A few posts back I added an option to do a fillet or chamfer with svg layers imported from Inkscape, but it lacked the capability to do a fillet or chamfer around an individual object on a specific layer, this module addresses that.
Minkowski is great for this but takes a lot of cpu power, using this method it is actually quite fast, even really complex objects take less than 30 seconds to render in fillet mode and basic shapes render in a couple of seconds.
Chamfer mode uses roof and offset, and renders in under a few seconds even with complex shapes.
here is the code:
//
Path_to_SVG_File ="";
/*[Fillet]*/
fillet=false;
InverseFillet=false;
FilletLayer="layer2";
size=.2;//[.1:.01:20]
shape=60;//[3:1:100]
scale_fillet_x=1;//[.1:.01:10]
scale_fillet_y=1;//[.1:.01:10]
scale_fillet_z=1;//[.1:.01:10]
move_fillet_x=0;//[-200:.01:200]
move_fillet_y=0;//[-200:.01:200]
move_fillet_z=0;//[-200:.01:200]
/*[Chamfer]*/
chamfer=false;
InverseChamfer=false;
ChamferLayer="layer2";
height=4;//[0.5:.01:100]
Offset=0;//[.01:.01:200])
scale_chamfer_x=1;//[.1:.01:10]
scale_chamfer_y=1;//[.1:.01:10]
scale_chamfer_z=1;//[.1:.01:10]
move_x=0;//[-200:.01:200]
move_y=0;//[-200:.01:200]
move_z=0;//[-200:.01:200]
module chamfer(){
scale([scale_chamfer_x,scale_chamfer_y,scale_chamfer_z])
intersection(){
roof(method="voronoi")
offset(delta=Offset/2)
import(Path_to_SVG_File,layer="layer2");
cylinder(height,400,.1,center=true,$fn=shape);
}}
module fillet(){
scale([scale_fillet_x,scale_fillet_y,scale_fillet_z])
minkowski(convexity=11){
linear_extrude(.01)
import(Path_to_SVG_File,layer=ChamferLayer);
sphere(size,$fn=shape);
}}
if(fillet){
render()
if(InverseFillet){
difference(){
linear_extrude(2)
import(Path_to_SVG_File,layer="layer1",$fn=100);
translate([move_fillet_x,move_fillet_y,move_fillet_z])
fillet();
}}
else{
render()
linear_extrude(4)
import(Path_to_SVG_File,layer="layer1",$fn=100);
translate([move_fillet_x,move_fillet_y,move_fillet_z])
fillet();
}}
if(chamfer){
render()
if(InverseChamfer){
difference(){
linear_extrude(2)
import(Path_to_SVG_File,layer="layer1",$fn=100);
translate([move_x,move_y,move_z])
chamfer();
}}
else{
render()
linear_extrude(2)
import(Path_to_SVG_File,layer="layer1");
translate([move_x,move_y,move_z])
chamfer();
}}
The key is to use the stroke for the object you want a fillet or chamfer around and move it to a separate layer:
I have gone over how to separate the fill and the stroke in several posts, it's pretty easy just goto>path, object to path then stroke to path, double click on the fill object and move it to layer 1, then select the stroke object and move it to layer 2. then you can save it as an inkscape svg and import it into OpenSCAD.
And here are some results:
With some experimentation you can make some nice frames around objects also:
While minkowski takes a bit to render the results are worth it, and I will be making improvements as I have time to experiment.