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

    Send_action workarounds?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 3 Posters 676 Views 3 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.
    • K Offline
      kaas
      last edited by

      To enhance my workflow & minimize my pen/mouse movements in Sketchup, I'm working on a on-screen-menu tool (just like I used to have in my 3dsMax days 10+ years ago).

      To launch plugins I use: active_model.select_tool ...
      To launch Sketchup commands I use: send_action ...

      Several native commands are missing from the API-docs http://www.sketchup.com/intl/en/developer/docs/ourdoc/sketchup#send_action. Commands like boolean-union, subtract etc are missing. Is there a way to still invoke those methods?


      sending actions.jpg

      1 Reply Last reply Reply Quote 0
      • tt_suT Offline
        tt_su
        last edited by

        Boolean operation methods are part of the API under Group/ComponentInstance classes.

        The send_action method has always been a hacky way to invoke things. If you can do thing without it that is the recommended way to do so.

        1 Reply Last reply Reply Quote 0
        • K Offline
          kaas
          last edited by

          @tt_su said:

          Boolean operation methods are part of the API under Group/ComponentInstance classes.

          These methods need 2 solid objects. For union I could start a script from the onscreenmenu that starts the union-method after selecting 2 solid objects. But for subtract, how can one control which object will be the subtracting object with a pre-selection of two objects?

          There's no way to simulate a normal mouse-press on the toolbar's union-button / subtract-button?

          @tt_su said:

          The send_action method has always been a hacky way to invoke things. If you can do thing without it that is the recommended way to do so.

          Just to be absolutely sure: there's no way to start native commands with active_model.select_tool ?

          1 Reply Last reply Reply Quote 0
          • tt_suT Offline
            tt_su
            last edited by

            @kaas said:

            But for subtract, how can one control which object will be the subtracting object with a pre-selection of two objects?

            http://www.sketchup.com/intl/en/developer/docs/ourdoc/group#subtract
            The object that subtract is the object in the argument. You invoke the method on the object you want to keep.

            @kaas said:

            Just to be absolutely sure: there's no way to start native commands with active_model.select_tool ?

            Not sure what you mean by native commands. For native tools you do need to use send_action. I's one of them things where we should be introducing proper API methods to do so.
            But for doing boolean operation you have full control with the API methods.

            1 Reply Last reply Reply Quote 0
            • K Offline
              kaas
              last edited by

              TT, thanks for your reply. I ended up assigning some un-used keyboard shortcuts to boolean-union and some other methods. Now I can start these methods from my on-screen-menu by using WIN32OLE.new("WScript.Shell").SendKeys("+u") for instance. Maybe not the most pretty solution but as long as I don't buy a Mac it seems to works without any problem.

              1 Reply Last reply Reply Quote 0
              • tt_suT Offline
                tt_su
                last edited by

                I'm still confused to why you don't want to use the API methods? Simulating key strokes or mouse clicks seems convoluted. Does the API not produce the same result as the UI operation?

                1 Reply Last reply Reply Quote 0
                • K Offline
                  kaas
                  last edited by

                  @tt_su said:

                  I'm still confused to why you don't want to use the API methods? Simulating key strokes or mouse clicks seems convoluted. Does the API not produce the same result as the UI operation?

                  It's not that I don't want to use the native API methods, it's just that I think it's more simple and easy to do it this way, just for an all-purpose on-screen-menu.

                  I will try to explain:

                  • The on-screen-menu(OSM) works just the same as clicking on any icon in one of the toolbars but in the OSM the 'icons' are centered at my mouse point at the moment I press the OSM keyboard shortcut. So with one keyboard shortcut, I can start several of my most used methods within a small mouse-movement-area.

                  I was thinking the most easy way to do this is creating 2 arrays: one for the all the 'names' in the OSM, and one array with the 'launch code' for starting the corresponding methods. Because there's no Sketchup.send_action option for boolean-union (and more), I needed another simple way to just start the method and let me pick some solids.

                  I hope this makes more sense...


                  osm_sml.gif

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

                    On the PC, send_action can process native tool command integer IDs.

                    I pub'd some IDs here (but do not use that file as is. It mods the API.) Just use it for tool ID reference. Somewhere here Thomas also posted a tool ID hash.

                    Ex: Sketchup::send_action( 24201 ) # Union Tool

                    I'm not here much anymore.

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

                    Advertisement