Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to create an iLogic rule to measure between 2 planes

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
WEZ69
2453 Views, 2 Replies

How to create an iLogic rule to measure between 2 planes

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

 

 

2 REPLIES 2
Message 2 of 3
Curtis_Waguespack
in reply to: WEZ69

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

Message 3 of 3

Nice,

 

Is there a way to have a parameter, that after this code remains linked to the distance between then?

 

Tiago Figueiredo

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report