Announcements

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

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

d.ahmed.hb
Contributor

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

d.ahmed.hb
Contributor
Contributor

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?

0 Likes
Reply
Accepted solutions (1)
1,154 Views
3 Replies
Replies (3)

naveen.kumar.t
Autodesk Support
Autodesk Support
Accepted solution

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

0 Likes

d.ahmed.hb
Contributor
Contributor
Hey @naveen.kumar.t, thanks a ton. It worked like a charm. Helped me out big time 🙂
0 Likes

alaraJ3LSY
Enthusiast
Enthusiast

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

0 Likes