Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to modify imported .stl files in OpenSCAD?

Tags:

openscad

Is there anyway to go about importing STL files into OpenSCAD with the ability to modify them?

For instance, the following code demonstrates what I have tried thus far:

difference() {
    import("spherical_puzzle_base.stl");
    translate([0, 0, -RADIUS/2]) {
        cube([RADIUS*2, RADIUS*2, RADIUS], center=true);
    }
}

When I do this I can either hit F5 to render the STL file only which doesn't include the intersection. Or I can hit F6 to compile and render, but it creates a very messed up rendering, no where near manifold or even close to what I would expect for that matter. Is there a solution to this problem using OpenSCAD? Thanks!

(I am attempting to do it this way to save long rendering times, especially while I am testing various design possibilities)

like image 711
Jeremy Avatar asked Oct 23 '13 23:10

Jeremy


People also ask

Can STL files be modified?

You can definitely edit and modify STL files, and it can be done using two different types of modeling software: CAD (Computer-Aided Design) Software. Mesh Editing Tools.

Can you open STL in OpenSCAD?

stl files in the current directory, select a file and open it. Another way to open . stl file is to use drag and drop method - just drag a file from Windows Explorer and drop in on the OpenSCAD program.


1 Answers

I was not sure, whether modifications of stl-models by boolean operations are possible. Boolean operations in openscad are part of csg-modelling. With csg only 'primitive solids' as 'cube', 'sphere', 'cylinder' or 'polyhedron' can be combined.

To verify in openscad 2014.01.29 i tried this:

translate([10,10,0]) polyhedron( points=[ [10,10,0],[10,-10,0],[-10,-10,0],[-10,10,0,[0,0,10]],
triangles=[ [0,1,4],[1,2,4],[2,3,4],[3,0,4],[1,0,3],[2,1,3]]
);

export as 'polyhedron.stl' and then:

difference() {
    import("polyhedron.stl"); 
    translate([5,5,0]) cube([10,10,10]); 
}

i got the correct result (with other, more complex stl too) and i could export them to valid stl-files. Only on screen in openscad some faces seemed to be transparent or damaged. So i think, openscad treats stl-files in boolean operations as 'polyhedron' and you can modify your stl in your way.

like image 175
a_manthey_67 Avatar answered Oct 15 '22 11:10

a_manthey_67