Hello everyone;
Would you know a trick/macro/routine or anything else... which will allow me to "clean" my creation tree at the level of sketch/constraint/function counters...
Let me explain: I have been dragging around for several years now parts and assemblies that I modify at leisure (I add constraints, change sketches, delete them, create new ones etc...)
In the creation tree, each new sketch/function or constraint increments with a higher number each time.
Is there a way to "go down" these increments to the lowest level:
Find a tree in the form:
Sketch1
sketch2...
Rather than:
Sketch1253
Sketch2014...
Just like it's my home right now. (well, what)
Thank you for the help you can give me.
To rename a sketch (e.g. the active sketch), it is the statement:
Set swSketch = swModel. GetActiveSketch2
Set swFeat = swSketch
' Change the name of the open sketch to CircleSketch
swFeat. Name = "CircleSketch"
See this link:
http://help.solidworks.com/2012/English/api/sldworksapi/Rename_Active_Sketch_Example_VB.htm
Which you will have to combine with an instruction to cross the entire construction tree, see this link:
http://help.solidworks.com/2012/English/api/sldworksapi/Traverse_FeatureManager_Design_Tree_VB.htm
Note: we can also take inspiration from the macro available here:
https://forum.solidworks.com/thread/81918
Well no, I'm not very comfortable in VBA, I had already found to rename the sketches but where I get stuck is the zeroing of the counters and then increment them by 1...
If there were only the sketches, it would be playable (even by hand) but I wanted to include the functions and constraints too.
By filling several bits with codes gleaned right and left, I have this... that doesn't work and is incomplete:
See attached document.
Note: Are there tags to post a code? Because the restriction to 6000 characters is not convenient.
renommer_fonctions.swp
Note:
For me, it would be an interesting tool to integrate into axemble's "TreeManager".... (2012 and/or 2014 versions)
...