Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Josh_Hudson97
377 Views, 2 Replies

Select a dimension using iLogic

Hi,

 

I have a rule I have manipulated from a earlier forum post (found here).

 

In this rule it requires a user to manually select the dimension you wish to add text to before running the rule. I'd like to automate this a little more, and specify the dimension within my rule I want to add text too. (My dimension is also added using iLogic)

 

Below is my current rule for adding dimensions, it's "Dimension 4" I wish to add text to for reference.

 

'Sheet / View References
Dim Sheet_1 = ThisDrawing.Sheets.ItemByName("Sheet:1")
Dim Front_View = Sheet_1.DrawingViews.ItemByName("Front View")
Dim genDims = Sheet_1.DrawingDimensions.GeneralDimensions

'Converts number of diagonals
Dim oDiagInt As Integer = Parameter("1002699.iam.NUMBER_OF_DIAGONALS")
Dim oDiagStr As String = oDiagInt.ToString(oDiagInt)

'oEndDiagLen = Parameter("1002699.iam.END_DIAGONAL")
Dim oEndDiagLen As String = Parameter("1002699.iam.END_DIAGONAL")

'Dim References
Dim Edge1 = Front_View.GetIntent("Vertical Infiller (L)", "Edge1")
Dim DiagCtr1 = Front_View.GetIntent("Standard Diagonal", "Center Point")
Dim DiagCtr = Front_View.GetIntent("C151 0010 09:" & oDiagStr, "Center Point")
Dim Edge0 = Front_View.GetIntent("Vertical Infiller (R)", "Edge0")

'Adds dims
Dim oDiagStart = genDims.AddLinear("Dimension 1", Front_View.SheetPoint(0.5, 1.1), Edge1, DiagCtr1)
Dim oDiagCtrs = genDims.AddLinear("Dimension 2", Front_View.SheetPoint(0.5, 1.1), DiagCtr1, DiagCtr)
Dim oDiagEnd = genDims.AddLinear("Dimension 4", Front_View.SheetPoint(0.5, 1.1), Edge0, DiagCtr)

'Sorts Dims
iLogicVb.RunExternalRule("Centre & Arrange Dimensions")
iLogicVb.RunExternalRule("Set Dimension Precision to 0 decimal place")

 

Below is my rule which adds text to my dimension currently

'Set reference to this document
Dim oDoc As DrawingDocument
oDoc = ThisApplication.ActiveDocument
'User selects dimension (prior to running rule)
Dim oSSet As SelectSet
oSSet = oDoc.SelectSet
'reference to the selected dimension
Dim oDim As LinearGeneralDimension
oDim = oSSet.Item(1)
'refrence to the DimensionText object
Dim oDimensionText As DimensionText
oDimensionText = oDim.Text
'Local Parameter
oNumDiag = Parameter("1002699.iam.NUMBER_OF_FULL_SPACES")
'change text
oDimensionText.FormattedText = oNumDiag & " AT 432 CTRS = <DimensionValue/>"

 

Any help would be much appreciated :grinning_face_with_big_eyes:

If I've helped you out drop the post a like, if I've given you a solution mark as solved. It's us, 'The community' that makes this place work :grinning_face_with_smiling_eyes:
Labels (3)