Requested conversion of non-convertible types

Hi, how can I hide this warning? It’s not a penalty, but it’s still there.

DSCore.Object.Type(x)=="System.String"?
x:
Math.Round((Revit.Element.BoundingBox(x).MaxPoint.Z-a)*100,1);

At startup I had this one with the same message:

x=="à faire"?
x:
Math.Round((Revit.Element.BoundingBox(x).MaxPoint.Z-a)*100,1);

The lists containing x and a are the same size.

There are elements and strings in lst [ x ]
there are only floats in lst [ a ]

cordially

christian.stan

Okay, I found a solution using Python.

import sys
import clr

clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
# Import Revit API
clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
lsx=UnwrapElement(IN[0])
lsa=IN[1]


OUT = [x if x=="à faire" else round((x.get_BoundingBox(doc.ActiveView).Max.ToPoint().Z-a)*100,1) for x,a in zip(lsx,lsa)]

thanks,cordially

christian.stan

2 Likes