--- title: "Generating AutoCAD Drawing" slug: "generating-autocad-drawing" description: "Use this extension point to generate an AutoCAD drawing based on the quote structure." updated: 2026-06-02T14:07:41Z published: 2026-06-02T14:07:41Z canonical: "docs.zilliant.com/generating-autocad-drawing" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.zilliant.com/llms.txt > Use this file to discover all available pages before exploring further. # Generating AutoCAD Drawing ## Purpose Allows you to run a script to generate an AutoCAD drawing based on the quote structure. A script must include the business logic for creating the drawing, and indicate whether to represent each line item in it. ## Setup To set up the extension point, follow these steps: 1. [Enable the AutoCAD functionality.](/docs/generating-autocad-drawing#enable-the-autocad-functionality) 2. [Add your credentials to the properties file.](/docs/generating-autocad-drawing#add-credentials-to-the-properties-file) 3. [Upload base AutoCAD drawings.](/main/docs/generating-autocad-drawing#upload-base-autocad-drawings) 4. [Create a Groovy script.](/main/docs/generating-autocad-drawing#create-a-groovy-script) ### Enable the AutoCAD functionality Zilliant CPQ's AutoCAD functionality is powered by the Autodesk Forge platform. Contact your Zilliant representative to create an Autodesk Forge subscription and enable the AutoCAD functionality in your environment. ### Add credentials to the properties file After creating an Autodesk Forge subscription, add your credentials to the [**application.properties** file](/main/docs/general-property-and-ontology-files) using the variables from the table below. Then restart the server. | Variable name | Description | | --- | --- | | autodesk.client_id | Client ID of the Forge app. | | autodesk.client_secret | Client secret of the Forge app. | | autodesk.engine_version | AutoCAD version you want to use. | ### Upload base AutoCAD drawings The system doesn't generate AutoCAD drawings from scratch. It creates the final output by combining multiple existing drawings with dynamically generated elements like text. Each of these drawings can either be stored as separate files or as predefined blocks in a file. Before the script can use these components, you must upload files containing the drawings or blocks. The supported file format is **.dwg**. To upload the base drawings, follow these steps: 1. From the application left navigation area, select **Model**. 2. From the top navigation bar, select **AutoCAD Management**. 3. Select **+** to upload a **.dwg** file. ### Create a Groovy script [Create a Groovy script](/docs/upload-a-groovy-script) in Zilliant CPQ by making the following selections: - Select **Generate Autocad Drawing** as the script type. - In the **Base DWG File** field, select a **.dwg** file based on which you want to create drawings. Note All elements of the selected **.dwg** file are included in all drawings generated with this script. Additionally, you can use all blocks defined in this file for the drawing composition. ## Binding variables In addition to the [common binding variables](/docs/binding-variables), the following binding variables are available for this extension point. | Variable name | Class | Description | | --- | --- | --- | | salesItemsTree | SalesItemsTree | Represents the quote. Contains functions you can use to query and modify the quote and its line items. | | drawingTitle | String | AutoCAD drawing name as defined while creating it. | | drawingNumber | Integer | Unique running number for the drawing that will be autogenerated by the system. | For details about the classes listed in this table, including available methods, fields, and method signatures, read the [Zilliant Groovy API reference](/main/docs/groovy-api-reference). ## Expected output The script should return one of the following objects: - `AutocadScript` - `List<AutocadScript>` - `Map<String, List<AutocadScript>>` Each AutocadScript object corresponds to a **.scr** script file, which is executed against a base file to generate a drawing. If the script returns a list, it means that it created multiple drawings. If the script returns a map, it means that it created several groups of drawings. The system supports only 2D drawings. They are represented by the **AutocadScript2D** class that allows you to perform the following actions: - Insert a predefined block from the base **.dwg** file with an ability to rotate and scale it. Additionally, you can set attribute values for the block. - Insert a drawing from an uploaded file with an ability to rotate and scale it. - Add text. - Insert aligned dimension measurements. - Draw straight lines. Additionally, you can add arbitrary commands. You can use any command that can be executed in a **.scr** script and run successfully in the AutoCAD desktop application. This allows you to use features that are not directly supported by the system. ## Script execution A user must manually run the script when creating an AutoCAD drawing. To execute the script, follow these steps: 1. [Open a quote](/docs/manage-quotes#open-quotes). 2. On the **AutoCAD** tab, select **+** to create a drawing. Enter information or make selections: - **Title**—Drawing name. To automatically generate drawing names, read [the corresponding section below](/docs/generating-autocad-drawing#automatically-generate-names-for-drawings). - **View Type**—Select a Groovy script of the **Generate Autocad Drawing** type to create a drawing. - **Select Item to Draw**—Select at least one sales item to generate a drawing. 3. Select **Create**. 4. (Optional.) You can download or view a generated drawing on the **AutoCAD** tab: - To download a **.dwg** file, select **Download** in the **DWG File** column. - To download a **.pdf** file, select **Download** in the **PDF File** column. - To view a drawing, select **View** in the **Open in Viewer** column. The drawings appear on the **AutoCAD** tab in a quote. - If the script returns the `AutocadScript` object or the `List<AutocadScript>` object, drawings are added to a group with the name matching the defined drawing title. - If the script returns the `Map<String, List<AutocadScript>>` object, each entry in the map becomes a group. ### Automatically generate names for drawings You can configure the AutoCAD names for drawings to be automatically generated every time you create a new drawing in a quote. To do this, follow these steps: 1. From the application left navigation area, select **Administration**. 2. From the top navigation bar, select **Master Data Management**. 3. Scroll or search to locate **Setting String** and select it from the list. 4. Select a scenario for which to define the name format: - **The format for AutoCAD drawing title when all sales items are selected** - **The format for AutoCAD drawing title when only one or a few sales items are selected** 5. In the **Setting Value String** field, use the following parameters to define the name format: - {QUOTE_ID} - {QUOTE_TITLE} - {VERSION} - {OBJECT_NAMES}