sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Changing part of a geometry from dc attribute

    Scheduled Pinned Locked Moved Dynamic Components
    sketchup
    7 Posts 3 Posters 1.4k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D Offline
      dumarjo
      last edited by

      HI,

      I try to modify a DC part. I have a polygon, and I would like to change some part of the polygone with DC attributes.

      I have put in attachement the skp of the polygone I would like to change.

      I would love changing th x1 and y1 from the attributes.

      Is it possible to do this ?

      Regards

      Jonathan


      testDC.skp

      1 Reply Last reply Reply Quote 0
      • Dave RD Offline
        Dave R
        last edited by

        You could divide the panel into two different components and change the dimension of each to change X and Y. The downside is if you want to generate a cutlist from the model, the panel will be shown as two different parts rather than just one.

        How many different toe kick dimensions would you have? If it's only two or three, you could make different components each with a different notch size and then choose which one to show and which to hide. I did that some time back with a dining table that is available in three different lengths. Since the shape of the table top couldn't be scaled, I just put each of the three different tops in the Dynamic Component. When the user selected the length of the table, the appropriate top was displayed. The benefit of this is that the top shows as a single component in the model.

        Etaoin Shrdlu

        %

        (THERE'S NO PLACE LIKE)

        G28 X0.0 Y0.0 Z0.0

        M30

        %

        1 Reply Last reply Reply Quote 0
        • D Offline
          dumarjo
          last edited by

          hi,

          This is the conclusion that I came of. The toekick shouldn't be too much different from one cabinet to others.

          From your comment, we can't do this ith DC directly ?

          Regards
          Jonathan

          1 Reply Last reply Reply Quote 0
          • P Offline
            pcmoor
            last edited by

            Hi Jonathan

            If you decide to make the DC using sub groups, then I recommend you make them out of solids so that if you want to 3D print, CAM or BOM, then you can convert to single object using the outer shell command (right click for context menu).

            So hide rather than delete shared faces and lines. Where you require an outline use a cubic shape with one or two axis length set to zero and hide other lines where necessary. for multi hidden sub groups that are not part of finish have all their length attributes =0 and position so it will become part of the final shape on either explosion or use of the outer shell command. (sample attribute in form ...X =if(Hidden,0,parent!LenX-LenX)

            attached sample
            The first side is made of two groups with no hidden geometry, on using the outer shell command they become one, the obvious common lines are deleted.

            The second is more involved, using 3 solid groups, it likewise can be changed to a single group of geometry using the outer shell. The outline is a solid group with its Z length set to "zero" (very small)

            Lots to think about?
            Cheers
            Philip


            two examples

            1 Reply Last reply Reply Quote 0
            • D Offline
              dumarjo
              last edited by

              Hi,

              Well i' don't quit understand what you said πŸ˜„

              I see in the sample that all 3 model are a multipart. The first one is the first thing I have in my head. The easiest one. When I try to use the cutlist plugin, it' see 3 part. That's normal. I If I use the outer shell is working. The problem is when we want to have more than one par in a component (like a base cabinet) we have to go thru each cabinet, edit it and to the outer shell command for all the panel.

              Probably we can overcome this with a ruby command.

              @pcmoor said:

              Lots to think about?
              Cheers
              Philip

              yes this is alot !

              thanx for your time and effort to help me with this !

              Regards

              Jonathan

              1 Reply Last reply Reply Quote 0
              • D Offline
                dumarjo
                last edited by

                Hi,
                Another question. Is it possible to add an part created in ruby to an component ?

                I did a ruby script that create this part, but I wonder if this can be included in a DC component ?

                I see that I can call a ruby script from the DC, but I have not been able to add this part to the DC itself. I can only create the part and add it to the model and not to the the selected component.

                I'm new to ruby too so it's a little bit complicated.

                Here what I did to create the part from the ruby script.

                require 'sketchup.rb'
                
                class DCFunctionsV1
                protected
                  def createside(param_array)
                    mod = Sketchup.active_model # Open model
                    ent = mod.entities # All entities in model
                    sel = mod.selection # Current selection
                    
                    lheight = param_array[0]
                    llength = param_array[1]
                    ltoeheigth = param_array[2]
                    ltoelength = param_array[3]
                    lwidth = param_array[4]
                    printf("heigth = %d\n", lheight)
                    printf("length = %d\n", llength)
                    printf("toe heigth = %d\n", ltoeheigth)
                    printf("toe length = %d\n", ltoelength)
                    printf("width = %f\n", lwidth)
                    # Create a series of "points", each a 3-item array containing x, y, and z.  
                  
                    pt = []
                    pt[0] = [0, 0, 0]
                    pt[1] = [0, 0, lheight.to_f]
                    pt[2] = [llength.to_f, 0, lheight.to_f]
                    pt[3] = [llength.to_f, 0, ltoeheigth.to_f]
                    pt[4] = [llength.to_f - ltoelength.to_f, 0, ltoeheigth.to_f]
                    pt[5] = [llength.to_f - ltoelength.to_f, 0, 0]
                
                    new_comp_def = mod.definitions.add("BCSide") ; 
                
                  # Call methods on the Entities collection to draw stuff.
                    new_face = new_comp_def.entities.add_face(pt) ; # returns a Face
                    new_face.reverse! if new_face.normal.z < 0 ; # flip face to up if facing down
                    new_face.pushpull(lwidth.to_f)
                  
                    trans = Geom;;Transformation.new
                  
                    mod.active_entities.add_instance(new_comp_def, trans) ;
                    #UI.messagebox("heigth = " + lheight.to_s)
                    return "ok"
                  end
                end
                
                1 Reply Last reply Reply Quote 0
                • P Offline
                  pcmoor
                  last edited by

                  Hi

                  With regards ruby it would pay to post your enquiry in the developers' forum to get more responses

                  Personally I am in a similar position, learning ruby, building DC to be used with code, interest is framing

                  With regards swapping, and cut list
                  consider the example again with a group of Right end components
                  if you copy the side DC and replace the geometry within one of the Right ends with it, set the DC to required parameters, then right click, outer shell then explode, all updated and can be seen as complete in cut list

                  Cheers
                  Philip


                  sides.skp

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Buy SketchPlus
                  Buy SUbD
                  Buy WrapR
                  Buy eBook
                  Buy Modelur
                  Buy Vertex Tools
                  Buy SketchCuisine
                  Buy FormFonts

                  Advertisement