Sketchup Bugsplat on modify the entities group

Create Box >>> Modify Box >>> Close Sketchup = Bugsplat

module Ahmad2020
  module Pondasi

    extend self

    KUNCI ||= Module.nesting[0].name.gsub('::','_')

    def create_box
      #Create the group and set attributes
      ents = Sketchup.active_model.entities
      car_group = ents.add_group

      main_face = car_group.entities.add_face(
        [0,0,0], [6,0,0], [6,8,0], [0,8,0]
      )
      main_face.reverse!
      main_face.pushpull(5)

      car_group.set_attribute(KUNCI, "bebas", "bebas")
    end

    def modify_box
      # Get attributes and Change entities
      groups = Sketchup.active_model.entities.grep(Sketchup::Group)
      groups.select! {|e| e.attribute_dictionary(KUNCI) }

      groups.each {|e|
        old  = e.entities.to_a
        temp = e.entities.add_group(old)
        main_face = e.entities.add_face(
          [0,0,0], [6,0,0], [6,8,0], [0,8,0]
        )
        main_face.reverse!
        main_face.pushpull(10)
        temp.erase!
      }
    end

    if !defined?(@loaded)
      menu = UI.menu("Plugins").add_submenu(KUNCI.gsub('_',' '))
      menu.add_item('Create Box') { create_box() }
      menu.add_item('Modify Box') { modify_box() }
      @loaded = true
    end

  end
end

I did not get a BugSplat! with SketchUp 2020.2.172, nor 2021.1.299 (on Windows.)

problem

Your code appears to have created an invalid geometry. Try to check Model Info>>Statistics>>Fix Problem before you quit.

On Windows only, you can call it by using this:

Sketchup.send_action(21124)

(I do not have BugSplat! either! )

Just a theory, but I wonder if the issue is with creating a new group using entities from the same group?

1 Like