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

    Empty groups get deleted?!

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 7 Posters 533 Views 7 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.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by

      @thomthom said:

      SketchUp will remove empty definitions from the model. Even definitions of ComponentInstances.

      definitions ??

      I thought it was empty instances that were GC'd ?

      I'm not here much anymore.

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

        It's a know way of removing an unused definition from the Component Browser without recourse to definitions.purge_unused, which of course might also remove components that the users has not yet got inserted, but would like to keep for later...
        definition.entities.clear!
        within a start/commit block will remove the definition.
        Similarly group.entities.clear!, although in that case group.erase! will work BUT can can fall foul of some new BIMish ill-advised entities-observers... πŸ˜’

        TIG

        1 Reply Last reply Reply Quote 0
        • thomthomT Offline
          thomthom
          last edited by

          @dan rathbun said:

          @thomthom said:

          SketchUp will remove empty definitions from the model. Even definitions of ComponentInstances.

          definitions ??

          I thought it was empty instances that were GC'd ?

          Instances are just references to definitions. And it's not garbage collection - if it had been then they would not have disappeared when you have reference to them. It's SketchUp cleaning up.

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @dan rathbun said:

            @thomthom said:

            SketchUp will remove empty definitions from the model. Even definitions of ComponentInstances.

            definitions ??

            I thought it was empty instances that were GC'd ?

            You're not talking about Ruby instances, right?

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • Dan RathbunD Offline
              Dan Rathbun
              last edited by

              No. Back on the topic of the OP,... he was asking about group instances that get GC'd before he can use them, because they are empty.

              I'm not here much anymore.

              1 Reply Last reply Reply Quote 0
              • thomthomT Offline
                thomthom
                last edited by

                Andreas as the first one to mention the GC. The OP only said the group was deleted - which is what happens to definitions when they are empty.

                @niccah said:

                okay, I insert now a small edge and hide the full group... when the user insert his first objects, I delete this line and make the group again visible...

                Why not create the group only right before you need to add something to it?

                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                List of my plugins and link to the CookieWare fund

                1 Reply Last reply Reply Quote 0
                • N Offline
                  niccah
                  last edited by

                  At first! Thank you very much again for all your comments! I'm always learning a lot, "listening" to your discussions!

                  @thomthom said:

                  Why not create the group only right before you need to add something to it?

                  Following idea:

                  • the user can create a "project" => so, in my code, I create at first an empty group
                  • all the projects will be listed in a table
                  • now, the user can add to a single project some "parts"

                  So, my current problem:

                  • user create a project, and then he / her starts to draw the "part" => during drawing, the empty project group will be removed by GC...

                  My hidden line in the groups works perfect! I know, it not realy smart, but...

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    That's where I ask: why do you need to create the group in advance before you actually make use of it? Seems to me it complicates things a little when you try to fight SketchUp for the group - slapping its wrist using hidden temp geometry.

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • N Offline
                      niccah
                      last edited by

                      @thomthom said:

                      That's where I ask: why do you need to create the group in advance before you actually make use of it? Seems to me it complicates things a little when you try to fight SketchUp for the group - slapping its wrist using hidden temp geometry.

                      πŸ˜„ Okay, let me "answer" with a new question - what can I do else? πŸ˜„ The user would like to create a project => so, somewhere I have to save this information about the projects (name, options, etc, ..). And the user could create a project and close Sketchup => so, the information about the new project has to be saved somewhere "for ever".

                      I realy agree, my way is realy complicated...

                      1 Reply Last reply Reply Quote 0
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by

                        OK major problem with your logic.

                        In Ruby you can cause the current editing context (the "project" group,) to be exited, via:
                        model#close_active()

                        BUT there is no API method to enter INTO an editing context. (You cannot cause the "project" group to become active for edit.)

                        I'm not here much anymore.

                        1 Reply Last reply Reply Quote 0
                        • Chris FullmerC Offline
                          Chris Fullmer
                          last edited by

                          @niccah said:

                          The user would like to create a project => so, somewhere I have to save this information about the projects (name, options, etc, ..). And the user could create a project and close Sketchup => so, the information about the new project has to be saved somewhere "for ever".

                          Use an attribute dictionary to attach information to the model. It will stay with it after the model is closed and opened.

                          Single Dictionatires
                          http://www.sketchup.com/intl/en/developer/docs/ourdoc/attributedictionary

                          Collections of multiple dictionaries
                          http://www.sketchup.com/intl/en/developer/docs/ourdoc/attributedictionaries

                          This is a much more stable way to maintain data in the model from session to session.

                          Chris

                          Lately you've been tan, suspicious for the winter.
                          All my Plugins I've written

                          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