I'm new to programming in visual basic for NX.
I'm trying to create a dll to execute some recursive operation on a CAD with NXOpen.
In particular, I need to measure the surface of some specific objects/ features and the volume.
If I am not in wrong to select a feature I have to write:
Dim sphere1 As Features.Sphere = CType(workPart.Features.FindObject("SPHERE(9)"), Features.Sphere)
now I cannot find the command to measure the area of the faces and the volume.
After, I also need to measure area and volume of the faces of a boolean feature.
Thanks a lot for you help
Solved! Go to Solution.
We hava a lot of NXOpen code samples available in the Solution Center. I have attached one that should be a good starting point for you.
Please ignore the first one and try this one instead. This allows you to select a Body object, instead of selecting a Tag and then converting it to a Body. (Just a little cleaner...)
You said you can't find any manuals. I suggest you solve that problem, first. The NX API documentation doesn't get installed, by default, so you may have to go get it installed.
If you're new to programming, you might find it helpful to read the "Getting Started with SNAP' guide, for starters, even if you don't use SNAP. It's part of the standard NX documentation set.
To measure area, there is a Snap.Compute.MassProperties function that will give you the surface area of a body, and a Snap.NX.Face.Area property. In the NX/Open library, there is
thanks for your reply.
I already installed the NX API documentation but it's not clear as the SNAP documetation.
I read also the "Getting Started with SNAP" that helped me to start with some first operations but we don't have SNAP license so I cannot use SNAP commands.
It would be usefull to find a "Getting started with NXOpen".
Furthermore, for me at least, it's not so simple to use the NX API documentation.
thanks a lot for your reply.
I need the value to use it inside the VB code and to write it in an external .txt file with other measures.
thanks in advance
Hi Steve, thanks a lot for the examples.
I modified the code to get a specific named body, because I don't need of the interactive selection:
Dim Intersezione As Body = CType(workPart.Bodies.FindObject("INTERSECT(11)"), Body)
1) Now I cannot get the area measurement of a specific feature.
To be more clear, I need to get the area of "Intersect(11)" but I also need to get the area of a Sphere Feature.
2) How can I select a body with a customized name?
Thanks in advance