/// <summary>
/// Select the point outside the air duct and the air duct, and draw the air duct perpendicular to the air duct.
/// </summary>
[Transaction()]
[Regeneration()]
public class cmd : IExternalCommand
{
public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
{
UIDocument uiDoc = ;
UIApplication uiApp = ;
Document doc = ;
Selection selection = ;
Transaction ts = new Transaction(doc, "https://");
();
//Get a type of air duct
DuctType ductType = null;
FilteredElementCollector collector = new FilteredElementCollector(doc);
(typeof(DuctType));
foreach (Element el in ())
{
ductType = el as DuctType;
break;
}
//
Reference refDuct = (, "Select a duct:");
Duct duct = (refDuct) as Duct;
XYZ xyz = ();//Select a little
LocationCurve lCurve = as LocationCurve;
IntersectionResult interResult = (xyz);//The projection of the point on the straight line
if (interResult != null)
{
(xyz, , ductType);
}
();
return ;
}
}