Categories
Uncategorized

OpenSCAD – first battle

My first attempts to use OpenSCAD:

module hc_hexagon(size, height) {
box_width = size/1.75;
for (r = [-60, 0, 60]) rotate([0,0,r]) cube([box_width, size, height],
true);
}
module hc_column(length, height, cell_size, wall_thickness) {
no_of_cells = floor(1 + length / (cell_size + wall_thickness)) ;
for (i = [0 : no_of_cells]) {
translate([0,(i * (cell_size + wall_thickness)),0])
hc_hexagon(cell_size, height + 1);
}
}
module honeycomb (length, width, height, cell_size, wall_thickness) {
no_of_rows = floor(1.75 * length / (cell_size + wall_thickness)) ;
tr_mod = cell_size + wall_thickness;
tr_x = sqrt(3)/2 * tr_mod;
tr_y = tr_mod / 2;
off_x = -1 * wall_thickness / 2;
off_y = wall_thickness / 2;
difference(){
cube([length, width, height]);
for (i = [0 : no_of_rows]) {
translate([i * tr_x + off_x, (i % 2) * tr_y + off_y, (height) / 2])
hc_column(width, height, cell_size, wall_thickness);
}
}
}
//honeycomb(length, width, height, cell_size, wall_thickness);
honeycomb(140, 80, 20, 5, 1);

ormatting doesn’t look very good in narrow blog, it looks better here: honeycomb.scad

Honeycomb - blender render

P.S. Thanks to help from OpenSCAD forum I have a new, improved & much faster honeycomb script:

module hc_column(length, cell_size, wall_thickness) {
        no_of_cells = floor(length / (cell_size + wall_thickness)) ;

        for (i = [0 : no_of_cells]) {
                translate([0,(i * (cell_size + wall_thickness)),0])
                         circle($fn = 6, r = cell_size * (sqrt(3)/3));
        }
}

module honeycomb (length, width, height, cell_size, wall_thickness) {
        no_of_rows = floor(1.2 * length / (cell_size + wall_thickness)) ;

        tr_mod = cell_size + wall_thickness;
        tr_x = sqrt(3)/2 * tr_mod;
        tr_y = tr_mod / 2;
        off_x = -1 * wall_thickness / 2;
        off_y = wall_thickness / 2;
        linear_extrude(height = height, center = true, convexity = 10, twist = 0, slices = 1)
                difference(){
                        square([length, width]);
                        for (i = [0 : no_of_rows]) {
                                translate([i * tr_x + off_x, (i % 2) * tr_y + off_y,0])
                                        hc_column(width, cell_size, wall_thickness);
                        }
                }
}

//honeycomb(length, width, height, cell_size, wall_thickness);
honeycomb(140, 80, 20, 5, 1);

Categories
Uncategorized

Compiling FreeCAD on Fedora 18 – a guide to the bumpy road.

sudo yum install cmake doxygen swig gcc-gfortran gettext dos2unix desktop-file-utils libXmu-devel freeimage-devel mesa-libGLU-devel OCE-devel python python-devel boost-devel tbb-devel eigen3-devel qt-devel qt-webkit-devel ode-devel xerces-c xerces-c-devel opencv-devel smesh-devel Coin2-devel SoQt-devel freetype freetype-devel

./configure --with-qt4-lib=/usr/lib64/qt4 with-qt4-include=/usr/include/QtCore/ --with-qt4-bin=/usr/lib64/qt4/bin/make