Create electrical wire from linesCreate electrical wire from lines

hai.
anyone help me how to Create electrical wire from lines in Revit dynamo have created chamfare wire but i have to convert the line to electrical wire

hi
there is a code in revit api we can use it

api

i have for this example two socket with detail lines between them

this is my sample code you code start from it

the main code:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *


clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

clr.AddReference('System')
from System.Collections.Generic import List

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)


clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)


clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB.Electrical import *
import System

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application

from System.Collections.Generic 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:
	verptxyz.append(v.ToXyz(True))

TransactionManager.Instance.EnsureInTransaction(doc)

errorReport=[]
try:
	wireN=[]
	wireN.append(Autodesk.Revit.DB.Electrical.Wire.Create(doc,wiretypeid,viewid,wiringtype,verptxyz,sconn,econn))
	OUT = wireN
except: 
	import traceback
	errorReport = traceback.format_exc()
	OUT = errorReport
TransactionManager.Instance.TransactionTaskDone()

for the wire type code:

import clr
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc =  DocumentManager.Instance.CurrentDBDocument

import Autodesk
from Autodesk.Revit.DB.Electrical import *
import System

wt = FilteredElementCollector(doc).OfClass(WireType)
wtn=[]
wte=[]
for w in wt:
	wtn.append(Element.Name.GetValue(w))
	wte.append(w)
	
OUT = wtn,wte

for wiringtype code:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB.Electrical import *
import System


#Assign your output to the OUT variable
OUT = System.Enum.GetValues(WiringType)

and the final result is like this

Thank you so much.

I have modified something have look once is it okay?

find the attached dynamo script

best regards

Tanveer

in this way i strongly recommend to start the process run circuit by circuit … not for all categories at once … because it will be completed and hard to find errors … by practices you could find a better way to run all over the project

okay thank you