Unable to find the modelcurve in all elements of type

I created model curve in dynamo with modelcurve.bycurve.
Then, selecting modelcurve in “Element Types” and using “All Elements of Type” looking for the model curve created.
But it return null.
May I know where is the major problem causing this. Thank you very much.

hello @awtyin1997
there is a “limitation” of Revit API
try this method with a Python Script

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

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

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication

typ_class = UnwrapElement(IN[0])
try:
	coll = FilteredElementCollector(doc).OfClass(typ_class).WhereElementIsNotElementType().ToElements()
except:
	coll = FilteredElementCollector(doc).WhereElementIsNotElementType().ToElements()
	coll = [x for x in coll if isinstance(x, typ_class)]
OUT = coll

2 Likes

that’s exactly the solution
thank you very much