Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JelteDeJong
in reply to: Anonymous

this works for me. (it assumes that there are 2x 2d sketches with at least 1 line in them)

Dim doc As PartDocument = ThisDoc.Document
Dim def = doc.ComponentDefinition

Dim sketch1 As Sketch = def.Sketches.Item(1)
Dim sketch2 As Sketch = def.Sketches.Item(2)
Dim line1 = sketch1.SketchLines.Item(1)
Dim line2 = sketch2.SketchLines.Item(1)

Dim sketch3d As Sketch3D = def.Sketches3D.Add()


Dim p1 = line1.StartSketchPoint
Dim p2 = line2.StartSketchPoint
sketch3d.SketchLines3D.AddByTwoPoints(p1, p2)

' or the log way

Dim p3 = ThisApplication.TransientGeometry.CreatePoint(1, 1, 1)
Dim p4 = ThisApplication.TransientGeometry.CreatePoint(2, 2, 2)
Dim line As SketchLine3D = sketch3d.SketchLines3D.AddByTwoPoints(p3, p4)

line.StartSketchPoint.ConnectTo(line1.EndSketchPoint)
line.EndSketchPoint.ConnectTo(line2.EndSketchPoint)

 

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