FAQ (Frequent Questions) - Grasshopper2024-03-28T14:27:15Zhttps://www.grasshopper3d.com/forum/categories/faq-frequent-questions/listForCategory?categoryId=2985220%3ACategory%3A598480&feed=yes&xn_auth=noPanel special code mappings.tag:www.grasshopper3d.com,2016-09-20:2985220:Topic:16029582016-09-20T22:51:04.860ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Grasshopper on Rhino6 will have support for 'special codes'. When enabled in the menu, special character combinations in curly braces will be replaced by other characters.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654993238?profile=original" target="_self"><img class="align-center" src="http://storage.ning.com/topology/rest/1.0/file/get/2654993238?profile=RESIZE_320x320" width="200"></img></a></p>
<p></p>
<p>The attached file shows all predefined mapping pairs. This data is always up to date as it is harvested directly from the panel api itself.…</p>
<p></p>
<p>Grasshopper on Rhino6 will have support for 'special codes'. When enabled in the menu, special character combinations in curly braces will be replaced by other characters.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654993238?profile=original" target="_self"><img width="200" src="http://storage.ning.com/topology/rest/1.0/file/get/2654993238?profile=RESIZE_320x320" width="200" class="align-center"/></a></p>
<p></p>
<p>The attached file shows all predefined mapping pairs. This data is always up to date as it is harvested directly from the panel api itself.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654993384?profile=original" target="_self"><img width="500" src="http://storage.ning.com/topology/rest/1.0/file/get/2654993384?profile=RESIZE_1024x1024" width="500" class="align-center"/></a></p> Grasshopper data types.tag:www.grasshopper3d.com,2016-08-11:2985220:Topic:15801082016-08-11T16:29:16.721ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Grasshopper is an application that deals with a lot of different types of data. These data types can come from 6 different sources and some of them will not be known when Grasshopper is written and compiled. The six potential sources are:</p>
<ol>
<li>Primitive types such as Booleans, Integers, Colors, Strings, etc. Grasshopper uses these types itself a lot.</li>
<li>Other .NET Framework types such as System.Drawing.PointF or System.Collections.Generic.HashSet<T>. Grasshopper does not…</li>
</ol>
<p>Grasshopper is an application that deals with a lot of different types of data. These data types can come from 6 different sources and some of them will not be known when Grasshopper is written and compiled. The six potential sources are:</p>
<ol>
<li>Primitive types such as Booleans, Integers, Colors, Strings, etc. Grasshopper uses these types itself a lot.</li>
<li>Other .NET Framework types such as System.Drawing.PointF or System.Collections.Generic.HashSet<T>. Grasshopper does not use these types to during component <-> component communication, but someone else might.</li>
<li>RhinoCommon types such as Point3d, Circle, Plane, Brep, Curve etc. Many of these are used natively, but certainly not all of them.</li>
<li>Types defined in Grasshopper itself.</li>
<li>Types defined in plug-ins for Grasshopper.</li>
<li>Types defined in VB/C#/Python scripts that run inside Grasshopper.</li>
</ol>
<p></p>
<p>Although clearly some of these are known to the developer during the time of writing, not all of them can be. Yet Grasshopper still needs to be able to interpret and use types it may know nothing about. Some of the things Grasshopper needs to be able to do with data of any type are:</p>
<ol>
<li>Convert it to text so tooltips and panels can be populated with <em>useful</em> descriptions of data.</li>
<li>Convert it to and from other types.</li>
<li>Duplicate data so we can change it without affecting the original.</li>
<li>Test data for validity.</li>
<li>Save types to *.gh files and load them back in. (note: this works especially poorly at the moment.)</li>
<li>Preview geometric types in the viewport.</li>
<li>Bake geometric types to the Rhino document.</li>
<li>Transform geometric types.</li>
<li>Calculate bounding boxes of geometric types.</li>
<li>Be able to store null states of each type.</li>
</ol>
<p></p>
<p>To overcome the problem of (A) needing to do so many things while (B) knowing nothing about the types in advance an interface is defined in the Grasshopper SDK and all data which is stored inside parameters <em>must</em> implement this interface. This allows GH to do the things from the second list to all the types from the first list.</p>
<p></p>
<p>The <em>IGH_Goo</em> interface is is usually nothing more than a wrapper around the actual data which provides a bunch of functionality for whatever it wraps. For example take the primitive <em>Boolean</em> (or <em>bool</em> in C#). It's a structure so it can never be null, and it can only exist in either a <em>true</em> or a <em>false</em> state.</p>
<p></p>
<p></p>
<p>GH uses booleans a lot so it provides an IGH_Goo implementation for Boolean. This wrapper class tells GH that a boolean value can be converted into an integer (false -> 0, true -> 1), into a colour (false -> black, true -> white), into a string (false -> "false", true -> "true) and so on. The wrapper class also knows how to write and read boolean values to and from *.gh files, and because we're now dealing with a wrapper class we can have null instances in a collection of boolean values. The wrapper <em>doesn't</em> tell GH how to preview or bake booleans, because booleans are not a geometric type of data.</p>
<p></p>
<p>Because so many data types are not in any way geometric, there is a second interface called <em>IGH_GeometricGoo</em> which extends <em>IGH_Goo</em> with stuff like transforming, bounding-boxing etc.</p>
<p></p>
<p><em>Almost always</em> component developers and scripters can ignore any of the <em>IGH_Goo</em> types, because they are mostly used for internal bookkeeping. However sometimes a developer will either want to access the functionality that goo provides or they wish to inject a new, previously unknown type of data into a Grasshopper file. In these cases some knowledge of IGH_Goo and its derived interface and classes is required.</p> Which Scripting Language should I learn? C#, VB.Net, or Python?tag:www.grasshopper3d.com,2016-03-28:2985220:Topic:14933942016-03-28T06:38:18.773ZAndrew Heumannhttps://www.grasshopper3d.com/profile/AndrewHeumann
<p>This question comes up a lot, and the answers below are compiled from my own experience and a number of posts by others:</p>
<p><a href="http://www.grasshopper3d.com/forum/topics/grasshopper-vs-python-c-vb-net">http://www.grasshopper3d.com/forum/topics/grasshopper-vs-python-c-vb-net</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/vb-vs-c-vs-python">http://www.grasshopper3d.com/forum/topics/vb-vs-c-vs-python…</a></p>
<p></p>
<p>This question comes up a lot, and the answers below are compiled from my own experience and a number of posts by others:</p>
<p><a href="http://www.grasshopper3d.com/forum/topics/grasshopper-vs-python-c-vb-net">http://www.grasshopper3d.com/forum/topics/grasshopper-vs-python-c-vb-net</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/vb-vs-c-vs-python">http://www.grasshopper3d.com/forum/topics/vb-vs-c-vs-python</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/which-programming-language-should-i-focus-on-vb-or-python">http://www.grasshopper3d.com/forum/topics/which-programming-language-should-i-focus-on-vb-or-python</a></p>
<p></p>
<p><span class="font-size-4"><strong>VB.Net and C#</strong></span></p>
<p>VB.Net and C# both belong to the ".Net" family of languages, and the things you can do with them in Rhino/Grasshopper are nearly 100% equivalent. Grasshopper itself was written in a combination of VB.Net and C#. Some advantages/comments, in no particular order:</p>
<p></p>
<ol>
<li><strong>Performance</strong> - VB.Net and C# scripts tend to execute faster because they are "Just-in-time" compiled as opposed to interpreted. </li>
<li><strong>Autocomplete</strong> - both VB.Net and C# have rich autocomplete functionality in their respective script editor components - significantly more so than the python editor. This can be helpful for beginners since you can "hunt" for methods and properties by just typing a "." after an object name and looking at the list of available methods/properties. </li>
<li><strong>Native Component development</strong> - If you eventually want to develop GHA assemblies/plug-ins for grasshopper, <span style="text-decoration: underline;">as of Rhino 5</span> you will have to use one of these two languages. However, there are plans to introduce python-based plugins in Rhino 6. Even so, the resources around plug-in development are very rich in the C# and VB.Net environments (with c# seeming to be the more popular of the two).</li>
<li><strong>"Strong Typing"</strong> - VB.net to some degree, and C# especially, are less "forgiving" languages than python - they require you to know about the data type of the objects you're operating on. This can sometimes result in more verbose code - as you explicitly convert from type to type - but it also promotes good programming practice and helps make errors more understandable. </li>
<li><strong>.Net ecosystem</strong> - using a .Net language means you have access to the thousands of libraries publicly available, and the process of referencing these libraries and making use of them is comparatively straightforward relative to python. More on this in the following section. </li>
<li><strong>Resources/Support</strong> - At least as of <a href="http://www.grasshopper3d.com/xn/detail/2985220:Comment:514217" target="_blank">2012</a>, VB and C# turned up more results on this forum than python, and I think you'll find slightly more expert-level coders in those languages able to help you here. </li>
<li><strong>Which one between the two? C# or VB.Net?</strong> - Personally, I greatly prefer C# - I find it to be cleaner and clearer to use. I also have some programming background in C++/Java/Processing so I found the "C family" approach to be more familiar. As David and Damian point out in some of the posts linked above, C# is more popular than either python or VB.net in the rest of the coding world. However, if you are learning without any prior programming experience you may find VB.net to be a bit easier to learn. </li>
</ol>
<p></p>
<p><span class="font-size-4"><strong>Python</strong></span></p>
<p>Python is, without a doubt, a beautiful and elegant language, which is probably more than can be said for VB.Net/C#. It is very popular with beginner coders, and its syntax is more readily understandable. </p>
<ol>
<li><strong>Syntax</strong> - Python is beautiful to read and write. Its syntax is very clear and free of extraneous punctuation (for example the ";" line endings in c#). It has many very nice language features that make common tasks more concise, like its loop syntax, list comprehensions, list "map" and "filter."</li>
<li><strong>Multiple ways to talk to Rhino/Grasshopper</strong> - Python enables two general approaches to interacting with the Rhino/Grasshopper environment: RhinoCommon and RhinoScriptSyntax. If you have prior experience with Rhinoscript, you may find RhinoScriptSyntax to be preferable - it adapts many of the methods you're familiar with to the python language, and simplifies some tasks. A word of caution though - working with Rhinoscriptsyntax can introduce a performance hit relative to RhinoCommon operations. C# and VB.net by contrast can only work with RhinoCommon. </li>
<li><strong>"Goodies"</strong> - The Python environment in Grasshopper has some "special features" that the other languages lack. In particular, the "GHPythonLib" library enables the ability to call most Grasshopper components from within your code, and the ability to easily enable parallel processing to improve performance. (A word of caution though - these two features do not seem to "play well" with each other, there may be bugs causing memory leaks that result in increasingly worse performance with each execution).</li>
<li><strong>Cross-Platform</strong> - Unlike C#/VB.net, Python can be used natively in Rhino for Windows and Rhino for Mac.</li>
<li><strong>Direct scripting in Rhino</strong> - You can also use Python directly in the Rhino environment without the need for Grasshopper if you desire, using the Rhino Python editor.</li>
<li><strong>IronPython / Ecosystem issues</strong> - one frustration / potential downside to working with Python for Rhino/GH is that though there is a vast, amazing ecosystem of external libraries for Python, getting these to install/work properly in the Rhino/GH environment can be a real pain - largely because the language is actually "IronPython," a version of python designed to work closely with the .Net ecosystem. Many popular libraries like numpy and scipy are <a href="http://www.grasshopper3d.com/forum/topics/importing-numpy" target="_blank">very challenging</a> to get working in Rhino/GH.</li>
<li><strong>Scripting in other programs</strong> - Especially in the AEC industry, Python is a popular scripting language for other applications. Tools like Revit, Dynamo, Blender, and ArcGIS all offer their own Python scripting interface - so learning Python in Rhino/GH can give you a leg up in eventually scripting in these other programs. </li>
<li><strong>Python's Stock is Rising</strong> - there are currently a number of efforts to improve the "status" of python within the Rhino/GH ecosystem. The python editor in Rhino 6 has a number of improvements, not least of which is the ability to "compile" add-ons for Grasshopper written in python. I'm sure Giulio can speak to other upcoming improvements. </li>
</ol>
<p></p>
<p>I hope this summary helps you find the right option for you. Ultimately you can't go wrong; concepts from <em>any</em> of the available scripting languages will make it much easier to learn the next one. In my day to day work I use a combination of both C# and python, where appropriate, and I love them both. </p>
<p></p>
<p>I hope others will feel welcome to chime in on this FAQ and add their own thoughts about advantages/disadvantages of these various options! If you have time, read through some of the other posts linked to at the beginning - there's lots of additional great information there. </p> Is it possible to call the functions of a Grasshopper component from inside a (C#/VB.Net/Python) script?tag:www.grasshopper3d.com,2015-12-09:2985220:Topic:14182132015-12-09T18:25:09.430ZAndrew Heumannhttps://www.grasshopper3d.com/profile/AndrewHeumann
<p>While there is not in fact a 1:1 correspondence between components and methods in a simply accessible library, <strong>it is under certain circumstances possible</strong> to call the functions of a GH component from inside a script.</p>
<p></p>
<p><strong>However</strong>, it should be noted that to do so introduces a significant amount of overhead, which may impact performance. This is because (to the best of my understanding) all the methods described below actually instantiate and execute…</p>
<p>While there is not in fact a 1:1 correspondence between components and methods in a simply accessible library, <strong>it is under certain circumstances possible</strong> to call the functions of a GH component from inside a script.</p>
<p></p>
<p><strong>However</strong>, it should be noted that to do so introduces a significant amount of overhead, which may impact performance. This is because (to the best of my understanding) all the methods described below actually instantiate and execute a virtual Grasshopper document, with components and everything else. Whenever possible, it is advisable to simply call RhinoCommon functions - these are designed to be called in code and are more streamlined.</p>
<p></p>
<p><strong>Python</strong></p>
<p>Grasshopper's Python is unique among the scripting languages in that it has a "node-in-code" mechanism for this purpose in the form of the ghpythonlib library and its "components" class. Here is some example code:</p>
<p></p>
<p><code>from ghpythonlib import components as ghcomp<br/> import Rhino<br/> a = ghcomp.Circle(Rhino.Geometry.Plane.WorldXY,25.0)<br/> <br/> result = ghcomp.DeconstructBrep(b)<br/> faces = result[0]<br/> edges = result[1]<br/> vertices = result[2]</code></p>
<p>This code will call the "Circle" component with the world XY base plane and a radius of 25, and then call the "Deconstruct Brep" component on a brep (input to the script as "b").</p>
<p>The arguments passed to the function will correspond to the inputs of the component, and the function will return the output (the data itself in the case of a component with only one output, and a tuple of data in the case of multiple outputs, as in the second example above). </p>
<p></p>
<p>For more info on this technique, see <a href="https://stevebaer.wordpress.com/2013/12/11/ghpython-node-in-code/" target="_blank">this post by Steve Baer</a>.</p>
<p></p>
<p><strong>C#/VB.Net</strong></p>
<p>James Ramsden has described a method for doing this in these two posts on his blog:</p>
<p><a href="http://james-ramsden.com/run-a-grasshopper-component-from-within-your-c-code/" target="_blank">Run a Grasshopper Component from C# Code</a></p>
<p><a href="http://james-ramsden.com/read-and-edit-persistent-data-in-grasshopper-components/" target="_blank">Read and edit persistent data in Grasshopper components with C#</a></p>
<p>His examples are in C#, but everything he describes can also be done in VB.net with some syntax tweaks. </p>
<p></p>
<p>The core of his method is to programmatically instantiate a component, populate its inputs, and then create a virtual grasshopper document in which to execute the code. He then harvests the outputs and converts them back to simple data. Here is his example code for calling the "Circle by Normal and Radius" component:</p>
<p></p>
<p><code><br/> var cs = new CurveComponents.Component_CircleCNR(); <br/> <br/> //add the circle centre (input 0) <br/> var pp = cs.Params.Input[0] as Grasshopper.Kernel.GH_PersistentGeometryParam<Grasshopper.Kernel.Types.GH_Point>; <br/> pp.PersistentData.ClearData(); <br/> pp.PersistentData.Append(new GH_Point(new Point3d(0, 0, 3))); <br/> <br/> //add the circle radius (input 2) <br/> var pn = cs.Params.Input[2] as Grasshopper.Kernel.GH_PersistentParam<Grasshopper.Kernel.Types.GH_Number>; <br/> pn.PersistentData.ClearData(); <br/> pn.PersistentData.Append(new GH_Number(y)); //y is another variable <br/> <br/> //run calculations <br/> cs.ExpireSolution(true); <br/> <br/> //add to a dummy document so we can read outputs <br/> var doc = new Grasshopper.Kernel.GH_Document(); <br/> doc.AddObject(cs, false); <br/> <br/> //read output circle <br/> cs.Params.Output[0].CollectData(); <br/> A = cs.Params.Output[0].VolatileData.get_Branch(0)[0]; <br/> <br/> //remove that component <br/> doc.RemoveObject(cs.Attributes, false);</code></p>
<p></p>
<p><strong>Final notes</strong></p>
<p>For a great many of the simple components, there are in fact methods in RhinoCommon that accomplish exactly the same thing. Note the complexity of the above code, and then look at the equivalent code using RhinoCommon methods:</p>
<p>Circle circle = new Circle(new Plane(origin, normal), radius);</p>
<p></p>
<p>In my experience it is preferable to just call or construct the methods you need using RhinoCommon rather than relying on trying to call components from inside your code. </p>
<p></p>
<p>Lastly, It is my understanding that this concept is central to David's thinking around GH2 - so that it in the next version it will be significantly more streamlined to switch between components and code representations. (I have no special knowledge of GH2 development - this is just what I have seen David say on the forums, and as usual any statements about future features are subject to change.)</p>
<p></p>
<p>Hope this is helpful!</p>
<p></p> What is Grasshopper 2 development status?tag:www.grasshopper3d.com,2015-06-26:2985220:Topic:13162642015-06-26T15:12:42.360ZChristopher Edgemonhttps://www.grasshopper3d.com/profile/ChristophreEdgemon
<p>I can't find any firm information about the development of GH2 - when it began, what state it's in now, approximately when it might be released. In fact, the only information that I know about it is that bugs in GH1 likely won't be addressed until GH2 is released.</p>
<p></p>
<p>So, does anyone know anything about when we migth see GH2, what its features are, etc.?</p>
<p>I can't find any firm information about the development of GH2 - when it began, what state it's in now, approximately when it might be released. In fact, the only information that I know about it is that bugs in GH1 likely won't be addressed until GH2 is released.</p>
<p></p>
<p>So, does anyone know anything about when we migth see GH2, what its features are, etc.?</p> The Why and How of Data Treestag:www.grasshopper3d.com,2015-01-20:2985220:Topic:12080262015-01-20T21:22:38.468ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p><em style="color: #c0c0c0; font-size: 13px;">This is not a tutorial on how to <strong>use</strong> data trees. The goal of this article is to explain <strong>why</strong> data trees are used in Grasshopper.</em></p>
<p></p>
<p><span class="font-size-4">Data storage in general programming</span></p>
<p>One of the key aspects of programming is deciding how and where to store your data. If you're writing textual code using any one of a huge number of programming languages there are a lot of…</p>
<p><em style="color: #c0c0c0; font-size: 13px;">This is not a tutorial on how to <strong>use</strong> data trees. The goal of this article is to explain <strong>why</strong> data trees are used in Grasshopper.</em></p>
<p></p>
<p><span class="font-size-4">Data storage in general programming</span></p>
<p>One of the key aspects of programming is deciding how and where to store your data. If you're writing textual code using any one of a huge number of programming languages there are a lot of different options, each with its own benefits and drawbacks. Sometimes you just need to store a single data point. At other times you may need a list of exactly one hundred data points. At other times still circumstances may demand a list of a <em>variable</em> number of data points.</p>
<p></p>
<p>In programming jargon, <a href="https://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx" target="_blank">lists</a> and <a href="https://msdn.microsoft.com/en-us/library/system.array(v=vs.110).aspx" target="_blank">arrays</a> are typically used to store an ordered collection of data points, where each item is directly accessible. <a href="https://msdn.microsoft.com/en-us/library/dd381779(v=vs.110).aspx" target="_blank">Bags</a> and <a href="https://msdn.microsoft.com/en-us/library/bb359438(v=vs.110).aspx" target="_blank">hash sets</a> are examples of <em>un</em>ordered data storage. These storage mechanisms do not have a concept of which data comes first and which next, but they are much better at searching the data set for specific values. <a href="https://msdn.microsoft.com/en-us/library/3278tedw(v=vs.110).aspx" target="_blank">Stacks</a> and <a href="https://msdn.microsoft.com/en-us/library/7977ey2c(v=vs.110).aspx" target="_blank">queues</a> are ordered data structures where only the youngest or oldest data points are accessible respectively. These are popular structures for code designed to create and execute schedules. <a href="https://msdn.microsoft.com/en-us/library/he2s3bh7(v=vs.110).aspx" target="_blank">Linked lists</a> are chains of consecutive data points, where each point knows only about its direct neighbours. As a result, it's a lot of work to find the one-millionth point in a linked list, but it's incredibly efficient to insert or remove points from the middle of the chain. <a href="https://msdn.microsoft.com/en-us/library/xfhwa508(v=vs.110).aspx" target="_blank">Dictionaries</a> store data in the form of key-value pairs, allowing one to index complicated data points using simple lookup codes.</p>
<p></p>
<p>The above is a just a <em>small</em> sampling of popular data storage mechanisms, there are many, many others. From <a href="https://msdn.microsoft.com/en-us/library/2yd9wwz4.aspx" target="_blank">multidimensional arrays</a> to <a href="http://en.wikipedia.org/wiki/SQL" target="_blank">SQL databases</a>. From <a href="https://msdn.microsoft.com/en-us/library/ms132474(v=vs.110).aspx" target="_blank">readonly collections</a> to <span style="font-family: tahoma, arial, helvetica, sans-serif;">concurrent <a href="http://en.wikipedia.org/wiki/K-d_tree" target="_blank">k-dTrees</a></span>. It takes a fair amount of knowledge and practice to be able to navigate this bewildering sea of options and pick the best suited storage mechanism for any particular problem. We did not wish to confront our users with this plethora of programmatic principles, and instead decided to offer only a single data storage mechanism.*</p>
<p></p>
<p><br/> <span class="font-size-4">Data storage in Grasshopper</span></p>
<p>In order to see what mechanism would be optimal for Grasshopper, it is necessary to first list the different possible ways in which components may wish to access and store data, and also how families of data points flow through a Grasshopper network, often acquiring more complexity over time.</p>
<ul>
<li><span style="font-size: 13px;">A lot of components operate on individual values and also output individual values as results. This is the simplest category, let's call it <span style="font-family: 'courier new', courier;">1:1</span> (pronounced as "one to one", indicating a mapping from single inputs to single outputs). Two examples of <span style="font-family: 'courier new', courier;">1:1</span> </span><span style="font-size: 13px;">components are Subtraction and Construct Point. Subtraction takes two arguments </span><span style="font-size: 13px;">on the left (A and B), and outputs the difference (A-B) to the right. Even when the component is called upon to calculate the difference between two collections of 12 </span><span style="font-size: 13px;">million values each, at any one time it only cares about three values; A, B and the difference between the two. Similarly, Construct Point takes three separate numbers </span><span style="font-size: 13px;">as input arguments and combines them to form a single xyz point.</span></li>
<li><span style="font-size: 13px;">Another common category of components create lists of data from single input values. We'll refer to these components as <span style="font-family: 'courier new', courier;">1:N</span>. Range and Divide Curve are oft used examples in this category. Range takes a single numeric domain and a single integer, but it outputs a list of numbers that divide the domain into the specified number of steps. </span><span style="font-size: 13px;">Similarly, Divide Curve requires a single curve and a division count, but it outputs several lists of data, where the length of each list is a function of the division count.</span></li>
<li><span style="font-size: 13px;">The opposite behaviour also occurs. Common <span style="font-family: 'courier new', courier;">N:1</span> components are Polyline and Loft, </span><span style="font-size: 13px;">both of which consume a list of points and curves respectively, yet output only a single </span><span style="font-size: 13px;">curve or surface.</span></li>
<li><span style="font-size: 13px;">Lastly (in the list category), <span style="font-family: 'courier new', courier;">N:N</span> components are also available. A fair number of </span><span style="font-size: 13px;">components operate on lists of data and also output lists of data. Sort and Reverse List are examples of <span style="font-family: 'courier new', courier;">N:N</span> components you will almost certainly encounter when using Grasshopper. It is true that <span style="font-family: 'courier new', courier;">N:N</span> components mostly fall into the <em>data management</em> category, in the sense that they are mostly employed to change the way data is stored, rather than to create entirely new data, but they are common and important nonetheless.</span></li>
<li><span style="font-size: 13px;">A rare few components are even more complex than <span style="font-family: 'courier new', courier;">1:N</span>, <span style="font-family: 'courier new', courier;">N:1</span>, or <span style="font-family: 'courier new', courier;">N:N</span>, in that they are </span><span style="font-size: 13px;">not content to operate on or output single lists of data points. The Divide Surface and </span><span style="font-size: 13px;">Square Grid components want to output not just lists of points, but several lists of points, each of which represents a single row or column in a grid. We can refer to these components as <span style="font-family: 'courier new', courier;">1:N'</span> or <span style="font-family: 'courier new', courier;">N':1</span> or <span style="font-family: 'courier new', courier;">N:N'</span> or ... depending on how the inputs and outputs are defined.</span></li>
</ul>
<p>The above listing of data mapping categories encapsulate all components that ship with Grasshopper, though they do not necessarily minister to all imaginable mappings. However in the spirit of getting on with the software it was decided that a data structure that could handle individual values, lists of values, and lists of lists of values would solve at least 99% of the then existing problems and was thus considered to be a 'good thing'.</p>
<p></p>
<p><br/> <span class="font-size-4">Data storage as the outcome of a process</span></p>
<p>If the problems of <span style="font-family: 'courier new', courier;">1:N'</span> mappings only occurred in those few components to do with grids, it would probably not warrant support for lists-of-lists in the core data structure. However, <span style="font-family: 'courier new', courier;">1:N'</span> or <span style="font-family: 'courier new', courier;">N:N'</span> mappings can be the result of the concatenation of two or more <span style="font-family: 'courier new', courier;">1:N</span> components. Consider the following case: A collection of three polysurfaces (a box, a capped cylinder, and a triangular prism) is imported from Rhino into Grasshopper. The shapes are all exploded into their separate faces, resulting in 6 faces for the box, 3 for the cylinder, and 5 for the prism. Across each face, a collection of isocurves is drawn, resembling a hatching. Ultimately, each isocurve is divided into equally spaced points.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654887581?profile=original" target="_self"><img width="400" src="http://storage.ning.com/topology/rest/1.0/file/get/2654887581?profile=RESIZE_480x480" width="400" class="align-center" style="padding: 25px;"/></a></p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654887671?profile=original" target="_self"><img width="400" src="http://storage.ning.com/topology/rest/1.0/file/get/2654887671?profile=RESIZE_480x480" width="400" class="align-center" style="padding: 25px;"/></a></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654887812?profile=original" target="_self"><img width="400" src="http://storage.ning.com/topology/rest/1.0/file/get/2654887812?profile=RESIZE_480x480" width="400" class="align-center" style="padding: 25px;"/></a></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654887842?profile=original" target="_self"><img width="400" src="http://storage.ning.com/topology/rest/1.0/file/get/2654887842?profile=RESIZE_480x480" width="400" class="align-center" style="padding: 25px;"/></a></p>
<p><span style="font-size: 13px;">This is not an unreasonably elaborate case, but it already shows how shockingly quickly layers of complexity are introduced into the data as it flows from the left to the right side of the network.</span></p>
<p>It's no good ending up with a single huge list containing all the points. The data structure we use must be detailed enough to allow us to select from it any logical subset. This means that the ultimate data structure must contain a record of all the mappings that were applied from start to finish. It must be possible to select all the points that are associated with the second polysurface, but not the first or third. It must also be possible to select all points that are associated with the first face of each polysurface, but not any subsequent faces. Or a selection which includes only the fourth point of each division and no others.</p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654888143?profile=original" target="_self"><img width="400" src="http://storage.ning.com/topology/rest/1.0/file/get/2654888143?profile=RESIZE_480x480" width="400" class="align-center" style="padding: 25px;"/></a></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654888179?profile=original" target="_self"><img width="400" src="http://storage.ning.com/topology/rest/1.0/file/get/2654888179?profile=RESIZE_480x480" width="400" class="align-center" style="padding: 25px;"/></a></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654888293?profile=original" target="_self"><img width="400" src="http://storage.ning.com/topology/rest/1.0/file/get/2654888293?profile=RESIZE_480x480" width="400" class="align-center" style="padding: 25px;"/></a></p>
<p><span style="font-size: 13px;">The only way such selection sets can be defined, is if the data structure contains a record of the "history" of each data point. I.e. for every point we must be able to figure out which original shape it came from (the cube, the cylinder or the prism), which of the exploded faces it is associated with, which isocurve on that face was involved and the index of the point within the curve division family.</span></p>
<p></p>
<p></p>
<p><span class="font-size-4">A flexible mechanism for variable history records.</span></p>
<p>The storage constraints mentioned so far (to wit, the requirement of storing individual values, lists of values, and lists of lists of values), combined with the relational constraints (to wit, the ability to measure the relatedness of various lists within the entire collection) lead us to Data Trees. The data structure we chose is certainly not the only imaginable solution to this problem, and due to its terse notation can appear fairly obtuse to the untrained eye. However since data trees only employ non-negative integers to identify both lists and items within lists, the structure is very amenable to simple arithmetic operations, which makes the structure very pliable from an algorithmic point of view.</p>
<p>A data tree is an <em>ordered collection of lists</em>. Each list is associated with a <em>path</em>, which serves as the identifier of that list. This means that two lists in the same tree cannot have the same path. A path is a collection of one or more non-negative integers. Path notation employs curly brackets and semi-colons as separators. The simplest path contains only the number zero and is written as: <span style="font-family: 'courier new', courier;">{0}</span>. More complicated paths containing more elements are written as: <span style="font-family: 'courier new', courier;">{2;4;6}</span>. Just as a path identifies a list within the tree, an <em>index</em> identifies a data point within a list. An index is always a single, non-negative integer. Indices are written inside square brackets and appended to path notation, in order to fully identify a single piece of data within an entire data tree: <span style="font-family: 'courier new', courier;">{2,4,6}[10]</span>.</p>
<p>Since both path elements and indices are zero-based (we start counting at zero, not one), there is a slight disconnect between the ordinality and the cardinality of numbers within data trees. The <em>first</em> element equals index 0, the <em>second</em> element can be found at index 1, the <em>third</em> element maps to index 2, and so on and so forth. This means that the "Eleventh point of the seventh isocurve of the fifth face of the third polysurface" will be written as <span style="font-family: 'courier new', courier;">{2;4;6}[10]</span>. The first path element corresponds with the oldest mapping that occurred within the file, and each subsequent element represents a more recent operation. In this sense the path elements can be likened to taxonomic identifiers. The species <span style="font-family: 'courier new', courier;">{Animalia;Mammalia;Hominidea;Homo}</span> and <span style="font-family: 'courier new', courier;">{Animalia;Mammalia;Hominidea;Pan} </span>are more closely related to each other than to <span style="font-family: 'courier new', courier;">{Animalia;Mammalia; Cervidea;Rangifer}</span>** because they share more codes at the start of their classification. Similarly, the paths <span style="font-family: 'courier new', courier;">{2;4;4}</span> and <span style="font-family: 'courier new', courier;">{2;4;6}</span> are more closely related to each other than they are to <span style="font-family: 'courier new', courier;">{2;3;5}</span>.</p>
<p></p>
<p></p>
<p><span class="font-size-4">The messy reality of data trees.</span></p>
<p>Although you may agree with me that in theory the data tree approach is solid, you may <br/> still get frustrated at the rate at which data trees grow more complex. Often Grasshopper will choose to add additional elements to the paths in a tree where none in fact is needed, resulting in paths that all share a lot of zeroes in certain places. For example a data tree might contain the paths:</p>
<blockquote><p><span style="font-family: 'courier new', courier;">{0;0;0;0;0}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;0;0;0;1}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;0;0;0;2}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;0;0;0;3}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;0;1;0;0}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;0;1;0;1}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;0;1;0;2}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;0;1;0;3}</span></p>
</blockquote>
<p></p>
<p>instead of the far more economical: </p>
<blockquote><p><span style="font-family: 'courier new', courier;">{0;0}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;1}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;2}</span></p>
<p><span style="font-family: 'courier new', courier;">{0;3}</span></p>
<p><span style="font-family: 'courier new', courier;">{1;0}</span></p>
<p><span style="font-family: 'courier new', courier;">{1;1}</span></p>
<p><span style="font-family: 'courier new', courier;">{1;2}</span></p>
<p><span style="font-family: 'courier new', courier;">{1;3}</span></p>
</blockquote>
<p></p>
<p>The reason all these zeroes are added is because we value consistency over economics. It doesn't matter whether a component actually outputs more than one list, if the component belongs to the <span style="font-family: 'courier new', courier;">1:N</span>, <span style="font-family: 'courier new', courier;">1:N'</span>, or <span style="font-family: 'courier new', courier;">N:N'</span> groups, it will <em>always</em> add an extra integer to all the paths, because some day in the future, when the inputs change, it may need that extra integer to keep its lists untangled. We feel it's bad behaviour for the topology of a data tree to be subject to the topical values in that tree. Any component which relies on a specific topology will no longer work when that topology changes, and that should happen as seldom as possible.</p>
<p></p>
<p><br/> <span class="font-size-4">Conclusion</span></p>
<p>Although data trees can be difficult to work with and probably cause more confusion than any other part of Grasshopper, they seem to work well in the majority of cases and we haven't been able to come up with a better solution. That's not to say we never will, but data trees are here to stay for the foreseeable future.</p>
<p></p>
<p></p>
<p></p>
<p><span style="color: #808080;"><em>* This is not something we hit on immediately. The very first versions of Grasshopper </em></span><span style="color: #808080;"><em>only allowed for the storage of a single data point per parameter, making operations </em></span><span style="color: #808080;"><em>like [Loft] or [Divide Curve] impossible. Later versions allowed for a single list </em></span><span style="color: #808080;"><em>per parameter, which was still insufficient for all but the most simple algorithms.</em></span></p>
<p></p>
<p><span style="color: #808080;"><em>** I'm skipping a lot of taxonometric classifications here to keep it simple.</em></span></p> Why doesn't equality work as I think it should?tag:www.grasshopper3d.com,2014-11-07:2985220:Topic:11637932014-11-07T19:32:38.077ZMateusz Zwierzyckihttps://www.grasshopper3d.com/profile/MateuszZwierzycki
<p><span style="font-size: 13px;">When numbers are displayed on the screen, they are typically rounded to avoid looking like 31.5000000000000089, 31.500000000000000092 or 31.49999999999999997. In all of these cases what you see is 31.5, even though they are all clearly different numbers.</span></p>
<p></p>
<p><span style="font-size: 13px;">Almost all decimal numbers that are the result of some sort of mathematics (and often also ones that have been constructed by hand)…</span></p>
<p><span style="font-size: 13px;">When numbers are displayed on the screen, they are typically rounded to avoid looking like 31.5000000000000089, 31.500000000000000092 or 31.49999999999999997. In all of these cases what you see is 31.5, even though they are all clearly different numbers.</span></p>
<p></p>
<p><span style="font-size: 13px;">Almost all decimal numbers that are the result of some sort of mathematics (and often also ones that have been constructed by hand)</span> <strong><em>suffer from noise in the least significant digits</em></strong><span style="font-size: 13px;">. Although this noise is in all likelihood meaningless garbage, it will still affect sort order as the smaller than and larger than operations are well defined. It also means that two numbers that look the same but are nevertheless different in the 12th decimal place, will not be treated as equal.</span></p>
<p></p>
<p><span style="font-size: 13px;">If you want to compare decimal numbers for equality, you almost always have to find the absolute difference between them and compare that to some tolerance threshold. For example;</span></p>
<blockquote><p><span style="font-size: 13px;">Abs(A-B) < 1e-10</span></p>
</blockquote>
<p></p>
<p><span style="font-size: 13px;">will evaluate as true if A and B are identical to within 0.0000000001. What tolerance to use depends on the numbers in question. If they are very big, you'll need a larger tolerance. If they are the result of <em>many</em> calculations, you'll also need a larger tolerance.</span></p>
<p></p>
<p><span style="font-size: 13px;">This description comes from</span> <a href="http://www.grasshopper3d.com/forum/topics/sort-points-error-1" style="font-size: 13px;">http://www.grasshopper3d.com/forum/topics/sort-points-error-1</a></p>
<p></p>
<p><span>You can find the same question and similar (more or less descriptive) answers here :</span></p>
<p></p>
<p><span><a href="http://www.grasshopper3d.com/forum/topics/equality-in-function-doesn-t-work-properly">http://www.grasshopper3d.com/forum/topics/equality-in-function-doesn-t-work-properly</a></span></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/equality-component-bug">http://www.grasshopper3d.com/forum/topics/equality-component-bug</a></p>
<p><a href="http://www.grasshopper3d.com/profiles/blogs/equality-component-doesn-t-work-although-i-already-anticipate-it">http://www.grasshopper3d.com/profiles/blogs/equality-component-doesn-t-work-although-i-already-anticipate-it</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/equality-mistery-help">http://www.grasshopper3d.com/forum/topics/equality-mistery-help</a></p> Everything you need to know about Display and View Menus in Grasshoppertag:www.grasshopper3d.com,2014-06-18:2985220:Topic:10899372014-06-18T10:17:13.147ZDanny Boyeshttps://www.grasshopper3d.com/profile/DannyBoyes
<p>[Skeleton Outline - Will complete latter]</p>
<p></p>
<p>Note I am going to close the discussion while I work on it (possibly afterwards as well) so that no one messes up the replies as this will be a large topic I want to be able to link to each sub topic from the Forum.</p>
<p></p>
<p>Click a link below to learn more:</p>
<p></p>
<p><strong><span style="text-decoration: underline;">Display Menu…</span></strong></p>
<p></p>
<p>[Skeleton Outline - Will complete latter]</p>
<p></p>
<p>Note I am going to close the discussion while I work on it (possibly afterwards as well) so that no one messes up the replies as this will be a large topic I want to be able to link to each sub topic from the Forum.</p>
<p></p>
<p>Click a link below to learn more:</p>
<p></p>
<p><strong><span style="text-decoration: underline;">Display Menu</span></strong></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1089975" target="_blank">Draw Icons</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1089975" target="_blank">Draw Fancy Wires</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1089975" target="_blank">Draw Full Names</a></p>
<p>_________________</p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1090490" target="_blank">Preview Mesh Settings</a></p>
<p>|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1090490" target="_blank">Disable Meshing</a></p>
<p>|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1090490" target="_blank">Low Quality</a></p>
<p>|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1090490" target="_blank">High Quality</a></p>
<p>|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1090490" target="_blank">Document Quality</a></p>
<p>|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1090490" target="_blank">Custom Quality & Edit Custom Quality</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1090490" target="_blank">[Bump Preview] not in File Menu</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1091071" target="_blank">No Preview</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1091071" target="_blank">Wireframe Preview</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1091071" target="_blank">Shaded Preview</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1091071" target="_blank">Selected Only Preview</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1091071" target="_blank">Preview Settings</a></p>
<p>_____________________</p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1092952" target="_blank">Preview Point Flavour</a></p>
<p>|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1092952" target="_blank">Dot</a></p>
<p>|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1092952" target="_blank">Point</a></p>
<p><span style="font-size: 13px;">|___ <a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1092952" target="_blank">Cross</a></span></p>
<p><span style="font-size: 13px;"><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1092952" target="_blank">Preview Plane Size</a><br/></span></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1092952" target="_blank">Preview Mesh Edges</a></p>
<p><a href="http://www.grasshopper3d.com/forum/topics/everything-you-need-to-know-about-displaying-in-grasshopper?commentId=2985220%3AComment%3A1092952" target="_blank">Gumballs</a></p>
<p><span style="font-size: 13px;">_________________________</span></p>
<p><span style="font-size: 13px;">Canvas Widgets</span></p>
<p><span style="font-size: 13px;">|___ Compass</span></p>
<p><span style="font-size: 13px;">|___ Align</span></p>
<p><span style="font-size: 13px;">|___ Markov</span></p>
<p><span style="font-size: 13px;">|___ Profiler</span></p>
<p><span style="font-size: 13px;">|___ Message Balloons</span></p>
<p></p>
<p><strong><span style="text-decoration: underline;">View Menu</span></strong></p>
<p>Remote Control Panel</p>
<p>Canvas Toolbar</p>
<p>Component Tabs</p>
<p>Panel Separators</p>
<p>Obscure Co<span style="font-size: 13px;">mponents</span></p>
<p>Data Viewer</p>
<p>_________________</p>
<p>Store Current View</p>
<p>Restore Named View</p>
<p>Zoom</p>
<p>|___ Zoom Selected</p>
<p>|___ Zoom Extents</p>
<p>|___ Focus on Upper-Left</p>
<p>|___ Focus on Upper-Right</p>
<p>|___ Focus on Lower-Left</p>
<p>|___ Focus on Lower-Right</p>
<p>|___ Zoom On Preview</p>
<p>_____________________</p>
<p>Canvas Redraw Speed</p>
<p>Document Info</p>
<p></p>
<p>there is a discussion <a href="http://www.grasshopper3d.com/forum/topics/discussion-for-display-and-view-menu" target="_blank">here</a> for any comments or suggestions</p>
<p></p>
<p></p> What are the icons on a component's input/output parameter?tag:www.grasshopper3d.com,2014-03-10:2985220:Topic:10233022014-03-10T17:41:22.001ZDanny Boyeshttps://www.grasshopper3d.com/profile/DannyBoyes
<p><em>Not sure if it qualifies as a FAQ but I wanted to reference it in other threads without having to post the same thing over and over.</em></p>
<p></p>
<p><strong>I/O Modifiers what are they and what do they do?…</strong></p>
<p><strong><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654844526?profile=original" target="_self"><img class="align-full" src="http://storage.ning.com/topology/rest/1.0/file/get/2654844526?profile=original" width="319"></img></a></strong></p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654844498?profile=original" target="_self"><img class="align-full" height="224" src="http://storage.ning.com/topology/rest/1.0/file/get/2654844498?profile=original" width="315"></img></a></p>
<p><em>Not sure if it qualifies as a FAQ but I wanted to reference it in other threads without having to post the same thing over and over.</em></p>
<p></p>
<p><strong>I/O Modifiers what are they and what do they do?</strong></p>
<p><strong><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654844526?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2654844526?profile=original" width="319" class="align-full"/></a></strong></p>
<p></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654844498?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2654844498?profile=original" width="315" class="align-full" height="224"/></a></p>
<p>The I/O Modifiers can be applied from the right click Context Menu of either a component's input or output parameters. With the exception of <Principal> and <Degrees> they work exactly like their corresponding Grasshopper Component. When a I/O Modifier is applied to a parameter a visual Tag (icon) is displayed. If you hover over a Tag a tool tip will be displayed showing what it is and what it does.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654844729?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2654844729?profile=original" width="317" class="align-full" height="118"/></a></p>
<p>The full list of these Tags:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654844684?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2654844684?profile=original" width="158" class="align-full" height="223"/></a></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654844849?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2654844849?profile=original" width="188" class="align-full" height="70"/></a></p>
<p></p>
<p><strong>1) Principal</strong></p>
<p>An input with the Principal Icon is designated the principal input of a component for the purposes of path assignment.</p>
<p>For example:</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654845122?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654845122?profile=RESIZE_1024x1024" width="750" class="align-full"/></a></p>
<p></p>
<p></p>
<p><strong>2) Reverse</strong></p>
<p>The Reverse I/O Modifier will reverse the order of a list (or lists in a multiple path structure)</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654845272?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654845272?profile=RESIZE_1024x1024" width="750" class="align-full"/></a></p>
<p></p>
<p><strong>3) Flatten</strong></p>
<p>The Flatten I/O Modifier will reduce a multi-path tree down to a single list on the {0} path </p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654845536?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654845536?profile=RESIZE_1024x1024" width="750" class="align-full"/></a></p>
<p></p>
<p><strong>4) Graft</strong></p>
<p>The Graft I/O Modifier will create a new branch for each individual item in a list (or lists)</p>
<p><strong><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654846370?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654846370?profile=RESIZE_1024x1024" width="750" class="align-full"/></a><br/></strong></p>
<p><strong>5) Simplify</strong></p>
<p>The Simplify I/O Modifier will remove the overlap shared amongst all branches. [<em>Note that a single branch does not share any overlap with anything else.]<br/></em></p>
<p><strong><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654846350?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654846350?profile=RESIZE_1024x1024" width="750" class="align-full"/></a></strong></p>
<p></p>
<p><strong>6) Degrees</strong></p>
<p>The Degrees Input Modifier indicates that the numbers received are actually measured in Degrees rather than Radians. Think of it more like a preference setting for each angle input on a Grasshopper Component that state you prefer to work in Degrees. There is no Output option as this is only available on Angle Inputs.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654846562?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654846562?profile=RESIZE_1024x1024" width="750" class="align-full"/></a></p>
<p></p>
<p><strong>7) Expression</strong></p>
<p>The Expression I/O Modifier allows you change the input value by evaluating an expression such as -x/2 which will have the input and make it negative. If you hover over the Tag a tool tip will be displayed with the expression. Since the release of GH version 0.9.0068 all I/O Expression Modifiers use "x" instead of the nickname of the parameter.</p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654846752?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654846752?profile=RESIZE_1024x1024" width="750" class="align-full"/></a></p>
<p></p>
<p><strong>8) Reparameterize</strong></p>
<p>The Reparameterize I/O Modifier will only work on lines, curves and surfaces <span>forcing the domains of all geometry to the [0.0 to 1.0] range.</span></p>
<p><span><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654846699?profile=original" target="_self"><img width="750" src="http://storage.ning.com/topology/rest/1.0/file/get/2654846699?profile=RESIZE_1024x1024" width="750" class="align-full"/></a></span></p>
<p></p>
<p><strong>9) Invert</strong></p>
<p>The Invert Input Modifier works in a similar way to a Not Gate in Boolean Logic negating the input. A good example of when to use this is on [Cull Pattern] where you wish to invert the logic to get the opposite results. <span>There is no Output option as this is only available on Boolean Inputs.</span></p>
<p><a href="http://storage.ning.com/topology/rest/1.0/file/get/2654846818?profile=original" target="_self"><img src="http://storage.ning.com/topology/rest/1.0/file/get/2654846818?profile=original" width="722" class="align-full"/></a></p>
<p></p> DataTree selection rulestag:www.grasshopper3d.com,2013-11-04:2985220:Topic:9506352013-11-04T03:57:12.039ZDavid Ruttenhttps://www.grasshopper3d.com/profile/DavidRutten
<p>Dear Users,</p>
<p></p>
<p>I've been working on data tree selection rules this weekend and when 0.9.0063 is released (hopefully tomorrow, 4th November) the [Path Compare], [Tree Split] and [Replace Path] components will work slightly different from before. Sorry about breaking this, but it proved impossible to improve the selection logic with the fairly ambiguous notation that was implemented already.</p>
<p></p>
<p>Not every change is breaking though and I hope that most simple matching…</p>
<p>Dear Users,</p>
<p></p>
<p>I've been working on data tree selection rules this weekend and when 0.9.0063 is released (hopefully tomorrow, 4th November) the [Path Compare], [Tree Split] and [Replace Path] components will work slightly different from before. Sorry about breaking this, but it proved impossible to improve the selection logic with the fairly ambiguous notation that was implemented already.</p>
<p></p>
<p>Not every change is breaking though and I hope that most simple matching rules will work as before. <span style="font-size: 13px;">There will be a</span> <a href="http://blog.rhino3d.com/2013/10/advanced-grasshopper-webinar-with-david.html" target="_blank" style="font-size: 13px;">McNeel webinar on Wednesday the 6th of November</a><span style="font-size: 13px;"> where I discuss the new selection rules (as well as <em>path mapping syntax</em> and <em>relative offsets within one or more data trees</em>). This will be a pretty hard-core webinar aimed at expert users. The event will be recorded so you can always go and watch it later. </span><span style="font-size: 13px;">I figured I'd briefly explain the new selection rules on Ning before I release the update though.</span></p>
<p></p>
<p><span style="font-size: 13px;">-------------------------------------------------------------------------------</span></p>
<p><span style="font-size: 13px;">Imagine we have the following data tree, containing a bunch of textual characters:</span></p>
<blockquote><p>{0;0} = [a,e,i,o,u,y]<br/> {0;1} = [ä,ë,ê,ï,î,ö,ô,õ,ü,û,ÿ,ý]<br/> {1;0} = [b,c,d,f,g,h,j,k,l,m,n,p,q,r,s,t,v,w,x,z]<br/> {1;1} = [ç,ĉ,č,ĝ,ř,š,ş,ž]</p>
</blockquote>
<p></p>
<p>There are a total of four branches {0;0}, {0;1}, {1;0} and {1;1}. The first branch contains all the vowels that are part of the standard English alphabet. The second branch contains all non-standard vowels and branches three and four contain the standard and non-standard consonants respectively.</p>
<p></p>
<p>So what if we want to select from this tree <em>only</em> the standard vowels? Basically include everything in the first branch and disregard everything else. We can use the [Tree Split] component with a selection rule to achieve this:</p>
<blockquote><p>{0;0}</p>
</blockquote>
<p></p>
<p>This selection rule hard-codes the number zero in both tree path locations. It doesn't define an item index rule, so all items in {0;0} will be selected.</p>
<p></p>
<p>If we want <em>all</em> the vowels (both standard and non-standard), then we have several options:</p>
<blockquote><p>{0;?} = select all branches that start with 0</p>
<p>{0;(0,1)} = select all branches that start with 0 and end in either 0 or 1</p>
<p>{0;(0 to 1)} = ......................................... and end in the range 0 to 1.</p>
</blockquote>
<p></p>
<p>Conversely, selecting all standard vowels and consonants while disregarding all non-standard character can be achieved with rules as follows:</p>
<blockquote><p>{?;0}</p>
<p>{(0,1);0}</p>
<p>{(0 to 1);0}</p>
</blockquote>
<p></p>
<p>It is also possible to select items from each branch in addition to limiting the selection to specific branches. In this case another rule stated in square brackets needs to be appended:</p>
<blockquote><p>{0;?}[0 to 2]</p>
</blockquote>
<p></p>
<p>The above rule will select the first three vowels from the standard and the non-standard lists.</p>
<p></p>
<p>Basically, rules work in a very consistent way, but there are some syntax conventions you need to know. The first thing to realize is that every individual piece of data in a data-tree can be uniquely and unambiguously identified by a collection of integers. One integer describes its index within the branch and the others are used to identify the branch within the tree. As a result a rule for selection items always looks the same:</p>
<blockquote><p>{A;B;C;...;Z}[i] where A, B, C, Z and i represent rules.</p>
</blockquote>
<p></p>
<p>It's very similar to the Path Mapper syntax except it uses square brackets instead of parenthesis for the index (the Path Mapper will follow suit soon, but that won't be a breaking change). You always have to define the path selector rule in between curly brackets. You can supply any number of rules as long as you separate them with semi-colons.</p>
<p>The index rule is optional, but -when provided- it has to be encased in square brackets after the path selection rule(s).</p>
<p></p>
<p>The following rule notations are allowed:</p>
<blockquote><p><strong>*</strong> Any number of integers in a path</p>
<p></p>
<p><strong>?</strong> Any single integer</p>
<p></p>
<p><strong>6</strong> Any specific integer</p>
<p></p>
<p><strong>!6</strong> Anything <span style="text-decoration: underline;">except</span> a specific integer</p>
<p></p>
<p><strong>(2,6,7)</strong> Any one of the specific integers in this group.</p>
<p></p>
<p><strong>!(2,6,7)</strong> Anything <span style="text-decoration: underline;">except</span> one of the integers in this group.</p>
<p></p>
<p><strong>(2 to 20)</strong> Any integer in this range (including both 2 and 20).</p>
<p></p>
<p><strong>!(2 to 20)</strong> Any integer <span style="text-decoration: underline;">outside</span> this range.</p>
<p></p>
<p><strong>(0,2,...)</strong> Any integer part of this infinite sequence. Sequences have to be at least two integers long, and every subsequent integer has to be bigger than the previous one (sorry, that may be a temporary limitation, don't know yet).</p>
<p></p>
<p><strong>(0,2,...,48)</strong> Any integer part of this finite sequence. You can optionally provide a single sequence limit after the three dots.</p>
<p></p>
<p><strong>!(3,5,...)</strong> Any integer <span style="text-decoration: underline;">not</span> part of this infinite sequence. The sequence doesn't extend to the left, only towards the right. So this rule would select the numbers <span style="font-family: 'courier new', courier;">0, 1, 2, 4, 6, 8, 10, 12 and all remaining even numbers</span>.</p>
<p></p>
<p><strong>!(7,10,21,...,425)</strong> Any integer <span style="text-decoration: underline;">not</span> part of this finite sequence.</p>
</blockquote>
<p></p>
<p>Furthermore, it is possible to combine two or more rules using the boolean and/or operators. If you want to select the first five items in every list of a datatree and also the items 7, 12 and 42, then the selection rule would look as follows:</p>
<blockquote><p>{*}[(0 to 4) <strong>or</strong> (6,11,41)]</p>
</blockquote>
<p></p>
<p>The asterisk allows you to include all branches, no matter what their paths looks like.</p>
<p></p>
<p>It is at present not possible to use the parenthesis to define rule <em>precedence</em>, rules are always evaluated from left to right. <span style="font-size: 13px;">It is at present also not possible to use negative integers to identify items from the end of a list.</span></p>
<p></p>
<p></p>
<p>If you want to know more, join the Webinar on Wednesday!</p>
<p></p>
<p>--</p>
<p>David Rutten</p>
<p>david@mcneel.com</p>
<p>Seattle, WA</p>