Yes, some of its operations take advantage of the start_operation flag so that they perform faster. Other than that, I'm not aware of any other changes.
Posts
-
RE: To the SU team: Is sandbox tools updated for SU7?
-
RE: New API doc - typos and questions
@thomthom said:
Could you post a working sample where
onClose
fires?Give this a go... Could be that we're seeing a sneaky bug...
class MyInstanceObserver < Sketchup;;InstanceObserver def onOpen(instance) UI.messagebox("onOpen; " + instance.to_s) end def onClose(instance) UI.messagebox("onClose; " + instance.to_s) end end model = Sketchup.active_model model.definitions[0].instances[0].add_observer(MyInstanceObserver.new)
-
RE: New API doc - typos and questions
@thomthom said:
ToolObservers? How are they related to onClose and onOpen?
I meant to say, InstanceObservers.
In any case, they fire fine for me.
-
RE: New API doc - typos and questions
@thomthom said:
We could ask Coen to have a strike-through BBC tag. [deleted] or something...
Or, put a big fat FIXED in bold green. Might be easier.Jim, is there a way that I could be granted edit rights just to this thread? Then I could add a FIXED note inside the reports as I correct them?
-
RE: New API doc - typos and questions
@thomthom said:
Seems that
InstanceObserver.onClose
is dead as well. http://code.google.com/apis/sketchup/docs/ourdoc/instanceobserver.html#onClose
ButonOpen
works.Thomas,
I'm about to push an update with all of the recent changes above. This one puzzled me, though. The ToolsObserver examples work fine for me on the onOpen and onClose. Can you clarify what "dead as well" means?
@unknownuser said:
Does this list work 'across-platforms' - my understanding was that PCs and Macs differ ?
Tig, these action codes only work on the PC, but I still think I'll add them to the docs. There are some cool things in there that PC-only shops might need.
Thanks, guys! New update should be live in the next day or so.
-
New code.google.com Attribute Reporting Example
Hello everyone,
I've received some PMs from folks curious about getting attributes out of Dynamic Components (and attributes in general.) We've added a tutorial to the new documentation site with a code example:
http://code.google.com/apis/sketchup/docs/tutorial_attrreporting.html
This information has been shared elsewhere in some other posts, but I thought I'd repost. If you haven't checked out the new documentation site, please visit and join ThomThom's sticky post above to help us improve it:
While I'm on the subject of URLs to know and love, if you're not a subscriber to the SketchUp developer blog, you can join here to get regular updates and tutorials about the API.
Okay, enough of that for today. Thanks!
-
RE: Store a hash as an value in an attribute dictionary
Pout,
I don't think you're allowed to store arrays, hashes, etc. inside attributes.
You could convert your object into a string with .inspect and then eval it back into an object. Here's a project with utilities for that kind of thing. (Disclaimer: I've not used it personally.)
http://rubyforge.org/projects/ron/
Cheers,
-
RE: New API doc - typos and questions
Self note: We should add these codes to the send_action docs:
http://groups.google.com/group/Ruby-API/msg/e30ee3f2b21cb228
-
RE: Need an example to munipulate a dynamic component with ruby
When you saved redsang.skp, did you File > Save As, or did you Right click > Save as?
The File > Save As method is probably what happened. This isn't the same as saving sang as a standalone SKP. Try right clicking on red sang and "Save as" and then try the import. See if that works.
-
RE: New API doc - typos and questions
Just saw another one: the Sketchup.break_edges= example is the Sketchup.break_edges? example.
Thom, step 1 with the observers is to confirm if it's the implementation that is broken or the documentation. Simone has filed A-list bugs against the observer problems you've found, and he and I have been chatting about it. Any fixes will have to wait until the next maintenance release.
Feel free to PM me if you want to brainstorm workarounds for what you're trying to accomplish. I know a few tricks.
-
RE: New API doc - typos and questions
I also just got this one from a coworker:
Sketchup.get_resource_path example fails. Looks like there's a required parameter that's not properly documented.
-Scott
-
RE: New API doc - typos and questions
There's a new update live that fixes (most of) the problems reported above. There were one or two that will require me to pound on it a bit more. Keep 'em coming!
I also posted a new tutorial on reading attributes.
-
RE: Need an example to munipulate a dynamic component with ruby
Hey guys,
Here's the "quick and dirty" overview of how to apply some options and then fire a redraw of a DC.
I'm working (slowly) on some better documentation. In the meantime, you can kind of understand how the various attributes work by inspecting the "dynamic_attributes" library yourself. This tool is handy for looking at attributes.
I just posted a tutorial on reading DC attributes to the code site. That could be helpful, too.
UI.menu("Plugins").add_item('Make Sang Red') { # Assumes that sang is the 1st entity in model. sang = Sketchup.active_model.entities[0] sang_def = sang.definition # Override sang's shirt color to red. ("material" # is a special attribute that requires # you to set a formula to "take control" # over the default material the user has painted.) sang_def.set_attribute 'dynamic_attributes', 'material', 'red' sang_def.set_attribute 'dynamic_attributes', '_material_formula', '"red"' # Add a new configurable option to Sang. # (Any attribute that starts with an underscore # is a "meta attribute" that describes behavior.) sang_def.set_attribute 'dynamic_attributes', 'weight', '145' sang_def.set_attribute 'dynamic_attributes', '_weight_label', 'weight' sang_def.set_attribute 'dynamic_attributes', '_weight_formlabel', 'My Weight' sang_def.set_attribute 'dynamic_attributes', '_weight_units', 'STRING' sang_def.set_attribute 'dynamic_attributes', '_weight_access', 'TEXTBOX' # Change the description that shows # up in the configure box with a custom # formula. sang_def.set_attribute 'dynamic_attributes', '_description_formula', '"Sang is now red and weighs " & weight' # There is a global handle into the plugin that # allows you to make the same calls that the # plugin does, like so... dcs = $dc_observers.get_latest_class dcs.redraw_with_undo(sang) }
Let me know what doesn't make sense.
-
RE: SketchUp SDK Scrambler - Problem with paths?
Talig,
Are the files you're trying to load in the Plugins directory someplace? You might try Sketchup.find_support_file, which has worked for me in scrambled rubies before.
http://code.google.com/apis/sketchup/docs/ourdoc/sketchup.html
Cheers,
-
RE: Webdialog problem
@pout said:
I have made a workarround by just generating and regenerating my html script all from in ruby itself.
So there is no external html file used anymore. This off course is not the best way (like chris says it's better to do all in html) but for now, it will do.I dunno, the advantage is that your script install has fewer files. Unless you're regenerating an extremely large set of HTML or doing it a lot, I think you'd be fine with that approach.
@unknownuser said:
Scott, the href contains javascript:doSomething();
Maybe if i drop the href and use the span it will solve.
I'll keep you posted once i get into this again.In that case, I think that if doSomething() returns false, as Thom suggested, then the problem should go away. Sounds like you found a solution in any case!
Cheers,
-
RE: Internet Explorer 8 & SketchUp
The only problem we've seen so far (that I'm aware of), is that a couple of folks have required a restart if they install IE8 while SketchUp is open.
So first suggestion is to install IE8 with all apps closed. But if you do see a webDialog problem, a system restart should fix it.
Cheers,
-
RE: New API doc - typos and questions
I just had a big one reported to me... posting it here so folks are aware until the next fix.
The face.material method is entirely missing from the new docs.
-
RE: Webdialog problem
Talig,
In the code for the dynamic link that you're generating, are you using a "#" as the href? If so, try changing it to "javascript:;" and see if that helps. For example, if you have something like this...
<a href="#" onclick="doSomething()">Link</a>
Change it to this...
<a href="javascript:;" onclick="doSomething()">Link</a>
Or even better, get rid of the link entirely...
<span onclick="doSomething()">Link</span>
I've seen a problem similar to what you're describing that was caused by something like the above.
Cheers,
-
RE: Dynamic components made unique after scaling
@thomthom said:
Just going back to this for a second. So if I apply a scale transformation to a DC, won't that trigger the DC to redraw in the same manner as if it was scaled using the Scale tool?
ThomThom,
Sorry for the late response on this one. I was on a business trip last week and am trying to catch up.
If you apply a scale transformation via the Ruby API, the redraw will not occur unless you tell it to. Here's a snippet of code that forces a redraw via Ruby, by getting a manual hook into the plugin:
$dc_observers.get_latest_class.redraw_with_undo(my_comp_instance)
Cheers,
-
RE: New API doc - typos and questions
@thomthom said:
ModelObserver.onPlaceComponent
http://code.google.com/apis/sketchup/docs/ourdoc/modelobserver.html#onPlaceComponentThe manual claims that a
Model
is passed on as the argument, but instead it's theComponentInstance
. I have not tested the rest of theModelObserver
events to see if they also match.Thomas, you rock.
I'll double check all of the modelobserver arguments. Thanks!