+ Reply to Thread
Results 1 to 3 of 3

Thread: Okay, a really really basic Python/Grasshopper question

  1. #1

    Okay, a really really basic Python/Grasshopper question

    I've been looking through all the forums and tutorials but can't see the answer to a really basic problem I have. Grasshopper/Python component. Script gets the active document and then the objects off a layer by name. There are 5 lines on the layer in Rhino. Python reports a list of 5 items... and I can open them up and see that they are the objects I want.

    But when I assign the list to the Grasshopper Component output parameter, I get GOO. A list with strings identifying the types of objects but no longer the objects themselves.

    What do I do to put the objects out so I can pass them to the next Grasshopper component?

    Thanks!

    - Brian -
    Attached Images

  2. #2
    Super Moderator Mitch's Avatar
    Join Date
    May 2010
    Location
    Switzerland
    Posts
    285
    Hi,
    What I learned from Steve is that you can get the real Rhino geometry objects from doc objects with the attribute ".Geometry".

    So, the following seems to work here:
    Python Code:
      import Rhino.Geometry as rg
      import Rhino.RhinoDoc as rd
      import Rhino
       
      layername="junk"
      doc=rd.ActiveDoc
       
      objs=doc.Objects.FindByLayer("junk")
      stuff=[obj.Geometry for obj in objs]
    Hope that is the correct way to be doing this...
    --Mitch
    Attached Images

  3. #3
    Works for me! Thanks Mitch-

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts