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
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
'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")
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:
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register