Ceiling placements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Using the following code I am able to place ceiling based sprinkes on the ceiling but when I try to insert smoke detectors they get placed on the floor.
Totally confused. PLease help:
public static FamilyInstance InsertCeilingElements(Document doc, XYZ location, String FamilyName, Element host)
{
FamilySymbol symbol = null;
foreach (FamilySymbol symbq in fsym)
{
String dd1 = symbq.Name;
String ff = symbq.Category.Name;
Family fm = symbq.Family;
Boolean fnd = false;
String[] Famarr = FamilyName.Split(new string[] { "=>" }, StringSplitOptions.None);
if (dd1 == Famarr[1] && ff == Famarr[0])
{
symbol = symbq;
fnd = true;
break;
}
if (fnd == true)
{
break;
}
}
FamilyInstance Finst = null;
using (Transaction t = new Transaction(doc, "Place Instance"))
{
t.Start();
Ceiling ceil = (Ceiling)host;
Options opt1 = Command.app.Create.NewGeometryOptions();
opt1.ComputeReferences = true;
ceil.get_Geometry(opt1);
GeometryElement geo = ceil.get_Geometry(opt1);
PlanarFace ceilingBottom = null;
foreach (GeometryObject obj in geo.Objects)
{
Solid solid = obj as Solid;
if (null != solid)
{
foreach (Face face in solid.Faces)
{
PlanarFace pf = face as PlanarFace;
if (null != pf)
{
ceilingBottom = pf;
break;
}
}
}
}
Finst = doc.Create.NewFamilyInstance(ceilingBottom, location, XYZ.BasisX, symbol);
t.Commit();
}
return door;
}