Hi alll
Im making a macro but i need help .
I would like to know how to change the default generated names of sketches .
For Example when i already have 5 sketches in My part when i run a macro that generate a sketch it will name it sketch 6 and for example if u want to revolve the sketch i need to select the sketch 6 So in a multiple user choices macro i need to anticipate wath the user will do to change the sketch name accordingly .
Is it possible to create a sketch that doesnt take by Default the standart name +1 of the previous name ( Previous Sketch name = Next Sketch name +1)?
I dont know if u understund wath i mean
Please Help
SolidworksApi macros
Check this example: Rename_Active_Sketch_Example
Thanks , i would also like to know to do the same thing with a plane is it possible too?
Check the macro by Artem Taturevich here: http://eng-tips.com/viewthread.cfm?qid=250003
Interesting but the problem is that this macro change name of all features not just planes .
Is there no simple solution , like give a name to a plane before its created just before inserting the plane
Set myRefPlane = Part.FeatureManager.InsertRefPlane(8, 0.1 , 0, 0, 0, 0)
or select the active plane like for sketch?
Anyway Apreciate your help
I would suggest spending some time learning how to create a SW add-in. With an add-in you could hook to an event trigger on when the user adds new sketch or a new pane then rename those features on the fly if you have some kind of logic you want to apply for the renaming. This would be the most seamless way to do this.
You can use event notifications with macros. I have a tutorial at my web site in the SolidWorks API Videos section and a few notification examples in the SolidWorks API Macros section.
Mikado, you would probably want to look at the swPartRegenPostNotify2 delegate. (Search for it in the API Help)
Keith
Video Tutorials for the SolidWorks API
This is good and all if you're not actively building a sketch though right? How do you rename a sketch as you're making it before the program "clicks" Exit Sketch?
Can you use vSkLines.Name somehow? I tried and no such luck.