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 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.
    • medeekM Offline
      medeek
      last edited by

      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
      • sdmitchS Offline
        sdmitch
        last edited by

        @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
        • TIGT Offline
          TIG Moderator
          last edited by

          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
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement