sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Bugsplat in Sketchup 2017 when manipulating groups

    Scheduled Pinned Locked Moved Developers' Forum
    2 Posts 2 Posters 671 Views 2 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.
    • A Offline
      alexmojaki
      last edited by

      I'm the author of the SunHours extension. Using the extension in Sketchup 2017 causes it to crash. Many users have emailed me about this but there's not much I can do since the bug is in Sketchup. I've narrowed the problem down to a minimal snippet of code which causes the crash:

      
      model = Sketchup.active_model
      model.start_operation("BOOM", true)
      
      entities = model.entities
      face = entities.to_a.select{ |ent| ent.is_a? Sketchup;;Face }[0]
      group = entities.add_group([face])
      group2 = entities.add_group([group])
      group.explode
      face = group2.entities.to_a.select{ |ent| ent.is_a? Sketchup;;Face }[0]
      group2.explode
      entities.add_group([face])
      
      model.commit_operation
      
      

      Creating a model with a single face and running that snippet in the Ruby Console will crash Sketchup with a bugsplat. Removing any single line (I think, I may have missed one) of the snippet will prevent the crash. I know the code looks strange and contrived but it is derived from real code (with lots of things in between removed) and the structure of creating and exploding groups is necessary.

      Please let me know if an update is released which fixes this issue.

      I'm on OSX but I don't think this is OS dependent.

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

        Unfortunately v2017 changes the way references can be got and reused.
        A few pointers...
        Use: entities = model.**active_**entities
        Also you can 'grep' to filter many kinds of 'collections' thus:
        puts face = entities.grep(Sketchup::Face)[0] return nil unless face
        The 'face' reference is lost in v2017 after the 'explode', instead consider this...
        group.explode puts face = group2.explode.grep(Sketchup::Face)[0]
        Now 'face' is a different, but valid, reference...
        I added the 'puts' to print the references in the Ruby Console.
        In < v2017 they should be the same, but in v2017 they will differ.
        This issue has meant that many authors have had to recode some of their plugins to accommodate the changes...

        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