algorithmic modeling for Rhino
Tags:
Hi Gearloose,
it sounds like you want to run a command macro. SendKeyCode is not your friend. It's basically what I use to delegate key-presses from Grasshopper to the Rhino commandline if I don't use them. For running commands you should be using Rhino.RhinoApp.RunScript().
Or, better yet, don't use any commands and use the SDK to modify the document directly.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi David,
ok, thanks. I thought because the help-file sais "Send a string of characters to the Rhino command line!", it would be the right command.
Could you please tell me, or show me an example, how I have to use your method?
By the way, I chose the macro, because I don't have the time at the moment to learn real scripting. And sending commands is the easiest way (for me) to do the modifications I need.
Greetz
Gearloose
The problem with using Commands is that you don't get much feedback. So when you're looking to add an object to a certain layer, there's a lot of bookkeeping involved just trying to keep track of 'your' objects. You end up spending a lot of time hacking around problems while you could spend that time learning how to use some SDK functions.
Tell me exactly what you need and I'll see if I can write a small script that does exactly that. Then you can start tweaking it to suit your further needs. I've always found that is the best way to learn programming.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Yes you're right. My problem was/is the time, that's because I needed a quick an dirty way to do it :)
Now it's working, like I wanted tu, but I'll try to explain what I want to do.
I want do generate a double-curved surface in a lot of different widths, heights and so on.
They are generated by 3 curves witch are controlled by some sliders.
My first problem was, that there is no option to make a Network Surface in GH.
And I didn't find another way to create the surface with exactly the same curves. So I just generate an bake the curves and afterwards I run a makro to make a Networf Surface an delete the baked curves.
To bake the different versions of the curves in separate layers I use the tool from Giulio Piacentino.
And what I wanted to do was to extend the code of the tool in such way that it runs the macro after baking, whitch I solved with Rhino.RhinoApp.RunScript.
I'm sure that there is a more elegant way to do this :)
If you like to write a script for that I would really appreciate that. In that case I could email you the gh-file.
greetz
Gearloose
any chance you could share the sendkeycode script? im sort of having the same macro doubt, but a small example could help break down and build up. :) lots of thanks
Yes sure.
But it's not SendCeyCode, but Rhino.RhinoApp.RunScript like David said.
The example creates a circle with a radius controlled by a slider.
I know it's a stupid example, because a circle can be created by GH itself, but it's just an example to show how I generated the dynamic macro and sent it to Rhino. :-) I substituted the layer/objectname
I've got it!! Thanks a lot for the hint!
After a few tests an playing around I figured out how to use it. Now it works!
I hat just to add following code:
//macro
if (activate) {
string runcode = macrocode;
Rhino.RhinoApp.RunScript(runcode, true);
}
The "macrocode" is my generated macro witch is input as a string from a panel.
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