New developer wants to simple plugin
-
Hi,
I am a fairly experienced Sketchup user, a professional data processor (but new to object oriented), and a serious chairmaker. I use sketchup to rotate things like legs, spindles etc. and a plugin would help me greatly. Where I am getting hung up to start is with the interfaces and other issues.
I see it working this way. The user must select a component to tilt, then call the plugin.
The plugin would display a dialog and/or input boxes where the user would type in a few x, y values and select other options. The plugin would check to make sure a component is selected, do some math on the x, y values, and then rotate the component. I have Scarpinos book "automatic sketchup" which is a good start, but the dialogs are a bit basic.
When I store my test plugin in the plugins directory (windows), it runs every time I start sketchup, unlike the other plugins that are stored there.
Does anyone have any advice to; 1. follow simple rules for good plugins, 2. locate some good sample dialogs, or just general ingo.
Thanks,Stevo
-
You need to wrap your code in a method [def] OR better inside a 'class' or even betterer a 'module'. That way you can then run your code from the Ruby Console to test it, or add some extra menu code to the end of your script to execute the tool from a menu item... Find any of my Plugins [there's an Index button...] and read them to see how the code is 'wrapped' and menus made etc... even the simpler ones don't run when Sketchup starts [unless there's something like an observer that needs to run at kick off...]
-
Hi Steve! I can't wait to see what you come up with.
This guy is really good. His SketchUp learning project was a Welsh stick chair. There's nothing like just diving in head first.
-
Stevo,
You should make a simple plugin, 1st. For example, try having an message box pop up with the text "Hello". That's like 1 line of core code, but the rest will be a wrapper that creates the actual plugin. Check out these videos: http://www.youtube.com/user/ChrisFullmer#g/u Then you can try writing your plugin. Brake it up into pieces and get each piece working, before moving on to the next. For example, 1st piece might be to simply to rotate the selected group/comp 90 deg. For user input, you can probably just use an input box: http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#inputbox
You see that I went to the Sketchup Ruby API documentation, when I wanted to research how to do something: http://code.google.com/apis/sketchup/docs/index.html
-Kwok
Advertisement