Creating Add-in
Using Visual Studio, a development tool by Microsoft, you can develop a new add-in with the following procedures.
Here, an add-in to display a message box will be created as a sample.
Creating an add-in project
- Start up RootPro CAD Professional, and click [Add-ins] - [Launch Visual Studio] menus.
Visual Studio will start up. When Visual Studio is not installed, Visual Studio website by Microsoft will be displayed where Visual Studio Community 2022 is published for free. Download and install either of them.
- Click [File] - [New] - [Project] menus, or [File] - [New Project] menus.
[New Project] dialog box will be displayed. - When a box to select a target version of .NET Framework is displayed at the [New Project] dialog box, select [.NET Framework 4.6.2].
- Enter "RootPro CAD" in the [Search Template] box or in the [Search] box to search and select [RootPro CAD Add-In (C#)] or [RootPro CAD Add-In (VB)] from the list.
- Input an add-in project name in [Name].
Use desired single-byte alphanumerics. For example, to create an add-in to draw a circle, input "RootProCADAddInCircle" - Click [OK].
The project will be created.
Describing code
- When a project is created, AppAddIn.cs file (or AppAddIn.vb for VB) will be automatically displayed. Add the following codes within AppAddINS_Startup function.
[For C# ]
[For Visual Basic]private void AppAddIn_Startup(object sender, EventArgs e) { // The following line will be added. MessageBox.Show("The add-in has been imported.") ; }
Private Sub AppAddIn_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup ' The following line will be added. MessageBox.Show("The add-in has been imported.") End Sub
Executing a build to create add-in file (with the extension of .dll)
- Click [Build] - [Build Solution] menus.
The project's build will be executed to generate an add-in file (with the extension of .dll). - When an error is displayed on Output Window or Error List Window, there is a mistake in code descriptions. Review codes, and execute the build again.
Executing debug to check that the add-in operates correctly
- If the build succeeds, click [Debug] - [Start Debugging].
RootPro CAD will start up. - Click [Add-in Manager] on [Add-ins] menu in RootPro CAD.
[Add-in/Script Manager] dialog box will be displayed. - When selecting [Add-in] - [Installed] in the menu on the left, the add-in you created will be displayed in the add-in list, so click [Enable].
- Click [Close].
The created add-in will be imported to RootPro CAD.
When the add-in is imported correctly, "The add-in has been imported." message box added by codes will be displayed. - After checking the add-in works correctly, exit RootPro CAD.
- Exit Visual Studio.
Saving location for add-in projects
A saving location for add-in projects can be specified on [New Project] dialog box to be displayed when creating a new project.
To modify the add-in code, start up Visual Studio and open a solution file (with the extension of .sln) in the folder.
Using the created add-in in other PCs
- Copy the folder add-ins are installed to another PC.
Add-ins are installed in a folder with the same name as an add-in in [RootPro CAD\AddIns] in Document folder.
Copy the folder to the same place in another PC. - Start up RootPro CAD, and click [Add-in Manager] on [Add-ins] menu in another PC.
[Add-in/Script Manager] dialog box will be displayed. - The add-in copied will be displayed in [Addin List]. Click [Enable].
- Click [Close].
The add-in will be imported and become executable.
Deleting add-in created
- Click [Add-in Manager] on [Add-ins] menu.
[Add-in/Script Manager] dialog box will be displayed. - Select [Add-in] - [Installed] in the menu on the left, Click [Uninstall] of the add-in to be deleted in the add-in list.
- Click [Close].
- Restart RootPro CAD.
Supplemental | |
▪ | To delete an add-in becoming unnecessary, delete the folder add-ins are installed on Windows Explorer. Add-ins are installed in a folder with the same name as an add-in in [RootPro CAD 8\AddIns] in Document folder. Deleting this folder completely deletes the add-in. |
Supplemental | |
▪ | Add-ins are only used in RootPro CAD Professional. RootPro CAD Free cannot use these functions. |