05-01-2024
09:54 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-01-2024
09:54 PM
If you check the face surface type to ensure it's a plane surface then you should be home and dry. The sample API help page shown here in face.geometry gave me the hint for this
Dim oDoc As PartDocument = ThisApplication.ActiveDocument
Dim oPlane1 As Plane = Nothing
Dim oPlane2 As Plane = Nothing
Dim oFaces As Faces = oDoc.ComponentDefinition.SurfaceBodies.Item(1).Faces 'gets too many results but works, using worksurfaces doesnt give me the correct result
MessageBox.Show(oFaces.Count.ToString, "Check No. of faces in Surface body")
Dim oFace1 As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFacePlanarFilter, "Select a face")
Dim oFace2 As Face = Nothing
oPlane1 = oFace1.Geometry
For Each oFace As Face In oFaces
If oFace.SurfaceType = SurfaceTypeEnum.kPlaneSurface Then
If oPlane1.IsCoplanarTo(oFace.Geometry) Then
ElseIf oPlane1.IsParallelTo(oFace.Geometry) Then
oFace2 = oFace
End If
End If
Next
DistPoints = ThisApplication.MeasureTools.GetMinimumDistance(oFace1, oFace2)
Distmm = Round(DistPoints * 10).ToString() + "mm Thick"
MessageBox.Show(Distmm, "Title")
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan
Or if this helped you, please, click (like)
Regards
Alan