Evaluating a Custom Property's Text Expression in a macro
Evaluating a Custom Property's Text Expression in a macro
(OP)
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?
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?






RE: Evaluating a Custom Property's Text Expression in a macro
Can you modify your macro to use a SW/Excel BOM with the correct headers instead of a standard Excel spreadsheet?
RE: Evaluating a Custom Property's Text Expression in a macro
RE: Evaluating a Custom Property's Text Expression in a macro
You should used the ModelDoc2.GetCustomInfoValue. This method give you the evaluated value of the custom property.
Hope this help.
Stef