discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Re: preview difference() glitch

LM
Leonard Martin Struttmann
Fri, Dec 23, 2022 4:34 PM

Roger, To avoid the problem when diferencing cylinders to make a pipe, I've
switched to using:

//******************************
module pipe( length, OD, ID, center=false  )
//******************************
{
offsetZ = (center==false)? 0 : -0.5*length;

translate( [ 0, 0, offsetZ ] )
rotate_extrude( angle=360 )
translate( [ 0.5ID, 0, 0 ] )
square( [ 0.5
(OD-ID), length ] );
}
//******************************
//pipe( 5, 10, 5 );

On Fri, Dec 23, 2022 at 5:13 AM Roger Whiteley via Discuss <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: Roger Whiteley roger.whiteley@me.com
To: discuss@lists.openscad.org
Cc:
Bcc:
Date: Fri, 23 Dec 2022 11:13:25 +0000
Subject: [OpenSCAD] Re: preview difference() glitch
Chris, aka nop.head - your tip about viewing in Orthogonal instead of
Perspective is worthy of a Big Thank You - a festive tipple of your
choice, pint of Robinson's perhaps?

If I am differencing cylinders to make a tube, I use a default offset of
0.1, but assigned to a 'constant', which I called cd, then I make the
length of the inner cylinder plus 2xcd.  It makes offsetting so much
easier when I use a module that makes the hole and puts a chamfer either
side of the hole thus:

module chamfered_hole_45 (hole_dia,plate_thick,hole_cham=1,bolt_round=40) {
echo (hole_dia,plate_thick,hole_cham,bolt_round);

  //bolt_round = 40;
  hole_depth = 2*plate_thick ;// just makes a long pole :-)
  l_hole_dia = hole_dia;
  l_hole_cham = hole_cham;
  echo (hole_depth=hole_depth);
  echo (bolt_round=bolt_round);

cylinder(d1=l_hole_dia+l_hole_cham*2,d2=l_hole_dia,h=l_hole_cham,$fn=bolt_round);
cylinder_outer (l_hole_dia/2,hole_depth+1,bolt_round);
translate([0,0,plate_thick-l_hole_cham])

cylinder(d1=l_hole_dia,d2=l_hole_dia+l_hole_cham*2,h=l_hole_cham,$fn=bolt_round);

}//end module

cylinder_outer is another module that compensates for the geometry going
round the inside of the 'hole' and making it undersize.

module cylinder_outer(radius,height,fn){
fudge = 1/cos(180/fn);
cylinder(h=height,r=radius*fudge,$fn=fn);}

Compliments of the season to all our readers ;-)

Roger

---------- Forwarded message ----------
From: Roger Whiteley via Discuss discuss@lists.openscad.org
To: discuss@lists.openscad.org
Cc: Roger Whiteley roger.whiteley@me.com
Bcc:
Date: Fri, 23 Dec 2022 11:13:25 +0000
Subject: [OpenSCAD] Re: preview difference() glitch


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

Roger, To avoid the problem when diferencing cylinders to make a pipe, I've switched to using: //****************************** module pipe( length, OD, ID, center=false ) //****************************** { offsetZ = (center==false)? 0 : -0.5*length; translate( [ 0, 0, offsetZ ] ) rotate_extrude( angle=360 ) translate( [ 0.5*ID, 0, 0 ] ) square( [ 0.5*(OD-ID), length ] ); } //****************************** //pipe( 5, 10, 5 ); On Fri, Dec 23, 2022 at 5:13 AM Roger Whiteley via Discuss < discuss@lists.openscad.org> wrote: > > > > ---------- Forwarded message ---------- > From: Roger Whiteley <roger.whiteley@me.com> > To: discuss@lists.openscad.org > Cc: > Bcc: > Date: Fri, 23 Dec 2022 11:13:25 +0000 > Subject: [OpenSCAD] Re: preview difference() glitch > Chris, aka nop.head - your tip about viewing in Orthogonal instead of > Perspective is worthy of a Big Thank You - a festive tipple of your > choice, pint of Robinson's perhaps? > > If I am differencing cylinders to make a tube, I use a default offset of > 0.1, but assigned to a 'constant', which I called cd, then I make the > length of the inner cylinder plus 2xcd. It makes offsetting so much > easier when I use a module that makes the hole and puts a chamfer either > side of the hole thus: > > module chamfered_hole_45 (hole_dia,plate_thick,hole_cham=1,bolt_round=40) { > echo (hole_dia,plate_thick,hole_cham,bolt_round); > > //bolt_round = 40; > hole_depth = 2*plate_thick ;// just makes a long pole :-) > l_hole_dia = hole_dia; > l_hole_cham = hole_cham; > echo (hole_depth=hole_depth); > echo (bolt_round=bolt_round); > > cylinder(d1=l_hole_dia+l_hole_cham*2,d2=l_hole_dia,h=l_hole_cham,$fn=bolt_round); > cylinder_outer (l_hole_dia/2,hole_depth+1,bolt_round); > translate([0,0,plate_thick-l_hole_cham]) > > cylinder(d1=l_hole_dia,d2=l_hole_dia+l_hole_cham*2,h=l_hole_cham,$fn=bolt_round); > > }//end module > > cylinder_outer is another module that compensates for the geometry going > round the inside of the 'hole' and making it undersize. > > > module cylinder_outer(radius,height,fn){ > fudge = 1/cos(180/fn); > cylinder(h=height,r=radius*fudge,$fn=fn);} > > Compliments of the season to all our readers ;-) > > Roger > > > > > ---------- Forwarded message ---------- > From: Roger Whiteley via Discuss <discuss@lists.openscad.org> > To: discuss@lists.openscad.org > Cc: Roger Whiteley <roger.whiteley@me.com> > Bcc: > Date: Fri, 23 Dec 2022 11:13:25 +0000 > Subject: [OpenSCAD] Re: preview difference() glitch > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
NH
nop head
Fri, Dec 23, 2022 4:36 PM

Or linear_extrude the difference between two circles.

On Fri, 23 Dec 2022 at 16:35, Leonard Martin Struttmann <
lenstruttmann@gmail.com> wrote:

Roger, To avoid the problem when diferencing cylinders to make a pipe,
I've switched to using:

//******************************
module pipe( length, OD, ID, center=false  )
//******************************
{
offsetZ = (center==false)? 0 : -0.5*length;

translate( [ 0, 0, offsetZ ] )
rotate_extrude( angle=360 )
translate( [ 0.5ID, 0, 0 ] )
square( [ 0.5
(OD-ID), length ] );
}
//******************************
//pipe( 5, 10, 5 );

On Fri, Dec 23, 2022 at 5:13 AM Roger Whiteley via Discuss <
discuss@lists.openscad.org> wrote:

---------- Forwarded message ----------
From: Roger Whiteley roger.whiteley@me.com
To: discuss@lists.openscad.org
Cc:
Bcc:
Date: Fri, 23 Dec 2022 11:13:25 +0000
Subject: [OpenSCAD] Re: preview difference() glitch
Chris, aka nop.head - your tip about viewing in Orthogonal instead of
Perspective is worthy of a Big Thank You - a festive tipple of your
choice, pint of Robinson's perhaps?

If I am differencing cylinders to make a tube, I use a default offset of
0.1, but assigned to a 'constant', which I called cd, then I make the
length of the inner cylinder plus 2xcd.  It makes offsetting so much
easier when I use a module that makes the hole and puts a chamfer either
side of the hole thus:

module chamfered_hole_45 (hole_dia,plate_thick,hole_cham=1,bolt_round=40)
{
echo (hole_dia,plate_thick,hole_cham,bolt_round);

  //bolt_round = 40;
  hole_depth = 2*plate_thick ;// just makes a long pole :-)
  l_hole_dia = hole_dia;
  l_hole_cham = hole_cham;
  echo (hole_depth=hole_depth);
  echo (bolt_round=bolt_round);

cylinder(d1=l_hole_dia+l_hole_cham*2,d2=l_hole_dia,h=l_hole_cham,$fn=bolt_round);
cylinder_outer (l_hole_dia/2,hole_depth+1,bolt_round);
translate([0,0,plate_thick-l_hole_cham])

cylinder(d1=l_hole_dia,d2=l_hole_dia+l_hole_cham*2,h=l_hole_cham,$fn=bolt_round);

}//end module

cylinder_outer is another module that compensates for the geometry going
round the inside of the 'hole' and making it undersize.

module cylinder_outer(radius,height,fn){
fudge = 1/cos(180/fn);
cylinder(h=height,r=radius*fudge,$fn=fn);}

Compliments of the season to all our readers ;-)

Roger

---------- Forwarded message ----------
From: Roger Whiteley via Discuss discuss@lists.openscad.org
To: discuss@lists.openscad.org
Cc: Roger Whiteley roger.whiteley@me.com
Bcc:
Date: Fri, 23 Dec 2022 11:13:25 +0000
Subject: [OpenSCAD] Re: preview difference() glitch


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


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

Or linear_extrude the difference between two circles. On Fri, 23 Dec 2022 at 16:35, Leonard Martin Struttmann < lenstruttmann@gmail.com> wrote: > Roger, To avoid the problem when diferencing cylinders to make a pipe, > I've switched to using: > > //****************************** > module pipe( length, OD, ID, center=false ) > //****************************** > { > offsetZ = (center==false)? 0 : -0.5*length; > > translate( [ 0, 0, offsetZ ] ) > rotate_extrude( angle=360 ) > translate( [ 0.5*ID, 0, 0 ] ) > square( [ 0.5*(OD-ID), length ] ); > } > //****************************** > //pipe( 5, 10, 5 ); > > > > On Fri, Dec 23, 2022 at 5:13 AM Roger Whiteley via Discuss < > discuss@lists.openscad.org> wrote: > >> >> >> >> ---------- Forwarded message ---------- >> From: Roger Whiteley <roger.whiteley@me.com> >> To: discuss@lists.openscad.org >> Cc: >> Bcc: >> Date: Fri, 23 Dec 2022 11:13:25 +0000 >> Subject: [OpenSCAD] Re: preview difference() glitch >> Chris, aka nop.head - your tip about viewing in Orthogonal instead of >> Perspective is worthy of a Big Thank You - a festive tipple of your >> choice, pint of Robinson's perhaps? >> >> If I am differencing cylinders to make a tube, I use a default offset of >> 0.1, but assigned to a 'constant', which I called cd, then I make the >> length of the inner cylinder plus 2xcd. It makes offsetting so much >> easier when I use a module that makes the hole and puts a chamfer either >> side of the hole thus: >> >> module chamfered_hole_45 (hole_dia,plate_thick,hole_cham=1,bolt_round=40) >> { >> echo (hole_dia,plate_thick,hole_cham,bolt_round); >> >> //bolt_round = 40; >> hole_depth = 2*plate_thick ;// just makes a long pole :-) >> l_hole_dia = hole_dia; >> l_hole_cham = hole_cham; >> echo (hole_depth=hole_depth); >> echo (bolt_round=bolt_round); >> >> cylinder(d1=l_hole_dia+l_hole_cham*2,d2=l_hole_dia,h=l_hole_cham,$fn=bolt_round); >> cylinder_outer (l_hole_dia/2,hole_depth+1,bolt_round); >> translate([0,0,plate_thick-l_hole_cham]) >> >> cylinder(d1=l_hole_dia,d2=l_hole_dia+l_hole_cham*2,h=l_hole_cham,$fn=bolt_round); >> >> }//end module >> >> cylinder_outer is another module that compensates for the geometry going >> round the inside of the 'hole' and making it undersize. >> >> >> module cylinder_outer(radius,height,fn){ >> fudge = 1/cos(180/fn); >> cylinder(h=height,r=radius*fudge,$fn=fn);} >> >> Compliments of the season to all our readers ;-) >> >> Roger >> >> >> >> >> ---------- Forwarded message ---------- >> From: Roger Whiteley via Discuss <discuss@lists.openscad.org> >> To: discuss@lists.openscad.org >> Cc: Roger Whiteley <roger.whiteley@me.com> >> Bcc: >> Date: Fri, 23 Dec 2022 11:13:25 +0000 >> Subject: [OpenSCAD] Re: preview difference() glitch >> _______________________________________________ >> OpenSCAD mailing list >> To unsubscribe send an email to discuss-leave@lists.openscad.org >> > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >