OpenSCAD - Cylinder from axis












1















How can I create this shape? The depicted shape can be interpreted as one of the following:




  1. A cone that comes to a line instead of a point.

  2. A loft from a circle to a straight line.

  3. A loft from a circle to a square of [0,1].

  4. A cylinder with one side squeezed in.


-- The curve on the face of the circle would be ideal for accuracy, but not strictly necessary.



Approximation in OpenSCAD using this code:



Cylinder projected from axis



Shape achieved in Fusion360:



Shape achieved in Fusion360










share|improve this question



























    1















    How can I create this shape? The depicted shape can be interpreted as one of the following:




    1. A cone that comes to a line instead of a point.

    2. A loft from a circle to a straight line.

    3. A loft from a circle to a square of [0,1].

    4. A cylinder with one side squeezed in.


    -- The curve on the face of the circle would be ideal for accuracy, but not strictly necessary.



    Approximation in OpenSCAD using this code:



    Cylinder projected from axis



    Shape achieved in Fusion360:



    Shape achieved in Fusion360










    share|improve this question

























      1












      1








      1








      How can I create this shape? The depicted shape can be interpreted as one of the following:




      1. A cone that comes to a line instead of a point.

      2. A loft from a circle to a straight line.

      3. A loft from a circle to a square of [0,1].

      4. A cylinder with one side squeezed in.


      -- The curve on the face of the circle would be ideal for accuracy, but not strictly necessary.



      Approximation in OpenSCAD using this code:



      Cylinder projected from axis



      Shape achieved in Fusion360:



      Shape achieved in Fusion360










      share|improve this question














      How can I create this shape? The depicted shape can be interpreted as one of the following:




      1. A cone that comes to a line instead of a point.

      2. A loft from a circle to a straight line.

      3. A loft from a circle to a square of [0,1].

      4. A cylinder with one side squeezed in.


      -- The curve on the face of the circle would be ideal for accuracy, but not strictly necessary.



      Approximation in OpenSCAD using this code:



      Cylinder projected from axis



      Shape achieved in Fusion360:



      Shape achieved in Fusion360







      openscad






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '18 at 18:38









      wizuluswizulus

      1,39311125




      1,39311125
























          2 Answers
          2






          active

          oldest

          votes


















          2














          You can simply extrude a circle and scale it over the length of extrusion to a flat line. The scale-parameter s. documentation
          of linear_extrude can be a scalar or a vector with x- and y-scale-factor. Set one of them to 1 and the other to 0:



          $fs = 0.01;
          $fa = 0.01;

          linear_extrude(height = 15, scale =[0, 1]) circle(d = 10);


          The result:
          enter image description here






          share|improve this answer































            0














            I learned you can do a convex loft using hull.



            module pinch(h=1,r1=1,r2=1,r3=0) {
            zero = 0.00000000001;
            steps = $fn ? $fn : $fa;
            res = h/steps;
            r1 = r1 ? r1 : res;
            r2 = r2 ? r2 : res;
            r3 = r3 ? r3 : zero;
            hull() {
            cylinder(h=zero,r=r1,r2=res,r3=0,center=false);
            translate([-r2, -r3, h - zero]) cube([
            r2 * 2,
            r3 * 2,
            zero
            ]);
            }
            }

            translate([1,0,.5]) rotate([0,-90,0]) pinch(1, .5, .5, $fn=50);


            Loft using Hull






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399434%2fopenscad-cylinder-from-axis%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              You can simply extrude a circle and scale it over the length of extrusion to a flat line. The scale-parameter s. documentation
              of linear_extrude can be a scalar or a vector with x- and y-scale-factor. Set one of them to 1 and the other to 0:



              $fs = 0.01;
              $fa = 0.01;

              linear_extrude(height = 15, scale =[0, 1]) circle(d = 10);


              The result:
              enter image description here






              share|improve this answer




























                2














                You can simply extrude a circle and scale it over the length of extrusion to a flat line. The scale-parameter s. documentation
                of linear_extrude can be a scalar or a vector with x- and y-scale-factor. Set one of them to 1 and the other to 0:



                $fs = 0.01;
                $fa = 0.01;

                linear_extrude(height = 15, scale =[0, 1]) circle(d = 10);


                The result:
                enter image description here






                share|improve this answer


























                  2












                  2








                  2







                  You can simply extrude a circle and scale it over the length of extrusion to a flat line. The scale-parameter s. documentation
                  of linear_extrude can be a scalar or a vector with x- and y-scale-factor. Set one of them to 1 and the other to 0:



                  $fs = 0.01;
                  $fa = 0.01;

                  linear_extrude(height = 15, scale =[0, 1]) circle(d = 10);


                  The result:
                  enter image description here






                  share|improve this answer













                  You can simply extrude a circle and scale it over the length of extrusion to a flat line. The scale-parameter s. documentation
                  of linear_extrude can be a scalar or a vector with x- and y-scale-factor. Set one of them to 1 and the other to 0:



                  $fs = 0.01;
                  $fa = 0.01;

                  linear_extrude(height = 15, scale =[0, 1]) circle(d = 10);


                  The result:
                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 21 '18 at 20:02









                  a_manthey_67a_manthey_67

                  2,5901817




                  2,5901817

























                      0














                      I learned you can do a convex loft using hull.



                      module pinch(h=1,r1=1,r2=1,r3=0) {
                      zero = 0.00000000001;
                      steps = $fn ? $fn : $fa;
                      res = h/steps;
                      r1 = r1 ? r1 : res;
                      r2 = r2 ? r2 : res;
                      r3 = r3 ? r3 : zero;
                      hull() {
                      cylinder(h=zero,r=r1,r2=res,r3=0,center=false);
                      translate([-r2, -r3, h - zero]) cube([
                      r2 * 2,
                      r3 * 2,
                      zero
                      ]);
                      }
                      }

                      translate([1,0,.5]) rotate([0,-90,0]) pinch(1, .5, .5, $fn=50);


                      Loft using Hull






                      share|improve this answer




























                        0














                        I learned you can do a convex loft using hull.



                        module pinch(h=1,r1=1,r2=1,r3=0) {
                        zero = 0.00000000001;
                        steps = $fn ? $fn : $fa;
                        res = h/steps;
                        r1 = r1 ? r1 : res;
                        r2 = r2 ? r2 : res;
                        r3 = r3 ? r3 : zero;
                        hull() {
                        cylinder(h=zero,r=r1,r2=res,r3=0,center=false);
                        translate([-r2, -r3, h - zero]) cube([
                        r2 * 2,
                        r3 * 2,
                        zero
                        ]);
                        }
                        }

                        translate([1,0,.5]) rotate([0,-90,0]) pinch(1, .5, .5, $fn=50);


                        Loft using Hull






                        share|improve this answer


























                          0












                          0








                          0







                          I learned you can do a convex loft using hull.



                          module pinch(h=1,r1=1,r2=1,r3=0) {
                          zero = 0.00000000001;
                          steps = $fn ? $fn : $fa;
                          res = h/steps;
                          r1 = r1 ? r1 : res;
                          r2 = r2 ? r2 : res;
                          r3 = r3 ? r3 : zero;
                          hull() {
                          cylinder(h=zero,r=r1,r2=res,r3=0,center=false);
                          translate([-r2, -r3, h - zero]) cube([
                          r2 * 2,
                          r3 * 2,
                          zero
                          ]);
                          }
                          }

                          translate([1,0,.5]) rotate([0,-90,0]) pinch(1, .5, .5, $fn=50);


                          Loft using Hull






                          share|improve this answer













                          I learned you can do a convex loft using hull.



                          module pinch(h=1,r1=1,r2=1,r3=0) {
                          zero = 0.00000000001;
                          steps = $fn ? $fn : $fa;
                          res = h/steps;
                          r1 = r1 ? r1 : res;
                          r2 = r2 ? r2 : res;
                          r3 = r3 ? r3 : zero;
                          hull() {
                          cylinder(h=zero,r=r1,r2=res,r3=0,center=false);
                          translate([-r2, -r3, h - zero]) cube([
                          r2 * 2,
                          r3 * 2,
                          zero
                          ]);
                          }
                          }

                          translate([1,0,.5]) rotate([0,-90,0]) pinch(1, .5, .5, $fn=50);


                          Loft using Hull







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 20 '18 at 19:59









                          wizuluswizulus

                          1,39311125




                          1,39311125






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53399434%2fopenscad-cylinder-from-axis%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Can a sorcerer learn a 5th-level spell early by creating spell slots using the Font of Magic feature?

                              Does disintegrating a polymorphed enemy still kill it after the 2018 errata?

                              A Topological Invariant for $pi_3(U(n))$