How to debug?
-
@liquid98 said:
My question: In what debugging situations is it necessary to restart Sketchup?
In additions to what TIG mentioned in regard to menus, you might want to restart after doing some major refactoring where you might have renamed methods etc. You might still be calling the old method.
And there might be things your plugin has to do at startup, such as some observers. But it belong to the rare cases. -
Thanx guys,
I'm working with dynamic screen notes and dynamic tooltips, and have to restart SU all the time to get them
refreshed.. But that's not common for most plugins I suppose. -
A tooltip for a UI::Command instance object can be changed at ANY time, simply by calling the instance object's tooltip= method, with an argument that is different than what the current tooltip text is.
This means that you must make and keep available, a reference (sloppily called a variable,) to that instance object, so you can later call it's instance methods.
You can also change the status bar text and the validation proc dynamically in the same way.
-
Its enough to make a grown man cry! It only took me 3 hours to find the 2 letter typing error. I hope this is not age related? There was no hint of a problem in the Ruby console, Notepad++ or SciTE. Its enough to make one
if( @stud != "YES" ) #...get the number of joists required for the related @vec/@joc #...@soc = joist on center spacing @num_stud=((@vec/@soc)+1).to_i definitions=model.definitions count=definitions.add entities=count.entities #...draw 1st stud base=entities.add_face(@pt1, @pt3, @pt33, @pt11) base=entities.add_line(@pt1, @pt33) base=entities.add_line(@pt3, @pt11) #...transform stud location t=Geom;;Transformation.translation(Geom;;Vector3d.new(0, 0, 0)) entities=model.active_entities entities.add_instance(count, t) #...copy studs to their new locations i = 1 while i < @num_stud # Transformation i = i + 1 vec = @pt5 - @pt6 # width between which studs are to be drawn vec.length = @soc*(i-1) t=Geom;;Transformation.translation(Geom;;Vector3d.new(0,@soc*(i-1), 0)) t=Geom;;Transformation.translation(vec) entities.add_instance(count, t) end end if # end if @stud
I feel better now!
-
line 7: no argument for the instance method
DefinitionsList.add()
-
@dan rathbun said:
line 7: no argument for the instance method
DefinitionsList.add()
No that's not it ! ..... nice try!..... try again?
-
end if
! -
@tomot said:
@dan rathbun said:
line 7: no argument for the instance method
DefinitionsList.add()
No that's not it ! ..... nice try!..... try again?
Wow... that's strange! An empty argument creates a new definition, whose name is "Component". The API does not mention this!!!
And Jim.. got it correct... although I would think Ruby would issue a
ScriptError
, something like "blah blah blah...`end' expected" -
yup! Jim is right!. So back to the initial subject, is there a debug routine for such errors?
your editor should be causing a high pitch sound for end if or at least a blicking, or bouncing simile. -
I was going to suggest checking the syntax, but you would need to have Ruby version 1.8.6 installed (not a bad idea if you are developing plugins.)
$ ruby -c plugin.rb plugin.rb:32: syntax error, unexpected $end
-
@jim said:
I was going to suggest checking the syntax, but you would need to have Ruby version 1.8.6 installed (not a bad idea if you are developing plugins.)
$ ruby -c plugin.rb plugin.rb:32: syntax error, unexpected $end
Jim: you have helped me with a few rubies I have posted here in the past,
would you please elaborate on I would install Ruby version 1.8.6 within the current Ruby/SU environment.
Currently I simply use NotePad ++ or SciTE to edit and develop my SketchUp Rubies. -
Ruby Binary Installer:
then use...
-
@dan rathbun said:
@tomot said:
@dan rathbun said:
line 7: no argument for the instance method
DefinitionsList.add()
No that's not it ! ..... nice try!..... try again?
Wow... that's strange! An empty argument creates a new definition, whose name is "Component". The API does not mention this!!!
And Jim.. got it correct... although I would think Ruby would issue a
ScriptError
, something like "blah blah blah...`end' expected"Dan, FYI, I have used that particular code several times to space entities between 2 know points, equally. I don't recall who helped me with the original code, many years ago.
-
@jim said:
Ruby Toolbar started - on Windows, it can open/close the Ruby Console, Clear it, and load/reload a file.
Jim: I get the following error when starting SU
-
You need WIn32API.so
-
I have written a debugger for Sketchup plugins with watches and breakpoints. Why isn't such a debugger already available? Would it be a good contribution to the community? The breakpoints based on watched variable changes seem like the best part.
Download the user guide that I attached.
It needs some work yet, as it processes only the Ruby snytax that I have
programmed with myself. It is a VB6 app. It would be free.Quote message
Face2Face plugin - autoextrusion between faces
Sent: Wed Dec 21, 2011 4:58 pm
by brian_concannonTIG,
I posted the plugin as you suggested, in the Resources/Plugins forum. It is being downloaded like crazy!
I hope you make it part of your Edgedraw plugins somehow.
anyway, I have written a debugger for Sketchup plugins with watches and breakpoints. Why isn't such a debugger already available? Would it be a good contribution to the community?
Quote message
Re: Face2Face plugin - autoextrusion between faces
Sent: Wed Dec 21, 2011 5:16 pm
From: TIG
To: brian_concannonIt would probably be a useful adjunct.
Why not post in the Developers' forum with a new thread.
You don't need to post the whole of your code, just some ideas to get a discussion rolling...
Thomthom, Jim and Dan are more in debugging etc than I am. I manually slog through with my own return nils, breaks, testing puts, UI.messageboxe, refreshes etc till I get it to work
-
@brian_concannon said:
I manually slog through with my own return nils, breaks, testing puts, UI.messageboxe, refreshes etc till I get it to work
That's my method of debugging as well. A debugger would be welcome. There is one out there already SuRDebug: http://code.google.com/p/surdebug/wiki/SuRDebug
I never got around to fully make it work...
-
I tried SurDebug early on and could not make it work either. I was told that the author got angry about some criticism, and he stopped working on it. There were no recent posts about it at the site that you show.
Debuggifier's concept is not as nice as the SurDebug concept, as it inserts debug statements after every Ruby statement in all or part of the code. It can be commented / uncommented at will, and totally removed ("undebuggified") when the Plugin development is complete. But I found it necessary to develop for my own programming, because Ruby is so hard to program with. Anyone using a true IDE knows this.
I will clean up Debuggifier a little and then post it. Since it is an EXE and requires VB6 DLL's to be installed with InstallShield etc, can I upload it to this forum? Can I upload a zip file?
-
There's a 4mb limit and it'll will need to be .zip
-
@thomthom said:
And under Windows you have this snippet to output the data to debuggers like DebugView:
http://forums.sketchucation.com/viewtopic.php?f=180&t=31216&p=274668#p274467A friend of mine showed me how to interface Unit Test (http://ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit.html) to the SketchUp API and the Ruby Console. It works really great for certain classes of scripts or methods and it allows you to develop a suite of tests that you can run automatically.
If anyone is interested I can add instructions to this forum.
Advertisement