Once in  while I want to design a new case for a controller and need to make modifications to an existing design, here is an easy way to take some snips from a design you already made and modify them to use in another deign.

Openscad has an option to make a projection that you can save as an image, so I made a way to automate the process with the ability to see what the section you are are slicing looks like compared to the model:

As you can see above there is a slider that allows you to move the projection (shown in red) and a visual representation of the model, then save the section you want to a file.

Here is the code:

Path_to_STL_File="/home/none3/Desktop/.stl";

Cut_height = 0; //[-200:.01:200]

translate([0, 0, Cut_height])
%import(Path_to_STL_File);

color("red")
projection(cut=true)
translate([0, 0,Cut_height])
rotate([0,0,0])
import(Path_to_STL_File);

After clicking render I can save the selection as an SVG file that I can modify in Inkscape:

right click and open in new tab for a larger image

Then I can select everything and break apart the path to use the different parts, or modify them to use in another design. This is  handy  for when you don't want to build a new model completely from scratch and you already have a design that has parts that are the right size and have cut outs in the right place, or if you have the STL file but lost the original SVG files.

Additionally you can modify the code to slice either an svg file or an stl file from what you have selected by checking a check box:

right click and open image in new tab for a larger view

here is the modified code:

Path_to_STL_File="/home/none3/Desktop/.stl";

Cut_Svg = false;
Cut_Stl = false;
Cut_height = 0; //[-200:.01:200]
Cut_depth = .01; // [.01:.01:200]

translate([0, 0, Cut_height])
%import(Path_to_STL_File);

module cut_svg(){
if (Cut_Svg)
color("red")
projection(cut=true)
translate([0, 0,Cut_height])
rotate([0,0,0])
import(Path_to_STL_File);
}

module cut_stl(){
if (Cut_Stl)
color("blue")
linear_extrude(Cut_depth)
projection(cut=true)
translate([0, 0,Cut_height])
rotate([0,0,0])
import(Path_to_STL_File);
}

cut_stl();
cut_svg();