Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

NXOpen Get FacetedBodies for an assembly

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
Solution
Solution
Accepted by topic author VivO
‎02-11-2016 06:45 AM

Re: NXOpen Get FacetedBodies for an assembly

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

Thank you very much for your help!