OpenSCAD small projects: Unterschied zwischen den Versionen

Aus Hackerspace Ffm
Wechseln zu: Navigation, Suche
(+ ruler)
(+ Datei:M6 thumbscrew 002.png)
Zeile 26: Zeile 26:
 
Datei:Foto1793.jpg|Safety first!
 
Datei:Foto1793.jpg|Safety first!
 
</gallery>
 
</gallery>
 +
 +
== Thumbscrews M6 ==
 +
[[Datei:M6 thumbscrew 002.png|240px|none|thumb|Screenshot]]
 +
* convert a regular M6 nut into a M6 thumbscrew
 +
<nowiki>//
 +
// M6 thumbscrew
 +
//
 +
// 29.12.2011 - 002 - initial
 +
// 30.12.2011 - 004 - better thumbscrew pattern
 +
// 30.12.2011 - 005 - + test mode
 +
// 01.01.2012 - 007 - adjust M6 hole, adjust nut diameter
 +
//
 +
 +
test = 0;
 +
 +
pi = 3.1415926;
 +
 +
R = 10; // main radius (mm)
 +
 +
// "diff" cylinders around main radius
 +
rs = 1.25; // radius cylinders
 +
N = round((R * 2 * pi) / (2.8 * rs)); // number
 +
R2 = R + rs / 4;
 +
 +
// hole M6
 +
rh = 3.25; // radius "hole for M6"
 +
 +
// heights
 +
tt = (test == 0) ? 8.0 : 3.2; // thickness total
 +
tt2 = tt + 1;
 +
 +
// nut
 +
Dn = 10.1; // diameter of the nut (!)
 +
Rn = tan(30) * Dn; // radius of outer circle (from diameter)
 +
tn = (test == 0) ? 4.6 : 2.0; // thickness
 +
 +
 +
// some debug infos
 +
echo ("main Radius R = ", R);
 +
echo ("diff cylinders N = ", N);
 +
 +
 +
difference () {
 +
cylinder(r = R, h = tt, center=true, $fn=N * 12);
 +
 +
cylinder(r = rh, h = tt2, center=true, $fn=50);
 +
 +
translate ([0, 0, 0.01 + ((tt - tn) / 2) ])
 +
cylinder(r = Rn, h = tn, center=true, $fa=60);
 +
 +
 +
for ( i = [1 : 1 : N] )
 +
{
 +
assign (a = 360 / N * i)
 +
translate([R2 * cos(a), R2 * sin(a), 0]) rotate ([0, 0, a]) {
 +
cylinder(r = rs, h = tt2, center=true, $fn=16);
 +
}
 +
 +
}
 +
}</nowiki>
 +
  
 
== Ruler for debugging ==
 
== Ruler for debugging ==
[[Datei:Ruler for debugging.png|100px|none|thumb|Screenshot]]
+
[[Datei:Ruler for debugging.png|240px|none|thumb|Screenshot]]
 
* add a simple ruler to OpenSCAD source code
 
* add a simple ruler to OpenSCAD source code
 
* optical control - prevent getting lost of orientation and size of the result
 
* optical control - prevent getting lost of orientation and size of the result
 
* ruler will '''not''' be part of STL output etc. (using the [http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Modifier_Characters % background modifier])
 
* ruler will '''not''' be part of STL output etc. (using the [http://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Modifier_Characters % background modifier])
 
* Source: [[Datei:Ruler for debugging.scad]]
 
* Source: [[Datei:Ruler for debugging.scad]]
  <nowiki>
+
  <nowiki>//
//
+
 
// rulers - demo
 
// rulers - demo
 
//
 
//
Zeile 51: Zeile 111:
 
% translate ([0, i, 0]) cube([ruler_thick, ruler_thick, ruler_length], center=true);
 
% translate ([0, i, 0]) cube([ruler_thick, ruler_thick, ruler_length], center=true);
 
% translate ([0, 0, i]) cube([ruler_length, ruler_thick, ruler_thick], center=true);
 
% translate ([0, 0, i]) cube([ruler_length, ruler_thick, ruler_thick], center=true);
}
+
}</nowiki>
</nowiki>
+
  
 
== OpenSCAD Tipps, Tutorials etc. ==
 
== OpenSCAD Tipps, Tutorials etc. ==

Version vom 1. Januar 2012, 21:19 Uhr

A collection of smaller projects using OpenSCAD:

Fan protective grille

  • The Hackerspace main network switch was quiet noisy.
  • Original 40 mm internal fan (5 Volt) was replaced by an external 70 mm & 12 Volt model.
  • Running at 5 Volts keeps it at a lower noise level.
  • To avoid (further) hurts, the fan needed a grille.
  • OpenSCAD Script Datei:Fan-Protector 005.scad
    • → render mesh and export in STL format
      • → 3D print on yag-freak's Prusa Mendel - thank you!


Thumbscrews M6

Screenshot
  • convert a regular M6 nut into a M6 thumbscrew
//
// M6 thumbscrew
//
// 29.12.2011 - 002 - initial
// 30.12.2011 - 004 - better thumbscrew pattern
// 30.12.2011 - 005 - + test mode
// 01.01.2012 - 007 - adjust M6 hole, adjust nut diameter
//

test = 0;

pi = 3.1415926;

R = 10;			// main radius (mm)

// "diff" cylinders around main radius
rs = 1.25;			// radius cylinders
N = round((R * 2 * pi) / (2.8 * rs)); 	// number
R2 = R + rs / 4;

// hole M6
rh = 3.25;			// radius "hole for M6"

// heights
tt = (test == 0) ? 8.0 : 3.2;		// thickness total
tt2 = tt + 1;

// nut
Dn = 10.1;			// diameter of the nut (!)
Rn = tan(30) * Dn;	// radius of outer circle (from diameter)
tn = (test == 0) ? 4.6 : 2.0;			// thickness


// some debug infos
echo ("main Radius R = ", R); 
echo ("diff cylinders N = ", N); 


difference () {
	cylinder(r = R, h = tt, center=true, $fn=N * 12);

	cylinder(r = rh, h = tt2, center=true, $fn=50);

	translate ([0, 0, 0.01 + ((tt - tn) / 2) ])
		cylinder(r = Rn, h = tn, center=true, $fa=60);


	for ( i = [1 : 1 : N] ) 
	{
		assign (a = 360 / N * i)
			translate([R2 * cos(a), R2 * sin(a), 0]) rotate ([0, 0, a]) {
				cylinder(r = rs, h = tt2, center=true, $fn=16);
			}
		
	}
}


Ruler for debugging

Screenshot
//
// rulers - demo
//

# translate ([60, 30, 50]) cylinder (h = 30, r=20, center = true, $fn=30); // sample, only - add your objects here


ruler_grid = 10;  // mm
ruler_digits = 10;
ruler_thick = 0.5;
ruler_length = ruler_grid / 4;

for ( i = [0 : ruler_grid : ruler_grid * ruler_digits] ) 
{
	% translate ([i, 0, 0]) cube([ruler_thick, ruler_thick, ruler_length], center=true);
	% translate ([0, i, 0]) cube([ruler_thick, ruler_thick, ruler_length], center=true);
	% translate ([0, 0, i]) cube([ruler_length, ruler_thick, ruler_thick], center=true);
}

OpenSCAD Tipps, Tutorials etc.