- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys,
In my job common situation is when I need to make arc length dimension on a drawing. (type "D" ->click on a line-> right click-> dimesnion type -> arc length).
I was wondering if there is an option to do macro or something to make this steps faster. Maybe there is an option to make custom button or short key that will instantly choose dimension type of arc length.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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:
4. Now in the drawing, activate the Annotate tab, and find the macro command:
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Thanks yuhanzhang, it works perfect!
Maybe, do You can help me with this... when I want to stop the program ArcLengthDim and press "Esc" this window appear:
I want skip this window. I guess it is a matter of one line code to stop by pressing "Esc"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sorry for late response, you can add a check in the VBA code to exit the sub if user cancels the selection:
Dim oCurveSeg As DrawingCurveSegment
Set oCurveSeg = ThisApplication.CommandManager.Pick(kDrawingCurveSegmentFilter, "Select an arc drawing curve")
If oCurveSeg Is Nothing Then
Exit Sub
End If
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.