Aerilius / sketchup-console-plus

A better Ruby Console and IDE for integrated development in SketchUp.
MIT License
42 stars 16 forks source link

Intro to Sketchup tutorial fails on first step? #43

Open slashdottir opened 1 year ago

slashdottir commented 1 year ago

Hello, I really like your console

I am trying to use the tutorial 'Introduction: Finding your way through SketchUp, Step 1

It says: "Type Sketchup.active_model' When I do so, it presents an error wrong argument type (expected Sketchup::Model)

If I type Sketchup::Model wrong argument type (Expected Sketchup::Model)

it says the same thing...

I am using Sketchup Make 2017 on Mac OS

If I type either of these into the actual ruby console, I get the expected object reference

thank you for any clues

slashdottir commented 1 year ago

I decided to try to debug this and i see now in the ruby console this stack trace

ruby-console-plus-error-stack-trace

which reads:

Error: #<TypeError: wrong argument type (expected Sketchup::Model)> /users/.../library/application support/sketchup 2017/sketchup/plugins/fredo6_fredoguides/bootstrap_fredoguides.rbe:488 in 'path' /users/.../library/application support/sketchup 2017/sketchup/plugins/fredo6_fredoguides/bootstrap_fredoguides.rbe:488 in 'track_model' /users/.../library/application support/sketchup 2017/sketchup/plugins/fredo6_fredoguides/bootstrapfredoguides.rbe:139 in 'block in startup' /users/.../library/application support/sketchup 2017/sketchup/plugins/fredo6!libfredo6/lib6g6.rbe:38 in 'call' /users/.../library/application support/sketchup 2017/sketchup/plugins/fredo6_!libfredo6/lib6g6.rbe:38 in 'timer_checkedproc' /users/.../library/application support/sketchup 2017/sketchup/plugins/fredo6!libfredo6/lib6g6.rbe:38 in 'block in start_timer'

This stacktrace is produced repeatedly on the console

slashdottir commented 1 year ago

Ok, I disabled the Fredo Guides plugin and tried again, and now I get this stack trace

ruby-console-error-no-fredo

which reads

Error: #<TypeError: wrong argument type (expected Sketchup::Model)> /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/features/feature_wrap_in_undo.rb:36:in 'abort_operation' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/features/feature_wrap_in_undo.rb:36:in 'block in initialize_console' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/observable.rb:47:in 'call' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/observable.rb:47:in 'block in trigger' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/observable.rb:46:in 'each' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/observable.rb:46:in 'trigger' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/console.rb:124:in 'error' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/core.rb:79:in 'error' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/bridge.rb:569:in 'log error' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/bridge.rb:673:in 'rescue in receive' /Users/.../Library/Application Support/Sketchup 2017/Sketchup/Plugins/ae_console/bridge.rb:671:in 'receive' Sketchup:1:in 'call'

slashdottir commented 1 year ago

Ok, I found the problem.

I added a few print statements to feature_wrap_in_undo.rb and it revealed this

Initialize_console: command: Sketchup.active_model metadata {"id"=>0, "line_number"=>1, "type"=>"input"} undo_current_operation: true model:

undo-counter: 1 operation_name: Ruby Console operation 1 console.on: result

metadata {:result_string=>"#<Sketchup::Model:0x007f95d018b038\n @tt_bezier_surface_editor=\n #>", :language=>:ruby, :id=>"31", :source=>0, :time=>1691686922.0487208} console.on: if @undo_current_operation: @model.commit_operation console.on: exception wrong argument type (expected Sketchup::Model) metadata {:message=>"TypeError: wrong argument type (expected Sketchup::Model)", :language=>:ruby, :id=>"43", :source=>0, :time=>1691686922.0569391, :backtrace=>[], :backtrace_short=>[]} console.on: exception wrong argument type (expected Sketchup::Model)

I guess the ThomThom Bezier Surface tool is somehow interfering with this. Maybe a namespace conflict of some kind?

Disabling the Bezier Surface tool seems to clear it up

thomthom commented 1 year ago

Bezier Surface adds an instance attribute to the model in order to track the editor instance associated with it. (There was some issue with using model as a key in a hash if I recall correctly. So I ended up with that kludge.)

But I don't see how that should cause a TypeError in this extension.

The debug output in that last comment is hard to decipher, not sure what I'm looking at there.

But did you find where the TypeError is thrown?

slashdottir commented 1 year ago

Well, here is a video that will show how the error happens

https://drive.google.com/file/d/1lY1q0WirPnZg5TAgWzEYvkBXVY-hMBja/view?usp=drive_link

Basically, go to tutorials, choose Introduction: Finding your way through sketchup, step 1, start

Then it asks you to type in Sketchup.active_model

and when you do, it gives the error about how how the argument didn't match the expected input because it has that decoration #<Sketchup::Model:0x007f95d018b038\n @tt_bezier_surface_editor=\n #TT::Plugins::BezierSurfaceTools::BezierSurfaceEditor:0x7f95d7c33d08

I added some debugging strings and here are the backtraces I could access. Unfortunately, I could not add more prints or puts debugging deeper into the logic as that seems to trigger a recursive stack overflow that prevents Sketchup from launching.

FeatureWrapInUndo:initialize_console:console.on: command: Sketchup.active_model 
metadata: {"id"=>1, "line_number"=>2, "type"=>"input"}

Console. rescue in do_eval: exception.backtrace: 
["/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/features/feature_wrap_in_undo.rb:27:in `start_operation'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/features/feature_wrap_in_undo.rb:27:in `block in initialize_console'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:50:in `call'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:50:in `block in trigger'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:49:in `each'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:49:in `trigger'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:203:in `do_eval'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:174:in `block (2 levels) in initialize_ui'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/object_replacer.rb:33:in `call'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/object_replacer.rb:33:in `swap'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:173:in `block in initialize_ui'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:643:in `call'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:643:in `handle_request'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:671:in `receive'", "SketchUp:1:in `call'"]
FeatureWrapInUndo:initialize_console:console.on: exception: 
wrong argument type (expected Sketchup::Model) , metadata: {:message=>"TypeError: wrong argument type (expected Sketchup::Model)", :language=>:ruby, :id=>"125", :source=>1, :backtrace=>[], :backtrace_short=>[], :time=>1693073161.243111}

exception.backtrace:
FeatureWrapInUndo:initialize_console:console.on: exception: 
wrong argument type (expected Sketchup::Model) , metadata: 
{:message=>"TypeError: wrong argument type (expected Sketchup::Model)", :backtrace=>["/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/features/feature_wrap_in_undo.rb:42:in `abort_operation'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/features/feature_wrap_in_undo.rb:42:in `block in initialize_console'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:50:in `call'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:50:in `block in trigger'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:49:in `each'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:49:in `trigger'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:221:in `rescue in do_eval'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:196:in `do_eval'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:174:in `block (2 levels) in initialize_ui'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/object_replacer.rb:33:in `call'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/object_replacer.rb:33:in `swap'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:173:in `block in initialize_ui'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:643:in `call'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:643:in `handle_request'", 
"/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:671:in `receive'", "SketchUp:1:in `call'"], :backtrace_short=>[
"…/ae_console/features/feature_wrap_in_undo.rb:42:in `abort_operation'", 
"…/ae_console/features/feature_wrap_in_undo.rb:42:in `block in initialize_console'", 
"…/ae_console/observable.rb:50:in `call'", 
"…/ae_console/observable.rb:50:in `block in trigger'", 
"…/ae_console/observable.rb:49:in `each'", 
"…/ae_console/observable.rb:49:in `trigger'", 
"…/ae_console/console.rb:221:in `rescue in do_eval'", 
"…/ae_console/console.rb:196:in `do_eval'", 
"…/ae_console/console.rb:174:in `block (2 levels) in initialize_ui'", 
"…/ae_console/object_replacer.rb:33:in `call'", 
"…/ae_console/object_replacer.rb:33:in `swap'", 
"…/ae_console/console.rb:173:in `block in initialize_ui'", 
"…/ae_console/bridge.rb:643:in `call'", 
"…/ae_console/bridge.rb:643:in `handle_request'", 
"…/ae_console/bridge.rb:671:in `receive'", "SketchUp:1:in `call'"], :language=>:ruby, :time=>1693073161.245879, :id=>"136"}
exception.backtrace:
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/features/feature_wrap_in_undo.rb:42:in `abort_operation'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/features/feature_wrap_in_undo.rb:42:in `block in initialize_console'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:50:in `call'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:50:in `block in trigger'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:49:in `each'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/observable.rb:49:in `trigger'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:221:in `rescue in do_eval'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:196:in `do_eval'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:174:in `block (2 levels) in initialize_ui'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/object_replacer.rb:33:in `call'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/object_replacer.rb:33:in `swap'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/console.rb:173:in `block in initialize_ui'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:643:in `call'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:643:in `handle_request'
/Users/foo/Library/Application Support/SketchUp 2017/SketchUp/Plugins/ae_console/bridge.rb:671:in `receive'
SketchUp:1:in `call'
wrong argument type (expected Sketchup::Model)