algorithmic modeling for Rhino
Hi Erik Sven, you can use path mapper: {A;B} -> {B\13;B}
No ... path mapper doesn't accept variables[13] (you'll need the Dark Side and GH_Lexer for that).
In the mean time get the Dark Side (where cookies are plenty and there's free warm Guinness for all).
And speaking about GH_Lexer ...
You can totally do it with path mapper as long as the value 13 is a constant.
If you want control over 13 via a slider you can do it using Replace Paths:
You can of course also do it with C#, but there's no need to scare people witless by using that as the go-to solution for any grasshopper problem.
C# it's just another alternative (and in the majority of cases I add the usual: "...although also easily doable with components ... blah, blah" meaning that it's just ... another alternative, he he).
But strictly speaking ... indeed Erik asked for a component based solution, so I've added ... just another alternative.
best
@peter
I appreciate the response. I looked at the code and it sorta makes sense, but the other solutions certainly help. THanks!
@Pieter
THanks for breaking down the path mapper. Such a powerful tool.
Best,
Erik
Thank you for your replies. This is one area that I always get tripped up on. I wonder if anyone can code this with Python.
@Peter - I was going for the path mapper originally, but was using the pattern {A;B/13} which was obviously returning an error. If you can explain the structure of your pattern that would be helpful to my understanding of your approach.
@David - I appreciate your native component solution. This is very helpful!
@the Dark Side. once again your approach works like a charm, but I am a novice python speaker and have yet to learn C#. Got a long way to go with python, but I hope to learn C# soon.
Thank you again for your replies!
Erik
Erik
I know that you after the cookies (or the Guinness) he he: that's the reason for providing the 3 DS thingies.
Plan A: is the way to go: like David's native solution it deals with paths (branches) thus is the more "safe" approach. For instance Imagine branches with unequal N of items etc etc.
Plan B: Is the way that PM works ... but obviously {A;B} > {B\something} assumes that branches are equally populated: a recipe for Armageddon in other cases.
Plan C: Is equally "shallow" since getting a List out of a Tree and then doing the Skip/Take thingy assumes that ... see Plan B . Of course using FromList.ToList().GetRange(startIndex, nOfItems);
is the same kind of rabbit hole.
Native: See Plan C.
PS: Something/OtherSomething IS NOT the same animal with Something\OtherSomething not to mention that {A;B\Something} gives 2 dimensional (wrong) results.
PS: Some of your Lofted stuff is "weird"/twisted (check this, this and that he he).
PS: Notify if you want a pack of 66.66 "easy" C# examples about how to get a tree and make chaos or order or whatever comes first.
Moral: cold of warm Guinness? that's the 1M question.
best, The Lord of Darkness
Hi Erik Sven,
the trick was to use integer division, you can find all about it on the web.
I decided to ignore the other replies (except David's and Vicente's), simply because none of them produced the outcome you said you were after.
Also I'm not very fond of self-acclaimed deities (of whatever), especially if they tend to ramble about al sort of unrelated and non-sensical stuff, so I ignored that too.
I do share Vicente's concern about the need for this.
What is the exact reason you want to do this for? Not always, but having to modify the tree structure in this way is usually a symptom of a problem that could be fixed by refactoring the definition leading up to this point.
I guess the components you used here are just an example, but the obvious solution would be to divide the loft output in 3 branches (using partition list, for example) before using the Deconstruct Brep component.
Doh, I hoped to be the first person to use the term "refactoring" referring to a Grasshopper definition. Unfortunately, I found one other comment from 2011.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by