Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Reading Custom Properties for Macros

Status
Not open for further replies.

dragoneye1589

Mechanical
Jan 9, 2011
4
0
0
CA
I've been trying to write a macro to automate saving my models and drawings into a couple different formats.

The macro works great except that I can't get the macro to automate naming my parts. If I bring up an InputBox and ask the user to input the info it works fine. But I really want to be able to read data from the property table which I can't figure out how to do.

Under the custom tab of properties I have a property called "PartNo" of the type "text" and the value "012345". How exactly can I specify in the VBA script that I want to read the value for that property?

Thanks
 
Replies continue below

Recommended for you

value = Part.GetCustomInfoValue("mud", "material sz")
If value = "" Then matsz(x) = Part.GetCustomInfoValue("", "material sz")

This reads value from the custom properties (material sz in this case - this is used for a BOM macro)for the "mud" configuration. If the property does not exist in that configuration, it reads it from the root properties.

value is a string
part is a modeldoc2 (object)
"mud" is the configuration name (string)if it is "", then it reads the properties from the root.
 
Status
Not open for further replies.
Back
Top