Message 1 of 12
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to Dimension the center of the two circles
But it does become an arc edge
How can I correct the code?
I beg you for your help, thank you!
[Transaction(TransactionMode.Manual)]
[Regeneration(RegenerationOption.Manual)]
public Result Execute
(ExternalCommandData commandData, ref string message, ElementSet elements )
{
UIApplication uiapp = commandData.Application;
UIDocument uidoc = uiapp.ActiveUIDocument;
Document doc = uidoc.Document;
Reference ref1 = uidoc.Selection.PickObject(ObjectType.Element, "pick an element Arc A:");
Element elem1 = doc.GetElement(ref1);
Curve elem_Curve1 = (elem1.Location as LocationCurve).Curve;
Arc elem_arc1 = elem_Curve1 as Arc;
XYZ elem_pt_1 = elem_arc1.Center;
Reference ref2 = uidoc.Selection.PickObject(ObjectType.Element, "pick an element Arc B:");
Element elem2 = doc.GetElement(ref2);
Curve elem_Curve2 = (elem2.Location as LocationCurve).Curve;
Arc elem_arc2 = elem_Curve2 as Arc;
XYZ elem_pt_2 = elem_arc2.Center;
using (Transaction trans = new Transaction(doc, ""))
{
trans.Start();
Line line = Line.CreateBound(elem_pt_1, elem_pt_2);
ReferenceArray refArray = new ReferenceArray();
refArray.Append(ref1);
refArray.Append(ref2);
doc.Create.NewDimension(doc.ActiveView, line, refArray);
trans.Commit();
}
}
Solved! Go to Solution.