Remove WireSize from Dynamo Python

Hello everyone I do not know if you could advise me, I need to remove some wiring size based on the TemperatureRating and WireMaterial. I know that the way to eliminate them is using the RemoveWireSize method from the TemperatureRatingType class and I asked as an argument a wiring size to be able to Remove them, what I have been able to do so far is to get the list of wiring sizes that I want to eliminate, but I have not been able to unwrapping, please check the code down below thanks.

import clr
import sys
import System
#import Revit API
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
from Autodesk.Revit.DB.Electrical import *
from Autodesk.Revit.UI import *
# Import Dynamo RevitNodes
import Revit #Enable namespace typing
from Revit.Elements import *
clr.ImportExtensions(Revit.Elements) # ToDSType(bool) extension method
clr.ImportExtensions(Revit.GeometryConversion)# Import ToProtoType(), ToRevitType() extension methods
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
#Internal Definition (all custom defined functions to be in this region)
def ToList(input):
    if isinstance(input, list):
        return input
        return [input]
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
wiretype = UnwrapElement(IN[0])
result = []

#Main codes to be within this region
for i in wiretype:
    tempRating = i.TemperatureRating
    wireMaterial = i.WireMaterial
    Wiresizes = tempRating.WireSizes
    for ws in Wiresizes:
        foundWS = [ws.Size, ws.Ampacity, ws.Diameter]
        if ws.Size != "2000":
        	Remsz = ws.GetType()
        	Rem = tempRating.RemoveWireSize(Remsz)
#End of region


OUT = result

Screenshot 2022-01-19 213948

Just from reading through the API Iā€™m not sure you need Remsz = ws.GetType(). The RemoveWireSize() method takes a WireSize argument which you should already have with ws.

1 Like