sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Exploding group removes material from a face

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 434 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.
    • G Offline
      gpavlidi
      last edited by

      Hi all,

      I 've encountered this issue where when I am exploding a group, it causes one of the Faces to lose its material, although it doesnt belong in the group.
      Is that an expected behavior, or is this a bug?

      Btw, the reason I am inserting each face, via a group that I explode, is because some of these faces might have holes, and carving out the holes, and then exploding the group is the most robust way I 've found so far that works.

      Thanks,
      Yanis

      Code snippet:

      inner = [[211.304795230314, 59.3387335473855, 144.121274015103], [198.016313479612, 93.8459200290483, 144.121274015103], [198.016313479612, 93.8459200290483, 209.586476052542], [211.304795230314, 59.3387335473855, 209.586476052542]]
      outer_right = [[123.368393800971, 287.689711452616, 222.214015434512], [124.599206984753, 284.49356753989, 222.214015434512], [124.599206984753, 284.49356753989, 7.04087985299685], [123.368393800971, 287.689711452616, 7.04087985299685]]
      outer_bottom = [[123.368393800971, 287.689711452616, 0.0], [123.368393800971, 287.689711452616, 7.04087985299685], [124.599206984753, 284.49356753989, 7.04087985299685], [278.931403899607, -116.27229864223, 7.04087985299685], [280.16221708339, -119.468442554957, 7.04087985299685], [280.16221708339, -119.468442554957, 0.0]]
      outer_left = [[278.931403899616, -116.272298642254, 222.214015434512], [280.16221708339, -119.468442554957, 222.214015434512], [280.16221708339, -119.468442554957, 7.04087985299685], [278.931403899607, -116.27229864223, 7.04087985299685]]
      outer_top = [[121.306929034951, 293.042869957925, 227.414539710024], [201.765305442185, 84.110634448818, 323.731055308166], [282.223681849419, -124.821601060289, 227.414539710024], [282.223681849419, -124.821601060289, 222.214015434512], [280.16221708339, -119.468442554957, 222.214015434512], [278.931403899616, -116.272298642254, 222.214015434512], [278.931403899616, -116.272298642254, 227.414539710024], [201.765305442185, 84.110634448818, 314.768300386351], [124.599206984753, 284.49356753989, 227.414539710024], [124.599206984753, 284.49356753989, 222.214015434512], [123.368393800971, 287.689711452616, 222.214015434512], [121.306929034951, 293.042869957925, 222.214015434512]]
      
      # place a textured inner face
      temp_group = Sketchup.active_model.entities.add_group
      inner_face = temp_group.entities.add_face inner
      material = Sketchup.active_model.materials.add "Test Material"
      material.color = 'red'
      inner_face.material = material
      temp_group.explode
      
      # place bounding faces
      temp_group = Sketchup.active_model.entities.add_group
      outer_right_face = temp_group.entities.add_face outer_right
      temp_group.explode
      
      temp_group = Sketchup.active_model.entities.add_group
      outer_bottom_face = temp_group.entities.add_face outer_bottom
      temp_group.explode
      
      temp_group = Sketchup.active_model.entities.add_group
      outer_left_face = temp_group.entities.add_face outer_left
      temp_group.explode
      
      temp_group = Sketchup.active_model.entities.add_group
      outer_top_face = temp_group.entities.add_face outer_top
      temp_group.explode
      
      # inner_face has lost it's material
      inner_face.material.nil?
      
      
      1 Reply Last reply Reply Quote 0
      • S Offline
        slbaumgartner
        last edited by

        I can reproduce this but can't explain it. Seems like a bug to me!

        1 Reply Last reply Reply Quote 0
        • G Offline
          gpavlidi
          last edited by

          Thanks slbaumgartner, this is what I thought too.
          Can an admin maybe move this to the 'Report a Bug' subforum?
          Maybe some SU folks out there will notice.

          1 Reply Last reply Reply Quote 0
          • TIGT Offline
            TIG Moderator
            last edited by

            	inner = [[211.304795230314, 59.3387335473855, 144.121274015103], [198.016313479612, 93.8459200290483, 144.121274015103], [198.016313479612, 93.8459200290483, 209.586476052542], [211.304795230314, 59.3387335473855, 209.586476052542]]
            	
                outer_right = [[123.368393800971, 287.689711452616, 222.214015434512], [124.599206984753, 284.49356753989, 222.214015434512], [124.599206984753, 284.49356753989, 7.04087985299685], [123.368393800971, 287.689711452616, 7.04087985299685]]
            	
                outer_bottom = [[123.368393800971, 287.689711452616, 0.0], [123.368393800971, 287.689711452616, 7.04087985299685], [124.599206984753, 284.49356753989, 7.04087985299685], [278.931403899607, -116.27229864223, 7.04087985299685], [280.16221708339, -119.468442554957, 7.04087985299685], [280.16221708339, -119.468442554957, 0.0]]
            	
                outer_left = [[278.931403899616, -116.272298642254, 222.214015434512], [280.16221708339, -119.468442554957, 222.214015434512], [280.16221708339, -119.468442554957, 7.04087985299685], [278.931403899607, -116.27229864223, 7.04087985299685]]
            	
                outer_top = [[121.306929034951, 293.042869957925, 227.414539710024], [201.765305442185, 84.110634448818, 323.731055308166], [282.223681849419, -124.821601060289, 227.414539710024], [282.223681849419, -124.821601060289, 222.214015434512], [280.16221708339, -119.468442554957, 222.214015434512], [278.931403899616, -116.272298642254, 222.214015434512], [278.931403899616, -116.272298642254, 227.414539710024], [201.765305442185, 84.110634448818, 314.768300386351], [124.599206984753, 284.49356753989, 227.414539710024], [124.599206984753, 284.49356753989, 222.214015434512], [123.368393800971, 287.689711452616, 222.214015434512], [121.306929034951, 293.042869957925, 222.214015434512]]
            
                # place bounding faces
                temp_group = Sketchup.active_model.entities.add_group
                outer_right_face = temp_group.entities.add_face outer_right
                temp_group.explode
            
                temp_group = Sketchup.active_model.entities.add_group
                outer_bottom_face = temp_group.entities.add_face outer_bottom
                temp_group.explode
            
                temp_group = Sketchup.active_model.entities.add_group
                outer_left_face = temp_group.entities.add_face outer_left
                temp_group.explode
                temp_group = Sketchup.active_model.entities.add_group
                outer_top_face = temp_group.entities.add_face outer_top
            	edges=temp_group.entities.grep(Sketchup;;Edge)
                temp_group.explode
            ###
            edges.each{|e| e.find_faces if e.valid?}
            
                # place a textured inner face
                temp_group = Sketchup.active_model.entities.add_group
                inner_face = temp_group.entities.add_face inner
                temp_group.explode
                ( material = Sketchup.active_model.materials.add("Red") ) unless material=Sketchup.active_model.materials["Red"]
            	material.color="Red"
            	# make 'red' once only
                inner_face.material = material
            
            ###
            # inner_face.erase! ### alternative
            
                # inner_face has lost it's material
                puts inner_face.material
            	
            
            

            This works.
            It adds a face within the overall form too.
            The 'window' is colored after the explosion.
            Note how I also only make a 'Red' material once.
            You could erase the 'window' instead of making it 'Red'...
            The order of operations and exploding groups affects the result, but knowing that you can avoid it.

            TIG

            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