How to obtain get_last_id in the classical journals

How do I get the last volume id with the classical journals like “get_last_id(‘volume’)” in python API.
In the following journal, in stead of “#{id1=1}”, I would prefer to obtain last id.

create sphere radius 100
volume 1 copy move z 200 nomesh
volume {#id1} rename ‘sph1’
volume {#id2} rename ‘sph2’

The APREPRO function Id(“type”) will do what you want. From the documentation,

Returns the ID of the entity most recently created with the specified type. Acceptable types include: “body”, “volume”, “surface”, “curve”, “vertex”, “group”, “node”, “edge”, “quad”, “face”, “tri”, “hex”, “tet”, or “pyramid”.

In your example, do something like

create sphere radius 100
volume {Id("volume")} name 'sph1'
volume sph1 copy move z 200
volume {Id("volume")} rename 'sph2'

Thank you. It helps me a lot.