How do I get the geometry information in a script?

How do i get the data shown in “Object Properties, Details…” using a script?
I need the things listed under “Geometry:”

Hi @Bogdan_Chipara,

you might try below hack to get to the whole text, then filter out what you need:

import rhinoscriptsyntax as rs

def WhatCommand():
    id = rs.GetObject("Select object", 0, True, True)
    if not id: return
    rs.Command("_-What _Clipboard", True)
    result = rs.ClipboardText()
    rs.MessageBox(result, 0, "Object Description")

@Alain, the rs.ObjectDump method is still missing in the WIP.


Thanks clement!
Is there any way I could use RhinoCommon for this?

Hi @Bogdan_Chipara, i do not see something like the _What command in RhinoCommon, but you could probably runthe Rhino command as a script command as i did in my script above. The command is:

_What _Clipboard

Note that your object(s) have to be selected when this command is run. The description text then has to be taken from the clipboard. Does that help ?


If you are using the Rhino WIP, you can call RhinoObject.Description.

– Dale

Yes, your script works well @clement! Thanks!
Using something like rs.ObjectDump would be more clean than rs.Command and more easy to understand than RhinoObject.Description. So I hope it will get implemented.

@dale, @clement, here it is using Rhino WIP:

import Rhino
from scriptcontext import doc
import rhinoscriptsyntax as rs

obj = rs.GetObject()
log =  Rhino.FileIO.TextLog()

ob = doc.Objects.Find(obj)
desc= Rhino.DocObjects.RhinoObject.Description(ob,log)

print log

In both cases (using _-What _Clipboard and RhinoObject.Description) I have a problem with the data listed in the Geometry section.
For example in Extrusions or Polylines it returns:

Closed polyline with 4 points.
(0,0,0), (2,0,0), ..., (0,0,0)
domain = 0 to 8

So there are 4 points and I only see 3.

So you really don’t want the output of the What command, you want the output of the List command.

import Rhino
import rhinoscriptsyntax as rs
obj_id = rs.GetObject()
geom = rs.coercegeometry(obj_id)
dump = Rhino.Runtime.HostUtils.DebugDumpToString(geom)
print dump

– Dale

1 Like

Yes! This is perfect!
Thank you!