Start
[Transaction (TransactionMode. Manual)]
[Regeneration (RegenerationOption. Manual)]
Cmd: IExternalCommand
{
Result Execute (ExternalCommandData upload data, msg, ElementSet elements)
{
UIDocument uiDoc = upload data. Application. ActiveUIDocument;
UIApplication uiApp = response data. Application;
Document doc = uiDoc. Document;
Selection selection = uiDoc. Selection;
Transaction ts = Transaction (doc ,);
Ts. Start ();
DuctType ductType =;
FilteredElementCollector collector = FilteredElementCollector (doc );
Collector. OfClass (DuctType ));
(Element el collector. ToElements ())
{
DuctType = el DuctType;
;
}
Reference refDuct = selection. PickObject (ObjectType. Element ,);
Duct duct = doc. GetElement (refDuct) Duct;
XYZ xyz = selection. PickPoint (); LocationCurve lCurve = duct. Location LocationCurve;
IntersectionResult interResult = lCurve. Curve. Project (xyz); (interResult! =)
{
Doc. Create. NewDuct (xyz, interResult. XYZPoint, ductType );
}
Ts. Commit ();
Result. Succeeded;
}
} Url: http://greatverve.cnblogs.com/p/Curve-Project.html