Good Day,
I'm having difficulty creating a line based family instance on the geometry of a curtain panel, On a wall it works perfectly.
I have tried using geometry from symbol and instance with no luck. If posable could you anyone please provide code that is able to draw a line based family on the front face of the curtain wall using the face edge for the line.
Thank You.
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
{
UIDocument uidoc = commandData.Application.ActiveUIDocument;
Document doc = uidoc.Document;
Selection selection = uidoc.Selection;
var app = commandData.Application;
using (Transaction tx = new Transaction(doc, "Place Family"))
{
tx.Start();
// Get face and ensure it has references
Reference faceRef = selection.PickObject(ObjectType.Face, "Select a face");
// Get edge
Reference edgeRef = selection.PickObject(ObjectType.Edge, "Select an edge");
Element edgeElem = doc.GetElement(edgeRef);
Edge edge = edgeElem.GetGeometryObjectFromReference(edgeRef) as Edge;
Line line = edge.AsCurve() as Line;
var symbol = new FilteredElementCollector(doc)
.OfCategory(BuiltInCategory.OST_StructuralStiffener)
.WhereElementIsElementType()
.First() as FamilySymbol;
doc.Create.NewFamilyInstance(faceRef, line, symbol);
tx.Commit();
}
return Result.Succeeded;
}