In my example, you would need a 3rd observer - EntitiesObserver - to get the entities to add the center point to.
The following attachment adds these 3 observers and outputs debugging info to the Ruby Console.
In my example, you would need a 3rd observer - EntitiesObserver - to get the entities to add the center point to.
The following attachment adds these 3 observers and outputs debugging info to the Ruby Console.
@azuby said:
Isn't is possible to observer the Circle Tool itself? Or subclassing the Circle Tool?
azuby
I don't think you can observe a Tool. You can observer the Tools class.
But, I think by using both a ToolsObserver and a ModelObserver, you can get to where you want to be.
@craigd said:
Hi Jim, here is the link to the new Ruby Discussions Group:
http://groups.google.com/group/sketchupruby/topics
Cheers,
- CraigD
Craig, I've been a regular reader and contributor since the group's inception - in fact, I was the one who asked for a Ruby forum. I never did understand why they named it "Ruby Ideas." Anyway, it never occurred to me to post there, but I'll try.
Is there a best place to report bugs and inconsistencies in the Ruby API?
@gidon said:
Hi y'all,
If memory serves, there's a script that eliminates superfluous faces. Like if I make a group made up of a number of groups then, if I understand correctly, the script will erase faces that are hidden or that overlap.
Is there indeed such a script and is that what it does?
Thanks
Gidon,
I've searched Didier's site and Smustard but came up with nothing. There's at least 2 scripts to remove coplanar edges, but I couldn't find anything to remove superfluous faces.
@dave r said:
Jim, the thumbnailer works fine on my computer but I can't seem to change the shadow selection from Both and I can't change the exported file name. It appears to be set to the SKP file name only. If this is the case, perhaps you could set it to show in the Save dialog?
Interesting idea for a script. I might be able to find an application for it, too.
The shadow selection is disabled on purpose. I wanted to see if the plugin was going to work before adding features.
I can set the base filename to appear in the save dialog. Good idea, thanks.
@daniel s said:
IsnĀ“t working well in my machine...
This plugin exports images of the current scene for the current in use Style only (one with and one without shadows).
It detects with "Image count" the number of images that will be created, but exports only the style iĀ“m using and not all the styles "In Model".
If i have 3 styles "in model", it only exports the current style 6 times (3 with shadows and 3 without them).
Daniel S
This is confusing to me. What are the filenames of the 6 exported images?
@daniel s said:
The Ruby Console doesnĀ“t report anything. IĀ“m using Windows Xp but i donĀ“t update to the latest version of Sketchup yet... iĀ“m using SU 6.0.312.
And I have custom styles installed that maybe contains unusual characters... I try not to use them for testing the plugin (but i didnĀ“t uninstall my styles) and i have the same error (exports the current in use style only).
Daniel, I just don't know. I've been going over it and I don't have any idea about why it only outputs one a single image for you, when it works for me.
Have you examined the code to see if what might be the problem?
Hello Daniel,
Since it exports at least one image, I am wondering you have any custom styles installed whose name contains unusual characters? Also, if you open the Ruby Console window before running the plugin, does it report anything? What about Mac or PC?
Thanks.
@daniel s said:
IsnĀ“t working well in my machine...
This plugin exports images of the current scene for the current in use Style only (one with and one without shadows).
It detects with "Image count" the number of images that will be created, but exports only the style iĀ“m using and not all the styles "In Model".
If i have 3 styles "in model", it only exports the current style 6 times (3 with shadows and 3 without them).
Daniel S
About
Style Thumbnailer was created for monsterzero (blog), who asked for...
@unknownuser said:
...the ability to automatically render out a shot/scene with several pre-set styles (incl shadows on/off).
This plugin exports 2 images of the current scene for each "In Model" Style - one with and one without shadows.
Usage
Download, extract, and move the files into your Plugins folder. Restart SketchUp.
Feedback
This plugin is being released with limited functionality. I want to test the fundamental operation in order to solicit feedback. Once it is accepted as being stable, I can add features.
Screenshot
Download
I wrote this Outliner exporter for a specific purpose, but it may be of use to someone.
I wrote this for a specific type of output; something called CI ID (or something.) This plugin exports the outliner to a text file. Download...
(sketchuptips.blogspot.com)
@unknownuser said:
Will you give me instructions on how to use the [JF] Unfold ruby script?
ZIM,
Attached is a dual-purpose tutorial skippy. Purpose #1 is to show some basic unfold usage.
Purpose #2 is to test my tutorial-making plugin, with which this model was made.
@rickw said:
Just tried this with FlightPath (which uses LAYER_IS_HIDDEN_ON_NEW_PAGES) and it worked fine. I saved the model, started a new model, then re-opened the saved model and checked the layer.page_behavior. Everything was saved with the model.
It doesn't work for my posted example. Did I do something wrong?
On a related issue, it doesn't look like a layer's page_behavior is saved with the model.
Sketchup.send_action("showRubyPanel;")
UI.menu.add_item("Layers y Pages") {
layer = Sketchup.active_model.layers.add Sketchup.active_model.layers.unique_name
layer.page_behavior = (LAYER_HIDDEN_BY_DEFAULT|LAYER_IS_HIDDEN_ON_NEW_PAGES)
#layer.page_behavior = LAYER_IS_HIDDEN_ON_NEW_PAGES
#layer.page_behavior = LAYER_HIDDEN_BY_DEFAULT
page = Sketchup.active_model.pages.add
}
UI.menu.add_item("layer behavior") {
puts "=" * 25
Sketchup.active_model.layers.each { |layer|
puts layer.page_behavior
}
}
@rickw said:
You can get the same thing with Sketchup.active_model.pages
The problem usually occurs when something is assigned to a variable (ie pages=Sketchup.active_model.pages), the script is loaded (say, on SU startup), and then you start/open a new model. pages was defined with the original model, and doesn't get redefined to the new model.I've mentioned this to the SU crew regarding pages. I can add that you've had the same problem with layers.
I'm not sure how I did it, but calling:
Sketchup.active_model.layers
#<Deleted Entity;0xb016af8>
I go to the Layers dialog, add some new layers - same thing. File > New == same thing.
How in the world can the layers object become deleted, and can I do anything about it from ruby? Shouldn't it at least always contain Layer0, since it is always present?
Thanks.
("a".."z").each { |l|
begin
print "Trying #{l};"
UI.menu(l).add_submenu('jim')
puts "OK"
rescue
puts "Error on #{l}."
end
}
I don't like the "code" font, by the way; it's hard to read.
azuby,
I came up with this code. It stores the menu object in a Hash on creation. But it doesn't work for the reasons you stated.
class Sketchup;;Menu
@@submenus = {}
alias ;old_add_submenu ;add_submenu
def add_submenu(name)
@@submenus[name] = old_add_submenu(name)
end
def self.submenus
@@submenus
end
end
Well, it builds the hash correctly, and you can access the sub menus by name:
Sketchup;;Menu.submenus["SomeName"].add_item("Say Hi") { UI.messagebox("Hi!") }
The above example does not work. It give no error, but it doesn't add the menu item either. Too bad as it would then be dead simple to hijack the add_submenu and add_item methods to create the menu tree, and no script would need changed to fit into a certain category.
What about using a WebDialog? The thought has been brewing in the back of my mind for awhile about a WebDialog based Add-In Manager.
Have a look at this menu example for a possible idea: http://www.zzee.com/art-html-listing/samples/apache/jsmenuVer.html
Edit: On second thought, this might not work so well.
What you want to do is difficult, otherwise it'd be done already
@unknownuser said:
Hi. .. .I am David. . .Long time listener. .. first time caller.
Where does one find taht Toolbar for Load scripts. I can't seem to find it. . .
David, you probably can't find it because I'm the only one who has it. It's just something I did for my own convenience.
My Toolbar has 4 items: [ Open Ruby Console | Browse Plugins Folder | Load Ruby Script | Re-Load Last Script ]
You can see it in the screenshot I previously posted. If you or anyone else is interested, I can polish it up and get it posted.
@unknownuser said:
is there a way to organize your rubies? mine are getting out of control... I have like 200 it seems...
can'T I build a folder structure that the drop down menu would recognize?
I keep very few in the Plugins menu, prefering to load less frequently used scipts on demand using a scipt loader tool button.
You just gave me an idea...
It would be possible to associate a list of scripts to a model, so after the model is loaded, the associated scripts could be loaded. I need to think more about if there's any value to this.