forked from DmytroSE/RevitApi-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLesson 4 CreateFloors
More file actions
41 lines (32 loc) · 1.19 KB
/
Lesson 4 CreateFloors
File metadata and controls
41 lines (32 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Autodesk
from Autodesk.Revit.DB import *
doc = __revit__.ActiveUIDocument.Document
levels = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType().ToElements()
slabs = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Floors).WhereElementIsElementType().ToElements()
p_1 = XYZ(0, 0, 0)
p_2 = XYZ(0, 10, 0)
p_3 = XYZ(10, 10, 0)
p_4 = XYZ(10, 0, 0)
line_1 = Line.CreateBound(p_1, p_2)
line_2 = Line.CreateBound(p_2, p_3)
line_3 = Line.CreateBound(p_3, p_4)
line_4 = Line.CreateBound(p_4, p_1)
for level in levels:
elevation = level.get_Parameter(BuiltInParameter.LEVEL_ELEV).AsDouble()
if elevation == 1000/304.8:
level_0 = level
for slab in slabs:
name = slab.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
if name == 'Floor 200mm':
floorType = slab
curveArray = CurveArray()
curveArray.Append(line_1)
curveArray.Append(line_2)
curveArray.Append(line_3)
curveArray.Append(line_4)
t = Transaction(doc, 'column')
t.Start()
slab_new = doc.Create.NewFloor(curveArray, floorType, level_0, Structure.StructuralType.Footing)
offset = slab_new.get_Parameter(BuiltInParameter.FLOOR_HEIGHTABOVELEVEL_PARAM)
offset.Set(0)
t.Commit()