[Code] Sketchup.send_action() : Arguments to
-
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+.
-
@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.
-
Realized I need to clarify. Those arguments return true, but nothing happens. Dialogs don't show up, etc. Do they work on a PC?
-
@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.
-
Bug Report filed for Sketchup Ruby on Apple OSX (this topic referenced.)
-
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: 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; - Undocumented
-
is this an exception? [as in a mac thing...]
> Sketchup.send_action('viewPerspective;') true > !Sketchup.send_action('viewPerspective;') falsejohn
Edit:
I've been looking for a replacement forSketchup.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 -
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
-
No action for the Follow Me tool? (That works on both platforms.)
-
@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 -
Excellent! I didn't realise that was it's internal name. Doh!
Yea, run the lot and see what you get.
-
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 !
-
Yea - there's lots of legacy strangeness to discover when traversing the API.
-
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...
-
@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 callingmodel.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: * -
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:') 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...
-
Is there any action to edit a group/component (similar as double clicking on a group)?
-
@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 usingview.pick_helper.path_at[-2], to select the picked object's container, then using the [forced open]Outlinerto open that now selected group/instance for editing... -
Has anyone found a cross-platform string to send the model to Layout ?
On the PC only this works:
Sketchup::send_action( 23051 ) -
@dan rathbun said:
Has anyone found a cross-platform string to send the model to Layout ?
On the PC only this works:
Sketchup::send_action( 23051 )John confirmed that
Sketchup::send_action("sendToLayOut:")works on Mac.So that gives us a cross-platform method
<span class="syntaxdefault">def send_active_model_to_layout</span><span class="syntaxkeyword">()<br /></span><span class="syntaxdefault"> return nil unless Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_pro</span><span class="syntaxkeyword">?<br /></span><span class="syntaxdefault"> if </span><span class="syntaxkeyword">(</span><span class="syntaxdefault">Sketchup</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">respond_to</span><span class="syntaxkeyword">?(;</span><span class="syntaxdefault">platform</span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&<br /></span><span class="syntaxdefault"> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">platform </span><span class="syntaxkeyword">==</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">;</span><span class="syntaxdefault">platform_win </span><span class="syntaxkeyword">)</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">||<br /></span><span class="syntaxdefault"> RUBY_PLATFORM </span><span class="syntaxkeyword">!~</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">/(</span><span class="syntaxdefault">darwin</span><span class="syntaxkeyword">)/</span><span class="syntaxdefault">i<br /> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> 23051 </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> else<br /> Sketchup</span><span class="syntaxkeyword">;;</span><span class="syntaxdefault">send_action</span><span class="syntaxkeyword">(</span><span class="syntaxstring">"sendToLayOut;"</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault"> end<br />end<br /></span>EDIT: inserted Pro only bailout statement to return
nilif not SketchUp Pro.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement