Revit API - CeilingType not retrievable from Ceiling

Revit API - CeilingType not retrievable from Ceiling

Anonymous
Not applicable
1,095 Views
2 Replies
Message 1 of 3

Revit API - CeilingType not retrievable from Ceiling

Anonymous
Not applicable

Edit: I've found that unlike Wall and Floor class, Ceiling class does not have a getter for CeilingType.  What are my options for getting this?  I've tried casting Ceiling  to HostObject which compiles, but breaks in revit.

 

 

Hi,

 

I'm diving into the Revit API for the first time to make a tool.  I've got the tool up and running for Walls and Floors, but ceilings are not acting the way they should (according to the docs).  specifically, I cannot get a CeilingType property from my Ceiling element.  Below is a sequence that works perfectly for my List of floors

 

//Floor overload for wipe
        public static void wipe(List<Floor> uniqueFloors)
        {
            foreach (Floor currItem in uniqueFloors)
            {
                CompoundStructure cs = currItem.FloorType.GetCompoundStructure();
                ElementId fakeId = new ElementId(-1);

                cs = currItem.FloorType.GetCompoundStructure();

However, replacing Floor with Ceilings, I am unable to retrieve currItem.CeilingType.

 

//Floor overload for wipe
        public static void wipe(List<Ceiling> uniqueCeilings)
        {
            foreach (Ceiling currItem in uniqueCeilings)
            {
                CompoundStructure cs = currItem.CeilingType.GetCompoundStructure(); //error, no "CeilingType property"
                ElementId fakeId = new ElementId(-1);

                cs = currItem.CeilingType.GetCompoundStructure();

according to the Revit API docs, Ceilings Inherit the same as Floors, so I have no idea why this isn't working.  Explicitly casting to HostObject doesn't work either.  Any help is appreciated!

 

 

0 Likes
Accepted solutions (1)
1,096 Views
2 Replies
Replies (2)
Message 2 of 3

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

Hi @Anonymous ,

try using the below code

Ceiling c ;
CeilingType CT = doc.GetElement(c.GetTypeId()) as CeilingType;

I hope this helps.


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 3

Anonymous
Not applicable

Awesome, that did it. Thanks!

0 Likes