Grasshopper

algorithmic modeling for Rhino

Hi I am trying to program in Python something like the geometry pipeline component where you can obtain all the geometry contained in a layer whose name contains a string of characters. 

Input: string of characters contained in the layer name.

Output: all the geometry contained in those layer(s). 

I tried this: 

import rhinoscriptsyntax as rs
import scriptcontext as sc
import Rhino as rh
import GhPython as gp

sc.doc = rh.RhinoDoc.ActiveDoc
layers = rs.LayerNames()
a = filter (lambda w: x in w, layers)

for i in a:
obj = sc.doc.Objects.FindByLayer(i)
b = obj

But I have not been able to make it work, it does not output the geometry elements.

Someone knows how to solve this?

Thanks in advance, 

Alejandro 

Views: 3369

Replies to This Discussion

Hi Alejandro,

please, next time, could you attach your definition? It would save some time and attract more answers.

You could use the Geometry Pipeline component, or this script.

I hope this helps,

Giulio
--
Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service