Hello, I'm new here and I hope to get some help regarding macros.
I'm creating a simple macro where I use a Join feature on an assembly. I recorded myself following these steps:
inserting a new part
selecting the top plane to open the sketch
exiting the sketch
selecting all features on the screen
using the join feature to join everything
(the new part is saved under C:/SWWork/JOINEDPART.sldprt)
exiting from the part editor and returning to the assembly
Of couse this works for my specific assembly file, but I want to be able to run this macro for any assembly file, regardless of the number of features and their names.
So, in my macro I have a series of lines such as:
boolstatus = Part.Extension.SketchBoxSelect("0.000000", "0.000000", "0.000000", "0.000000", "0.000000", "0.000000")
boolstatus = Part.Extension.SelectByID2("xxxxx", "COMPONENT", 0, 0, 0, True, 0, Nothing, 0)
boolstatus = Part.Extension.SelectByID2("xxxxx", "COMPONENT", 0, 0, 0, True, 0, Nothing, 0)
... and so on, where "xxxxx" is a feature name.
2 questions: If I change the "SketchBoxSelect" to select everything from -999,-999,-999 to 999,999,999 is this going to select every feature and body within this cube?
And, why is there a separate line for each particular feature? If I delete these lines the macro doesn't work properly, but of course I can't name each feature for every assembly in the same way.
How can I correct this? Do I need some type of loop to select every feature? Or is there an easier way?
Thanks for the help. I have a lot of experience with Solidworks in general, but limited programming experience. Just a basic background in C++ and Matlab, but no Visual Basic experience.
SolidworksApi macros