How can I set the .stil import unit system (Spaceclaim/Discovery)

Mike.Thompson
Member, Employee Posts: 391
✭✭✭✭
How can I use the document insert API to insert an stl but specify the unit system to use for that file?
Options = ImportOptions.Create()
Options.Stl.Units=??
Tagged:
0
Best Answers
-
According to the API documentation,
StlImportOptions.Units Property
should provide support to STL unit change.
Please, check the documentation for full information on this property (commonly it is found in your local installation e.g. "C:\Program Files\ANSYS Inc\v242\scdm\SpaceClaim.Api.V242\API_Combined_Class_Library.chm" )1 -
Below is small example that does this:
file='D:\deformed.stl' from SpaceClaim.Api.V232 import * #a=MetricUnits(MetricLengthUnit.Millimeters,MetricMassUnit.Kilograms, AngleUnit.Degrees) a=MetricUnits(MetricLengthUnit.Meters,MetricMassUnit.Kilograms, AngleUnit.Degrees) #a=ImperialUnits(ImperialLengthUnit.Inches,ImperialMassUnit.Pounds,AngleUnit.Degrees) # Open Document: deformed.stl importOptions = ImportOptions.Create() importOptions.Stl.Units=a DocumentOpen.Execute(r"D:\deformed.stl", importOptions)
1