Python list to csharp list

Hi Everyone…I have got a python list of Revit curves in a nested list which I want to add to a csharp list where the data type is a curve but I am getting an error. Can anyone suggest me on doing this…I have attached the images for reference. Thanks in advance…!!

@CHANDU I think you need to loop over the nested lists as well

Here an example

import clr
import sys
import System
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS

#import Revit API
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB

#import net library
from System.Collections.Generic import List

import Revit

#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

#Preparing input from dynamo to revit
lstcurves = UnwrapElement(IN[0])

net_Lst = List[List[DB.Curve]]()
for sublst in lstcurves:
	lst = List[DB.Curve]([x.ToRevitType() for x in sublst])
OUT = net_Lst

it is better to post your code, to facilitate the users who will come to help you

1 Like

Thanks a lot…!! It worked for me…