3D part design with Inkscape and Openscad #32: DXF matrix

An example of how to make a 3d matrix using Inkscape and Openscad

2 min read
By Bob
3D part design with Inkscape and Openscad #32: DXF matrix

I wanted to make a 3D matrix with any DXF File had made with Inkscape. I had already made the dxf grid module so all I had to do was add a 3rd dimension.

Here is the code:

/*[3D DXF Grid]*/
Path_to_DXF_File="/home/none3/Desktop/drawing.dxf";

Show_Grid = false;
Cell_Number = 2;//[1:1:100]
Cell_Thickness = .5 ;//[.01:.01:100]
Cell_Spacing = 1 ;//[.10:.01:100]
X_Cell_Spacing = 2 ;//[.01:.01:3]
Y_Cell_Spacing = 2 ;//[.01:.01:3]
Z_Cell_Spacing = 0;//[0:1:100]
Rotate_X = 0;//[-360:.01:360]
Rotate_Y = 0 ;//[-360:.01:360]
Rotate_Z = 0 ;//[-360:.01:360]
Move_All_X = 0 ;//[-400:.1:400]
Move_All_Y = 0 ;//[-400:.1:400]
Move_All_Z = 0 ;//[-400:.1:400]

module 3D_GridX(){

if (Show_Grid){
translate([Move_All_X,Move_All_Y,Move_All_Z])

for(z=[1:Cell_Number]){
translate([0,0,z * Z_Cell_Spacing])

for (x=[0:Cell_Number-1]){
translate([x * Cell_Spacing * X_Cell_Spacing,0,0])
rotate([0,0,90])
for (y=[0:Cell_Number-1]){
translate([y * Cell_Spacing * Y_Cell_Spacing,0,0])
rotate([Rotate_X,0,0])
rotate([0,Rotate_Y,0])
rotate([0,0,Rotate_Z])
linear_extrude(Cell_Thickness,center= true)
import(Path_to_DXF_File, layer = "");

}}}}}
//
module 3D_GridY(){

if (Show_Grid){
translate([Move_All_X,Move_All_Y,Move_All_Z])

for(a=[1:Cell_Number]){
translate([0,0,a * Z_Cell_Spacing])

for (b=[0:Cell_Number-1]){
translate([b * Cell_Spacing * X_Cell_Spacing,0,0])
rotate([90,0,90])
for (c=[0:Cell_Number-1]){
translate([c * Cell_Spacing * Y_Cell_Spacing,0,0])
rotate([Rotate_X,0,0])
rotate([0,Rotate_Y,0])
rotate([0,0,Rotate_Z])
linear_extrude(Cell_Thickness,center=true)
import(Path_to_DXF_File, layer = "");

}}}}}

3D_GridX();
3D_GridY();

A square and a circle rendered in a few seconds, the more complex designs will take a while.

By adding multiple layer import you can make some interesting designs, it would take a few days to print some of them but it is fun to experiment:

To add multi layer import just add the following lines: