×
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

Extracting units from mass properties

Extracting units from mass properties

Extracting units from mass properties

(OP)
I'm currently working on some custom properties that link to the mass properties, such as Volume, Density, etc.  The problem is that some parts have different units, so it would be very helpful to put in a custom property that specifies what unit system is being used.  (The mass property numbers are only scalar; the units are not included.)

Does anyone know of a way to do this?  Thanks for the help.

RE: Extracting units from mass properties

This could be done with API; assuming you wish direct, just put in a custom property (such as Units).

RE: Extracting units from mass properties

(OP)
I see what you're saying, but that's not really extracting the unit system from the mass properties.  That's simply entering text into a custom property.  What I'm after is a linked property that will reflect the current unit system being used, without me having to go and change it every time.  I'm after something like "SW-Units@MyPart.SLDPRT" but the problem is that there's no such variable as "SW-Units."

RE: Extracting units from mass properties

You'll have to interrogate the object model (that is, use the API) to do what you want automatically. Check the APIHELP.CHM file, ModelDoc2::GetUserUnit and SetUserUnit.

RE: Extracting units from mass properties

It's been a while since I tried to use mass properties in a drawing.  There were some problems that made me back off from the whole thing.

The units for mass properties is not controlled by the model units.  It is controlled by the units settings in the mass properties tool.  For instance, if the part units were millimeters, and I changed the mass properties tool units to inch, the mass would be in pounds.

This may have changed.  Be careful and experiment thoroughly.

Due to illness, the part of The Tick will be played by... The Tick.
http://www.EsoxRepublic.com

RE: Extracting units from mass properties

And another thing...

The "mass" property value is based on the model's current active configuration.  If the drawing shows one configuration, but the part is open and has a different configuration active, the mass value will be that of the part's current active configuration.

Due to illness, the part of The Tick will be played by... The Tick.
http://www.EsoxRepublic.com

RE: Extracting units from mass properties

The API evolves (sometimes varying by Service Pack) reflecting changes to the SW Object Model; precise answer to original question requires system specifics.

As of SW2003 SP2R11.0 Density is part of MassProperty object; System units are Meters, Radians, Grams, Seconds .. Property UseSystemUnits determines whether MassProperty object will use System Units or Document Units. MassProperty is a Utility object.

As Tick says,

Quote:

[color=red]Be careful and experiment thoroughly.[/color]
There is no substitute for validation (a.k.a. 'debugging').

RE: Extracting units from mass properties

(OP)
After playing around with several different options (including "Volume in Feet" from Scott Baugh's website), I decided to stick with the automatic "unitless" properties and not mess with the API.  I can display the units easily with the API (it helps that the API has its own standard set of units), but the price you pay is that the information doesn't update very frequently.  (A geometry rebuild appeared to be the only reliable way, from what I saw.)

Thanks for all the help!

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