[OpenSCAD] extruding plain draws or saving plain draws into STL files.

Juan C.Cilleruelo juanc.cilleruelo at gmail.com
Fri Jul 19 04:08:57 EDT 2019


Yes, of course. I'm developing software for Furniture Manufacturing. His 
base is a powerful smart product configurator based on "Mass 
Customization" principles.

But our brain needs images to see the power of this tool. My program 
generates the images as OpenSCAD scripts and launches it to show the 
currently product configuration.

You can draw many types of parts. The more complex are in .scad files or 
in STL files, to make it as many standard as possible.

At this moment I'm drawing profiles, maybe wood profiles or aluminium 
profiles. If I use an OpenSCAD script, with only 2D instructions, it 
works well of course. But after I need to extrude a plain image and I 
want to do it based on an STL file, to maintain the unity of the software.

Next is the code used to generate the aluminium profile I've used as 
example:

module InternalCross(){
    translate([0, 0, 0]){
       rotate(-45)
       translate([-0.75, 1, 0])
       square([1.5, 26]);
    }

    translate([20, 0, 0]){
       rotate(45)
       translate([-0.75, 1, 0])
       square([1.5, 26]);
    }
}

module Corner(){
$fn = 100;
    offset(.5) offset(-.5) square([1.5, 7  ]);
    offset(.5) offset(-.5) square([7  , 1.5]);
}

module CornerSquare(){
$fn = 100;
    offset(.5) offset(-.5) square([4.5, 4.5]);
    offset(.5) offset(-.5) square([4.5, 4.5]);
}

module CentralSquare(){
     square(7.52);
}

module CentralRound(){
     circle(d=4.2, $fn=100);
}

module nutProfile20x20(){
     difference(){
         union(){
             InternalCross();
             Corner();
             translate([20,  0, 0]) rotate( 90) Corner();
             translate([20, 20, 0]) rotate(180) Corner();
             translate([ 0, 20, 0]) rotate(270) Corner();

             CornerSquare();
             translate([20-4.5,      0, 0]) CornerSquare();
             translate([20-4.5, 20-4.5, 0]) CornerSquare();
             translate([     0, 20-4.5, 0]) CornerSquare();

             translate([6.25, 6.25, 0]) CentralSquare();
        }
        translate([10, 10, 0]) CentralRound();
     }
}

module BasicProfile20Female(Length){
    union(){
         difference(){
             linear_extrude(Length)
            nutProfile20x20();
         }
     }
}

linear_extrude(height = 40, center = false, convexity = 10, twist = 0){
     nutProfile20x20();
}


(I can't send you the images of the result, because I've tried it but 
the forum has currently a problem with inserted images into the messages.)

Use this code to after render it to generate the STL file. And after, 
use the code of the previous message to extrude it.

Really works, with the projection() instruction.

Thanks again!


On 19/07/2019 09:47, nop head wrote:
> Glad to help!
>
> I can see why you needed it now. Where did you get the profile STL from?
>
> On Fri, 19 Jul 2019 at 08:43, Juan C.Cilleruelo 
> <juanc.cilleruelo at gmail.com <mailto:juanc.cilleruelo at gmail.com>> wrote:
>
>     Thank you very much!!!!
>
>     It's just what I looking for!!!
>
>
>
>     /*----------  PROFILE 20X20 => ALUMINIUM PROFILE 20x20 ----------*/
>        linear_extrude(height = 40, center = false, convexity = 10,
>     twist = 0){
>           projection(){
>             import("PROFILE20X20_001.stl");
>           }
>        }
>
>     On 19/07/2019 09:11, nop head wrote:
>>     All those statements are true. To export and import 2D shapes you
>>     need to use a 2D format like DXF or SVG.
>>
>>     You can convert a 3D shape to 2D with projection(), so if you
>>     have a flat object in an STL file you can make it 2D and then
>>     linear_extrude it.
>>
>>     On Fri, 19 Jul 2019 at 08:04, Juan C.Cilleruelo
>>     <juanc.cilleruelo at gmail.com <mailto:juanc.cilleruelo at gmail.com>>
>>     wrote:
>>
>>         I've discovered the next thing in OpenSCAD and I want to know
>>         if it's a
>>         logical situation or is a limitation or if it's a bug behaviour.
>>
>>         1st : I can't use linear_extrude() with modules that use 3D
>>         instructions, only with those that use exclusively 2D
>>         instructions.
>>
>>         2nd: I can't export to STL a drawing that uses exclusively 2D
>>         instructions.
>>
>>         if I want to generate an STL file with only 2D instructions,
>>         I need to
>>         apply at least a 0.1 of linear_extrusion to the drawing.
>>
>>         3rd: As a consequence of the first, I can't use
>>         linear_extrude() to
>>         extrude an imported STL, because its content is always in 3D.
>>
>>         Did anyone know a tip or trick to save 2D drawings into an
>>         STL and to
>>         extrude an STL file imported?
>>
>>         Thank you all in advance!
>>
>>
>>
>>
>>
>>
>>         _______________________________________________
>>         OpenSCAD mailing list
>>         Discuss at lists.openscad.org <mailto:Discuss at lists.openscad.org>
>>         http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>>
>>
>>     _______________________________________________
>>     OpenSCAD mailing list
>>     Discuss at lists.openscad.org  <mailto:Discuss at lists.openscad.org>
>>     http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190719/abf2c5d2/attachment.html>


More information about the Discuss mailing list