create a wall:Wall.Create(doc, line, baseLevel.Id, False)

create a wall:

import clr
#Import module for Revit 
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
#import module for the Document and transactions
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#import Revit API 
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
#get the document 
doc = DocumentManager.Instance.CurrentDBDocument
#Dynamo input 
baseLevel = UnwrapElement(IN[0])
topLevel = UnwrapElement(IN[1])
wallType = UnwrapElement(IN[2])
#create point for line 
pt1 = XYZ(0, 0, 0)
pt2 = XYZ(10, 0, 0)
#use safe transaction with Revit 
TransactionManager.Instance.EnsureInTransaction(doc)
#create line
line = Line.CreateBound(pt1, pt2)
#create wall using Revit API
wall = Wall.Create(doc, line, baseLevel.Id, False)
#Set the wall type to Dynamo input
wall.WallType = wallType
#Get the top constarint parameter using built in parameter
#Revit Document shows it as WALL_HEIGHT_TYPE
topConstraint = wall.get_Parameter(BuiltInParameter.WALL_HEIGHT_TYPE)
#Set the top constraint 
topConstraint.Set(topLevel.Id)
#Finish Transaction with task done
TransactionManager.Instance.TransactionTaskDone()

OUT = wall

 

转载于:https://www.cnblogs.com/ShirleyX/p/8023010.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值