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

    Circle orientation other than Z_axis?

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 2 Posters 206 Views 2 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
      tomot
      last edited by

      I'm in need for some code to orient a circle forming a stair railing, which needs to be normal to the riser/tread triangular relationship
      see attachment.

          edges = entities.add_edges(@pt1, @pt2)
          circle = entities.add_circle(@pt1, Z_AXIS, 1.inch, 16)
          base = entities.add_face(circle)
          base.back_material = Sketchup;;Color.new (255,200,100) 
          base.followme(edges) 
      

      extrusion.png

      [my plugins](http://thingsvirtual.blogspot.ca/)
      tomot

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

        An edge has a 'line'.
        That's a two element array of the start point and its vector.
        So point=edge.line[0] and vector=edge.line[1]
        Use 'vector' instead of an 'axis' and also the 'center' can be 'point'...

        TIG

        1 Reply Last reply Reply Quote 0
        • T Offline
          tomot
          last edited by

          @tig said:

          An edge has a 'line'.

          point=edge.line[0] and vector=edge.line[1]

          circle = entities.add_circle(@pt1, Z_AXIS, 1.inch, 16)
          

          do I replace the Z_AXIS code with your code?

          [my plugins](http://thingsvirtual.blogspot.ca/)
          tomot

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

            circle = entities.add_circle(@pt1, Z_AXIS, 1.inch, 16)
            

            Your ' @pt1' can be replaced with any point you specify - like edge.line[0]
            and the circle's 'normal' is any vector you specify - it doesn't have to be the z-axis [ Z_AXIS] so any vector, like edge.line[1], will do as well...
            The radius [' i.inch'] in your code can also be whatever you want it to be...
            And the ' 16' that sets the umber of segments, can also be what you like...

            TIG

            1 Reply Last reply Reply Quote 0
            • T Offline
              tomot
              last edited by

              It took a while for your medication to be absorbed 😄

                      vector = $pt2a - $pt1a
                      edges1 = entities.add_edges($pt1a, $pt2a)
                      circle = entities.add_circle($pt1a, vector, 1.inch, 16)
                      base = entities.add_face(circle)
                      base.back_material = Sketchup;;Color.new (255,200,100) #use RGB Color numbers
                      base.followme(edges1)
              

              using my coded example: subtracting the 2 points creates a 3d vector which is normal to any circle.

              [my plugins](http://thingsvirtual.blogspot.ca/)
              tomot

              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