SketchUcation Premium Membership

 

 

Right click axis show errors in ruby console by plugins

General discussion related to SketchUp. No off topic threads please.

Right click axis show errors in ruby console by plugins

Postby dukejazz » Sat Jun 16, 2012 7:41 pm

Just by right clicking on axis for it's context will show errors in a open ruby console, cause by some ruby loaded plugins.

Is this just my sketchup setup only or do some one else's with alot plugins see this too?

I had a page and haft of error ... I unloaded 6 plugins and still have one left to find.

Error: #<LocalJumpError: unexpected return>
(eval):107:in `load'

Why dose this happen? (must be bad code or conflick)
User avatar
dukejazz
 
Posts: 257
Joined: Thu May 28, 2009 7:13 am
Location: WA
Name: dukejazz
Operating system: Windows
SketchUp version: 7
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Intermediate

Re: Right click axis show errors in ruby console by plugins

Postby dukejazz » Sat Jun 16, 2012 8:23 pm

Example
The loaded plugin zorro2.rb

Error: #<LocalJumpError: unexpected return>
D:\P\Google\Google SketchUp 8m3\Plugins\Zorro2.rb:650
(eval):107:in `call'
(eval):107
User avatar
dukejazz
 
Posts: 257
Joined: Thu May 28, 2009 7:13 am
Location: WA
Name: dukejazz
Operating system: Windows
SketchUp version: 7
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Intermediate

Re: Right click axis show errors in ruby console by plugins

Postby thomthom » Mon Jun 18, 2012 10:15 am

That's usually a result of people using return to exit a block instead of break.
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17673
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

Re: Right click axis show errors in ruby console by plugins

Postby dukejazz » Tue Jun 19, 2012 9:25 am

@650 return method 647-656
Code: Select all
UI.add_context_menu_handler {|menu|
   sel=Sketchup.active_model.selection.first
   menu.add_separator
   return if not sel
   if sel.class==Sketchup::SectionPlane
         menu.add_item("Slice Model at Section") {Zorro2Tool.new.slice_model_at_section(sel)}
         #menu.add_item("Slice Context at Section") {}
   end
   
}

Ruby console pannel show
Error: #<LocalJumpError: unexpected return>
D:/P/Google/Google SketchUp 8m3/Plugins/Zorro2.rb:650
(eval):107:in `call'
(eval):107


@650 break method 647-656
Code: Select all
UI.add_context_menu_handler {|menu|
   sel=Sketchup.active_model.selection.first
   menu.add_separator
   break if not sel
   if sel.class==Sketchup::SectionPlane
         menu.add_item("Slice Model at Section") {Zorro2Tool.new.slice_model_at_section(sel)}
         #menu.add_item("Slice Context at Section") {}
   end
   
}

Ruby console pannel show
Error: #<LocalJumpError: break from proc-closure>
D:/P/Google/Google SketchUp 8m3/Plugins/Zorro2.rb:650:in `call'
(eval):107return


sel = nil
Both block methods fail?
Thomthom you know more than I.
by thomthom on Mon Jun 18, 2012 2:15 am
That's usually a result of people using return to exit a block (true)
so by getting rid of return line (#return if not sel)
and adding to the 651 line if statement (and is sel)
Code: Select all
UI.add_context_menu_handler {|menu|
   sel=Sketchup.active_model.selection.first
   menu.add_separator
   #return if not sel
   if sel.class==Sketchup::SectionPlane and is sel
         menu.add_item("Slice Model at Section") {Zorro2Tool.new.slice_model_at_section(sel)}
         #menu.add_item("Slice Context at Section") {}
   end
   
}

This seem to fix the zorro2.rb code.
Thank you, for your help, Thomthom on Mon Jun 18, 2012 2:15 am -jwc
User avatar
dukejazz
 
Posts: 257
Joined: Thu May 28, 2009 7:13 am
Location: WA
Name: dukejazz
Operating system: Windows
SketchUp version: 7
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Intermediate

Re: Right click axis show errors in ruby console by plugins

Postby thomthom » Tue Jun 19, 2012 10:03 am

Replace this:
return if not sel
if sel.class==Sketchup::SectionPlane


With this:
if sel && sel.class==Sketchup::SectionPlane
Thomas Thomassen — SketchUp Monkey & Coding addict
List of my plugins and link to the CookieWare fund
User avatar
thomthom
Global Moderator
 
Posts: 17673
Joined: Tue Nov 13, 2007 12:47 pm
Location: Trondheim, Norway
Name: thomthom
Operating system: Windows
SketchUp version: 8
License type: Pro
SketchUp use: architecture
Level of SketchUp: Advanced

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Keyframe Animation plugin - animate your SketchUp model by adding movement to any object.

Premium Members get 20% discount!

Ad Machine
Robot
 
Posts: 2012


Return to SketchUp Discussions

Who is online

Users browsing this forum: greenskp and 3 guests