AnsweredAssumed Answered

Macro for removing all customer properties and creating a set of properties

Question asked by Edwin Clough on Nov 17, 2014
Latest reply on Nov 18, 2014 by Steven Smith

We have our templates changed over to a new style that has all the appropriate fields in the part or assembly file and it displays correctly on the drawings.


I need a macro to remove all current custom properties from a file and replace them with a set of defaults.  All custom properties are text fields. 


Items like Description and Color.  I can take a simple code and copy it for all 21 custom properties, so I won't bore you with the whole list.


I have seen a number of sections of code out there, I would love for it to find the file type, Part and Assembly have very similar properties, except the Material for the assembly defaults to --- instead of SW-Material, so if it can be one macro that applies it correctly and doesn't do anything to drawings, great, if it's two separate macros and we assign them to different keyboard keys, that's aok also.


Whatever file is open:


1) determine file type

2) if drawing, do nothing,

3) if part or assembly, do delete all current info

4) Add a bunch of custom properties with certain defaults (usually "---" or a couple with SW-Mass or Material.)

5) on one of the fields (Material) either make it SW-Material or --- depending on part or assembly.


Thanks for anyone's help with putting this together with me.