Macro to adjust the partnames in a STEP export
Posted: Tue Aug 08, 2023 6:31 am
Hi all,
wow what an amazing community and source of knowledge! New here and tagging along for the ride
Little introduction:
I'm a design engineer from the Netherlands and using Solidworks 20+ years.
I don't like when things don't work the way I would like them to, so that's why I ventured into the wonderfull world of macro's. After some successful bits of script that helped me in changing files and properties in batch operations, I feel more confident in seeking a solution in the form of macro's.
I have a long wish to change the name of the parts/bodies in a STEP export.
Why?:
Often we export our work in progress assembly to a STEP file, for our client to use for images/work instructions/ visualisation/ etc.
The problem is that you can Export the assembly with a revision in the name, say: assembly Rev1.STEP, but when our client opens/imports the STEP assy in Solidworks, it creates an assembly with parts again. Problem is that the parts in that assembly have all the partnames, without revisions or other differentiators. And we have seen this going wrong and being mixed up in the past, so we got cautious doing this.
What I would like:
A STEP export with al the body names with a (date) prefix.
How we do this now:
- Pack and go the assembly to a TEMP folder and add a prefix.
- open the new assy and save as a STEP file
- delete the TEMP folder
I can do the same process with a macro, but was trying to find out how I can do this without creating files and deleting them. So do this all in memory, like a pack and go. So basically a pack and go with a STEP file as deliverable.
Can you give me any inspiration on how to attack this? or if it is far fetched and better to automate our current process?
Thanks in advance!
wow what an amazing community and source of knowledge! New here and tagging along for the ride
Little introduction:
I'm a design engineer from the Netherlands and using Solidworks 20+ years.
I don't like when things don't work the way I would like them to, so that's why I ventured into the wonderfull world of macro's. After some successful bits of script that helped me in changing files and properties in batch operations, I feel more confident in seeking a solution in the form of macro's.
I have a long wish to change the name of the parts/bodies in a STEP export.
Why?:
Often we export our work in progress assembly to a STEP file, for our client to use for images/work instructions/ visualisation/ etc.
The problem is that you can Export the assembly with a revision in the name, say: assembly Rev1.STEP, but when our client opens/imports the STEP assy in Solidworks, it creates an assembly with parts again. Problem is that the parts in that assembly have all the partnames, without revisions or other differentiators. And we have seen this going wrong and being mixed up in the past, so we got cautious doing this.
What I would like:
A STEP export with al the body names with a (date) prefix.
How we do this now:
- Pack and go the assembly to a TEMP folder and add a prefix.
- open the new assy and save as a STEP file
- delete the TEMP folder
I can do the same process with a macro, but was trying to find out how I can do this without creating files and deleting them. So do this all in memory, like a pack and go. So basically a pack and go with a STEP file as deliverable.
Can you give me any inspiration on how to attack this? or if it is far fetched and better to automate our current process?
Thanks in advance!