When exporting files to STL format in Autodesk Inventor, users often come across different translator options. These include Surface Deviation, Normal Deviation, MaxEdgeLength, and Aspect Ratio, which are important parameters in defining the quality of the exported STL file. However, a common question that arises is the discrepancy between how these options are represented in the Inventor UI and how they are handled through the Inventor API.
The Question
In the Inventor User Interface (UI), the STL translator options—Surface Deviation, Normal Deviation, MaxEdgeLength, and Aspect Ratio—are accepted as double values. This means that you can input values with decimal precision for fine-tuning the export options, as shown in the UI settings.
However, the Inventor API documentation mentions that these same STL translator options are expected to be in integer format. This raises confusion, especially when developers are trying to pass these values through the API for automation or custom applications.
For clarity, here’s how the translator options and their expected value types are represented in the Inventor API documentation:
The Answer: Converting Double to Integer
To resolve the confusion, it is important to understand how the Inventor API processes these values. Typically, the STL translator internally converts the integer values to double types by dividing the integer value by 100.0. This approach allows for greater precision in the final output while still adhering to the integer input requirement in the API.
For example, if you input a value of 2000 for the Aspect Ratio in the API, it will be internally converted to 20.00 when applied in the STL translator. Additionally, if the input value exceeds the valid range, the translator will automatically default to the maximum allowable value (21.5).
Default Values and Resolution Settings
The Inventor API provides default values for different resolutions, which allow you to specify the level of detail in the exported STL file. These resolution settings are divided into High, Medium, and Low categories, as shown in the code snippet below:
// High resolution defaults // Medium resolution defaults // Low resolution defaults |
Key Points to Remember
- Maximum Edge Length and Aspect Ratio have default values of 100.0 and 21.5, respectively, across all resolutions (Low, Medium, and High).
- The Surface Deviation, Normal Deviation, MaxEdgeLength, and Aspect Ratio values are expected as integers in the API but are internally processed as doubles by dividing the integer values by 100.0.
- If input values exceed the specified range, the translator will default to the maximum allowed values.
By understanding how the Inventor API handles STL export settings, developers can more accurately configure and automate their workflows, ensuring that the exported STL files meet the desired quality requirements.