discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Is there a better way to do this?

D
denverh
Fri, Jul 12, 2024 6:44 PM

Hello,

This design starts by rotating two or more overlapping circles around a
common center while extruding them upwards in the Z direction.  The
resulting braided column is then duplicated around a larger diameter.  
The outer diameter changes as a function of Z and the columns spiral
around that some number of degrees.  Then the open center is filled with
a closed cylinder to make a solid.

The only way I can think of to change the diameter as a function of Z
and get the braided columns to spiral around is to create discrete
slices.  The thinner the slices are the smoother the result.  But I
always end up with something that takes many hours to generate an STL,
and contains a huge amount of geometry.  Perhaps this is the only way to
achieve the result I want, but I would be interested in hearing about
alternative approaches, especially if they take less time.  I usually
use a layer height (step) > 1.0 for testing, and no more than 0.2 for
the STL output.

Here's the code:
height=100;             //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;               //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;             // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;             // small circle overlap fraction
scircs=3;               //  number of small circles
step=1.2;               // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;       //  number of degrees in sturns
ldegr=360
lturns;       //  number of degrees in lturns
sdegrstp=sdegr/nstps;   // number of degrees per step
ldegrstp=ldegr/nstps;   // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape() {
    for (c=[1:scircs]) {
        rotate(360/scircsc)
        translate([0,srad
(1-covlp)])
        circle(sdiam);
    }
}

// make base shape 3d
module base_shape(h,s) {
    // h = current height
    // s = current step #, from 0

    translate([0,0,h])
    linear_extrude(height=step, twist=-sdegrstp)
    rotate(s*sdegrstp)
    shape();
}

module core(h,s) {
    // h = vertical position
    // s= scale factor

    scale([s,s,1])
    translate([0,0,h])
    linear_extrude(height=step)
    circle(d=ldiam);
}

module main(z,high) {
    // z = starting position
    // high = total height

    translate([0,0,z])
    for (p=[1:scols]) {
        rotate(360/scols*p) {
            //color("red") base();
            for (h=[0:step:high]) {
                s=siz(h)/lrad;

                // adjust the profile shape
                scale([s,s,1])
                // twist as required
                rotate(ldegrstp*h/step)
                // shift to perimeter
                translate([0,lrad,0])
                // send height, step#
                base_shape(h,h/step);
                core(h,s);
            }
        }
    }
}

main(0,height);

Regards,

Denver

Hello, This design starts by rotating two or more overlapping circles around a common center while extruding them upwards in the Z direction.  The resulting braided column is then duplicated around a larger diameter.   The outer diameter changes as a function of Z and the columns spiral around that some number of degrees.  Then the open center is filled with a closed cylinder to make a solid. The only way I can think of to change the diameter as a function of Z and get the braided columns to spiral around is to create discrete slices.  The thinner the slices are the smoother the result.  But I always end up with something that takes many hours to generate an STL, and contains a huge amount of geometry.  Perhaps this is the only way to achieve the result I want, but I would be interested in hearing about alternative approaches, especially if they take less time.  I usually use a layer height (step) > 1.0 for testing, and no more than 0.2 for the STL output. Here's the code: height=100;             //height ldiam=100;              // large diameter lrad=ldiam/2; scols=20;               //  number of small columns sdiam=8;                // diameter of small circles srad=sdiam/2; sturns=3.0;             // number of rotations of small circles lturns=0.25;            // number of turns for combined layers covlp=0.20;             // small circle overlap fraction scircs=3;               //  number of small circles step=1.2;               // vertical layer interval // calculated values nstps=height/step;      // total number of vertical steps sdegr=360*sturns;       //  number of degrees in sturns ldegr=360*lturns;       //  number of degrees in lturns sdegrstp=sdegr/nstps;   // number of degrees per step ldegrstp=ldegr/nstps;   // number of degrees per step $fn=60; // sine function values ampl=20;        // amplitude ofs=lrad-ampl;        // offset from 0 wl=height*2;        // wavelength shi=0;            // shift in degrees degr=150;        // degree range // calcualte size based on height function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); // make the base 2d shape module shape() {     for (c=[1:scircs]) {         rotate(360/scircs*c)         translate([0,srad*(1-covlp)])         circle(sdiam);     } } // make base shape 3d module base_shape(h,s) {     // h = current height     // s = current step #, from 0     translate([0,0,h])     linear_extrude(height=step, twist=-sdegrstp)     rotate(s*sdegrstp)     shape(); } module core(h,s) {     // h = vertical position     // s= scale factor     scale([s,s,1])     translate([0,0,h])     linear_extrude(height=step)     circle(d=ldiam); } module main(z,high) {     // z = starting position     // high = total height     translate([0,0,z])     for (p=[1:scols]) {         rotate(360/scols*p) {             //color("red") base();             for (h=[0:step:high]) {                 s=siz(h)/lrad;                 // adjust the profile shape                 scale([s,s,1])                 // twist as required                 rotate(ldegrstp*h/step)                 // shift to perimeter                 translate([0,lrad,0])                 // send height, step#                 base_shape(h,h/step);                 core(h,s);             }         }     } } main(0,height); Regards, Denver
JB
Jordan Brown
Sat, Jul 13, 2024 12:03 AM

It won't be fun, but you could construct each strand (of which I think
you have sixty) as a single polyhedron, then union them all.  (Of
course, you only need one module that generates the polyhedron, and then
you call it with different parameters for where to start each strand in
a braided group, and generate the same braided group 20 times, rotated
each time.)

Pretty much, that means doing the same trigonometry that the various
rotates and translates would do, to generate the points, and then
connect them together appropriately.

You do want 60 distinct polyhedra, because you don't want to have to
figure out how to union them on your own.

It won't be fun, but you could construct each strand (of which I think you have sixty) as a single polyhedron, then union them all.  (Of course, you only need one module that generates the polyhedron, and then you call it with different parameters for where to start each strand in a braided group, and generate the same braided group 20 times, rotated each time.) Pretty much, that means doing the same trigonometry that the various rotates and translates would do, to generate the points, and then connect them together appropriately. You do want 60 distinct polyhedra, because you don't want to have to figure out how to union them on your own.
SP
Sanjeev Prabhakar
Sat, Jul 13, 2024 1:03 AM

You need to learn to write code, defining points in space rather than using
standard modules.
What you want is to create just 1 or 2 polyhedron strands and then
replicate them in some circular pattern.

On Sat, 13 Jul 2024 at 05:06, denverh via Discuss <
discuss@lists.openscad.org> wrote:

Hello,

This design starts by rotating two or more overlapping circles around a
common center while extruding them upwards in the Z direction.  The
resulting braided column is then duplicated around a larger diameter.
The outer diameter changes as a function of Z and the columns spiral
around that some number of degrees.  Then the open center is filled with
a closed cylinder to make a solid.

The only way I can think of to change the diameter as a function of Z
and get the braided columns to spiral around is to create discrete
slices.  The thinner the slices are the smoother the result.  But I
always end up with something that takes many hours to generate an STL,
and contains a huge amount of geometry.  Perhaps this is the only way to
achieve the result I want, but I would be interested in hearing about
alternative approaches, especially if they take less time.  I usually
use a layer height (step) > 1.0 for testing, and no more than 0.2 for
the STL output.

Here's the code:
height=100;            //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;              //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;            // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;            // small circle overlap fraction
scircs=3;              //  number of small circles
step=1.2;              // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;      //  number of degrees in sturns
ldegr=360
lturns;      //  number of degrees in lturns
sdegrstp=sdegr/nstps;  // number of degrees per step
ldegrstp=ldegr/nstps;  // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape() {
for (c=[1:scircs]) {
rotate(360/scircsc)
translate([0,srad
(1-covlp)])
circle(sdiam);
}
}

// make base shape 3d
module base_shape(h,s) {
// h = current height
// s = current step #, from 0

  translate([0,0,h])
  linear_extrude(height=step, twist=-sdegrstp)
  rotate(s*sdegrstp)
  shape();

}

module core(h,s) {
// h = vertical position
// s= scale factor

  scale([s,s,1])
  translate([0,0,h])
  linear_extrude(height=step)
  circle(d=ldiam);

}

module main(z,high) {
// z = starting position
// high = total height

  translate([0,0,z])
  for (p=[1:scols]) {
      rotate(360/scols*p) {
          //color("red") base();
          for (h=[0:step:high]) {
              s=siz(h)/lrad;

              // adjust the profile shape
              scale([s,s,1])
              // twist as required
              rotate(ldegrstp*h/step)
              // shift to perimeter
              translate([0,lrad,0])
              // send height, step#
              base_shape(h,h/step);
              core(h,s);
          }
      }
  }

}

main(0,height);

Regards,

Denver


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

You need to learn to write code, defining points in space rather than using standard modules. What you want is to create just 1 or 2 polyhedron strands and then replicate them in some circular pattern. On Sat, 13 Jul 2024 at 05:06, denverh via Discuss < discuss@lists.openscad.org> wrote: > Hello, > > This design starts by rotating two or more overlapping circles around a > common center while extruding them upwards in the Z direction. The > resulting braided column is then duplicated around a larger diameter. > The outer diameter changes as a function of Z and the columns spiral > around that some number of degrees. Then the open center is filled with > a closed cylinder to make a solid. > > The only way I can think of to change the diameter as a function of Z > and get the braided columns to spiral around is to create discrete > slices. The thinner the slices are the smoother the result. But I > always end up with something that takes many hours to generate an STL, > and contains a huge amount of geometry. Perhaps this is the only way to > achieve the result I want, but I would be interested in hearing about > alternative approaches, especially if they take less time. I usually > use a layer height (step) > 1.0 for testing, and no more than 0.2 for > the STL output. > > Here's the code: > height=100; //height > ldiam=100; // large diameter > lrad=ldiam/2; > scols=20; // number of small columns > sdiam=8; // diameter of small circles > srad=sdiam/2; > sturns=3.0; // number of rotations of small circles > lturns=0.25; // number of turns for combined layers > covlp=0.20; // small circle overlap fraction > scircs=3; // number of small circles > step=1.2; // vertical layer interval > > // calculated values > nstps=height/step; // total number of vertical steps > sdegr=360*sturns; // number of degrees in sturns > ldegr=360*lturns; // number of degrees in lturns > sdegrstp=sdegr/nstps; // number of degrees per step > ldegrstp=ldegr/nstps; // number of degrees per step > > $fn=60; > > // sine function values > ampl=20; // amplitude > ofs=lrad-ampl; // offset from 0 > wl=height*2; // wavelength > shi=0; // shift in degrees > degr=150; // degree range > > // calcualte size based on height > function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); > > // make the base 2d shape > module shape() { > for (c=[1:scircs]) { > rotate(360/scircs*c) > translate([0,srad*(1-covlp)]) > circle(sdiam); > } > } > > // make base shape 3d > module base_shape(h,s) { > // h = current height > // s = current step #, from 0 > > translate([0,0,h]) > linear_extrude(height=step, twist=-sdegrstp) > rotate(s*sdegrstp) > shape(); > } > > module core(h,s) { > // h = vertical position > // s= scale factor > > scale([s,s,1]) > translate([0,0,h]) > linear_extrude(height=step) > circle(d=ldiam); > } > > module main(z,high) { > // z = starting position > // high = total height > > translate([0,0,z]) > for (p=[1:scols]) { > rotate(360/scols*p) { > //color("red") base(); > for (h=[0:step:high]) { > s=siz(h)/lrad; > > // adjust the profile shape > scale([s,s,1]) > // twist as required > rotate(ldegrstp*h/step) > // shift to perimeter > translate([0,lrad,0]) > // send height, step# > base_shape(h,h/step); > core(h,s); > } > } > } > } > > main(0,height); > > > Regards, > > Denver > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
AM
Adrian Mariano
Sat, Jul 13, 2024 1:37 AM

Using BOSL2 you could do this pretty easily with sweep() I think or with
vnf_vertex_array() to make the object as a single polyhedron, perhaps.

On Fri, Jul 12, 2024 at 18:04 Sanjeev Prabhakar via Discuss <
discuss@lists.openscad.org> wrote:

You need to learn to write code, defining points in space rather than
using standard modules.
What you want is to create just 1 or 2 polyhedron strands and then
replicate them in some circular pattern.

On Sat, 13 Jul 2024 at 05:06, denverh via Discuss <
discuss@lists.openscad.org> wrote:

Hello,

This design starts by rotating two or more overlapping circles around a
common center while extruding them upwards in the Z direction.  The
resulting braided column is then duplicated around a larger diameter.
The outer diameter changes as a function of Z and the columns spiral
around that some number of degrees.  Then the open center is filled with
a closed cylinder to make a solid.

The only way I can think of to change the diameter as a function of Z
and get the braided columns to spiral around is to create discrete
slices.  The thinner the slices are the smoother the result.  But I
always end up with something that takes many hours to generate an STL,
and contains a huge amount of geometry.  Perhaps this is the only way to
achieve the result I want, but I would be interested in hearing about
alternative approaches, especially if they take less time.  I usually
use a layer height (step) > 1.0 for testing, and no more than 0.2 for
the STL output.

Here's the code:
height=100;            //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;              //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;            // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;            // small circle overlap fraction
scircs=3;              //  number of small circles
step=1.2;              // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;      //  number of degrees in sturns
ldegr=360
lturns;      //  number of degrees in lturns
sdegrstp=sdegr/nstps;  // number of degrees per step
ldegrstp=ldegr/nstps;  // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape() {
for (c=[1:scircs]) {
rotate(360/scircsc)
translate([0,srad
(1-covlp)])
circle(sdiam);
}
}

// make base shape 3d
module base_shape(h,s) {
// h = current height
// s = current step #, from 0

  translate([0,0,h])
  linear_extrude(height=step, twist=-sdegrstp)
  rotate(s*sdegrstp)
  shape();

}

module core(h,s) {
// h = vertical position
// s= scale factor

  scale([s,s,1])
  translate([0,0,h])
  linear_extrude(height=step)
  circle(d=ldiam);

}

module main(z,high) {
// z = starting position
// high = total height

  translate([0,0,z])
  for (p=[1:scols]) {
      rotate(360/scols*p) {
          //color("red") base();
          for (h=[0:step:high]) {
              s=siz(h)/lrad;

              // adjust the profile shape
              scale([s,s,1])
              // twist as required
              rotate(ldegrstp*h/step)
              // shift to perimeter
              translate([0,lrad,0])
              // send height, step#
              base_shape(h,h/step);
              core(h,s);
          }
      }
  }

}

main(0,height);

Regards,

Denver


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Using BOSL2 you could do this pretty easily with sweep() I think or with vnf_vertex_array() to make the object as a single polyhedron, perhaps. On Fri, Jul 12, 2024 at 18:04 Sanjeev Prabhakar via Discuss < discuss@lists.openscad.org> wrote: > You need to learn to write code, defining points in space rather than > using standard modules. > What you want is to create just 1 or 2 polyhedron strands and then > replicate them in some circular pattern. > > > On Sat, 13 Jul 2024 at 05:06, denverh via Discuss < > discuss@lists.openscad.org> wrote: > >> Hello, >> >> This design starts by rotating two or more overlapping circles around a >> common center while extruding them upwards in the Z direction. The >> resulting braided column is then duplicated around a larger diameter. >> The outer diameter changes as a function of Z and the columns spiral >> around that some number of degrees. Then the open center is filled with >> a closed cylinder to make a solid. >> >> The only way I can think of to change the diameter as a function of Z >> and get the braided columns to spiral around is to create discrete >> slices. The thinner the slices are the smoother the result. But I >> always end up with something that takes many hours to generate an STL, >> and contains a huge amount of geometry. Perhaps this is the only way to >> achieve the result I want, but I would be interested in hearing about >> alternative approaches, especially if they take less time. I usually >> use a layer height (step) > 1.0 for testing, and no more than 0.2 for >> the STL output. >> >> Here's the code: >> height=100; //height >> ldiam=100; // large diameter >> lrad=ldiam/2; >> scols=20; // number of small columns >> sdiam=8; // diameter of small circles >> srad=sdiam/2; >> sturns=3.0; // number of rotations of small circles >> lturns=0.25; // number of turns for combined layers >> covlp=0.20; // small circle overlap fraction >> scircs=3; // number of small circles >> step=1.2; // vertical layer interval >> >> // calculated values >> nstps=height/step; // total number of vertical steps >> sdegr=360*sturns; // number of degrees in sturns >> ldegr=360*lturns; // number of degrees in lturns >> sdegrstp=sdegr/nstps; // number of degrees per step >> ldegrstp=ldegr/nstps; // number of degrees per step >> >> $fn=60; >> >> // sine function values >> ampl=20; // amplitude >> ofs=lrad-ampl; // offset from 0 >> wl=height*2; // wavelength >> shi=0; // shift in degrees >> degr=150; // degree range >> >> // calcualte size based on height >> function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); >> >> // make the base 2d shape >> module shape() { >> for (c=[1:scircs]) { >> rotate(360/scircs*c) >> translate([0,srad*(1-covlp)]) >> circle(sdiam); >> } >> } >> >> // make base shape 3d >> module base_shape(h,s) { >> // h = current height >> // s = current step #, from 0 >> >> translate([0,0,h]) >> linear_extrude(height=step, twist=-sdegrstp) >> rotate(s*sdegrstp) >> shape(); >> } >> >> module core(h,s) { >> // h = vertical position >> // s= scale factor >> >> scale([s,s,1]) >> translate([0,0,h]) >> linear_extrude(height=step) >> circle(d=ldiam); >> } >> >> module main(z,high) { >> // z = starting position >> // high = total height >> >> translate([0,0,z]) >> for (p=[1:scols]) { >> rotate(360/scols*p) { >> //color("red") base(); >> for (h=[0:step:high]) { >> s=siz(h)/lrad; >> >> // adjust the profile shape >> scale([s,s,1]) >> // twist as required >> rotate(ldegrstp*h/step) >> // shift to perimeter >> translate([0,lrad,0]) >> // send height, step# >> base_shape(h,h/step); >> core(h,s); >> } >> } >> } >> } >> >> main(0,height); >> >> >> Regards, >> >> Denver >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
HL
Hans L
Sat, Jul 13, 2024 4:00 AM

If you can break it down to slices of convex geometry (a single strand
having a circular cross section), then doing a hull of consecutive slices
works as a sort of sweep.

The linear extrude height is changed to some miniscule epsilon (to make a
technically 3d shape), and hull is done between two layers of the computed
shape.

height=100;            //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;              //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;            // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;            // small circle overlap fraction
scircs=3;              //  number of small circles
step=1.2;              // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;      //  number of degrees in sturns
ldegr=360
lturns;      //  number of degrees in lturns
sdegrstp=sdegr/nstps;  // number of degrees per step
ldegrstp=ldegr/nstps;  // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape(c) {
rotate(360/scircsc)
translate([0,srad
(1-covlp)])
circle(sdiam);
}

// make base shape 3d
module base_shape(h,h2,s,s2,c) {
eps = 0.001;
// h = current height
// s = current step #, from 0
// c = circle index

hull() {
  echo(h,h2,s,s2,c);
  scale([s,s,1]) rotate(ldegrstp*h/step) translate([0,lrad,h])
  linear_extrude(height=eps)
  rotate(h/step*sdegrstp)
  shape(c);

  scale([s2,s2,1]) rotate(ldegrstp*h2/step) translate([0,lrad,h2-eps])
  linear_extrude(height=eps)
  rotate(h2/step*sdegrstp)
  shape(c);
}

}

module core(h,s) {
// h = vertical position
// s= scale factor

 scale([s,s,1])
 translate([0,0,h])
 linear_extrude(height=step)
 circle(d=ldiam);

}

module main(z,high) {
// z = starting position
// high = total height

 translate([0,0,z])
 for (p=[1:scols]) {
     rotate(360/scols*p) {
         //color("red") base();
         for(c=[1:scircs])
         for(h=[0:step:high-step]) {
             h2 = h+step;
             s=siz(h)/lrad;
             s2=siz(h2)/lrad;

             // send height, step#
             base_shape(h,h2,s,s2,c);
         }
     }
 }

 for(h=[0:step:high-step]) {
      s=siz(h)/lrad;
      core(h,s);
  }

}

main(0,height);

On Fri, Jul 12, 2024 at 6:36 PM denverh via Discuss <
discuss@lists.openscad.org> wrote:

Hello,

This design starts by rotating two or more overlapping circles around a
common center while extruding them upwards in the Z direction.  The
resulting braided column is then duplicated around a larger diameter.
The outer diameter changes as a function of Z and the columns spiral
around that some number of degrees.  Then the open center is filled with
a closed cylinder to make a solid.

The only way I can think of to change the diameter as a function of Z
and get the braided columns to spiral around is to create discrete
slices.  The thinner the slices are the smoother the result.  But I
always end up with something that takes many hours to generate an STL,
and contains a huge amount of geometry.  Perhaps this is the only way to
achieve the result I want, but I would be interested in hearing about
alternative approaches, especially if they take less time.  I usually
use a layer height (step) > 1.0 for testing, and no more than 0.2 for
the STL output.

Here's the code:
height=100;            //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;              //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;            // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;            // small circle overlap fraction
scircs=3;              //  number of small circles
step=1.2;              // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;      //  number of degrees in sturns
ldegr=360
lturns;      //  number of degrees in lturns
sdegrstp=sdegr/nstps;  // number of degrees per step
ldegrstp=ldegr/nstps;  // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape() {
for (c=[1:scircs]) {
rotate(360/scircsc)
translate([0,srad
(1-covlp)])
circle(sdiam);
}
}

// make base shape 3d
module base_shape(h,s) {
// h = current height
// s = current step #, from 0

  translate([0,0,h])
  linear_extrude(height=step, twist=-sdegrstp)
  rotate(s*sdegrstp)
  shape();

}

module core(h,s) {
// h = vertical position
// s= scale factor

  scale([s,s,1])
  translate([0,0,h])
  linear_extrude(height=step)
  circle(d=ldiam);

}

module main(z,high) {
// z = starting position
// high = total height

  translate([0,0,z])
  for (p=[1:scols]) {
      rotate(360/scols*p) {
          //color("red") base();
          for (h=[0:step:high]) {
              s=siz(h)/lrad;

              // adjust the profile shape
              scale([s,s,1])
              // twist as required
              rotate(ldegrstp*h/step)
              // shift to perimeter
              translate([0,lrad,0])
              // send height, step#
              base_shape(h,h/step);
              core(h,s);
          }
      }
  }

}

main(0,height);

Regards,

Denver


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

If you can break it down to slices of convex geometry (a single strand having a circular cross section), then doing a hull of consecutive slices works as a sort of sweep. The linear extrude height is changed to some miniscule epsilon (to make a technically 3d shape), and hull is done between two layers of the computed shape. height=100; //height ldiam=100; // large diameter lrad=ldiam/2; scols=20; // number of small columns sdiam=8; // diameter of small circles srad=sdiam/2; sturns=3.0; // number of rotations of small circles lturns=0.25; // number of turns for combined layers covlp=0.20; // small circle overlap fraction scircs=3; // number of small circles step=1.2; // vertical layer interval // calculated values nstps=height/step; // total number of vertical steps sdegr=360*sturns; // number of degrees in sturns ldegr=360*lturns; // number of degrees in lturns sdegrstp=sdegr/nstps; // number of degrees per step ldegrstp=ldegr/nstps; // number of degrees per step $fn=60; // sine function values ampl=20; // amplitude ofs=lrad-ampl; // offset from 0 wl=height*2; // wavelength shi=0; // shift in degrees degr=150; // degree range // calcualte size based on height function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); // make the base 2d shape module shape(c) { rotate(360/scircs*c) translate([0,srad*(1-covlp)]) circle(sdiam); } // make base shape 3d module base_shape(h,h2,s,s2,c) { eps = 0.001; // h = current height // s = current step #, from 0 // c = circle index hull() { echo(h,h2,s,s2,c); scale([s,s,1]) rotate(ldegrstp*h/step) translate([0,lrad,h]) linear_extrude(height=eps) rotate(h/step*sdegrstp) shape(c); scale([s2,s2,1]) rotate(ldegrstp*h2/step) translate([0,lrad,h2-eps]) linear_extrude(height=eps) rotate(h2/step*sdegrstp) shape(c); } } module core(h,s) { // h = vertical position // s= scale factor scale([s,s,1]) translate([0,0,h]) linear_extrude(height=step) circle(d=ldiam); } module main(z,high) { // z = starting position // high = total height translate([0,0,z]) for (p=[1:scols]) { rotate(360/scols*p) { //color("red") base(); for(c=[1:scircs]) for(h=[0:step:high-step]) { h2 = h+step; s=siz(h)/lrad; s2=siz(h2)/lrad; // send height, step# base_shape(h,h2,s,s2,c); } } } for(h=[0:step:high-step]) { s=siz(h)/lrad; core(h,s); } } main(0,height); On Fri, Jul 12, 2024 at 6:36 PM denverh via Discuss < discuss@lists.openscad.org> wrote: > Hello, > > This design starts by rotating two or more overlapping circles around a > common center while extruding them upwards in the Z direction. The > resulting braided column is then duplicated around a larger diameter. > The outer diameter changes as a function of Z and the columns spiral > around that some number of degrees. Then the open center is filled with > a closed cylinder to make a solid. > > The only way I can think of to change the diameter as a function of Z > and get the braided columns to spiral around is to create discrete > slices. The thinner the slices are the smoother the result. But I > always end up with something that takes many hours to generate an STL, > and contains a huge amount of geometry. Perhaps this is the only way to > achieve the result I want, but I would be interested in hearing about > alternative approaches, especially if they take less time. I usually > use a layer height (step) > 1.0 for testing, and no more than 0.2 for > the STL output. > > Here's the code: > height=100; //height > ldiam=100; // large diameter > lrad=ldiam/2; > scols=20; // number of small columns > sdiam=8; // diameter of small circles > srad=sdiam/2; > sturns=3.0; // number of rotations of small circles > lturns=0.25; // number of turns for combined layers > covlp=0.20; // small circle overlap fraction > scircs=3; // number of small circles > step=1.2; // vertical layer interval > > // calculated values > nstps=height/step; // total number of vertical steps > sdegr=360*sturns; // number of degrees in sturns > ldegr=360*lturns; // number of degrees in lturns > sdegrstp=sdegr/nstps; // number of degrees per step > ldegrstp=ldegr/nstps; // number of degrees per step > > $fn=60; > > // sine function values > ampl=20; // amplitude > ofs=lrad-ampl; // offset from 0 > wl=height*2; // wavelength > shi=0; // shift in degrees > degr=150; // degree range > > // calcualte size based on height > function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); > > // make the base 2d shape > module shape() { > for (c=[1:scircs]) { > rotate(360/scircs*c) > translate([0,srad*(1-covlp)]) > circle(sdiam); > } > } > > // make base shape 3d > module base_shape(h,s) { > // h = current height > // s = current step #, from 0 > > translate([0,0,h]) > linear_extrude(height=step, twist=-sdegrstp) > rotate(s*sdegrstp) > shape(); > } > > module core(h,s) { > // h = vertical position > // s= scale factor > > scale([s,s,1]) > translate([0,0,h]) > linear_extrude(height=step) > circle(d=ldiam); > } > > module main(z,high) { > // z = starting position > // high = total height > > translate([0,0,z]) > for (p=[1:scols]) { > rotate(360/scols*p) { > //color("red") base(); > for (h=[0:step:high]) { > s=siz(h)/lrad; > > // adjust the profile shape > scale([s,s,1]) > // twist as required > rotate(ldegrstp*h/step) > // shift to perimeter > translate([0,lrad,0]) > // send height, step# > base_shape(h,h/step); > core(h,s); > } > } > } > } > > main(0,height); > > > Regards, > > Denver > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
HL
Hans L
Sat, Jul 13, 2024 4:02 AM

Also the "core" was moved outside of the other loops so that it isn't
duplicated for every braid.

On Fri, Jul 12, 2024 at 11:00 PM Hans L thehans@gmail.com wrote:

If you can break it down to slices of convex geometry (a single strand
having a circular cross section), then doing a hull of consecutive slices
works as a sort of sweep.

The linear extrude height is changed to some miniscule epsilon (to make a
technically 3d shape), and hull is done between two layers of the computed
shape.

height=100;            //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;              //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;            // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;            // small circle overlap fraction
scircs=3;              //  number of small circles
step=1.2;              // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;      //  number of degrees in sturns
ldegr=360
lturns;      //  number of degrees in lturns
sdegrstp=sdegr/nstps;  // number of degrees per step
ldegrstp=ldegr/nstps;  // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape(c) {
rotate(360/scircsc)
translate([0,srad
(1-covlp)])
circle(sdiam);
}

// make base shape 3d
module base_shape(h,h2,s,s2,c) {
eps = 0.001;
// h = current height
// s = current step #, from 0
// c = circle index

 hull() {
   echo(h,h2,s,s2,c);
   scale([s,s,1]) rotate(ldegrstp*h/step) translate([0,lrad,h])
   linear_extrude(height=eps)
   rotate(h/step*sdegrstp)
   shape(c);

   scale([s2,s2,1]) rotate(ldegrstp*h2/step) translate([0,lrad,h2-eps])
   linear_extrude(height=eps)
   rotate(h2/step*sdegrstp)
   shape(c);
 }

}

module core(h,s) {
// h = vertical position
// s= scale factor

  scale([s,s,1])
  translate([0,0,h])
  linear_extrude(height=step)
  circle(d=ldiam);

}

module main(z,high) {
// z = starting position
// high = total height

  translate([0,0,z])
  for (p=[1:scols]) {
      rotate(360/scols*p) {
          //color("red") base();
          for(c=[1:scircs])
          for(h=[0:step:high-step]) {
              h2 = h+step;
              s=siz(h)/lrad;
              s2=siz(h2)/lrad;

              // send height, step#
              base_shape(h,h2,s,s2,c);
          }
      }
  }

  for(h=[0:step:high-step]) {
       s=siz(h)/lrad;
       core(h,s);
   }

}

main(0,height);

On Fri, Jul 12, 2024 at 6:36 PM denverh via Discuss <
discuss@lists.openscad.org> wrote:

Hello,

This design starts by rotating two or more overlapping circles around a
common center while extruding them upwards in the Z direction.  The
resulting braided column is then duplicated around a larger diameter.
The outer diameter changes as a function of Z and the columns spiral
around that some number of degrees.  Then the open center is filled with
a closed cylinder to make a solid.

The only way I can think of to change the diameter as a function of Z
and get the braided columns to spiral around is to create discrete
slices.  The thinner the slices are the smoother the result.  But I
always end up with something that takes many hours to generate an STL,
and contains a huge amount of geometry.  Perhaps this is the only way to
achieve the result I want, but I would be interested in hearing about
alternative approaches, especially if they take less time.  I usually
use a layer height (step) > 1.0 for testing, and no more than 0.2 for
the STL output.

Here's the code:
height=100;            //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;              //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;            // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;            // small circle overlap fraction
scircs=3;              //  number of small circles
step=1.2;              // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;      //  number of degrees in sturns
ldegr=360
lturns;      //  number of degrees in lturns
sdegrstp=sdegr/nstps;  // number of degrees per step
ldegrstp=ldegr/nstps;  // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape() {
for (c=[1:scircs]) {
rotate(360/scircsc)
translate([0,srad
(1-covlp)])
circle(sdiam);
}
}

// make base shape 3d
module base_shape(h,s) {
// h = current height
// s = current step #, from 0

  translate([0,0,h])
  linear_extrude(height=step, twist=-sdegrstp)
  rotate(s*sdegrstp)
  shape();

}

module core(h,s) {
// h = vertical position
// s= scale factor

  scale([s,s,1])
  translate([0,0,h])
  linear_extrude(height=step)
  circle(d=ldiam);

}

module main(z,high) {
// z = starting position
// high = total height

  translate([0,0,z])
  for (p=[1:scols]) {
      rotate(360/scols*p) {
          //color("red") base();
          for (h=[0:step:high]) {
              s=siz(h)/lrad;

              // adjust the profile shape
              scale([s,s,1])
              // twist as required
              rotate(ldegrstp*h/step)
              // shift to perimeter
              translate([0,lrad,0])
              // send height, step#
              base_shape(h,h/step);
              core(h,s);
          }
      }
  }

}

main(0,height);

Regards,

Denver


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

Also the "core" was moved outside of the other loops so that it isn't duplicated for every braid. On Fri, Jul 12, 2024 at 11:00 PM Hans L <thehans@gmail.com> wrote: > If you can break it down to slices of convex geometry (a single strand > having a circular cross section), then doing a hull of consecutive slices > works as a sort of sweep. > > The linear extrude height is changed to some miniscule epsilon (to make a > technically 3d shape), and hull is done between two layers of the computed > shape. > > height=100; //height > ldiam=100; // large diameter > lrad=ldiam/2; > scols=20; // number of small columns > sdiam=8; // diameter of small circles > srad=sdiam/2; > sturns=3.0; // number of rotations of small circles > lturns=0.25; // number of turns for combined layers > covlp=0.20; // small circle overlap fraction > scircs=3; // number of small circles > step=1.2; // vertical layer interval > > // calculated values > nstps=height/step; // total number of vertical steps > sdegr=360*sturns; // number of degrees in sturns > ldegr=360*lturns; // number of degrees in lturns > sdegrstp=sdegr/nstps; // number of degrees per step > ldegrstp=ldegr/nstps; // number of degrees per step > > $fn=60; > > // sine function values > ampl=20; // amplitude > ofs=lrad-ampl; // offset from 0 > wl=height*2; // wavelength > shi=0; // shift in degrees > degr=150; // degree range > > // calcualte size based on height > function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); > > // make the base 2d shape > module shape(c) { > rotate(360/scircs*c) > translate([0,srad*(1-covlp)]) > circle(sdiam); > } > > // make base shape 3d > module base_shape(h,h2,s,s2,c) { > eps = 0.001; > // h = current height > // s = current step #, from 0 > // c = circle index > > hull() { > echo(h,h2,s,s2,c); > scale([s,s,1]) rotate(ldegrstp*h/step) translate([0,lrad,h]) > linear_extrude(height=eps) > rotate(h/step*sdegrstp) > shape(c); > > scale([s2,s2,1]) rotate(ldegrstp*h2/step) translate([0,lrad,h2-eps]) > linear_extrude(height=eps) > rotate(h2/step*sdegrstp) > shape(c); > } > } > > module core(h,s) { > // h = vertical position > // s= scale factor > > scale([s,s,1]) > translate([0,0,h]) > linear_extrude(height=step) > circle(d=ldiam); > } > > module main(z,high) { > // z = starting position > // high = total height > > translate([0,0,z]) > for (p=[1:scols]) { > rotate(360/scols*p) { > //color("red") base(); > for(c=[1:scircs]) > for(h=[0:step:high-step]) { > h2 = h+step; > s=siz(h)/lrad; > s2=siz(h2)/lrad; > > // send height, step# > base_shape(h,h2,s,s2,c); > } > } > } > > for(h=[0:step:high-step]) { > s=siz(h)/lrad; > core(h,s); > } > } > > main(0,height); > > > > On Fri, Jul 12, 2024 at 6:36 PM denverh via Discuss < > discuss@lists.openscad.org> wrote: > >> Hello, >> >> This design starts by rotating two or more overlapping circles around a >> common center while extruding them upwards in the Z direction. The >> resulting braided column is then duplicated around a larger diameter. >> The outer diameter changes as a function of Z and the columns spiral >> around that some number of degrees. Then the open center is filled with >> a closed cylinder to make a solid. >> >> The only way I can think of to change the diameter as a function of Z >> and get the braided columns to spiral around is to create discrete >> slices. The thinner the slices are the smoother the result. But I >> always end up with something that takes many hours to generate an STL, >> and contains a huge amount of geometry. Perhaps this is the only way to >> achieve the result I want, but I would be interested in hearing about >> alternative approaches, especially if they take less time. I usually >> use a layer height (step) > 1.0 for testing, and no more than 0.2 for >> the STL output. >> >> Here's the code: >> height=100; //height >> ldiam=100; // large diameter >> lrad=ldiam/2; >> scols=20; // number of small columns >> sdiam=8; // diameter of small circles >> srad=sdiam/2; >> sturns=3.0; // number of rotations of small circles >> lturns=0.25; // number of turns for combined layers >> covlp=0.20; // small circle overlap fraction >> scircs=3; // number of small circles >> step=1.2; // vertical layer interval >> >> // calculated values >> nstps=height/step; // total number of vertical steps >> sdegr=360*sturns; // number of degrees in sturns >> ldegr=360*lturns; // number of degrees in lturns >> sdegrstp=sdegr/nstps; // number of degrees per step >> ldegrstp=ldegr/nstps; // number of degrees per step >> >> $fn=60; >> >> // sine function values >> ampl=20; // amplitude >> ofs=lrad-ampl; // offset from 0 >> wl=height*2; // wavelength >> shi=0; // shift in degrees >> degr=150; // degree range >> >> // calcualte size based on height >> function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); >> >> // make the base 2d shape >> module shape() { >> for (c=[1:scircs]) { >> rotate(360/scircs*c) >> translate([0,srad*(1-covlp)]) >> circle(sdiam); >> } >> } >> >> // make base shape 3d >> module base_shape(h,s) { >> // h = current height >> // s = current step #, from 0 >> >> translate([0,0,h]) >> linear_extrude(height=step, twist=-sdegrstp) >> rotate(s*sdegrstp) >> shape(); >> } >> >> module core(h,s) { >> // h = vertical position >> // s= scale factor >> >> scale([s,s,1]) >> translate([0,0,h]) >> linear_extrude(height=step) >> circle(d=ldiam); >> } >> >> module main(z,high) { >> // z = starting position >> // high = total height >> >> translate([0,0,z]) >> for (p=[1:scols]) { >> rotate(360/scols*p) { >> //color("red") base(); >> for (h=[0:step:high]) { >> s=siz(h)/lrad; >> >> // adjust the profile shape >> scale([s,s,1]) >> // twist as required >> rotate(ldegrstp*h/step) >> // shift to perimeter >> translate([0,lrad,0]) >> // send height, step# >> base_shape(h,h/step); >> core(h,s); >> } >> } >> } >> } >> >> main(0,height); >> >> >> Regards, >> >> Denver >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> >
SP
Sanjeev Prabhakar
Sat, Jul 13, 2024 5:11 PM

I tried with my python method:
just a rough attempt: scad file is 4 mb so not fit to share here, but it f6
renders in few seconds.

[image: Screenshot 2024-07-13 at 10.38.25 PM.png]

On Sat, 13 Jul 2024 at 05:06, denverh via Discuss <
discuss@lists.openscad.org> wrote:

Hello,

This design starts by rotating two or more overlapping circles around a
common center while extruding them upwards in the Z direction.  The
resulting braided column is then duplicated around a larger diameter.
The outer diameter changes as a function of Z and the columns spiral
around that some number of degrees.  Then the open center is filled with
a closed cylinder to make a solid.

The only way I can think of to change the diameter as a function of Z
and get the braided columns to spiral around is to create discrete
slices.  The thinner the slices are the smoother the result.  But I
always end up with something that takes many hours to generate an STL,
and contains a huge amount of geometry.  Perhaps this is the only way to
achieve the result I want, but I would be interested in hearing about
alternative approaches, especially if they take less time.  I usually
use a layer height (step) > 1.0 for testing, and no more than 0.2 for
the STL output.

Here's the code:
height=100;            //height
ldiam=100;              // large diameter
lrad=ldiam/2;
scols=20;              //  number of small columns
sdiam=8;                // diameter of small circles
srad=sdiam/2;
sturns=3.0;            // number of rotations of small circles
lturns=0.25;            // number of turns for combined layers
covlp=0.20;            // small circle overlap fraction
scircs=3;              //  number of small circles
step=1.2;              // vertical layer interval

// calculated values
nstps=height/step;      // total number of vertical steps
sdegr=360sturns;      //  number of degrees in sturns
ldegr=360
lturns;      //  number of degrees in lturns
sdegrstp=sdegr/nstps;  // number of degrees per step
ldegrstp=ldegr/nstps;  // number of degrees per step

$fn=60;

// sine function values
ampl=20;        // amplitude
ofs=lrad-ampl;        // offset from 0
wl=height*2;        // wavelength
shi=0;            // shift in degrees
degr=150;        // degree range

// calcualte size based on height
function siz(h)=(ofs+amplsin(degrh/height+shi));

// make the base 2d shape
module shape() {
for (c=[1:scircs]) {
rotate(360/scircsc)
translate([0,srad
(1-covlp)])
circle(sdiam);
}
}

// make base shape 3d
module base_shape(h,s) {
// h = current height
// s = current step #, from 0

  translate([0,0,h])
  linear_extrude(height=step, twist=-sdegrstp)
  rotate(s*sdegrstp)
  shape();

}

module core(h,s) {
// h = vertical position
// s= scale factor

  scale([s,s,1])
  translate([0,0,h])
  linear_extrude(height=step)
  circle(d=ldiam);

}

module main(z,high) {
// z = starting position
// high = total height

  translate([0,0,z])
  for (p=[1:scols]) {
      rotate(360/scols*p) {
          //color("red") base();
          for (h=[0:step:high]) {
              s=siz(h)/lrad;

              // adjust the profile shape
              scale([s,s,1])
              // twist as required
              rotate(ldegrstp*h/step)
              // shift to perimeter
              translate([0,lrad,0])
              // send height, step#
              base_shape(h,h/step);
              core(h,s);
          }
      }
  }

}

main(0,height);

Regards,

Denver


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

I tried with my python method: just a rough attempt: scad file is 4 mb so not fit to share here, but it f6 renders in few seconds. [image: Screenshot 2024-07-13 at 10.38.25 PM.png] On Sat, 13 Jul 2024 at 05:06, denverh via Discuss < discuss@lists.openscad.org> wrote: > Hello, > > This design starts by rotating two or more overlapping circles around a > common center while extruding them upwards in the Z direction. The > resulting braided column is then duplicated around a larger diameter. > The outer diameter changes as a function of Z and the columns spiral > around that some number of degrees. Then the open center is filled with > a closed cylinder to make a solid. > > The only way I can think of to change the diameter as a function of Z > and get the braided columns to spiral around is to create discrete > slices. The thinner the slices are the smoother the result. But I > always end up with something that takes many hours to generate an STL, > and contains a huge amount of geometry. Perhaps this is the only way to > achieve the result I want, but I would be interested in hearing about > alternative approaches, especially if they take less time. I usually > use a layer height (step) > 1.0 for testing, and no more than 0.2 for > the STL output. > > Here's the code: > height=100; //height > ldiam=100; // large diameter > lrad=ldiam/2; > scols=20; // number of small columns > sdiam=8; // diameter of small circles > srad=sdiam/2; > sturns=3.0; // number of rotations of small circles > lturns=0.25; // number of turns for combined layers > covlp=0.20; // small circle overlap fraction > scircs=3; // number of small circles > step=1.2; // vertical layer interval > > // calculated values > nstps=height/step; // total number of vertical steps > sdegr=360*sturns; // number of degrees in sturns > ldegr=360*lturns; // number of degrees in lturns > sdegrstp=sdegr/nstps; // number of degrees per step > ldegrstp=ldegr/nstps; // number of degrees per step > > $fn=60; > > // sine function values > ampl=20; // amplitude > ofs=lrad-ampl; // offset from 0 > wl=height*2; // wavelength > shi=0; // shift in degrees > degr=150; // degree range > > // calcualte size based on height > function siz(h)=(ofs+ampl*sin(degr*h/height+shi)); > > // make the base 2d shape > module shape() { > for (c=[1:scircs]) { > rotate(360/scircs*c) > translate([0,srad*(1-covlp)]) > circle(sdiam); > } > } > > // make base shape 3d > module base_shape(h,s) { > // h = current height > // s = current step #, from 0 > > translate([0,0,h]) > linear_extrude(height=step, twist=-sdegrstp) > rotate(s*sdegrstp) > shape(); > } > > module core(h,s) { > // h = vertical position > // s= scale factor > > scale([s,s,1]) > translate([0,0,h]) > linear_extrude(height=step) > circle(d=ldiam); > } > > module main(z,high) { > // z = starting position > // high = total height > > translate([0,0,z]) > for (p=[1:scols]) { > rotate(360/scols*p) { > //color("red") base(); > for (h=[0:step:high]) { > s=siz(h)/lrad; > > // adjust the profile shape > scale([s,s,1]) > // twist as required > rotate(ldegrstp*h/step) > // shift to perimeter > translate([0,lrad,0]) > // send height, step# > base_shape(h,h/step); > core(h,s); > } > } > } > } > > main(0,height); > > > Regards, > > Denver > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
D
denverh
Sat, Jul 13, 2024 10:28 PM

On 7/12/24 21:02, Hans L via Discuss wrote:

Also the "core" was moved outside of the other loops so that it isn't
duplicated for every braid.

On Fri, Jul 12, 2024 at 11:00 PM Hans L thehans@gmail.com wrote:

 If you can break it down to slices of convex geometry (a single
 strand having a circular cross section), then doing a hull of
 consecutive slices works as a sort of sweep.

 The linear extrude height is changed to some miniscule epsilon (to
 make a technically 3d shape), and hull is done between two layers
 of the computed shape.

Thanks, this works well.  I began the project this way, but when I began
making the changes for scaling the outer diameter and spiraling the
braids around it, I somehow couldn't get past the idea that I had to
operate on the cross-section of the braid, rather than a strand.  Since
the braid is partly concave, I couldn't use hull(), so I fell back on
thin slices.  With the larger step size, this now takes 15 to 20 minutes
instead of 15 to 20 hours.

And thanks to everyone who responded with helpful suggestions. They're
all appreciated.  Sanjeev's results are impressive indeed. I have read a
few articles about creating models that way, but it's a bit beyond my
current level of ability with OpenSCAD.  Definitely something to keep in
mind for the future, though.

Thanks again everyone!

Denver

On 7/12/24 21:02, Hans L via Discuss wrote: > Also the "core" was moved outside of the other loops so that it isn't > duplicated for every braid. > > On Fri, Jul 12, 2024 at 11:00 PM Hans L <thehans@gmail.com> wrote: > > If you can break it down to slices of convex geometry (a single > strand having a circular cross section), then doing a hull of > consecutive slices works as a sort of sweep. > > The linear extrude height is changed to some miniscule epsilon (to > make a technically 3d shape), and hull is done between two layers > of the computed shape. > Thanks, this works well.  I began the project this way, but when I began making the changes for scaling the outer diameter and spiraling the braids around it, I somehow couldn't get past the idea that I had to operate on the cross-section of the braid, rather than a strand.  Since the braid is partly concave, I couldn't use hull(), so I fell back on thin slices.  With the larger step size, this now takes 15 to 20 minutes instead of 15 to 20 hours. And thanks to everyone who responded with helpful suggestions. They're all appreciated.  Sanjeev's results are impressive indeed. I have read a few articles about creating models that way, but it's a bit beyond my current level of ability with OpenSCAD.  Definitely something to keep in mind for the future, though. Thanks again everyone! Denver
HL
Hans L
Sat, Jul 13, 2024 11:19 PM

By the way, if you run a recent development snapshot from here:
https://openscad.org/downloads#snapshots
and enable "Manifold" in the experimental features preferences, then it
renders in about 1 second at the current detail level.

On Sat, Jul 13, 2024 at 5:28 PM denverh via Discuss <
discuss@lists.openscad.org> wrote:

On 7/12/24 21:02, Hans L via Discuss wrote:

Also the "core" was moved outside of the other loops so that it isn't
duplicated for every braid.

On Fri, Jul 12, 2024 at 11:00 PM Hans L thehans@gmail.com wrote:

If you can break it down to slices of convex geometry (a single strand
having a circular cross section), then doing a hull of consecutive slices
works as a sort of sweep.

The linear extrude height is changed to some miniscule epsilon (to make a
technically 3d shape), and hull is done between two layers of the computed
shape.

Thanks, this works well.  I began the project this way, but when I began
making the changes for scaling the outer diameter and spiraling the braids
around it, I somehow couldn't get past the idea that I had to operate on
the cross-section of the braid, rather than a strand.  Since the braid is
partly concave, I couldn't use hull(), so I fell back on thin slices.  With
the larger step size, this now takes 15 to 20 minutes instead of 15 to 20
hours.

And thanks to everyone who responded with helpful suggestions.  They're
all appreciated.  Sanjeev's results are impressive indeed.  I have read a
few articles about creating models that way, but it's a bit beyond my
current level of ability with OpenSCAD.  Definitely something to keep in
mind for the future, though.

Thanks again everyone!

Denver


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

By the way, if you run a recent development snapshot from here: https://openscad.org/downloads#snapshots and enable "Manifold" in the experimental features preferences, then it renders in about 1 second at the current detail level. On Sat, Jul 13, 2024 at 5:28 PM denverh via Discuss < discuss@lists.openscad.org> wrote: > On 7/12/24 21:02, Hans L via Discuss wrote: > > Also the "core" was moved outside of the other loops so that it isn't > duplicated for every braid. > > On Fri, Jul 12, 2024 at 11:00 PM Hans L <thehans@gmail.com> wrote: > >> If you can break it down to slices of convex geometry (a single strand >> having a circular cross section), then doing a hull of consecutive slices >> works as a sort of sweep. >> >> The linear extrude height is changed to some miniscule epsilon (to make a >> technically 3d shape), and hull is done between two layers of the computed >> shape. >> > Thanks, this works well. I began the project this way, but when I began > making the changes for scaling the outer diameter and spiraling the braids > around it, I somehow couldn't get past the idea that I had to operate on > the cross-section of the braid, rather than a strand. Since the braid is > partly concave, I couldn't use hull(), so I fell back on thin slices. With > the larger step size, this now takes 15 to 20 minutes instead of 15 to 20 > hours. > > And thanks to everyone who responded with helpful suggestions. They're > all appreciated. Sanjeev's results are impressive indeed. I have read a > few articles about creating models that way, but it's a bit beyond my > current level of ability with OpenSCAD. Definitely something to keep in > mind for the future, though. > > Thanks again everyone! > > Denver > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
D
denverh
Sun, Jul 14, 2024 3:41 AM

On 7/13/24 16:19, Hans L via Discuss wrote:

By the way, if you run a recent development snapshot from here:
https://openscad.org/downloads#snapshots
and enable "Manifold" in the experimental features preferences, then
it renders in about 1 second at the current detail level.

I'll give that a try, thanks!

On Sat, Jul 13, 2024 at 5:28 PM denverh via Discuss
discuss@lists.openscad.org wrote:

 On 7/12/24 21:02, Hans L via Discuss wrote:
 Also the "core" was moved outside of the other loops so that it
 isn't duplicated for every braid.

 On Fri, Jul 12, 2024 at 11:00 PM Hans L <thehans@gmail.com> wrote:

     If you can break it down to slices of convex geometry (a
     single strand having a circular cross section), then doing a
     hull of consecutive slices works as a sort of sweep.

     The linear extrude height is changed to some miniscule
     epsilon (to make a technically 3d shape), and hull is done
     between two layers of the computed shape.
 Thanks, this works well.  I began the project this way, but when I
 began making the changes for scaling the outer diameter and
 spiraling the braids around it, I somehow couldn't get past the
 idea that I had to operate on the cross-section of the braid,
 rather than a strand.  Since the braid is partly concave, I
 couldn't use hull(), so I fell back on thin slices.  With the
 larger step size, this now takes 15 to 20 minutes instead of 15 to
 20 hours.

 And thanks to everyone who responded with helpful suggestions. 
 They're all appreciated.  Sanjeev's results are impressive
 indeed.  I have read a few articles about creating models that
 way, but it's a bit beyond my current level of ability with
 OpenSCAD.  Definitely something to keep in mind for the future,
 though.

 Thanks again everyone!

 Denver

 _______________________________________________
 OpenSCAD mailing list
 To unsubscribe send an email to discuss-leave@lists.openscad.org

OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

On 7/13/24 16:19, Hans L via Discuss wrote: > By the way, if you run a recent development snapshot from here: > https://openscad.org/downloads#snapshots > and enable "Manifold" in the experimental features preferences, then > it renders in about 1 second at the current detail level. I'll give that a try, thanks! > > On Sat, Jul 13, 2024 at 5:28 PM denverh via Discuss > <discuss@lists.openscad.org> wrote: > > On 7/12/24 21:02, Hans L via Discuss wrote: >> Also the "core" was moved outside of the other loops so that it >> isn't duplicated for every braid. >> >> On Fri, Jul 12, 2024 at 11:00 PM Hans L <thehans@gmail.com> wrote: >> >> If you can break it down to slices of convex geometry (a >> single strand having a circular cross section), then doing a >> hull of consecutive slices works as a sort of sweep. >> >> The linear extrude height is changed to some miniscule >> epsilon (to make a technically 3d shape), and hull is done >> between two layers of the computed shape. >> > Thanks, this works well.  I began the project this way, but when I > began making the changes for scaling the outer diameter and > spiraling the braids around it, I somehow couldn't get past the > idea that I had to operate on the cross-section of the braid, > rather than a strand.  Since the braid is partly concave, I > couldn't use hull(), so I fell back on thin slices.  With the > larger step size, this now takes 15 to 20 minutes instead of 15 to > 20 hours. > > And thanks to everyone who responded with helpful suggestions.  > They're all appreciated.  Sanjeev's results are impressive > indeed.  I have read a few articles about creating models that > way, but it's a bit beyond my current level of ability with > OpenSCAD.  Definitely something to keep in mind for the future, > though. > > Thanks again everyone! > > Denver > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org