-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateWall
46 lines (33 loc) · 1004 Bytes
/
CreateWall
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
42
43
44
45
46
"""
Create a simple Wall objects using python
"""
__author__ = 'Onur Korkmaz'
"""
Sample on how to create a Wall.
Use this sample along with the Video on Youtube.
"""
import clr
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
#Dynamo input
Baselvl = UnwrapElement(IN[0])
Toplvl = UnwrapElement(IN[1])
WallType = UnwrapElement(IN[2])
pt1 = XYZ(0, 0, 0)
pt2 = XYZ(10, 0, 0)
TransactionManager.Instance.EnsureInTransaction(doc)
line = Line.CreateBound(pt1, pt2)
wall = Wall.Create(doc, line, Baselvl.Id, False)
wall.WallType = WallType
TopCons = wall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE)
TopCons.Set(Toplvl.Id)
TransactionManager.Instance.TransactionTaskDone()
OUT = wall