0% found this document useful (0 votes)
1K views7 pages

Revit Dynamo Scripts for Electrical Wiring

This document contains code for creating wires in Revit including importing necessary libraries and references, getting input data, creating the wires in a transaction, and handling errors. It also includes code for getting the list of available wire types and wiring types from the model.

Uploaded by

Wil Frid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views7 pages

Revit Dynamo Scripts for Electrical Wiring

This document contains code for creating wires in Revit including importing necessary libraries and references, getting input data, creating the wires in a transaction, and handling errors. It also includes code for getting the list of available wire types and wiring types from the model.

Uploaded by

Wil Frid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
  • Create Wires
  • Details of Lines and Codes
  • Electrical One-Line Diagram

CREATE WIRES

MAIN CODE

import clr
[Link]('ProtoGeometry')
from [Link] import *

[Link]("RevitServices")
import RevitServices
from [Link] import DocumentManager
from [Link] import TransactionManager

[Link]('System')
from [Link] import List

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
[Link](pyt_path)

[Link]("RevitAPI")
import Autodesk
from [Link] import *
[Link]("RevitNodes")
import Revit
[Link]([Link])
[Link]([Link])

[Link]("RevitAPI")
import Autodesk
from [Link] import *
import System

doc = [Link]
uiapp = [Link]
app = [Link]

from [Link] import *

wiretypeid=UnwrapElement(IN[0]).Id
viewid=UnwrapElement(IN[1]).Id
wiringtype= UnwrapElement(IN[2])
verpt= UnwrapElement(IN[3])
sconn= UnwrapElement(IN[4])
econn= UnwrapElement(IN[5])

verptxyz=[]
for v in verpt:
[Link]([Link](True))

[Link](doc)

errorReport=[]
try:
wireN=[]

[Link]([Link](doc,wiretypeid,view
id,wiringtype,verptxyz,sconn,econn))
OUT = wireN
except:
import traceback
errorReport = traceback.format_exc()
OUT = errorReport
[Link]()

WIRE CODE
import clr
# Import RevitAPI
[Link]("RevitAPI")
import Autodesk
from [Link] import *

[Link]("RevitNodes")
import Revit
[Link]([Link])

[Link]("RevitServices")
import RevitServices
from [Link] import DocumentManager
from [Link] import TransactionManager
doc = [Link]

import Autodesk
from [Link] import *
import System

wt = FilteredElementCollector(doc).OfClass(WireType)
wtn=[]
wte=[]
for w in wt:
[Link]([Link](w))
[Link](w)

OUT = wtn,wte

WIRING TYPE
import clr
[Link]('ProtoGeometry')
from [Link] import *

# Import DocumentManager and TransactionManager


[Link]("RevitServices")
import RevitServices
from [Link] import DocumentManager
from [Link] import TransactionManager

# Import RevitAPI
[Link]("RevitAPI")
import Autodesk
from [Link] import *
import System
#Assign your output to the OUT variable
OUT = [Link](WiringType)

Electrical One-Line Diagram.

You might also like