- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
When measured using i-logic below, there is an error from reality.
It is not the distance between the centers of the sides.
Can you tell me how i-logic works to find the minimum distance?
SubMain()
' Select two faces
Dim face1 As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select the first face.")
Dim face2 As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, "Select the second face.")
' Measure distance only when two faces are selected
If face1 IsNot Nothing AndAlso face2 IsNot Nothing Then
' Center point of two sides
Dim centroid1 As Point = face1.PointOnFace
Dim centroid2 As Point = face2.PointOnFace
' Use the center points of the two sides to calculate the distance.
Dim distanceInCM As Double = centroid1.DistanceTo(centroid2) * 10 ' Convert to centimeters (cm).
'Display the distance as a message.
MessageBox.Show("The minimum distance between two selected faces is " & Math.Round(distanceInCM, 1).ToString() & " mm.")
'Assign a value to Measure1 of User parameters.
iProperties.Value("Custom", "measure1Value") = Math.Round(distanceInCM, 1).ToString()
Else
' If either of the two sides is not selected, an error message is displayed.
MessageBox.Show("Please select two faces.")
End If
End Sub
Solved! Go to Solution.