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: 

Select Floor Slabs and Height Difference between them to place formwork family

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
d.ahmed.hb
1098 Views, 3 Replies

Select Floor Slabs and Height Difference between them to place formwork family

Hello,

 

im a little new to C#, I was trying to look for a way where the Plug-In lets me select a top floor slab and then the bottom floor slab, so that I can subtract the parameters from both and get the height difference. The issue is I do not understand how to tell the code to let me select the second floor slab. Is there a link which describes something similar?

 

I have been successful in selecting the first floor slab and display the height of its bottom surface. To calculate the height difference I need to be able to select the bottom floor slab and get its top height, then I can subtract the two. But this seems to be a challenge. Any similar link or code, which does this?

Labels (7)
3 REPLIES 3
Message 2 of 4
naveen.kumar.t
in reply to: d.ahmed.hb

Hi @d.ahmed.hb ,

Are you looking for this?

 //Lets you to Select first floor
                Reference r1 = uidoc.Selection.PickObject(ObjectType.Element);
                Floor firstFloor = doc.GetElement(r1.ElementId) as Floor;
                Parameter firstFloorParameter = firstFloor.get_Parameter() (or) firstFloor.LookupParameter("");
                double firstFloorHeight = firstFloorParameter.AsDouble();

//Lets you to Select second floor
                Reference r2 = uidoc.Selection.PickObject(ObjectType.Element);
                Floor secondFloor = doc.GetElement(r2.ElementId) as Floor;
                Parameter secondFloorParameter = secondFloor.get_Parameter() (or) secondFloor.LookupParameter("");
                double secondFloorHeight = secondFloorParameter.AsDouble();

Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
d.ahmed.hb
in reply to: naveen.kumar.t

Hey @naveen.kumar.t, thanks a ton. It worked like a charm. Helped me out big time 🙂
Message 4 of 4
alaraJ3LSY
in reply to: d.ahmed.hb

Gentlemen, 
Does this work with sloping floors (top or bottom or both)?

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

Post to forums  

Autodesk Design & Make Report