• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

Global transformation of a selected nested face

Scheduled Pinned Locked Moved Developers' Forum
10 Posts 4 Posters 1.1k 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.
  • T Offline
    tomasz
    last edited by 9 Nov 2008, 18:29

    Hi,
    Is there a way to find out a global transformation of a selected face?
    When I try face.parent I get a component (group) definition.
    Is there a way to get an instance inside which the face has been selected?

    Thanks
    Tomasz

    Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

    1 Reply Last reply Reply Quote 0
    • T Offline
      tomasz
      last edited by 9 Nov 2008, 19:42

      I have found a possible workaround through ray-casting, but I think it is valid only in a new tool and won't work well with a basic selection. It would be also awkward to cast a ray few milimeters off the face in an opposite direction to a normal .. hoping to hit the face.. not an opening .

      It would be extremely nice to have a Ruby method Sketchup.active_model.active_entity (not entities) which would return an active group or component instance.

      Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

      1 Reply Last reply Reply Quote 0
      • T Online
        TIG Moderator
        last edited by 9 Nov 2008, 21:06

        I think you need to you multiply the transformation of the given instance/group by what you want the contained face to be 'moved' to ... and it should then match your aspirations [tran1 * tran2... ?]...

        .

        TIG

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by 9 Nov 2008, 21:26

          I think Tomasz needs to get the instance of the face's container - a Group in this case - in order to get it's transformation to which the face's normal is relative to. And I don't know how to do it, but I haven't given it much effort.

          Hi

          1 Reply Last reply Reply Quote 0
          • T Offline
            tomasz
            last edited by 9 Nov 2008, 21:49

            @jim said:

            I think Tomasz needs to get the instance of the face's container

            Yep, that's it Jim.

            Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

            1 Reply Last reply Reply Quote 0
            • C Offline
              CPhillips
              last edited by 9 Nov 2008, 22:20

              I am not totally sure about this but it might not be possible. I believe that you cant actually select a face in an instance. What you are really doing is selecting a face in the definition. So as far as Sketchup is concerned all instances have that face selected.

              There might be a work around depending on what you are trying to do.

              1 Reply Last reply Reply Quote 0
              • T Online
                TIG Moderator
                last edited by 9 Nov 2008, 22:41

                To find the instance of a group that is given by its definition that you have got through parent use

                face.parent.instances[0]
                
                • there's only one instance of a group definition - groups are unique !

                .

                TIG

                1 Reply Last reply Reply Quote 0
                • C Offline
                  CPhillips
                  last edited by 10 Nov 2008, 05:30

                  Groups are usually unique. Sometimes they are not. Count instances in the definition to be sure and then call make_unique.

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    tomasz
                    last edited by 10 Nov 2008, 19:57

                    Thanks for all help. It is rather an academic dilemma for me. I wanted to be sure it is valid to put it on Ruby API wish-list.

                    From what you have all written there is no way to find out where an user is in a tree of transformations. Only if an user selects an instance, not a face inside a component, it is possible to find out all parents of an instance and - as a result, calculate global coordinates of a all vertices in a component. Am I right?

                    It would be very useful if SU could return an array of all parent entities as it can do when using ray-casting method - simply to provide current location within outliner tree.

                    Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                    1 Reply Last reply Reply Quote 0
                    • C Offline
                      CPhillips
                      last edited by 10 Nov 2008, 21:42

                      It depends on what you mean by "where the user is". If your user has just clicked on something you can find out the top level instance and then figure out the transform of the object in that instance.

                      If your user has "opened" the object its a little trickier but you can find the top instance through an observer.

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

                      Advertisement