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

    Brendon5374

    @Brendon5374

    10
    Reputation
    1
    Profile views
    6
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Brendon5374 Unfollow Follow
    registered-users

    Latest posts made by Brendon5374

    • RE: Creating Components in Cab.rb

      Well, in light of not getting an answer I can use (at least with my knowledge base), I have figured out an inelegant solution for my problem. I have moved each piece .01mm from each other. The side panel is .01mm away from the bottom shelf and .01mm away from the table top, and the back panel...etc. So now I can point the cursor at each piece without the whole assembly being selected, select all, and make a component.

      Slow, but by making up a plugin, at least all the lines are already drawn.

      I did have a look at the suggestions, but they just wouldn't work for me, no matter where I put them in the script. And I did try. I tried to look for references and examples, but it was a labynrith on google, and quite often the only link was back here in this thread. LOL I thought it would be easier, since it is a basic action. But this experience for me here has been like asking what the motto says on a school blazer, only to be told to learn the latin language and find out that way.

      posted in Developers' Forum
      B
      Brendon5374
    • RE: Creating Components in Cab.rb

      Jim, I know you must be right. But still, I can't get it to work my end.

      Here is the file. If I cut and paste even just your first lines to replace the first piece, nothing comes up when I run the plugin. I put the old lines back, and it works.


      Cabinet

      posted in Developers' Forum
      B
      Brendon5374
    • RE: Creating Components in Cab.rb

      Thanks Jim,

      but I dropped that into the script, and when I ran the plugin it came back with nothing. Nothing appeared. I tried doing just the example you gave - that didn't work - and then each new element the extra lines. I made sure each one was different. ie:

      ls=[] #left panel
      ls[0] = [0, depth, kick]
      ls[1] = [0, depth, height-thick]
      ls[2] = [0, thick, height-thick]
      ls[3] = [0, thick, kick]
      new_definition=Sketchup.active_model.definitions.add("Left Panel")
      cdef_entities = new_definition.entities
      ls_base = cdef_entities.add_face(ls)
      ls_base.pushpull(thick)

      and..

      btm=[] #bottom shelf
      btm[0] = [thick, thick, kick+thick]
      btm[1] = [thick, depth, kick+thick]
      btm[2] = [thick, depth, kick+0]
      btm[3] = [thick, thick, kick+0]
      new_definition=Sketchup.active_model.definitions.add("Bottom Shelf")
      cdef_entities = new_definition.entities
      btm_base = cdef_entities.add_face(btm)
      btm_base.pushpull(width-thick-thick)

      Didn't work.

      posted in Developers' Forum
      B
      Brendon5374
    • RE: How do you make individual components

      Thank you Thomas and Dave for your replies. I was pretty sure there had to be more script for each piece (object). I'm not too familar with the syntax. And reading all this is daunting for me. Basically, I was just cannabalizing open files to suit my purpose; and beyond what I understood from doing that, I'm a bit lost when off the beaten track. I read the links you gave, and I tried, but came up lacking.

      I do not know what to put with say,

      ls=[] #left panel
      ls[0] = [0, depth, kick]
      ls[1] = [0, depth, height-thick]
      ls[2] = [0, thick, height-thick]
      ls[3] = [0, thick, kick]
      ls_base = entities.add_face ls
      ls_base.pushpull thick

      to turn it into a component. I pasted every line you gave, this way and that- front and back. But I couldn't figure it. Monkey see-monkey do, has it limits. ha ha.

      posted in Plugins
      B
      Brendon5374
    • How do you make individual components

      Here is something I have edited for myself from cab.rb from the ruby libray. I end up with panels, a complete cabinet, etc. But when I point the cursor at the object in sketchup, there are no individual components. No individual pieces of timber I can point to, move around., resize, etc. How do I make this script come up with a left panel that is a component and not part of the whole entity.

      When I use the menu without the plugin I draw the dimensions, push/pull, select all, and "make component". Then I do the same over again. I get what I want then. How can I get the same result doing a plugin script?

      I don't know the ettiquette here, so sorry if pasting all this is wrong. But here goes:

      require 'sketchup.rb'
      #-----------------------------------------------------------------------------
      def create_cab

      prompts = ["Cabinet Width", "Cabinet Height", "Cabinet Depth","With Kick?"]
      values = [100.cm, 100.cm, 60.cm , 10.cm ]
      thick = 1.6.cm  #<----panel thickness
      results = inputbox prompts, values, "Cabinet Dimensions"
      width, height, depth, kick = results
      if (kick <= 0.0.cm)
         then kick = 0.01.cm
      end
      

      #-----------------------------------------------------------------------------
      model = Sketchup.active_model
      model.start_operation "Create Cab"
      entities = model.active_entities
      group = entities.add_group
      entities = group.entities

      ls=[]   #left panel
      ls[0] = [0, depth, kick]
      ls[1] = [0, depth, height-thick]
      ls[2] = [0, thick, height-thick]
      ls[3] = [0, thick, kick]
      ls_base = entities.add_face ls
      ls_base.pushpull thick
      
      
      
      x = width-thick
      rs=[]   #right panel
      rs[0] = [x, depth, kick]
      rs[1] = [x, depth, height-thick]
      rs[2] = [x, thick, height-thick]
      rs[3] = [x, thick, kick]
      rs_base = entities.add_face rs
      rs_base.pushpull thick
      
      
      
      
      rp=[]   #rear panel
      rp[0] = [0, depth, kick]
      rp[1] = [0, depth+thick, kick]
      rp[2] = [0, depth+thick, height-thick]
      rp[3] = [0, depth, height-thick]
      rp_base = entities.add_face rp
      rp_base.pushpull -width
      
      top=[]   #top 
      top[0] = [thick, 10.cm, height-thick]
      top[1] = [thick, 0+thick, height-thick]
      top[2] = [thick, 0+thick, height-thick-thick]
      top[3] = [thick, 10.cm, height-thick-thick]
      top_base = entities.add_face top
      top_base.pushpull width-thick-thick
      
      
      
      top=[]   #top 
      top[0] = [thick, depth-10.cm, height-thick]
      top[1] = [thick, depth, height-thick]
      top[2] = [thick, depth, height-thick-thick]
      top[3] = [thick, depth-10.cm, height-thick-thick]
      top_base = entities.add_face top
      top_base.pushpull width-thick-thick
      
      
      
      btm=[]   #bottom shelf
      btm[0] = [thick, thick, kick+thick]
      btm[1] = [thick, depth, kick+thick]
      btm[2] = [thick, depth, kick+0]
      btm[3] = [thick, thick, kick+0]
      btm_base = entities.add_face btm
      btm_base.pushpull width-thick-thick
      
      
      
      
      
      kickf=[]   #kicktoe panel front
      kickf[0] = [0, 4.cm, 0]
      kickf[1] = [0, 4.cm+thick, 0]
      kickf[2] = [0, 4.cm+thick, kick]
      kickf[3] = [0, 4.cm, kick]
      kickf_base = entities.add_face kickf 
      kickf_base.pushpull -width
      
      
      kickb=[]   #kicktoe panel back
      kickb[0] = [0, depth-4.cm, 0]
      kickb[1] = [0, depth-4.cm-thick, 0]
      kickb[2] = [0, depth-4.cm-thick, kick]
      kickb[3] = [0, depth-4.cm, kick]
      kickb_base = entities.add_face kickb 
      kickb_base.pushpull -width
      

      #-----------------------------------------------------------------------------
      view = model.active_view
      view.zoom_extents
      #-----------------------------------------------------------------------------
      prompts = ["Door Height", "Top Rail Width", "Bottom Rail Width", "Stile Width" ]
      values = [100.cm, 10.cm, 10.cm, 3.3.cm]
      results = inputbox prompts, values, "Door Frame Dimensions"
      height, top, btm, sw = results
      #----------------------------------Do Left Door
      ld=[] #left style, left door
      ld[0] = [0, 0, kick]
      ld[1] = [0, 0, height]
      ld[2] = [0, thick, height]
      ld[3] = [0, thick, kick]
      ld_base = entities.add_face ld
      ld_base.pushpull -sw

      x = width/2-sw
      ld=[]    #right style, left door
      ld[0] = [x, 0, kick]
      ld[1] = [x, 0, height]
      ld[2] = [x, thick, height]
      ld[3] = [x, thick, kick]
      ld_base = entities.add_face ld 
      ld_base.pushpull -sw
      
      x = sw
      ld=[]    #top rail, left door
      ld[0] = [x, 0, height-top]
      ld[1] = [x, thick,height-top]
      ld[2] = [x, thick, height]
      ld[3] = [x, 0, height]
      ld_base = entities.add_face ld
      ld_base.pushpull width/2-sw-sw
      
      x = sw
      ld=[]    #btm rail, left door
      ld[0] = [x, 0, kick]
      ld[1] = [x, 0, kick+btm]
      ld[2] = [x, thick, kick+btm]
      ld[3] = [x, thick, kick]
      ld_base = entities.add_face ld 
      ld_base.pushpull width/2-sw-sw
      
      x = sw
      ld=[]    #glazing panel, left door
      ld[0] = [x, thick/2, height-top]
      ld[1] = [x, thick, height-top]
      ld[2] = [x, thick, kick+btm]
      ld[3] = [x, thick/2, kick+btm]
      ld_base = entities.add_face ld 
      ld_base.material = Sketchup::Color.new (236,201, 101)
      ld_base.material.alpha = 0.7 
      ld_base.pushpull width/2-sw-sw
      

      #----------------------------------- Do Right Door
      x = width/2+sw
      ld=[] #left style, right door
      ld[0] = [x, 0, kick]
      ld[1] = [x, 0, height]
      ld[2] = [x, thick, height]
      ld[3] = [x, thick, kick]
      ld_base = entities.add_face ld
      ld_base.pushpull sw

      x = width-sw
      ld=[]    #right style, right door
      ld[0] = [x, 0, kick]
      ld[1] = [x, 0, height]
      ld[2] = [x, thick, height]
      ld[3] = [x, thick, kick]
      ld_base = entities.add_face ld 
      ld_base.pushpull -sw
      
      x = width-sw
      ld=[]    #top rail, right door
      ld[0] = [x, 0, height-top]
      ld[1] = [x, thick,height-top]
      ld[2] = [x, thick, height]
      ld[3] = [x, 0, height]
      ld_base = entities.add_face ld
      ld_base.pushpull width/2-sw-sw
      
      x = width-sw
      ld=[]    #btm rail, right door
      ld[0] = [x, 0, kick]
      ld[1] = [x, 0, kick+btm]
      ld[2] = [x, thick, kick+btm]
      ld[3] = [x, thick, kick]
      ld_base = entities.add_face ld 
      ld_base.pushpull width/2-sw-sw
      
      x = width-sw
      ld=[]    #glazing panel, right door
      ld[0] = [x, thick/2, height-top]
      ld[1] = [x, thick, height-top]
      ld[2] = [x, thick, kick+btm]
      ld[3] = [x, thick/2, kick+btm]
      ld_base = entities.add_face ld 
      ld_base.material = Sketchup::Color.new (236,201, 101)
      ld_base.material.alpha = 0.7 
      ld_base.pushpull width/2-sw-sw
      

      #-----------------------------------------------------------------------------
      prompts = ["Counter Top Height", "Thickness", "Reveal"]
      values = [100.cm, 3.3.cm, 1.cm]
      results = inputbox prompts, values, "Countertop Optional"
      height, th, reveal = results

      top=[]   #countertop 
      top[0] = [0, thick, height]
      top[1] = [0, thick, height+reveal]
      top[2] = [0, 0, height+reveal]
      top[3] = [0, 0, height+th]
      top[4] = [0, depth, height+th]
      top[5] = [0, depth, height]
      top_base = entities.add_face top
      top_base.pushpull -width
      

      #-----------------------------------------------------------------------------
      model.commit_operation
      end
      #-----------------------------------------------------------------------------
      if( not file_loaded?("Cab.rb") )
      add_separator_to_menu("Plugins")
      UI.menu("Plugins").add_item("Cab") { create_cab }
      end
      #-----------------------------------------------------------------------------
      file_loaded("cab.rb")

      posted in Plugins
      B
      Brendon5374
    • Creating Components in Cab.rb

      Hi,

      We have started a kitchen making business, and I have been elected to the front office: quotes, customer relations, cold calls, MYOB accounts. And now, drawings. They can make their own coffee. I'm drawing the line at coffee. ha ha.

      I shoppped around on the internet and found the best one (user friendly) was free. By far, at least for a beginner!

      Carcasses is the thing I draw up the most that I make little mistakes with. So I wanted to automate it. I found cab.rb in the depot library, and changed the co-ordinates around to suit. I changed the middle panel to a back panel, and changed it around so that the side panels were not extensions of the kickers, etc. I thought I was quite the resoucesful one.

      My problem is that the drawing process and the feel of the the drawing has to reflect the actual cutting and putting together in the workshop. When I do it the slow way without Ruby I draw the lines for a single piece of timber, Select All, Make Component, then move to the next cut. If I do it in that sequence, then a cabinet will be all joined together (like in the workshop), but I will have the ability to highlight each component (each cut of wood), change it, colour it, measure it, or whatever.

      When I use Cab.rb, its like there was never that process, what appears is the whole cabinet as one as-yet single piece. Obviously it would be a waste for me to laboriously go back and select each line and each face of each peice of wood and press the "Make Component" button.

      I'm having trouble knowing the right words so I can search for the answer. Every time I looked up "Make Component" it took me back to the normal menu on the Sketchup page, and not ruby script.

      I hope there is a simple solution. Thanks in advance.

      Here is a bit of the script. I need each panel and each kicker and each door to be a single component:

      model = Sketchup.active_model
      model.start_operation "Create Cab"
      entities = model.active_entities
      group = entities.add_group
      entities = group.entities

      ls=[]   #left panel
      ls[0] = [0, depth, kick]
      ls[1] = [0, depth, height-thick]
      ls[2] = [0, thick, height-thick]
      ls[3] = [0, thick, kick]
      ls_base = entities.add_face ls
      ls_base.pushpull thick
      
      x = width-thick
      rs=[]   #right panel
      rs[0] = [x, depth, kick]
      rs[1] = [x, depth, height-thick]
      rs[2] = [x, thick, height-thick]
      rs[3] = [x, thick, kick]
      rs_base = entities.add_face rs
      rs_base.pushpull thick
      
      
      rp=[]   #rear panel
      rp[0] = [0, depth, kick]
      rp[1] = [0, depth+thick, kick]
      rp[2] = [0, depth+thick, height-thick]
      rp[3] = [0, depth, height-thick]
      rp_base = entities.add_face rp
      rp_base.pushpull -width
      
      top=[]   #top 
      top[0] = [thick, depth-10.cm, height-thick]
      top[1] = [thick, depth, height-thick]
      top[2] = [thick, depth, height-thick-thick]
      top[3] = [thick, depth-10.cm, height-thick-thick]
      top_base = entities.add_face top
      top_base.pushpull width-thick-thick
      
      btm=[]   #bottom shelf
      btm[0] = [thick, thick, kick+thick]
      btm[1] = [thick, depth, kick+thick]
      btm[2] = [thick, depth, kick+0]
      btm[3] = [thick, thick, kick+0]
      btm_base = entities.add_face btm
      btm_base.pushpull width-thick-thick
      
      
      
      kickf=[]   #kicktoe panel front
      kickf[0] = [0, 4.cm, 0]
      kickf[1] = [0, 4.cm+thick, 0]
      kickf[2] = [0, 4.cm+thick, kick]
      kickf[3] = [0, 4.cm, kick]
      kickf_base = entities.add_face kickf 
      kickf_base.pushpull -width
      
      kickb=[]   #kicktoe panel back
      kickb[0] = [0, depth-4.cm, 0]
      kickb[1] = [0, depth-4.cm-thick, 0]
      kickb[2] = [0, depth-4.cm-thick, kick]
      kickb[3] = [0, depth-4.cm, kick]
      kickb_base = entities.add_face kickb 
      kickb_base.pushpull -width
      

      #-----------------------------------------------------------------------------
      view = model.active_view
      view.zoom_extents ....

      posted in Developers' Forum
      B
      Brendon5374