iLogic Add arc length under the existing angular dimension

iLogic Add arc length under the existing angular dimension

infoEHE7X
Participant Participant
302 Views
3 Replies
Message 1 of 4

iLogic Add arc length under the existing angular dimension

infoEHE7X
Participant
Participant

I have written a code to get a value from the user and multiply half of it to the existing angular dimension in the sheet. The code has no error however, it doesn't work.

 

Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim val As String = InputBox("Enter Shell OD in inch", "User Input")
If val = "" Or Not IsNumeric(val) Then 
    MsgBox("Please enter a valid numeric value.")
    Exit Sub
End If

Dim OD As Double = CDbl(val)

For Each oDim As GeneralDimension In oSheet.DrawingDimensions.GeneralDimensions
    If oDim.Type = DimensionTypeEnum.kAngularDimensionType Then
        ' Get the current angular dimension value
        Dim oAngleDim As AngularGeneralDimension = oDim
        Dim angleValue As Double = oAngleDim.ModelValue

        ' Multiply by the scale factor (user input value)
        Dim ARC As Double = angleValue * OD / 2

        ' Update the dimension text to show both original and new values
        oDim.Text.FormattedText = "<DimensionValue/><br/>" & ARC.ToString
    End If
Next
0 Likes
Accepted solutions (1)
303 Views
3 Replies
Replies (3)
Message 2 of 4

cidhelp
Advocate
Advocate

Hello @infoEHE7X ,

 

this seams like a bug in api. Using 

117474816

instead of 

DimensionTypeEnum.kAngularDimensionType

 works for me.

0 Likes
Message 3 of 4

cidhelp
Advocate
Advocate
Accepted solution

no bug.

this is 

kAngularGeneralDimensionObject

instead of  

kAngularDimensionType
0 Likes
Message 4 of 4

infoEHE7X
Participant
Participant

Thanks,

 

The correct code would be:

 

Dim oDoc As DrawingDocument = ThisDrawing.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim val As String = InputBox("Enter Shell OD in inch", "User Input")
If val = "" Or Not IsNumeric(val) Then 
    MsgBox("Please enter a valid numeric value.")
    Exit Sub
End If

Dim OD As Double = CDbl(val)

For Each oDim As GeneralDimension In oSheet.DrawingDimensions.GeneralDimensions
    If oDim.Type = ObjectTypeEnum.kAngularGeneralDimensionObject Then
        ' Get the current angular dimension value
        Dim oAngleDim As AngularGeneralDimension = oDim
        Dim angleValue As Double = oAngleDim.ModelValue

        ' Multiply by the scale factor (user input value)
        Dim ARC As Double = angleValue * OD / 2

        ' Update the dimension text to show both original and new values
        oDim.Text.FormattedText = "<DimensionValue/><br/>" & ARC.ToString
    End If
Next
0 Likes