Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5892

Python: Display RH objects by layer in GH Python

$
0
0

Hi,
I have referencing Rhino Objects from the active rhino doc (with python) and I am not able to understand how to display them in GH. I am able to bake them back into Rhino. GH is also showing that I am properly referencing them.

I think this may have to do with setting the active document, but I am not sure. Attached is my Rhino File as well as my GH script which contains the python code.

I am interested in understanding how to do this with the Grasshopper.Kernel.GH_Convert.ObjRefToGeometry technique as well as a a method not using the GH API.

Thank you.

import Rhino
import scriptcontext as sc
import Grasshopper

rh_obj_list =
#rh_objs = sc.doc.Objects.FindByLayer(“ceilings”)
rh_objs = Rhino.RhinoDoc.ActiveDoc.Objects.FindByLayer(“foo”)

for obj in rh_objs:
refobj = Rhino.DocObjects.ObjRef(obj)
goo = Grasshopper.Kernel.GH_Convert.ObjRefToGeometry(refobj)
rh_obj_list.append(goo)

sc.doc = Rhino.RhinoDoc.ActiveDoc

a = rh_obj_list

sc.doc = ghdoc

find_by_layer.gh (3.1 KB) find_by_layer.3dm (124.9 KB)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5892

Trending Articles