Some jornal APREPRO commands which are not interfaced with Python API

There are journal APREPRO commands which do not have an interface to the Python APIs. For example, webcut commands and generating ciccles.
In the Python API, we sometimes want to access to the objects that are generated after webcut commands. Are there any elegant way of doing this?
The combination of cubit.cmd(‘webcut’) and cubit.get_last_id(‘volume’) is not always function.

Hi,

you can make use of the webcut option [group_results]. This will create a new group with the involved entities from the webcut. After that you can query the last group id and take a look at the entities in the group. Here is a short example how it could look like

import cubit
cubit.init('')

cubit.cmd(f"reset")
cubit.cmd(f"create brick x 1 y 1 z 1")
cubit.cmd(f"webcut volume all with plane xplane offset 0 group_results")
cubit.cmd(f"webcut volume all with plane yplane offset 0 group_results")
cubit.cmd(f"webcut volume all with plane zplane offset 0 group_results")

webcut_group_id = cubit.get_last_id('group')
webcut_volumes_id = cubit.get_group_volumes(webcut_group_id)
for id in webcut_volumes_id:
 print("volume " + str(id) + " was involved in the last webcut")

2 Likes

I see, It worked. Thank you.