sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    [Code] Sketchup.send_action() : Arguments to

    Scheduled Pinned Locked Moved Developers' Forum
    22 Posts 8 Posters 7.3k Views
    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.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by


      Sketchup.send_action() : Arguments to


      This topic is for posting both string and (PC ONLY) numeric arguments to the Sketchup.send_action() method.


      Other known threads on this topic:

      • Sketchup.send_action arguments: Mac vs PC

      Search the Developers Forum
      ( for other posts on send action )

      • Search for "send_action":* Search for "+send +action":

      I'm not here much anymore.

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


        integer arguments are PC ONLY:


        @unknownuser said:

        (http://forums.sketchucation.com/memberlist.php?mode) in Google toolbar: get position":2lfu275a]Hi all, do you know how can I call the get position (the 1st command in Google Toolbar) via API?
        I looked around and found that SU5 had some script for manage the Google Earth input/ouput.


        use: Sketchup.send_action( *numarg* )

        Sketchup ver 7.x, where *numarg* is:

        <span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> numarg </span><span class="syntaxkeyword">)<br /></span><span class="syntaxcomment"># Sketchup ver 7.x<br /># PC ONLY ; numargs for the Google Toolbar;<br /></span><span class="syntaxdefault">  139  </span><span class="syntaxstring">"Get Current View"<br /></span><span class="syntaxdefault">  140  </span><span class="syntaxstring">"Toggle Terrain"<br /></span><span class="syntaxdefault">  145  </span><span class="syntaxstring">"Place Model"<br /></span><span class="syntaxdefault">21988  </span><span class="syntaxstring">"Get Models"<br /></span><span class="syntaxdefault">21989  </span><span class="syntaxstring">"Share Model"<br /></span><span class="syntaxdefault">24188  </span><span class="syntaxstring">"Upload Component"<br /></span><span class="syntaxdefault">  </span>
        

        Sketchup ver 8.x, where *numarg* is:

        <span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> numarg </span><span class="syntaxkeyword">)<br /></span><span class="syntaxcomment"># Sketchup ver 8.x<br /># PC ONLY ; numargs for the Google Toolbar;<br /></span><span class="syntaxdefault">  139  </span><span class="syntaxstring">"Add Location..."<br /></span><span class="syntaxdefault">  140  </span><span class="syntaxstring">"Toggle Terrain"<br /></span><span class="syntaxdefault">24209  </span><span class="syntaxstring">"Add New Building..."<br /></span><span class="syntaxdefault">24210  </span><span class="syntaxstring">"Photo Textures"<br /></span><span class="syntaxdefault">  145  </span><span class="syntaxstring">"Preview Model in Google Earth"<br /></span><span class="syntaxdefault">21988  </span><span class="syntaxstring">"Get Models..."<br /></span><span class="syntaxdefault">21989  </span><span class="syntaxstring">"Share Model..."<br /></span><span class="syntaxdefault">24188  </span><span class="syntaxstring">"Share Component..."<br /><br /></span><span class="syntaxcomment"># Cross-Platform String arguments;<br /></span><span class="syntaxstring">'addBuilding;'</span><span class="syntaxdefault">     </span><span class="syntaxstring">"Add New Building..."<br />'getPhotoTexture;'</span><span class="syntaxdefault"> </span><span class="syntaxstring">"Photo Textures"<br />'getModels;'</span><span class="syntaxdefault">       </span><span class="syntaxstring">"Get Models..."<br />'shareModel;'</span><span class="syntaxdefault">      </span><span class="syntaxstring">"Share Model..."</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">**<br /></span><span class="syntaxstring">'uploadComponent;'</span><span class="syntaxdefault"> </span><span class="syntaxstring">"Share Component..."</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">**<br />**(</span><span class="syntaxdefault">brings up login dialog if not logged in</span><span class="syntaxkeyword">.)<br /></span><span class="syntaxdefault">   </span>
        

        Updated 2011-09-05 : show the cross-platform strings for ver 8+.

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • S Offline
          Shoff
          last edited by

          @unknownuser said:

          # Cross-Platform String arguments;
          > 'addBuilding;'     "Add New Building..."
          > 'getPhotoTexture;' "Photo Textures"
          > 'getModels;'       "Get Models..."
          > 'shareModel;'      "Share Model..." **
          > 'uploadComponent;' "Share Component..." **
          > **(brings up login dialog if not logged in.)
          

          The Cross-Platform String arguments don't work for me on a Mac with SketchUp 8.

          1 Reply Last reply Reply Quote 0
          • S Offline
            Shoff
            last edited by

            Realized I need to clarify. Those arguments return true, but nothing happens. Dialogs don't show up, etc. Do they work on a PC?

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

              @shoff said:

              Realized I need to clarify. Those arguments return true, but nothing happens. Dialogs don't show up, etc. Do they work on a PC?

              Yes they work on PC.. same as if you clicked the corresponding button on the Google Toolbar.

              I'm not here much anymore.

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


                Bug Report filed for Sketchup Ruby on Apple OSX (this topic referenced.)


                I'm not here much anymore.

                1 Reply Last reply Reply Quote 0
                • J Offline
                  Jim
                  last edited by

                  Here's an updated list of send_action() arguments for SketchUp 8 M2.

                  • Undocumented
                    ! Broken on Mac
                  
                  addBuilding; !
                  copy; *
                  cut; *
                  editDelete; *
                  editHide;
                  editRedo;
                  editUndo;
                  editUnhide;
                  fixNonPlanarFaces;
                  getCurrentView; *
                  getModels; *!
                  getPhotoTexture; !
                  newDocument; *
                  openDocument; *
                  pageAdd;
                  pageDelete;
                  pageNext;
                  pagePrevious;
                  pageUpdate;
                  paste; *
                  placeModel; *
                  printDocument; *
                  renderHiddenLine;
                  renderMonochrome&#058;
                  renderShaded;
                  renderTextures;
                  renderWireframe;
                  saveDocument; *
                  select3dTextTool; *
                  selectArcTool;
                  selectAxisTool;
                  selectCircleTool;
                  selectDimensionTool;
                  selectDollyTool;
                  selectEraseTool;
                  selectExtrudeTool;
                  selectFieldOfViewTool;
                  selectFreehandTool;
                  selectImageIglooTool;
                  selectLineTool;
                  selectMeasureTool;
                  selectMoveTool;
                  selectNorthTool;
                  selectOffsetTool;
                  selectOrbitTool;
                  selectPaintTool;
                  selectPolygonTool;
                  selectPositionCameraTool;
                  selectProtractorTool;
                  selectPushPullTool;
                  selectRectangleTool;
                  selectRotateTool;
                  selectScaleTool;
                  selectSectionPlaneTool;
                  selectSelectionTool;
                  selectTextTool;
                  selectTurnTool;
                  selectWalkTool;
                  selectZoomTool;
                  selectZoomWindowTool;
                  selectionZoomExt; *
                  shareModel; *!
                  showRubyPanel;
                  uploadComponent; *!
                  viewBack;
                  viewBottom;
                  viewFront;
                  viewIso;
                  viewLeft;
                  viewPerspective;
                  viewRight;
                  viewShowAxes;
                  viewShowGuides; *
                  viewShowHidden;
                  viewTop;
                  viewUndo;
                  viewZoomExtents;
                  viewZoomToSelection;
                  

                  SketchUp 15

                  • = removed
                  • = added
                  
                  -addBuilding;
                  +selectArc3PointFitTool;
                  +selectArc3PointPieTool;
                  +selectArc3PointTool;
                  +selectClassifierTool;
                  +selectionZoomExt;
                  +selectRectangle3PointTool;
                  -selectionZoomExt;
                  +showExtensionStore;
                  
                  

                  Hi

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

                    is this an exception? [as in a mac thing...]

                    > Sketchup.send_action('viewPerspective;')
                    true
                    > !Sketchup.send_action('viewPerspective;')
                    false
                    

                    john

                    Edit:
                    I've been looking for a replacement for Sketchup.send_action('viewParallelProjection:') which returns True, but doesn't 'switch views' on mac.
                    **!**Sketchup.send_action('viewPerspective:') does, I'm wondering if it also 'switches views' on PC or would I need to have both in a cross platform script.

                    EDIT Edit: Sketchup.send_action('viewParallelProjection:') is working now?
                    it not on the list, but I had tried it... maybe I had a typo...

                    So does Sketchup.send_action('viewParallelProjection:') work on PC's... 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
                    • K Offline
                      ktkoh
                      last edited by

                      Sketchup.send_action('viewParallelProjection:') does not work on the PC. It returns true or false but does not change the view.

                      Sketchup.active_model.active_view.camera.perspective = false This command will change based on the true or false value

                      Keith

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        No action for the Follow Me tool? (That works on both platforms.)

                        Thomas Thomassen — SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

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

                          @thomthom said:

                          No action for the Follow Me tool? (That works on both platforms.)

                          don't know what works on a PC, but since your probably missing the mac one...

                          Sketchup.send_action('selectExtrudeTool;')
                          

                          I'll add this to my list...
                          I've got a osascript test runner, for running the lot if you want it...
                          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
                          • thomthomT Offline
                            thomthom
                            last edited by

                            Excellent! I didn't realise that was it's internal name. Doh!

                            Yea, run the lot and see what you get.

                            Thomas Thomassen — SketchUp Monkey & Coding addict
                            List of my plugins and link to the CookieWare fund

                            1 Reply Last reply Reply Quote 0
                            • TIGT Offline
                              TIG Moderator
                              last edited by

                              I think early versions of SketchUp called it the 'Extrude Tool', later it was renamed 'FollowMe' but the original 'coded' name remains - which is like 'Scenes' are really 'Pages', 'Guides' are really 'Clines' etc, and other foibles that you can probably list too !

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                Yea - there's lots of legacy strangeness to discover when traversing the API.

                                Thomas Thomassen — SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

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

                                  possibly new for v2013 on mac at least

                                  Sketchup.send_action('closeDocument;')
                                  
                                  Sketchup.send_action('newDocument;')
                                  
                                  Sketchup.send_action('saveDocument;')
                                  
                                  Sketchup.send_action('openDocument;')
                                  
                                  Sketchup.send_action('printDocument;')
                                  
                                  

                                  @Dan, thanks for the trigger to test them...

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

                                  1 Reply Last reply Reply Quote 0
                                  • TIGT Offline
                                    TIG Moderator
                                    last edited by

                                    @driven said:

                                    possibly new for v2013 on mac at least

                                    Sketchup.send_action('closeDocument;')
                                    > 
                                    > Sketchup.send_action('newDocument;')
                                    > 
                                    > Sketchup.send_action('saveDocument;')
                                    > 
                                    > Sketchup.send_action('openDocument;')
                                    > 
                                    > Sketchup.send_action('printDocument;')
                                    > 
                                    

                                    @Dan, thanks for the trigger to test them...
                                    Some of those have been around BUT 'undocumented' for some time [v8M2].
                                    The 'saveDocument:' is particularly useful because calling model.save(model.path) does NOT save the model BUT returns 'true'.
                                    So if you want to ensure the model is saved before saving it as another name, that send_action is needed...
                                    Here's a list that I have for those v8M2 changes - some were documented but * == undocumented & ! == broken on MAC:
                                    addBuilding: !
                                    copy: *
                                    cut: *
                                    editDelete: *
                                    getCurrentView: *
                                    getModels: *!
                                    getPhotoTexture: !
                                    newDocument: *
                                    openDocument: *
                                    paste: *
                                    placeModel: *
                                    printDocument: *
                                    saveDocument: *
                                    select3dTextTool: *
                                    selectionZoomExt: *
                                    shareModel: *!
                                    showRubyPanel:
                                    uploadComponent: *!
                                    viewShowGuides: *

                                    TIG

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

                                      This is my latest list, some may be mac only, some new, some missing

                                      
                                      Sketchup.send_action('addBuilding;') #!   dosn't work on mac
                                      Sketchup.send_action('getPhotoTexture;') #!   dosn't work on mac
                                      
                                      
                                      #/
                                      Sketchup.send_action('closeDocument;')
                                      Sketchup.send_action('newDocument;')
                                      Sketchup.send_action('openDocument;') # dialog drop-down sheet
                                      Sketchup.send_action('printDocument;') # direct print of current view  @current settings
                                      Sketchup.send_action('saveDocument;') # dialog drop-down sheet
                                      
                                      
                                      #/
                                      Sketchup.send_action('editHide;')
                                      Sketchup.send_action('editRedo;')
                                      Sketchup.send_action('editUndo;')
                                      Sketchup.send_action('editUnhide;') #!   dosn't work on mac
                                      Sketchup.send_action('editUnhideAll;') #*  does work on mac
                                      Sketchup.send_action('editUnhideLast;') #*  does work on mac
                                      
                                      
                                      #/
                                      Sketchup.send_action('fixNonPlanarFaces;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('pageAdd;')
                                      Sketchup.send_action('pageDelete;')
                                      Sketchup.send_action('pageNext;')
                                      Sketchup.send_action('pagePrevious;')
                                      Sketchup.send_action('pageUpdate;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('renderHiddenLine;')
                                      Sketchup.send_action('renderMonochrome&#058;')
                                      Sketchup.send_action('renderShaded;')
                                      Sketchup.send_action('renderTextures;')
                                      Sketchup.send_action('renderWireframe;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('selectAll;') #NEW?  does work on mac but not('editSelectAll;')
                                      Sketchup.send_action('selectArcTool;')
                                      Sketchup.send_action('selectAxisTool;')
                                      Sketchup.send_action('selectCircleTool;')
                                      Sketchup.send_action('selectDimensionTool;')
                                      Sketchup.send_action('selectDollyTool;')
                                      Sketchup.send_action('selectEraseTool;')
                                      Sketchup.send_action('selectExtrudeTool;')
                                      Sketchup.send_action('selectFieldOfViewTool;')
                                      Sketchup.send_action('selectFreehandTool;')
                                      Sketchup.send_action('selectImageIglooTool;')
                                      Sketchup.send_action('selectLineTool;')
                                      Sketchup.send_action('selectMeasureTool;')
                                      Sketchup.send_action('selectMoveTool;')
                                      Sketchup.send_action('selectNorthTool;')
                                      Sketchup.send_action('selectOffsetTool;')
                                      Sketchup.send_action('selectOrbitTool;')
                                      Sketchup.send_action('selectPaintTool;')
                                      Sketchup.send_action('selectPolygonTool;')
                                      Sketchup.send_action('selectPositionCameraTool;')
                                      Sketchup.send_action('selectProtractorTool;')
                                      Sketchup.send_action('selectPushPullTool;')
                                      Sketchup.send_action('selectRectangleTool;')
                                      Sketchup.send_action('selectRotateTool;')
                                      Sketchup.send_action('selectScaleTool;')
                                      Sketchup.send_action('selectSectionPlaneTool;')
                                      Sketchup.send_action('selectSelectionTool;')
                                      Sketchup.send_action('selectTextTool;')
                                      Sketchup.send_action('selectTurnTool;')
                                      Sketchup.send_action('selectWalkTool;')
                                      Sketchup.send_action('selectZoomTool;')
                                      Sketchup.send_action('selectZoomWindowTool;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('viewBack;')
                                      Sketchup.send_action('viewBottom;')
                                      Sketchup.send_action('viewFront;')
                                      Sketchup.send_action('viewIso;')
                                      Sketchup.send_action('viewLeft;')
                                      Sketchup.send_action('viewParallelProjection;') #* does work on mac •toggle
                                      Sketchup.send_action('viewPerspective;') #* does work on mac •toggle
                                      Sketchup.send_action('viewRight;')
                                      Sketchup.send_action('viewShowAxes;')
                                      Sketchup.send_action('viewShowAxes;') #*  does work on mac •toggle
                                      Sketchup.send_action('viewShowGuides;') #*  does work on mac •toggle
                                      Sketchup.send_action('viewShowHidden;') #*  does work on mac •toggle
                                      Sketchup.send_action('viewTop;')
                                      Sketchup.send_action('viewTwoPointPerspective;') #* does work on mac
                                      Sketchup.send_action('viewUndo;')
                                      Sketchup.send_action('viewZoomExtents;')
                                      Sketchup.send_action('viewZoomToSelection;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('showRubyPanel;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('cut;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('copy;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('paste;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('pasteInPlace;')
                                      
                                      
                                      #/
                                      Sketchup.send_action('editDelete;')
                                      
                                      

                                      forgot the bottom one, and I think I have a few others... somewhere...

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

                                      1 Reply Last reply Reply Quote 0
                                      • M Offline
                                        Mythos
                                        last edited by

                                        Is there any action to edit a group/component (similar as double clicking on a group)?

                                        1 Reply Last reply Reply Quote 0
                                        • TIGT Offline
                                          TIG Moderator
                                          last edited by

                                          @mythos said:

                                          Is there any action to edit a group/component (similar as double clicking on a group)?
                                          No. 😞
                                          I have PM'd you a suggestion with a method using view.pick_helper.path_at[-2], to select the picked object's container, then using the [forced open] Outliner to open that now selected group/instance for editing...

                                          TIG

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

                                            Has anyone found a cross-platform string to send the model to Layout ?

                                            On the PC only this works:
                                            Sketchup::send_action( 23051 )

                                            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