mixing 2D and 3D

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

mixing 2D and 3D

jon_bondy
I'm playing around with moldings.  I thought I was careful to keep all
of the 2D stuff together and all of the 3D stuff together, but I guess I
was wrong.

1) if I do a hull() on 2D objects, don't I get a 2D object as a result?

2) can a module() return a 2D object?

3) sure would be nice if the error messages gave even a HINT about where
the problem was.  I doubt that I am the first to whine about this.

Thanks

Jon

---

$fn = 100;
eps = 0.1;

module RoundedSquare(x, y) {
     hull() {
         translate([0,     1]) square(1);
         translate([x-4, y-4]) circle(4);
         translate([x-1,   1]) square(1);
         translate([0,   y-1]) square(1);
         }
     }

module CrossSection1()
     difference() {
         union() {
             square([10, 20]);
             translate([10, 3])
                 circle(2);
             }
         translate([10, 15])
             circle(2);
         }

CrossSection1();

translate([0, 30, 0])
     CrossSection2();

module CrossSection2()
     difference() {
         union() {
             RoundedSquare(10, 20);
             translate([10, 12])
                 circle(2);
             }
         translate([10, 5])
             circle(2);
         }

translate([80, 0, 0])
     rotate([0, -90, 0])
         linear_extrude(height = 50)
             CrossSection1();

translate([80, 30, 0])
     rotate([0, -90, 0])
         linear_extrude(height = 50)
             CrossSection2();

difference() {
     translate([-50, 50 + 15, 0])
         rotate([0, -90, 90])
             linear_extrude(height = 50)
                 CrossSection2();
     translate([-50, 0, -eps])
         rotate([0, -90, 0])
             linear_extrude(height = 50)
                 CrossSection2();
     }


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: mixing 2D and 3D

doug.moen
Your model has 2 2D objects and 3 3D objects at the top level. This is clearly visible in F5 preview.

You can't export a mixture of 2D and 3D objects, we don't support any file formats where this makes sense, and the F6 render fails for this reason.

If you want to export to STL, you'll need to disable the 2D objects before doing F6 and Export. Likewise, if you want to export to DXF, you'll need to disable the 3D objects before doing F6 and Export.

On 25 June 2016 at 17:58, jon <[hidden email]> wrote:
I'm playing around with moldings.  I thought I was careful to keep all of the 2D stuff together and all of the 3D stuff together, but I guess I was wrong.

1) if I do a hull() on 2D objects, don't I get a 2D object as a result?

2) can a module() return a 2D object?

3) sure would be nice if the error messages gave even a HINT about where the problem was.  I doubt that I am the first to whine about this.

Thanks

Jon

---

$fn = 100;
eps = 0.1;

module RoundedSquare(x, y) {
    hull() {
        translate([0,     1]) square(1);
        translate([x-4, y-4]) circle(4);
        translate([x-1,   1]) square(1);
        translate([0,   y-1]) square(1);
        }
    }

module CrossSection1()
    difference() {
        union() {
            square([10, 20]);
            translate([10, 3])
                circle(2);
            }
        translate([10, 15])
            circle(2);
        }

CrossSection1();

translate([0, 30, 0])
    CrossSection2();

module CrossSection2()
    difference() {
        union() {
            RoundedSquare(10, 20);
            translate([10, 12])
                circle(2);
            }
        translate([10, 5])
            circle(2);
        }

translate([80, 0, 0])
    rotate([0, -90, 0])
        linear_extrude(height = 50)
            CrossSection1();

translate([80, 30, 0])
    rotate([0, -90, 0])
        linear_extrude(height = 50)
            CrossSection2();

difference() {
    translate([-50, 50 + 15, 0])
        rotate([0, -90, 90])
            linear_extrude(height = 50)
                CrossSection2();
    translate([-50, 0, -eps])
        rotate([0, -90, 0])
            linear_extrude(height = 50)
                CrossSection2();
    }


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org




_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: mixing 2D and 3D

jon_bondy

Ah.  Not "mixed within a statement" or "mixed within a module" but "mixed across the entire set of objects".

Thank you.  I "fixed" it by doing a tiny linear_extrude() of the 2D objects.

Jon


On 6/25/2016 6:17 PM, doug moen wrote:
Your model has 2 2D objects and 3 3D objects at the top level. This is clearly visible in F5 preview.

You can't export a mixture of 2D and 3D objects, we don't support any file formats where this makes sense, and the F6 render fails for this reason.

If you want to export to STL, you'll need to disable the 2D objects before doing F6 and Export. Likewise, if you want to export to DXF, you'll need to disable the 3D objects before doing F6 and Export.

On 25 June 2016 at 17:58, jon <[hidden email]> wrote:
I'm playing around with moldings.  I thought I was careful to keep all of the 2D stuff together and all of the 3D stuff together, but I guess I was wrong.

1) if I do a hull() on 2D objects, don't I get a 2D object as a result?

2) can a module() return a 2D object?

3) sure would be nice if the error messages gave even a HINT about where the problem was.  I doubt that I am the first to whine about this.

Thanks

Jon

---

$fn = 100;
eps = 0.1;

module RoundedSquare(x, y) {
    hull() {
        translate([0,     1]) square(1);
        translate([x-4, y-4]) circle(4);
        translate([x-1,   1]) square(1);
        translate([0,   y-1]) square(1);
        }
    }

module CrossSection1()
    difference() {
        union() {
            square([10, 20]);
            translate([10, 3])
                circle(2);
            }
        translate([10, 15])
            circle(2);
        }

CrossSection1();

translate([0, 30, 0])
    CrossSection2();

module CrossSection2()
    difference() {
        union() {
            RoundedSquare(10, 20);
            translate([10, 12])
                circle(2);
            }
        translate([10, 5])
            circle(2);
        }

translate([80, 0, 0])
    rotate([0, -90, 0])
        linear_extrude(height = 50)
            CrossSection1();

translate([80, 30, 0])
    rotate([0, -90, 0])
        linear_extrude(height = 50)
            CrossSection2();

difference() {
    translate([-50, 50 + 15, 0])
        rotate([0, -90, 90])
            linear_extrude(height = 50)
                CrossSection2();
    translate([-50, 0, -eps])
        rotate([0, -90, 0])
            linear_extrude(height = 50)
                CrossSection2();
    }


_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org





_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7640 / Virus Database: 4604/12488 - Release Date: 06/25/16



_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org