Quantcast

Problem with union

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

Problem with union

stcisz
This post has NOT been accepted by the mailing list yet.
Hi,
I'm new to openSCAD and during "testing" it I got a mysterious error.
The code below can be previewed bat not render. The stl also can not be
save properly. Both parts can be rendered separably. Any hint, please.

Best regards,
Staszek


============================= code ================================
function square(x) = sqrt(1 - x * x);

union() {
    difference() {
        rotate_extrude(angle=360,convexity=4, $fn=6)
        polygon([[0,0],
            [3.95, square(0.9)-0.5],
            [3.9, square(0.8)-0.5],
            [3.85, square(0.7)-0.5],
            [3.8, square(0.6)-0.5],
            [3.75, square(0.5)-0.5],
            [3.7, square(0.4)-0.5],
            [3.65, square(0.3)-0.5],
            [3.6, square(0.2)-0.5],
            [3.55, square(0.1)-0.5],
        [3.5,0.5], [2.5,0.5], [2.5,0.8], [0,0.8]]);
        union() {
            rotate(30,[0,0,1]) cube([8,1.2, 2],true);
            rotate(90,[0,0,1]) cube([8,1.2, 2], true);
            rotate(150,[0,0,1]) cube([8,1.2, 2], true);
        }
    }
    rotate_extrude(angle=360,convexity=3, $fn=6)
    polygon([[3.5,0.5],
            [3.45, square(0.9)],
            [3.4, square(0.8)],
            [3.35, square(0.7)],
            [3.3, square(0.6)],
            [3.25, square(0.5)],
            [3.2, square(0.4)],
            [3.15, square(0.3)],
            [3.1, square(0.2)],
            [3.05, square(0.1)],
            [3.0, 1], [2.5,1],
            [2.25, 3 - square(0.1) * 2],
            [2.125, 3 - square(0.2) * 2],
            [2.0, 3 - square(0.3) * 2],
            [1.875, 3 - square(0.4) * 2],
            [1.75, 3 - square(0.5) * 2],
            [1.625, 3 - square(0.6) * 2],
            [1.5, 3 - square(0.7) * 2],
            [1.375, 3 - square(0.8) * 2],
            [1.25, 3 - square(0.9) * 2],
            [1.15, 3 - square(0.9) * 2],
            [1.15, 0.5]
    ]);
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with union

MichaelAtOz
Administrator
Welcome to the forum. Your post is still flagged as "This post has NOT been accepted by the mailing list yet", so nobody gets it unless they look.
You need to subscribe to the mailing list, and CLICK THE LINK in the registration email.

stcisz wrote
Hi,
I'm new to openSCAD and during "testing" it I got a mysterious error.
The code below can be previewed bat not render. The stl also can not be
save properly. Both parts can be rendered separably. Any hint, please.

Best regards,
Staszek


============================= code ================================
function square(x) = sqrt(1 - x * x);

union() {
    difference() {
        rotate_extrude(angle=360,convexity=4, $fn=6)
        polygon([[0,0],
            [3.95, square(0.9)-0.5],
            [3.9, square(0.8)-0.5],
            [3.85, square(0.7)-0.5],
            [3.8, square(0.6)-0.5],
            [3.75, square(0.5)-0.5],
            [3.7, square(0.4)-0.5],
            [3.65, square(0.3)-0.5],
            [3.6, square(0.2)-0.5],
            [3.55, square(0.1)-0.5],
        [3.5,0.5], [2.5,0.5], [2.5,0.8], [0,0.8]]);
        union() {
            rotate(30,[0,0,1]) cube([8,1.2, 2],true);
            rotate(90,[0,0,1]) cube([8,1.2, 2], true);
            rotate(150,[0,0,1]) cube([8,1.2, 2], true);
        }
    }
    rotate_extrude(angle=360,convexity=3, $fn=6)
    polygon([[3.5,0.5],
            [3.45, square(0.9)],
            [3.4, square(0.8)],
            [3.35, square(0.7)],
            [3.3, square(0.6)],
            [3.25, square(0.5)],
            [3.2, square(0.4)],
            [3.15, square(0.3)],
            [3.1, square(0.2)],
            [3.05, square(0.1)],
            [3.0, 1], [2.5,1],
            [2.25, 3 - square(0.1) * 2],
            [2.125, 3 - square(0.2) * 2],
            [2.0, 3 - square(0.3) * 2],
            [1.875, 3 - square(0.4) * 2],
            [1.75, 3 - square(0.5) * 2],
            [1.625, 3 - square(0.6) * 2],
            [1.5, 3 - square(0.7) * 2],
            [1.375, 3 - square(0.8) * 2],
            [1.25, 3 - square(0.9) * 2],
            [1.15, 3 - square(0.9) * 2],
            [1.15, 0.5]
    ]);
}
I think your 2nd poly is the problem:

Admin - PM me if you need anything,
or if I've done something stupid...

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Problem with union

stcisz

Thank you. After correction everything works OK.

Best regards,
Staszek


Loading...