[Request] - Plugin to enable Macros !?
-
Hi guys ...
i was wondering is there is away of providing sketchup with the ability to record keystrokes to perform tasks ...
like for instance i have "T" as a shortcut for Top View ...
what i would love as a simple example use for this ...
would be to create a macro that when i hit "T" ... sketchup zooms extends and then changes to top view ...
chris
-
Its a bit tricky to implement macros (impossible to do it perfectly). But small scripts are easily written for tasks like that. That is just a few lines of code. Do you want to learn ruby?
Do you have a list of specific "macros" you want?
-
I would like to learn ruby but as I'm not a genius it just looks like a jumble of words and characters to me ...
-
Small snippets like this is a nice way to learn - small task, but still something you can make use of.
Lets take your first post as an example:
<span class="syntaxdefault"><br />def top_view_zoom_extent<br /> </span><span class="syntaxcomment"># Some variables for easy reference<br /></span><span class="syntaxdefault"> model </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_model<br /> view </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> model</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">active_view<br /><br /> </span><span class="syntaxcomment"># Orient camera top down and zoom<br /></span><span class="syntaxdefault"> new_camera </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">camera</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">set</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> ORIGIN</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> Z_AXIS</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">reverse</span><span class="syntaxkeyword">,</span><span class="syntaxdefault"> Y_AXIS </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> view</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">zoom_extents<br />end<br /></span>
Note - there are some extra steps to make it into a plugin with menus and making sure it doesn't interfer with other plugins. But as you can see - it doesn't take much code to do simple things.
We do have a thread somewhere with links to where to get started with the concepts of scripting/programming and Ruby. I'll see if I can dig it out.
Advertisement