How to create a measurement between two planes using ilogic rules?
I have created the planes on the asssmbly parts but dont know how to directly pick them.
The measurement is going to be used as reference dimension
Thanks
Solved! Go to Solution.
Solved by Curtis_Waguespack. Go to Solution.
Hi WEZ69,
Here is a quick example rule that allows the user to select from a list:
'Dim oDoc As AssemblyDocument
'oDoc = ThisApplication.ActiveDocument
Dim MyArrayList As New ArrayList
'look at the workplane collection
'and add each workplane to the select set
For Each oWorkPlane In ThisDoc.Document.ComponentDefinition.WorkPlanes
'filter out the origin planes
If oWorkPlane.IsCoordinateSystemElement = False Then
'add planes to list
MyArrayList.add(oWorkPlane.Name)
End If
Next
'select first plane to use
oWorkPlane1 = InputListBox("Select the 1st plane to use from the list.", MyArrayList , MyArrayList.item(0), "iLogic", "Workplanes")
'select second plane to use
oWorkPlane2 = InputListBox("Select the 2nd plane to use from the list.", MyArrayList , MyArrayList.item(1), "iLogic", "Workplanes")
'get distance
myDistance = Measure.MinimumDistance(oWorkPlane1, oWorkPlane2)
'display distance in cm's
MessageBox.Show(myDistance & " cm", "iLogic")
'display distance in inches
MessageBox.Show(myDistance * 0.393701 & " in", "iLogic")
Also, if you know the names of the planes ahead of time you could just use something like this example:
'get distance between named work planes myDistance = Measure.MinimumDistance("Work Plane2", "Work Plane5") 'display distance in cm's MessageBox.Show(myDistance & " cm", "iLogic") 'display distance in inches MessageBox.Show(myDistance * 0.393701 & " in", "iLogic")
Keep in mind that in the future you might have better luck searching and asking questions of this type on the Inventor Customization forum:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
Nice,
Is there a way to have a parameter, that after this code remains linked to the distance between then?