intersection() is a really cool way to add some more capabilities to your code, here is an example of how you can take some basic outlines made with Inkscape and carve out a more complex object.
I added a few new lines to my existing svg layer code so I can intersect the the layers, here is a simple example:
/*[SVG] */
Path_to_SVG_File="/home/none4/Desktop/Openscad shoe/drawing.svg";
/* [SVG_Layer 1] */
ShowLayer1 = true;
Layer1_name="layer1";
Linear_Extrude_Layer1 = 40; //[0.1:0.01:400]
Layer1_twist = 0; //[-360:0.01:360]
Layer1_slices = 1; //[0:1:400]
Layer1_transparency = 1;//[0:.01:1]
Layer1_red = 255;//[0:255]
Layer1_green = 255;//[0:255]
Layer1_blue = 0;//[0:255]
Rotate_Layer1_X = 90; //[0:.01:360]
Rotate_Layer1_Y = 0; //[0:.01:360]
Rotate_Layer1_Z = 0; //[0:.01:360]
Move_Layer1_X = 0; //[-400:0.01:400]
Move_Layer1_Y = 0; //[-400:0.01:400]
Move_Layer1_Z = 0; //[-400:0.01:400]
Scale_Layer1_X = 1; //[1:0.01:100]
Scale_Layer1_Y = 1; //[1:0.01:100]
Scale_Layer1_Z = 1; //[1:0.01:100]
/* [SVG_Layer 2] */
ShowLayer2 = true;
Layer2_name="layer2";
Linear_Extrude_Layer2 = 22; //[0.1:0.01:400]
Layer2_twist = 0; //[-360:0.01:360]
Layer2_slices = 1; //[0:1:400]
Layer2_transparency = 1;//[0:.01:1]
Layer2_red = 255;//[0:255]
Layer2_green = 255;//[0:255]
Layer2_blue = 0;//[0:255]
Rotate_Layer2_X = 0; //[0:.01:360]
Rotate_Layer2_Y = 0; //[0:.01:360]
Rotate_Layer2_Z = 90; //[0:.01:360]
Move_Layer2_X = -16; //[-400:0.01:400]
Move_Layer2_Y = -7; //[-400:0.01:400]
Move_Layer2_Z = 0; //[-400:0.01:400]
Scale_Layer2_X = 1; //[1:0.01:100]
Scale_Layer2_Y = 1; //[1:0.01:100]
Scale_Layer2_Z = 1; //[1:0.01:100]
/* [SVG_Layer 3] */
ShowLayer3 = true;
Layer3_name="layer3";
Linear_Extrude_Layer3 = 20; //[0.1:0.01:400]
Layer3_twist = 0; //[-360:0.01:360]
Layer3_slices = 1; //[0:1:400]
Layer3_transparency = 1;//[0:.01:1]
Layer3_red = 255;//[0:255]
Layer3_green = 255;//[0:255]
Layer3_blue = 0;//[0:255]
Rotate_Layer3_X = 0; //[0:.01:360]
Rotate_Layer3_Y = 0; //[0:.01:360]
Rotate_Layer3_Z = 90; //[0:.01:360]
Move_Layer3_X = -16; //[-400:0.01:400]
Move_Layer3_Y = -7; //[-400:0.01:400]
Move_Layer3_Z = 0; //[-400:0.01:400]
Scale_Layer3_X = 1; //[1:0.01:100]
Scale_Layer3_Y = 1; //[1:0.01:100]
Scale_Layer3_Z = 1; //[1:0.01:100]
/* [SVG_Layer 4] */
ShowLayer4 = true;
Layer4_name="layer4";
Linear_Extrude_Layer4 = 0.1; //[0.1:0.01:400]
Layer4_twist = 0; //[-360:0.01:360]
Layer4_slices = 1; //[0:1:400]
Layer4_transparency = 1;//[0:.01:1]
Layer4_red = 255;//[0:255]
Layer4_green = 255;//[0:255]
Layer4_blue = 0;//[0:255]
Rotate_Layer4_X = 0; //[0:.01:360]
Rotate_Layer4_Y = 0; //[0:.01:360]
Rotate_Layer4_Z = 0; //[0:.01:360]
Move_Layer4_X = 0; //[-400:0.01:400]
Move_Layer4_Y = 0; //[-400:0.01:400]
Move_Layer4_Z = 0; //[-400:0.01:400]
Scale_Layer4_X = 1; //[1:0.01:100]
Scale_Layer4_Y = 1; //[1:0.01:100]
Scale_Layer4_Z = 1; //[1:0.01:100]
/* [SVG_Layer 5] */
ShowLayer5 = true;
Layer5_name="layer5";
Linear_Extrude_Layer5 = 0.1; //[0.1:0.01:400]
Layer5_twist = 0; //[-360:0.01:360]
Layer5_slices = 1; //[0:1:400]
Layer5_transparency = 1;//[0:.01:1]
Layer5_red = 255;//[0:255]
Layer5_green = 255;//[0:255]
Layer5_blue = 0;//[0:255]
Rotate_Layer5_X = 0; //[0:.01:360]
Rotate_Layer5_Y = 0; //[0:.01:360]
Rotate_Layer5_Z = 0; //[0:.01:360]
Move_Layer5_X = 0; //[-400:0.01:400]
Move_Layer5_Y = 0; //[-400:0.01:400]
Move_Layer5_Z = 0; //[-400:0.01:400]
Scale_Layer5_X = 1; //[1:0.01:100]
Scale_Layer5_Y = 1; //[1:0.01:100]
Scale_Layer5_Z = 1; //[1:0.01:100]
/* [Rotate Extrude SVG] */
ShowExtrudeLayer = false;
Rotate_Extrude_Layer_Name = "";
Rotate_Extrude_Degrees = 0.1; //[0.1:.01:360]
Rotate_Extrude_Facets = 3; //[3:1:400]
Extrude_Layer_transparency = 1;//[0:.01:1]
Extrude_Layer_red = 255;//[0:255]
Extrude_Layer_green = 255;//[0:255]
Extrude_Layer_blue = 0;//[0:255]
RotateX_Extrude_Layer = 0; //[0:0.01:360]
RotateY_Extrude_Layer = 0; //[0:0.01:360]
RotateZ_Extrude_Layer = 0; //[0:0.01:360]
MoveX_ExtrudeLayer = 0; //[-400:0.01:400]
MoveY_ExtrudeLayer = 0; //[-400:0.01:400]
MoveZ_ExtrudeLayer = 0; //[-400:0.01:400]
ScaleX_Extrude_Layer = 1; //[1:0.01:100]
ScaleY_Extrude_Layer = 1; //[1:0.01:100]
ScaleZ_Extrude_Layer = 1; //[1:0.01:100]
module Layer1(){
if(ShowLayer1)
color([Layer1_red/255,Layer1_green/255,Layer1_blue/255],Layer1_transparency)
rotate(a = [Rotate_Layer1_X,Rotate_Layer1_Y,Rotate_Layer1_Z])
translate([Move_Layer1_X,Move_Layer1_Y,Move_Layer1_Z])
scale([Scale_Layer1_X,Scale_Layer1_Y,Scale_Layer1_Z])
linear_extrude(height=Linear_Extrude_Layer1,twist=Layer1_twist,slices=Layer1_slices)
import(Path_to_SVG_File, layer = Layer1_name);
}
module Layer2(){
if(ShowLayer2)
color([Layer2_red/255,Layer2_green/255,Layer2_blue/255],Layer2_transparency)
rotate(a = [Rotate_Layer2_X,Rotate_Layer2_Y,Rotate_Layer2_Z])
translate([Move_Layer2_X,Move_Layer2_Y,Move_Layer2_Z])
scale([Scale_Layer2_X,Scale_Layer2_Y,Scale_Layer2_Z])
linear_extrude(height=Linear_Extrude_Layer2,twist=Layer2_twist,slices=Layer2_slices)
import(Path_to_SVG_File,layer=Layer2_name);
}
module Layer3(){
if(ShowLayer3)
color([Layer3_red/255,Layer3_green/255,Layer3_blue/255],Layer3_transparency)
rotate(a = [Rotate_Layer3_X,Rotate_Layer3_Y,Rotate_Layer3_Z])
translate([Move_Layer3_X,Move_Layer3_Y,Move_Layer3_Z])
scale([Scale_Layer3_X,Scale_Layer3_Y,Scale_Layer3_Z])
linear_extrude(height=Linear_Extrude_Layer3,twist=Layer3_twist,slices=Layer3_slices)
import(Path_to_SVG_File,layer=Layer3_name);
}
module Layer4(){
if(ShowLayer4)
color([Layer4_red/255,Layer4_green/255,Layer4_blue/255],Layer4_transparency)
rotate(a = [Rotate_Layer4_X,Rotate_Layer4_Y,Rotate_Layer4_Z])
translate([Move_Layer4_X,Move_Layer4_Y,Move_Layer4_Z])
scale([Scale_Layer4_X,Scale_Layer4_Y,Scale_Layer4_Z])
linear_extrude(height=Linear_Extrude_Layer4,twist=Layer4_twist,slices=Layer4_slices)
import(Path_to_SVG_File,layer=Layer4_name);
}
module Layer5(){
if(ShowLayer5)
color([Layer5_red/255,Layer5_green/255,Layer5_blue/255],Layer5_transparency)
rotate(a = [Rotate_Layer5_X,Rotate_Layer5_Y,Rotate_Layer5_Z])
translate([Move_Layer5_X,Move_Layer5_Y,Move_Layer5_Z])
scale([Scale_Layer5_X,Scale_Layer5_Y,Scale_Layer5_Z])
linear_extrude(height=Linear_Extrude_Layer5,twist=Layer5_twist,slices=Layer5_slices)
import(Path_to_SVG_File, layer = Layer5_name);
}
module RotateExtrude(){
if (ShowExtrudeLayer)
color([Extrude_Layer_red/255,Extrude_Layer_green/255,Extrude_Layer_blue/255],Extrude_Layer_transparency)
rotate_extrude(angle=Rotate_Extrude_Degrees, convexity=10,$fn=Rotate_Extrude_Facets)
rotate(a = [RotateX_Extrude_Layer,RotateY_Extrude_Layer,RotateZ_Extrude_Layer])
translate([MoveX_ExtrudeLayer,MoveY_ExtrudeLayer,MoveZ_ExtrudeLayer])
scale([ScaleX_Extrude_Layer,ScaleY_Extrude_Layer,ScaleZ_Extrude_Layer])
import(Path_to_SVG_File, layer = Rotate_Extrude_Layer_Name);
}
intersection(){
Layer1();
Layer2();
Layer3();
}
color("green",.3)
%Layer1();
color("red",.3)
%Layer2();
color("blue",.3)
%Layer3();
%Layer4();
%Layer5();
%RotateExtrude();
At the end of the code I added a few lines to be able to intersect the layers and make them different transparent colors so they are easier to arrange before rendering them:
I made some outlines for a shoe with Inkscape and put them on different layers so I can adjust them to cut out the main shape:
It will take some adjustment to get them to overlap properly, but using this method you can carve out shapes in seconds, and while it's not like a real sculpting program you can make some pretty complex shapes.
I'm still working on making a shoe with Inkscape and Openscad,but I have made good progress, and soon I will have a customizable shoe program that I can design any type of shoe I want.