Can anyone tell me rather then building a long cylinder with different diameters and stacking them on top of each other if a person can do rather create a long cylinder and use nested difference() to keep the cylinder solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail for Windows
If I understand your question correctly, you pose a possible construction
technique, give an example, and ask if it works.
What happens when you run that code?
(Yeah, I tried your example, it has a simple typo, and in preview you get
Z-fighting, which is easily fixable by making the subtraction cylinders
slightly larger)
Or are you asking something else?
Michael, fra mobilen
fre. 4. mar. 2022 16.30 skrev Hendrik blindguydiy@gmail.com:
Hi
Can anyone tell me rather then building a long cylinder with different
diameters and stacking them on top of each other if a person can do rather
create a long cylinder and use nested difference() to keep the cylinder
solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail https://go.microsoft.com/fwlink/?LinkId=550986 for
Windows
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
You could build the profile in 2D and then rotate_extrude() it.
Jon
On 3/4/2022 10:29 AM, Hendrik wrote:
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Another way to make it that would execute much faster is to
rotate_extrude() a half profile, which would either be a polygon or a union
of squares.
On Fri, 4 Mar 2022 at 15:48, Michael Möller private2michael@gmail.com
wrote:
If I understand your question correctly, you pose a possible construction
technique, give an example, and ask if it works.
What happens when you run that code?
(Yeah, I tried your example, it has a simple typo, and in preview you get
Z-fighting, which is easily fixable by making the subtraction cylinders
slightly larger)
Or are you asking something else?
Michael, fra mobilen
fre. 4. mar. 2022 16.30 skrev Hendrik blindguydiy@gmail.com:
Hi
Can anyone tell me rather then building a long cylinder with different
diameters and stacking them on top of each other if a person can do rather
create a long cylinder and use nested difference() to keep the cylinder
solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail https://go.microsoft.com/fwlink/?LinkId=550986 for
Windows
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
If I run the code with f5 and f6 I get no errors and it loads it. But will have to try and find someone to see what is on the screen..
I can even export it.
Sent from Mail for Windows
From: Michael Möller
Sent: Friday, 04 March 2022 17:48
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: nested difference to subtract from solid
If I understand your question correctly, you pose a possible construction technique, give an example, and ask if it works.
What happens when *you* run that code?
(Yeah, I tried your example, it has a simple typo, and in preview you get Z-fighting, which is easily fixable by making the subtraction cylinders slightly larger)
Or are you asking something else?
Michael, fra mobilen
fre. 4. mar. 2022 16.30 skrev Hendrik <blindguydiy@gmail.com>:
Hi
Can anyone tell me rather then building a long cylinder with different diameters and stacking them on top of each other if a person can do rather create a long cylinder and use nested difference() to keep the cylinder solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail for Windows
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Sent from Mail for Windows
From: Michael Möller
Sent: Friday, 04 March 2022 17:48
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: nested difference to subtract from solid
If I understand your question correctly, you pose a possible construction technique, give an example, and ask if it works.
What happens when *you* run that code?
(Yeah, I tried your example, it has a simple typo, and in preview you get Z-fighting, which is easily fixable by making the subtraction cylinders slightly larger)
Or are you asking something else?
Michael, fra mobilen
fre. 4. mar. 2022 16.30 skrev Hendrik <blindguydiy@gmail.com>:
Hi
Can anyone tell me rather then building a long cylinder with different diameters and stacking them on top of each other if a person can do rather create a long cylinder and use nested difference() to keep the cylinder solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail for Windows
_______________________________________________
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
In general it is wise to overlap unioned shapes, especially in 3D. In your
case all the heights look like they can be represented exactly in floating
point fractions, so you probably get away without it.
On Fri, 4 Mar 2022 at 16:26, Hendrik blindguydiy@gmail.com wrote:
The reason why I looked at doing it that way, it means that it is one
solid part and problems with correctly union where small spaces can appear
is excluded. So just was wondering if it could be done like that. On the
other hand say I stack all the different cylinders is it safer to include a
esp=0.01 or something like that to make sure no spaces appear. Could it do
any harm in including the esp or could it be just a safety net.
Sent from Mail https://go.microsoft.com/fwlink/?LinkId=550986 for
Windows
*From: *Michael Möller private2michael@gmail.com
*Sent: *Friday, 04 March 2022 17:48
*To: *OpenSCAD general discussion discuss@lists.openscad.org
*Subject: *[OpenSCAD] Re: nested difference to subtract from solid
If I understand your question correctly, you pose a possible construction
technique, give an example, and ask if it works.
What happens when you run that code?
(Yeah, I tried your example, it has a simple typo, and in preview you get
Z-fighting, which is easily fixable by making the subtraction cylinders
slightly larger)
Or are you asking something else?
Michael, fra mobilen
fre. 4. mar. 2022 16.30 skrev Hendrik blindguydiy@gmail.com:
Hi
Can anyone tell me rather then building a long cylinder with different
diameters and stacking them on top of each other if a person can do rather
create a long cylinder and use nested difference() to keep the cylinder
solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail https://go.microsoft.com/fwlink/?LinkId=550986 for
Windows
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
Hendrik,
nop.head’s alternative is this,
rotate_extrude($fn=100)
polygon(points=
[[0,0],
[4,0],
[4,2],
[3.5,2],
[3.5,3.5],
[4,3.5],
[4,8.5],
[3.5,8.5],
[3.5,10],
[11,10],
[11,12],
[8,12],
[8,40],
[6,40],
[6,12],
[0,12],
[0,0]]
);
Whilst this is simpler to code and execute it may be more difficult for you to visualise. I think I have the values correct I overlaid the two outputs and they look the same to me.
The polygon is a list of co-ordinates to draw out a flat shape that describes the cross section profile of one half of your finished set of cylinders complete with holes. This is then rotated about the z axis through 360 to create the finished object.
Note the final [0,0] point is not strictly necessary, it is not shown in the examples, and the code works without it, but I just like to close out shapes..
I use this method to create the various bezel cross section shapes for my dial instruments, I then use translate to push the profile away from the z axis before rotate_extrude to create the hole for the glass to go in the middle.
Cheers
Bob C
On 4 Mar 2022, at 16:59, nop head nop.head@gmail.com wrote:
In general it is wise to overlap unioned shapes, especially in 3D. In your case all the heights look like they can be represented exactly in floating point fractions, so you probably get away without it.
On Fri, 4 Mar 2022 at 16:26, Hendrik <blindguydiy@gmail.com mailto:blindguydiy@gmail.com> wrote:
The reason why I looked at doing it that way, it means that it is one solid part and problems with correctly union where small spaces can appear is excluded. So just was wondering if it could be done like that. On the other hand say I stack all the different cylinders is it safer to include a esp=0.01 or something like that to make sure no spaces appear. Could it do any harm in including the esp or could it be just a safety net.
Sent from Mail https://go.microsoft.com/fwlink/?LinkId=550986 for Windows
From: Michael Möller mailto:private2michael@gmail.com
Sent: Friday, 04 March 2022 17:48
To: OpenSCAD general discussion mailto:discuss@lists.openscad.org
Subject: [OpenSCAD] Re: nested difference to subtract from solid
If I understand your question correctly, you pose a possible construction technique, give an example, and ask if it works.
What happens when you run that code?
(Yeah, I tried your example, it has a simple typo, and in preview you get Z-fighting, which is easily fixable by making the subtraction cylinders slightly larger)
Or are you asking something else?
Michael, fra mobilen
fre. 4. mar. 2022 16.30 skrev Hendrik <blindguydiy@gmail.com mailto:blindguydiy@gmail.com>:
Hi
Can anyone tell me rather then building a long cylinder with different diameters and stacking them on top of each other if a person can do rather create a long cylinder and use nested difference() to keep the cylinder solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail https://go.microsoft.com/fwlink/?LinkId=550986 for Windows
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org mailto:discuss-leave@lists.openscad.org
OpenSCAD mailing list
To unsubscribe send an email to discuss-leave@lists.openscad.org
Sent from Mail for Windows
From: Bob Carter
Sent: Friday, 04 March 2022 19:35
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: nested difference to subtract from solid
Hendrik,
nop.head’s alternative is this,
rotate_extrude($fn=100)
polygon(points=
[[0,0],
[4,0],
[4,2],
[3.5,2],
[3.5,3.5],
[4,3.5],
[4,8.5],
[3.5,8.5],
[3.5,10],
[11,10],
[11,12],
[8,12],
[8,40],
[6,40],
[6,12],
[0,12],
[0,0]]
);
Whilst this is simpler to code and execute it may be more difficult for you to visualise. I think I have the values correct I overlaid the two outputs and they look the same to me.
The polygon is a list of co-ordinates to draw out a flat shape that describes the cross section profile of one half of your finished set of cylinders complete with holes. This is then rotated about the z axis through 360 to create the finished object.
Note the final [0,0] point is not strictly necessary, it is not shown in the examples, and the code works without it, but I just like to close out shapes..
I use this method to create the various bezel cross section shapes for my dial instruments, I then use translate to push the profile away from the z axis before rotate_extrude to create the hole for the glass to go in the middle.
Cheers
Bob C
On 4 Mar 2022, at 16:59, nop head <nop.head@gmail.com> wrote:
In general it is wise to overlap unioned shapes, especially in 3D. In your case all the heights look like they can be represented exactly in floating point fractions, so you probably get away without it.
On Fri, 4 Mar 2022 at 16:26, Hendrik <blindguydiy@gmail.com> wrote:
The reason why I looked at doing it that way, it means that it is one solid part and problems with correctly union where small spaces can appear is excluded. So just was wondering if it could be done like that. On the other hand say I stack all the different cylinders is it safer to include a esp=0.01 or something like that to make sure no spaces appear. Could it do any harm in including the esp or could it be just a safety net.
Sent from Mail for Windows
From: Michael Möller
Sent: Friday, 04 March 2022 17:48
To: OpenSCAD general discussion
Subject: [OpenSCAD] Re: nested difference to subtract from solidIf I understand your question correctly, you pose a possible construction technique, give an example, and ask if it works.
What happens when *you* run that code?
(Yeah, I tried your example, it has a simple typo, and in preview you get Z-fighting, which is easily fixable by making the subtraction cylinders slightly larger)
Or are you asking something else?
Michael, fra mobilen
fre. 4. mar. 2022 16.30 skrev Hendrik <blindguydiy@gmail.com>:
Hi
Can anyone tell me rather then building a long cylinder with different diameters and stacking them on top of each other if a person can do rather create a long cylinder and use nested difference() to keep the cylinder solid and only take away the different diameters. For example.
difference() {
cylinder(d=22, h=40, $fn=100);
difference() {
cylinder(d=22, h=2, $fn=100);
cylinder(d=8, h=4, $fn=100);
}
difference() {
translate([0,0,2]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,1]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,3.5]) cylinder(d=22, h=5, $fn=100);
translate([0,0,2.5]) cylinder(d=8, h=7, $fn=100);
}
difference() {
translate([0,0,8.5]) cylinder(d=22, h=1.5, $fn=100);
translate([0,0,7.5]) cylinder(d=7, h=3.5, $fn=100);
}
difference() {
translate([0,0,12]) cylinder(d=22, h=28, $fn=100);
translate([0,0,11]) cylinder(d=16, h=30, $fn=100);
}
translate([0,0,15]) cylinder(d=12, 26, $fn=100););
}
Sent from Mail for Windows
_______________________________________________
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
On Fri, Mar 04, 2022 at 04:59:16PM +0000, nop head wrote:
In general it is wise to overlap unioned shapes, especially in 3D. In your
case all the heights look like they can be represented exactly in floating
point fractions, so you probably get away without it.
In general you don't usually want such "fragile" code. Fragile means
that a "should be independent" change impacts/breaks code you didn't touch.
In this case, moving everything up by say 0.1mm will cause the floating
point representations to be endlessly repeating, the roundoff can then cause
a small gap or an overlap.
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.