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

    Hide semantics

    Scheduled Pinned Locked Moved Developers' Forum
    20 Posts 4 Posters 529 Views 4 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.
    • chrisglasierC Offline
      chrisglasier
      last edited by

      @adamb said:

      @chrisglasier said:

      @tig said:

      B is visible inside A, but A is hidden so you can't see that !

      Exactly. The original assertion was that it was plain wrong, but I think semantically it must be correct; whether it is inconvenient is another matter.

      But thats my point. The meaning of the words "is visible" means to most people - "is this thing visible" and not "what is the value of some boolean inside the implementation".

      Reminds me of asking a programmer "Have you got the time?" and he says "yes". Not useful.

      Most people don't go ferreting around Ruby code; those that do should respect what ignoramus' like me respect as necessary pedantic semantics; that's all I was trying to put forward.

      Pinky

      With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

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

        To be pedantic you ask a question that doesn't have an answer... at least without 'qualification'...
        Is A visible ? Well any Entity -A- can either be visible or be not_visible in its own right.
        When A is in the Model that question is OK, since its context is the Model's Entities.
        When A is inside a Group or a Definition the question is also OK - provided that it has the unspoken qualification that also applies to the Model - "Is A visible, in its context ?" - of the Group/Definition's Entities...
        You cannot ask if A is visible when its 'in' an Instance - it is only ever 'in' a Definition. A Definition is really just like a sub-model that has Entities etc just like the main enclosing Model - the state [hidden et al] of an Entity within it is relative to those Entities NOT the main Model.
        You can ask if a particular Instance is visible [it is after all an Entity in its own right!], but then getting the answer tells you nothing about the state of that Instance's Definition's Entities - some of which could well be hidden too !

        TIG

        1 Reply Last reply Reply Quote 0
        • chrisglasierC Offline
          chrisglasier
          last edited by

          Oh, all I was suggesting is if my reading lamp is on but my black out curtains are drawn, those outside have no idea whether my lamp is on or off. So I think the more interesting question is when to know whether the lamp is on or off. And why?

          With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

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

            You can ask that very question, is the lamp on/off ? - but it is only useful in the context of the room.
            Having drawn the blinds makes the lamp's on/off state irrelevant to those who are outside, but it remains relevant to those still in the room ? πŸ’­

            TIG

            1 Reply Last reply Reply Quote 0
            • chrisglasierC Offline
              chrisglasier
              last edited by

              @tig said:

              You can ask that very question, is the lamp on/off ? - but it is only useful in the context of the room.
              Having drawn the blinds makes the lamp's on/off state irrelevant to those who are outside, but it remains relevant to those still in the room ? πŸ’­

              Exactly ... so the question remains why those outside need to know ... particularly AdamB.

              With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

              1 Reply Last reply Reply Quote 0
              • AdamBA Offline
                AdamB
                last edited by

                The huge missing method in SU, is being able to walk up hierarchy.

                Why I want to know, is I have a particular Component. I want to find all instances of that Component that are visible? Its essentially not possible without incredibly slow processing in SU.

                Developer of LightUp Click for website

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

                  
                  visible_components=[]
                  definition.instances.each{|instance|visible_components<<if instance.visible?}
                  ### visible_components is an array of all of that definition's instances that are visible ???
                  
                  

                  ??? πŸ€“

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • AdamBA Offline
                    AdamB
                    last edited by

                    Err, we're going around in circles here.

                    That snippet gives you all those instances that have visible?==true which is of zero use, since if the instance is inside something that is hidden, it too will be hidden.

                    The only way is to enumerate all instances then track back through the parts hierarchy for every instance - something the Ruby API cannot do.

                    But thanks for trying! πŸ˜„

                    Developer of LightUp Click for website

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

                      @adamb said:

                      Err, we're going around in circles here.

                      That snippet gives you all those instances that have visible?==true which is of zero use, since if the instance is inside something that is hidden, it too will be hidden.

                      The only way is to enumerate all instances then track back through the parts hierarchy for every instance - something the Ruby API cannot do.

                      But thanks for trying! πŸ˜„

                      You can only establish the visibility of Entities.
                      An Entity can be raw Geometry etc, Groups and Instances.
                      That is what my snippet does.
                      You can work out if an Entity within a Definition is visible [that will be the same in all Instances of the Definition], BUT as you said... you can't tell if a particular Instance of that Definition containing that Entity is itself visible. There is no connection between the Definition's Instance's visibility, except insofar that the Instance is of the Definition ! It's the same Entity that's within the Definition in every Instance of it !
                      Instances of a Definition are simply 'markers' that refer back to that Definition: these 'markers' are Entities that can have their visibility set... There are no 'parts' in an Instance. These 'parts' [Entities] exist only in the Definition that the Instance is 'marking'...

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • chrisglasierC Offline
                        chrisglasier
                        last edited by

                        @adamb said:

                        The only way is to enumerate all instances then track back through the parts hierarchy for every instance - something the Ruby API cannot do.

                        I just think this strengthens the case for identifying components in a web dialog - use callbacks to hide them individually or in groups, set up inheritance rules, almost anything really. Also use their ids + attributes for import, material count, Internet communication (including search). And get free from the restrictions of Sketchup's layer/outliner system.

                        With TBA interfaces we can analyse what is to be achieved so that IT can help with automation to achieve it.

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

                          Having slept on this... πŸ˜’
                          An Entity that is part of a Definition's Entities is a single 'thing'.
                          Instances of this Definition can be 'placed' within the Entities of a Model or even those of other Definition.
                          Instances are themselves 'Entities'...
                          These Instances are simply 'markers' and refer to the Definition - they have no 'contents' of their own.
                          Any properties that this Entity has [like visibility, material, layer etc] are set within the Definition's Entities and cannot be changed on an Instance by Instance basis as they don't exist.
                          Any Instance of the Definition containing this Entity can have individual properties [like visibility, material, layer etc] - some of these might even get reflected down the nesting - like 'material' which when changed on the Instance will affect the appearance of any contained Entities which have their material=nil, however the 'visible' property does not filter down.
                          Visible/hidden Entities within a Definition [that is seen as an Instance] remain visible/hidden independent of each Instance's 'visible' state - however, if the container Instance is 'hidden' then you cannot see it, and by logic you cannot see its contents - irrespective of whether or not they are visible/hidden within the Definition itself.
                          This is a logical setup.

                          Let's say you have Entity called A [an Entity is unique, but of course it might itself be just one Instance of a Definition].
                          'A' is within a Definition and there are 6 Instances of this Definition within an Entities set.
                          2 of these Instances are visible the other 4 are not.
                          Thus you can only 'see' 2 representations of A.
                          However, there are 6 representations of A 'available' in the scheme of things - so, how do you get the number of visible A's ?
                          Remember you can't refer to a particular A in a particular Instance because there is only one A and that's inside the Definition.
                          If you mined down into the contents of every Definition in the Model to find A you will eventually get just one parent Definition returned because every Entity is unique - however, if A were an Instance then finding its Definition and then that Definition's Instances would give us a list of all Instances equivalent to A - however, they are NOT A itself, but a list of Instances of A's Definition - we can't confuse Entity-A and Definition-of-Instance-A - this would just make it more complicated to find them all, but it's not impossible.
                          For now let's assume we have a simple Entity A, and we have its parent Definition, we can now find a list of all of that Definition's Instances, and then from this list we can get lists of all of those Instances that are visible/hidden.
                          Thus we can say that Entity A exists 6 times in the Entities set, that it is visible 2 time and that it is hidden 4 time, simply by looking at the lists we just made of the parent Definition's Instances visibility.
                          Since we know which are the Instances displaying A we can find each of their locations and thus the location of the 'ghost' of A within them, since we know where A is inside the Instance's Definition...
                          However, if Entity A were hidden in its Definition then it would be always hidden in every Instance we looked at, so in that case, irrespective of the containing Definition's Instance visibility, A is 'hidden' in all 6 cases even when its container is visible...

                          Not sure much of this is of any practical use... ❓

                          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