extract STL #286

Closed
dlucad opened this Issue Feb 26, 2013 · 14 comments

Comments

Projects
None yet
4 participants

dlucad commented Feb 26, 2013

I'm having issues extracting to STL. My design takes about 25min to compile and render. When I attempt to extract to STL, it either crashes, error with no filename specified, or prompt filename window but when I clicked on save - nothing happens.

I've tried reducing the detail by changing $fn from 100 to 50. This speed up the rendering process but still can not extract STL.

Tested an example and was able to render and extract to STL.

Why don´t you post your program here and we`ll have a look at it

Owner

kintel commented Mar 1, 2013

Also, are you using the latest version of OpenSCAD (2013.01)? This sounds like an old bug which was fixed a while ago.

dlucad commented Mar 1, 2013

Yes, I'm using the latest version. I also had to bump up the "Turn off rendering at" default was 4000 "elements".

Owner

kintel commented Mar 2, 2013

Can you post the file causing this behavior?

dlucad commented Apr 2, 2013

My code is not pretty.. ;)
I also had to increase the "Turn off rendering at" value under Preferences -> Advanced.

module top_portion()
{
difference() { //top portion bottom

translate([0,0,handle_l*7/10])
scale([handle_w*mp,handle_h*mp,handle_l])
    sphere(r=.5, $fn=100, center=true);

translate([0,0,handle_l-l_offset])
    cylinder(r=handle_w*mp, h=handle_l, $fn=100, center=true);

translate([0,handle_h,handle_l/2])
    cube([handle_w*2,handle_h*2,handle_l], center=true);

}

difference() { //top portion light

translate([0,0,handle_l*7/10])
scale([handle_w*mp,handle_h*mpl,handle_l])
    sphere(r=.5, $fn=100, center=true);

translate([0,0,handle_l-l_offset])
    cylinder(r=handle_w*mpl, h=handle_l, $fn=100, center=true);

translate([0,-handle_h-0.05,handle_l/2])
    cube([handle_w*2,handle_h*2,handle_l], center=true);

}
}//top_portion

module fingers() {
translate([0,0,5]) {

translate([0,handle_h,(handle_l/2)_2/5])
rotate_extrude(convexity = 10, $fn = fn)
translate([handle_w_2.15, 0, 0])
circle(r = handle_w_2/3);
translate([0,handle_h,(handle_l/2)_2/5-20])
rotate_extrude(convexity = 10, $fn = fn)
translate([handle_w_2.15, 0, 0])
circle(r = handle_w_2/3);
translate([0,handle_h,(handle_l/2)_2/5-20_2])
rotate_extrude(convexity = 10, $fn = fn)
translate([handle_w_2.15, 0, 0])
circle(r = handle_w_2/3);
translate([0,handle_h,(handle_l/2)_2/5-20_3])
rotate_extrude(convexity = 10, $fn = fn)
translate([handle_w_2.15, 0, 0])
circle(r = handle_w_2/3);
}
}//fingers

module print_supports() {
//print supports
if (p_supports){
difference() {
union() {
for ( i = [1 : 7] ) {
translate([0,0,handle_l/2-2.25-i_20])
cylinder(r=handle_h_mpl/2, h=.6, $fn=fn, center=true);
}//for loop

translate([0,0,-handle_l/2])
    cube([30,20,30], center=true);

translate([0,0,-handle_l/2])
    cube([30,6,65], center=true);

translate([0,handle_h*.3,-handle_l*.2])
rotate([90,0,90])
    cylinder(r=4, h=handle_h, center=true, $fn=fn);
translate([0,handle_h*.28,handle_l*.24])
rotate([90,0,90])
    cylinder(r=4, h=handle_h, center=true, $fn=fn);
translate([0,-handle_h*.3,handle_l*.405])
rotate([90,0,90])
    cylinder(r=4, h=handle_h, center=true, $fn=fn);




}//union

difference() {
translate([0,0,0])
    scale([handle_w*mpl,handle_h*mpl,handle_l])
    cube([3,3,3], center=true); 

translate([0,0,0])
    scale([handle_w,handle_h,handle_l])
    sphere(r=.5, $fn=100, center=true);

top_portion();

}


fingers();

}
}//print supports
}//print_supports

fn=100;

v_debug=false; //debug
v2_debug=false; //debug
hv_debug=true;
p_supports=true;

golden_ratio=(1+sqrt(5))/2;
total_l=17*25.4;

thickness=5;

handle_l=7*25.4;
l_offset=10;
handle_w=29;
handle_h=32;

mp=1.2;
mpl=1.8;

//handle2_l=handle_l/golden_ratio;
//handle2_l=(handle_l/golden_ratio)_(golden_ratio/(1+golden_ratio));
handle2_l=total_l/4;
handle2_w=3.75_25.4;
handle2_h=2;

handle3_l=total_l/4;
handle3_w=19;
handle3_h=2;

led_h=5;
hs_h=1.42;
hs_w=13;

lens_r=17.5/2;
lens_h=11.1-1.5+led_h+hs_h;
lens_a=5;

difference(){

union(){

difference(){

union(){
difference(){
translate([0,0,0])
scale([handle_w,handle_h,handle_l])
sphere(r=.5, $fn=100, center=true);

translate([0,0,handle_l*.85])
    cylinder(r=handle_w*mp, h=handle_l, $fn=100, center=true);

//hollow
difference(){
translate([0,0,0])
scale([handle_w-thickness,handle_h-thickness,handle_l-thickness])
sphere(r=.5, $fn=100, center=true);
translate([0,-handle_h*7.5/10,0])
cube([handle_w,handle_h,handle_l], center=true);

}

translate([0,0,handle_l-l_offset])
    cylinder(r=handle_w*mp, h=handle_l, $fn=100, center=true);

fingers();

}

difference() {
top_portion();

//delete center
translate([0,0,handle_l*.2])
    cylinder(r=lens_r*.9, h=thickness*3, center=false, $fn=fn);

}

if (v_debug) {
translate([0,0,handle_l/2+handle3_l/2])
scale([handle3_w,handle3_h,handle3_l])
// sphere(r=.5, $fn=fn, center=true);
cube([1,1,1], center=true);

translate([0,0,handle_l/2+handle2_l/2+handle3_l])
scale([handle2_w,handle2_h,handle2_l])
// sphere(r=.5, $fn=fn, center=true);
cube([1,1,1], center=true);
}
}

//hollow bottom
difference() {
    translate([0,0,handle_l*7/10])
    scale([handle_w*mp-thickness,handle_h*mp-thickness,handle_l-thickness])
        sphere(r=.5, $fn=fn, center=true);

    translate([0,0,handle_l-l_offset-thickness/2])
        cylinder(r=handle_w, h=handle_l, $fn=fn, center=true);

}

//hollow light
difference() {
    translate([0,0,handle_l*7/10])
    scale([handle_w*mp-thickness,handle_h*mpl-thickness,handle_l-thickness])
        sphere(r=.5, $fn=fn, center=true);

    translate([0,0,handle_l-l_offset-thickness/2])
        cylinder(r=handle_w, h=handle_l, $fn=fn, center=true);

    translate([0,-handle_h-0.1,handle_l/2])
        cube([handle_w*2,handle_h*2,handle_l], center=true);


}

//peg
translate([0,lens_r*1.4-(lens_h/tan(90-lens_a)),handle_l/2-l_offset-10.75-lens_h])
rotate([-lens_a,0,0])
cylinder(r=6.5/2,h=10.8, $fn=fn, center=false);

//lens
translate([0,lens_r_1.4,handle_l/2-thickness/2-l_offset])
rotate([-lens_a,0,0])
cylinder(r=lens_r,h=thickness_2, $fn=fn, center=true);
translate([0,lens_r*1.4,handle_l/2-thickness/2-1.5-l_offset])
rotate([-lens_a,0,0])
cylinder(r=19.9/2,h=thickness, $fn=fn, center=true);

}//difference

//lens_support
difference() {
translate([0,lens_r_1.4-(lens_h/tan(90-lens_a)),handle_l/2-l_offset-thickness/2-lens_h])
rotate([-lens_a,0,0])
cylinder(r2=lens_r,r1=lens_r_1.5,h=thickness, $fn=fn, center=true);

difference(){
translate([0,0,handle_l*7/10])
    scale([handle_w,handle_h,handle_l])
    cube([2,2,1], center=true); 
translate([0,0,handle_l*7/10])
    scale([handle_w*mp,handle_h*mpl,handle_l])
    sphere(r=.5, $fn=100, center=true);
}

translate([0,lens_r*1.4-(lens_h/tan(90-lens_a)),handle_l/2-l_offset-10.75-lens_h])
rotate([-lens_a,0,0])
cylinder(r=6.5/2,h=10.8, $fn=fn, center=false);

translate([0,lens_r*1.4-(lens_h/tan(90-lens_a))-thickness-6,handle_l/2-thickness-lens_h-l_offset])
    rotate([-lens_a,0,0])
    cube([hs_w*2, thickness*2, thickness*4], center=true);

}

//insert support
if (v2_debug == false) {
difference() {
union() {

    translate([0,-handle3_h/2-thickness/2-0.01,handle_l/2-l_offset-15.1])
        cube([handle_w*mp,thickness,30], center=true);
    translate([0,handle3_h/2+thickness/2+0.01,handle_l/2-l_offset-11.5/2])
        cube([handle_w*mp,thickness,11.3], center=true);

    }


    translate([0,lens_r*1.4-(lens_h/tan(90-lens_a))-thickness/2-6,handle_l/2-thickness-lens_h-l_offset])
    rotate([-lens_a,0,0])
    cube([hs_w*2, thickness, thickness*4], center=true);


translate([0,0,handle_l/2-l_offset])
scale([handle3_w,handle3_h,60])
    cube([1,1,1], center=true);

translate([0,lens_r*1.4,handle_l/2-thickness/2-l_offset])
rotate([-lens_a,0,0])
cylinder(r=lens_r,h=thickness*2, $fn=fn, center=true);
translate([0,lens_r*1.4,handle_l/2-thickness/2-1.5-l_offset])
rotate([-lens_a,0,0])
cylinder(r=19.9/2,h=thickness, $fn=fn, center=true);


difference() {
    translate([0,0,handle_l*7/10])
        cube([handle_w*mpl, handle_h*mpl, handle_l], center=true);



difference() { //top portion bottom

translate([0,0,handle_l*7/10])
scale([handle_w*mp,handle_h*mp,handle_l])
    sphere(r=.5, $fn=100, center=true);

translate([0,0,handle_l-l_offset])
    cylinder(r=handle_w*mp, h=handle_l, $fn=100, center=true);

translate([0,handle_h,handle_l/2])
    cube([handle_w*2,handle_h*2,handle_l], center=true);
}

difference() { //top portion light

translate([0,0,handle_l*7/10])
scale([handle_w*mp,handle_h*mpl,handle_l])
    sphere(r=.5, $fn=100, center=true);

translate([0,0,handle_l-l_offset])
    cylinder(r=handle_w*mpl, h=handle_l, $fn=100, center=true);

translate([0,-handle_h,handle_l/2])
    cube([handle_w*2,handle_h*2,handle_l], center=true);
}

}
}

}

print_supports();

}//union

//thumb switch
//translate([0,handle_h/2_.85,handle_l_0.34])
// rotate([75,0,0])
// cylinder(r1=lens_r_2/3, r2=lens_r_1, h=thickness, center=true, $fn=fn);

if (v2_debug == false) {
translate([0,0,handle_l/2-l_offset])
scale([handle3_w,handle3_h,thickness*2])
cube([1,1,1], center=true);
}

if (hv_debug){
translate([-handle_w,0,0])
cube([handle_w_2,handle_h_2,handle_l*2], center=true);
}

//loop
translate([0,0,-handle_l*.45])
rotate([90,0,90])
cylinder(r=2, h=20, center=true, $fn=fn);

//pegs holes
translate([0,0,-handle_l_.36])
rotate([90,0,90])
cylinder(r=1.5, h=6, center=true, $fn=fn);
translate([0,-handle_h_.34,-handle_l_.2])
rotate([90,0,90])
cylinder(r=1.5, h=6, center=true, $fn=fn);
translate([0,handle_h_.3,-handle_l_.2])
rotate([90,0,90])
cylinder(r=1.5, h=6, center=true, $fn=fn);
translate([0,handle_h_.28,handle_l_.24])
rotate([90,0,90])
cylinder(r=1.5, h=6, center=true, $fn=fn);
translate([0,-handle_h_.3,handle_l*.405])
rotate([90,0,90])
cylinder(r=1.5, h=6, center=true, $fn=fn);

}//difference

//pegs

for ( i = [0 : 4] ) {
translate([5/2,-handle_h,i*10])
rotate([90,0,90])
cylinder(r=1.48, h=5, center=true, $fn=fn);
}

Hi,
I had a look at the code:
I had to reduce fn to 16 to have it display in a reasonable time ( on a Acer Aspire One, 1Ghz, Win7).
I also reduced every explicit $fn=100 to 16.
Do you really need in your manufacturing process such a high precision?
It now compiles and renders in 8 minutes and works fine.
It does look very chunky with $fn=16. So increase it where you really need it.

A sphere with fn=100 has, I believe, about 2_100_100=20.000 polygons. And repeatably subtracting spheres just result in a lot(!) of operations, very fast.

By the way, was is it? A flash light?

dlucad commented Apr 4, 2013

I have a Quad Core i7 2.8ghz and 16gb of RAM. I understand OpenSCAD is not multi-threaded but it should be able to handle complicated designs or designs with lots of polygons. I don't mind it takes a long time to render but I need it to be able to extract to STL.

Is there anything that can be done to increase OpenSCAD memory usage so it doesn't crash?

Owner

kintel commented Apr 4, 2013

Which OS are you using?

I'm trying to reproduce the crash, but haven't succeeded so far.
If you could provide more information about what constitutes a crash, including any crashlog or error output you see, it would be helpful.

dlucad commented Apr 4, 2013

I'm running Win7 64bit version.

Hit F5 to compile a few times after making minor changes will cause OpenSCAD to hang (unresponsive).

Hit F5 to compile then make minor changes, hit F6 to compile and render will cause it to crash (Windows warns OpenSCAD have problem, hit ok, openscad is terminated).

Owner

kintel commented Apr 4, 2013

I'm not familiar with Windows 7 - do you get any more information when Windows "warns OpenSCAD have problem" ?
What happens if you don't click OK? Does OpenSCAD continue to run (use CPU)?

It sounds to me like Windows detects that OpenSCAD hasn't responded in a while, and tries to be helpful but guesses wrongly. For complex designs like yours, the last operation can easily take hours to finish, and while that's happening, it will appear frozen. I've heard people having to let it run for 12 hours to finish.

Owner

kintel commented Apr 4, 2013

Also, from your initial report, it's unclear when this happens. You mentioned things like "error with no filename specified" and "prompt filename window but when I clicked on save - nothing happens". Both these suggest that the F6 operation succeeded and that the error happen after you try to export STL from the meny. In your last message you say it hangs while doing the F6.

I loaded the above. It shows signs consistent with #418.
F5, console outputs the usual stuff, shows the object (looks like it's cut in half - have not looked at code to see if this is normal), non responsive, very slow to move image around. CPU goes to 100% (system), OpenSCAD is only getting ~70-80%, but I'm running lots of stuff. None of the task manager memory values are changing.
Hit F6, screen cleared, still processing...will repost back if/when anything happens...

Owner

kintel commented Jun 30, 2013

@MichaelAtOz I agree, but the original report confuses me, specifically "error with no filename specified" and "prompt filename window but when I clicked on save - nothing happens".
I haven't gotten any feedback on this in a while, so I might close this assuming it's the same as #418.

kintel closed this Dec 31, 2013

Owner

kintel commented Dec 31, 2013

Closed assuming this is a duplicate of #418

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment