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

  1. 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 2017" or "Visual Studio Express 2017 for Windows Desktop" is published for free. Download and install either of them.
  2. Click [File] - [New] - [Project] menus, or [File] - [New Project] menus.
    [New Project] dialog box will be displayed.
  3. When a box to select a target version of .NET Framework is displayed at the top of the [New Project] dialog box, select [.NET Framework 4.6].
    Supplemental
    In "Visual Studio Express for Windows Desktop," this box will not be displayed, so it is not necessary to modify.
    If only versions before [.NET Framework 4.5] are displayed in the box in "Visual Studio 2013", download and install ".NET Framework 4.6 Targeting Pack".
    Downloading ".NET Framework 4.6 Targeting Pack"
  4. Click [Template] - [Visual C#] (or Visual Basic) - [RootPro CAD] on the left tree, and select [RootPro CAD 9 Add-ins].
    Supplemental
    When RootPro CAD templates are not displayed, start up by selecting [Add-ins] - [Launch Visual Studio] menus in RootPro CAD, rather than starting up Visual Studio from Start Menu of Windows.
    Starting up Visual Studio in RootPro CAD will install the RootPro CAD template.
    Next time and onward, you can start up Visual Studio from Start Menu of Windows.
  5. 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"
  6. Click [OK].
    The project will be created.

Describing code

  1. 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# ]
    private void AppAddIn_Startup(object sender, EventArgs e)
    { 
    	// The following line will be added. 
    	MessageBox.Show("The add-in has been imported.") ; 
    }
    [For Visual Basic]
    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)

  1. Click [Build] - [Build Solution] menus.
    The project's build will be executed to generate an add-in file (with the extension of .dll).
  2. 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

  1. If the build succeeds, click [Debug] - [Start Debugging].
    RootPro CAD will start up.
  2. Click [Add-in Manager] on [Add-ins] menu in RootPro CAD.
    [Add-in/Script Manager] dialog box will be displayed.
  3. 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].
  4. 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.
  5. After checking the add-in works correctly, exit RootPro CAD.
  6. 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.
Normally, it is the folder with the same name as an add-in in [Visual Studio 2017\Projects], [Visual Studio 2015\Projects] or [Visual Studio 2013\Projects] in Document folder.
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

  1. 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.
  2. 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.
  3. The add-in copied will be displayed in [Addin List]. Click [Enable].
  4. Click [Close].
    The add-in will be imported and become executable.

Deleting add-in created

  1. Click [Add-in Manager] on [Add-ins] menu.
    [Add-in/Script Manager] dialog box will be displayed.
  2. Select [Add-in] - [Installed] in the menu on the left, Click [Uninstall] of the add-in to be deleted in the add-in list.
  3. Click [Close].
  4. Restart RootPro CAD.
  5. 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.

Related topics