Capturing the output of cubit.cmd in python

Is it possible to “capture” the output of cubit.cmd in the python interface?

I tried the following in the python “script” window but it only returned True (I was hoping to capture the output information)

%>test_out=cubit.cmd(‘list vol 742’)
Volume Entity (Id = 742)
Visible: Yes
1 Owned Surface:
Name Id
Surface 24 24

In MCNP_ID_5001.

Journaled Command: list volume 742

%>print test_out
True

Unfortunately, there is not currently a way to do this in Python. We have some things using C++, but not Python.

That would be a very helpful feature, and probably not too difficult to code into the API. A string with the console output in python could open many possibilities, and drastically reduce the time spent on creating complicated filters that select objects based on center position, shared surfaces and so on. It would also avoid having to count the objects and keep track of how many of them are around, reducing the debug time.
is there any hope to see that in the future? It’s very helpful and many users will benefit from it.

Welcome @balep!

I can see how that could be helpful - there have been times where I wished I could do that! I’m not sure if things have changed from four years ago, so I’ll have to do some digging around. If it is possible (and not too “hacky”) then it is very likely that we’ll implement this functionality. And if it’s not (yet) possible, we’ll investigate what would be needed to enable this functionality.

Thanks for the help looking forward to have this feature in the code interface.