discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

module [maybe later function] spiral(rev, hfac, wfac, base_r, sp_r)

RT
r.d. terramir
Sat, Sep 8, 2018 10:05 PM

I need a little help finishing this function to be exact I would like
hfac to be just spiral height in mm from center wire to center wire,
but somehow I endup fraking it up algebra can suck at times but I
think I just not seeing the solution as the germans' say "can't see
the forest because of all the trees"
here is my budding function with instructions :
<code>

module spiral(rev,hfac,wfac,base_r,sp_r){
for (i=[0:0.5:rev*360]){
translate([0,0,i/hfac])
rotate([90,0,i])
translate([base_r-(i/wfac),0,0])
cylinder(r=sp_r, h=0.4, $fn=32);
}

}
/spiral module instructions
rev= revolutions the spiral makes
hfac= height factor derived by (360
rev)/height in mm)
wfac= incline of the spiral minimum about 15% of rev*360 play with it
to get your best approximate shape) anything under 15% gives you wierd
inverted results before the top
base_r= radius of the bottom spiral
sp_r= radius of the "wire" in mm

*/
// example
spiral(4,60,170,8.75,0.9);
</code>
help
terramir

I need a little help finishing this function to be exact I would like hfac to be just spiral height in mm from center wire to center wire, but somehow I endup fraking it up algebra can suck at times but I think I just not seeing the solution as the germans' say "can't see the forest because of all the trees" here is my budding function with instructions : <code> module spiral(rev,hfac,wfac,base_r,sp_r){ for (i=[0:0.5:rev*360]){ translate([0,0,i/hfac]) rotate([90,0,i]) translate([base_r-(i/wfac),0,0]) cylinder(r=sp_r, h=0.4, $fn=32); } } /*spiral module instructions rev= revolutions the spiral makes hfac= height factor derived by (360*rev)/height in mm) wfac= incline of the spiral minimum about 15% of rev*360 play with it to get your best approximate shape) anything under 15% gives you wierd inverted results before the top base_r= radius of the bottom spiral sp_r= radius of the "wire" in mm */ // example spiral(4,60,170,8.75,0.9); </code> help terramir
N
NateTG
Sat, Sep 8, 2018 11:11 PM

This one might make more sense.

coil.scad http://forum.openscad.org/file/t2140/coil.scad

There may be some other way to do things, but this calculates the path the
spring is on and then 'extrudes' along that path.

--
Sent from: http://forum.openscad.org/

This one might make more sense. coil.scad <http://forum.openscad.org/file/t2140/coil.scad> There may be some other way to do things, but this calculates the path the spring is on and then 'extrudes' along that path. -- Sent from: http://forum.openscad.org/
RT
r.d. terramir
Sat, Sep 8, 2018 11:35 PM

Yes it makes more sense in someways, but it does not have clear
instructions.
The angles are needed instead of the amount of rotations.
terramir

On Sep 8, 2018 4:11 PM, "NateTG" nate-openscadforum@pedantic.org wrote:

This one might make more sense.

coil.scad http://forum.openscad.org/file/t2140/coil.scad

There may be some other way to do things, but this calculates the path the
spring is on and then 'extrudes' along that path.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Yes it makes more sense in someways, but it does not have clear instructions. The angles are needed instead of the amount of rotations. terramir On Sep 8, 2018 4:11 PM, "NateTG" <nate-openscadforum@pedantic.org> wrote: > This one might make more sense. > > coil.scad <http://forum.openscad.org/file/t2140/coil.scad> > > There may be some other way to do things, but this calculates the path the > spring is on and then 'extrudes' along that path. > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
N
NateTG
Sun, Sep 9, 2018 2:05 AM

If you want to do the angles in degrees instead, you can just replace 360
with 1.

Lines 42-46 and then 63-72 make the tapered windings.

It's possible to do fancier stuff to get something that looks better, but
I'm not sure what application you have in mind.

--
Sent from: http://forum.openscad.org/

If you want to do the angles in degrees instead, you can just replace 360 with 1. Lines 42-46 and then 63-72 make the tapered windings. It's possible to do fancier stuff to get something that looks better, but I'm not sure what application you have in mind. -- Sent from: http://forum.openscad.org/
R
Ronaldo
Sun, Sep 9, 2018 5:39 PM

NateTG wrote

This one might make more sense.

coil.scad <http://forum.openscad.org/file/t2140/coil.scad>

There may be some other way to do things, but this calculates the path the
spring is on and then 'extrudes' along that path.

The coil code is indeed a specific sweep of a circle along a path. It has
however many cracks and it is inadequate for 3d printing for instance. There
are many codes out there aiming to sweep a planar section along a path. The
following is one more version that resorts to the heterodox hull of a
degenerated polyhedron that some people would argue against but which
simplifies the code a lot. For simplicity, this sweep does not avoid
undesirable twists along the path as can be seen by running

sweep(coilpath(), 3dsquare(1));

coil_sweep.scad http://forum.openscad.org/file/t1275/coil_sweep.scad

--
Sent from: http://forum.openscad.org/

NateTG wrote > This one might make more sense. > > coil.scad &lt;http://forum.openscad.org/file/t2140/coil.scad&gt; > > There may be some other way to do things, but this calculates the path the > spring is on and then 'extrudes' along that path. The coil code is indeed a specific sweep of a circle along a path. It has however many cracks and it is inadequate for 3d printing for instance. There are many codes out there aiming to sweep a planar section along a path. The following is one more version that resorts to the heterodox hull of a degenerated polyhedron that some people would argue against but which simplifies the code a lot. For simplicity, this sweep does not avoid undesirable twists along the path as can be seen by running sweep(coilpath(), 3dsquare(1)); coil_sweep.scad <http://forum.openscad.org/file/t1275/coil_sweep.scad> -- Sent from: http://forum.openscad.org/
RT
r.d. terramir
Mon, Sep 10, 2018 2:45 AM

Well what I did is actually working albeit I had to change some stuff to
negative cause it was winding in the wrong direction. I got the cutout for
the spring I did a wall test print and with a little prep it worked.
So now just design the battery box to go with it.
terramir

On Sep 8, 2018 7:06 PM, "NateTG" nate-openscadforum@pedantic.org wrote:

If you want to do the angles in degrees instead, you can just replace 360
with 1.

Lines 42-46 and then 63-72 make the tapered windings.

It's possible to do fancier stuff to get something that looks better, but
I'm not sure what application you have in mind.

--
Sent from: http://forum.openscad.org/


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

Well what I did is actually working albeit I had to change some stuff to negative cause it was winding in the wrong direction. I got the cutout for the spring I did a wall test print and with a little prep it worked. So now just design the battery box to go with it. terramir On Sep 8, 2018 7:06 PM, "NateTG" <nate-openscadforum@pedantic.org> wrote: > If you want to do the angles in degrees instead, you can just replace 360 > with 1. > > Lines 42-46 and then 63-72 make the tapered windings. > > It's possible to do fancier stuff to get something that looks better, but > I'm not sure what application you have in mind. > > > > > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >