Grasshopper

algorithmic modeling for Rhino

hi everyone,

how can I move a series of copies in python? I have only succeeded in moving the curve itself but I can't manage to duplicate it...any tip?

Views: 397

Replies to This Discussion

Hi Fabio,

You the CopyObject function instead of MoveObject one. Replace your last line with:

    duplicate_curve1.append(rs.CopyObject(curve1, (0,0,i*20)))

thanks djordje!

hi djordje, may I ask you a question?

I am trying to use list.index () to select a series of curves out of copies (the first, fourth, seventh and so on). in gh I would use cull index. is there a function that will allow me to do that in python? list.index is not finding any index in the list...

Hi,

Built-in "index" function would return an index of supplied object in your list. In this case it would be guid of your curves, that needs to be supplied.

What you need actually is SelectObjects rhinoscriptsyntax function, which requires guids of your copied curves, not its indices. Replace the last three lines of your upper code with:

listSelCurves1 = []
for i in range(0,len(duplicate_curve1),3):
    listSelCurves1.append(duplicate_curve1[i])
rs.SelectObjects(listSelCurves1)

Please attach your .py/.gh files too, for any future issues.
I would also recommend reading the Rhino Python primer.

thanks djordje...

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service