im trying to draw a sketch line and when my code is ran it draws the line but in cm not inches. heres my code...
Dim oLines(0 To 3) AsSketchLine
oLines(0) = oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(0, 2))
when this runs i have a line thats 0.7874 inches, instead of 2 inches. how do i set the UOM so inventor knows i mean inches?
Here is a generic example of how you might use one of the methods in the UnitsOfMeasure object to get what you are after.
' Get UOM object from the document with something like
Dim uom As UnitsOfMeasure
uom = <doc>.UnitsOfMeasure
' Get converted value (does not have to be done outside of AddByTwoPoints call, just for clarity sakes
Dim maxY As Double
' Convert 2" to cm (database length units)
maxY = uom.ConvertUnits(2.0, UnitsTypeEnum.kInchLengthUnits, UnitsTypeEnum.kDatabaseLengthUnits)
' Call the line creation method with the value converted to the required cm's
Dim oLines(0 To 3) As SketchLine
oLines(0) = oSketch.SketchLines.AddByTwoPoints(oTG.CreatePoint2d(0, 0), oTG.CreatePoint2d(0, maxY))
Neil