public Result Execute( ExternalCommandData commandData, ref string message, ElementSet elements) { UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; Selection sel = uidoc.Selection; ISelectionFilter f = new JtElementsOfClassSelectionFilter <Dimension>(); Reference elemRef = sel.PickObject( ObjectType.Element, f, "Pick a dimension"); Dimension dim = doc.GetElement(elemRef) as Dimension; XYZ p = GetDimensionStartPoint(dim); List <XYZ> pts = GetDimensionPoints(dim, p); int n = pts.Count; Debug.Print("Dimension origin at {0} followed " + "by {1} further point{2}{3} {4}", Util.PointString(p), n, Util.PluralSuffix(n), Util.DotOrColon(n), string.Join(", ", pts.Select( q => Util.PointString(q)))); List <double> d = new List <double>(n); XYZ q0 = p; foreach (XYZ q in pts) { d.Add(q.X - q0.X); q0 = q; } Debug.Print( "Horizontal distances in metres: " + string.Join(", ", d.Select(x => Util.RealString(Util.FootToMetre(x))))); using (Transaction tx = new Transaction(doc)) { tx.Start("Draw Point Markers"); SketchPlane sketchPlane = dim.View.SketchPlane; double size = 0.3; DrawMarker(p, size, sketchPlane); pts.ForEach(q => DrawMarker(q, size, sketchPlane)); tx.Commit(); } return(Result.Succeeded); }