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

Add an array of entities to an existing group?

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 3 Posters 2.8k Views
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.
  • M Offline
    medeek
    last edited by 6 Mar 2018, 06:48

    Normally I add a group of entities (groups and components in an array) to my large assembly group with this single line of code:

    @maingroup = Sketchup.active_model.entities.add_group(@all_trusses)

    Instead I would like to add my array of entitities “@all_trusses” to an existing group that has already been created and is essentially empty except for a small place holder entity in it to prevent it from being garbage collected.

    Nathaniel P. Wilkerson PE
    Medeek Engineering Inc
    design.medeek.com

    1 Reply Last reply Reply Quote 0
    • S Offline
      sdmitch
      last edited by 6 Mar 2018, 15:42

      @medeek said:

      Normally I add a group of entities (groups and components in an array) to my large assembly group with this single line of code:

      @maingroup = Sketchup.active_model.entities.add_group(@all_trusses)

      Instead I would like to add my array of entitities “@all_trusses” to an existing group that has already been created and is essentially empty except for a small place holder entity in it to prevent it from being garbage collected.

      How about

      @existinggroup.entities.add_group(@all_trusses)
      

      Nothing is worthless, it can always be used as a bad example.

      http://sdmitch.blogspot.com/

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 6 Mar 2018, 20:23

        Unfortunately, if the model.active_entities is not the @existinggroup.entities context and/or the array of added entities is not in that same context, then a BUgSplat! awaits...
        You cannot 'cross-thread' entities across contexts...

        TIG

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

        Advertisement