Let’s suppose we have created the following iLogic rule in the drawing document. (Of course, you may change dimension text from the rule in the model document. It’s up to you.)
This rule:
1) finds the reference to the model file that was used to create the drawing.
2) read the value of the text parameter in the model document. This parameter could be multivalue one. Here parameter value is saved in the string variable Value.
3) finds the reference to the dimension object. (Here I used the second dimension in the active sheet - for simplicity).
4) changes dimension text adding the string Value below the current dimension text.
'get model document (part or assembly) from the parent DrawingDocument
modelName = IO.Path.GetFileName(ThisDrawing.ModelDocument.FullFileName)
'save text parameter "MyText" value in the string variable Value
Dim Value As String = Parameter(modelName, "MyText")
'Note: this string Value could be read from any source (e.g., excel sheet).
Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = ActiveSheet.Sheet
'reference to some dimension
Dim oDim As GeneralDimension = oSheet.DrawingDimensions.Item(2)
'refrence to the DimensionText object
Dim oDimensionText As DimensionText = oDim.Text
'create text that should be placed below the dimension
Dim St As String = "<br/>" & Value
'change dimension text
oDimensionText.FormattedText = "<DimensionValue/>" & St
Now if you run this rule you will see the model parameter value in the second line of dimension text.
Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network