sketchucation logo sketchucation
    • Login
    1. Home
    2. Dan Rathbun
    3. Topics
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    Offline
    • Profile
    • Following 0
    • Followers 1
    • Topics 92
    • Posts 4,903
    • Groups 2

    Topics

    • Dan RathbunD

      [code] Error raising scriptlets for testing

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      1k Views
      No one has replied
    • Dan RathbunD

      [code] Split a long pathstring ~in half at the nearest '/'

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      10
      0 Votes
      10 Posts
      2k Views
      Dan RathbunD
      Ok here's my current version: <span class="syntaxdefault">def self</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">path_knife</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">path</span><span class="syntaxkeyword">,</span><span class="syntaxdefault">max</span><span class="syntaxkeyword">=</span><span class="syntaxdefault">60</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment"># make sure it's a Ruby path using '/'.<br /></span><span class="syntaxdefault">  path </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> File</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">expand_path</span><span class="syntaxkeyword">(</span><span class="syntaxdefault">path</span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">  if path</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">length </span><span class="syntaxkeyword">></span><span class="syntaxdefault"> max<br />    </span><span class="syntaxcomment"># cut the file path into 2 lines<br /></span><span class="syntaxdefault">    ok </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">((</span><span class="syntaxdefault">path</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">length</span><span class="syntaxkeyword">-</span><span class="syntaxdefault">1</span><span class="syntaxkeyword">)*</span><span class="syntaxdefault">0.45</span><span class="syntaxkeyword">).</span><span class="syntaxdefault">to_i<br />    cut </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> path</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">split</span><span class="syntaxkeyword">(</span><span class="syntaxcomment">//).each_with_index { |e,i|<br /></span><span class="syntaxdefault">      break i if</span><span class="syntaxkeyword">(</span><span class="syntaxdefault"> e</span><span class="syntaxkeyword">==</span><span class="syntaxstring">'/'</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">&&</span><span class="syntaxdefault"> i</span><span class="syntaxkeyword">>=</span><span class="syntaxdefault">ok </span><span class="syntaxkeyword">)<br /></span><span class="syntaxdefault">    </span><span class="syntaxkeyword">}<br /></span><span class="syntaxdefault">    cut </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> 0 unless cut</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">is_a</span><span class="syntaxkeyword">?(Integer)<br /></span><span class="syntaxdefault">    return </span><span class="syntaxstring">"  #{path[0..cut]}   \n  #{path[(cut+1)..-1]}   "</span><span class="syntaxdefault"> if cut</span><span class="syntaxkeyword">></span><span class="syntaxdefault">0<br />  end<br />  </span><span class="syntaxcomment"># otherwise, leave it as one line<br /></span><span class="syntaxdefault">  return </span><span class="syntaxstring">"  #{path}   "<br /></span><span class="syntaxdefault">  </span><span class="syntaxcomment">#<br /></span><span class="syntaxdefault">end </span><span class="syntaxcomment"># def<br /></span><span class="syntaxdefault"> </span> **EDIT: Added test after iterator, to set cut to 0, if a string had no '/' characters (in which case each_with_index just returns the array characters.) Also removed frivolous line before iterator: cut = 0 EDIT 2:(2011-02-19) Simplified path substring references (line 11.) Removed frivolous else clause (were lines 12 and 13.)**
    • Dan RathbunD

      [Code] Sketchup.send_action() : Arguments to

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      22
      0 Votes
      22 Posts
      8k Views
      D
      it's been a while and maybe everyone has lost interest, but I found a few more for the mac list... the big question is, how many of these run on a PC? single # denotes a Menu Title, ## Item Title, ### hard coded shortcut combo... # SketchUp Sketchup.send_action('showAboutBox;') ## About SketchUp Sketchup.send_action('showSketchUpPreferences;') ## Preferences... Sketchup.send_action('manageLicenses;') ## License... Sketchup.send_action('checkWebUpdate;') ## Check Web for Update... Sketchup.send_action('hide;') ## Hide SketchUp ### ⌘H Sketchup.send_action('hideOtherApplications;') ## Hide Others ### ⌘H Sketchup.send_action('unhideAllApplications;') ## Show All Sketchup.send_action('terminate;') ## Quit SketchUp ### ⌘Q # File Sketchup.send_action('newDocument;') ## New ### ⌘N Sketchup.send_action('openDocument;') ## Open... ### ⌘O Sketchup.send_action('clearRecentDocuments;') ## Clear Menu Sketchup.send_action('performClose;') ## Close ### ⌘W Sketchup.send_action('saveDocument;') ## Save ### ⌘S Sketchup.send_action('saveDocumentAs;') ## Save As... ### ⇧⌘S Sketchup.send_action('saveCopy;') ## Save A Copy As... Sketchup.send_action('saveAsTemplate;') ## Save As Template... Sketchup.send_action('revertDocumentToSaved;') ## Revert Sketchup.send_action('sendToLayOut;') ## Send to LayOut Sketchup.send_action('importFromGoogleEarth;') ## Add Location... Sketchup.send_action('clearLocation;') ## Clear Location Sketchup.send_action('toggleTerrain;') ## Show Terrain Sketchup.send_action('browse3DWarehouse;') ## Get Models... Sketchup.send_action('shareWithGoogleEarthCommunity;') ## Share Model... Sketchup.send_action('runImporter;') ## Import... Sketchup.send_action('runPageLayout;') ## Page Setup... ### ⇧⌘P Sketchup.send_action('runDocumentSetup;') ## Document Setup... Sketchup.send_action('printDocument;') ## Print... ### ⌘P # Edit Sketchup.send_action('editUndo;') ## Undo ### ⌘Z Sketchup.send_action('editRedo;') ## Redo ### ⇧⌘Z Sketchup.send_action('cut;') ## Cut ### ⌘X Sketchup.send_action('copy;') ## Copy ### ⌘C Sketchup.send_action('paste;') ## Paste ### ⌘V Sketchup.send_action('pasteInPlace;') ## Paste In Place Sketchup.send_action('editDelete;') ## Delete Sketchup.send_action('eraseConstructionGeometry;') ## Delete Guides Sketchup.send_action('selectAll;') ## Select All ### ⌘A Sketchup.send_action('deselectAll;') ## Select None ### ⇧⌘A Sketchup.send_action('editHide;') ## Hide ### ⌘E Sketchup.send_action('editUnhide;') ## Selected Sketchup.send_action('editUnhideLast;') ## Last Sketchup.send_action('editUnhideAll;') ## All ### ⇧⌘E Sketchup.send_action('editLock;') ## Lock Sketchup.send_action('editUnlockSelected;') ## Selected Sketchup.send_action('editUnlockAll;') ## All Sketchup.send_action('makeComponent;') ## Make Component... ### ⇧⌘G Sketchup.send_action('makeGroup;') ## Make Group ### ⌘G Sketchup.send_action('closeGroupOrComponent;') ## Close Group/Component ### ⇧⌘G Sketchup.send_action('intersectWithModel;') ## With Model Sketchup.send_action('intersectSelected;') ## With Selection Sketchup.send_action('intersectWithContext;') ## With Context # View Sketchup.send_action('toggleToolPalette;') ## Large Tool Set Sketchup.send_action('toggleSolidModelToolPalette;') ## Solid Tools Sketchup.send_action('toggleGoogleToolPalette;') ## Location Sketchup.send_action('toggleWarehouseToolPalette;') ## Warehouse Sketchup.send_action('togglePageTabsDsiplay;') ## Scene Tabs Sketchup.send_action('viewShowHidden;') ## Hidden Geometry Sketchup.send_action('sectionToggleDisplay;') ## Section Planes Sketchup.send_action('sectionToggleActivation;') ## Section Cuts Sketchup.send_action('viewShowAxes;') ## Axes Sketchup.send_action('viewShowGuides;') ## Guides Sketchup.send_action('toggleShadows;') ## Shadows Sketchup.send_action('toggleFog;') ## Fog Sketchup.send_action('toggleDisplayEdges;') ## Edges Sketchup.send_action('toggleDisplayBackEdges;') ## Back Edges Sketchup.send_action('toggleProfiles;') ## Profiles Sketchup.send_action('toggleDepthQue;') ## Depth Cue Sketchup.send_action('toggleExtensions;') ## Extension Sketchup.send_action('toggleGlobalTransparency;') ## X-ray Sketchup.send_action('renderWireframe;') ## Wireframe Sketchup.send_action('renderHiddenLine;') ## Hidden Line Sketchup.send_action('renderShaded;') ## Shaded Sketchup.send_action('renderTextures;') ## Shaded With Textures Sketchup.send_action('renderMonochrome&#058;') ## Monochrome Sketchup.send_action('toggleHideRestOfModel;') ## Hide Rest of Model Sketchup.send_action('toggleHideSimilarComponents;') ## Hide Similar Components Sketchup.send_action('pageAdd;') ## Add Scene Sketchup.send_action('pageUpdate;') ## Update Scene Sketchup.send_action('pageDelete;') ## Delete Scene Sketchup.send_action('pagePrevious;') ## Previous Scene Sketchup.send_action('pageNext;') ## Next Scene Sketchup.send_action('slideshowStart;') ## Play Sketchup.send_action('pageOptions;') ## Settings Sketchup.send_action('toggleToolbarShown;') ## Hide Toolbar Sketchup.send_action('runToolbarCustomizationPalette;') ## Customize Toolbar ... # Draw Sketchup.send_action('selectLineTool;') ## Line ### ⌘L Sketchup.send_action('selectFreehandTool;') ## Freehand ### ⌘F Sketchup.send_action('selectArc3PointTool;') ## Arc ### ⌘J Sketchup.send_action('selectArcTool;') ## 2 Point Arc Sketchup.send_action('select3PointFitArcTool;') ## 3 Point Arc Sketchup.send_action('selectArcPieTool;') ## Pie Sketchup.send_action('selectRectangleTool;') ## Rectangle ### ⌘K Sketchup.send_action('selectRectangle3PointTool;') ## Rotated Rectangle Sketchup.send_action('selectCircleTool;') ## Circle Sketchup.send_action('selectPolygonTool;') ## Polygon # Camera Sketchup.send_action('viewUndo;') ## Previous Sketchup.send_action('viewRedo;') ## Next Sketchup.send_action('viewTop;') ## Top ### ⌘1 Sketchup.send_action('viewBottom;') ## Bottom ### ⌘2 Sketchup.send_action('viewFront;') ## Front ### ⌘3 Sketchup.send_action('viewBack;') ## Back ### ⌘4 Sketchup.send_action('viewLeft;') ## Left ### ⌘5 Sketchup.send_action('viewRight;') ## Right ### ⌘6 Sketchup.send_action('viewIso;') ## Iso ### ⌘7 Sketchup.send_action('viewParallelProjection;') ## Parallel Projection Sketchup.send_action('viewPerspective;') ## Perspective Sketchup.send_action('viewTwoPointPerspective;') ## Two-Point Perspective Sketchup.send_action('cameraMatchNewPhoto;') ## Match New Photo... Sketchup.send_action('editPhotoMatch;') ## Edit Matched Photo Sketchup.send_action('selectOrbitTool;') ## Orbit ### ⌘B Sketchup.send_action('selectDollyTool;') ## Pan ### ⌘R Sketchup.send_action('selectZoomTool;') ## Zoom Sketchup.send_action('selectFieldOfViewTool;') ## Field of View Sketchup.send_action('selectZoomWindowTool;') ## Zoom Window Sketchup.send_action('viewZoomExtents;') ## Zoom Extents Sketchup.send_action('viewZoomToSelection;') Sketchup.send_action('viewZoomImage;') ## Zoom to Photo Sketchup.send_action('selectPositionCameraTool;') ## Position Camera Sketchup.send_action('selectWalkTool;') ## Walk Sketchup.send_action('selectTurnTool;') ## Look Around Sketchup.send_action('selectImageIglooTool;') ## Image Igloo # Tools Sketchup.send_action('selectSelectionTool;') ## Select Sketchup.send_action('selectEraseTool;') ## Eraser Sketchup.send_action('selectPaintTool;') ## Paint Bucket Sketchup.send_action('selectMoveTool;') ## Move ### ⌘0 Sketchup.send_action('selectRotateTool;') ## Rotate ### ⌘8 Sketchup.send_action('selectScaleTool;') ## Scale ### ⌘9 Sketchup.send_action('selectPushPullTool;') ## Push/Pull Sketchup.send_action('selectExtrudeTool;') ## Follow Me Sketchup.send_action('selectOffsetTool;') ## Offset Sketchup.send_action('selectOuterShellTool;') ## Outer Shell Sketchup.send_action('selectUnionTool;') ## Union Sketchup.send_action('selectDifferenceTool;') ## Subtract Sketchup.send_action('selectDifferenceNDTool;') ## Trim Sketchup.send_action('selectIntersectTool;') ## Intersect Sketchup.send_action('selectBooleanSplitTool;') ## Split Sketchup.send_action('showSolidModelToolsMenu;') ## Split Sketchup.send_action('selectMeasureTool;') ## Tape Measure ### ⌘D Sketchup.send_action('selectProtractorTool;') ## Protractor Sketchup.send_action('selectAxisTool;') ## Axes ### ⌘F Sketchup.send_action('selectDimensionTool;') ## Dimensions Sketchup.send_action('selectTextTool;') ## Text Sketchup.send_action('doThreeDText;') ## 3D Text Sketchup.send_action('selectSectionPlaneTool;') ## Section Plane ### ⌘Y # Window Sketchup.send_action('performMiniaturize;') ## Minimize ### ⌘M Sketchup.send_action('performZoom;') ## Zoom Sketchup.send_action('showModelPropertiesPanel;') ## Model Info ### ⇧⌘I Sketchup.send_action('entityProperties;') ## Entity Info ### ⌘I Sketchup.send_action('orderFrontColorPanel;') ## Materials ### ⇧⌘C Sketchup.send_action('showComponentBrowser;') ## Components Sketchup.send_action('showStyleBrowser;') ## Styles Sketchup.send_action('showLayerPanel;') ## Layers Sketchup.send_action('showOutliner;') ## Outliner Sketchup.send_action('showPagePanel;') ## Scenes Sketchup.send_action('orderFrontFontPanel;') ## Show Fonts ### ⌘T Sketchup.send_action('showRubyConsole;') ## Ruby Console Sketchup.send_action('showShadowsPanel;') ## Shadows Sketchup.send_action('showFogSettingsPanel;') ## Fog Sketchup.send_action('showPhotoMatchPanel;') ## Match Photo Sketchup.send_action('showSoftenEdgesPanel;') ## Soften Edges Sketchup.send_action('showInstructor;') ## Instructor Sketchup.send_action('browse3DWarehouse;') ## 3D Warehouse Sketchup.send_action('browseExtensionStore;') ## Extension Warehouse Sketchup.send_action('toggleInspectors;') ## Hide Dialogs Sketchup.send_action('getPhotoTexture;') ## Photo Textures !!!!!!!!!!!! not working Sketchup.send_action('arrangeInFront;') ## Bring All to Front # Help Sketchup.send_action('showWelcomePanel;') ## Welcome To SketchUp… Sketchup.send_action('showOnlineHelpCenter;') ## Knowledge Center Sketchup.send_action('contactUs;') ## Contact Us # Orphans Sketchup.send_action('fixNonPlanarFaces;') ## Model Info >> Statistics >> Fix Problems I may have missed some... john
    • Dan RathbunD

      MAC UI.show_model_info() w/ no args

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      926 Views
      Dan RathbunD
      Need to know if this is a new v8 bug or not. Any one with Mac SU 7.x, could you try: UI.show_model_info nothing on PC (v7.x and v8.0,); nothing on Mac (v8.0) UI.show_model_info("") last used panel on PC (v7.x and v8.0,) and on Mac (v8.0) UI.model_info_pages PC output >> ["Animation", "Components", "Credits", "Dimensions", "File", "Geo-location", "Rendering", "Statistics", "Text", "Units"] UI.show_model_info("File") displays File panel on PC (v7.x and v8.0) regardless of what panel was previously shown. does not work on Mac (v8.0); only hilites the panel name in the selection box, and still displays the last panel that was used. ~
    • Dan RathbunD

      [code] Menu Validation (MF_DISABLED bugged on PC?)

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      12
      0 Votes
      12 Posts
      3k Views
      thomthomT
      Possibly. Maybe it was in another language where you had to gray and disable. ...Visual Basic...? Can't think of anything else where I've dealt with menus...
    • Dan RathbunD

      [Request] SU 6,7 & 8 : Version & Build & MR numbers

      Watching Ignoring Scheduled Pinned Locked Moved Plugins
      13
      0 Votes
      13 Posts
      2k Views
      Dan RathbunD
      So I'm hoping someone out there does what I do when I download an Installer for a new Maintenance Release. I make folders (on my E:\ drive,) and name them MR0, MR1, MR2 ..etc., and save the Installers there in the folder for the matching MR. ~
    • Dan RathbunD

      Ruby Version for Sketchup 8.0 M1 on Mac ??

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      41
      0 Votes
      41 Posts
      4k Views
      S
      WARNING Make sure to restore SketchUp to its distribution Ruby (1.8.5) before installing a version update to SketchUp! Otherwise the SU install will overwrite parts of your system-installed 1.8.7 Ruby and make it unusable (DAMHIKT)! Steve
    • Dan RathbunD

      X-Mouse Window Focus for Mac OSX ??

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      17
      0 Votes
      17 Posts
      5k Views
      thomthomT
      @dan rathbun said: @thomthom said: Will have to look into this. OK good.. get with John (driven) directly. Since I don't have a Mac, I cannot recreate his situation. Your in a better position to help him (he wants to use Jim's Mover plugin with 1 click.) I'm wondering if one of those shell commands (in the forum topics would work,) like ?? %(#4000BF)[defaults write com.apple.Safari FocusFollowsMouse -string YES] OR %(#4000BF)[defaults write com.google.Sketchup FocusFollowsMouse -string YES] OR whatever... Found this: http://mactips.dwhoard.com/mactips/x11-and-terminal/x11-click-through Doesn't modify the focus follow mouse behaviour, but allows clicks to go through at first click. But I'd prefer to find a per-window setting instead of a per-application setting.
    • Dan RathbunD

      UGLY Sketchup Icon !

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Discussions sketchup
      24
      0 Votes
      24 Posts
      3k Views
      jim smithJ
      @edson said: I am almost sure you can find free programs to convert any image into a windows icon. True- I found four without looking hard (I picked "image2iconConverter"). Easy to convert and in windows, just right click the icon, go to properties, change icon and pick the icon from where ever you stored it. Very easy [image: kg4Y_2010-09-27_1009.png]
    • Dan RathbunD

      Life Phases of a Ruby Method

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      251 Views
      No one has replied
    • Dan RathbunD

      [code] ruby_const_update.rb : ver 1.0.0

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      1
      0 Votes
      1 Posts
      987 Views
      No one has replied
    • Dan RathbunD

      BUG: Vector3d.angle_between

      Watching Ignoring Scheduled Pinned Locked Moved SketchUp Bug Reporting sketchup
      2
      0 Votes
      2 Posts
      665 Views
      mitcorbM
      If this needs a bump, here it is.
    • Dan RathbunD

      [REQ] Group different color than Component

      Watching Ignoring Scheduled Pinned Locked Moved Plugins
      3
      0 Votes
      3 Posts
      465 Views
      Dan RathbunD
      @thomthom said: Well, you could make a custom Tools that did highlight groups/components with different bounding boxes... Naw... he wishes the boxes to be colored differently using ALL tools (especially the native tools.) But wouldn't it be interesting if class ComponentDefinition had a @boundingboxcolor attribute ?? We wouldn't be limited to only a few colors (enitity, image, group, component, model.) Components of different definitions could have different boundingbox colors! Another idea... take a Group or Components boundingbox color from it's layer color!
    • Dan RathbunD

      [Code] Ruby LOAD PATHs script (Win32) : ver 3.0.1

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      19
      0 Votes
      19 Posts
      15k Views
      Dan RathbunD
      @26delta said: This creates an interesting problem. The error was introduced by the Rayelectron package which works with a file named "win32api.so". Somehow, in all the confusion, my Win32API.so file got overwritten by win32api.so. The files are identical, but differently named. Obviously the problem was created by whomever in the "Rayelectron" project, decided it would be a good idea (NOT!) to create an extension with the same name as a standard Ruby library source object file. (Because most Operating Systems are case-aware, but case tolerant... the OS will treat the filename the same, no matter how a command or shortcut may have the text 'cased'.) BUT.. internally, the require method (for some reason...,) will only load a file if it matches casewise the part of function name following "Init_" I always wondered why the programmers did not just copy the function a few times and rename it, thus: // C function Init_Win32API(){ init(); } function Init_WIN32API(){ init(); } function Init_win32API(){ init(); } function Init_win32api(){ init(); } The only good thing from this is that a hacker/pirate cannot "steal" (violate copyright,) an so file by renaming it. ~
    • Dan RathbunD

      [code] reading a CSV file

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      5
      0 Votes
      5 Posts
      3k Views
      Dan RathbunD
      @zps222 said: Hi, Dan, I simply paste "module MyTopLevelNamespace" in to Ruby console window of SU, but the error comes. So why? A module definition is a block statement. It's meant to be read by the interpreter. The console is a line evaluation function. You CAN make a module at the console by putting it all on 1 line, like: module Zps222; def say_hello(); puts "Hello!"; end; end YOU are supposed to choose YOUR OWNidentifier for a toplevel module name (namespace.) Replace "MyTopLevelNamespace" with a unique name that YOU decide. (You can use Zps222, or whatever you want, as long as it is unique for YOU, and noone else will use it.) Also "MyPlugin", you change it to whatever name you want your plugin to be. @zps222 said: By the way, can I use eclipse to run your code? Yes. This code is not Sketchup specific. It's just plain old standard Ruby.
    • Dan RathbunD

      [code] loading from the Standard Ruby Libs

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      1k Views
      K
      Dan, Very helpful, as always. So... For future... this is where you can download the library files if you need to: http://www.ruby-lang.org/en/downloads/ Thanks again! -- Karen
    • Dan RathbunD

      [talk] Using Ruby Modules

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      33
      0 Votes
      33 Posts
      29k Views
      J
      Discussion of Wiki purpose and motives moved here.
    • Dan RathbunD

      [info] Using Ruby Modules

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      6
      0 Votes
      6 Posts
      3k Views
      Dan RathbunD
      Condensed, Simplified and Reposted from another topic thread. Modules are important and very necessary. If you (speaking generally to all readers and especially newbies,) do not understand the importance of modules, then you do not understand how Ruby operates and how code is (and should be,) loaded. Modules separate your code from other people's code, and prevent your code from "crapping" on the ObjectSpace (which is the same as "crapping" on everyone else's modules and classes, including Google's and Ruby's.) ANY script that defines methods, instance variables, class variables or constants in the ObjectSpace IS "crap." It does not matter if Google did it in their examples, it is still "crap." Not only should you be using A module around your script... you should be using nested modules. The outermost is your TOP_LEVEL namespace. Any tool or plugin you create should be in a nested module (submodule,) of your TOP_LEVEL namespace. This also allows individual tools or plugins to be removed from memory when they are no longer being used. (It also means Google incorrectly put their modules at the toplevel, when they should have been within module Google. What happens in the future when Layout gets an API, and/or Picasa gets a Ruby API that integrates to Sketchup and Layout? But that could be a whole other discussion topic.) Concerning indenting... anticpating a chorus of whiney voices, thus: "Oh man, nested modules mean I have to waste so much space on the left of my code, and push the "meat" of my rubies way to the right! And then I have to hit that TAB key all the time on every line... boohoo!" No you don't! Ruby allows multiple scope defintions ! If I wish to define a class within a submodule of my toplevel module, I can do so and only have 1 indent: # The Outer namespace modules must exist before referencing them. require('myfolder/MyTopLevel.rb') require('myfolder/myplugin/MyPlugin.rb') class MyTopLevel;;MyPlugin;;ThisClass def initialize(*args) # INIT CODE GOES HERE end # def end # class MyTopLevel;;MyPlugin;;ThisClass I can also save an indent when defining a plugin module by doing: # The Outer namespace module must exist before referencing it. require('myfolder/MyTopLevel.rb') module MyTopLevel;;MyPluginTwo class<<self private def method_one # .. code .. end public def method_two # .. code .. end # .. etc .. end # self end # module MyTopLevel;;MyPluginTwo EDIT: Ruby v1.8.0 does not allow the TopLevel scope operator prefix, ie: class **::**MyTopLevel::MyPlugin::ThisClass %(#4000BF)[v1.8.6 does allow it. It basically tells Ruby to start looking at the TopLevel for an indentifier, instead of backing up thru each nesting level from the current level. (I've removed the use of it in these examples, as many users will be running v1.8.0 on Win32, and not know how to update their Sketchup Ruby.)] instead of doing this: module MyTopLevel module MyPluginTwo class<<self private def method_one # .. code .. end public def method_two # .. code .. end # .. etc .. end # self end # module MyPluginTwo end # module MyTopLevel So choose a TopLevel namespace (module name,) that is unique. Use part of your surname. Or if your plugins will be distributed under a brand or company name, then that would be a good toplevel module name. Or you could use your SCF screen name, as long as it's unique. Just don't use a trademarked brandname(s) if your not the owner of the trademark!! Please do not use this thread to discuss issues relating to Using Ruby Modules, instead please use the talk thread: [talk] Using Ruby Modules
    • Dan RathbunD

      Posting tables of data in the forum

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      11
      0 Votes
      11 Posts
      2k Views
      Dan RathbunD
      @thomthom said: No Ruby fun - only PHP... I posted a Ruby Hilited test example(s) at the phpBBStyles forum, ie: Code Test - Ruby EDIT: corrected URL as topic was moved by phpbbstyles moderator. .. in order to see how well the phpBB Syntax Highlighter MOD works/looks. Adds a BBCode 'syntax' which allows you to post programs / scripts in upto 132 languages and have the post Syntax Highlighted using GeSHi.General description: http://www.phpbb.com/customise/db/mod/syntax_highlighter More info (install notes, etc.): http://www.phpbb.com/community/viewtopic.php?t=1697035#p10232505 Extra info: http://www.phpbbstyles.co.uk/info/viewtopic.php?f=6&t=39&p=83 Supported coding Syntaxes: [ emphasis on some by me ] @unknownuser said: Syntax Highlighter - 1.0.8](http://www.phpbbstyles.co.uk/info/viewtopic.php?f)":sk3p0i6l] now supports 138 languages. Supported Syntaxes: abap, actionscript, actionscript3, ada, apache, applescript, apt_sources, asm, asp, autoit, avisynth, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_mac, caddcl, cadlisp, cfdg, cfm, cil, cmake, cobol, cpp, cpp-qt, csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, gnuplot, groovy, haskell, hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml, ocaml-brief, oobas, oracle11, oracle8, pascal, per, perl, php, php-brief, phpbb, pic16, pixelbender, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic, rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xhtml, xml, xorg_conf, xpp, z80 Using GeSHi version: 1.0.8.4
    • Dan RathbunD

      [code] Sketchup Safe Shutdown method

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      10
      0 Votes
      10 Posts
      5k Views
      D
      censored
    • 1 / 1