I have no idea how to catch results from this command:
Volume Displacement = …
Center of Buoyancy = …
Wetted Surface Area = …
Waterline Length = …
Maximum Waterline Beam = …
Water Plane Area = …
Center of Floatation = …
Can anyone give me a hint to return results into my python script.
I also like to run this comamnd for the same object several times with different elevation.
Without selecting the same object again.
Hi @Vojko, you could route the results to the clipboard, then print the text for each level:
#! python 2
import rhinoscriptsyntax as rs
def DoSomething():
message = "Select surfaces or polysurfaces for hydrostatics"
obj_ids = rs.GetObjects(message, 8+16, True, True, True)
if not obj_ids: return
cmd = "_-Hydrostatics "
cmd += "_WaterlineElevation {} "
cmd += "_Symmetric=_Yes "
cmd += "_Longitude=X _Enter "
cmd += "_Clipboard "
levels = [-0.25, 0.0, 0.25]
for level in levels:
rc = rs.Command(cmd.format(level), False)
if rc:
text = rs.ClipboardText()
print "Results for level: {}\n{}".format(level, text)
DoSomething()
it should print someting like below for each level:
Results for level: -0.25
Volume Displacement = 14398.3
Center of Buoyancy = -1.33073, 1.61587, -6.00779
Wetted Surface Area = 2900.65
Waterline Length = 27.919
Maximum Waterline Beam = 42.9205
Water Plane Area = 1198.3
Center of Floatation = -1.33073, 1.61587,0
…
Do you need the results as usable variables or just as text ?
_
c.