Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-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
Joined
Nov 14, 2006
Messages
31
Location
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?
 
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.

Part and Inventory Search

Sponsor

Back
Top