Where to start?
-
@thomthom said:
Not only is it in global namespace - it uses
typename
to identity the type of entity (which many plugin does because the API docs sets a very poor example.).typename
is very very slow - avoid at all cost!Exactly. I am reading it just in the first link (http://forums.sketchucation.com/viewtopic.php?f=180&t=10142) in the first response in this thread.
-
Use
puts
statements in the code, to output to the Ruby Console. -
@rumcajs said:
I would like to see what contains
@iptemp
.It is an Sketchup::InputPoint instance object. See the API dictionary.
-
What debug tools and methods can I use to debug method?
Example, utilitiestool.rb
class TrackMouseTool
method onMouseMove@iptemp.pick view, x, y
I would like to see what contains @iptemp.
Is it possible to show dialog box or pause code?
-
If I change code of the plugin, will it be refreshed automatically or must I reload the plugin and how?
-
@rumcajs said:
If I change code of the plugin, will it be refreshed automatically or must I reload the plugin and how?
Reload it manually.
load 'myfile.rb'
Though I think Jim created a utility to autoreload after changes where detected. Never used it though as I prefer the manual control.
-
OK. Works. So I tried:
@iptemp.pick view, x, y puts @iptemp
#Sketchup::InputPoint:0xd0fe6fc
So the input point is in hexadecimal format? If I would want to read it, I would need to add method to convert to decimal, right? I tried:
puts @iptemp.hex
returns error -
No - the hex number you see there is the hexadecimal version of the object id. Ruby convention.
Refer to the API manual and you find
InputPoint.position
https://developers.google.com/sketchup/docs/ourdoc/inputpoint#position -
Ah, now it works.
puts @iptemp.position
Something I miss in the reference manual. From different languages I am used to see above every method a list of similar or related methods/links.... Is here some similar page which gives such kind of information / organized in different way? Or is this the only source?
-
What does mean $ is it global variable? I thought it is array, but now I see they use it in different way.
This:
results = inputbox prompts, values, $exStrings.GetString("Cost Estimate")
What is inputbox, does not look like method of global scope
-
@rumcajs said:
Is here some similar page which gives such kind of information / organized in different way? Or is this the only source?
Each class list all its methods.
List of classes:
https://developers.google.com/sketchup/docs/classesList of methods:
https://developers.google.com/sketchup/docs/methodsObject Diagram:
https://developers.google.com/sketchup/docs/diagram -
@rumcajs said:
What does mean $ is it global variable? I thought it is array, but now I see they use it in different way.
This:
results = inputbox prompts, values, $exStrings.GetString("Cost Estimate")
What is inputbox, does not look like method of global scope
$
is global variables, yes. Avoid them.inputbox
is an alias forUI.inputbox
defined insketchup.rb
which comes with SketchUp. (I useUI.inputbox
simply because of potential problems of relying on the methods in the global namespace.) -
Hm. I see. Sketchup.rb is short, so it will not be problem to remember it. And where is definited UI?
-
@rumcajs said:
And where is definited UI?
That's from the API - defined in C++.
Look to the documentation: https://developers.google.com/sketchup/docs/ourdoc/ui
Advertisement