Placing Dimensions: iLogic 2021

Using “Capture Current State” to Automate Dimensions with iLogic.

iLogic in 2021 introduces the ability to add dimensions to drawings and to capture the state of selected geometry on a drawing view.

In this example I’m going to show you how to create a linear dimension. In the image below I have named some faces (right click on practically any geometry and select “Assign Name”), using the new tools in iLogic, I can now easily place a linear dimension between these 2 faces.

In the drawing environment, simply select the geometry you wish to use and then right click and choose “iLogic” then “Capture Current State”.

The information that you need is now copied to your iLogic clipboard.

Note that if you have not already named the geometry, you can still “Capture Current State” from the drawing, you will be prompted by Inventor, letting you know that the underlying geometry is going to be edited.

In a new iLogic, rule, simply paste in the info about the 2 lines from my iLogic clipboard (purple). Note that we have pulled through Face 1 and Face 2.

Next navigate to the new “Drawings” section of the snippets and double click on “Linear Dimension”.

Delete the first 3 lines as they are not needed (the are duplicates of the info from our clipboard)

Click me for High Res Version

The last line of code looks like this, we need to replace “namedGeometry1” with the information from Face1 and Face2.

Dim linDim1 = genDims.AddLinear("Dimension 1", VIEW1.SheetPoint(0.5, -0.1), namedGeometry1)

If we just put in Face1 we will get something like this, just as if we had chosen Face1 in the interface.

Dim linDim1 = genDims.AddLinear("Dimension 1", VIEW1.SheetPoint(0.5, -0.1), Face1)

If we include Face1 and Face2, we get the following:

Dim linDim1 = genDims.AddLinear("Dimension 1", VIEW1.SheetPoint(0.5, -0.1), Face1, Face2)

Here’s the full code that I used to get the linear dimension between Face1 and Face2:

Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
Dim Face2 = VIEW1.GetIntent("Face2")
Dim Face1 = VIEW1.GetIntent("Face1")


Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions
Dim linDim1 = genDims.AddLinear("Dimension 1", VIEW1.SheetPoint(0.5, -0.1),Face1,Face2)