Find id number of last point created in Flux
Does anyone know how could I possibly access the id number of the last created point in Flux?
As an example, I know that I can create a point with the Pyflu command:
PointCoordinates(color=Color['White'],visibility=Visibility['VISIBLE'],coordSys=CoordSys['XY1'],uvw=['0','0'],nature=Nature['STANDARD'])
In this case the interpreter numerates automatically the created point. But I can also create a point with its own id number, for example:
Point[5]=PointCoordinates(color=Color['White'],visibility=Visibility['VISIBLE'],coordSys=CoordSys['XY1'],uvw=['0','0'],nature=Nature['STANDARD'])
In my case I created many points in an automated routine in Python and many points were created by some kind of propagation command and numbered automatically.
So, I would like to know how can I get the number of the last created point? Does anybody help?
Thanks
Answers
-
Hi,
Most of the time the last Id is the length for the list : len(Point[ALL])
If you want to be sure you can use :
def sorted_fonction(x):
return float(str(x))
listPointSorted = sorted(Point[ALL], key=sorted_fonction)
lastPointId = str(listPointSorted[len(listPointSorted)-1])Best regards
Yann
0 -
Altair Forum User said:
Hi,
Most of the time the last Id is the length for the list : len(Point[ALL])
If you want to be sure you can use :
def sorted_fonction(x):
return float(str(x))
listPointSorted = sorted(Point[ALL], key=sorted_fonction)
lastPointId = str(listPointSorted[len(listPointSorted)-1])Best regards
Yann
Hi Yann
It really works!
Thank you
0 -
Welcome !
Yann
0