Accessing all data from referenced rhino geometry

Hello,

I have been using grasshopper for quite some time and decided to learn scripting. However, it’s relatively new field for me and still lacking a lot of knowledge.

I want to make a custom component that retrieve the “Object Description” of meshes in Rhino which has imported from .obj file.

The .obj file represents small house unit layout in 3D and includes meshes, that are grouped together as their typology such as wall ceiling and different type of furniture.

I was able to use some plugins to retrieve material, colour and GUID of the meshes however, I need all the information which could be found in object description which you can see it from the image below.

What sort of function should I use for grasshopper python in this particular case?

Reference House.3dm (1.6 MB)

Thanks in advance.

Hi @Amartuvshin_Naranger,

This script works with the Rhino WIP:

https://github.com/mcneel/rhino-developer-samples/blob/6/rhinopython/SampleObjectDescription.py

However, there isn’t a function in Rhino 5 that returns the contents of the What command.

– Dale

1 Like

Dear Mr. @dale

I have downloaded rhino WIP and this script works perfect with python in Rhino.
However, I am getting error when I use it for grasshopper python.

It seems like I need to tweak the code for grasshopper python but I when try the rs.GetObject in grasshopper, it doesn’t allow me to select meshes from rhino viewport.

I think I am doing it wrong or it would be much better if I connect reference mesh directly into “input x” of python component.

I think I should tweak the code for ghpython and but I don’t know really how to achive this particular process. Could you tell me what should I start with?

Thank you very much for your time and concern.

Best regards,
Amaraa

Retrive_reference_object_1.gh (114.1 KB)

You don’t typically reference data with rhinoscript selection methods in general in GH using Python. Instead, use the variable on the inputs side to obtain a value.

Have a look at this tutorial: Your first Python script in Grasshopper.

Object description is only available in Rhino objects. Grasshopper 1.0 has no data attributes attached to geometry, so things like “Short description” is not present. A script won’t make it appear if it’s not there. You can however read the description if you specifically reference the original Rhino object by its ID.

You can input IDs in WIP. In Rhino 5, input them as text. Then switch to the Rhino doc as active doc. At that point you can use coercerhinoobject.

Please let me know if you need more help.