Wire sizes Material (Electrical Settings)

Hi there

I would like to know if there a way to create new wire sizes material with nodes in Dynamo.

Best Regards

I don’t have an immediate answer but have you been able to create a list of these parameters in the dynamo environment. This would be my first attempt to try to solve

Looks like you can add them manually but I am unsure if dynamo will be able to talk/control this deep into REVIT.

Interested to know the answer if you get there.

As far I go, I just realize that i need how to create a new element type, because the three ones in the list of the node “All elements of type” are the one that came manual in Revit, i think if we create another wire type in that list, we can now manipulate all the parameters. I do not know if I am wrong or not.

Hello,
i’m not sure if there is a node for this
you can try this method with Python

import clr
import sys
import System

#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB.Electrical import *

clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

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

wiretype = UnwrapElement(IN[0])
strSize = IN[1]
ampacity = IN[2]
diameter = IN[3] * 0.00328084 # convert to decimal feet
error = None
tempRating = wiretype.TemperatureRating
wireMaterial = wiretype.WireMaterial 
TransactionManager.Instance.EnsureInTransaction(doc)
try:
	newSize = tempRating.AddWireSize(strSize, ampacity, diameter)
except:
	error = "Error, this ampacity or size already exists for :\nTemperatureRating : {}\nWireMaterialType : {}".format(tempRating.ToDSType(True).Name, 
	                                                                                                           wireMaterial.ToDSType(True).Name)
	TaskDialog.Show("Error Size", error)

TransactionManager.Instance.TransactionTaskDone()
if error is not None:
	OUT = error
else:
	OUT = 'Success', newSize
1 Like

Hi Thank you for the help. I do not know if I am doing right because prompts me "Warning: Get.ValueAtIndex operation filed " in the code block

hi,
in your code bock replace List.clean by List.Clean

filters = wireType.Name == "THWN" ? wireType : null;
out = List.Clean(filters, false)[0];

Hi I think it works, but now saying

and on the python node

Because you are using the wrong output, you can use FilterByBoolMask node if you prefer

Oh I see yeah you right, now my filter works but on the python node says

btw, thank you for your help

the error indicates that the Size is already existing (script launched twice?) verify in your electrical settings

addWireSize

I figure out what was the problem, I need to remove the existing one on my particular material which in this case is copper, now works fine thank you very much.