Ghpython executing rhino command and get the result inside grasshopper?


Namely I am talking about the command Hydrostatics.

The results are displayed as plain text in a window, not displayed in the console.
I cannot find Hydrostatics in RhinoCommon. I am not surprised as it is quite easy to get these results with simple intersections and volume calculations.

So, how can I parse the result from the output back in Grasshopper?

PS: Yes I know I can develop the hydrostatics calculations myself both in python and plain grasshopper. I probably even have already done this in one of my GH definitions. But humor me, please. Let’s say I’m currently that lazy and rusty using GH and python that I just want to run the rhino command instead.

Thanks in advance

obj = sc.doc.Objects.Add(x)
if (rs.SelectObject(obj)):
    rs.Command("_-hydrostatics _Enter _HistoryWindow")
    history = rs.CommandHistory()
    last_index = history.rfind("Hydrostatics")
    a = history[last_index:]
    sc.doc.Objects.Delete(rs.coercerhinoobject(obj)) (17.4 KB)

KILL / RELOAD Grasshopper without restarting Rhino

Perfect! Thanks a lot @Mahdiyar ! :partying_face: