sketch like created by vba, the dimension is 10x longer than actual length

sketch like created by vba, the dimension is 10x longer than actual length

Anonymous
Not applicable
729 Views
2 Replies
Message 1 of 3

sketch like created by vba, the dimension is 10x longer than actual length

Anonymous
Not applicable

I created a sketch line with following vba codes. When I measure the length on Inventor, the length is 10x longer than the actual length. (measured 14.142, it should be 1.4142). Anything wrong?

----------------

Sub Test()
Dim app As Application
Dim doc As Document

Set app = ThisApplication
Set doc = app.ActiveDocument
Dim partDef As PartComponentDefinition
Set partDef = doc.ComponentDefinition
Dim sk As PlanarSketch
Set sk = partDef.Sketches.Add(partDef.WorkPlanes(3))
sk.Edit
Dim tg As TransientGeometry
Set tg = app.TransientGeometry
Dim myStart As Point2d
Set myStart = tg.CreatePoint2d(0, 0)
Dim myEnd As Point2d
Set myEnd = tg.CreatePoint2d(1, 1)
Call sk.SketchLines.AddByTwoPoints(myStart, myEnd)
sk.ExitEdit

End Sub

0 Likes
Accepted solutions (2)
730 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor
Accepted solution

Internaly Inventor uses cm. i could not test Your code but i think that you need to convert Youri values from cm to mm

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 3

Anonymous
Not applicable
Accepted solution

I didn't know that. Thank you so much!

0 Likes