Hi I am trying to write a ilogic code that will set the part precion to zero. I have a bunch of parts that shows 3 decimals and the rest are showing none, I need to change them all to 0.
I tried this code:
' iLogic rule to change linear dimension display to 0 in Document Settings Dim oDoc As Document = ThisDoc.Document ' Open Document Settings oDoc.Settings.EditDocumentSettings() ' Switch to Units tab Dim oDialog As PropertyManagerDialog = oDoc.Settings.GetPropertyManagerDialog() oDialog.GetControl("UnitsTab").Select() ' Set linear dimension display to 0 oDoc.Settings.GeneralOptions.ModelingDimensionDisplay = 0 ' Save and close Document Settings oDoc.Settings.Save() oDoc.Settings.Close()
But I get this erro line.
Hi @hEINSTEIN
Just curious as to how this code came about? The inventor API doesn’t list settings as a method see help page here for part document.
Can you supply an image of what settings your trying to change in the User Interface? I suspect you want to get to the units of measure but it’s only a guess at this stage.
Very creative code.
Please read the API help to find what's available.
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-CF60F6F3-8074-4719-B8E0-5E482E5AF783
You can set it with:
https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-3E732FB2-A8FA-4B89-BED0-03F5933DEBA1
UnitsOfMeasure.LengthDisplayPrecision = 0
Changing that setting only affect that part. It won't change any assembly or drawing.
You can open Templates and change it there if you want it in all new files.
Hi, try this code.
Dim oDoc As Document = ThisApplication.ActiveDocument Dim oUm As UnitsOfMeasure = oDoc.UnitsOfMeasure ' Get the current length units. Dim eLengthUnits As UnitsTypeEnum = oUm.LengthUnits oUm.LengthUnits = UnitsTypeEnum.kMillimeterLengthUnits oUm.LengthDisplayPrecision = 0
If a response answers your question, please use ACCEPT SOLUTION to assist other users later.
Also be generous with Likes! Thank you and enjoy!
Can't find what you're looking for? Ask the community or share your knowledge.