Hello world
Public sample
As a simple extension sample, let's take a look at an implementation example of an extension that displays a message with a button on the ribbon. This sample is available on GitHub.
External link: hello-world
Extension placement
Copy the hello-world
folder that contains the manifest.json
file directly under the following extensions
folder.
{User's home path}\AppData\Local\DENSO CREATE\Next Design\extensions\
Example user home path: C:\Users\user-name
If you want to create this extension yourself, follow the steps below.
- Create a
hello-world
folder directly under the aboveextensions
folder. - Create a
images
folder in thehello-world
folder and prepare aAbout.png
that will be the button image for the ribbon (32 x 32 images are recommended). - Create
manifest.json
andmain.cs
in thehello-world
folder.
manifest.json
This manifest defines one button on the ribbon and one command to execute on the button.
{
//Extension definition
"name": "Hello World",
"version": "1.1.0",
"publisher": "DENSO CREATE INC.",
"license": "Conforms to the Next Design License Agreement. Copyright (C) 2019 DENSO CREATE INC. All rights reserved.",
"main": "main.cs", //Specify a C# script as the entry point.
"lifecycle": "application", //Specify the application lifecycle as the lifecycle.
//Extension point definition
"extensionPoints": {
//Ribbon
"ribbon": {
"tabs": [
//Define the ribbon tab to add for the extension.
{
"id": "HelloWorld.MainTab",
"label": "Hello World",
"orderBefore": "System.View",
"groups": [
//Define a group that separates the ribbon tabs.
{
"id": "HelloWorld.FirstGroup",
"label": "Group 1",
"controls": [
//Define a Say Hello button.
{
"id": "HelloWorld.SayHelloButton",
"type": "Button",
"label": "Say Hello",
"imageLarge": "images/About.png",
"command": "Command.SayHello" //Specify the id of the command defined in the command described below.
}
]
}
]
}
]
},
//Command
"commands": [
//Define a command that calls the command handler `SayHello`.
{
"id": "Command.SayHello",
"execFunc": "SayHello" //Specifies the public function to be implemented at the entry point.
}
]
}
}
main.cs
This C# script, specified as the entry point in the manifest, implements a simple command handler to display the message.
//Command handler public function
public void SayHello (ICommandContext context, ICommandParams paramemters)
{
App.Window.UI.ShowInformationDialog ("Hello!", "Hello World");
}
Execute
When you start Next Design, you will see the ribbon as shown below.
When you click the Say Hello
button, the following message will be displayed.