> For the complete documentation index, see [llms.txt](https://windows.help.formit.autodesk.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://windows.help.formit.autodesk.com/it/plugins/how-to-develop-plugins/additional-development-options/creating-an-add-in.md).

# Creazione di un modulo aggiuntivo

Un modulo aggiuntivo è un plug-in che carica anche le DLL che espongono nuove API JavaScript.

### Download dell'API di FormIt

Per creare DLL che supportino FormIt, è necessaria l'API di FormIt. L'API di FormIt può essere scaricata da [Autodesk Developers Network](https://www.autodesk.com/developer-network/overview). Per accedere al download, è necessario eseguire l'accesso.

Una volta eseguito l'accesso, l'API di FormIt è disponibile in SOFTWARE.

![](https://formit3d.github.io/FormItExamplePlugins/docs/images/FormItAPIDownload.jpg)

![](https://formit3d.github.io/FormItExamplePlugins/docs/images/FormItAPIMenuItem.jpg)

Un modulo aggiuntivo dispone dell'accesso all'[API di FormIt](https://formit3d.github.io/FormItExamplePlugins/docs/FormItCPPAPI/index.html) e all'[API C++ del kernel di modellazione di FormIt](https://formit3d.github.io/FormItExamplePlugins/docs/FormItCPPAPI/group__mod__wsm__api__ref.html).

Un modulo aggiuntivo presenta la seguente struttura:

```
            // 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") {}
                ...
                ...
            }
```

Per ottenere gli argomenti nelle variabili C++, utilizzare 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;
            }
```

Può essere restituito JSON\_UNDEFINED o qualsiasi oggetto JSON. Utilizzare to\_json per convertire la variabile C++ in 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);
            }
```

Una volta definite tutte le API JS necessarie tramite la DLL, il plug-in deve indicare a FormIt quali DLL devono essere caricate. Questa operazione viene eseguita nel file [manifesto](https://github.com/FormIt3D/HelloAddIn/blob/main/v22_0/manifest.json#L8).

```
        "DLLs" : ["PLUGINLOCATION/MyClass.dll", "PLUGINLOCATION/HelloDLL.dll"]
```

[HelloAddIn](https://github.com/FormIt3D/HelloAddIn) è un esempio pratico che spiega come creare un modulo aggiuntivo.

[HelloWSMAddIn](https://github.com/FormIt3D/HelloWSMAddIn) è un esempio pratico che spiega come creare un modulo aggiuntivo con l'[API C++ del kernel di modellazione di FormIt](https://formit3d.github.io/FormItExamplePlugins/docs/FormItCPPAPI/group__mod__wsm__api__ref.html).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://windows.help.formit.autodesk.com/it/plugins/how-to-develop-plugins/additional-development-options/creating-an-add-in.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
