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

    [ruby request\question]nesting visibility toggle

    Scheduled Pinned Locked Moved Plugins
    10 Posts 5 Posters 448 Views 5 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.
    • R Offline
      rv1974
      last edited by

      Is it possible to create ruby that would show (toggle in additive mode with one shortcut key) the rest of the model by 'nesting level'?
      Let's say I'm editing the deepest component (the smallest matreshka doll) within the component within the component etc.
      Now I'd like to (klicking the same shortcut) see the rest of dolls one by one in 'add mode'. Is it doable?

      http://dollsmag.com/wp-content/uploads/2011/05/1234383288_matrioshka-med1.jpg

      http://static3.depositphotos.com/1000586/110/i/450/dep_1102632-Matreshka-line-russian-doll.jpg

      1 Reply Last reply Reply Quote 0
      • renderizaR Offline
        renderiza
        last edited by

        Well there is always the option to make different scenes and updating the hidden geometry with the scene manager accordingly to what you want to accomplish.

        If you still want to assign a single key to toggle the visibility of nested groups then you might want to study “knightgame.rb” by Scott Lininger. In his scrip he says the following;

        “# Change the visibility of the Hero components based on the current frame.”

        for subentity in entity.definition.entities

        	if subentity.definition.name == params['frame']
        		subentity.hidden = false
        	else
        		subentity.hidden = true
        	end
        end
        

        ^^^
        I have no experience in scripting since I only started to learn some ruby a few days ago so I can’t be of much help but maybe someone else could make some sense on the code above.

        Good luck!

        [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

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

          @rv1974 said:

          Now I'd like to (klicking the same shortcut) see the rest of dolls one by one in 'add mode'.

          What is "add mode" ??

          When you are in edit mode, is "Hide rest of model" ON ??

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • R Offline
            rv1974
            last edited by

            @dan rathbun said:

            @rv1974 said:

            Now I'd like to (klicking the same shortcut) see the rest of dolls one by one in 'add mode'.

            What is "add mode" ??

            When you are in edit mode, is "Hide rest of model" ON ??

            1. Yes, the rest of model is hidden.
            2. 'add' mode' (maybe not so successful term?) is unveiling the rest of the model by it's hierarchy layers.
              Example: You're editing the component 'flea' that is nested in the component 'hair' nested in comp 'tail' nested in comp 'dog' nested in comp 'doghouse'. The rest of the model is constantly hidden.
              Now You'd hit desired shortcut key (for example F12 )to show the 'hair' component . As result you see the editing flea and the 'hair' comp. Now you'd hit once again the same F12: the component tail is shown in addition
              to the 'hair' component. Yet another F12 hit: now you see the next hierarchy layer (the dog) in addition to the hair and the tail. the 3rd F12 hit: the the hair+tale+dog+doghouse component is unveiled. the 4th F12 would start the loop from the beginning: the rest of the model is completely hidden (the only thing you see is a lonely handsome flea)
              Hope the flea helps..
            1 Reply Last reply Reply Quote 0
            • Dave RD Offline
              Dave R
              last edited by

              Interesting idea. I find it extremely difficult to edit a component with the rest of the model hidden because I am almost always using other parts of the model for inferencing. I can see where this could be a useful tool, though. How about F11 reversing the steps?

              Etaoin Shrdlu

              %

              (THERE'S NO PLACE LIKE)

              G28 X0.0 Y0.0 Z0.0

              M30

              %

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

                So... to put it another way... when your 'editing-context' is not the model, you want to be able to hide everything in the context's below the current edit-context.
                I think we need four tools - 1. hide all, 2. hide none, 3. un-hide stepping down, 4. hide stepping up.

                Let's take the 'flea in tail in dog in model' schema.

                You edit the flea'

                1. hides 'everything' except the active-flea.
                2. un-hides 'everything' previously hidden by 1 [i.e. the entire model becomes visible again].
                3. assuming 'everything' is hidden, the container of the active-flea [i.e. tail] also becomes visible, but nothing else in the hierarchy can be seen; if tool 3. is repeated then the container of the 'tail' [the 'dog'] becomes visible, right back down the hierarchy to the entire model being made visible.
                4. assuming 'everything' is currently visible, the 'base' container [i.e. the model] is now hidden, but everything else in the hierarchy can be seen; if tool 4. is repeated then each container is hidden up the hierarchy until only the 'flea' is visible.

                This sounds quite simple...
                However, in practice it requires convoluted 'housekeeping'.
                Forst off hidden geometry needs to be forced 'off' during the processing.
                To hide everything except the flea means you must hide the contents of the tail-instance except-for-the-flea, then you must hide the contents of the dog-instance except for the tail-instance [hiding the tail would also hide the flea !] then you must hide the contents of the model except for the dog-instance. Each 'stepping-visibilies' then needs to keep track of what was hidden/unhidden - also remembering that already hidden objects need to be conserved in the processing.
                This all needs 'remembering' robustly so that on an exit of the edit the status quo is restored as it was !
                I'm sure it's possible: just very complex to trap and make robust. 😕

                Perhaps a v9 enhancement ?

                TIG

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

                  .. and I see the global edit mode "Hide Rest of Model" interfering with such a feature.

                  The current rendering options setting for this would need saving, adjustment, and restoration, when done.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • renderizaR Offline
                    renderiza
                    last edited by

                    Giving that the solution towards hiding everything except the flea interferes with “Hide Rest of Model”, could the solution possibly be to find a way in temporarily copy & “pasting in place” the “flea” outside of the current group you’re going to hide automatically with a script?

                    That way the process of hiding the group without the wanted subgroup will be faked. But I bet that will take the fun out in figuring out how to not fake the process. 😉

                    [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      rv1974
                      last edited by

                      Unfortunatly, copy-pasting means freezing.
                      Something flawless is needed (by TIG and Dan if I got it right it should be a part of program itself)

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

                        The "Hide Rest of Model" issue is not a show-stopper, it's just a step that needs to be dealt with.

                        Keep in mind when your not in edit mode, things are simple. The challenge comes when in edit mode, because we can exit an editing context with the API, but not enter (or change,) an editing context via the API.

                        I'm not here much anymore.

                        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