Since the number of facets has a big impact on the size of a file. I would like to see the option to delete faces smaller than a specified area added to the dialog. This might result in solid bodies being converted to surface bodies but as long as the user is aware that should not be a problem.
The following iLogic rule demonstrates the concept. The are has been hardcoded to 50 cm^2:
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oDoc.ComponentDefinition
Dim oSurfBodies As SurfaceBodies = oCompDef.SurfaceBodies
Dim oPartFeats As PartFeatures = oCompDef.Features
'Loop through each body in the active part
For Each oSurfBody As SurfaceBody In oSurfBodies
Dim oFaces As Faces = oSurfBody.Faces
Logger.Info(oSurfBody.Name, Nothing)
'Create an empty collction for faces to delete
Dim oFaceColl As FaceCollection
oFaceColl = ThisApplication.TransientObjects.CreateFaceCollection
'Loop through each face in the body
For Each oFace As Face In oFaces
'If the area of the face is less then the value of
'MaximumAreaToDelete add it to the collection
If oFace.Evaluator.Area < 50 Then
oFaceColl.Add(oFace)
End If
Next
Try
Dim surfBodyName As String = oSurfBody.Name
'If there is at least 1 face collected to tdelete
If oFaceColl.Count > 0 Then
Logger.Info(surfBodyName & " currenty has " & oFaces.Count & " Faces")
'Delete the faces in the collection
oPartFeats.DeleteFaceFeatures.Add(oFaceColl, False)
Logger.Info("Face Collection Deleted from " & surfBodyName, Nothing)
Logger.Info(surfBodyName & " now has " & oSurfBody.Faces.Count & " Faces")
End If
Catch
Logger.Info("Delete Face collection from " & oSurfBody.Name & " Failed", Nothing)
End Try
Next