New API doc - typos and questions
-
Tool - onMouseMove example has a bad local variable.
http://code.google.com/apis/sketchup/docs/ourdoc/tool.html#onMouseMovedef onMouseMove(flags, x, y, view) puts "onMouseMove; flags = " + key.to_s puts " x = " + x.to_s puts " y = " + y.to_s puts " view = " + view.to_s end
The variable "key" should be replaced with "flag" I think. That makes the example work.
Chris
-
http://code.google.com/apis/sketchup/docs/ourdoc/face.html#get_UVHelper
The code example:
model = Sketchup.active_model entities = model.active_entities pts = [] pts[0] = [0, 0, 0] pts[1] = [9, 0, 0] pts[2] = [9, 9, 0] pts[3] = [0, 9, 0] # Add the face to the entities in the model face = entities.add_face pts tw = Sketchup;;TextureWriter.new uvHelp = face.get_UVHelper true, true, tw
This will return the error:
@unknownuser said:
Error: #<TypeError: (eval):95:in `get_UVHelper': wrong argument type (expected Sketchup::TextureWriter)>
(eval):95Instead of
tw = Sketchup::TextureWriter.new
, the methodtw = Sketchup.create_texture_writer
will work.
Which leads to another questions: why can'ttw = Sketchup::TextureWriter.new
be used as in the example? -
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.onPlaceComponent FIXED
-
@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!
-
For
Point3d.distance_to_line
the docs give the same example aspoint3d.distance
. -
I can't get the
DefinitionObserver
to trigger at all. http://code.google.com/apis/sketchup/docs/ourdoc/definitionobserver.html Neither theonComponentInstanceAdded
oronComponentInstanceRemoved
events. Are these the correct event names? -
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.
-
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.
-
Nice one Scott.
I seem to have come across three observer events that doesn't work. It would probably be useful to mark these in the docs with a warning so that people won't waste a whole lot of time trying to get them work work. ..like I have...
DefinitionObserver
http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=17631 (Completely busted)
EntitiesObserver.onContentsModified
http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=17970 (Add and Remove event works though. Haven't tried the Erase event.) -
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
-
These failing observers is quite severe. I don't suppose there's a chance the dev team can push out an update outside the servicepack schedule? (I don't know what your schedule is, but seeing that we just got an servicepack I'm a bit pessimistic to when this might be addressed...)
-
A semi related typo:
in this tutorial pt4=[0,9,9] whereas it should be [0,9,0].
-
::OFF TOPIC::
All right Remus, come clean. Your always in the Ruby forum, you spotted a typo in tutorial, you answer questions once in a while....how much ruby do you know? Are you making plugins and selling them overseas for big money or something?Chris
-
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.
-
Dont pretend your not in on it as well
on a more serious note, it seems a shame to miss out on the ever so powerful ruby based capabilities of sketchup, so i thought i'd try my hand at it and see if i got anywhere.
I reckon i could just about right a box making script at the moment just as long as you dont want to change your box at all...
-
Seems that
InstanceObserver.onClose
is dead as well. http://code.google.com/apis/sketchup/docs/ourdoc/instanceobserver.html#onClose
ButonOpen
works. -
http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/model.html#active_path
@unknownuser said:
For example, if a user has double-clicked into a component to edit its geometry, and then double clicked into a sub-group to edit that, the active_path might contain:
And there it stops. Doesn't actually display an example.
-
Self note: We should add these codes to the send_action docs:
http://groups.google.com/group/Ruby-API/msg/e30ee3f2b21cb228
-
http://code.google.com/apis/sketchup/docs/ourdoc/toolsobserver.html
# This is an example of an observer that watches tool interactions. class MyToolsObserver < Sketchup;;ShadowInfoObserver def onActiveToolChanged(tools, tool_name, tool_id) UI.messagebox("onActiveToolChanged; " + tool_name.to_s) end end # Attach the observer. Sketchup.active_model.tools.add_observer(MyToolsObserver.new)
Note that it refers to
Sketchup::ShadowInfoObserver
instead ofSketchup::ToolsObserver
. -
@unknownuser said:
Self note: We should add these codes to the send_action docs:
http://groups.google.com/group/Ruby-API/msg/e30ee3f2b21cb228
Does this list work 'across-platforms' - my understanding was that PCs and Macs differ ?
If there are such codes it makes like a lot easier...
Some "wrong": Sketchup.send_action 21513 >>> opens the Outliner ???
.
Advertisement