Grasshopper

algorithmic modeling for Rhino

I'm trying to remap a flattened panel path structure {A}(i) where i is variable within each path, to the structure {A;B}(i) where {A;B} are the number of modules in X and Y axis, with i being the subdivision of each panel

The screenshot attached shows how i'm currently doing this with the Path Mapper, however I now want to make the 44 (X Module) a variable .. which I understand cannot be done within the Path Mapper.

I know similar questions have been asked before, and i've looked at these but all seem to only deal with this process where (i) is a consistent value in all paths, so flattening and re-division is easy

does anyone have any ideas how to do this more efficiently and parametrically?

cheers,

owen

Views: 2507

Attachments:

Replies to This Discussion

There's almost always a grasshoppery way to avoid using the path mapper, but if you really want all of the functionality of the path mapper with the ability to specify dynamic variables, this "dynamic path mapper" script will do the trick. It works exactly the same as the path mapper, but the from and to mapping strings are specified in the definition, allowing you to dynamically customize them, as in the examples. 

Attachments:

andrew,

great, thanks for this .. looks very useful indeed

in the bottom example i note the use of '%' in your target path: {{d;i%{0}}} .. i can see what it does, but do not understand where this comes from? Can you explain this or where it is documented?

cheers,

owen

this is modulo - a mathematical operator that returns the remainder of a division. I was just using it as an example, since you can basically do any sort of math you want in a path mapper expression. In the example I'm using it to divy up data into branches - the set 0,1,2,3,4,5,6,7 % 2 yields 0,1,0,1,0,1,0,1.

'you can basically do any sort of math you want in a path mapper expression'

thanks Andrew, very good to know!

David .. if you're watching,  this has probably been asked before but the Path Mapper would be even more useful if you could also input variables as this script does ... is this a possibility for future development?

Hi Owen,

probably not for GH1. 

--

David Rutten

david@mcneel.com

andrew - i've just been replacing all my manual Path Mapper components with this and its really great, thanks very much for sharing this

(i really must pick the C# book i'd been reading up again)

david, totally understand :)

cheers,

owen

hi andrew,

i've just discovered an issue which appears to be caused by empty branches culled when passed via this 'dynamic Path Mapper' Script component .. the attached GH file shows the same data passed through both series of Path Mappers and the script in parallel, note for example path {14;8} is culled as it contained no geometry

is there anything that can be done to prevent this? I had only just noticed it as the other locations i'd used it did not contain nulls

the problem that this seems to be causing is when Orienting geometry from one plane to another, these missing branches at the Geometry input seem to be creating duplicates as the Plane inputs have no missing branches - instead of getting {14-33;0-57} I'm getting {14-33;0-57} except for the last branch where i get {33;0-245}.

I don't really know why these missing paths are causing the issue but if i use the normal Path Mapper which doesn't cull these i don't get the duplicates in the last branch. Maybe i'm misunderstanding how this should work, but if branch {14;8} does not exist at the Geometry input of the Orient component, it should skip over this - the Source and Target Planes {14;8} are not used?

there is a second Gh file illustrating this issue, but i can work around it for now but switching back to a static Path Mapper

cheers,

owen

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service