discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

difference() is not working as expected

M
mikeonenine@web.de
Fri, Nov 22, 2024 12:32 AM

Rogier Wolff wrote:

On Wed, Nov 20, 2024 at 11:47:28PM +0000, Caddiy via Discuss wrote:

Another useful feature is center=true. It anchors objects in their
centre, which simplifies things in most, but not all cases. I use it
about 80% of the time. Regrettably, it’s not the default.

Create a module that does it for you:

module ccube (size) cube (size, center=true);

Put it with the other "stuff I always use" in an include.
(I have stuff in there like dup2() : Duplicates an object by rotating
it around the origin, along with dup3(), dup4() and dupn(n) ).

Roger. 

--
** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 **
**    Delftechpark 11 2628 XJ  Delft, The Netherlands.  KVK: 27239233    **
f equals m times a. When your f is steady, and your m is going down
your a** is going up.  -- Chris Hadfield about flying up the space shuttle.
**  'a' for accelleration.

I’ve been thinking of a “stuff I always use” library for some time and now I’ve started one.

ccube(x,y,z) is now centred and without square brackets too. It had bothered me that “cube” required extra square brackets.

ccylinder(h,r) now doesn’t need r= , h= , just the numbers.

In “ccone”, the height now comes last, as in “cylinder”, to avoid confusion.

All that is missing now is a standard “blank.scad” with some “includes” at the top.

module ccube(x, y, z)

{

cube([x, y, z], center=true);

}

module ccyldr(r, h)

{

cylinder(r=r, h=h, center=true);

}

module ccone(r1, r2, h)

{

cylinder(r1=r1, r2=r2, h, center=true);

}

But what happens to the “stuff I always use” library, when a newer version of OpenSCAD is installed?

Rogier Wolff wrote: > On Wed, Nov 20, 2024 at 11:47:28PM +0000, Caddiy via Discuss wrote: > > > Another useful feature is center=true. It anchors objects in their > > centre, which simplifies things in most, but not all cases. I use it > > about 80% of the time. Regrettably, it’s not the default. > > Create a module that does it for you: > > module ccube (size) cube (size, center=true); > > Put it with the other "stuff I always use" in an include. > (I have stuff in there like dup2() : Duplicates an object by rotating > it around the origin, along with dup3(), dup4() and dupn(n) ). > > ``` > Roger. > ``` > > \-- > \*\* R.E.Wolff@BitWizard.nl \*\* https://www.BitWizard.nl/ \*\* +31-15-2049110 \*\* > \*\* Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 \*\* > f equals m times a. When your f is steady, and your m is going down > your a\*\* is going up. -- Chris Hadfield about flying up the space shuttle. > \*\* 'a' for accelleration. I’ve been thinking of a “stuff I always use” library for some time and now I’ve started one. ccube(x,y,z) is now centred and without square brackets too. It had bothered me that “cube” required extra square brackets. ccylinder(h,r) now doesn’t need r= , h= , just the numbers. In “ccone”, the height now comes last, as in “cylinder”, to avoid confusion. All that is missing now is a standard “blank.scad” with some “includes” at the top. `module ccube(x, y, z)` `{` `cube([x, y, z], center=true);` `}` `module ccyldr(r, h)` `{` `cylinder(r=r, h=h, center=true);` `}` `module ccone(r1, r2, h)` `{` `cylinder(r1=r1, r2=r2, h, center=true);` `}` But what happens to the “stuff I always use” library, when a newer version of OpenSCAD is installed?
JB
Jordan Brown
Fri, Nov 22, 2024 3:46 AM

On 11/21/2024 4:32 PM, Caddiy via Discuss wrote:

It had bothered me that “cube” required extra square brackets.

cube() doesn't require square brackets.  It requires an argument that is
a list of three coordinates.  While taking x, y, and z as three separate
arguments might seem simpler, it really ends up not being simpler when
you do more complex things where you need to pass around coordinates,
have arrays of coordinates, do arithmetic on coordinates, and so on.

But what happens to the “stuff I always use” library, when a newer
version of OpenSCAD is installed?

If you put it in the proper place - Documents\OpenSCAD\libraries on
Windows, don't know about on other OSes - then what happens to it on
upgrade is ... absolutely nothing.

"File/Show Library Folder..." should show you the right directory.

On 11/21/2024 4:32 PM, Caddiy via Discuss wrote: > It had bothered me that “cube” required extra square brackets. cube() doesn't require square brackets.  It requires an argument that is a list of three coordinates.  While taking x, y, and z as three separate arguments might seem simpler, it really ends up *not* being simpler when you do more complex things where you need to pass around coordinates, have arrays of coordinates, do arithmetic on coordinates, and so on. > But what happens to the “stuff I always use” library, when a newer > version of OpenSCAD is installed? > If you put it in the proper place - Documents\OpenSCAD\libraries on Windows, don't know about on other OSes - then what happens to it on upgrade is ... absolutely nothing. "File/Show Library Folder..." should show you the right directory.