- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
While placing sprinkles/Ceiling Lights on ceilings I am trying to offset them by a negative value so that they get placed below the ceiling but somehow the sprinkers/Ceiling Lights are getting placed on top of it. Kindly help:
The code to place ceiling sprinkers/Ceiling Lights is as follows:
public static FamilyInstance InsertCeilingElements(Document doc, XYZ location, String FamilyName, Element host,double offset)
{
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)
{
XYZ normal = pf.Normal;
ceilingBottom = pf;
XYZ x = new XYZ(0, 0, 0);
Finst= doc.Create.NewFamilyInstance(face, location, x, symbol);
Finst.get_Parameter(BuiltInParameter.INSTANCE_FREE_HOST_OFFSET_PARAM).Set(-150);
t.Commit();
break;
}
}
}
}
}
return Finst;
}
Solved! Go to Solution.