Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
YuhanZhang
in reply to: Anonymous

You can follow below steps to create a button with the sample macro for you to create arc length dimension:

 

1. Copy below macro to a VBA module(in the ApplicationProject).

 

Sub ArcLengthDim()
    Dim oDoc As DrawingDocument
    Set oDoc = ThisApplication.ActiveDocument
    
    Dim oSheet As Sheet
    Set oSheet = oDoc.ActiveSheet
    
    Dim oCurveSeg As DrawingCurveSegment
    Set oCurveSeg = ThisApplication.CommandManager.Pick(kDrawingCurveSegmentFilter, "Select an arc drawing curve")
    
    Dim oCurve As DrawingCurve
    Set oCurve = oCurveSeg.Parent
    
    If oCurve.CurveType <> kCircularArcCurve Then
        MsgBox "The selected drawing curve is not an arc curve!"
        Exit Sub
    End If
    
    Dim dPosX As Double, dPosY As Double
    If oCurve.MidPoint.X <= oCurve.CenterPoint.X Then
        dPosX = oCurve.MidPoint.X * 3 / 2 - oCurve.CenterPoint.X / 2
    Else
        dPosX = oCurve.MidPoint.X / 2 + oCurve.CenterPoint.X / 2
    End If
    If oCurve.MidPoint.Y <= oCurve.CenterPoint.Y Then
        dPosY = oCurve.MidPoint.Y * 3 / 2 - oCurve.CenterPoint.Y / 2
    Else
        dPosY = oCurve.MidPoint.Y / 2 + oCurve.CenterPoint.Y / 2
    End If
    
    Dim oPos As Point2d
    Set oPos = ThisApplication.TransientGeometry.CreatePoint2d(dPosX, dPosY)
    
    Dim oIntent As GeometryIntent
    Set oIntent = oSheet.CreateGeometryIntent(oCurve)
    
    Dim oArcLenDim As LinearGeneralDimension
    Set oArcLenDim = oSheet.DrawingDimensions.GeneralDimensions.AddLinear(oPos, oIntent, , kArcLengthDimensionType)
End Sub

 

2. In Inventor ribbon, right click and choose "Customize User Commands...".

3. In the Ribbon tab, select "ArcLengthDim" macro in the commands, and send it to the "Drawing | Annotate" tab:

ArcLenCommand1.pngArcLenCommand2.png

 

4. Now in the drawing, activate the Annotate tab, and find the macro command:

ArcLenCommand3.png

 

5. Click it and select an arc curve to see the result.

 

This is a sample for you to get starting on this. Hope it helps.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.