Showing posts with label dev. Show all posts
Showing posts with label dev. Show all posts

Updated WebConsole



I updated WebConsole - a multi-line Ruby code evaluator aimed to be an enhancement of the built-in Ruby Console.

Look!
This version will not prompt you to save code snippets when you close or clear the console. I found the prompts annoying, and so removed them.

Windows only
This release won't work on a Mac, I'm almost certain of that. I do plan on making it cross-platform in the future.

No More Results Area
I eliminated the results area of the console in favor of using SketchUp's Ruby Console. This was partially for performance - if you process a large number of entities, then the result is a large list which needs to get uploaded to the results. I figured why not just use the Ruby Console?

Open Ruby Console Button
So since there is no more results area, I added a button to open the Ruby Console. The same button will clear the Ruby Console if you have morisdov's rubyCons.exe utility installed.

Save/Load retains indentation
The code indentation is retained when loading and saving snippets.

Push/Pull code to Model
You can "push" the code into the Model, and "pull" it back into the console. Good for sharing a model and code in one file.

Code Indenter
I included a Ruby code beautifier from http://www.arachnoid.com/ruby/rubyBeautifier.html - so now you can indent the code in the console and even select the tab size.

There's more, but those are the biggies.

Download here.

SketchUp Installation Location Registry Entry

Didier Bur on the SketchUcation forums asked where SketchUp stores its installation location in the Windows registry. The answer, direct from SketchUp's installer expert Steve P. is..

For SketchUp 6:

HKEY_LOCAL_MACHINE\SOFTWARE \Microsoft\Windows\
CurrentVersion\\Uninstall\{98736A65-3C79-49EC-B7E9-A3C77774B0E6}\InstallLocation


For SketchUp 7+:
HKEY_LOCAL_MACHINE\SOFTWARE\Google\Google SketchUp 7\InstallLocation


SketchUcation Community Forums • View topic - Sketchup registry key ?

SketchUp Ruby API Objects Diagram

It really helps you to visualize the object types and relationships.

Objects Diagram - Google SketchUp Ruby API - Google Code

[ via Google SketchUp API Blog ]

Undocumented Sketchup.send_action's

Here are a few undocumented messages I found. These are in addition to the documented list.

copy:
cut:
paste:
editDelete:
getCurrentView:
getModels:
newDocument:
openDocument:
placeModel:
printDocument:
saveDocument:
select3dTextTool:
selectionZoomExt:
shareModel:
viewShowGuides:

Inputbox class

The Inputbox class makes it easy to create user input dialogs by providing a consistent interface to UI.inputbox for text fields and drop-down selections.

New updates 5/15/2009

* Access the values by name or by index.
* An each method to iterate the options.
* Reset fields to original values.
* Persistent storage using the Registry (or .plist file on Mac.)

Download inputbox.rb

Some examples of usage.


# my_plugin.rb
require 'inputbox'

# Create a new Inputbox. The name is used as part of the registry key.
# The registry key (if inputbox is saved) will be: "Inputbox_Unique Name"
@options = Inputbox.new("Unique Name")

@options.add("Name") # add a empty text input
@options.add("Age", 39) # a text input with 39 as the default value.
@options.add("Ruby", ["Beginner", "Intermediate", "Advanced"]) # Dropdown
@options.add("Sketchup", [1, 2, 3, 4, 5], 3) # dropdown, 3 as default

# Display the dialog
@options.show

# Access the options

# Iterate prompt, value pairs
@options.each { |k, v| puts "#{k.inspect} = #{v.inspect}" }

# By name
name = @options["Name"]

# By Index
age = @options[1]

# Persistent Storage
@options.save


Here's an example for creating the inputbox from registry values.

# my_plugin.rb
require 'inoutbox'

# Create
@options = Inputbox.new("Unique Name")

# Load
@options.load
if @options.prompts.empty?
  # Build Inputbox
  @options.add("Name")
end

# Display
# returns an Array of values
values = @options.show





Plugin: Observer Tests

2010-05 - The renderingOptionsObsever now prints the name of the changed option.


Observer Tests a test suite of all the available observers in SketchUp.

The image shows the menu with the observers. Click an an observer to add it to the model. Be sure to open the Ruby Console window to view the events that get called.


The latest version includes all the Observers in SketchUp. A few of them need some user input to find something to attach to, and so I added some dialogs to help pick those things out. These are marked with an asterisk.

To install, unzip the file and move the observers folder into your Plugins folder. The Observers menu will appear in the Plugins menu.

Download from here.

Popular Posts (Last 30 Days)