This feature allows the user to generate an AutoCAD drawing based on the quote structure. The business logic of how, if each line item should be represented in the drawing, will need to be defined in a custom script.
Initial Setup
- The AutoCAD functionality in the Digital Sales Platform is powered by the Autodesk Forge platform. As this is a paid service that is external to our platform, please contact us to discuss enabling this functionality. Once the subscription to the Forge platform has been sorted out, put the credentials in the application.properties file and restart the server.
Variable Name
Description
autodesk.client_id
The Client ID of the Forge App
autodesk.client_secret
The Client Secret of the Forge App
autodesk.engine_version
The AutoCAD version to use. At the time of writing, the following values are accepted:
· 20.0 (i.e. AutoCAD 2015)
· 20.1 (i.e. AutoCAD 2016)
· 21.0 (i.e. AutoCAD 2017)
· 22.0 (i.e. AutoCAD 2018)
· 23.0 (i.e. AutoCAD 2019)
Note that the supported versions may change at any time and is not under InMind’s control.
- This feature does not generate AutoCAD drawing from scratch. Instead, it composes the final output from multiple existing drawings, with the addition of some simpler dynamically generated contents such as texts. Each existing drawing can be its own separate file, or it can exist as a predefined block in a file. Either way, the files containing the drawing or block has to be uploaded first before the script can make use of them. This can be done from Model > AutoCAD Management screen. The accepted file extension is dwg.
- Create a new Groovy Script with the type “Autocad”. Please refer to Groovy Service Introduction - Uploading a New Groovy Script for more details of how to do this.
Once “Generate Autocad Drawing” is selected as the Type, the field “Base DWG File” will be shown. The files that were uploaded in the previous step will be available for selection here. Select the file that would act as the base for the drawing generation, i.e. anything already drawn on this file will automatically be included in the output (for example, this can be used for including a title block in all drawings), and all blocks defined in this file can be used for the drawing composition.
Additional Binding Variables
The following binding variable(s) are made available for this extension point, in addition to the common binding variables listed in Groovy Service Introduction - Common Binding Variables.
Variable Name |
Class |
Description |
---|---|---|
salesItemsTree |
SalesItemsTree |
Represents the Quote, it contains the functions that can be used to query the quote and its line items data as well as to modify them. |
drawingTitle |
String |
The title of the AutoCAD Drawing, as specified on the dialog when generating it. |
drawingNumber |
Integer |
A unique running number for the drawing that will be auto-generated by the system. |
Expected Output
The script may return 3 different types of output:
- an AutocadScript object
- a List<AutocadScript> object
- a Map<String, List<AutocadScript>> object
Each AutocadScript object represents a “.scr” script file that would be executed on the base file to create one output drawing. Thus, when a list is returned, it represented that the script generated more than 1 drawing, and for the map, it means that the script generated several groups of drawings.
Currently, only 2D drawings are supported, which is represented by the AutocadScript2D class (support for 3D or other types of drawing may be added at a future date). This class currently supports the following operations:
- Inserting a block that has been predefined in the base dwg file at a given position. The block can be rotated or scaled as it is inserted. The block can also have its attribute values set.
- Inserting a drawing from a file that has been uploaded into the system at a given position. The drawing can be rotated or scaled as it is inserted.
- Inserting a text at a given position.
- Inserting an aligned dimension measurement.
- Drawing an arbitrary straight line.
For the details of these operations, please consult the Javadoc.
It is also possible to insert an arbitrary command. Anything that could be used in a “.scr” script file and executed that way successfully in the AutoCAD desktop application could also be used here. Thus, if there is any feature that is available in AutoCAD but not supported directly, the feature can still be used using the arbitrary command.
Script Execution
For this extension point, the script to execute can be selected during the AutoCAD Drawing generation process:
- Open a Quote, then go to the AutoCAD tab.
- Click on the plus icon to generate a new AutoCAD Drawing. The Create AutoCAD Drawing pop-up will be displayed.
- The Create AutoCAD Drawing pop-up contains the following components. Specify their values as desired and click on the Create button.
- Title field. This field can be setup to be automatically populated based on the Quote attributes, in Administration > Master Data Management > Setting String, using the settings “The format for AutoCAD drawing title when all sales items are selected” and “The format for AutoCAD drawing title when only one or a few sales items are selected”.
- The View Type drop-down will list the Groovy Scripts that has the type “Generate Autocad Drawing”. The selected script will be used to generate the drawing, and the script name will be displayed as the “View Type” in this screen
- The top-level sales items in the quote are listed here. You can choose to generate the drawing only for some selected items, or for all of them at once.
- The drawing(s) will be generated by calling on the Forge platform according to the output of the selected script. Once that is done, the Quote Autocad screen will be refreshed to show the newly generated AutoCAD Drawing. Click on the row to view the Drawing Group list for that drawing.
If the output of the script is an AutocadScript or a List<AutocadScript> object, they will be automatically assigned into a group with the same name as the Drawing Title. If the output of the script is a Map<String, List<AutocadScript>> object, each entry in the map will become a group, with the group name being the key. Clicking on the Download button under the “DWG file” column will download a zip file containing all the generated dwg files in the group. Clicking on the Download button under the “PDF file” column will download a multi-page PDF file containing all the generated pages in the group.
- Clicking on one of the AutoCAD Drawing Group rows will display the list of pages within that group. Click on the Download buttons to download the file for that individual page, either in dwg or pdf format. Clicking on the View button will open an online viewer for the page