Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Evaluating a Custom Property's Text Expression in a macro 1

Status
Not open for further replies.

shawn76o

Nuclear
Nov 14, 2006
31
0
0
US
Hi all, newbie question here...

I have a macro that traverses an assembly to create an indented Bill of Materials. The problem I'm having is that our engineers use expressions in the custom property fields rather than absolute values. I see that the values are automatically evaluated and displayed if you use SolidWorks' BOM Table in a drawing. However, I'm clueless as to how I should evaluate the expression from a macro. NOTE: (This macro does not require that a drawing exist for the assembly) -- Right now, my macro creates an Excel spreadsheet which is currently outputting the expression in each cell like this:

SW-Volume@95103-K.SLDPRT (this represents a Custom Property "Volume")

Any ideas how I can translate that into the actual value for each part?
 
Replies continue below

Recommended for you

That isn't an expression used (created) by the engineers, it is a selection from a SW drop-down list of standard properties. (Material, Mass, Density, etc)

Can you modify your macro to use a SW/Excel BOM with the correct headers instead of a standard Excel spreadsheet?

[cheers]
 
You have to access the mass properties of the part(s) in question. The code is pretty similar to accessing custom properties. If you're already accessing custom properties then the mass props should be no problem for you.
 
Hi shwan76o
You should used the ModelDoc2.GetCustomInfoValue. This method give you the evaluated value of the custom property.

Hope this help.

Stef
 
Status
Not open for further replies.
Back
Top