discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Beginner needs help with project

PF
Peter Falke
Sun, Mar 22, 2015 6:17 PM

Here is an advanced technique: you can pass a module to an other module:

module boss() {

h = 6;

r = 3;

$fn = 20;

difference() {

cylinder(h=6, r=3, center=true);

cylinder(h=7, r=2.5, center=true);

}

}

module place_corner(x=20,y=10){

for(mx=[-1:1],my=[-1:1]){

mirror(mx*[1,0,0])

mirror(my*[0,1,0])

translate([x,y,0])

children();

}

}

place_corner(40,20)boss();

place_corner(40,20)cylinder(5,5,5);

Unfortunately my email program (googlemail) eats the tabs: find it with
tabs in the attachment

2015-03-22 18:38 GMT+01:00 Jerry Davis jdawgaz@gmail.com:

I am a relative beginner too, here is a first stab at something you can
start from:

module boss() {
h = 6;
r = 3;
$fn = 20;

difference() {
cylinder(h=6, r=3, center=true);
cylinder(h=7, r=2.5, center=true);
}
}

module pcbbox(l=30, w=25, h=1) {
co = 12;

union() {
difference() {
cube([l+3, w+3, h+14], center=true);
translate([0, 0, 3]) cube([l, w, h+15], center=true);
}
translate([(l-co)/2, (w-co)/2, 0]) boss();
translate([-(l-co)/2, (w-co)/2, 0]) boss();
translate([(l-co)/2, -(w-co)/2, 0]) boss();
translate([-(l-co)/2, -(w-co)/2, 0]) boss();
}
}

pcbbox(50, 40, 1);

On Sun, Mar 22, 2015 at 9:59 AM, Tim Deagan tim@deagan.net wrote:

An example I have on thingiverse that is a nesting edge box for a pcb is
http://www.thingiverse.com/thing:150101, here's the scad file link:
http://www.thingiverse.com/download:291446

The scad code is set up with lots of params to resize.  It's very basic
scad and an easy intro to boxen.

I'd be happy to help with any questions about it.

--tim

On Sun, Mar 22, 2015 at 11:51 AM, david vanhorn kc6ete@gmail.com wrote:

For mine, I set the screw holes to the diameter used to drill for a
tap.  The 6-32 screws self-tap into that very nicely.  The holes in the top
of the box then are the size to pass the screw. I found a table online
somewhere.

Lowering the number of sides in a hole can give nice hexagonal surfaces
for tapping into.

The one thing I didn't do (yet) on my test box that I would like, is to
have the bottom half nest into the top half.  But so far it has been ok to
just have the two walls meet without any indexing.

On Sun, Mar 22, 2015 at 10:46 AM, donrecardo <
don@crystal-computing.co.uk> wrote:

Hi Michelle ,
I didnt mean to sound ungrateful  , its just that pretty much most
things
I saw on thingiverse
had only got an stl file  and no Scad file  but I can see now that if
the
Scad file is available then looking at it should be very helpful

Don

--
View this message in context:
http://forum.openscad.org/Beginner-needs-help-with-project-tp12117p12134.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer

The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".
- Isaac. Asimov

I
*f you give someone a program, you will frustrate them for a day; if you
teach them how to program, you will frustrate them for a lifetime. *-
Anonymous

If writing good code requires very little comments, then writing really
excellent code requires no comments at all!
- Ken Thompson


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

--
stempeldergeschichte@googlemail.com karsten@rohrbach.de

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!

Here is an advanced technique: you can `pass` a module to an other module: module boss() { h = 6; r = 3; $fn = 20; difference() { cylinder(h=6, r=3, center=true); cylinder(h=7, r=2.5, center=true); } } module place_corner(x=20,y=10){ for(mx=[-1:1],my=[-1:1]){ mirror(mx*[1,0,0]) mirror(my*[0,1,0]) translate([x,y,0]) children(); } } place_corner(40,20)boss(); place_corner(40,20)cylinder(5,5,5); ​ Unfortunately my email program (googlemail) eats the tabs: find it with tabs in the attachment 2015-03-22 18:38 GMT+01:00 Jerry Davis <jdawgaz@gmail.com>: > I am a relative beginner too, here is a first stab at something you can > start from: > > module boss() { > h = 6; > r = 3; > $fn = 20; > > difference() { > cylinder(h=6, r=3, center=true); > cylinder(h=7, r=2.5, center=true); > } > } > > module pcbbox(l=30, w=25, h=1) { > co = 12; > > union() { > difference() { > cube([l+3, w+3, h+14], center=true); > translate([0, 0, 3]) cube([l, w, h+15], center=true); > } > translate([(l-co)/2, (w-co)/2, 0]) boss(); > translate([-(l-co)/2, (w-co)/2, 0]) boss(); > translate([(l-co)/2, -(w-co)/2, 0]) boss(); > translate([-(l-co)/2, -(w-co)/2, 0]) boss(); > } > } > > pcbbox(50, 40, 1); > > > On Sun, Mar 22, 2015 at 9:59 AM, Tim Deagan <tim@deagan.net> wrote: > >> An example I have on thingiverse that is a nesting edge box for a pcb is >> http://www.thingiverse.com/thing:150101, here's the scad file link: >> http://www.thingiverse.com/download:291446 >> >> The scad code is set up with lots of params to resize. It's very basic >> scad and an easy intro to boxen. >> >> I'd be happy to help with any questions about it. >> >> --tim >> >> On Sun, Mar 22, 2015 at 11:51 AM, david vanhorn <kc6ete@gmail.com> wrote: >> >>> For mine, I set the screw holes to the diameter used to drill for a >>> tap. The 6-32 screws self-tap into that very nicely. The holes in the top >>> of the box then are the size to pass the screw. I found a table online >>> somewhere. >>> >>> Lowering the number of sides in a hole can give nice hexagonal surfaces >>> for tapping into. >>> >>> The one thing I didn't do (yet) on my test box that I would like, is to >>> have the bottom half nest into the top half. But so far it has been ok to >>> just have the two walls meet without any indexing. >>> >>> On Sun, Mar 22, 2015 at 10:46 AM, donrecardo < >>> don@crystal-computing.co.uk> wrote: >>> >>>> Hi Michelle , >>>> I didnt mean to sound ungrateful , its just that pretty much most >>>> things >>>> I saw on thingiverse >>>> had only got an stl file and no Scad file but I can see now that if >>>> the >>>> Scad file is available then looking at it should be very helpful >>>> >>>> Don >>>> >>>> >>>> >>>> -- >>>> View this message in context: >>>> http://forum.openscad.org/Beginner-needs-help-with-project-tp12117p12134.html >>>> Sent from the OpenSCAD mailing list archive at Nabble.com. >>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> Discuss@lists.openscad.org >>>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>>> >>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >>> >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > > > -- > Extra Ham Operator: K7AZJ > Registered Linux User: 275424 > Raspberry Pi and Arduino developer > > > *The most exciting phrase to hear in science - the one that heralds new > discoveries - is not "Eureka!" but "That's funny...".*- Isaac. Asimov > > *I* > *f you give someone a program, you will frustrate them for a day; if you > teach them how to program, you will frustrate them for a lifetime. *- > Anonymous > > > *If writing good code requires very little comments, then writing really > excellent code requires no comments at all!*- Ken Thompson > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > -- stempeldergeschichte@googlemail.com <karsten@rohrbach.de> 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!
D
donrecardo
Sun, Mar 22, 2015 6:26 PM

Once again thank you everyone

Thanks to all the fantastic help I have been given I was able to find where
my syntax was going wrong  and have had a minor success

I can now generate the box , I still dont have the mounting bosses yet but
thats my next challenge

By inputing your values into the first 4 lines of my code it will now
generate the correct sized box while still maintaining my rules of
the pcb holes are 4mm in from the edges of the PCB in both X and Y axis
the PCB is 3 mm from the inside of the box on all edges

I dont suppose its the most efficient or elegant way to do it but iot does
work
I did it like this......

// Enter your values into the first 4 lines below

holes_x = 140; // spacing of pcb mounting holes in X direction
holes_y = 100; // spacing of pcb mounting holes in Y direction
inner_depth = 35 ;// depth required inside not including the 6mm for the
bosses
thickness = 4; // thickness of walls and floor

// The code will calculate everything else it needs

inner_x = holes_x + 14; // inside width of box in X direction
inner_y = holes_y +14; // Inside length of box in Y direction
outer_x = inner_x + ( thickness * 2);// outside width of box in X direction
outer_y = inner_y + ( thickness * 2);//outside length of box in Y direction
outer_depth = (inner_depth+6+thickness);

module outer_box() {
cube([ outer_x , outer_y, outer_depth]) ;

}

module inner_box() {
cube ([inner_x , inner_y, inner_depth]);

}
module box() {
difference (){
outer_box();
translate([thickness,thickness,(thickness + 6)])  inner_box();
}
}
box();

I need to scratch my head a bit now and think how I will add the bosses

Don

--
View this message in context: http://forum.openscad.org/Beginner-needs-help-with-project-tp12117p12141.html
Sent from the OpenSCAD mailing list archive at Nabble.com.

Once again thank you everyone Thanks to all the fantastic help I have been given I was able to find where my syntax was going wrong and have had a minor success I can now generate the box , I still dont have the mounting bosses yet but thats my next challenge By inputing your values into the first 4 lines of my code it will now generate the correct sized box while still maintaining my rules of the pcb holes are 4mm in from the edges of the PCB in both X and Y axis the PCB is 3 mm from the inside of the box on all edges I dont suppose its the most efficient or elegant way to do it but iot does work I did it like this...... // Enter your values into the first 4 lines below holes_x = 140; // spacing of pcb mounting holes in X direction holes_y = 100; // spacing of pcb mounting holes in Y direction inner_depth = 35 ;// depth required inside not including the 6mm for the bosses thickness = 4; // thickness of walls and floor // The code will calculate everything else it needs inner_x = holes_x + 14; // inside width of box in X direction inner_y = holes_y +14; // Inside length of box in Y direction outer_x = inner_x + ( thickness * 2);// outside width of box in X direction outer_y = inner_y + ( thickness * 2);//outside length of box in Y direction outer_depth = (inner_depth+6+thickness); module outer_box() { cube([ outer_x , outer_y, outer_depth]) ; } module inner_box() { cube ([inner_x , inner_y, inner_depth]); } module box() { difference (){ outer_box(); translate([thickness,thickness,(thickness + 6)]) inner_box(); } } box(); I need to scratch my head a bit now and think how I will add the bosses Don -- View this message in context: http://forum.openscad.org/Beginner-needs-help-with-project-tp12117p12141.html Sent from the OpenSCAD mailing list archive at Nabble.com.
JD
Jerry Davis
Sun, Mar 22, 2015 10:29 PM

QSL
On Mar 22, 2015 11:14 AM, "david vanhorn" kc6ete@gmail.com wrote:

KC6ETE here!

On Sun, Mar 22, 2015 at 11:38 AM, Jerry Davis jdawgaz@gmail.com wrote:

I am a relative beginner too, here is a first stab at something you can
start from:

module boss() {
h = 6;
r = 3;
$fn = 20;

difference() {
cylinder(h=6, r=3, center=true);
cylinder(h=7, r=2.5, center=true);
}
}

module pcbbox(l=30, w=25, h=1) {
co = 12;

union() {
difference() {
cube([l+3, w+3, h+14], center=true);
translate([0, 0, 3]) cube([l, w, h+15], center=true);
}
translate([(l-co)/2, (w-co)/2, 0]) boss();
translate([-(l-co)/2, (w-co)/2, 0]) boss();
translate([(l-co)/2, -(w-co)/2, 0]) boss();
translate([-(l-co)/2, -(w-co)/2, 0]) boss();
}
}

pcbbox(50, 40, 1);

On Sun, Mar 22, 2015 at 9:59 AM, Tim Deagan tim@deagan.net wrote:

An example I have on thingiverse that is a nesting edge box for a pcb is
http://www.thingiverse.com/thing:150101, here's the scad file link:
http://www.thingiverse.com/download:291446

The scad code is set up with lots of params to resize.  It's very basic
scad and an easy intro to boxen.

I'd be happy to help with any questions about it.

--tim

On Sun, Mar 22, 2015 at 11:51 AM, david vanhorn kc6ete@gmail.com
wrote:

For mine, I set the screw holes to the diameter used to drill for a
tap.  The 6-32 screws self-tap into that very nicely.  The holes in the top
of the box then are the size to pass the screw. I found a table online
somewhere.

Lowering the number of sides in a hole can give nice hexagonal surfaces
for tapping into.

The one thing I didn't do (yet) on my test box that I would like, is to
have the bottom half nest into the top half.  But so far it has been ok to
just have the two walls meet without any indexing.

On Sun, Mar 22, 2015 at 10:46 AM, donrecardo <
don@crystal-computing.co.uk> wrote:

Hi Michelle ,
I didnt mean to sound ungrateful  , its just that pretty much most
things
I saw on thingiverse
had only got an stl file  and no Scad file  but I can see now that if
the
Scad file is available then looking at it should be very helpful

Don

--
View this message in context:
http://forum.openscad.org/Beginner-needs-help-with-project-tp12117p12134.html
Sent from the OpenSCAD mailing list archive at Nabble.com.


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

--
Extra Ham Operator: K7AZJ
Registered Linux User: 275424
Raspberry Pi and Arduino developer

The most exciting phrase to hear in science - the one that heralds new
discoveries - is not "Eureka!" but "That's funny...".
- Isaac. Asimov

I
*f you give someone a program, you will frustrate them for a day; if you
teach them how to program, you will frustrate them for a lifetime. *-
Anonymous

If writing good code requires very little comments, then writing really
excellent code requires no comments at all!
- Ken Thompson


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

QSL On Mar 22, 2015 11:14 AM, "david vanhorn" <kc6ete@gmail.com> wrote: > KC6ETE here! > > On Sun, Mar 22, 2015 at 11:38 AM, Jerry Davis <jdawgaz@gmail.com> wrote: > >> I am a relative beginner too, here is a first stab at something you can >> start from: >> >> module boss() { >> h = 6; >> r = 3; >> $fn = 20; >> >> difference() { >> cylinder(h=6, r=3, center=true); >> cylinder(h=7, r=2.5, center=true); >> } >> } >> >> module pcbbox(l=30, w=25, h=1) { >> co = 12; >> >> union() { >> difference() { >> cube([l+3, w+3, h+14], center=true); >> translate([0, 0, 3]) cube([l, w, h+15], center=true); >> } >> translate([(l-co)/2, (w-co)/2, 0]) boss(); >> translate([-(l-co)/2, (w-co)/2, 0]) boss(); >> translate([(l-co)/2, -(w-co)/2, 0]) boss(); >> translate([-(l-co)/2, -(w-co)/2, 0]) boss(); >> } >> } >> >> pcbbox(50, 40, 1); >> >> >> On Sun, Mar 22, 2015 at 9:59 AM, Tim Deagan <tim@deagan.net> wrote: >> >>> An example I have on thingiverse that is a nesting edge box for a pcb is >>> http://www.thingiverse.com/thing:150101, here's the scad file link: >>> http://www.thingiverse.com/download:291446 >>> >>> The scad code is set up with lots of params to resize. It's very basic >>> scad and an easy intro to boxen. >>> >>> I'd be happy to help with any questions about it. >>> >>> --tim >>> >>> On Sun, Mar 22, 2015 at 11:51 AM, david vanhorn <kc6ete@gmail.com> >>> wrote: >>> >>>> For mine, I set the screw holes to the diameter used to drill for a >>>> tap. The 6-32 screws self-tap into that very nicely. The holes in the top >>>> of the box then are the size to pass the screw. I found a table online >>>> somewhere. >>>> >>>> Lowering the number of sides in a hole can give nice hexagonal surfaces >>>> for tapping into. >>>> >>>> The one thing I didn't do (yet) on my test box that I would like, is to >>>> have the bottom half nest into the top half. But so far it has been ok to >>>> just have the two walls meet without any indexing. >>>> >>>> On Sun, Mar 22, 2015 at 10:46 AM, donrecardo < >>>> don@crystal-computing.co.uk> wrote: >>>> >>>>> Hi Michelle , >>>>> I didnt mean to sound ungrateful , its just that pretty much most >>>>> things >>>>> I saw on thingiverse >>>>> had only got an stl file and no Scad file but I can see now that if >>>>> the >>>>> Scad file is available then looking at it should be very helpful >>>>> >>>>> Don >>>>> >>>>> >>>>> >>>>> -- >>>>> View this message in context: >>>>> http://forum.openscad.org/Beginner-needs-help-with-project-tp12117p12134.html >>>>> Sent from the OpenSCAD mailing list archive at Nabble.com. >>>>> >>>>> _______________________________________________ >>>>> OpenSCAD mailing list >>>>> Discuss@lists.openscad.org >>>>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>>>> >>>> >>>> >>>> _______________________________________________ >>>> OpenSCAD mailing list >>>> Discuss@lists.openscad.org >>>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>>> >>>> >>> >>> _______________________________________________ >>> OpenSCAD mailing list >>> Discuss@lists.openscad.org >>> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >>> >>> >> >> >> -- >> Extra Ham Operator: K7AZJ >> Registered Linux User: 275424 >> Raspberry Pi and Arduino developer >> >> >> *The most exciting phrase to hear in science - the one that heralds new >> discoveries - is not "Eureka!" but "That's funny...".*- Isaac. Asimov >> >> *I* >> *f you give someone a program, you will frustrate them for a day; if you >> teach them how to program, you will frustrate them for a lifetime. *- >> Anonymous >> >> >> *If writing good code requires very little comments, then writing really >> excellent code requires no comments at all!*- Ken Thompson >> >> _______________________________________________ >> OpenSCAD mailing list >> Discuss@lists.openscad.org >> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >> >> > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > >