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!

NX9 - VB Code possible for this?

Status
Not open for further replies.

Kenja824

Automotive
Nov 5, 2014
949
0
0
US
When doing a measure bodies, the result always pops up on VOLUME. Is it possible to create a Journal that extracts that Volume result?

What I would like to do, which may be beyond my abilities, is create a journal that will allow me to select a solid body or multiple bodies, and when I click OK, will prompt me for what mass I want the bodies to be, then it will multiply the mass I entered by 1000, find the volume of the selected bodies and divide that by 1000, then divide the converted mass by the converted volume and multiply the answer by .0361273 and give that density to the solids I had selected.

The equation is simply Density=((mass*1000)/(volume/1000))*.0361273

I will likely be asking help to make the VB to do this, but first I am wondering if it is even possible to automatically extract the volume of the bodies to begin with.
 
Replies continue below

Recommended for you

Hi Kenja824

What are you really trying to do?

I'm asking this because it seems that you're lost with software/part units.

In NX, density is a material (part) property and do not need to be calculated, but setted instead, so the software can automatically calculate the mass and weight for you based on the solid volume. You set it on Tools -> Materials -> Assign Materials.

With your formula you are simply converting the already specifyed density from lb/in3 to g/cm3. I'm assuming it by the constant 0.0361273 that you're multiplying by.

Cheers.



 

Hi andradrr

I deal with the company's library of components a lot and sometimes I get parasolids of components from other companies to add to the library. Sometimes our modelers will model up a standard component I add to the library and quite often I will work with Family Parts where I have multiple solid bodies for a family of components. The problem is it is rare that a component has all of the inside workings modeled up as well. A hydraulic cylinder will be modeled as a solid body with a shaft and clevis coming from it. The point is, if I just give them a steel material, the weight will come out far heavier than the component should be. So I need to change the density so that it will have the correct weight when we do a measure bodies.

I used to spend a lot of time doing this on a family part with multiple bodies. I would have to give the bodies a density, measure bodies, change the density, measure bodies, change the density and so on until I got the weight correct.

Cowski saved me a ton of time now by teaching me the equation of Mass/Volume=Density. So now I can do a measure bodies to get the volume and find the density I need rather than playing with it.

But my inner lazy instincts took that and thought, I wonder if I can make a journal to do all of this for me then. So now I am digging into trying to create a button that will just let me type in the mass I want and select the bodies I need to change and presto, they get the density assigned and now weigh the correct amount.
 
Status
Not open for further replies.
Back
Top