Distance between two faces in assy as a parameter

Distance between two faces in assy as a parameter

GoranBe
Advocate Advocate
2,531 Views
22 Replies
Message 1 of 23

Distance between two faces in assy as a parameter

GoranBe
Advocate
Advocate

Hello

 

What is the easiest way to get distance between two faces, store it into some user parameter and have the value updated if the distance changes. From experience I know that if I Measure the parameter value it will not update, if the distance changes. I tried to create dimension annotation in model, but I am not aware of how to use it's value as a parameter. In short, I'd like to have 47,00 mm dimension value from the picture below stored in the (named) parameter and updated, if it changes due to any reason - housing height change, constrains change etc...

 

Thanks for your ideas

Goran

aa.png

0 Likes
Accepted solutions (1)
2,532 Views
22 Replies
Replies (22)
Message 21 of 23

JhoelForshav
Mentor
Mentor
Accepted solution

hi @GoranBe 

Try this iLogic to get the 3D dimension value:

 

Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oCompDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim oDimension As LinearModelDimension
oDimension = oCompDef.ModelAnnotations.ModelDimensions.LinearModelDimensions.Item("OHa")
Dim oValue As Double = oDimension.ModelValue 'Database units (cm)

MsgBox(oValue) 

Dim oValue2 As Double = CDbl(oDimension.Definition.Text.Text) 'Convert the actual dimension text to double

MsgBox(oValue2)
Message 22 of 23

GoranBe
Advocate
Advocate

Jhoel,

 

you made my day, thanks. @JhoelForshav, just one more question if I may - in your opinion what is the best source to learn iLogic objects? Me personally I just couldn't find "...ModelAnnotations.ModelDimension..." in online help resources for example.

 

Thanks again

Goran

 

Message 23 of 23

JhoelForshav
Mentor
Mentor

Hi @GoranBe 

I usually inspect the objects by simply typing in the iLogic editor

ModelDimension.PNG

But klicking your way through the objects in the API help is also a good way.

http://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-D675E860-ADB7-4771-ADAB-2EEEB214F9EC

 

If i have no clue where to start i usually search this forum or do a google search to find some object related to what I'm trying to do 🙂

0 Likes