algorithmic modeling for Rhino
Hi Saniago,
that is nnot RhinoScript, that is just a Rhino command macro. You can use commands from within C# components, but you could also use regular RhinoCommon SDK methods.
The trick here is to use the hyphen to disable the window and use the command line version of the SelLayer command.
private void RunScript(string layer, bool run, ref object A)
{
if (!run) return;
Rhino.RhinoApp.RunScript("-_SelLayer " + '"' + layer + '"', true);
}
This C# component has two inputs, one string identifying the layer name to be selected and one bool that allows you to enable/disable the script easily.
I added double quotes around the layer name because if the name has a space it will act as a premature assignment in the Rhino command line.
--
David Rutten
david@mcneel.com
Tirol, Austria
As allways, thanksss sooo much, this trick is so nice!
Let me ask you another question (allways pushing you huh xDD) ... what If I need to apply to each object in that layer an specific mapping? Should I need first to request the objects ID´s, and then piking up the first one -> _ApplyBoxMapping, the second one -> _ApplyBoxMapping...etc.?? Or should I need to create as much sub-layers as objects and then apply the mapping to each one??
Sorry, I know this is a very speciphic question, but im a little bit lost
thanks
If you want to use your geometry in Grasshopper then it's better to actually import it and apply the operations using Grasshopper components. If you want to operate on the objects in the Rhino document, then you'll indeed have to iterate over them and apply transformations. Using Rhino commands like SelLayer etc. is not the best way to go if you want something as complex as this.
What I would do is collect all objects that are on the appropriate layer, put them in the right order (I do now know what criteria you use to identify the order the objects) and then use RhinoCommon SDK transformation methods.
Can you explain a bit more about the details? Like; how is the mapping defined? How are your objects sorted?
--
David Rutten
david@mcneel.com
Tirol, Austria
The thing is i need to render several objects, so I organize these breps by groups (as you say) and then I´m doing a controlled bake by layers, a vray render, then I save the image, selecting every geometry and deleting them. BUT, I have diferent materials for each layer, and in each layer I have lets say... 20 objetcs. If I were in rhino I would select one by one, then I shold apply a box mapping (again, to each one) Because if I select all the layer and then I apply the box mapping, it will affect as if it was only one. I use to do everything inside grasshopper, but in that case I have no way to control this property into it.
by the way.. Its strange: the button I use to make it works seems stucks the mouse function... I meen, I can only zoom in and zoom out after pressing it. (I can only solve it by pressing again the buttom... :S) Is this some kind of bug?
How could I trick it in that case? Using a delay to be sure the true boolean is ON at least for some miliseconds?
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