@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):107returnsel = 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