AnsweredAssumed Answered

Can you select a part based on a custom property?

Question asked by Michael Ferraro on May 16, 2016
Latest reply on Jun 19, 2017 by Pichaiyan Prabaharan



I am working on developing a template assembly for some of our designers here and was curious if I can do something in the coding to make it a bit more robust.


Currently I have a template assembly that the user opens, runs the macro to make changes and then copy trees it into their working area. The only drawback is that if they end up needing to make an additional change later on the tool no longer works as everything has a new file name from the copy tree. (and my macro explicitly calls out specific file names).


So I was wondering if there is a way I could add a custom property to each file like "TemplateID" and give each part a number. Then in my macro I find a part with a specific ID number and then do the modifications necessary. I can obviously manually add the "TemplateID" custom properties to each of the files but I am a bit unsure how to find a part in an assembly based on a custom property within a macro.


So it would do something along the following:

-Seach the assembly for a part with "TemplateID" = "001"

-Set that part files name as a property (for referencing purposes)

-Make a pile of modifications to the part (length, features on/off, etc.)

-Clear the property

-Then search for the next part and repeat.