Hi
I'm trying to place a line-based family on an edge of a roof. The API creates the instance but not in the location specified by the diagonal edge that was selected. Any ideas?
public void voidCut()
{
Document doc = this.Document;
UIDocument uidoc = new UIDocument(doc);
FamilySymbol voidSym = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).Cast<FamilySymbol>().FirstOrDefault(q => q.Family.Name.Contains("BoxGutterVoidSweep"));
Reference edgeRef = uidoc.Selection.PickObject(ObjectType.Edge);
RoofBase roof = doc.GetElement(edgeRef) as RoofBase;
Edge edge = roof.GetGeometryObjectFromReference(edgeRef) as Edge;
Curve curve = edge.AsCurve();
using (Transaction t = new Transaction(doc, "void"))
{
t.Start();
FamilyInstance voidInstance = doc.Create.NewFamilyInstance(curve, voidSym, null, StructuralType.NonStructural);
doc.Regenerate();
LocationCurve lc = voidInstance.Location as LocationCurve;
lc.Curve = curve;
t.Commit();
}
}