As
Please find the modified code:
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elemSet) { UIApplication uiap = cmdData.Application; UIDocument uidoc = uiap.ActiveUIDocument; Document doc = uidoc.Document; View view = doc.ActiveView; XYZ startPoint = new XYZ(0, 0, 0); XYZ endPoint = new XYZ(UnitUtils.Convert(100, DisplayUnitType.DUT_MILLIMETERS, DisplayUnitType.DUT_DECIMAL_FEET), 0, 0); using (Transaction t = new Transaction(doc, "Creat Detail Line")) { t.Start(); Line l1 = Line.CreateBound(startPoint, endPoint); doc.Create.NewDetailCurve(view, l1); t.Commit(); TaskDialog.Show("Creat Detail Line", "Line was created"); } return Result.Succeeded; }
If this reply satisfies your need please don't forget to mark it as an answer.