sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    HTMLDialog vs WebDialog?

    Scheduled Pinned Locked Moved Developers' Forum
    23 Posts 5 Posters 4.5k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G Offline
      Garry K
      last edited by

      Thanks guys - I haven't had time to look into this yet. But what I see looks encouraging.

      1 Reply Last reply Reply Quote 0
      • D Offline
        driven
        last edited by

        gotcha, you mean bug SU-35701.

        john

        learn from the mistakes of others, you may not live long enough to make them all yourself...

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          Let us know if any of the suggestions work.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • medeekM Offline
            medeek
            last edited by

            I have some issues with Mac users and my webdialogs. Unfortunately, I don't have a Mac computer at my disposal so I can't directly test and debug the issues but it appears to be some behavior with the blocking not working correctly in MacOS.

            Does anyone have any suggestions on a work around for this problem.

            I've been tempted to switch to HTMLDialog from WebDialog but I have too many people using the plugins who have older versions of SU.

            I also don't see any distinct advantage to switching unless it will fix my MacOS problem.

            Nathaniel P. Wilkerson PE
            Medeek Engineering Inc
            design.medeek.com

            1 Reply Last reply Reply Quote 0
            • medeekM Offline
              medeek
              last edited by

              Here is my code for my webdialog for the timber truss feature that I recently added. I think the issues with Mac users may have to do with the dialog not being "modal" even though I am using the show_modal method:

              # Create the WebDialog instance
              if @Licensemode == "trial"
                dlg1 = UI;;WebDialog.new("Timber Truss Geometry - Medeek Truss Plugin - (trial version)", true, "SelectionInfoPrefKey", 1210, 860, 500, 250, true)
              else
                dlg1 = UI;;WebDialog.new("Timber Truss Geometry - Medeek Truss Plugin", true, "SelectionInfoPrefKey", 1210, 860, 500, 250, true)
              end
              
              dlg1.add_action_callback("PUSHTOHTML_SETTINGS") {|dialog, params|
                 		
                js_command = 'pushdata( "' + @Trusstype.to_s + '|' ....  .... '|' + @Panel.to_s + '" );'
                # puts js_command
                dialog.execute_script(js_command)	
              }
              
              dlg1.add_action_callback("GET_SETTINGS") {|dialog, params|
                 		
                params = params.to_s
                # puts params
                paramlist = []
                paramlist = params.split("|")
              
                @Trusstype = paramlist[0]
              
                @Span = paramlist[1]
                if @Span == ""
                  @Span = @TrussSpan_ft
                else
                  @Span = @Span.to_f
                end
              
              ....				
              
                @Panel = paramlist[20]
                if @Panel == ""
                  @Panel = @Span * 12.0 * 0.25
                else
                  @Panel = @Panel.to_f
                end
              }
              
              dlg1.add_action_callback("CLOSE_DIALOG") {|dialog, params|
                dialog.close
              }
              
              # Find and show our html file
              	
              dlg1.set_file File.dirname(__FILE__) + "/html/web_dialog_timber_truss.html"
              dlg1.show_modal()
              

              Nathaniel P. Wilkerson PE
              Medeek Engineering Inc
              design.medeek.com

              1 Reply Last reply Reply Quote 0
              • D Offline
                driven
                last edited by

                can you add a link to the version showing issues...

                without the html and params it's impossible to guess the issue...

                I doubt it has anything to do with modality of the window...

                john

                learn from the mistakes of others, you may not live long enough to make them all yourself...

                1 Reply Last reply Reply Quote 0
                • medeekM Offline
                  medeek
                  last edited by

                  The html code is rather large due to the insane amount of javascript that is used to generate the SVG preview so rather than post it on the board it can be viewed here:

                  favicon

                  (design.medeek.com)

                  Just take a look at the source code of this page.

                  The version of the plugin having the issues is 1.9.8, download here:

                  http://design.medeek.com/calculator/sketchup/medeek_truss_ext.rbz

                  Nathaniel P. Wilkerson PE
                  Medeek Engineering Inc
                  design.medeek.com

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    driven
                    last edited by

                    are they seeing errors like this?

                    the `onLButtonDown' doesn't finalise before the dialog shows, and then creates and new dialog when you click again...

                    /users/johns_imac/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;801;in `get_truss_geometry_timber'
                    /users/johns_imac/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;1103;in `main_menu'
                    /users/johns_imac/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5705;in `calculate_obj'
                    /users/johns_imac/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5718;in `update_state'
                    /users/johns_imac/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5726;in `onLButtonDown'
                    

                    john

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

                    1 Reply Last reply Reply Quote 0
                    • medeekM Offline
                      medeek
                      last edited by

                      I will check with the user who reported the error and see what I come back with. Thank-you for helping me look into this.

                      Nathaniel P. Wilkerson PE
                      Medeek Engineering Inc
                      design.medeek.com

                      1 Reply Last reply Reply Quote 0
                      • medeekM Offline
                        medeek
                        last edited by

                        Error; #<NoMethodError; undefined method `*' for nil;NilClass>
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;1064;in `create_timber_geometry'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;801;in `get_truss_geometry_timber'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;1103;in `main_menu'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5705;in `calculate_obj'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5718;in `update_state'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5726;in `onLButtonDown'
                        Error; #<TypeError; String can't be coerced into Float>
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;1355;in `+'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;1355;in `create_timber_geometry'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;801;in `get_truss_geometry_timber'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;1103;in `main_menu'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5705;in `calculate_obj'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5718;in `update_state'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5726;in `onLButtonDown'
                        Error; #<TypeError; String can't be coerced into Float>
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;1355;in `+'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;1355;in `create_timber_geometry'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_timber_roof_truss.rbs;801;in `get_truss_geometry_timber'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;1103;in `main_menu'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5705;in `calculate_obj'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5718;in `update_state'
                        /users/momdad/library/application support/sketchup 2017/sketchup/plugins/medeek_truss_ext/medeek_roof_truss.rbs;5726;in `onLButtonDown'
                        

                        Nathaniel P. Wilkerson PE
                        Medeek Engineering Inc
                        design.medeek.com

                        1 Reply Last reply Reply Quote 0
                        • medeekM Offline
                          medeek
                          last edited by

                          The error codes posted above.

                          Nathaniel P. Wilkerson PE
                          Medeek Engineering Inc
                          design.medeek.com

                          1 Reply Last reply Reply Quote 0
                          • Dan RathbunD Offline
                            Dan Rathbun
                            last edited by

                            @medeek said:

                            The error codes posted above.

                            ... are occurring (according to your error messages,) in " medeek_roof_truss.rbs", line 5726, in callback method onLButtonDown.

                            In the first you are calling a *() method upon an object that is referencing the global singleton nil object. Since the NilClass does not have an "asterisk" method, a NoMethodError is raised.

                            The second method is caused by your code expecting a Float object, but getting a String object instead.

                            The answer is simple. Whenever an object reference could reference disparate types (classes) of obejcts, use a combination of type validation and Ruby rescue clauses with the onLButtonDown callback method.

                            I'm not here much anymore.

                            1 Reply Last reply Reply Quote 0
                            • medeekM Offline
                              medeek
                              last edited by

                              Okay 95% of that just went over my head, but I'll try and decipher into terms I can understand.

                              But why would this error only be raised for SketchUp running on MacOS and not Windows?

                              Nathaniel P. Wilkerson PE
                              Medeek Engineering Inc
                              design.medeek.com

                              1 Reply Last reply Reply Quote 0
                              • Dan RathbunD Offline
                                Dan Rathbun
                                last edited by

                                Basically I'm trying to prompt you to learn how to read Ruby error and backtrace messages.
                                “filename:lineNo: inmethod”‘ or “filename:lineNo.”`

                                http://ruby-doc.org/core-2.2.4/doc/syntax/exceptions_rdoc.html
                                http://ruby-doc.org/core-2.2.4/Exception.html

                                @medeek said:

                                Okay 95% of that just went over my head, but I'll try and decipher into terms I can understand.

                                Link Preview Image
                                Data validation - Wikipedia

                                favicon

                                (en.wikipedia.org)

                                An example in Ruby of testing if an object reference is pointing at an object of a certain class:
                                if obj.is_a?(NilClass)
                                ... or ...
                                if obj.is_a?(Float)

                                An example in Ruby of validating that an object reference call responds to a certain method call:
                                if obj.respond_to?(:methname)
                                ... and testing for the "asterisk" method specifically:
                                if obj.respond_to?(:*)

                                @medeek said:

                                But why would this error only be raised for SketchUp running on MacOS and not Windows?

                                I don't know (offhand) as I avoid Macs myself. (But OSX and MS Windows use different sets of keycodes.)

                                Actually, looking at the backtraces (in your original error listing) the errors are kicked off by a LButtonDown keypress, but are occurring in the `` create_timber_geometry()`' method, lines 1064 and 1355.

                                I'm not here much anymore.

                                1 Reply Last reply Reply Quote 0
                                • 1
                                • 2
                                • 1 / 2
                                • First post
                                  Last post
                                Buy SketchPlus
                                Buy SUbD
                                Buy WrapR
                                Buy eBook
                                Buy Modelur
                                Buy Vertex Tools
                                Buy SketchCuisine
                                Buy FormFonts

                                Advertisement