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

    [Plugin] Position Explorer (Update 12 Feb 2010)

    Scheduled Pinned Locked Moved Plugins
    8 Posts 6 Posters 9.2k Views 6 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.
    • G Offline
      gbabcock
      last edited by gbabcock

      Update 12 Feb 2010

      Change log

      - added ability to get the global positon of vertices in groups/components (1st instance only)

      - improved formatting of output

      - added vertices only option

      A key new feature is the ability to find the global position of vertices that are inside unopened and/or nested Groups/Components. As an example, if you create a cube then Group it, and you have a plugin that tries to get the position of the vertices using .position, the results will be relative to the Group (local space), not the model (global space). This plugin has a feature which can find all parent Groups/Components and stack their Transformations onto the vertex position to get the global position.

      ===============================================================

      As I have struggled up the learning curve on writing SU plugins, I discovered that understanding how SU computes the location of things is quite complex! For instance, you might have a Group of objects, and that Group may be nested in another Group. Each Group has Transformations, and if you open a Group you get "local" positions! Then you have scaling, rotation...

      This plugin is really just a tool for developers to explore the position of objects in real time. You right-click (context-click) on an object or objects, and it will run a report to the Ruby Console. It has helped me to learn about the inner workings of SU.

      All functionality is accessed through the context menu, and the output goes to the Ruby Console. Currently there are four choices:

      • Position Report (position information about selection)* Position Report Recursive (includes all nested objects in selection)* Position Report Recursive, No Faces (same as previous but Faces are skipped to reduce duplicate vertices)* Position Report Detailed Recursive (provides additional details besides position)
        Here is a excerpt from a sample Position Report Recursive:

      ****** Begin Position Report Thu Feb 11 22:04:00 Eastern Standard Time 2010 *****
      Options: Recursive(true), Faces(true), Detail(false)

      #Sketchup::Group:0xcdf4b10; ID:146; Name=; contains 19 entities
      Group Transformation:
      1.0 : 0.0 : 0.0 : 0.0
      0.0 : 1.0 : 0.0 : 0.0
      0.0 : 0.0 : 1.0 : 0.0
      14.1858552430346 : 28.7146355916016 : 0.0 : 1.0
      Entities in Group ID:146:
      #Sketchup::Edge:0xcdcdcd8; ID:138
      Vert ID:97 [0].position = (20.435683", 40.376235", 0")
      Vert ID:122 [1].position = (20.435683", 40.376235", 3.61414")
      #Sketchup::Edge:0xcdcddb0; ID:131
      Vert ID:93 [0].position = (9.152105", 40.376235", 0")
      Vert ID:118 [1].position = (9.152105", 40.376235", 3.61414")*

      (Note: The formatting doesn't show up well here)

      I'm finding that the recursive feature really helps to understand the relative position of objects in groups and components. Try creating a box, group it, then create a second box and create a new group of the first and second boxes, then experiment with opening the top group, then the nested group, and checking positions.

      Be careful with using recursive mode on objects with many entities! It will report on EVERY face, edge and their associated vertices.

      More features are planned, including formatted reporting and saving to a file.

      Let me know what you think.

      Glenn


      Position Explorer 12 Feb 2010 Update

      Glenn

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

        Yea - the swap between local and global position as you open and close grops/components can bite your in the rear end some times.
        Sounds like an interesting tool. πŸ‘

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

        1 Reply Last reply Reply Quote 0
        • J Offline
          Jim
          last edited by

          I know one thing that adds to the confusion is that when you have a Group open for editing, the positions are reported relative to the Global axes, and not the Group's axes.

          Hi

          1 Reply Last reply Reply Quote 0
          • G Offline
            gbabcock
            last edited by

            @jim said:

            I know one thing that adds to the confusion is that when you have a Group open for editing, the positions are reported relative to the Global axes, and not the Group's axes.

            Yes, that was driving me crazy with SketchyFFD. I'd open a group and check positions through the Ruby Console, then put that code into a plugin and watch it act completely differently! Once I figured out what was causing that, I was able to fix it, but it was still hard to visualize, especially with nested groups/components.

            Glenn

            Glenn

            1 Reply Last reply Reply Quote 0
            • G Offline
              gbabcock
              last edited by

              Update 1 posted, see top of thread.

              Glenn

              Glenn

              1 Reply Last reply Reply Quote 0
              • J Offline
                J.Park
                last edited by

                Hi, I have a question about the positions / coordinates within sketchup. I am not a software engineer/ programmer, but I have an idea of which I want to check the technical feasibility. I want to build a model with standardised components using SketchUp 7 (free version). In these components I added a CPoint.
                When I have built my project with the components, I want to extract all the following data:
                Componentname Componentrotation Globalposition of CPoint X, Y, Z (projectposition. 1 component can have multiple instances. I want to extract every single instance with its own unique position)

                Can you tell me: Can this be done? (and if not, do you have any suggestions?)

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

                  @j.park said:

                  Hi, I have a question about the positions / coordinates within sketchup. I am not a software engineer/ programmer, but I have an idea of which I want to check the technical feasibility. I want to build a model with standardised components using SketchUp 7 (free version). In these components I added a CPoint.
                  When I have built my project with the components, I want to extract all the following data:
                  Componentname Componentrotation Globalposition of CPoint X, Y, Z (projectposition. 1 component can have multiple instances. I want to extract every single instance with its own unique position)
                  Can you tell me: Can this be done? (and if not, do you have any suggestions?)

                  Search for 'Transformation'...
                  You get the cpoint's position in the definition, then get each instance's transformation, then transform the cpoint's position by that instance's transformation - this gives you the location in the model of the cpoint that's in that instance... Ifinstances are inside another container [group/instance] other than the model you need to get their transformations too and apply them 'combined' tr1 * tr0 etc [in reverse order].
                  Repeat for each of the definition.instances
                  There are also ways of getting an instance's rotation from its trasformation.

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • liquid98L Offline
                    liquid98
                    last edited by

                    Glenn, Thnx! πŸ˜„

                    This script was really helpful to me and instructive too!

                    Things that flourish fall into decay. This is not-Tao, And what is not-Tao soon ends ~ Lao tse

                    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