Hi
i need to be able to get the surface area of a part. i can get it using the measure tool and selecting the 'Measure Area' command but can i get the value i need via code only?
i actually need to iterate all faces on a part to find the largest one.
Does anyboby have any ideas or can help?
Thanks
Nigel
Nacho
Automation & Design Engineer
Inventor Programmer (C#, VB.Net / iLogic)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Something like so (VB.NET). Covers parts with multiple solid bodies.
Dim doc As PartDocument = Nothing
Dim bodies As SurfaceBodies = Nothing
Dim faces As Faces = Nothing
Dim maxArea AsDouble = 0.0
Dim faceArea AsDouble = 0.0
Dim bigFace As Face = Nothing
doc = <get a reference to part document>
bodies = doc.ComponentDefinition.SurfaceBodies
For Each body As SurfaceBody In bodies
For Each bodyFace As Face In body.Faces
faceArea = bodyFace.Evaluator.Area
If faceArea > maxArea Then
bigFace = bodyFace
maxArea = faceArea
End If
Next
Next
Nacho
Automation & Design Engineer
Inventor Programmer (C#, VB.Net / iLogic)
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.