discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Problem with "Difference" and F5 ...

D
Dave
Sat, Feb 19, 2022 4:09 PM

Hi, I am running Openscad v2021.01 and am having problems with the following script.

$fn=32;
difference()
{
union(){
import("base_slide_heavy_duty_HA.stl", 4);
hull(){
translate([22,-13,0]) color("red") cube([20,70,3]);
translate([35.5,-13,0]) color("green") cylinder(h=3, d=13);
translate([28.5,-19.5,0]) color("blue") cube([7,5,3]);
translate([24,57,0]) color("green")cylinder(h=3, d=4);
translate([40,57,0]) color("green")cylinder(h=3, d=4);
}
}
translate([25.8,-17,-1]) color("red")cylinder(h=5, d=3);
}

and when I hit F5 I get the following display

i.e. there are "holes" in the render.

If I comment out the difference() it appears correctly except the red cylinder isn't subtracted :-

The "imported" .STL file is attached.

This is only a problem for the preview, the generated STL is fine.

What am I doing wrong ??

Regards,
Dave

AM
Adrian Mariano
Sat, Feb 19, 2022 5:18 PM

You need to add convexity=10 to your import call.

On Sat, Feb 19, 2022 at 11:10 AM Dave softfoot@hotmail.com wrote:

Hi, I am running Openscad v2021.01 and am having problems with the
following script.

$fn=32;
difference()
{
union(){
import("base_slide_heavy_duty_HA.stl", 4);
hull(){
translate([22,-13,0]) color("red") cube([20,70,3]);
translate([35.5,-13,0]) color("green") cylinder(h=3, d=13);
translate([28.5,-19.5,0]) color("blue") cube([7,5,3]);
translate([24,57,0]) color("green")cylinder(h=3, d=4);
translate([40,57,0]) color("green")cylinder(h=3, d=4);
}
}
translate([25.8,-17,-1]) color("red")cylinder(h=5, d=3);
}

and when I hit F5 I get the following display

i.e. there are "holes" in the render.

If I comment out the difference() it appears correctly except the red
cylinder isn't subtracted :-

The "imported" .STL file is attached.

This is only a problem for the preview, the generated STL is fine.

What am I doing wrong ??

Regards,
Dave


OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org

You need to add convexity=10 to your import call. On Sat, Feb 19, 2022 at 11:10 AM Dave <softfoot@hotmail.com> wrote: > Hi, I am running Openscad v2021.01 and am having problems with the > following script. > > $fn=32; > difference() > { > union(){ > import("base_slide_heavy_duty_HA.stl", 4); > hull(){ > translate([22,-13,0]) color("red") cube([20,70,3]); > translate([35.5,-13,0]) color("green") cylinder(h=3, d=13); > translate([28.5,-19.5,0]) color("blue") cube([7,5,3]); > translate([24,57,0]) color("green")cylinder(h=3, d=4); > translate([40,57,0]) color("green")cylinder(h=3, d=4); > } > } > translate([25.8,-17,-1]) color("red")cylinder(h=5, d=3); > } > > and when I hit F5 I get the following display > > i.e. there are "holes" in the render. > > If I comment out the difference() it appears correctly except the red > cylinder isn't subtracted :- > > The "imported" .STL file is attached. > > This is only a problem for the preview, the generated STL is fine. > > What am I doing wrong ?? > > Regards, > Dave > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
RW
Raymond West
Sat, Feb 19, 2022 5:28 PM

Hi Dave,

It doesn' t seem to like some boolean ops on the stl. I've modified the
code, below, and made the red hole so it avoids countersink renders Ok

$fn=32;

    import("C:/Users/Ray/Downloads/base_slide_heavy_duty_HA.stl");
      plate();

module plate (){
   difference(){
hull(){
translate([22,-13,0]) color("red") cube([20,70,3]);
translate([35.5,-13,0]) color("green") cylinder(h=3, d=13);
translate([28.5,-19.5,0]) color("blue") cube([7,5,3]);
translate([24,57,0]) color("green")cylinder(h=3, d=4);
translate([40,57,0]) color("green")cylinder(h=3, d=4);
}

translate([25.8,-17,-1]) color("red")cylinder(h=5, d=6);
}
}

On 19/02/2022 16:09, Dave wrote:

Hi, I am running Openscad v2021.01 and am having problems with the
following script.

$fn=32;
difference()
{
  union(){
    import("base_slide_heavy_duty_HA.stl", 4);
    hull(){
      translate([22,-13,0]) color("red") cube([20,70,3]);
      translate([35.5,-13,0]) color("green") cylinder(h=3, d=13);
      translate([28.5,-19.5,0]) color("blue") cube([7,5,3]);
      translate([24,57,0]) color("green")cylinder(h=3, d=4);
      translate([40,57,0]) color("green")cylinder(h=3, d=4);
    }
  }
  translate([25.8,-17,-1]) color("red")cylinder(h=5, d=3);
}

and when I hit F5 I get the following display

i.e. there are "holes" in the render.

If I comment out the difference() it appears correctly except the red
cylinder isn't subtracted :-

The "imported" .STL file is attached.

This is only a problem for the preview, the generated STL is fine.

What am I doing wrong ??

Regards,
Dave


OpenSCAD mailing list
To unsubscribe send an email todiscuss-leave@lists.openscad.org

Hi Dave, It doesn' t seem to like some boolean ops on the stl. I've modified the code, below, and made the red hole so it avoids countersink renders Ok $fn=32;     import("C:/Users/Ray/Downloads/base_slide_heavy_duty_HA.stl");       plate(); module plate (){    difference(){ hull(){ translate([22,-13,0]) color("red") cube([20,70,3]); translate([35.5,-13,0]) color("green") cylinder(h=3, d=13); translate([28.5,-19.5,0]) color("blue") cube([7,5,3]); translate([24,57,0]) color("green")cylinder(h=3, d=4); translate([40,57,0]) color("green")cylinder(h=3, d=4); } translate([25.8,-17,-1]) color("red")cylinder(h=5, d=6); } } On 19/02/2022 16:09, Dave wrote: > > Hi, I am running Openscad v2021.01 and am having problems with the > following script. > > $fn=32; > difference() > { >   union(){ >     import("base_slide_heavy_duty_HA.stl", 4); >     hull(){ >       translate([22,-13,0]) color("red") cube([20,70,3]); >       translate([35.5,-13,0]) color("green") cylinder(h=3, d=13); >       translate([28.5,-19.5,0]) color("blue") cube([7,5,3]); >       translate([24,57,0]) color("green")cylinder(h=3, d=4); >       translate([40,57,0]) color("green")cylinder(h=3, d=4); >     } >   } >   translate([25.8,-17,-1]) color("red")cylinder(h=5, d=3); > } > > and when I hit F5 I get the following display > > i.e. there are "holes" in the render. > > If I comment out the difference() it appears correctly except the red > cylinder isn't subtracted :- > > The "imported" .STL file is attached. > > This is only a problem for the preview, the generated STL is fine. > > What am I doing wrong ?? > > Regards, > Dave > > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email todiscuss-leave@lists.openscad.org