BOSL befuddles me, completely,
I routinely build objects using this approach (which I know for many
discussion readers is like teaching grandma to suck eggs)
difference () {
union ( ){
build_object_part1(); // any number of modules with
build_object_part2(); // any number of modules with
.....
}
subtract_from_object ();// typically a hole chamfered on both ends,
the thickness of the built object.
subtract_from_object ();// typically a hole chamfered on both ends,
the thickness of the built object.
......
}
just plain OpenSCAD. works for me... :-)
Here's an RJ45 socket without BOSL. Setting up the variables is almost
longer than the module call:
rj45_socket
(led=true,led_style="jewel",outer_block_colour="grey",inner_block_colour="black");//set
led=true to get leds in socket
module rj45_socket
(led=false,led_style="jewel",outer_block_colour="grey",inner_block_colour="black")
{
block_wide = 15;
block_high = 13;
socket_z = 3;
wide = 11.91;
high = 6.83;
notch_wide = 8.7;
notch_high = 8.52;
latch_wide = 4.06;
latch_high = 10;
pin_pitch = 1.02;
pin_long = 8;
pin_colour = "gold";
pin_dia = 0.56;
pin_count = 8;
pin_angle = 70;
pin_land = 0.51;
led_w = 2.75;
led_z = 1.75;
led_green = "lime";
led_yellow = "yellow";
pins_width = (pin_count-1)*pin_pitch;
//echo(pins_width=pins_width);
//construct the profile
difference () {
color (outer_block_colour) cube ([block_wide,10,block_high]);
color (inner_block_colour)
translate ([(block_wide-wide)/2,-cd,socket_z])
cube([wide,9,high]);
color (inner_block_colour)
translate ([(block_wide-notch_wide)/2,-cd,socket_z])
cube ([notch_wide,9,notch_high]);
color (inner_block_colour)
translate ([(block_wide-latch_wide)/2,-cd,socket_z])
cube ([latch_wide,9,latch_high-0.1]);
}//end diff
translate ([(block_wide-pins_width)/2,2,2.5]) {
for (i = [ 0 : pin_count-1 ]) {
translate ([i*pin_pitch,0,0])
rotate ([-pin_angle,0,0])
color(pin_colour) cylinder
(d=pin_dia,h=pin_long,$fn=20);
}//end for
}//end translate
if (led) {
translate ([1.6,0.5,10.9]) led_block
(led_colour=led_yellow,led_style);
translate ([13.4,0.5,10.9]) led_block
(led_colour=led_green,led_style);
//end if
}
module led_block (led_colour,led_style) {
if ( led_style == "jewel" )
color (led_colour) {
hull () {
cube ([led_w,1,led_z],center=true);
sphere (d=1.75);
}//end hull
}//end colour
else {
color (led_colour) cube ([led_w,1.1,led_z],center=true);
}
}//end led_block
}//end module