×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Evaluating a Custom Property's Text Expression in a macro

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?

RE: Evaluating a Custom Property's Text Expression in a macro

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

RE: Evaluating a Custom Property's Text Expression in a macro

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.

RE: Evaluating a Custom Property's Text Expression in a macro

Hi shwan76o
You should used the ModelDoc2.GetCustomInfoValue. This method give you the evaluated value of the custom property.

Hope this help.

Stef

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources