Find id number of last point created in Flux

Bernardo_22553
Bernardo_22553 Altair Community Member
edited October 2020 in Community Q&A

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

Tagged:

Answers

  • Yann_Le_Floch
    Yann_Le_Floch
    Altair Employee
    edited December 2019

    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

  • Bernardo_22553
    Bernardo_22553 Altair Community Member
    edited December 2019

    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

  • Yann_Le_Floch
    Yann_Le_Floch
    Altair Employee
    edited December 2019

    Welcome !

    Yann