Jump to content
Bernardo

Find id number of last point created in Flux

Recommended Posts

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
14 minutes ago, Yann Le FLoch 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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...