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

    Posts

    Recent Best Controversial
    • RE: Changing part of a geometry from dc attribute

      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
      
      posted in Dynamic Components
      D
      dumarjo
    • RE: Changing part of a geometry from dc attribute

      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

      posted in Dynamic Components
      D
      dumarjo
    • RE: Changing part of a geometry from dc attribute

      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

      posted in Dynamic Components
      D
      dumarjo
    • Changing part of a geometry from dc attribute

      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

      posted in Dynamic Components sketchup
      D
      dumarjo
    • 1 / 1