What is extension?
Next Design allows users to freely extend the functionality by using the API provided by Next Design from a programming language. These individual features are called extensions. By developing the Next Design extension, you can achieve the following additional features:
- You can implement a verification function that verifies the integrity of the designed model and presents errors and warnings.
- You can develop your own import/export functions such as importing existing assets from documents, generating data for simulation, and outputting documents in your own format.
- A tool chain can be realized by linking data with external tools.
Features
The Next Design extension has the following features:
Development with scripts and DLLs
The extension development language uses C#. It has been refined as a language, and in recent years it has become more open and can be used on Linux/Mac and mobile. There are two types of extension mounting methods, which can be selected for each extension.
- Implementation method to compile from C# to .NET DLL (recommended)
- Implementation method using C# script
The Next Design extension works very lightly because it is dynamically compiled at runtime even in a script, but development with a DLL has a rich library, and considering ease of debugging and maintainability, it is a DLL. We recommend the development of. With the .NET DLL method implementation method, advanced function extensions such as event handling and UI extension are also possible. See Scripts and DLLs for more information.
//Command handler
public void SayHello (ICommandContext context, ICommandParams commandParams)
{
App.Window.UI.ShowInformationDialog ("Hello!", "Hello World");
}
Expansion point
Extension points are UIs and events that are extended by extensions. That file is called the Manifest File (hereafter referred to simply as the Manifest). The extension point is defined in Json as follows.
"extensionPoints": {
"commands": [
{
"id": "Command.SayHello",
"execFunc": "SayHello"
}
],,
...
}
- You can expand the function by adding buttons etc. to the ribbon (menu).
- You can receive events such as model editing operations and file operations, and use those events to extend the functionality.
- Ribbon and event definitions extended by extensions are read from the manifest described for each extension.
Extension life cycle
Extensions can be enabled as soon as the application is launched, or extensions can be enabled depending on the profile of the project. You can also enable multiple extensions for one profile.
Operation by API
You can access various information of the application and operate the user interface through the API of Next Design. For example, the following operations are possible.
//Open the project file
Workspace.OpenProject (filePath);
//Get all the elements of the project
var project = CurrentProject;
var children = project.GetAllChildren ();
//Output the name of the descendant element to the output tab of the info window
foreach (var child in children)
{
Output.WriteLine ("sample", child.Name);
}
//Activate the Output tab of the Info window
Window.EditorPage.ActiveInfoWindow = "Output";
Window.EditorPage.CurrentOutputCategory = "sample";
Window.IsInformationPaneVisible = true;
- Open a project, create a new one, save it.
- Get or modify the selected model of the application.
- Access model information to add or update new models.
- Display a message at the error location by validating the model and setting error information for each model.
Multilingual
- Provides a multilingual mechanism to switch the display language of the extension in conjunction with the display language switch in the Next Design option.
{
"locale": "ja",
"resourceStrings": {
"MyExt.Tab.Label": "Extension",
"MyExt.ValidationGroup.Label": "Model Validation",
"MyExt.ValidationButton.Label": "Validation",
"MyExt.ValidationButton.Description": "Validate all models.",,
"MyExt.Error.CanNotBeEmpty.Title": "Cannot empty",
"MyExt.Error.CanNotBeEmpty.Message": "Name field cannot be empty",
"MyExt.Error.CanNotChange.Message2": "{0} cannot be {1}"
}
}