All of the example code you've posted works fine for me within TBC.
Original Message:
Sent: 06-02-2023 10:31
From: Morteza Kiani
Subject: Why System.Collections.Generic doesn't work on TBC while it runs on IronPython
It works for me either while creating that list within the StackPanel Class, something like this. I tried exact code with IronPython Console and it works perfectly fine but not with TBC and IronPython
class TempScript(StackPanel): # this inherits from the WPF StackPanel control def __init__(self, currentProject, macroFileFolder): with StreamReader (macroFileFolder + r"\TempScript.xaml") as s: wpf.LoadComponent (self, s) self.MyPointList=List[Point]()
but the moment you instantiate this list within another class it throws error. something like this:
class MyClass: def __init__MyClass(): myPointsList=List[Point]()
it will work on IronPython console but not with the Trimble
Thank you,
Morteza
------------------------------
Morteza Kiani
Original Message:
Sent: 06-01-2023 16:10
From: Dylan Towler
Subject: Why System.Collections.Generic doesn't work on TBC while it runs on IronPython
The code you posted worked for me by the way. I don't think that code is what is actually causing the problem. It's more likely something that you're passing the the PointList to that is expecting an array. It's hard to tell without seeing the actual code causing the exception but if you wanted to post your full source I could take a look.
------------------------------
Dylan Towler
dylan_towler@buildingpoint.com.au
https://tbcanz.com/anz-toolbox/
Original Message:
Sent: 06-01-2023 09:07
From: Morteza Kiani
Subject: Why System.Collections.Generic doesn't work on TBC while it runs on IronPython
I would not be surprised to not get any response.....
If you write this and run in on IronPython Console, it works but TBC throws this exception and asks to use Array[Type] which is not what I want use. I need to be able to use Collections.Generics not Array[Type].
class point: def __init__(self,x,y,z):... self.X=x... self.Y=y... self.Z=z...>>> PointList=List[point]()>>> point1=point(2,5,6)>>> point2=point(4,7,8)>>> point3=point(64,47,38)>>> PointList.Add(point1)>>> PointList.Add(point2)
above script works on IronPython Console but when I run it with TBC it throws this nasty exception.
------------------------------
Morteza Kiani
------------------------------