cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Mass,Volume and Center of Mass of NX Assembly through API (VBA)

Creator
Creator

Hi All,

 

I need Mass,Volume and COM of NX Assembly through VBA. How do i get that through API.

 

Any help would be greatly appreciated.

 

Thanks in advance

 

 

4 REPLIES

Re: How to get Mass,Volume and Center of Mass of NX Assembly through API (VBA)

Esteemed Contributor
Esteemed Contributor

Have you already tried recording a journal of the manual steps?

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: How to get Mass,Volume and Center of Mass of NX Assembly through API (VBA)

Creator
Creator

Hi Stefan_Pendl,

 

Thank you for your response.

 

Yes i have tried recording journal for same.

 

But to get mass property of assembly, i have to retrive body from each component present in assembly. and then have to pass it to object array and then have to create a new object for MeasureBodies. its syntax is like this.

 

Dim measureBodies1 As MeasureBodies
measureBodies1 = workPart.MeasureManager.NewMassProperties(massUnits1, 0.99, objects2)

 

where objects2 contains all body present in each component in assembly.

 

As it seems a lengthy process to get this basic features.Do we have any API at top level through which we could easily get these features. I mean, Is there any other way to get the Mass, Volume and COM of an assembly?

 

Thanks

Re: How to get Mass,Volume and Center of Mass of NX Assembly through API (VBA)

Esteemed Contributor
Esteemed Contributor

There are some samples available that walk the assembly tree to get information from the components.

These can be used as a blueprint for your task, since there is no single API method to do what you are asking for.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Re: How to get Mass,Volume and Center of Mass of NX Assembly through API (VBA)

Siemens Phenom Siemens Phenom
Siemens Phenom
If you have access to SNAP, then ... You can get a list of solid bodies in the work part (including those from component parts) by cycling through the workParts.Objects array. Then pass the resulting array of bodies to Snap.Compute.MassProperties. This resturns a structure that contains mass, volume, and centroid. About 5 lines of code, in all.
山田
yamada