UI exit ruby?
-
hi,
is there a function in the UI, where i couldstop the ruby at this point and exit,
to check the actual state of elements in sketchup directly?
thanx
stan -
I use a manual combo...
E.G.
puts 999
or
p 999
at a given point in the code will tell me it has got to that point successfully.A
UI.messagebox('!')pauses the script while it's open - I'd use that to check if a temporary file was made etc... Used after aSketchup.active_model.active_view.refreshcall it will let me see what geometry has been made thus far...If I am in a 'loop' [
foror{}block] I can include anextto skip the current item being processed and then do the next one, orbreakto exit the loop altogether. I might use an extendedUI.messageboxwithOK|Canceland usenext|breakon a 'Cancel' ?If I want just to exit a method's execution I include a
returnin the loop-test, OR simply at some point in the main code, so that everything after it remains unprocessed... -
Yes you can - at least with SU2014 and above (M1 for OSX). You grab your favorite Ruby IDE and start SketchUp in debug mode. You can then set breakpoint in the IDE which will halt SketchUp and you can inspect the Ruby variables in the call stack. It does away with "puts-debugging" so you don't have to modify your source code and restart SketchUp any more to inspect the data.
GitHub - SketchUp/sketchup-ruby-debugger: Ruby API debugger for SketchUp 2014 and later.
Ruby API debugger for SketchUp 2014 and later. Contribute to SketchUp/sketchup-ruby-debugger development by creating an account on GitHub.
GitHub (github.com)
You cannot however halt execution and then interact with the viewport - if that was what you wanted.
-
hi and thanx to both,
@ tig: yes, i also use puts-tags to follow the code in the console , whit line-number-output to see, in which code -line the puts is.
i will try out all the break, next etc. functions. thanx for this?and @tt_su
yes, interaction with the viewport was exactly, what i hoped for, so i could inspect the geometry at any stage ot the running code. (break - inspect geometry - go on....). the rest is still tooooo 'high' for me, although i already 'speak' a bit ruby...-:)
stan
Advertisement