Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 516

Understanding STL Translator Options and Value Types in Inventor API

$
0
0

by Chandra shekar Gopal,

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.

Untitled

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:

Screenshot 2025-01-04 002343

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
const int HIGH_SUR_DEV = 5;
const int HIGH_NOR_DEV = 1000; // (10 degrees)
const int HIGH_MAX_EDGE_LEN = MAX_EDGE_LENGTH_SLIDER_MAX; // (100.0)
const int HIGH_ASPECT_RATIO = ASPECT_RATIO_SLIDER_MAX; // (21.5)

// Medium resolution defaults
const int MEDI_SUR_DEV = 16;
const int MEDI_NOR_DEV = 1500; // (15 degrees)
const int MEDI_MAX_EDGE_LEN = MAX_EDGE_LENGTH_SLIDER_MAX; // (100.0)
const int MEDI_ASPECT_RATIO = ASPECT_RATIO_SLIDER_MAX; // (21.5)

// Low resolution defaults
const int LOW_SUR_DEV = 40;
const int LOW_NOR_DEV = 3000; // (30 degrees)
const int LOW_MAX_EDGE_LEN = MAX_EDGE_LENGTH_SLIDER_MAX; // (100.0)
const int LOW_ASPECT_RATIO = ASPECT_RATIO_SLIDER_MAX; // (21.5)

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.


Viewing all articles
Browse latest Browse all 516

Trending Articles