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

    Posts

    Recent Best Controversial
    • RE: Component Axis Display Option

      Dan that code controls the global axis. I am trying to control the individual component axis visibility.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Component Axis Display Option

      I tried this code from the API in an attempt to find the Option name for controlling the component axis visibility but it does not run. There is a optionsmanager but the options.name line fails.

       model = Sketchup.active_model
       optionsmanager = model.options
       if (optionsmanager)
         # If an options manager is returned, iterate through each option
         # provider within the options manager and display its name.
         for option in optionsmanager
           name = options.name
           UI.messagebox name
         end
       else
         UI.messagebox "Failure"
       end
      

      Is there a code method for controlling the component axis visibility?

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: How to distinguish face size

      I have been looking at rounding calculated dimensions in my woodworking joint program and this is what I came up with. I only accept inches and millimeters as sketchup units and then round the calculations to the precision set for the active model. It is not very compact code but seems to work.

      mod = Sketchup.active_model # Open model
      ent = mod.entities # All entities in model
      sel = mod.selection # Current selection
      @num = 1.0
      #UI.messagebox("Test Number = " + @num.to_s)
      
      prompts = ["Test Number = "]
      defaults = [@num.to_s]
      results = inputbox prompts, defaults, "Test Round Function"
      if !results then;Sketchup.send_action "selectSelectionTool;";return;end
              
      @num = results[0].to_l
      
      #Test Units
      @opt_LEN_No = Sketchup.active_model.options["UnitsOptions"]["LengthUnit"]
      @opt_Format_No = Sketchup.active_model.options["UnitsOptions"]["LengthFormat"]
      @opt_Precision_No = Sketchup.active_model.options["UnitsOptions"]["LengthPrecision"]
            
      @opt_Precision_No = @opt_Precision_No.to_s
      UI.messagebox("Precision = " + @opt_Precision_No)
      
      case @opt_Precision_No
          when "0"
              if @opt_Format_No == 0 then @round = 1.0 end 
              if @opt_LEN_No == 2 then @round = 0.0393701 end 
              if @opt_Format_No == 3 then @round = 1.0 end 
          when "1"
              if @opt_Format_No == 0 then @round = 0.1 end
              if @opt_LEN_No == 2 then @round = 0.00393701 end
              if @opt_Format_No == 3 then @round = 0.5 end 
          when "2"
              if @opt_Format_No == 0 then @round = 0.01 end
              if @opt_LEN_No == 2 then @round = 0.000393701 end
              if @opt_Format_No == 3 then @round = 0.25 end 
          when "3"
              if @opt_Format_No == 0 then @round = 0.001 end 
              if @opt_LEN_No == 2 then @round = 0.0000393701 end
              if @opt_Format_No == 3 then @round = 0.125 end 
           when "4"
              if @opt_Format_No == 0 then @round = 0.0001 end
              if @opt_LEN_No == 2 then @round = 0.00000393701 end
              if @opt_Format_No == 3 then @round = 0.0625 end 
           when "5"
              if @opt_Format_No == 0 then @round = 0.00001 end
              if @opt_LEN_No == 2 then @round = 0.000000393701 end
              if @opt_Format_No == 3 then @round = 0.03125 end 
          when "6"
               if @opt_Format_No == 0 then @round = 0.000001 end 
               if @opt_LEN_No == 2 then @round = 0.0000000393701 end
               if @opt_Format_No == 3 then @round = 0.015625 end           
      end #case
      UI.messagebox("Round To = " + @round.to_s)
      @num_R = ((@num + (@round/2.0))/@round).to_i*@round
      UI.messagebox(@num.to_s + " Round to  " + @round.to_l.to_s + " = " + @num_R.to_l.to_s)
      Sketchup.active_model.entities.add_line [@num_R,0,0],[@num_R,@num_R,0]
      

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Namespace and Tool Class Question

      I have started working on my wood joint tools script to wrap it in my namespace and this is what I came up with so far. The attached code that demonstrates only the Dowell part of my tools. This works, however I would like some comments on the method.
      I retained the old directory structure for the actual tool K2WS_Tools\K2_ToolsDowelJoint.rb so that the new version would overwrite the old version for users that have downloaded the old version.

      Keith

      #This Program Loads the Individual K2_Tools when their Menu is accessed!
      require 'K2WS/k2ws_module.rb' #-NameSpace Module
      
      module K²WS;;K2_ToolsLoader
      
        class << self
      
          #ToolBars are only created when Menu Item is selected
          
          
          
          def dowel_ToolBar	
            if  @tlb5== nil
              itcmd51 = UI;;Command.new("Dowel Joint") {dowelJoint}
              itcmd51.tooltip = "Complete Dowel Joint"
              itcmd51.small_icon = File.join(File.dirname(__FILE__),"K2_ToolsSupportFiles","DowelJoint_small.png")
              itcmd51.large_icon = File.join(File.dirname(__FILE__),"K2_ToolsSupportFiles","DowelJoint_large.png")
              itcmd52 = UI;;Command.new("Dowels 1 Comp") {dowel1Comp}
              itcmd52.small_icon = File.join(File.dirname(__FILE__),"K2_ToolsSupportFiles","Dowel1Comp_small.png")
              itcmd52.large_icon = File.join(File.dirname(__FILE__),"K2_ToolsSupportFiles","Dowel1Comp_large.png")
              itcmd52.tooltip = "Dowel 1 Comp"
              @tlb5 = UI;;Toolbar.new("Dowels")
              @tlb5.add_item(itcmd51)
              @tlb5.add_item(itcmd52)
              @tlb5.show
            else
              #state = @tlb5.get_last_state
              #UI.messagebox("State of Dowel ToolBar " + state.to_s)
              @tlb5.show
            end
          end
      
          def dowelJoint
            require  'K2WS_Tools\K2_ToolsDowelJoint.rb'
            Sketchup.active_model.select_tool K2_Tools_Dowel_Joint.new  
          end
          
          
          def dowel1Comp
            require  'K2WS_Tools\K2_ToolsDowelJoint.rb'
            Sketchup.active_model.select_tool K2_Tools_Dowel_Holes.new
            
          end
          
          
          
          
        end # proxy class
        
        #Run Once
      	unless file_loaded?(File.basename(__FILE__))
      		
          # Access the main Tools menu
          tools_menu = UI.menu "Tools"
          # Add a separator and a submenu
          tools_menu.add_separator
          sub_menu = tools_menu.add_submenu("KK_Tools")
          # Add items to the submenu
      		
          it1= sub_menu.add_item("Dowels"){dowel_ToolBar}
          
          
        file_loaded(File.basename(__FILE__))  
           
        end #End Run Once 
      
       
       end #module K²WS;;K2_ToolsLoader
      
      posted in Developers' Forum
      K
      ktkoh
    • RE: Plugin installation recomendations

      Thanks I will make use of that.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Plugin installation recomendations

      The reason I asked here was for comments.

      It was not info on how to package plugins but to suggest to a user how to install a plugin I was recomending if they were not comfortable with moving/copying files to the plugins dir. I have looked at the Sketchup definition of how to install plugins and that was why I thought some users might need a simpler method.

      I have downloaded and used the TT installer (and use and like it) but since it was removed from the Ruby Depot the user would need to come to this forum and regester and possibly not wanting to regester at another site.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Plugin installation recomendations

      I had not thought about the second possibility. In my case as I will be recomending specific plugins I can check before and warn user if a different installation process will be necessary.
      Thanks
      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Plugin installation recomendations

      I have started a blog aimed at woodwookers about sketchup plugins and how they can help thier modeling. I realized that I should start with how to install plugins and this is what I came up with:
      Well I think the easiest way is to use the windows explorer and by right clicking on a file (xxxxxxxx.rb) and select sendto compressed file. This will result in a second file (xxxxxxxx.zip). Now you can right click on this file and select 'rename' and change the extension from .zip to .rbz. Once this is complete open sketchup and install this file as an extension. It's that easy. If the file is already a zipped file "xxxxxxx.zip" change the extension to ".rbz" and install as and extension. This way you do not need to find the plugin directory on your computer let sketchup handle that.

      What is your opinion of this method? Is it something I should suggest or not?
      I found it also works for rbs files.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Plugin Comp2LayerScene

      I have released this aimed at woodworkers see:
      http://forums.sketchucation.com/viewtopic.php?f=323&t=47805#p428597

      Also have a youtube demo http://www.youtube.com/watch?v=vshabhT-UEA

      Keith

      posted in Woodworking
      K
      ktkoh
    • [Plugin] Comp2LayerScene

      This plugin is ready for public use and is aimed at woodwookers that draw models in sketchup to build in their shop. Select a single component, single parent component or 2 or more components and the program is found on the right click context menuThe program is described below:

      Place the Component on a new layer named from the component

      Layer name includes prefix A##- where ## is 2 digit no (01...99)

      All instances of the component will be placed on the new A##- layer

      A second new Drawing Layer named Z-## will be created.

      A copy of the Board will be added to the Z-## Layer for the Drawing Scene

      If user has MakeOrthoViews.rb installed then ortho views are created

      The drawing Scene will be updated

      Added NC2SCENE to make layer and scene for Nested Component

      Added GP2SCENE to make Sub Assembly scene for 2 or more components

      Added C2SCNE to make scene for Component already placed on its Named Layer

      Added SETPREF to allow user to set Preferences [Plugins/Set Comp2Layer Pref]

      I have created a youtube demo at: http://www.youtube.com/watch?v=vshabhT-UEA

      Edited 4/21/2014

      I have released version 2.0 @ the SketchUcation Plugin Store

      The program now makes the orthographic views and thus you no longer need the "Make Ortho Views" plugin

      The prefix for the layer name is completely optional.

      The drawing views are offset so the main view can be on layer0.

      I see that many models are drawn with all components visible on layer0
      This makes it easy to use the drawing scenes for a model that was drawn without separating components on individual layers
      Added the make a new hidden layer command for the users convenience

      Thanks to all the help I received from the Developer's Forum
      Keith


      Version 2.0

      posted in Plugins
      K
      ktkoh
    • RE: Adding Flipped Component Instance

      Thanks TIG that worked like I wanted it to. Seem a long way around but results are good.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Adding Flipped Component Instance

      In the script I am writing I need to add a copy of a flipped component. After selecting the flipped component I use this code but the copy is the same if I have selected the orgional component or flipped component.

      @model = Sketchup.active_model
      @layers = @model.layers
      @ss = @model.selection
      @ents = @model.active_entities
      @entities = @model.entities
      @pages = @model.pages
      @count = @pages.count
      @length = @layers.length
      @definitions = @model.definitions
      
      entity = @ss.first
      ent_def = entity.definition
      insert_tran = Geom;;Transformation.new [0,0,0]
      c2=@model.active_entities.add_instance(ent_def,insert_tran)
      

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Creating rbz files on Win7

      Mistry with win7 zip files solved!!! Some how my folder option to hide known extensions was selected and this created the problem making a ziped file a ziped folder. I know I had nothing to do with that change as it took me a long time to find Folder Options after I started looking for them.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Creating rbz files on Win7

      Yes 7Zip worked when I selected send to xxxxxxxxxx.zip file. Thanks

      Still don't understand what happened to my Win7 to make this a problem!!! I assume it came with one of the updates.

      Thanks
      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Creating rbz files on Win7

      When I right click on a selected file or files in windows explorer the send to option for compress is a zipped folder not a zipped file like it was previously.

      Dan what option do you use in 7zip I tried that but SU could not install from that file when I renamed it rbz???

      posted in Developers' Forum
      K
      ktkoh
    • Creating rbz files on Win7

      Now my windows 7 has started creating compressed folders when I am trying to make a zip file of a plugin and its folders. This compressed folder is not seen by sketchup as a rbz file for installation. In the past my system had been making zip files which I renamed to rbz and this always worked to install as an extension. Is there a setting that will change this problem or do I need a zip program from another vendor??

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Review of Plugin/NameSpace/Extension Format

      Thanks Dan for the review and changes. I have adjusted my files to include your suggestions and when I have a how to vidio completed I will post in the plugin section.

      Also I expect to be back for help on putting my Joint Tools under the namespace umbrella as I have just started that process.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Review of Plugin/NameSpace/Extension Format

      I edited my post with the correct file. You can either install as extension or change it to a zip file and unzip to see the files in question.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Review of Plugin/NameSpace/Extension Format

      Several months ago I asked about plugin formating and Dan made a namespace template/example for me and now I have finally got a working plugin written using the template. I thought before I offered it to fellow woodworkers I would post it here for comments to see if I am using acceptable format so as not to cause problems with other plugins.

      Thanks for your help
      Keith


      Decription of Plugin


      K2WS_Comp2LayerScene_ext.rbz

      posted in Developers' Forum
      K
      ktkoh
    • RE: A big frigging L desk

      Here is a large L shaped desk I did for our church sec. The panels are oak frames with a 1/2" plywood panel. {I used 1/2 because I could find plain sawed face} The top is particle board with a 1 1/2" solid edge. There is no problem with sagging as I had expected and was ready to add reinforcement.

      Keith


      Large L size desk

      posted in Woodworking
      K
      ktkoh
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 12
    • 13
    • 6 / 13