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: Reverse faces after pushpull??

      I have tried that and to make sure I tried again still reversed. I seem to need a way to identify the faces created with the pushpull and reverse each one. Or else just leave them red. I know the points on each end of the circle just the z value changes could I use face common to 2 edges to find each face and change it??

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Reverse faces after pushpull??

      Drawing counter sunk holes with a rb script and all looks ok except the faces on the inside of the thru hole are reversed and I have not be able to alter the code to fix this. Any suggestions???

      
      when "C_Sunk"
      #Calculate points for C_Bore 
      points_ScrewHead(@xcl[i],ycl,0,(@h_dia/2),dir_y) #@pthd[ ]
      @pthd=@pthd.collect {|point| point.transform(backt)}
      points_Screw(@xcl[i],ycl,(@z1*-1),(@s_dia/2),dir_y) #@ptsc[ ]
      @ptsc=@ptsc.collect {|point| point.transform(backt)}#to component coord
      cface=codef.entities.add_face(@pthd) #Counter Sink Dia
      codef.entities.erase_entities cface  #Erase face for CS large opening
      cface=codef.entities.add_face(@ptsc) # Screw shank Dia
      if @thruHole == "Yes" then cface.pushpull((@edge3L-@z1)*-1) end #Pushes scw dia thru component
      codef.entities.erase_entities cface # Added this because pushpull left face at bottom of CS
      for k in -1...11
      cface=codef.entities.add_face(@pthd[k],@pthd[k+1],@ptsc[k+1],@ptsc[k]) # Adds bevel faces for CS              
      end # for k
      

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Methods from Support files

      Thanks TIG that got me going. I found that my program was using the Arithmetic methods from an already loaded file.
      However as I got into i farther I found that I was going to have to rewrite to pass several more variables and I am going to leave that for another time. I revised the names and added KK_ to the front so I would know where the methods were that I was using.

      Thanks
      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Methods from Support files

      I am trying to move some def's that are common to most of my joint scripts to a support file. I am already using Arithmetic parsing.rb which I think Jim sent me to convert equations into calculated lengths. I thought I could add other def's there and use them from the main program. I get this error message
      Error: #<NoMethodError: undefined method cal_xCL_points' for ArithmeString:Module> C:\Users\Keith\Documents\ShopProjects\TestPlugins\K2WS_Tools\KK_Tools_Template.rb:214:in onLButtonDown'

      The code in the support file is:

        def ArithmeString.cal_xCL_points(x1,e_len,dir_x,spacing,qty)
          @xcl=Array.new qty.to_i
          case spacing
            when "Symetrical"
              #Debug UI.messagebox("Spacing = " + spacing.to_s)
              if qty == 1
                @xcl[0]=x1+(end2CL*dir_x)
                #Debug UI.messagebox("@xcl[0] = " + @xcl[0].to_s)
                #Debug UI.messagebox("Completed qty = " + qty.to_s)
              elsif qty == 2
                @xcl[0]=x1+(end2CL*dir_x)
                @xcl[1]=x1+((e_len-end2CL)*dir_x)
                #Debug UI.messagebox("Completed qty = " + qty.to_s)        
              elsif qty == 3
                @xcl[0]=x1+(end2CL*dir_x)
                @xcl[1]=x1+((e_len/2)*dir_x)
                @xcl[2]=x1+((e_len-end2CL)*dir_x)
                #Debug UI.messagebox("Completed qty = " + qty.to_s)
              elsif qty >= 4
                #Debug UI.messagebox("Started qty = " + qty.to_s)
                @xcl[0]=x1+(end2CL*dir_x)
                @xcl[qty-1]=x1+((e_len-end2CL)*dir_x)
                @xcl[qty/2]=x1+((e_len/2)*dir_x)
                n =(qty-2)/2  #loop number
                sn = 1 #Starting number
                i = 0
                while n > 0
                  temp_offset=cl_offset[i]
                  #Debug  UI.messagebox("CL Offset = "+ temp_offset.to_s)
                  @xcl[sn]=@xcl[sn-1]+((temp_offset)*dir_x)
                  @xcl[qty-1-sn]=@xcl[qty-sn]-((temp_offset)*dir_x)
                  sn = sn + 1
                  n = n -1
                  i = i + 1
                end # while n > 0                
              end #if qty == 
              #Debug  @xcl.each {|e| UI.messagebox("Symetrical CL point = "+ e.to_s)}           
            when "Equal"
              #Debug UI.messagebox("Case Spacing = " + spacing.to_s)
              equal_offset=(e_len-(end2CL*2))/(qty-1)
              @xcl[0]=x1+(end2CL*dir_x)
              @xcl[qty-1]=x1+((e_len-end2CL)*dir_x)
              n =(qty-2)  #loop number
              sn = 1 #Starting number
              while n > 0
                @xcl[sn]=@xcl[sn-1]+((equal_offset)*dir_x)
                sn = sn + 1
                n = n -1
              end # while n > 0
              #Debug @xcl.each {|e| UI.messagebox("Equal CL point = "+ e.to_s)}        
            when "User"
              #Debug UI.messagebox("Case Spacing = " + spacing.to_s)
              @xcl[0]=x1+(end2CL*dir_x)
              n =(qty-1)  #loop number
              sn = 1 #Starting number
              i = 0
              while n > 0
                user_offset=cl_offset[i]
                #user_offset=user_offset.to_l
                #Debug UI.messagebox("user_offset = "+ user_offset.to_s)
                @xcl[sn]=@xcl[sn-1]+((user_offset)*dir_x)
                sn = sn + 1
                i = i + 1
                n = n -1
              end # while n > 0
              #Debug @xcl.each {|e| UI.messagebox("User CL point = "+ e.to_s)} 
            when "Fixed"
              #Debug UI.messagebox("Case Spacing = " + spacing.to_s)
              @xcl[0]=x1+(end2CL*dir_x)
              n =(qty-1)  #loop number
              sn = 1 #Starting number
              while n > 0
                fixed_offset=cl_offset[0]
                @xcl[sn]=@xcl[sn-1]+((fixed_offset)*dir_x)
                sn = sn + 1
                n = n -1
              end # while n > 0
              #Debug @xcl.each {|e| UI.messagebox("Fixed CL point = "+ e.to_s)}         
          end #case spacing
          #Debug UI.messagebox("End Spacing = " + spacing.to_s)
        end #cal_xCL_points
      

      the code in the main file is:

      UI.messagebox"Calculations and then Add Features for first part"
                x1=0; e_len=6.0; dir_x=1;spacing="Symetrical"; qty=3
                ArithmeString.cal_xCL_points(x1,e_len,dir_x,spacing,qty)
                UI.messagebox("Center line points = " + @xcl[1].to_s)
      

      I know the file is read because in earlier statements I used:

      todist_input=ArithmeString.string_to_length(results[1].to_s)
          if !todist_input then todist_input=results[1] end
          @@todist=todist_input; ans[1] = @@todist
      

      and this works properly

      As always I appreciate the help. [I do use the SketchUp Book, examples and api code and try lots of things before asking].
      Keith

      posted in Developers' Forum
      K
      ktkoh
    • RE: Write all faces id's and point information to text file

      Thanks TIG That should help me out. I had already worked out the file new/open etc. but found no help on directories etc.

      Keith

      posted in Plugins
      K
      ktkoh
    • RE: Write all faces id's and point information to text file

      A question along similar lines:
      I am trying to write the input data to a file named like the rb file and in the same directory as the rb file. This will provide users with their on default data not what the author picked. Currently in windows the file is written to the desktop and I have not found code to change it. Where I would like it is in .....plugins\K2WS.

      Keith

      posted in Plugins
      K
      ktkoh
    • Plugin problem in SU8

      I am working on a box joint plugin and having very strange results.
      Box joints are an array of slots and fingers evenly spaced on the end of a board. To make a joint one board starts with a finger then alternates space-finger to end of board. The second board would start with a space and alternate finger-space to end of board.

      The program basically draws lines across the end of the board to create faces and these alternate between fingers(not pushed in) and spaces (push/pull to depth of finger).

      Problem the program works fine when starting with a finger. However when I try to make the second board that starts with a space (push first face in) in SU8 the program SPLATS. In Su7 both work ok as expected. By changing the starting point on line 394 to 0.002 the program runs but leaves a sliver of material on end of board. If I comment out the push/pull line (423) and manually push that first face in to make a space the model is ok. There are no error messages in the Ruby Console while running the program. The program appears to complete then SU Splats and closes.
      I have not looked at the files created by the problem as I wouldn't know what they meant but have sent report to google.

      Keith


      KK_BoxJointTool.rb


      BoxJointTest7.skp

      posted in Developers' Forum
      K
      ktkoh
    • RE: Reversing direction of a feature

      Thanks TIG that was exactly what I was looking for and it works perfectly!!

      Keith

      posted in Plugins
      K
      ktkoh
    • Reversing direction of a feature

      The continuing saga of woodworking joint scripts.
      Is there a simple way to reverse the z direction of a point array. My previous features were only push/pull and easily reversed for the second component. Now biscuit slots are created differently and I need points with the z values reversed or multiplied by -1. Before I do it the long way of adding separate calculations for all the points I thought I would ask if there is a way of changing an array of points (x,y,z) to (x,y,z*(-1))??

      points_BiscuitSlot(@xcl[i],ycl,z) #Method calculates points for creating biscuit slot
      

      Returns values for @pt[] 0 thru 15 & I use these to draw the biscuit slot in component 1
      Then the points are translated to global coord and then translated to component 2 coord. However at this point the feature protrudes from the face of component 2 and I need it to be recessed into the face (making a slot).

      Thanks
      Keith

      posted in Plugins
      K
      ktkoh
    • How to handle units when calculating points

      I am still working on my woodworking joint plugin and I am now trying to address the inches/mm so it will work in both units. I found the .to_l that makes the variables display the correct units in the input form now I am trying to figure out how to get the calculated points to also be correct for the drawing units.

      def points_DowelCircle_Comp1(x,y)
          r=@@dia/2
          @pt[0]=Geom;;Point3d.new(x+r,y,0)
          @pt[1]=Geom;;Point3d.new(x+(0.866*r),y+(0.5*r),0)
          @pt[2]=Geom;;Point3d.new(x+(0.5*r),y+(0.866*r),0)
          @pt[3]=Geom;;Point3d.new(x,y+r,0)
          @pt[4]=Geom;;Point3d.new(x-(0.5*r),y+(0.866*r),0)
          @pt[5]=Geom;;Point3d.new(x-(0.866*r),y+(0.5*r),0)
          @pt[6]=Geom;;Point3d.new(x-r,y,0)
          @pt[7]=Geom;;Point3d.new(x-(0.866*r),y-(0.5*r),0)
          @pt[8]=Geom;;Point3d.new(x-(0.5*r),y-(0.866*r),0)
          @pt[9]=Geom;;Point3d.new(x,y-r,0)
          @pt[10]=Geom;;Point3d.new(x+(0.5*r),y-(0.866*r),0)
          @pt[11]=Geom;;Point3d.new(x+(0.866*r),y-(0.5*r),0)
          
          #Debug @pt.each {|e| UI.messagebox("point = "+ e.to_s)}
          
        end #points_DowelCircle
      

      What do I need to do so these points are correct in mm and in? Do I need to apply the .to_l to each variable that is a distance or length or point in space before it is used in the equation? In this case the x,y,r variables. I have a lot of other calculations so I thought I would ask before making the changes to the program.

      Keith

      posted in Plugins
      K
      ktkoh
    • RE: New mortise &amp; tenon tool for woodworkers

      I was out of town and just saw your post. When you select the second component the program should hide it to give you unobstructed view of the first component. Can you post the file so I could look at it?

      Keith

      posted in Woodworking
      K
      ktkoh
    • RE: Question on Ruby Problem

      Thanks TIG as usual you were right on the problem and I found the error earlier in the code and it resulted in dir_y did not exist and program did not actually reach the point I thought was the problem.

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Question on Ruby Problem

      Working on a new woodworking joint rb starting with dowel joint and I have this problem passing a negative number to a procedure.

      
          points_DowelCircle_Comp1(@xcl[i],ycl)
      
          def points_DowelCircle_Comp1(x,y)
          UI.messagebox("x = " + x.to_s)
          UI.messagebox("y = " + y.to_s)
          r=@@dia/2
          @pt[0]=Geom;;Point3d.new(x+r,y,0)
          @pt[1]=Geom;;Point3d.new(x+(0.866*r),y+(0.5*r),0)
          @pt[2]=Geom;;Point3d.new(x+(0.5*r),y+(0.866*r),0)
          @pt[3]=Geom;;Point3d.new(x,y+r,0)
          @pt[4]=Geom;;Point3d.new(x-(0.5*r),y+(0.866*r),0)
          @pt[5]=Geom;;Point3d.new(x-(0.866*r),y+(0.5*r),0)
          @pt[6]=Geom;;Point3d.new(x-r,y,0)
          @pt[7]=Geom;;Point3d.new(x-(0.866*r),y-(0.5*r),0)
          @pt[8]=Geom;;Point3d.new(x-(0.5*r),y-(0.866*r),0)
          @pt[9]=Geom;;Point3d.new(x,y-r,0)
          @pt[10]=Geom;;Point3d.new(x+(0.5*r),y-(0.866*r),0)
          @pt[11]=Geom;;Point3d.new(x+(0.866*r),y-(0.5*r),0)
          
          #Debug @pt.each {|e| UI.messagebox("point = "+ e.to_s)}
          
        end #points_DowelCircle
      

      When @xcl[i] is a negative number ie. -0.375 the program quits and the UI.messagebox at the start of the method does not happen. What am I doing wrong?

      Keith

      posted in Developers' Forum
      K
      ktkoh
    • Shorter version for this ruby line

      I am rewriting my wood joint scripts and was wanting to know if there is a shorthand version of this command

      cface=codef.entities.add_face @pt[0],@pt[1],@pt[2],@pt[3],@pt[4],@pt[5],@pt[6],@pt[7],@pt[8],@pt[9],@pt[10],@pt[11]
      

      Keith

      posted in Plugins
      K
      ktkoh
    • Lost Oribit from Mouse Wheel Click

      Some how SU no longer orbits when I hold down the mouse wheel. Any ideas on why or how to correct this its very troublesome as I always had this feature before.

      Windows 7, Dell portable, logitech mouse.

      Keith

      posted in SketchUp Discussions sketchup
      K
      ktkoh
    • RE: Loading plugins only when needed

      The concept is usable on any plugin however the file loading and menu would need to be separated into a separate plugin. Yes it would be nice to have a list and load from a list but so far that has seemed to evaded the plugin writers. The way I made this the menu for the tool will exist which I think is handy for the user but only load as needed. I mainly put this out for comments and possibly starting some thinking on a different approach to the management problem. Also I wanted to know if there were any problems obvious to others that I overlooked as I am rather a newbe to SkethcUp & Ruby programing.

      Keith

      posted in Plugins
      K
      ktkoh
    • Loading plugins only when needed

      After writing the Mortise & Tenon plugin I realized it could be the basis for other woodworking furniture joints ie. Dowels, Dovetails, Biscuits, etc. When starting to develop these additions it became useful to think of each program individually as this should make the logic and program easier to develop and follow. Then I thought that adding detail to joints in a sketchup furniture design is a very small part of what needs to be done and I didn't want these plugins taking up resources when not needed. So I devised a method of using a loading script that only populates the menu but waits for the first use to load the plugin. It seems to work well but I thought I would post the example to see if there are hidden problems I have not encountered or thought out. The included files are:"loadK2WS_Tools.rb" placed in the plugins directory to automatically load other files, "KK_MortiseTool_X.rb" this is the actual tool script, and "Test_MortiseTool2.rb" the file that creates the menu items and loads the tool plugin as needed (these files need to be placed in a K2WS_Tools directory in the plugins directory ). Note: as written only the Tenon and Mortise tools are available the M&T_Joint and LT_Joints do not function until the tool script is loaded the first time by the Tenon or Mortise tools. This was done to demonstrate that the main tool script file did not load until requested.

      Thanks for looking (comments +/- appreciated)
      Keith


      loadK2WS_Tools.rb


      KK_MortiseTool_X.rb


      Test_MortiseTool2.rb

      posted in Plugins
      K
      ktkoh
    • RE: New mortise &amp; tenon tool for woodworkers

      Dave I don't seem to be a YouTube kind of guy. I don't expect to write many rb files so I think this will have to do. I would like to have the woodworkers that use SU at least give the program a try. I tested the download and viewing on my old desk top and it was easy and seemed quick to me.

      Keith

      posted in Plugins
      K
      ktkoh
    • New mortise &amp; tenon tool for woodworkers

      I posted a new Mortise Joint Tool in the plugin forum: http://forums.sketchucation.com/viewtopic.php?f=323&t=36799&p=324691#p324003
      Features:
      Creates complete joints for Mortise & Tenon Joints or Loose Tenon Joints.
      Also will draw a single Tenon or Mortise.
      Tenons or Mortises can have Square or Round Ends.
      Also will draw Haunched Tenons and the corresponding mortise.
      Will draw dowel holes for doweled joint. Use LT_Mortise and select "Dowel" for End Shape.
      Mortise depth in second part is specified separate so it can be different than the Tenon Length.
      Tool is added to the "Draw" menu with pullouts to the individual tools.
      Input Form will accept numbers, fractions, or equations.
      Demo Videos: (Edited urls so they work again 5/30)
      HaunchedTenon: http://www.filefactory.com/file/cb87da2/n/H_Tenon.swf
      Dowel Joint: http://www.filefactory.com/file/cb87da5/n/3DowelJoint.swf
      Mortises for loose tenon joint:http://www.filefactory.com/file/cb87da7/n/LooseTenonJoint.swf
      Spline Joint:http://www.filefactory.com/file/cb87dba/n/SplineJoint.swf
      Stopped Dado Joint:http://www.filefactory.com/file/cb87dbe/n/StoppedDado.swf

      Take a Look and give the program a try
      Keith

      posted in Woodworking
      K
      ktkoh
    • RE: New mortise &amp; tenon tool for woodworkers

      Pilou: Thanks for the link to BB Flashback I have downloaded it and made new videos. I am posting the links here and on the woodworker section of this forum.
      HaunchedTenon
      http://www.adrive.com/public/8ba076e35e4ecb9015450c3d6e2775980fb62f8a1cc8d8370ab9383fccd8e5e4.html
      Dowel Joint:
      http://www.adrive.com/public/42b2a827db877af305303bad8d294d9c7c5fcfa560d38df942c00f0d906dcf00.html
      Mortises for loose tenon joint:
      http://www.adrive.com/public/44b836216805467202377805bb142a231ed8a17b67122b2353dd65673358e704.html
      Spline Joint:
      http://www.adrive.com/public/bbf49e1dacb96708aa1f542dd7e84395b1e27f3c704e8bbc25721d95343dbc72.html
      Stopped Dado Joint:
      http://www.adrive.com/public/2469ec45ef27b465021765695cedb39f9eda9be3d531ef2acefc87f43f27833a.html

      Keith

      posted in Plugins
      K
      ktkoh
    • 1 / 1