sketchucation logo sketchucation
    • Login
    1. Home
    2. pecan
    3. Posts
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    P
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 21
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Difference between win32api.rb and win32api.so?

      Win32API is included in the full download of Ruby. Here is a list from my Ruby install folder Ruby 1.8.6

      http://forums.sketchucation.com/download/file.php?mode=view&id=31058&sid=34c6106451bc20499d4769a22f4515b8

      Googling, I found no usable result for Win32API.rb except for JRuby.


      win32api.png.zip

      posted in Developers' Forum
      P
      pecan
    • RE: [Plugin] Plugin Loader for SketchUp

      The download link is broken. The big green download button returns a 404 page not found.

      posted in Plugins
      P
      pecan
    • RE: System(iexplorer) freezes sketchup until iexplore is closed

      In SuRDebug, I do something like:

      cmd = "\"" + sketchupDir + "\\plugins\\SuRDebug\\SuRDebug.exe\" --suver=#{suVer}";
      puts cmd;
      systhr = Thread.new(){`#{cmd}`}
      
      

      You can also try:

      systhr = Thread.new(){system(cmd)}

      but, for me, it left a command window open.

      posted in Developers' Forum
      P
      pecan
    • RE: [Plugin Library] LibFredo6 - v15.4d - 14 Aug 25

      When I close SketchUp, my debugger console get the following messages.

      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Core_31.rb:270: warning: parenthesize argument(s) for future version
      C:/Program Files/Google/Google SketchUp 7/Plugins/PutOnLayer.rb:78: warning: don't put space before argument parentheses
      (eval):1: warning: already initialized constant SU_MAJOR_VERSION
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Mark_31.rb:325: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Mark_31.rb:331: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Mark_31.rb:335: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Mark_31.rb:339: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Protractor.rb:154: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Startup_31.rb:58: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Tool_31.rb:325: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Tool_31.rb:437: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Tool_31.rb:653: warning: don't put space before argument parentheses
      C:/Program Files/Google/Google SketchUp 7/Plugins/LibFredo6_Dir_31/Lib6Traductor_31.rb:47: warning: don't put space before argument parentheses
      (eval):3081: warning: parenthesize argument(s) for future version
      (eval):3104: warning: parenthesize argument(s) for future version
      key = Units
      value = 0.0
      key = StampOffset
      value = 12.0
      key = GridSpacingX
      value = 120.0
      key = SmooveRadius
      value = 360.0
      key = GridSpacingY
      value = 120.0
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command
      free_Command

      posted in Plugins
      P
      pecan
    • RE: Getting rdebug-ide working with SU Ruby

      @billbell52 said:

      I am on this quest to get Netbeans IDE working with SU Ruby. The development version of Netbeans has a capability to attach a debugger to a Ruby process.
      ...

      From a quick reading, it looks like this is an ide to attach to a Ruby script run from the command line.

      SketchUp, however, runs scripts from an embedded version of Ruby. Not the command line. So there's no port or process to attach to.

      Secondly, running the rudebug-ide would not give you access to the SketchUp Ruby extensions embedded inside SketchUp. Eg., If you issue a UI.messagebox() call (or any SketchUp call) from your script loaded by rdebug-ide, it'll just get an "unknown method" error.

      Third, the SketchUp Console is in control of all Standard in, out, and err I/O streams. Ruby-ide will have to redirect the SketchUp Console I/O to itself, then restore them when it's finished.

      For MS windows, an alternative might be:

      http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=18130
      SketchUcation Community Forums • View topic - [plugin] SuRDebug

      posted in Developers' Forum
      P
      pecan
    • RE: Refresh plugins without restart Sketchup is possible??

      @davidsuke said:

      It is a excellent tool!! Only one bad thing, no syntax highlighting, but it's great!!

      Thanks for the advice!!

      If you want syntax highlighting you can use the editor here.

      http://www.sketchucation.com/forums/scf/viewtopic.php?f=180&t=18130#p146440
      [plugin] SuRDebug

      posted in Developers' Forum
      P
      pecan
    • RE: Building Spanish Colonial Doors

      Beautiful !

      Is the .skp available? for us wood manglers to explode and see and learn the parts?

      posted in Woodworking
      P
      pecan
    • RE: [Code] Tool ID Constants - Rev. 2

      @thomthom said:

      Ugh... Mac compatibility was the reason I'm trying to use the IDs since Mac truncates the tool names so you can't tell PolyTool apart from MoveTool or TextTool.

      Is it possible that the trucation is consistent enough that you could use a combination of the trucated name and the inspect id to create a hash to dynamically identify the tool?

      Don't mean to insult your intelligence.

      What does the trucation look like. I don't know, I don't have access to a mac.

      If you had a map consisting of the SketchUp version number, the OS, the ordinary sequence of the Tools menu, the Ids of the ordinary menu, the inspect id of the tools, then you might be able to hack a hash of the Tool name.

      If the user changes the Tools structure with a C extension or insertion, then they'll just have to punt. You still catch 99% of the users.

      You should be able to get the Tool id from a "Tools observer" test script while physically observing your actions plus the report of the tool id.

      Hope something of this helps.

      posted in Developers' Forum
      P
      pecan
    • RE: [Code] Tool ID Constants - Rev. 2

      @thomthom said:

      Btw, how are native menu items shifted about? Can they be modified somehow? I thought that ruby menu items where added to the bottom of the menus. But you're saying they can affect the native menu items?

      When I wrote EventRelay, I noticed that I could not depend on menu items being constant.

      I'm saying that native menu items shift about all on their own without the help of us script writers.

      Eg., the Edit menu structure menu id's even share ids depending on what's selected before the user invokes the menu. Id 41002 can be "Delete Component" or "Flip along Groups Red" depending on the selection.

      I'm suggesting that plugin menu id's are dynamic according to the order in which SketchUp finds them in the Plugin folder.

      Insert a new plugin, your old plugin menu id may change.

      I'm suggesting that the Tools menu id may change depending on whether I added someones C extension in the Tools menu.

      I know it's frustrating and annoying. But that's the way (at least in windows) menu structures work.

      Before EventRelay could translate a user command to a menu id, it had to ask, each time, the windows menu routines for its current menu id for a particular menu entry. It would have been so much easier had they been constant. No such luck, however.

      posted in Developers' Forum
      P
      pecan
    • RE: [Code] Tool ID Constants - Rev. 2

      @thomthom said:

      Hmm... interesting. But that's not the Tools. Just general references to commands.
      What I had tried was looking through all the classes that existed. Thinking there'd be one for each tool as you'd do when you create a ruby tool. But there was nothing there either.

      My experience with those "constants" are that they are not always "constant". They're actually menu ids.

      As long as the tool menu does not change, they'll work, but if someone inserts or changes the order of the menus, they shift around.

      You can find all menu ids using EventRelay and the example script at http://code.google.com/p/eventrelay/wiki/EventRelay

      # ----------------------------------
      # Menus
      # ----------------------------------
      def OnMenuSelected?(menuId, menuLabel)
      
          puts "MENU SELECTED MenuId?[#{menuId}] label[#{menuLabel}]"
          return ALLOW
      
      end #OnMenuSelected? 
      
      posted in Developers' Forum
      P
      pecan
    • RE: Text on 2D plans

      @jim said:

      ... Double-click on a face with the Text tool to attach text, without leader, to the face.

      Wow! I gave up on the Text tool becaue I didnt know we could do this.

      Double click... who knew?

      thanks Jim.

      posted in Newbie Forum
      P
      pecan
    • RE: [Plugin] Recall last tool v1.2

      The following seems to work, and you can add to the exceptions hash when you find 'em.

      Hope this helps some...

      
      # Supports Organizer.rb
      =begin
      Copyright 2009, Matt
      All Rights Reserved
      
      THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION,
      THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
      
      License;   Free
      
      Author;     	Matthieu NOBLET
      Organization;   Matt
      Name;      		Recall_lst_tool
      Version;   		1.0
      SU Version;   	6 and 7
      Date;      		17/02/2009
      Description;   	Recall last tool used
      Usage;      	If you want to have a shortcut, please try with native Sketchup shortcuts...
      History;
      	1.000   17/02/2009
      			First version
      
      	1.100	17/02/2009
      			Global variables replaced by Class variables
      =end
      
      require 'sketchup.rb'
      
      class Matt_Observer < Sketchup;;ToolsObserver
          def initialize
              @ToolExceptionsHash = {
                 # observerName    send_actionName
                  "FOVTool",       "FieldOfViewTool",
                  "SketchCSTool",  "AxisTool",
                  "SketchTool",    "LineTool",
                  "PolyTool",      "PolygonTool"
              }
          end
      	@@Matt_Model_Toolid = nil
      	@@Matt_Model_Toolid2 = nil
      	def onActiveToolChanged (tools_object, toolname, toolid)
              print tools_object, " ", toolname, " ", toolid, "\n"
              tname = toolname;
      		@@Matt_Model_Toolid = @@Matt_Model_Toolid2 if @@Matt_Model_Toolid2
      		# remove "Camera" prefix reported by ToolObserver"
      		@@Matt_Model_Toolid2 = (tname[0,6]="" if (tname[0,6] == "Camera"));
      		tname = @ToolExceptionsHash.fetch(tname, tname);
      		@@Matt_Model_Toolid2 = "select#{tname};";
      		puts "1; #{@@Matt_Model_Toolid} 2; #{@@Matt_Model_Toolid2}"
      	end
      	def self.recall_last
              puts "sending action #{@@Matt_Model_Toolid}" if @@Matt_Model_Toolid
      		return Sketchup.send_action(@@Matt_Model_Toolid) if @@Matt_Model_Toolid
      		return Sketchup.send_action("selectSelectionTool;")
      	end
      end
      
      unless file_loaded?(__FILE__)
         file_loaded(__FILE__)
         Sketchup.active_model.tools.add_observer(Matt_Observer.new)
         $submenu ? (organizer = $submenu) ; (organizer = UI.menu("Plugins"))
         organizer.add_item("Recall last tool"){ Matt_Observer.recall_last }
      end
      
      
      
      posted in Plugins
      P
      pecan
    • RE: [Plugin] Recall last tool v1.2

      Here's a list of the send_actions and the actual tool name returned by the observer.

      howRubyPanel;
      viewBack;
      viewBottom;
      viewFront;
      viewIso;
      viewLeft;
      viewRight;
      viewTop;
      viewPerspective;
      viewShowAxes;
      viewShowHidden;
      viewZoomExtents;
      viewZoomToSelection;
      viewUndo;
      selectOrbitTool; (CameraOrbitTool)
          ok  selectPositionCameraTool;
      selectDollyTool; (CameraDollyTool
      selectTurnTool;
      selectWalkTool; (CameraWalkTool)
      selectZoomTool; (CameraZoomTool)
      selectFieldOfViewTool; (CameraFOVTool) <=== inconsistency
      selectZoomWindowTool; (CameraZoomWindowTool)
      pageAdd;
      pageDelete;
      pageUpdate;
      pageNext;
      pagePrevious;
      renderWireframe;
      renderHiddenLine;
      renderMonochrome&#058;
      renderShaded;
      renderTextures;
          ok  selectArcTool;
      selectAxisTool; (SketchCSTool)
          ok  selectCircleTool;
          ok selectEraseTool;
          ok  selectFreehandTool;
      selectLineTool; (SketchTool)
          ok  selectMeasureTool;
          ok  selectMoveTool;
          ok  selectOffsetTool;
          ok  selectPaintTool;
      selectPolygonTool; (PolyTool)
          ok  selectProtractorTool;
          ok  selectPushPullTool;
          ok  selectRectangleTool;
          ok  selectRotateTool;
          ok  selectScaleTool;
          ok  selectSectionPlaneTool;
          ok  selectTextTool;
          ok  selectDimensionTool;
          ok  selectExtrudeTool;
          ok  selectSelectionTool;
      editUndo;
      editRedo;
      editHide;
      editUnhide;
      fixNonPlanarFaces;
      
      axes is returning SketchCSTool
      3d text is returning 3DTextTool
      plugins return RubyTool
      orbit return CameraOrbitTool
      pan returns CameraDollyTool
      zoom returns CameraZoomTool
      field of view returns CameraFDVTool
      zoom window returns CameraFOVTool
      zoom extends return CameraZoomWindowTool
      walk return CamerWalkTool
      look returns CameraPanTool
      line returns selectSketchTool
      
      

      Except for "selectFieldOfViewTool: (CameraFOVTool)" you can remove "Camera" from the observer reported name and prefix "select".
      Special cases are PolyTool, Line tool, and axis tool.

      On second thought, a hash like {reportedObserverName, sendSelectName} might be the best bet.

      posted in Plugins
      P
      pecan
    • RE: [Plugin] Recall last tool v1.2

      @pecan said:

      Using the tool name should work:

      
      > def onActiveToolChanged (tools_object, toolname, toolid)
      >         print tools_object, toolname, toolid
      > 		@@Matt_Model_Toolid = @@Matt_Model_Toolid2 if @@Matt_Model_Toolid2
      > 		#@@Matt_Model_Toolid2 = toolid if not([21022,10508].index toolid)
      > 		@@Matt_Model_Toolid2 = "select#{toolname};";
      > 		puts "1; #{@@Matt_Model_Toolid} 2; #{@@Matt_Model_Toolid2}"
      > 	end
      > 
      

      Well... almost.

      "selectCameraOrbitTool:" doesnt work.
      It's action name is simply OrbitTool.
      So maybe a hash of returned tool names and the send_action name.

      sendActionToolName = {"CameraOrbitTool", "OrbitTool", } etc.
      Or maybe a hash of just the exceptions.

      Its a shame SU has to be so inconsistent.

      posted in Plugins
      P
      pecan
    • RE: [Plugin] Recall last tool v1.2

      Using the tool name should work:

      
      def onActiveToolChanged (tools_object, toolname, toolid)
              print tools_object, toolname, toolid
      		@@Matt_Model_Toolid = @@Matt_Model_Toolid2 if @@Matt_Model_Toolid2
      		#@@Matt_Model_Toolid2 = toolid if not([21022,10508].index toolid)
      		@@Matt_Model_Toolid2 = "select#{toolname};";
      		puts "1; #{@@Matt_Model_Toolid} 2; #{@@Matt_Model_Toolid2}"
      	end
      
      
      posted in Plugins
      P
      pecan
    • RE: [Plugin] Recall last tool v1.2

      Result from SU ruby console

      (eval)
      result = Sketchup.send_action "selectSelectionTool:"
      true

      I was in error suggesting it was a num.

      posted in Plugins
      P
      pecan
    • RE: [Plugin] Recall last tool v1.2

      @matt666 said:

      Hi Edson... I hope you do not know!! I'm cursed...

      Sketchup.send_action(21022)
      

      This code calls selection tool.

      Thank you Edson. And sorry for the inconvenience.

      On differenct OS's, even the same OS with different menus, that magic number will have changed.

      What's wrong with Sketchup.send_action(selectSelectionTool:);

      When the menu structure is updated, then the call will still work even tho the menu id has changed.

      posted in Plugins
      P
      pecan
    • RE: A Queen Anne Style Table Leg?

      I really enjoy your work.

      When I first started using SU in my wood mangling, it was your tutorials that got me going and gave me an understanding how much time I could save in the shop.

      Thanks

      posted in SketchUp Tutorials
      P
      pecan
    • RE: Debugging?

      See plugin SCrud:

      301 Moved Permanently

      favicon

      (www.sketchucation.com)

      posted in Developers' Forum
      P
      pecan
    • RE: Debugging?

      @avariant said:

      I've seen a ruby gem called ruby_debug, but I don't know anything about gems, or if such a thing is compatible with SU. It seems to imply it's like a command-line debugger.

      Debug is built into the base Ruby system. And you can attempt to load it from an installed Ruby version 1.8 directory.

      # Add debug library load path
      $;.push "c;/User/Programs/ruby/lib/ruby/1.8"
      # invoke the debugger
      require "debug.rb"
      puts "Ready to run"
      
      

      Result:

      load "/temp2/dbug.rb"
      Error; #<Errno;;EBADF; Bad file descriptor>
      c;/User/Programs/ruby/lib/ruby/1.8/debug.rb;74;in `flush'
      c;/User/Programs/ruby/lib/ruby/1.8/debug.rb;74;in `readline'
      c;/User/Programs/ruby/lib/ruby/1.8/debug.rb;275;in `debug_command'
      c;/User/Programs/ruby/lib/ruby/1.8/debug.rb;705;in `excn_handle'
      c;/User/Programs/ruby/lib/ruby/1.8/debug.rb;755;in `trace_func'
      c;/User/Programs/ruby/lib/ruby/1.8/debug.rb;945
      c;/User/Programs/ruby/lib/ruby/1.8/debug.rb;944
      
      

      Debug Line 74: is
      STDOUT.flush

      But... it was built to run under a shell, such as MS DOS and writes to STDOUT and reads from STDIN console files.

      Since SU imbeds Ruby in a GUI window, there is no STDIN or STDOUT.

      I suspect with experimentation and work, STDIN and STDOUT could be redirected to the SU Ruby window, or a shell could be started to run along side SU to accept debugger IO.

      It would take replacing the Ruby 1.8 debug.rb script with another compatible with SU.

      An interesting project. It should be done. Anyone?

      posted in Developers' Forum
      P
      pecan
    • 1 / 1