-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathLesson 5 CreateWall
More file actions
26 lines (24 loc) · 1.03 KB
/
Lesson 5 CreateWall
File metadata and controls
26 lines (24 loc) · 1.03 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
import Autodesk
from Autodesk.Revit.DB import FilteredElementCollector, BuiltInParameter, BuiltInCategory, Line, Wall, XYZ, Transaction
doc = __revit__.ActiveUIDocument.Document
levels = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels).WhereElementIsNotElementType().ToElements()
walls = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsElementType().ToElements()
for level in levels:
elevation = level.get_Parameter(BuiltInParameter.LEVEL_ELEV).AsDouble()
if elevation == 1000/304.8:
level_0 = level
for wall in walls:
name = wall.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
if name == 'C25/30 - 250mm':
wall_type = wall
p_1 = XYZ(0,0,level_0.Elevation)
p_2 = XYZ(50,0,level_0.Elevation)
p_3 = XYZ(50,50,level_0.Elevation)
line_1 = Line.CreateBound(p_1, p_2)
line_2 = Line.CreateBound(p_2, p_3)
lines = [line_1, line_2]
t = Transaction(doc, 'column')
t.Start()
for line in lines:
wall_1 = Wall.Create(doc, line, wall_type.Id, level_0.Id, 3000/304.8, 0, False, True)
t.Commit()