Grasshopper

algorithmic modeling for Rhino

'nother quick question...  actually two...

1)  I see the polyline component can take multiple lists of points - is the order in which the polyline is built always the order in which the upstream components are connected to the polyline component?

2) I have lists of points that I want to assign a specific Z coordinate to.  In RhinoScript I would iterate through the list and use arrPts(i)(2)=dblZval in a For loop...  IN GH, I use decompose point and point xyx components, connect x-x ; y-y and the desired value to z...  Easier way?

Thx again,   --Mitch

Views: 1720

Replies to This Discussion

Hey Mitch,

1) The list order of the points determines how the polyline is drawn. The example below is (of course) not dynamic which means you would need to develop a routine to sort your point lists if they aren't already generated in a ordered fashion. Using [Merge] is a visual way to keep track of the attachment order.


2) What you're saying is a straight forward way to do it. If you'd like you could recreate your points with an expression or a scripted component but I don' know that it would save you any trouble.

Thanks for the clarification.


I'm trying to do something similar, but instead of inputting individual points I'd like to input sets of points into the Polyline and have corresponding points in the sets joined.


Specifically, I have a set of points as an output of a HexGrid (say, 4 points for a 2 x 2 grid), which I then move (4 new points) and then rotate (4 new points) and then rotate again (4 new points). I use the outputs of the move and rotate as input vertices in the PolyLine (12 points). What I would like is for the first point from the move to join to the first point of the first rotate and the first point of the second rotate, etc (4 poly lines of 3 points each); instead the 12 points are joined across each other in an order I can't define.

I was following this tutorial (https://www.youtube.com/watch?v=8TFrz2eWyB0) and found my program working differently than the demo at ~18 min in.

Thanks for the help! I'd be happy to provide more context if the above is unclear.

Read this first! How to get help on this forum.

Don't expect anyone to watch a video or recreate your code from scratch.

Thank you - feedback appreciated.

1) not sure exactly what you mean by "upstream" components, but I'll try to explain. the polyline component will connect all of the points in each branch of the tree in a separate polyline. So if you connect multiple lists into the component with different branch/tree structures, then you'll likely get the same result as if you connected each one individually. If you connect multiple lists and they have a similar structure, then since the points all share the same path, the polyline will connect all of them, even though they are from "separate" lists. The ORDER in which their connected will react to the order in which the lists were added though, so that's something to be aware of.

2) nope, that's about the easiest. Compared to scripting, there's a lot of "shorthand" kind of things that you're probably used to that require additional components to take care of. Since we don't have access to the data in the same way as in code, that's kinda just how it is.
I beat you by a minute. At least the answers are the same (less any tree talk)...
I like the merge idea... in looking this over I was some what "annoyed" that the order can't be determined very well when connecting multiple things to a single node. That's probably why I tend to not do it very often. That brings up the whole "is this extra component worth it" debate.
[Merge] works best with trees when there's boundary conditions that need to be maintained or operated on separately. With points for example:

{Start Pt} --> [ ]
{Interior Pts} --> [Merge] --> {All Pts}
{End Pt} --> [ ]

I find [Merge] is useful when putting definitions together, but if one goes back to "tighten up" a finished definition it can easily be removed. So maybe it's not an "extra" component but a "for clarity" component.

The same could be said for all the scalar comps since there isn't any combination of scalar operations that can't easily by wrapped up into an expression... But it's nice to see them sometimes for working things out.
Thanks guys! Taz, the use of the merge component to control the order in which the polyline is built is excellent, thanks. Damien, "upstream" just is my way of referring to stuff which is happening before the data stream gets to a particular component... I like the flow analogy. --Mitch
Then you'll be (probably somewhat secretly) happy to know that I initially used the words "upstream" and "downstream" as well, but people for confused so now it's "input" and "output".

--
David Rutten
david@mcneel.com
Poprad, Slovakia

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