sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Componant axes

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 4 Posters 274 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.
    • A Offline
      adebeo
      last edited by

      Hi all,
      He's there someone who have a simple method to retrieve the x,y,z of a 3D point in a group or in a componant according to the axes of the model ?
      thanks

      adebeo
      Nos Formations sketchup
      Notre blog : www .adebeo.com/wp/
      Nos tutoriels: www .youtube.com/adebeo

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

        Is the component open or closed when you get your 3d point information? SU transforms the open component/group into world coordinates.

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

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

          Otherwise... you know the container's transformation and you can apply that to the point in the group to give 'world' coordinates... If things are nested you'll need to applying each context's transformation to get back to the base model's coordinates...
          There are also methods like group.transformation.origin to give the group's insertion point in its current context (but [0,0,0] in the group itself)...

          TIG

          1 Reply Last reply Reply Quote 0
          • A Offline
            adebeo
            last edited by

            Thanks for yours answer.

            Because of my english I'm not sure of youre answer.

            My plugin make an array of all edges in the model including edges inside group and componant. for each edge it find coordinates of strat and end point od edge. But for edge inside group and componant ".position" give me the local coordinate. And I want global coordinate.

            Thomthom solution: I need to open the group or componant to retrive is coordinate
            TIG solution: I should use the componentinstance.transformation and apply transformation to the point.position.

            I finaly apply TIG solution and it's works . Thanks.

            adebeo
            Nos Formations sketchup
            Notre blog : www .adebeo.com/wp/
            Nos tutoriels: www .youtube.com/adebeo

            1 Reply Last reply Reply Quote 0
            • C Offline
              Chris88
              last edited by

              Hey,

              i want to load 2 - 4 components in SU.
              My Problem:
              How can i put these componets together, without hardcoding the coordinates?

              For example:
              I want to set a driller on a cuboid, then i need the coordinates of
              the edges to know how big the components are, right?
              Unfortunately i don't know any method to retrieve these values πŸ˜’

              Or is there another way to avoid the hardcoded way?

              Greets

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

                You add the components - each as a new definition, to the model.definitions list.
                Then use say model.active_entities.add_instance(definition, transformation).
                The 'transformation' is premade by you to locate the instance where you want - it can also include rotations, scaling etc...
                You can also use instance.transform!(tr) later to change the location or rotation of an existing instance.
                If you know the sizes of the various component it's easy enough to locate them all relative to one another.
                Alternatively, if the inserted instances' relationships are always the same, then why not make single SKP with the various components already manually arranged as desired and then load that, place an instance of it and explode it so the 'loose' components are place as desired...

                TIG

                1 Reply Last reply Reply Quote 0
                • C Offline
                  Chris88
                  last edited by

                  Thanks a lot for your answer,

                  Mayby i'm wrong,
                  but i believe, you misunderstand me.

                  so i show you what i've programmed:

                  ` driller= Sketchup.active_model.definitions.load("\driller.skp")
                  pos_driller = Geom::Point3d.new 47,32,25
                  set_driller= Geom::Transformation.new pos_driller
                  instance1 = entities.add_instance driller, set_driller

                  cuboid_wood = Sketchup.active_model.definitions.load("\Cuboid_wood.skp")
                  pos_cuboid = Geom::Point3d.new 0,0,0
                  set_cuboid = Geom::Transformation.new pos_cuboid
                  instance2 = entities.add_instance cuboid_wood, set_cuboid`

                  but this is hardcoded
                  and i want that the computer places the objects correctly together automatically,by calculating the best position, but i can't calculate the size of these objects, because i don't know how. (i would have to measure the size with the measure-tool in SU with the mouse, but it should retrieve the values with a method)

                  I have the task to do that with many components, that's why i wouldn't
                  say the detailed coordinates for every components, which i load.

                  the programm should be able to load componentes, put it together correctly and dynamically, take some photos in different perspectives, save these pictures, clear it all and start at the beginning with other components ... everthing is quite clear to me, with the exception of the hardcoded coordinates of these objects

                  P.S.
                  i have wrote this problem in a new topic too

                  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