How do you collect two selected sketch points, get their sketch point2d geometry, and draw a line to connect the selected points.
Solved! Go to Solution.
Solved by JhoelForshav. Go to Solution.
Maybe having a look at this whould help?
Regards,
FINET L.
If this post solved your question, please kindly mark it as "Solution"
If this post helped out in any way to solve your question, please drop a "Like"Not exactly what I am looking for. That seems to work with given inputs. I am trying to have it use 2 selected points as my inputs. How do I grab the two selected or active points?
This is as close as I have gotten. I have to select the two points after I run it. I cannot figure out a way to work with preselected points.
Public Sub JoinPoints()
'set a reference to the active sketch.
Dim oSketch As PlanarSketch
Set oSketch = ThisApplication.ActiveEditObject
Dim oSketchPoints As SketchPoints
Set oSketchPoints = oSketch.SketchPoints
Dim skPoint As SketchPoint
Set skPoint = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchPointFilter, "Select point")
Dim skPoint2 As SketchPoint
Set skPoint2 = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kSketchPointFilter, "Select second point")
Dim oLines As SketchLine
Set oLines = oSketch.SketchLines.AddByTwoPoints(skPoint, skPoint2)
End Sub
If the points are selected they will be in the documents selectset. I wrote this macro for you. Make sure there are only two selected entities and that they are two sketchpoints in the same sketch 🙂
Public Sub JoinPoints()
Dim oSelSet As SelectSet
Set oSelSet = ThisApplication.ActiveDocument.SelectSet
If oSelSet.Count = 2 Then
If TypeOf oSelSet(1) Is SketchPoint And TypeOf oSelSet(2) Is SketchPoint Then
Call oSelSet(1).Parent.SketchLines.AddByTwoPoints(oSelSet(1), oSelSet(2))
End If
End If
End Sub
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website
Can't find what you're looking for? Ask the community or share your knowledge.