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

    Re-orienting Coordinate system (Z-axis as ref)

    Scheduled Pinned Locked Moved Newbie Forum
    sketchup
    10 Posts 5 Posters 701 Views 5 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.
    • N Offline
      northcoastrat
      last edited by

      It is easy enough to re-orient the coordinate system, but is there a way to choose the origin and then align the z-axis (blue) along a known line rather than the x-axis (red)? I could use a feature like this because I want to create an "off axis" cylinder (in the default coordinate space)pointing towards a known point, the base of which is a circle that must be normal to the central axis of the cylinder. The circle tool seems to orient to the XY plane by default, making it problematic to extrude in my intended direction and still remain cylindrical (as of now this direction is where the x-axis(red)is pointing).

      The freerotate pugin is another option but is a big clunky. Any other ideas?

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

        The 'Axes' tool resets the axes in RG[B] order so you need to have R & G pickable as Blue comes from those automatically. If you have a line drawn in the required-Blue direction it's simple enough to draw a line from it at right angles... start a new line pick on the line drawn in the required-Blue direction, hover the mouse over that line and the temp-guide drawn to the cursor will turn magenta as you move away from the line - the inferencing has locked to be parallel to that existing line, now move your cursor at approximately a right angle and when the temp-guide again turns magenta - showing it's perpendicular. At this point you can hold shift to lock the new edge to that line. Pick a point to add the edge.
        To add a second line at right angles to the one you just added... select that new line, Rotate+Ctrl to copy it, drag the mouse [keep the button down] along the line drawn in the required-Blue direction, this will lock the rotation gizmo to that line as the axis, pick a point on the line you are copying and start the copy, type in 90. Now you have the line drawn in the required-Blue direction and two other lines drawn from it at right angles to it and each other. You can adjust the rotation of these two by selecting both [+Ctrl adds to a selection] and use the Rotate tool again drag-locked to the first line as its axis.
        Now use the Axes tool snapping to each of these new lines in turn for R & G and Blue is automatically set to the line you want...
        Erase the temp-lines when they are no longer needed.
        It's much quicker to do the steps that it is to write them!

        TIG

        1 Reply Last reply Reply Quote 0
        • Wo3DanW Offline
          Wo3Dan
          last edited by

          @northcoastrat said:

          It is easy enough to re-orient the coordinate system, but is there a way to choose the origin and then align the z-axis (blue) along a known line rather than the x-axis (red)? ......
          This applies to any line in space and with basic SU tools.

          A given line.
          Select 'Axes' tool to change axes, direct Red along that line by first two clicks. Click green anywhere. Green and Blue are now perpendicular to the line. Right click on one of the axes and select 'Move' in context menu.
          Enter for rotation: X(red) 90 and Y(green) 90 [OK]. Change nothing else.
          Now blue is along the given line

          1 Reply Last reply Reply Quote 0
          • honoluludesktopH Offline
            honoluludesktop
            last edited by

            If you can draw, or move your component to the desired origin, this will rotate the component's z axis on its origin to what ever you can point to.

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

              Thinking about this a little more... 😒
              You can readily snap the new Axes to the desired line - using the first pick Red, and then pick Green anywhere, and Blue follows automatically.
              A Circle's orientation will default to be on any of the three axial planes [or a non-axial surface that you might hover over].
              If you are looking generally along the Red axis it will be oriented on that Plane [it shows Red]...
              Now hold Shift to lock to that orientation and you can draw the circle square to the line at any picked point you want.
              If it's awkward to position the circle's center exactly at that time, then if its made 'in space' you can then Select it and Move it by its center [inference again] to snap to exactly where you want it after it's been created.
              Why worry about the circle/line having to be the Blue axial ? Just Orbit till Red becomes available and lock to that! The change of axes is only temporary and the actual axis that something is locked to is usually unimportant [unless you are inserting a component]...

              TIG

              1 Reply Last reply Reply Quote 0
              • Jean LemireJ Offline
                Jean Lemire
                last edited by

                Hi folks.

                Depending on how your view is orbited, you can draw a circle on the red/blue (XZ) plane as well as the green/blue (YZ) plane as easily as it is on the red/green (XY) plane.

                You can also rotate the cylinder to any orientation with the Rotate Tool.

                Just ideas.

                Jean (Johnny) Lemire from Repentigny, Quebec, Canada.

                1 Reply Last reply Reply Quote 0
                • N Offline
                  northcoastrat
                  last edited by

                  Thanks for all the input, I just returned from three weeks of field work and will give these ideas a try. I am also interested in creating/working with someone on a script that will take my data in the format below and create a series of cone frusta automatically. I have very limited experience with programming however. The data below is an example of two conic frusta oriented in x,y,z, space.

                  Data Format: Base Top
                  X Y Z Diam X Y Z Diam
                  0 0 0 6.5 4 6 10 6.0
                  4 6 10 5.9 10 12 15 5.0

                  1 Reply Last reply Reply Quote 0
                  • N Offline
                    northcoastrat
                    last edited by

                    @honoluludesktop said:

                    If you can draw, or move your component to the desired origin, this will rotate the component's z axis on its origin to what ever you can point to.

                    I'm having trouble making this work. How do you know where the component's origin is? It doesn't seem to point my shape along the necessary line, but always at a strange angle to it.

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

                      It's relatively easy to read a file and make some geometry.
                      Do you want a solid object or just two circles, perhaps with joining lines or clines ??
                      Is the data 'space' separated

                      1 2 3 44 5 6 7 88 
                      

                      where its 1st x y z diam and then 2nd x y z diam - on one line er 'cone'?
                      How many 'segments' would you like? 6, 8, 12, 24, 36 ?
                      I'll try to post some code for you shortly...
                      To find a group/instance's location use point=group.transformation.origin to get its insertion point, to set its insertion point use group.transform!(Geom::Transformation.new(point))

                      TIG

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

                        Copy+paste this code into a file named something like data2frusta.rb in the Plugins folder

                        module TIG
                        def self.data2frusta()
                          model=Sketchup.active_model
                          ents=model.active_entities
                          path=model.path
                          if path==''
                            folder=Dir.pwd
                          else
                            folder=File.dirname(path)
                          end
                          file=UI.openpanel("Chose DATA txt file", folder, "*")
                          return nil if not file or not File.exist?(file)
                          model.start_operation("data2frusta")
                          ns=24 ### number of segments
                          name="frusta#1" ### group name
                          lines=IO.readlines(file)
                          lines.each{|line|
                            line.chomp!
                            next if line==''
                            next if not line=~/[0-9]/
                            data=line.split(' ')
                            p0=Geom;;Point3d.new(data[0].to_f, data[1].to_f, data[2].to_f)
                            r0=data[3].to_f/2.0
                            p1=Geom;;Point3d.new(data[4].to_f, data[5].to_f, data[6].to_f)
                            r1=data[7].to_f/2.0
                            no=p0.vector_to(p1)
                            group=ents.add_group()
                            names=[];model.definitions.each{|d|names << d.name if d.group?}
                            name.next! while names.include?(name)
                            gents=group.entities
                            group.name=name
                            gents.parent.name=name
                            c0=gents.add_circle(p0,no,r0,ns)
                            c1=gents.add_circle(p1,no,r1,ns)
                            c0[0].find_faces
                            f0=c0[0].faces[0]
                            c1[0].find_faces
                            f1=c1[0].faces[0]
                            v0s=f0.vertices
                            v1s=f1.vertices
                            0.upto(ns-1){|i|
                              li=gents.add_line(v0s[i],v1s[i])
                              li.find_faces
                              li.smooth=true
                              li.soft=true
                            }
                            f0.reverse!    
                          }
                          model.commit_operation
                        end
                        end
                        

                        Usage:
                        In the Ruby Console type TIG.data2frusta - select the data.txt file that is in the format for each line of
                        x0 y0 z0 d0 x1 y1 z1 d1
                        where the conic-start 0 center is at [x0,y0,z0] and has the diameter d0
                        and the conic-end 1 center is at [x1,y1,z1] and has the diameter d1.
                        Each line of code makes a grouped conic frusta - to change from 24 sides or another group-name edit the code at the ### noted lines...
                        It is one step undo-able, canceling at the file dialog stops the tool...

                        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