Hi everyone!
I've been busting my head for too long and now I hope one of you would be so kind and help me out. I tried adjusting the code provided in some of the previous responses here and also dabbled with the Inventor-provided snippets but I just can't find a proper way to make it work.
I wrote some code, that adds dimensions to a model. However this model is parametric and it will change quite drastically with each new iteration, so naturally, the dimensions will also change - some new dimensions will be included, some excluded.
I want iLogic to add text to each dimension. But, as mentioned, the dimensions change with each new drawing copy and each dimension requires different text, so I need my code to find the right dimension based on the dimension name (or if anyone knows a better way).
For example, one dimension is namend "AADim1". How can I find this specific dimension and make it so that it will read: "AA <DimensionValue/>" ?
Then for the next example, I have the dimension "frameDim1", and I would like the dimension text in this specific dimension to read: "Frame <DimensionValue/>. I'll have many more example to add in the future.
Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Blatt:1")
Dim a1 As Double = 0.5
Dim b1 As Double = 1.8 'rahmen
Dim b2 As Double = 1.6 'AA
Dim b3 As Double = 1.4 'seitenwand
Dim VIEW1 = Sheet_1.DrawingViews.ItemByName("VIEW1")
Dim VIEW2 = Sheet_1.DrawingViews.ItemByName("VIEW2")
Dim VIEW3 = Sheet_1.DrawingViews.ItemByName("VIEW3")
Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions
ThisDrawing.BeginManage()
'VIEW1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dim rearSeitenwand = VIEW1.GetIntent(framePart, "rearSeitenwand")
Dim rueckwandFace = VIEW1.GetIntent(framePart, "rueckwandFace")
Dim frontSeitenwand = VIEW1.GetIntent(framePart, "frontSeitenwand")
Dim rearBandrahmen = VIEW1.GetIntent(framePart, "rearBandrahmen")
Dim frontBandrahmen = VIEW1.GetIntent(framePart, "frontBandrahmen")
Dim rearAxle = VIEW1.GetIntent(framePart, "rearAxle")
Dim frontAxle = VIEW1.GetIntent(framePart, "frontAxle")
If Not Direction = "REV" Then
Dim rueckwandDim1 = genDims.AddLinear("rueckwandDim1", VIEW1.SheetPoint(a1, b3), rearBandrahmen, rueckwandFace)
Dim seitenwandDim1 = genDims.AddLinear("seitenwandDim1", VIEW1.SheetPoint(a1, b3), rearSeitenwand, frontSeitenwand)
End If
Dim frameDim1 = genDims.AddLinear("frameDim1", VIEW1.SheetPoint(a1, b1), rearBandrahmen, frontBandrahmen)
Dim AADim1 = genDims.AddLinear("AADim1", VIEW1.SheetPoint(a1, b2), rearAxle, frontAxle)
'VIEW3 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Dim frameRight = VIEW3.GetIntent(framePart, "frameRight")
Dim frameLeft = VIEW3.GetIntent(framePart, "frameLeft")
'***************************************************************************
'Add text to dimensions
'***************************************************************************
ThisDrawing.EndManage()