Cancel
Showing results for 
Search instead for 
Did you mean: 

NXOpen Get FacetedBodies for an assembly

Valued Contributor
Valued Contributor

Hello,

I get geometry of a part in the following way:

Part workPart = theSession.Parts.Work;

foreach (FacetedBody fb in workPart.FacetedBodies)
{
     if (fb.IsSolidBody)
     {
          workPart.FacetedBodies.Convert(fb, FacetedBodyCollection.Type.Nx);
          SolidBodyData.GetBodyData(fb.Tag, theUfSession, out VertexArray, out FacesArray);
     }
}

 
This way works for a separate part. Next step is to get geometry for
an assembly. Please look through the following code:

Component rootComponent = theSession.Parts.Display.ComponentAssembly.RootComponent;
    

private void AddChildren(TreeNode node, Component component) 
    {
        Component[] childComponents = component.GetChildren();
        for (int i = 0; i < childComponents.Length; i++) 
        {
            TreeNode childNode = new TreeNode(childComponents[i].Name);
            componentTable[childNode] = childComponents[i];
            node.Nodes.Add(childNode);
            AddChildren(childNode, childComponents[i]);
        }

    }

In the code above Component type is used. Is there any way to get
FacetedBodyCollection having this Component. If there is no way to use
Component to do that, is there any way to get FacetedBodyCollection
for every part?

 

2 REPLIES

Re: NXOpen Get FacetedBodies for an assembly

Honored Contributor
Honored Contributor

If the component is loaded, you can get the part from the component with:

 

{component reference}.Prototype.OwningPart

Re: NXOpen Get FacetedBodies for an assembly

Valued Contributor
Valued Contributor

Thank you very much for your help!