• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

How can I add construction points by x,y,z location?

Scheduled Pinned Locked Moved Newbie Forum
sketchup
10 Posts 3 Posters 256 Views
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.
  • K Offline
    Krisidious
    last edited by 12 Mar 2012, 02:17

    How can I add construction points by x,y,z location? I have these 3D locations in this format pos=(0.70,0.0,-1.34) ori=(0.0,0.0,0.0) and need to make construction points from them. is there an easy way to do it?

    By: Kristoff Rand
    Home DesignerUnique House Plans

    1 Reply Last reply Reply Quote 0
    • D Offline
      Dave R
      last edited by 12 Mar 2012, 02:19

      Didier Bur's Points Cloud plugin could do it.

      Linkity link: http://rhin.crai.archi.fr/rld/plugin_details.php?id=777

      Etaoin Shrdlu

      %

      (THERE'S NO PLACE LIKE)

      G28 X0.0 Y0.0 Z0.0

      M30

      %

      1 Reply Last reply Reply Quote 0
      • T Offline
        TIG Moderator
        last edited by 12 Mar 2012, 10:17

        First set you Model Info > Units to match the file's units.
        Assuming that these points are in a file with one line per point, in the form
        pos=(0.70,0.0,-1.34) ori=(0.0,0.0,0.0) you'll need to do something like this... in the Ruby Console...
        Set a reference to this 'file of points'... e.g.

        f='C;\Temp\points.txt';
        

        i.e. set it to your REAL file's path.
        Then run this one liner...

        IO.readlines(f).each{|t|next if t.empty? or not t=~/[(]/;p=t.split('(')[1].split(')')[0].tr(' ','').split(',');Sketchup.active_model.active_entities.add_cpoint([p[0].to_l,p[1].to_l,p[2].to_l])}
        

        Note how the various coded 'splits' etc parse the strings at the '(' and ')', remove any 'whitespace', and then divides the point that's left at the ',' to get the X,Y,Z values for that point [see how the '.to_l' says make the 'string' into a 'length' - hence the need to match the model's units to the file's] and it then adds the cpoint using those...
        This is specific to your file's format, it can be readily adjusted to suit other configurations of data...

        TIG

        1 Reply Last reply Reply Quote 0
        • K Offline
          Krisidious
          last edited by 12 Mar 2012, 17:57

          thanks Dave and Tig,

          I'm running into an issue. are XYZ not universal? why do different 3D programs use different XYZ? I can understand X & Y being mixed up but Z? here is the top of my code. and a bit of the locations I'm dealing with.

          /////////////////////////////////////////////////////////////////////////////
          //
          // Conventions;
          //
          // +x = left
          // +z = rear
          // +y = up
          // +pitch = nose up
          // +yaw = nose right
          // +roll = right
          //
          // [BODY]  - a rigid mass with mass and inertial properties
          // [JOINT] - a ball joint constraining an offset of one body to an
          //           offset of another body (eliminates 3 DOF)
          // [HINGE] - a constraint restricting the relative rotations of two
          //           bodies to be around a single axis (eliminates 2 DOF).
          // [BAR]   - a constraint holding an offset of one body from an offset of
          //           another body at a fixed distance (eliminates 1 DOF).
          // [JOINT&HINGE] - both the joint and hinge constraints, forming the
          //           conventional definition of a hinge (eliminates 5 DOF).
          //
          /////////////////////////////////////////////////////////////////////////////
          
          // Body including all rigidly attached parts (wings, barge boards, etc.)
          [BODY]
          name=body mass=(1562.0) inertia=(1856,2194,495.0)
          pos=(0.0,0.00,0.0) ori=(0.0,0.0,0.0)
          
          // Front spindles
          [BODY]
          name=fl_spindle mass=(22.0) inertia=(0.0325,0.0305,0.0285)
          pos=(0.70,0.0,-1.34) ori=(0.0,0.0,0.0)
          
          
          [BODY]
          name=fr_spindle mass=(22.0) inertia=(0.0325,0.0305,0.0285)
          pos=(-0.70,0.0,-1.34) ori=(0.0,0.0,0.0)
          
          // Front wheels
          [BODY]
          name=fl_wheel mass=(26.0) inertia=(2.100,1.220,1.220)
          pos=(0.764,0.0,-1.34) ori=(0.0,0.0,0.0)
          
          [BODY]
          name=fr_wheel mass=(26.0) inertia=(2.100,1.220,1.220)
          pos=(-0.764,0.0,-1.34) ori=(0.0,0.0,0.0)
          
          // Live rear axle
          [BODY]
          name=rear_axle mass=(120.00) inertia=(10.70,10.70,5.20)
          pos=(0.0,-0.07,1.30) ori=(0.0,0.0,0.0)
          
          // Rear wheels 
          [BODY]
          name=rl_wheel mass=(30.0) inertia=(2.110,1.225,1.225)
          pos=(0.715,0.0,1.35) ori=(0.0,0.0,0.0)
          
          [BODY]
          name=rr_wheel mass=(30.0) inertia=(2.110,1.225,1.225)
          pos=(-0.715,0.0,1.35) ori=(0.0,0.0,0.0)
          
          // Fuel in tank is not rigidly attached - it is attached with springs and
          // dampers to simulate movement.  Properties are defined in the HDV file.
          
          [BODY]
          name=fuel_tank mass=(1.5) inertia=(1.0,1.0,1.0)
          pos=(0.0,0.0,0.0) ori=(0.0,0.0,0.0)
          
          // Driver's head is not rigidly attached, and it does NOT affect the vehicle
          // physics.  Position is from the eyepoint defined in the VEH file, while
          // other properties are defined in the head physics file.
          
          [BODY]
          name=driver_head mass=(6.0) inertia=(0.035,0.025,0.030)
          pos=(0.0,0.0,0.0) ori=(0.0,0.0,0.0)
          

          By: Kristoff Rand
          Home DesignerUnique House Plans

          1 Reply Last reply Reply Quote 0
          • T Offline
            TIG Moderator
            last edited by 12 Mar 2012, 18:52

            Most 3d CAD programs like SUp now have X and Y on the ground [right/left and back/front] and Z is up/down.
            Old 2d/3d CAD programs used 'width' =X and 'depth =Y, with 'height' =Z.
            This is confusing even in the SUp's API bounding box methods which returns these unexpectedly too, so 'height' is measured in the Y, while 'depth' is measured the Z and X is measured as the 'width'...
            The typical 'flip' is that of Y and Z, with a -ve value for the Y to make it a proper Z in the other file's format... So that SUp file then suits say OBJ format... conversely importing an OBJ file into a SKP you must flip Y/Z backwards to suit the SKP...

            TIG

            1 Reply Last reply Reply Quote 0
            • K Offline
              Krisidious
              last edited by 12 Mar 2012, 19:49

              Thanks Tig...

              one more question... is red guide in SU X or Y?

              By: Kristoff Rand
              Home DesignerUnique House Plans

              1 Reply Last reply Reply Quote 0
              • D Offline
                Dave R
                last edited by 12 Mar 2012, 19:57

                Red is X.

                Etaoin Shrdlu

                %

                (THERE'S NO PLACE LIKE)

                G28 X0.0 Y0.0 Z0.0

                M30

                %

                1 Reply Last reply Reply Quote 0
                • K Offline
                  Krisidious
                  last edited by 12 Mar 2012, 21:08

                  thank you sir.

                  By: Kristoff Rand
                  Home DesignerUnique House Plans

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    TIG Moderator
                    last edited by 12 Mar 2012, 22:10

                    RGB = XYZ [in SUp!]

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • K Offline
                      Krisidious
                      last edited by 12 Mar 2012, 22:30

                      oh that makes nice sense. good to know. thank you.

                      By: Kristoff Rand
                      Home DesignerUnique House Plans

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

                      Advertisement