Cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to get faceted faces of triangulated mesh (.STL) file

Solution Partner Pioneer Solution Partner Pioneer
Solution Partner Pioneer

I have import a .stl file in NX 11.

In my application ,i retrvieve that facetedBody from part.

I want faceted faces from this facetedBody . So I have implemented following code.

//===================================================================

NXOpen.Part workPart = Session.GetSession().Parts.Work;
NXOpen.Facet.FacetedBodyCollection facetedBodies = workPart.FacetedBodies;
NXOpen.Facet.FacetedBody[] facetedBodiesInPart = facetedBodies.ToArray();

for (int i = 0; i < facetedBodiesInPart.Length; i++)
{
NXOpen.Facet.FacetedBody facetedBody = facetedBodiesInPart[i];
Body body = facetedBody.AssociatedBody;
if(body == null)
{
int numfaces = facetedBody.NumberOfFaces;
try
{
//I got exception here.

NXOpen.Facet.FacetedEdge[] edges = facetedBody.GetEdges();
NXOpen.Facet.FacetedFace[] faces = facetedBody.GetFaces();

}
catch (NXOpen.NXException ex)
{
UI.GetUI().NXMessageBox.Show("Caught exception in Main", NXMessageBox.DialogType.Error, ex.Message);
}
try
{
double vol = facetedBody.Volume;
double area = facetedBody.SurfaceArea;

}
catch (NXOpen.NXException ex)
{
UI.GetUI().NXMessageBox.Show("Caught exception in Main", NXMessageBox.DialogType.Error, ex.Message);
}
}
}

//==========================================================================

But it gives exception for geting faces and edges.

Can you please tell us how to get faceted faces from faceted body?

 

 

1 REPLY 1

Re: Not able to get faceted faces of triangulated mesh (.STL) file

Siemens Phenom Siemens Phenom
Siemens Phenom

You might find this discussion useful.

山田
yamada