Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an assembly and I need to measure the distance between its YZ plane and a plane within a component.
I'm having issues with a bit of code. It is not throwing any errors but is getting the wrong solution. It always equals 0mm even though the actual measurement is several meters. What am I doing wrong?
' Get the assembly document Dim asmDoc As AssemblyDocument = ThisApplication.ActiveDocument ' Get the assembly YZ plane Dim asmYZPlane As WorkPlane = asmDoc.ComponentDefinition.WorkPlanes.Item("YZ Plane") ' Get the component occurrence Dim compOcc As ComponentOccurrence = asmDoc.ComponentDefinition.Occurrences.ItemByName("Component1") ' Get the work plane from the component Dim planeB As WorkPlane = compOcc.Definition.WorkPlanes.Item("Component1_Plane") ' Use MeasureTools to get the minimum distance Dim measureTools As MeasureTools = ThisApplication.MeasureTools Dim distance As Double = measureTools.GetMinimumDistance(asmYZPlane.Plane, planeB.Plane) ' Convert distance from cm to mm (if needed) distance = distance * 10 ' Output the result MessageBox.Show("Distance between YZ Plane and PADEYE_REAR of PADEYE: " & distance & " mm")
Solved! Go to Solution.