AnsweredAssumed Answered

How to get dimensions from AddOrdinateDimension

Question asked by Andrew Braham on May 13, 2020

I wrote a API function to automatically dimension a series of points using ModelDoc.Extension.AddOrdinateDimension. I can get the dimensions added (doesn't seem to work like the examples supplied), the problem I have now is getting the reference for the created dimensions so I can get the ID's for adding equations. How can I get a reference to the created dimensions?


public bool DimensionPoints(SketchSegment origin, IList<SketchPoint> points)
         SelectionMgr selMgr = modelDoc.SelectionManager;


         //Get the dimension offset distance from preferences
         var dimOffset = modelDoc.Extension.GetUserPreferenceDouble((int)swUserPreferenceDoubleValue_e.swDetailingDimToDimOffset, (int)swUserPreferenceOption_e.swDetailingNoOptionSpecified);


         origin.Select4(false, null);
         for(var i = 1; i < points.Count; i++)
            points[i].Select4(true, null);


         modelDoc.Extension.AddOrdinateDimension((int)swAddOrdinateDims_e.swOrdinate, points[0].X, points[0].Y + dimOffset, 0);


         var dims = selMgr.GetSelectedObject6(1, -1); // <- This always returns null


         return true;