I'm trying to write a macro (in VB.Net) that will select all the arcs in a sketch then add a Equal Relation to them.
Does anybody have any suggestions on how to do it?
ISketch.GetArcs2 returns an array - no names
This works while the sketch is active. Try it on the attached part.
Partial Class SolidWorksMacro
Public Sub main()
Dim swModel As ModelDoc2
Dim swSketch As Sketch
Dim vSketchSegs As Object
Dim swSketchSeg As SketchSegment
swModel = swApp.ActiveDoc
swSketch = swModel.SketchManager.ActiveSketch
vSketchSegs = swSketch.GetSketchSegments
For i As Integer = 0 To UBound(vSketchSegs)
swSketchSeg = vSketchSegs(i)
If swSketchSeg.GetType = swSketchSegments_e.swSketchARC Then
Public swApp As SldWorks
Video Tutorials for the SolidWorks API
Who cares if there's no names? You have the entities themselves. Just select them with .Select
Never look at SolidWorks recorded macros. Well, almost never. They are garbage. 99.9% of the time, whatever gets recorded is not the way you want to do any of what you want to do.
Retrieving data ...