Grasshopper

algorithmic modeling for Rhino

Stumped for lack of working examples: I have three lists of numbers here represented by letters too for clarity, created by Range, and simply want a hierarchical tree or even just a single branching level in which each final branch contains a list of one number from each list in all its variations with the other two lists.

12

AB

xy

Becomes eight possible combinations:

1Ax

1Ay

1Bx

1By

2Ax

2Ay

2Bx

2By

Either I could immediately break into 8 branches or branch twice from 2 items to 4 items then from those 4 items to 8 final items. I keep trying grafting with all manner of tree components and *never* obtain a simple dual branching fractal tree structure. I barely even need a tree actually, but I'd prefer each final branch to contain a list I can pull each final value individual value out of rather than dealing with string extraction. This is all to eventually plug all these variations into a parametric mesh model that now uses three sliders, and Python script also to bake them all as OBJ files.

Crucially I also need to obtain the numbers to use as part of my multiply exported OBJ files. I can so far only get a single range to export as a series of OBJ files automatically but not the whole three list array of them.

Views: 2167

Replies to This Discussion

I found one thread related to this:

http://www.grasshopper3d.com/forum/topics/bake-several-sliders-comb...

"Bake several sliders combinations"

...and that's exactly what I'm trying to do eventually. and also *save* them to files as meshes with specific file names via my own Python component that is already working.

May have solved it unless there are any memory problems generating a thousand objects in memory, though after I bake each one and export it as an OBJ file via Python I then delete it from Rhino:

Python script:

import rhinoscriptsyntax
import Rhino

if Enable:

    Rhino.RhinoDoc.ActiveDoc.Objects.AddMesh(Meshes, Rhino.DocObjects.ObjectAttributes())

    rhinoscriptsyntax.Command("SelAll") # Select all
    # The - modifier replaces a Rhino dialog box with command line options
    # Learn what command line options exist by manually using the command with the - modifier
    rhinoscriptsyntax.Command("-Export " + DirectoryPath + FileNameA + "." + FileNameB + "." + FileNameC + FileNameD + "." + FileNameE +".obj Enter Enter") # Using .obj automatically selects the file type option
    rhinoscriptsyntax.Command ("Delete") # Nuke the baked mesh

The useful post was here, after so many hours of searching. I'd still like to know how to avoid having to parse strings to extract my array entry values.

http://www.grasshopper3d.com/forum/topics/cross-reference-what-is-i...

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service