Convert System.Object to Element

Hello everyone, I have a problem with my dynamo script and I haven’t found the answer on the other topics.
With a Python nodes I create a Site Subregion and after this I want to take this subregion as an element. But in outpu of my python node I only have a System.Object (Autodesk.Revit.Architecture.SiteSubRegion).
How can I convert this System Object to an Element (Topography) in the same python node or in another one ?

Okay, so you want the Topography element which is linked to the Site SubRegion?

You can get that by calling the TopographySurface property of the SiteSubRegion

Do you have any picture showing you case?

image

I uploaded a screenshot of Dynamo. When you said I can calling the TopographySurface property, how ?
I also upload the python code :

import clr

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Architecture import *
import System.Collections.Generic
from System.Collections.Generic import List

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

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

doc = DocumentManager.Instance.CurrentDBDocument

# Get input variables
subregions = IN[0]
host = UnwrapElement(IN[1])

# Init variables
curveLoops = []
createdSubRegions = []
error = []

TransactionManager.Instance.EnsureInTransaction(doc)

# Get groups of curves (exploded polycurves!) and creates per group a SubRegion
for i in subregions:
	# Init CurveLoop for every curve group
	x = CurveLoop()
	
	# Iterate the seperate curves -> convert type to Revit Type -> add to CurveLoop
	for j in i:
		x.Append(j.ToRevitType())
	curveLoops.append(x)
	
	# Add layer to list
	y = [x]
	yI = List[CurveLoop](y)
	
	if SiteSubRegion.IsValidBoundary(yI):
		# Create SubRegion out of the CurveLoop group and add its to 'createdSubregions'
		newSubRegion = SiteSubRegion.Create(doc, yI, host.Id)
		createdSubRegions.append(newSubRegion)
	
TransactionManager.Instance.TransactionTaskDone()

# Output
OUT = createdSubRegions

https://www.revitapidocs.com/2022/a6e38474-7fe8-4c4a-e138-96dca3391ae9.htm

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

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

doc = DocumentManager.Instance.CurrentDBDocument

# Get input variables
subregions = IN[0]
host = UnwrapElement(IN[1])

# Init variables
curveLoops = []
createdSubRegions = []
topos = []
error = []

TransactionManager.Instance.EnsureInTransaction(doc)

# Get groups of curves (exploded polycurves!) and creates per group a SubRegion
for i in subregions:
	# Init CurveLoop for every curve group
	x = CurveLoop()
	
	# Iterate the seperate curves -> convert type to Revit Type -> add to CurveLoop
	for j in i:
		x.Append(j.ToRevitType())
	curveLoops.append(x)
	
	# Add layer to list
	y = [x]
	yI = List[CurveLoop](y)
	
	if SiteSubRegion.IsValidBoundary(yI):
		# Create SubRegion out of the CurveLoop group and add its to 'createdSubregions'
		newSubRegion = SiteSubRegion.Create(doc, yI, host.Id)
                topos.append(newSubRegion.TopographySurface)
		createdSubRegions.append(newSubRegion)
	
TransactionManager.Instance.TransactionTaskDone()

# Output
OUT = topos