New API doc - typos and questions
-
Brian
Please learn to use the forum's search function [top right]...
http://forums.sketchucation.com/viewtopic.php?p=380121#p380121
-
Model.save_thumbnail
BUG: SU ver 7.1.6087 win32
Model.save_thumbnail (which only works for the current model,) but has a bug, in that if the model has never been saved, the method writes a blank thumbnail image to the %UserProfile% folder [actually to the current working directory,] instead of the Model folder specified in Preferences>Files>Model folderpath.
If the current model has been saved with a thumbnail, then the thumbnail image is properly saved to the Model path as set in Preferences>Files>Model.
UPDATE - the API should include aModel.refresh_thumbnailmethod, similar to (or perhaps using the same internal code as,) theComponentDefinition.refresh_thumbnailmethod.
_ -
Hi!
Under Quick References --> Method Index it will only load from "Symbol, A, B, C, D to E"... not any further.
I have the same problem in I.E. and Chrome... for more than a week now.
-
All letter links (targets,) work fine for me using Chrome.
Try clearing your browser cache ??
-
Hmm... found a solution.
When I press Methods Index in the menu it opens "https://developers.google.com/sketchup/docs/methods?hl=da"
I tried to delete ?hl=da so it only said: "https://developers.google.com/sketchup/docs/methods"
Then it works.
-
@rvs1977 said:
Hmm... found a solution.
I tried to delete ?hl=da so it only said: "https://developers.google.com/sketchup/docs/methods"
Then it works.
On the Google Developers site.. at the lower right, on the bottom (dark gray) toolbar, is a language change button.
Use it to switch to English ... then bookmark the page.I also posted a API links menu that I exported out of Chrome, ...
Get it here: SUAPI_Links.zip -
"NamedOptions" OptionsProvider bugged?
I am not sure what the intended behavior of the "NamedOptions" OptionsProvider is... so...
I'll just describe the weirdness of it, that I see on the PC:
1) It is within the Model options scope, ie, accessed via:
Sketchup.active_model.options["NamedOptions"]
2) It is saved with the model file.
3) But once this OptionsProvider is used within a session, all attributes remain loaded, regardless of whether the model is closed, another model opened, or just a new model opened.
- An attribute of the same name, from the next file, will overwrite.
- But existing attributes will remain unchanged.
- If you save the second model, whether you add any attributes, or not, ALL the "NamedOptions" attributes are written into ALL subsequent model files saved during that session.
So.. if you happened to open a file, just to view it,... and it had any "NamedOptions" attributes saved,.. and then you started a new model, or re-opened another file for editing... the "NamedOptions" attributes from the "viewed" file, will propagate into your "edit" model (likely without you knowing it.)
It does not seem to be desirable behavior. I think there is a bug, in that Sketchup should clear and reset the "NamedOptions" provider when another file is loaded.
I wonder what the behavior is on the Mac when multiple files are open ??
-
I could not find a send_action value for Display or toggle the Measurement Toolbar. Just VCB hide / unhide with Statusbar.
Is there an undocumented Value? -
There's a massive list of numerical PC only codes that do more than the PC/MAC Sketchup.send_action("text") versions... I've PM'd you it...
-
You refer to the API list? https://developers.google.com/sketchup/docs/ourdoc/sketchup#send_action
There I could not find what I`m looking for. So my question for undocumented numbers. -
@thomthom said:
Animation
http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/animation.htmlThe first example on that page:
> # This is an example of a simple animation that floats the camera up to > # a z position of 200". The only required method for an animation is > # nextFrame. It is called whenever you need to show the next frame of > # the animation. If nextFrame returns false, the animation will stop. > class FloatUpAnimation > def nextFrame(view) > new_eye = view.camera.eye > new_eye.z = new_eye.z + 1.0 > view.camera.set(new_eye, view.camera.target, view.camera.up) > view.show_frame > return new_eye.z < 500.0 > end > end > > # This adds an item to the Camera menu to activate our custom animation. > UI.menu("Camera").add_item("Run Float Up Animation") { > Sketchup.active_model.active_view.animation = FloatUpAnimation.new > } >
It makes a class named
FloatUpAnimation
, but no mention ofAnimation
. A bit confusing.
Is it like the Observers?
Should it sayclass FloatUpAnimation < Animation
Hi,
Can someone post an example of using the "nextFrame(view)" definition for moving an entity object instead of a camara?
My objective is to create a game in SketchUp similar to the one I am making with ruby and gosu named "Resballiza" ... Here is a link for more info;
http://www.libgosu.org/cgi-bin/mwf/topic_show.pl?tid=815
So far I have studied JS Move Tool by Jan Sandstrom and changed the Keys for my game style but the "Typematic effects" bug in windows is giving me a hard time.
I have also tried to understand the scrip in the "Prince of IO" game but get lost with anything that has to do with Webdialog related scripts. Please any help in demonstrating a simple object animation that is as simple as the FloatUpAnimation scrip for the camera let me know.Thanks
-
The menu item's code
Sketchup.active_model.active_view.animation = FloatUpAnimation.new
runs that class, making a new animation associated with the 'view', the class calls the lone special methodnextFrame(view)
- which affects the view's camera when it resets it with anew_eye
position and usesshow_frame
to update the view...
The '.animation
' is a method applied to a view, no a 'separate' class in it's own right...
Your own class that you pass to theview.animation
can do various things inside thenextFrame(view)
method - changing the camera's eye position is just one example...It is an awkwardly set up method/class - but it will work as the example...
-
Hi,
Thanks TIG for explaining that
I found this topic and it solves animating an object like I wanted to but I can't make a file.rb for leading in the plugins menu. It shows me this error;
Load Errors
Undefined method ‘transform!’ for nil:NilClassError Loading File
jumper.rb
undefined method ‘transform!’ for nil: NilClassIf anyone nows how to solve this let me know
Thanks
-
@burkhard said:
I could not find a send_action value for Display or toggle the Measurement Toolbar. Just VCB hide / unhide with Statusbar.
The VCB ("Measurements") toolbar is special. (It's really a ControlBar.) There are many native tools, and Ruby Tools that rely upon it. Therefore it cannot be hidden like other toolbars. (This is by design.)
However when you "toggle" it, instead of it being a hide/show toggle, it is actually a StatusBar dock/undock toggle.
@burkhard said:
Is there an undocumented Value?
Yes the dock/undock toggle is
Sketchup.send_action(24157)
, but on PC only.When you undock it from the StatusBar, it will take on the user's undocked setting, which is either floating (the default,) or docked to one of the Toolbar Containers (top, left, right or bottom.)
Be aware that the location of the VCB is a user preference. I myself have it undocked from the StatusBar, and docked in the top toolbar container, 2nd row, 2nd position (following the Layer ControlBar.)
If your plugin was to callSketchup.send_action(24157)
, the VCB would be moved back onto the StatusBar (where I hate it.) So you risk upsetting users if you move the VCB somewhere the user does not want it. -
@unknownuser said:
If anyone nows how to solve this let me know
You really should have started a new topic for your issue. (This topic about errors in the online API Dictionary.)
You need to learn to read Exception messages. The full message will have a line number in your file where the error happen.
You are calling the instance methodtransform!
upon an object that you think is aSketchup::Group
instance (guessing,) ... but something had gone wrong in a previous statement when you assigned the ref to the object identifier, and some other method returnednil
(the singleton instance of theNilClass
.)It is standard in Ruby to first check for success, before continuing.
obj = ents.add_edge( pt1, p2 ) if obj # evals true if not false or nil obj.transform!(tr) else UI.messagebox("Error created the Edge object!") end
-
@dan rathbun said:
@unknownuser said:
If anyone nows how to solve this let me know
You really should have started a new topic for your issue. (This topic about errors in the online API Dictionary.)
Don't worry about that now (this topic is so long and cluttered it does not matter much. And likely will be locked when the next version of the online API Dictionary is updated.)
@dan rathbun said:
You need to learn to read Exception messages. The full message will have a line number in your file where the error happen.
Move your file (and all your authored scripts,) into a "Renderiza" subdir of the Plugins dir.
When debugging.. start Sketchup, then open the Ruby Console.
Enter
load("Renderiza/myfile.rb")
You'll see a more complete Exception message output to the console.
-
Thanks Dan Rathbun for teaching me how to debug inside Ruby Console.
I forgor to post the topic link I was referring to…
http://forums.sketchucation.com/viewtopic.php?f=180&t=25498I still can’t find a way to load the jumper.rb and animate the object when active but I will sonn figure it out. And I promise that for next time I will make a new topic for my issues.
Thanks
-
Hi !
I haven't seen if it had benn reported but :
In Attribute reporting Tutorial in the function :def clean_for_xml(value) value = value.to_s value = value.gsub(/\</,'<') value = value.gsub(/\>/,'>') value = value.gsub(/\"/,'"') value = value.gsub(/\'/,''') return value end
The last gsub make that the rest of code is a comment...
-
???
.gsub(/\'/,''')
should be
.gsub(/\'/,"'")
to 'wrap' the lone ' properly...I'm unclear what you put in and what you expect to come out here
The
value = value.gsub(/\</,'<')
could be made as
value.gsub**!**(/\</,'<')
changing 'value' rather than reassigning it to a modified version of itself.
You could also 'string' the gsub changes into one line...
return value.to_s.gsub(/\</,'<').gsub(/\>/,'>').gsub(/\"/,'"').gsub(/\'/,"'")
Although it's easier to read what you are doing your way.
It'd probably be slightly faster - but relatively unnoticeable if only a few values are processed...
Can you clarify? -
I thought this topic was used to identify inconsistencies in the API doc.
I had just noticed that the code of the tutorial was a mistake.
I started in ruby but I think the line "value = value.gsub(/'/,''')" contains an error.
Maybe I'm wrong and that it is normal that the two following functions can be found commented.
So TIG you say it should be .gsub(/'/,"'"). That's what I wanted to know and get noticed.
Sorry for the inconvenience.
Advertisement