Skip to main content

What is an extension?

With Next Design, users can freely extend functions by using the API provided by Next Design from a programming language. These individual functions are called extensions. By developing extensions for Next Design, the following additional functions can be realized.

  • Validate the integrity of the designed model and implement validation functions that present 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 data linkage with external tools.

Features

The Next Design extension has the following features:

Development with scripts and DLLs

Extension development language is C#. It has become more sophisticated as a language, and in recent years it has become more open and can run on Linux/Mac and mobile devices. There are two types of extension implementation methods, which can be selected for each extension.

  • How to implement compiling from C# to .NET DLL (recommended)
  • Implementation method by C# script

Next Design's extensions are dynamically compiled at runtime, even in scripts, so they work very lightly. development is recommended. The .NET DLL method of implementation enables advanced functional extensions such as event processing and UI extensions. See Scripts and DLLs for more information.

//command handler
public void SayHello(ICommandContext context,ICommandParams commandParams)
{
App.Window.UI.ShowInformationDialog("Hello !","Hello World");
}

Extension points

An extension point is a UI or event that you extend with an extension. This file is called a manifest file (hereafter simply referred to as manifest). Extension points are defined in Json as follows.

manifest.json
  "extensionPoints": {
"commands": [
{
"id": "Command.SayHello",
"execFunc": "SayHello"
}
],
...
}
  • Functions can be expanded by adding buttons to the ribbon (menu).
  • You can receive events such as model editing operations and file operations, and use those events to extend the functionality.
  • Ribbons and event definitions extended by extensions are read from a manifest that is written for each extension.

Extension Lifecycle

Extensions can be enabled as soon as the application starts, or extensions can be enabled according to the project's profile. Also, you can enable multiple extensions for one profile.

Operation by API

You can access various information of the application through Next Design's API and operate the user interface. For example, you can do the following:

API call example
//open the project file
var filePath = "xxx.nproj";
Workspace.OpenProject(filePath);

//get all the elements of the project
var project = CurrentProject;
var children = project.GetAllChildren();

//prints the names of descendant elements 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. ActiveInfoWindow = "Output";
Window.CurrentOutputCategory = "sample";
  • Open, create new, and save projects.
  • Get and change the model selected by the application.
  • Access model information to add new or update models.
  • Validate the model and set error information for each model to display a message at the error location.

Multilingual

  • Provides a multilingual mechanism to switch the display language of the extension in conjunction with the display language switching in the Next Design options.
locale.ja.json
{
"locale": "en",
"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 be empty",
"MyExt.Error.CanNotBeEmpty.Message": "Name field cannot be empty",
"MyExt.Error.CanNotChange.Message2": "{0} cannot be {1}"
}
}