Hey all,
If I have multiple sketches (let's say 30 sketches) and I want to extrude cut all 30 of those sketches with one macro, how would I go about it?
Assume all sketches are randomly named, so we want the code to choose all existing sketches in that part or part folder.
Here is what I have so far:
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
boolstatus = Part.Extension.SelectByID2("A1@Face-1@Toolbox", "SKETCH", 0, 0, 0, False, 0, Nothing, 0)
Dim myFeature As Object
Set myFeature = Part.FeatureManager.FeatureCut4(True, False, True, 1, 0, 0.0127, 0.0127, False, False, False, False, 1.74532925199433E-02)
Part.SelectionManager.EnableContourSelection = False
End Sub
Thank you,
Seth
SolidworksApi macros
I don't really have much of a programation background but I know a thing or two. I havemy doubts that what you ask would be achievable, unless the sketches are all made parralel to the same plane and would be doing an extruded cut all in the same direction.
If you don't do an extruded cut through all you then you would need to parameterize each and single of the detected sketch.
Maybe I'm wrong on that though, I'd wait for someone with more knowledge then me to answer.
You need to traverse the feature tree to find sketches instead of using SelectByID. There are several examples in the API help... One of them actually looks for sketches. It hides them rather than extruding them, but still pretty applicable.