Drawing tools in OpenSCAD

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Drawing tools in OpenSCAD

Post by WillAdams » Sun Jun 02, 2013 3:36 am

Working on this off-and-on:

Machinist's square:
openscad_machinist_square.png
openscad_machinist_square.png (4.53 KiB) Viewed 3664 times

Code: Select all

module machinists_square (blade_length, blade_width, blade_thickness, beam_offset, beam_length, beam_width, beam_thickness)
{cube(size=[blade_length,blade_width,blade_thickness]);
translate([0,beam_offset,-beam_thickness/2+blade_thickness/2])
cube(size=[beam_width,beam_length,beam_thickness]);
}

machinists_square(6,1,.0625, 0.5, 3, 1, .5);
Allen wrenches:
openscad_hex_key.png
openscad_hex_key.png (3.61 KiB) Viewed 3663 times
(hexagon function by Kevin Crowley <caohaoim@gmail.com> )

Code: Select all

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) {
translate([-hex_size, -hex_size*2, -hex_size/2])
render(convexity = 1) {
intersection() {
cube(size=[hex_size*2,hex_size*2.501,hex_size*2.501]);
translate([hex_size, 0, hex_size*2.5])
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)
rotate([0,0,90])
hexagon(hex_size/2);
translate([0, -hex_size*2, 0])
rotate([90,0,0])
linear_extrude(height=hex_blade-hex_size*2)
rotate([0,0,90])
hexagon(hex_size/2);
}

hexkey (4,73,28);
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Sun Jun 02, 2013 11:55 pm

and a combination wrench:
openscad_wrench.png
openscad_wrench.png (6.24 KiB) Viewed 3641 times

Code: Select all

module wrench (wrench_size, wrench_handle) {
$fn=50;
translate([wrench_size/4, wrench_handle/4, -wrench_size/16])
minkowski()
{cube (size=[wrench_size*0.5,wrench_handle/2,wrench_size/4]);
cylinder(r=wrench_size/8,h=wrench_size/4);}
cube (size=[wrench_size*1.0625,wrench_handle*0.9,wrench_size*0.375]);
render(convexity = 1) {
translate([0, wrench_handle*0.9, -wrench_size])
intersection() {
cube(size=[wrench_size*2,wrench_handle*0.061,wrench_size*2]);
translate([0, 0, wrench_size*3.375])
rotate([0,90,0])
rotate_extrude(convexity = 10)
translate([wrench_size*2, 0, 0])
square ([wrench_size*0.375,wrench_size*1.0625]);}}
render(convexity = 1) {
difference() {
translate([wrench_size/2, wrench_handle+wrench_size/6, wrench_size/8])
rotate([10,0,0])
cylinder(h = wrench_size*0.625, r=wrench_size*.5+2);
translate([wrench_size/2, wrench_handle+wrench_size/6, wrench_size/16])
rotate([10,0,0])
linear_extrude(height=wrench_size)
rotate([0,0,90])
hexagon(wrench_size/2);}}
translate([wrench_size/2, -wrench_size/2, -wrench_size/8])
render(convexity = 1) {
difference() {
hull() {
rotate([0,0,30])
scale([1.125,1,1]) 
cylinder(h = wrench_size*0.625, r=wrench_size*.5+2);
translate([wrench_size/8, -wrench_size/2, 0])
cylinder(h = wrench_size*0.625, r=wrench_size*.5+2);
}
{rotate([0,0,15])
{translate([-wrench_size/2, -wrench_size*2.25, -wrench_size/4])
cube (size=[wrench_size,wrench_size*2,wrench_size]);
translate([0, -wrench_size/4, -wrench_size/4])
scale([2,1,1]) 
cylinder(h = wrench_size, r=wrench_size/4);
}}}}
}

wrench (8,86);
Code is a bit rough and probably won't work at all sizes --- improvements welcome.
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Mon Jun 03, 2013 2:44 am

and a screwdriver:
openscad_screwdriver.png
openscad_screwdriver.png (9.59 KiB) Viewed 3634 times
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Mon Jun 03, 2013 6:27 pm

and Brown & Sharpe micrometer (sans locking lever):
openscad_micrometer.png
openscad_micrometer.png (5.33 KiB) Viewed 3607 times
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Mon Jun 03, 2013 6:29 pm

All that leaves is the Mitutoyo analog caliper.

Anyone have suggestions for other useful tools?
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Fri Jun 07, 2013 3:23 am

And we're done (except for the scribing point):
openscad_analog_calipers.png
openscad_analog_calipers.png (7.08 KiB) Viewed 3550 times
Initial arrangement:
openscad_cigarbox.png
openscad_cigarbox.png (13.18 KiB) Viewed 3550 times
Just need to add finger cut-outs and extrude.
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Fri Jun 07, 2013 11:02 am

Hmm, can't linear extrude a 3D shape....

I guess the CAM program handles the balance?
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

Will Winder
Posts: 435
Joined: Fri Apr 20, 2012 2:40 pm
Location: Hudson, MA
Contact:

Re: Drawing tools in OpenSCAD

Post by Will Winder » Fri Jun 07, 2013 11:59 am

You could try adding a second tool positioned up higher and do a hull() operation to join the two in an extrusion-like object. I'm not sure if hull works with 3D objects, if it does work the object may take a long time to render.
ShapeOko #367: Dual-Y drive, Belt on outside, 1000mm Y-Axis, DW660 Spindle, Nema-23 X/Y motors.

Primary developer on Universal Gcode Sender.

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Fri Jun 07, 2013 4:40 pm

I was informed by two people on the OpenSCAD mailing list that the ``project()'' (but it's actually projection()) command will do what I need here --- will try it this evening.

William
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

WillAdams
Posts: 8489
Joined: Mon Apr 09, 2012 6:11 pm
Location: Pennsylvania --- south of the Turnpike, East of US-15
Contact:

Re: Drawing tools in OpenSCAD

Post by WillAdams » Sat Jun 08, 2013 1:59 pm

And I was asked to test, and tested projection to the point of failure --- works on the square, Allen wrenches, scribing point and wrench. Fails on the calipers, micrometer and screwdriver.

But I only really needed the square, so I'm good, after whacking at the calipers to make a ``valid 2-D manifold''.
openscad_cigarbox_extruded.png
openscad_cigarbox_extruded.png (13.12 KiB) Viewed 3485 times
Shapeoko 3XL #0006 w/Makita RT0701 Router w/0.125″ and ¼″ Elaire precision collets
Nomad 883 Pro #596 (bamboo)

Post Reply