Grasshopper

algorithmic modeling for Rhino

I'm starting this discussion for people who have questions about using the Local Code Components that were recently released, because the comments section on Nicholas's blog were not as accommodating as a normal discussion thread. And this way others can find help more easily.

Here's the link to the blog post with info about the components, and the questions that started this discussion.

To Miguel:

the Local Code Export Component does not currently assign attributes to individual objects, though we may add that functionality later. The Mode Tools components, as well as Giulio Piacentino's components can. But for our component, the intention of inputting colors was intended as a convenience for organizing layers. So if you wanted to assign colors to each object, you would have to bake each object to a separate layer, and ensure that the dxf and ai files you are exporting will retain these layers and layer colors (dxf might not retain the precise colors, depending on the color scheme and dxf format used). This is quite easy, but I assume that it would be inconvenient to have a such a large number of layers. Also, if you post your definition here, I would be happy to help with getting your script to work correctly with the component.

Views: 335

Replies to This Discussion

Hi Benjamin,

Thanks for your reply. I am uploading my tests files here in case you can have a look at them and suggest what I can do to export objects with their own colours to external formats automatically.

Cheers.
The files ...
Attachments:
Hi Miguel,

I took a look at your definition, and there are several things to resolve.

1. Why it only exports the last layer in your loop:
When a loop is within a scripting component, Grasshopper will run through the entire loop before passing the output of that component to another component. So in order to run through all the layers and output a separate file for each, you should NOT loop through the layers using your script. Instead you should use a slider (instead of a series component) and then right-click on the slider and say "animate" to force the slider to move through each value. You can see an example of using "animate" to export multiple files if you watch the import/export loop tutorial video posted on the Local Code group page.

2. Why the objects are not colored individually:
When you are using this definition, you are reading objects in from Rhino, turning them into Grasshopper objects, and then baking those grasshopper objects back into Rhino. The problem is that when they are turned into Grasshopper objects, they do not retain the object attributes that define their individual color. This means that you cannot use the Local Code component to export these objects with individual colors. There are two ways to solve this:

Method 1: don't use Grasshopper.
Grasshopper is not really helping you very much in this definition, because you are mainly using Grasshopper to run scripts, so it might be easier to simply make a Rhinoscript, so that you can retain the object attributes of the Rhino objects, instead of creating Grasshopper geometry which does not retain the individual colors. It is would only take a few lines of code to select by layer and export selected objects using Rhinoscript. You could also use macros to easily select by layer and export selected objects.

Method 2, edit an existing script.
You could edit Giulio Piacentino's "bake objects with attributes" script by adding a layer input, a filename input then adding a line to select objects by layer, and then a line to export selected objects using an input file name. If you add an export selected objects line to your "select by layer" script, there would be no need to use the Local Code Export Component.
Thank you Benjamin, you´ve been really helpful!

Cheers

:-)

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