- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi
I'm trying to do some automatic dimensioning in VBA. I want to give outer dimensions to a part, but not from a sketch. For this I will need to dimension parts from point to point. This is no problem when the points are on lines, since then I can use start, mid and end points which is always a corner. Sometimes its not a line but an arc and this is where my problem occurs.
It seems like the snap points created when you activate the dimension command and hover your mouse over a point on the arc are not available through the API. So I am trying to use the midpoint of an arc to to create a dimension to another point. When I try this the dimension keeps being created at the centerpoint instead.
Is it possible to create a dimension with VBA from an CircularArcCurve.midpoint to another point?
And can you get a geometry intent just by giving a point2d and the curve? So I can dimension to any point?
this is the code i used to try it out, and i attached a screenshot, left is what i want right is what i get
Sub test() Dim dwg As DrawingDocument Set dwg = ThisApplication.ActiveDocument Dim oview As DrawingView Set oview = ThisApplication.CommandManager.Pick(kDrawingViewFilter, "Pick a view") Dim arc As DrawingCurve For Each arc In oview.DrawingCurves If arc.CurveType = kCircularArcCurve Then Exit For Next Dim crv As DrawingCurve Set crv = oview.DrawingCurves.Item(2) Dim int1 As GeometryIntent Set int1 = dwg.ActiveSheet.CreateGeometryIntent(crv, crv.MidPoint) Dim int2 As GeometryIntent Set int2 = dwg.ActiveSheet.CreateGeometryIntent(arc, arc.MidPoint) Call dwg.ActiveSheet.DrawingDimensions.GeneralDimensions.AddLinear(oview.Position, int2, int1, kHorizontalDimensionType) End Sub
Solved! Go to Solution.