Drawing tools

classic Classic list List threaded Threaded
82 messages Options
12345
Reply | Threaded
Open this post in threaded view
|

Drawing tools

William Adams-2
Okay, I'm working on creating models of all the tools I use on my ShapeOko.

The boxes for the endmills was trivial, and I did okay on the machinist's square (if I re-work the code so that it's nicely parameterized is there somewhere I could share it?), but I've been absolutely stymied by how to extrude a hexagon for a set of Allen wrenches.

Is there something I missed?

I _really_ wish that there was an interaction option which would let me grab a node in the preview window, move it, and then have the code window up-date.

William

--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

clothbot
For hexagons of a given flat diameter, I usually implement them with an intersection of rotated rectangles:

--snip--

module hexagon(flat_d=10.0) {
intersection() {
square([flat_d,2*flat_d],center=true);
rotate(60) square([flat_d,2*flat_d],center=true);
rotate(-60) square([flat_d,2*flat_d],center=true);
}
}
hexagon(flat_d=13.5);
% circle($fn=6,r=13.5/2);
--end-snip--

Andrew.

On 2013-05-31, at 9:06 AM, William Adams wrote:

Okay, I'm working on creating models of all the tools I use on my ShapeOko.

The boxes for the endmills was trivial, and I did okay on the machinist's square (if I re-work the code so that it's nicely parameterized is there somewhere I could share it?), but I've been absolutely stymied by how to extrude a hexagon for a set of Allen wrenches.

Is there something I missed?

I _really_ wish that there was an interaction option which would let me grab a node in the preview window, move it, and then have the code window up-date.

William

--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

nophead
In reply to this post by William Adams-2
linear_extrude(height = h)
   circle($fn = 6, r = r);

or simply:
   cylinder($fn = 6, r = r, h = h);


On 31 May 2013 14:06, William Adams <[hidden email]> wrote:
Okay, I'm working on creating models of all the tools I use on my ShapeOko.

The boxes for the endmills was trivial, and I did okay on the machinist's square (if I re-work the code so that it's nicely parameterized is there somewhere I could share it?), but I've been absolutely stymied by how to extrude a hexagon for a set of Allen wrenches.

Is there something I missed?

I _really_ wish that there was an interaction option which would let me grab a node in the preview window, move it, and then have the code window up-date.

William

--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

kintel
Administrator
In reply to this post by clothbot
On 2013-05-31, at 09:36 , Andrew Plumb wrote:

> For hexagons of a given flat diameter, I usually implement them with an intersection of rotated rectangles:
>
Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

clothbot

On 2013-05-31, at 10:39 AM, Marius Kintel wrote:

On 2013-05-31, at 09:36 , Andrew Plumb wrote:

For hexagons of a given flat diameter, I usually implement them with an intersection of rotated rectangles:

Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

-Marius

When that starts to happen I often explicitly insert render() op's to flatten the 2D geometry before it's used for extrusions and in other higher-level operations.

Andrew.

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

kintel
Administrator
On 2013-05-31, at 10:52 , Andrew Plumb wrote:
>
> When that starts to happen I often explicitly insert render() op's to flatten the 2D geometry before it's used for extrusions and in other higher-level operations.
>
Yep, that's a decent workaround - only drawback is that it has to drop into CGAL, but for small components that's fast enough and will be cached.

 -Marius

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

William Adams-2
In reply to this post by kintel
On May 31, 2013, at 10:39 AM, Marius Kintel wrote:

> Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

After thinking on that, I realized that it'd be pretty simple to just define this as a polygon:

module hexagon(hex_size) {
polygon(points=[[0.288665*hex_size,0],[0.866005*hex_size,0],[1.15467*hex_size,0.5*hex_size],[0.866005*hex_size,1*hex_size], [0.288665*hex_size,1*hex_size], [0,0.5*hex_size]]);
}

linear_extrude(height=66)
hexagon(4);

I suppose there's some fancy / formulaic way to derive the numbers, but math / geometry was never my strong suit --- now I just need to work out how to extrude it into a hex key w/ a rounded bend....

I'm faintly surprised that there isn't a standard library of geometric primitives.

Thanks!

William


--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

nophead
You can make all the regular polygons with circle() by setting $fn.


On 31 May 2013 20:15, William Adams <[hidden email]> wrote:
On May 31, 2013, at 10:39 AM, Marius Kintel wrote:

> Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

After thinking on that, I realized that it'd be pretty simple to just define this as a polygon:

module hexagon(hex_size) {
polygon(points=[[0.288665*hex_size,0],[0.866005*hex_size,0],[1.15467*hex_size,0.5*hex_size],[0.866005*hex_size,1*hex_size], [0.288665*hex_size,1*hex_size], [0,0.5*hex_size]]);
}

linear_extrude(height=66)
hexagon(4);

I suppose there's some fancy / formulaic way to derive the numbers, but math / geometry was never my strong suit --- now I just need to work out how to extrude it into a hex key w/ a rounded bend....

I'm faintly surprised that there isn't a standard library of geometric primitives.

Thanks!

William


--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

William Adams-2
On May 31, 2013, at 3:23 PM, nop head wrote:

> You can make all the regular polygons with circle() by setting $fn.

but won't the polygon be inset w/in the (ideal) circle?

William

--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

Jeff Senn-2
In reply to this post by nophead
Yep.  In fact, if you want "flat side" radius you can even do something as complicated as:

module regular_poly(flat_radius,sides) {
    rotate(180/sides) circle(r=flat_radius/cos(180/sides),$fn=sides);
}


On May 31, 2013, at 3:23 PM, nop head <[hidden email]> wrote:

You can make all the regular polygons with circle() by setting $fn.


On 31 May 2013 20:15, William Adams <[hidden email]> wrote:
On May 31, 2013, at 10:39 AM, Marius Kintel wrote:

> Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

After thinking on that, I realized that it'd be pretty simple to just define this as a polygon:

module hexagon(hex_size) {
polygon(points=[[0.288665*hex_size,0],[0.866005*hex_size,0],[1.15467*hex_size,0.5*hex_size],[0.866005*hex_size,1*hex_size], [0.288665*hex_size,1*hex_size], [0,0.5*hex_size]]);
}

linear_extrude(height=66)
hexagon(4);

I suppose there's some fancy / formulaic way to derive the numbers, but math / geometry was never my strong suit --- now I just need to work out how to extrude it into a hex key w/ a rounded bend....

I'm faintly surprised that there isn't a standard library of geometric primitives.

Thanks!

William


--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

Peter Falke
This makes nice nuts, but dont bump fn_rr up too high.
Otherwise you get really long render times.

// (c) 2013 TakeItAndRun


h=5;

r=10/2;

fn_r=6;

rr=2;

fn_rr=16;


// unit vectors

xaxis=[1,0,0];

yaxis=[0,1,0];

zaxis=[0,0,1];


module point(){

sphere(rr,$fn=fn_rr);

}

module nut(){

for(i=[0:fn_r])

rotate(i*360/fn_r)

translate(r/cos(fn_r)*xaxis){

point();

translate((h-rr)*zaxis)point();

}

}


hull()nut();







On 31 May 2013 22:33, Jeff Senn <[hidden email]> wrote:
Yep.  In fact, if you want "flat side" radius you can even do something as complicated as:

module regular_poly(flat_radius,sides) {
    rotate(180/sides) circle(r=flat_radius/cos(180/sides),$fn=sides);
}


On May 31, 2013, at 3:23 PM, nop head <[hidden email]> wrote:

You can make all the regular polygons with circle() by setting $fn.


On 31 May 2013 20:15, William Adams <[hidden email]> wrote:
On May 31, 2013, at 10:39 AM, Marius Kintel wrote:

> Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

After thinking on that, I realized that it'd be pretty simple to just define this as a polygon:

module hexagon(hex_size) {
polygon(points=[[0.288665*hex_size,0],[0.866005*hex_size,0],[1.15467*hex_size,0.5*hex_size],[0.866005*hex_size,1*hex_size], [0.288665*hex_size,1*hex_size], [0,0.5*hex_size]]);
}

linear_extrude(height=66)
hexagon(4);

I suppose there's some fancy / formulaic way to derive the numbers, but math / geometry was never my strong suit --- now I just need to work out how to extrude it into a hex key w/ a rounded bend....

I'm faintly surprised that there isn't a standard library of geometric primitives.

Thanks!

William


--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

Kevin Crowley
I just wrote a hexagon module.

r is the radius of the inside circle
 x and y are the coordinates of the center of the hexagon.


module hexagon(r,x,y){

polygon(points=[[(r+x),(r*(tan(30)))+y],
                [x,(r*(2/sqrt(3)))+y],
                [-r+x,(r*(tan(30)))+y],
                [-r+x,-(r*(tan(30)))+y],
                [x,-(r*(2/sqrt(3)))+y], 
                [r+x,-(r*(tan(30)))+y]]);
         
 }
 
 hexagon(1,11,-1);
 hexagon(1,0,0);


On Sat, Jun 1, 2013 at 3:17 AM, Peter Falke <[hidden email]> wrote:
This makes nice nuts, but dont bump fn_rr up too high.
Otherwise you get really long render times.

// (c) 2013 TakeItAndRun


h=5;

r=10/2;

fn_r=6;

rr=2;

fn_rr=16;


// unit vectors

xaxis=[1,0,0];

yaxis=[0,1,0];

zaxis=[0,0,1];


module point(){

sphere(rr,$fn=fn_rr);

}

module nut(){

for(i=[0:fn_r])

rotate(i*360/fn_r)

translate(r/cos(fn_r)*xaxis){

point();

translate((h-rr)*zaxis)point();

}

}


hull()nut();







On 31 May 2013 22:33, Jeff Senn <[hidden email]> wrote:
Yep.  In fact, if you want "flat side" radius you can even do something as complicated as:

module regular_poly(flat_radius,sides) {
    rotate(180/sides) circle(r=flat_radius/cos(180/sides),$fn=sides);
}


On May 31, 2013, at 3:23 PM, nop head <[hidden email]> wrote:

You can make all the regular polygons with circle() by setting $fn.


On 31 May 2013 20:15, William Adams <[hidden email]> wrote:
On May 31, 2013, at 10:39 AM, Marius Kintel wrote:

> Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

After thinking on that, I realized that it'd be pretty simple to just define this as a polygon:

module hexagon(hex_size) {
polygon(points=[[0.288665*hex_size,0],[0.866005*hex_size,0],[1.15467*hex_size,0.5*hex_size],[0.866005*hex_size,1*hex_size], [0.288665*hex_size,1*hex_size], [0,0.5*hex_size]]);
}

linear_extrude(height=66)
hexagon(4);

I suppose there's some fancy / formulaic way to derive the numbers, but math / geometry was never my strong suit --- now I just need to work out how to extrude it into a hex key w/ a rounded bend....

I'm faintly surprised that there isn't a standard library of geometric primitives.

Thanks!

William


--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

Peter Falke
@Kevin
Is your module faster than circle(r/cos(60),$fn=6);  ?

Sincerely TakeItAndRun


On 1 June 2013 17:53, Kevin Crowley <[hidden email]> wrote:
I just wrote a hexagon module.

r is the radius of the inside circle
 x and y are the coordinates of the center of the hexagon.


module hexagon(r,x,y){

polygon(points=[[(r+x),(r*(tan(30)))+y],
                [x,(r*(2/sqrt(3)))+y],
                [-r+x,(r*(tan(30)))+y],
                [-r+x,-(r*(tan(30)))+y],
                [x,-(r*(2/sqrt(3)))+y], 
                [r+x,-(r*(tan(30)))+y]]);
         
 }
 
 hexagon(1,11,-1);
 hexagon(1,0,0);


On Sat, Jun 1, 2013 at 3:17 AM, Peter Falke <[hidden email]> wrote:
This makes nice nuts, but dont bump fn_rr up too high.
Otherwise you get really long render times.

// (c) 2013 TakeItAndRun


h=5;

r=10/2;

fn_r=6;

rr=2;

fn_rr=16;


// unit vectors

xaxis=[1,0,0];

yaxis=[0,1,0];

zaxis=[0,0,1];


module point(){

sphere(rr,$fn=fn_rr);

}

module nut(){

for(i=[0:fn_r])

rotate(i*360/fn_r)

translate(r/cos(fn_r)*xaxis){

point();

translate((h-rr)*zaxis)point();

}

}


hull()nut();







On 31 May 2013 22:33, Jeff Senn <[hidden email]> wrote:
Yep.  In fact, if you want "flat side" radius you can even do something as complicated as:

module regular_poly(flat_radius,sides) {
    rotate(180/sides) circle(r=flat_radius/cos(180/sides),$fn=sides);
}


On May 31, 2013, at 3:23 PM, nop head <[hidden email]> wrote:

You can make all the regular polygons with circle() by setting $fn.


On 31 May 2013 20:15, William Adams <[hidden email]> wrote:
On May 31, 2013, at 10:39 AM, Marius Kintel wrote:

> Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

After thinking on that, I realized that it'd be pretty simple to just define this as a polygon:

module hexagon(hex_size) {
polygon(points=[[0.288665*hex_size,0],[0.866005*hex_size,0],[1.15467*hex_size,0.5*hex_size],[0.866005*hex_size,1*hex_size], [0.288665*hex_size,1*hex_size], [0,0.5*hex_size]]);
}

linear_extrude(height=66)
hexagon(4);

I suppose there's some fancy / formulaic way to derive the numbers, but math / geometry was never my strong suit --- now I just need to work out how to extrude it into a hex key w/ a rounded bend....

I'm faintly surprised that there isn't a standard library of geometric primitives.

Thanks!

William


--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

William Adams-2
In reply to this post by Kevin Crowley
On Sat, Jun 1, 2013 at 11:53 AM, Kevin Crowley <[hidden email]> wrote:
I just wrote a hexagon module.

Thanks! That's perfect!

I've just about got it, but for some reason the intersection isn't working:

 module hexagon(r){

polygon(points=[[r,(r*(tan(30)))],

[0,(r*(2/sqrt(3)))],

[-r,(r*(tan(30)))],

[-r,-(r*(tan(30)))],

[0,-(r*(2/sqrt(3)))],

[r,-(r*(tan(30)))]]);

}

module hexkey (hex_size, hex_length, hex_blade) {

intersection() {

translate([-hex_size, -hex_size*2, -hex_size/2])

%cube(size=[hex_size*2.51,hex_size*2.51,hex_size*2.51]);

}

translate([0, -hex_size*2, hex_size*2])

rotate([0,90,0])

rotate_extrude()

translate([hex_size*2, 0, 0])

rotate([0,0,90])

hexagon(hex_size/2);

//}

translate([0, 0, hex_size*2])

linear_extrude(height=hex_length-hex_size*2)

hexagon(hex_size/2);

translate([0, -hex_size*2, 0])

rotate([90,0,0])

linear_extrude(height=hex_blade-hex_size*2)

hexagon(hex_size/2);

}


hexkey (4,73,28);


What do I need to do to get the %cube to cut off the circling hexagon?


William


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

Kevin Crowley
In reply to this post by Peter Falke
It is probably slower but it has the advantage always being a hexagon.  regardless of of any of the $f values.


On Sat, Jun 1, 2013 at 6:38 PM, Peter Falke <[hidden email]> wrote:
@Kevin
Is your module faster than circle(r/cos(60),$fn=6);  ?

Sincerely TakeItAndRun


On 1 June 2013 17:53, Kevin Crowley <[hidden email]> wrote:
I just wrote a hexagon module.

r is the radius of the inside circle
 x and y are the coordinates of the center of the hexagon.


module hexagon(r,x,y){

polygon(points=[[(r+x),(r*(tan(30)))+y],
                [x,(r*(2/sqrt(3)))+y],
                [-r+x,(r*(tan(30)))+y],
                [-r+x,-(r*(tan(30)))+y],
                [x,-(r*(2/sqrt(3)))+y], 
                [r+x,-(r*(tan(30)))+y]]);
         
 }
 
 hexagon(1,11,-1);
 hexagon(1,0,0);


On Sat, Jun 1, 2013 at 3:17 AM, Peter Falke <[hidden email]> wrote:
This makes nice nuts, but dont bump fn_rr up too high.
Otherwise you get really long render times.

// (c) 2013 TakeItAndRun


h=5;

r=10/2;

fn_r=6;

rr=2;

fn_rr=16;


// unit vectors

xaxis=[1,0,0];

yaxis=[0,1,0];

zaxis=[0,0,1];


module point(){

sphere(rr,$fn=fn_rr);

}

module nut(){

for(i=[0:fn_r])

rotate(i*360/fn_r)

translate(r/cos(fn_r)*xaxis){

point();

translate((h-rr)*zaxis)point();

}

}


hull()nut();







On 31 May 2013 22:33, Jeff Senn <[hidden email]> wrote:
Yep.  In fact, if you want "flat side" radius you can even do something as complicated as:

module regular_poly(flat_radius,sides) {
    rotate(180/sides) circle(r=flat_radius/cos(180/sides),$fn=sides);
}


On May 31, 2013, at 3:23 PM, nop head <[hidden email]> wrote:

You can make all the regular polygons with circle() by setting $fn.


On 31 May 2013 20:15, William Adams <[hidden email]> wrote:
On May 31, 2013, at 10:39 AM, Marius Kintel wrote:

> Note that intersections could be slow when used in larger assemblies (due to the inner workings of OpenCSG).

After thinking on that, I realized that it'd be pretty simple to just define this as a polygon:

module hexagon(hex_size) {
polygon(points=[[0.288665*hex_size,0],[0.866005*hex_size,0],[1.15467*hex_size,0.5*hex_size],[0.866005*hex_size,1*hex_size], [0.288665*hex_size,1*hex_size], [0,0.5*hex_size]]);
}

linear_extrude(height=66)
hexagon(4);

I suppose there's some fancy / formulaic way to derive the numbers, but math / geometry was never my strong suit --- now I just need to work out how to extrude it into a hex key w/ a rounded bend....

I'm faintly surprised that there isn't a standard library of geometric primitives.

Thanks!

William


--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566



--
[hidden email]

P.S. Falls meine E-Mail kürzer ausfällt als Dir angenehm ist:
Ich probiere gerade aus kurze Antworten statt gar keine Antworten zu schreiben.
Wenn Du gerne mehr lesen möchtest, dann lass es mich bitte wissen.

P.S. In case my e-mail is shorter than you enjoy:
I am currently trying short replies instead of no replies at all.
Please let me know, if you like to read more.

Enjoy!

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

William Adams-2
In reply to this post by William Adams-2
Puzzled it out --- bracket in wrong place and needed to add render.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

Kevin Crowley
getting the brackets right was the hardest part of writing the hexagon module.


On Sat, Jun 1, 2013 at 10:07 PM, William Adams <[hidden email]> wrote:
Puzzled it out --- bracket in wrong place and needed to add render.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

nophead
When $fn is set $fa and $fs are ignored so circle($fn = 6, r = radius /cos(30)) is always a hexagon. Note cos(30), not 60.


On 2 June 2013 04:11, Kevin Crowley <[hidden email]> wrote:
getting the brackets right was the hardest part of writing the hexagon module.


On Sat, Jun 1, 2013 at 10:07 PM, William Adams <[hidden email]> wrote:
Puzzled it out --- bracket in wrong place and needed to add render.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

Len Trigg
In reply to this post by William Adams-2


On Jun 1, 2013 1:06 AM, "William Adams" <[hidden email]> wrote:

> I _really_ wish that there was an interaction option which would let me grab a node in the preview window, move it, and then have the code window up-date.

Last November Clifford showed how you can sort of do this using the paste viewport function, and made this demo:
http://www.youtube.com/watch?v=xDSv-VksrE4

(Sorry can't give a direct link to his message from my phone)

Cheers
Len.

>
> William
>
> --
> William Adams
> senior graphic designer
> Fry Communications
> Sphinx of black quartz, judge my vow.
>
> _______________________________________________
> OpenSCAD mailing list
> [hidden email]
> http://rocklinux.net/mailman/listinfo/openscad
> http://openscad.org - https://flattr.com/thing/121566


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
Reply | Threaded
Open this post in threaded view
|

Re: Drawing tools

William Adams-2
In reply to this post by Kevin Crowley
On Jun 1, 2013, at 11:11 PM, Kevin Crowley wrote:

> getting the brackets right was the hardest part of writing the hexagon module.

Glad to know it's not just me.

I've posted the code for most of the tools here:

http://www.shapeoko.com/forum/viewtopic.php?f=6&t=1756

I'd be glad of suggestions and improvements (in particular, the wrench needs to have the code fixed to be fully parametric).

Is there some sort of repository for these things w/ a nice opensource license and easy interface?

William

--
William Adams
senior graphic designer
Fry Communications
Sphinx of black quartz, judge my vow.

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://rocklinux.net/mailman/listinfo/openscad
http://openscad.org - https://flattr.com/thing/121566
12345