Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Ceiling placements

2 REPLIES 2
Reply
Message 1 of 3
Intecinfocom
278 Views, 2 Replies

Ceiling placements

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;
}

2 REPLIES 2
Message 2 of 3
jeremytammik
in reply to: Intecinfocom

Dear Intecinfocom,

 

As always when working with the Revit API, one good method to proceed to explore this is to create the desired situation through the user interface and explore that in detail using RevitLookup or more detailed exploration using one of the Python or Ruby shells:

 

http://thebuildingcoder.typepad.com/blog/2013/11/intimate-revit-database-exploration-with-the-python...

 

In this case, there seems to be some difference in behaviour between the two types of family instances that you are inserting.

 

Check and compare their host properties, and whether there are any offset parameters that are being used somehow.

 

Meanwhile, I will ask my colleagues whether they have any other suggestions for you.

 

Thank you and good luck,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 3
jeremytammik
in reply to: Intecinfocom

Dear Intecinfocom,

 

This is what the development team suggest for you:

 

There are different types of hosting that need to be considered:

 

  • Face
  • Ceiling
  • Floor
  • Unhosted
  • etc., others...

 

Based on your description, you are placing ceiling based sprinklers, so there is probably some logic in the family definition to find the ceiling automatically for them.

 

You need to be aware what kind of hosting the smoke detector uses. If they are unhosted smoke detectors, Revit won’t assume an elevation/host. If they are face hosted, there may be a separate method you need to call to specify which face to host the element.

 

Here are some discussions on family instance placement on The Building Coder:

 

http://thebuildingcoder.typepad.com/blog/about-the-author.html#5.25

 

Best regards,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community