Making Inventor iLogic Work for You

Pallet-Seattle-4906.jpg

While Inventor does some things really well, some things are still difficult to accomplish. Take for instance updating dimensions to reference. You have a few options, set it in the dialog box when the dimension is created, double click and then set after the dimension is created. Then you can right-click and copy the property. I don't know about you but that is cumbersome.

 

When I am annotating a drawing I prefer to place all my dimensions and notes and then massage it around so it works best. I enjoy being in a grove and dislike leaving my command to alter the appearance of the dimension.

 

Here is a snippet to change any dimension into a Reference dimension. I find this helpful as you can click on one dimension and then poof its a reference, it also allows for individual ordinate dimensions to be selected instead of the whole chain:

 

While True
	'select a dimension line and set the filter to dimension
	Dim oDim As DrawingDimension = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingDimensionFilter, "Select Drawing Dimension...")

	'if nothing exit while
	If IsNothing(oDim) Then Exit Sub
		oDim.Tolerance.SetToReference
End While

Setting up Dimension precision can be specific to each drawing, we have a simple system of two or three place decimals for how precise we'd like to be. Changing dimensions is a little cumbersome one by one, this code will set your precision to Two places for your active style in a drawing.

We had a lot of older drawings that contain a mis-match of Two and Three place dimensions:

' Set a reference to the drawing document.
' This assumes a drawing document is active.
Dim DrawDoc As DrawingDocument
DrawDoc = ThisApplication.ActiveDocument

'set ref to StylesManager

StyleDoc = DrawDoc.StylesManager

ActiveDimStyle = StyleDoc.ActiveStandardStyle.ActiveObjectDefaults.LinearDimensionStyle
ActiveDimStyle.LinearPrecision = kTwoDecimalPlacesLinearPrecision

 

The other piece of code I'd like to share is for updating our dimension standards. We have a lot of old drawings and as we all know standards change and evolve over time. This allows us to grab a specific Global Style and apply it to the drawing, and apply it to the drawing style we have in our drawings. One thing we have run into sometimes is the style is not in our file. To alleviate this the user must go and set the standard once it has been updated from the global style. That is by far the exception, but some of these files are over 13 years old.

 

Dim ActiveDoc As DrawingDocument
ActiveDoc = ThisApplication.ActiveDocument

Dim oStyleManager As DrawingStylesManager = ActiveDoc.StylesManager

Dim DimStyle As DimensionStyle
DimStyleCollection = ActiveDoc.StylesManager.DimensionStyles

Dim Style As DimensionStyle
For Each Style In DimStyleCollection
    If Style.Name = "Your_Dim_Style_Here" Then
        Style.UpdateFromGlobal
    Exit For
    End If
Next

oStyleManager.ActiveStandardStyle = oStyleManager.StandardStyles.Item("Your_Style_Here")

I hope this helps you be a little more efficient and consistent. Let me know if you have any questions or ideas for future time savers!