Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
amillsLD4X8
490 Views, 5 Replies

How to interpret length values in inches, not centimeters?

Why does Inventor interpret my dimension values in units of "cm" and not "in"? 

All I'm trying to do in the code below is draw a circle with a diameter of 120 in. But it creates a circle with diameter of 47.244 in. It looks like Inventor is taking my 120 in "cm" and then by dividing by 2.54 to converting to "cm". Is there away to tell Inventor that the 120 is already in inches? 

I thought line 17 would tell the document to interpret length values in "in", but it doesn't look like that is happening.  

 

Thank you for the help.

Sub BuildPart()

'Get value from user input
Dim circleRadius As Double
circleID = 120

'Define Inventor Document
Dim app As Application
Set app = Inventor.ThisApplication
Dim partDoc As Document

Set partDoc = app.Documents.Add(kPartDocumentObject, ThisApplication.FileManager.GetTemplateFile(kPartDocumentObject))
Set compDef = partDoc.ComponentDefinition
Set tG = app.TransientGeometry

'Change units of document
partDoc.UnitsOfMeasure.LengthUnits = UnitsTypeEnum.kInchLengthUnits

'Create sketch
Dim baseSketch As PlanarSketch
Set baseSketch = compDef.Sketches.Add(compDef.WorkPlanes.Item(2))

'Create circle in sketch
Dim tankID As SketchCircle
Set tankID = baseSketch.SketchCircles.AddByCenterRadius(tG.CreatePoint2d(0, 0), circleID / 2)

End Sub

 

 

 

amillsLD4X8_0-1682691655965.png