Anyone know of an automated way to saveAS a drawing based on custom properties? For instance, saveAs partName_SWBOMPartNo_gauge would save as Widget_WI123_14GA.
Yes you can do that via a macro
Check here for a similar macro that saves drawings as DWG with custom property in the file name: https://forum.solidworks.com/message/406298#406298
The macro can be tweaked to work based on your needs.
It's not doing anything.
James few things:
1 Did you changed the path in the macro?
2 Did you set up the properties you need?
The macro in that post is for pulling out revision value. In case you need a different one, then please share some example files (part and drawing) and then I can tweak the macro. Also suggested where those properties would be; i.e. they properties will be in part/assembly OR drawing file.
All my properties will be in the part file. The properties would be partname, gage, material.
Can you attach one sample file.
I've attached the file. I've simplified my need somewhat but it brought about another problem. I combined three properties into one; that one is called dwgflat. I would like to make the gage property pull information from my gage table.
So it would work like this:
I add the SWBOMPARTNO property.
I select the material.
The macro pulls the gage number from the part based on what i selected when i made the part.
When i export, the dwg is name exactly as the property dwgflat is.
PS - where's a good place to get started with api?
Thanks in advance,
Were you able to take a look at this?
James, sorry for a delayed response as I had been busy and could not spend time on it. Finally got some time to look into it and will soon share the macro.
For the API check this post: https://forum.solidworks.com/message/364355#364355
James I'm about to finalize the macro and would like to know as where you want to save the DWG file; In the same location as SW drawings OR in a different fixed location (which is same for all DWG files) OR you want to select every time the file location when you run this macro.
James can you try this macro. Saves in the same location of Drawing.
cant compile error
cant find project or library.
it highlights sub main()
James, I'm assuming that you're using an older version OR version below 2013 and that is why you getting the error. Please fix the missing references/libraries in the macro. Make sure you select the corresponding ones for your version of SW.
To fix libraries:
Retrieving data ...