discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Swiss cheese

JW
Joe Weinpert
Thu, Jun 29, 2023 12:10 AM

Swiss cheese is a flat piece of cheese having random sized holes in random
positions.

One object is a flat cube (the cheese slice) and the other objects are
cylinders (the holes).

Within BOSL2 using diff() or difference() these are combined to make the
final cheese slice.

Here is the code that finalizes it:

diff( "hole" )
vnf_polyhedron( plate ){
for( i = [1:loop] ){
tag( "hole" )
vnf_polyhedron(
move(
[ gougePosX(), gougePosY(), gougePosZ() ],
scale( [ gougeX(), gougeY(), 1 ], adze )
)
);
}
}

This works fine.  No trouble at all.

However ...

What I am wondering is how can I save the above diff() functionality as a
vnf array for later use in the code rather than drawing the objects with
vnf_polyhedron()?

For example the "plate" vnf array shown above was created earlier by using
cube() as a function:

plate = cube([ oaX, oaY, oaZ ]);

Can I do the same when combining objects in a diff()?  If not, is there
another way beyond using something like diff()?

Swiss cheese is a flat piece of cheese having random sized holes in random positions. One object is a flat cube (the cheese slice) and the other objects are cylinders (the holes). Within BOSL2 using diff() or difference() these are combined to make the final cheese slice. Here is the code that finalizes it: diff( "hole" ) vnf_polyhedron( plate ){ for( i = [1:loop] ){ tag( "hole" ) vnf_polyhedron( move( [ gougePosX(), gougePosY(), gougePosZ() ], scale( [ gougeX(), gougeY(), 1 ], adze ) ) ); } } This works fine. No trouble at all. However ... What I am wondering is how can I save the above diff() functionality as a vnf array for later use in the code rather than drawing the objects with vnf_polyhedron()? For example the "plate" vnf array shown above was created earlier by using cube() as a function: plate = cube([ oaX, oaY, oaZ ]); Can I do the same when combining objects in a diff()? If not, is there another way beyond using something like diff()?
RB
Richard Benjamin
Thu, Jun 29, 2023 1:08 PM

Cheese facts, not at all relates to openscad...

Technically, the holes are roughly spherical sliced at diffetent points.
Also the slice itsself is from a larger drum shaped cheese so will have
variously bevelled ends.

Also, recently the swiss found fewer holes in their cheese...tracked back
to less contamination of the raw milk. The holes need nucleation sites to
form.

On Thu, 29 Jun 2023, 02:11 Joe Weinpert, joe.weinpert@gmail.com wrote:

Swiss cheese is a flat piece of cheese having random sized holes in random
positions.

One object is a flat cube (the cheese slice) and the other objects are
cylinders (the holes).

Within BOSL2 using diff() or difference() these are combined to make the
final cheese slice.

Here is the code that finalizes it:

diff( "hole" )
vnf_polyhedron( plate ){
   for( i = [1:loop] ){
      tag( "hole" )
      vnf_polyhedron(
         move(
            [ gougePosX(), gougePosY(), gougePosZ() ],
            scale( [ gougeX(), gougeY(), 1 ], adze )
         )
      );
   }
}

This works fine.  No trouble at all.

However ...

What I am wondering is how can I save the above diff() functionality as a
vnf array for later use in the code rather than drawing the objects with
vnf_polyhedron()?

For example the "plate" vnf array shown above was created earlier by using
cube() as a function:

plate = cube([ oaX, oaY, oaZ ]);

Can I do the same when combining objects in a diff()?  If not, is there
another way beyond using something like diff()?


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

Cheese facts, not at all relates to openscad... Technically, the holes are roughly spherical sliced at diffetent points. Also the slice itsself is from a larger drum shaped cheese so will have variously bevelled ends. Also, recently the swiss found fewer holes in their cheese...tracked back to less contamination of the raw milk. The holes need nucleation sites to form. On Thu, 29 Jun 2023, 02:11 Joe Weinpert, <joe.weinpert@gmail.com> wrote: > Swiss cheese is a flat piece of cheese having random sized holes in random > positions. > > One object is a flat cube (the cheese slice) and the other objects are > cylinders (the holes). > > Within BOSL2 using diff() or difference() these are combined to make the > final cheese slice. > > Here is the code that finalizes it: > > diff( "hole" ) > vnf_polyhedron( plate ){ > for( i = [1:loop] ){ > tag( "hole" ) > vnf_polyhedron( > move( > [ gougePosX(), gougePosY(), gougePosZ() ], > scale( [ gougeX(), gougeY(), 1 ], adze ) > ) > ); > } > } > > This works fine. No trouble at all. > > However ... > > What I am wondering is how can I save the above diff() functionality as a > vnf array for later use in the code rather than drawing the objects with > vnf_polyhedron()? > > For example the "plate" vnf array shown above was created earlier by using > cube() as a function: > > plate = cube([ oaX, oaY, oaZ ]); > > Can I do the same when combining objects in a diff()? If not, is there > another way beyond using something like diff()? > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >
JW
Joe Weinpert
Thu, Jun 29, 2023 1:19 PM

Are you saying that cheese is not grown by the Swiss?  Only made?

Joe Weinpert
skidrowacademy.com

On Thu, Jun 29, 2023 at 9:09 AM Richard Benjamin richardpbenjamin@gmail.com
wrote:

Cheese facts, not at all relates to openscad...

Technically, the holes are roughly spherical sliced at diffetent points.
Also the slice itsself is from a larger drum shaped cheese so will have
variously bevelled ends.

Also, recently the swiss found fewer holes in their cheese...tracked back
to less contamination of the raw milk. The holes need nucleation sites to
form.

On Thu, 29 Jun 2023, 02:11 Joe Weinpert, joe.weinpert@gmail.com wrote:

Swiss cheese is a flat piece of cheese having random sized holes in
random positions.

One object is a flat cube (the cheese slice) and the other objects are
cylinders (the holes).

Within BOSL2 using diff() or difference() these are combined to make the
final cheese slice.

Here is the code that finalizes it:

diff( "hole" )
vnf_polyhedron( plate ){
   for( i = [1:loop] ){
      tag( "hole" )
      vnf_polyhedron(
         move(
            [ gougePosX(), gougePosY(), gougePosZ() ],
            scale( [ gougeX(), gougeY(), 1 ], adze )
         )
      );
   }
}

This works fine.  No trouble at all.

However ...

What I am wondering is how can I save the above diff() functionality as a
vnf array for later use in the code rather than drawing the objects with
vnf_polyhedron()?

For example the "plate" vnf array shown above was created earlier by
using cube() as a function:

plate = cube([ oaX, oaY, oaZ ]);

Can I do the same when combining objects in a diff()?  If not, is there
another way beyond using something like diff()?


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

Are you saying that cheese is not grown by the Swiss? Only made? Joe Weinpert skidrowacademy.com On Thu, Jun 29, 2023 at 9:09 AM Richard Benjamin <richardpbenjamin@gmail.com> wrote: > Cheese facts, not at all relates to openscad... > > Technically, the holes are roughly spherical sliced at diffetent points. > Also the slice itsself is from a larger drum shaped cheese so will have > variously bevelled ends. > > Also, recently the swiss found fewer holes in their cheese...tracked back > to less contamination of the raw milk. The holes need nucleation sites to > form. > > > > On Thu, 29 Jun 2023, 02:11 Joe Weinpert, <joe.weinpert@gmail.com> wrote: > >> Swiss cheese is a flat piece of cheese having random sized holes in >> random positions. >> >> One object is a flat cube (the cheese slice) and the other objects are >> cylinders (the holes). >> >> Within BOSL2 using diff() or difference() these are combined to make the >> final cheese slice. >> >> Here is the code that finalizes it: >> >> diff( "hole" ) >> vnf_polyhedron( plate ){ >> for( i = [1:loop] ){ >> tag( "hole" ) >> vnf_polyhedron( >> move( >> [ gougePosX(), gougePosY(), gougePosZ() ], >> scale( [ gougeX(), gougeY(), 1 ], adze ) >> ) >> ); >> } >> } >> >> This works fine. No trouble at all. >> >> However ... >> >> What I am wondering is how can I save the above diff() functionality as a >> vnf array for later use in the code rather than drawing the objects with >> vnf_polyhedron()? >> >> For example the "plate" vnf array shown above was created earlier by >> using cube() as a function: >> >> plate = cube([ oaX, oaY, oaZ ]); >> >> Can I do the same when combining objects in a diff()? If not, is there >> another way beyond using something like diff()? >> >> >> >> _______________________________________________ >> 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 >
RD
Revar Desmera
Thu, Jun 29, 2023 4:07 PM

Sadly BOSL2 only implements 2D region union/difference/intersection. 3D VNF boolean geometry has not been implemented, and would likely be rather slow. At least until geometry inspection becomes available in OpenSCAD itself.

-Revar

On Jun 29, 2023, at 6:24 AM, Joe Weinpert <joe.weinpert@gmail.com> wrote:

Are you saying that cheese is not grown by the Swiss? Only made?

Joe Weinpert
skidrowacademy.com

On Thu, Jun 29, 2023 at 9:09 AM Richard Benjamin <richardpbenjamin@gmail.com> wrote:

Cheese facts, not at all relates to openscad...

Technically, the holes are roughly spherical sliced at diffetent points.Also the slice itsself is from a larger drum shaped cheese so will have variously bevelled ends.

Also, recently the swiss found fewer holes in their cheese...tracked back to less contamination of the raw milk. The holes need nucleation sites to form.

On Thu, 29 Jun 2023, 02:11 Joe Weinpert, <joe.weinpert@gmail.com> wrote:

Swiss cheese is a flat piece of cheese having random sized holes in random positions.

One object is a flat cube (the cheese slice) and the other objects are cylinders (the holes).

Within BOSL2 using diff() or difference() these are combined to make the final cheese slice.

Here is the code that finalizes it:

diff( "hole" )
vnf_polyhedron( plate ){
for( i = [1:loop] ){
tag( "hole" )
vnf_polyhedron(
move(
[ gougePosX(), gougePosY(), gougePosZ() ],
scale( [ gougeX(), gougeY(), 1 ], adze )
)
);
}
}

This works fine. No trouble at all.

However ...

What I am wondering is how can I save the above diff() functionality as a vnf array for later use in the code rather than drawing the objects with vnf_polyhedron()?

For example the "plate" vnf array shown above was created earlier by using cube() as a function:

plate = cube([ oaX, oaY, oaZ ]);

Can I do the same when combining objects in a diff()? If not, is there another way beyond using something like diff()?

_______________________________________________
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

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

JW
Joe Weinpert
Thu, Jun 29, 2023 4:17 PM

Ok ... thanks for letting me know, Revar.  Will do some workaround.  I do
use BOSL2 all of the time.  Very much to learn.

Joe Weinpert
skidrowacademy.com

On Thu, Jun 29, 2023 at 12:07 PM Revar Desmera revarbat@gmail.com wrote:

Sadly BOSL2 only implements 2D region union/difference/intersection. 3D
VNF boolean geometry has not been implemented, and would likely be rather
slow. At least until geometry inspection becomes available in OpenSCAD
itself.

-Revar

On Jun 29, 2023, at 6:24 AM, Joe Weinpert joe.weinpert@gmail.com wrote:


Are you saying that cheese is not grown by the Swiss?  Only made?

Joe Weinpert
skidrowacademy.com

On Thu, Jun 29, 2023 at 9:09 AM Richard Benjamin <
richardpbenjamin@gmail.com> wrote:

Cheese facts, not at all relates to openscad...

Technically, the holes are roughly spherical sliced at diffetent points.
Also the slice itsself is from a larger drum shaped cheese so will have
variously bevelled ends.

Also, recently the swiss found fewer holes in their cheese...tracked back
to less contamination of the raw milk. The holes need nucleation sites to
form.

On Thu, 29 Jun 2023, 02:11 Joe Weinpert, joe.weinpert@gmail.com wrote:

Swiss cheese is a flat piece of cheese having random sized holes in
random positions.

One object is a flat cube (the cheese slice) and the other objects are
cylinders (the holes).

Within BOSL2 using diff() or difference() these are combined to make the
final cheese slice.

Here is the code that finalizes it:

diff( "hole" )
vnf_polyhedron( plate ){
   for( i = [1:loop] ){
      tag( "hole" )
      vnf_polyhedron(
         move(
            [ gougePosX(), gougePosY(), gougePosZ() ],
            scale( [ gougeX(), gougeY(), 1 ], adze )
         )
      );
   }
}

This works fine.  No trouble at all.

However ...

What I am wondering is how can I save the above diff() functionality as
a vnf array for later use in the code rather than drawing the objects with
vnf_polyhedron()?

For example the "plate" vnf array shown above was created earlier by
using cube() as a function:

plate = cube([ oaX, oaY, oaZ ]);

Can I do the same when combining objects in a diff()?  If not, is there
another way beyond using something like diff()?


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


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

Ok ... thanks for letting me know, Revar. Will do some workaround. I do use BOSL2 all of the time. Very much to learn. Joe Weinpert skidrowacademy.com On Thu, Jun 29, 2023 at 12:07 PM Revar Desmera <revarbat@gmail.com> wrote: > Sadly BOSL2 only implements 2D region union/difference/intersection. 3D > VNF boolean geometry has not been implemented, and would likely be rather > slow. At least until geometry inspection becomes available in OpenSCAD > itself. > > -Revar > > > On Jun 29, 2023, at 6:24 AM, Joe Weinpert <joe.weinpert@gmail.com> wrote: > >  > Are you saying that cheese is not grown by the Swiss? Only made? > > > Joe Weinpert > skidrowacademy.com > > > > On Thu, Jun 29, 2023 at 9:09 AM Richard Benjamin < > richardpbenjamin@gmail.com> wrote: > >> Cheese facts, not at all relates to openscad... >> >> Technically, the holes are roughly spherical sliced at diffetent points. >> Also the slice itsself is from a larger drum shaped cheese so will have >> variously bevelled ends. >> >> Also, recently the swiss found fewer holes in their cheese...tracked back >> to less contamination of the raw milk. The holes need nucleation sites to >> form. >> >> >> >> On Thu, 29 Jun 2023, 02:11 Joe Weinpert, <joe.weinpert@gmail.com> wrote: >> >>> Swiss cheese is a flat piece of cheese having random sized holes in >>> random positions. >>> >>> One object is a flat cube (the cheese slice) and the other objects are >>> cylinders (the holes). >>> >>> Within BOSL2 using diff() or difference() these are combined to make the >>> final cheese slice. >>> >>> Here is the code that finalizes it: >>> >>> diff( "hole" ) >>> vnf_polyhedron( plate ){ >>> for( i = [1:loop] ){ >>> tag( "hole" ) >>> vnf_polyhedron( >>> move( >>> [ gougePosX(), gougePosY(), gougePosZ() ], >>> scale( [ gougeX(), gougeY(), 1 ], adze ) >>> ) >>> ); >>> } >>> } >>> >>> This works fine. No trouble at all. >>> >>> However ... >>> >>> What I am wondering is how can I save the above diff() functionality as >>> a vnf array for later use in the code rather than drawing the objects with >>> vnf_polyhedron()? >>> >>> For example the "plate" vnf array shown above was created earlier by >>> using cube() as a function: >>> >>> plate = cube([ oaX, oaY, oaZ ]); >>> >>> Can I do the same when combining objects in a diff()? If not, is there >>> another way beyond using something like diff()? >>> >>> >>> >>> _______________________________________________ >>> 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 >> > _______________________________________________ > 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 >
AM
Adrian Mariano
Fri, Jun 30, 2023 10:16 AM

So I think Revar's answer of "you can't do it" isn't complete.  You cannot
easily save a single VNF representing a diff, but there are options here
for how you could save your information.

First, you say you are cutting cylinders out of a cube.  That's a 2d
process.  If that's what you're doing you really should be cutting circles
out of a rectangle and then extruding.  You can get a VNF for that by using
the 2d difference functions and then using linear_sweep() instead of
linear_extrude.

Alternatively, if you want to stay in 3d, you can still save your shape as
the parent VNF and then a list of subtracted VNFs.  Instead of having the
for loop actually create geometry, have the for loop make a list of VNFs,
like vnflist = [for(....) move(...,scale(...,adze))].

If the holes don't intersect each other then you can actually use vnf_join
to join the list together into a single VNF so that later you could do a
difference with just two vnf_polyhedron calls instead of needing a loop.

On Wed, Jun 28, 2023 at 8:11 PM Joe Weinpert joe.weinpert@gmail.com wrote:

Swiss cheese is a flat piece of cheese having random sized holes in random
positions.

One object is a flat cube (the cheese slice) and the other objects are
cylinders (the holes).

Within BOSL2 using diff() or difference() these are combined to make the
final cheese slice.

Here is the code that finalizes it:

diff( "hole" )
vnf_polyhedron( plate ){
   for( i = [1:loop] ){
      tag( "hole" )
      vnf_polyhedron(
         move(
            [ gougePosX(), gougePosY(), gougePosZ() ],
            scale( [ gougeX(), gougeY(), 1 ], adze )
         )
      );
   }
}

This works fine.  No trouble at all.

However ...

What I am wondering is how can I save the above diff() functionality as a
vnf array for later use in the code rather than drawing the objects with
vnf_polyhedron()?

For example the "plate" vnf array shown above was created earlier by using
cube() as a function:

plate = cube([ oaX, oaY, oaZ ]);

Can I do the same when combining objects in a diff()?  If not, is there
another way beyond using something like diff()?


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

So I think Revar's answer of "you can't do it" isn't complete. You cannot easily save a single VNF representing a diff, but there are options here for how you could save your information. First, you say you are cutting cylinders out of a cube. That's a 2d process. If that's what you're doing you really should be cutting circles out of a rectangle and then extruding. You can get a VNF for that by using the 2d difference functions and then using linear_sweep() instead of linear_extrude. Alternatively, if you want to stay in 3d, you can still save your shape as the parent VNF and then a list of subtracted VNFs. Instead of having the for loop actually create geometry, have the for loop make a list of VNFs, like vnflist = [for(....) move(...,scale(...,adze))]. If the holes don't intersect each other then you can actually use vnf_join to join the list together into a single VNF so that later you could do a difference with just two vnf_polyhedron calls instead of needing a loop. On Wed, Jun 28, 2023 at 8:11 PM Joe Weinpert <joe.weinpert@gmail.com> wrote: > Swiss cheese is a flat piece of cheese having random sized holes in random > positions. > > One object is a flat cube (the cheese slice) and the other objects are > cylinders (the holes). > > Within BOSL2 using diff() or difference() these are combined to make the > final cheese slice. > > Here is the code that finalizes it: > > diff( "hole" ) > vnf_polyhedron( plate ){ > for( i = [1:loop] ){ > tag( "hole" ) > vnf_polyhedron( > move( > [ gougePosX(), gougePosY(), gougePosZ() ], > scale( [ gougeX(), gougeY(), 1 ], adze ) > ) > ); > } > } > > This works fine. No trouble at all. > > However ... > > What I am wondering is how can I save the above diff() functionality as a > vnf array for later use in the code rather than drawing the objects with > vnf_polyhedron()? > > For example the "plate" vnf array shown above was created earlier by using > cube() as a function: > > plate = cube([ oaX, oaY, oaZ ]); > > Can I do the same when combining objects in a diff()? If not, is there > another way beyond using something like diff()? > > > > _______________________________________________ > OpenSCAD mailing list > To unsubscribe send an email to discuss-leave@lists.openscad.org >