FormIt for Windows
English
English
  • Introduction
  • What's New
  • FormIt Capabilities
    • Multiple Clients
    • Conceptual Solid Modeling
    • Working with Data Formats
    • Languages
    • Collaboration
    • Presentation Graphics
    • FormIt + Autodesk Docs
    • FormIt + Dynamo
    • Solar + Energy Analysis
    • FormIt + Revit
    • FormIt + JavaScript for Plugins
  • FormIt Introduction
    • Frequently Asked Questions
    • Prerequisites and Installation
    • Setting Up the Project
    • Toolbars and Palettes
    • Navigating the Scene
  • FormIt Primer
    • Part I
      • 1.1 - Set the Location
      • 1.2 - Project Set Up with Images and Grid
      • 1.3 - 3D Sketch and Drag Face
      • 1.4 - Add Floors with Levels
      • 1.5 - Group Objects
      • 1.6 - Control Visibility with Layers
      • 1.7 - Paint with Materials
      • 1.8 - Create Columns with Array
      • 1.9 - Adding Details
      • 1.10 - Computational Groups with Dynamo
      • 1.11 - Import Models with Content Library
      • 1.12 - Visual Styles
      • 1.13 - Section Planes
      • 1.14 - Export Image
      • 1.15 - Working With Revit
    • Part II
      • 2.1 - Offset Line Tool
      • 2.2 - Advanced Modeling Tools: Shell and Cover
      • 2.3 Orthographic View Workflow
      • 2.4 - 3D Terrain Workflows
      • 2.5 - Plugins
      • 2.6 - Dynamo FormIt Nodes
      • 2.7 - Diagnostics Tools
      • 2.8 - Advanced Revit Workflows
      • 2.9 - Solar and Insight Energy Analysis
      • 2.10 - Collaboration Sessions
  • Tool Library
    • 3D Text
    • Align Camera With Face
    • Arc
    • Array
    • Array Along Path
    • AutoSave
    • Boolean Cut
    • Boolean Intersect
    • Boolean Join
    • Circle
    • Collaboration
    • Content Library
    • Copy Object
    • Cover, Sweep, Loft
    • Create Panorama
    • Curve + Surface Faceting
    • Delete, Edit, Move
    • Dynamo
    • Energy Analysis with Insight
    • Faces: Extrude, Cut and Offset
    • Faces: Flatten
    • Faces: Tilt and Facet/Smooth
    • Groups Tree
    • Groups
    • Import and Export Data
    • Layers
    • Levels and Area
    • Lines
    • Materials
    • Measure Angle
    • Measure
    • Meshes
    • Mirror
    • Model Statistics
    • Model Tree
    • Modifying Faces, Edges, and Points
    • Non-Uniform Scale
    • Offset Line
    • Orthographic Views
    • Orthographic and Perspective Camera
    • Placing Primitives
    • Place Vertex
    • Plugins
    • Polygon
    • Properties
    • Railing Along Path
    • Rectangle
    • Revit
    • Rotate Object
    • Scale Object
    • Scenes
    • Section Planes
    • Selection
    • Setting Location
    • Sun + Shadows
    • Shell
    • Snaps and Inferences
    • Solar Analysis
    • Spline
    • Storefront/Curtainwall Mullion System
    • Undo Manager
    • Visual Styles
    • Work Planes
    • World Axes
  • Plugins
    • Introduction to Plugins
    • How to Use Plugins
    • How to Develop Plugins
      • Your First Plugin
        • Plugin Playground
        • Launching the Sample Plugin
        • Adding Your Own Features
        • Saving Your Work to GitHub
        • Publishing Your Project
      • Advanced Development
        • Using an IDE
        • Cloning a Sample Plugin
        • Hosting a Plugin on a Local Server
        • Previewing a Plugin in the Plugin Manager
        • Setting Up FormIt for Development
        • Hosting a Plugin on GitHub
        • General Plugin Setup in the Manifest
        • Reloading for Local Changes
        • Client-Side vs Web-Side Engines
        • Debugging
        • Versioning
      • Additional Development Options
        • Creating an HTML Panel Plugin
        • Creating a Combined HTML Panel and Toolbar Plugin
        • Creating a Toolbar-Based Plugin
        • Testing a Combined HTML Panel and Toolbar Plugin
        • Creating an Add-In
        • Invoking Plugins and API from Dynamo
    • FormIt APIs
    • Examples
      • Generate String Lights
      • Manage Cameras Plugin
      • Properties Plus Plugin
      • 3D Context Creator
      • FormIt Plugin Community
  • Appendix
    • Keyboard Shortcuts
Powered by GitBook
On this page
Edit on GitHub
  1. Plugins
  2. How to Develop Plugins
  3. Additional Development Options

Creating an Add-In

PreviousTesting a Combined HTML Panel and Toolbar PluginNextInvoking Plugins and API from Dynamo

Last updated 3 years ago

An Add-In is a plugin that also loads DLLs that expose new JavaScript APIs.

Download FormIt API

To build DLLs that support FormIt, the FormIt API is needed. The FormIt API can be downloaded from the . A login is needed to access the download.

Once logged in, the FormIt API is available under SOFTWARE.

An add-in has the following structure:

            // FormIt looks for REGISTERAPIMETHODS to load new JS APIs
            REGISTERAPIMETHODS
            {
                // Declare new namespace for the new JS APIs
                REGISTERNAMESPACE("HelloDLL")
                // Create a JS API with no arguments
                APIMETHOD(HelloDLL, API1, "") {}
                // Create a JS API with 1 argument
                APIMETHOD(HelloDLL, API2, "arg1") {}
                // Create a JS API with 2 argument
                APIMETHOD(HelloDLL, API3, "arg1, arg2") {}
                ...
                ...
            }
        

To get the arguements into C++ variables use SCRIPTCONVERTER-

            // Create a JS API with 2 argument
            APIMETHOD(HelloDLL, API3, "arg1, arg2")
            {
                // NOTE: The arg names above ^^^^ have to match the args in the macros below.
                // arg1 expects a bool
                SCRIPTCONVERTER(bool, arg1);
                // arg2 expects an int
                SCRIPTCONVERTER(int, arg2);
                return JSON_UNDEFINED;
            }
        

Either JSON_UNDEFINED or any json object can be returned. Use to_json to convert your C++ variable to json

            // Create a JS API with 2 argument
            APIMETHOD(HelloDLL, API3, "arg1, arg2")
            {
                // NOTE: The arg names above ^^^^ have to match the args in the macros below.
                // arg1 expects a bool
                SCRIPTCONVERTER(bool, arg1);
                // arg2 expects an int
                SCRIPTCONVERTER(int, arg2);

                std::string myValue = "Test";
                return to_json(myValue);
            }
        
        "DLLs" : ["PLUGINLOCATION/MyClass.dll", "PLUGINLOCATION/HelloDLL.dll"]
        

An Add-In has access to the and .

Once the DLL is defining all the needed JS APIs, the plugin must tell FormIt what DLLs need loaded. This is done in the .

is a working example that explains how to make an Add-In.

is a working example that explains how to make an Add-In with the .

FormIt API
FormIt Modeling Kernel C++ API
manifest
HelloAddIn
HelloWSMAddIn
FormIt Modeling Kernel C++ API
Autdesk Developers Network