• 创作工场专业版,一问多答!更智能、更完整、更原创
  • 这是一个超强内容创作平台,它会写文章、做设计、绘图、敲代码,有问必答!
🔥点击使用-高级专业版🔥

写一个 Dynamo 放置 revit

时间2023-02-22 22:17:09 提问来自 广东省广州市 的网友 分类创作 浏览697
// Dynamo Script to Place Rebar in Revit // This script will place rebar in Revit using Dynamo // First, import the necessary libraries import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) // Create a new document and get the active view from it doc = DocumentManager.Instance.CurrentDBDocument view = doc.ActiveView // Get the current selection from the document and get its elements selection = revitDoc.Selection // Start a transaction to modify the document                                                                                                                                                                                                                                                                                                      transaction = New Transaction(doc, "Place Rebar")  transaction.Start()  try:   // Create a rebar type from parameters  rebarTypeParams = [RebarBarTypeParameters("Rebar Type", RebarStyle .Standard)]  rebarTypeName = "My Rebar Type"  rebarTypeCreated = doc .Create .NewRebarBarType(rebarTypeParams, rebarTypeName) // Create a new rebar set with parameters                                                                                                                                      setParams = [RebarSetParameters("Set Name", rebarTypeCreated)]  setName= "My Set"                  // Create an instance of the set in the active view setCreated= doc .Create .NewRebarSet(view, setParams, setName) // Place an instance of the set at given location locationPoint= XYZ (0, 0 ,0 ) instanceCreated= doc .Create .NewRebarInstanceAtPoint (view ,setCreated ,locationPoint ) // Commit changes to document transaction .Commit () except: transaction .RollBack ()

点击这里,进行内容创作

创作工场 免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。
点击这里>>使用🔥专业版,更聪明、更完整、更原创!

上一篇 他爱我吗 下一篇 专升本月志英语形容词,副词学习感受1200字