I'm having a problem using difference() with an object I created with
linear_extrude(). The extruded shape is different and wrong when it is used
in difference() than when it isn't used in difference(). The example code
extrudes a rectangle with twist. When it is extruded by itself, the shape is
correct. When the extruded shape is subtracted from a cube using
difference(), the shape is incorrect. The sides are jagged and the top is
too narrow in the middle. I'm using OpenSCAD 2019.05 on Windows 10.
Example images: top_view.JPG
http://forum.openscad.org/file/t1635/top_view.JPG side_view.JPG
http://forum.openscad.org/file/t1635/side_view.JPG
Example code:
/*
Problem: the extruded shape is different when it is used
in difference() than when it isn't used in difference()
*/
difference() {
translate([-10, -10, 0])
cube([20, 20, 20]);
extrude_it();
}
translate([21, 0, 0])
extrude_it();
module extrude_it() {
linear_extrude(21, twist=45, slices=10, convexity=3)
square([1, 30], center=true);
}
--
Sent from: http://forum.openscad.org/
If you look at the thrown together view you will see this.
[image: image.png]
The section is so twisted compared to the number of slices it
self intersects and the purple bits are inside out. If you increase the
slices to 100 it looks OK.
[image: image.png]
On Tue, 18 Aug 2020 at 16:00, jamcultur nyponen@gmail.com wrote:
I'm having a problem using difference() with an object I created with
linear_extrude(). The extruded shape is different and wrong when it is used
in difference() than when it isn't used in difference(). The example code
extrudes a rectangle with twist. When it is extruded by itself, the shape
is
correct. When the extruded shape is subtracted from a cube using
difference(), the shape is incorrect. The sides are jagged and the top is
too narrow in the middle. I'm using OpenSCAD 2019.05 on Windows 10.
Example images: top_view.JPG
http://forum.openscad.org/file/t1635/top_view.JPG side_view.JPG
http://forum.openscad.org/file/t1635/side_view.JPG
Example code:
/*
Problem: the extruded shape is different when it is used
in difference() than when it isn't used in difference()
*/
difference() {
translate([-10, -10, 0])
cube([20, 20, 20]);
extrude_it();
}
translate([21, 0, 0])
extrude_it();
module extrude_it() {
linear_extrude(21, twist=45, slices=10, convexity=3)
square([1, 30], center=true);
}
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
I tried increasing slices to 100 and 200. There are no inside out bits, but
the edges are still jagged which they shouldn't be. You can see it when you
zoom in.
--
Sent from: http://forum.openscad.org/
Well everything is jagged in OpenSCAD, there are no curves. The twisted
shape has facets made of two triangles at an angle, that give it a rippled
surface. If you zoom you can see the ripples and that gives the jagged edge
when subtracted.
There is nothing wrong with difference().
On Tue, 18 Aug 2020 at 16:35, jamcultur nyponen@gmail.com wrote:
I tried increasing slices to 100 and 200. There are no inside out bits, but
the edges are still jagged which they shouldn't be. You can see it when you
zoom in.
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
When I extrude the shape outside of difference(), the shape is correct. When
I extrude the shape inside of difference() the shape is different and
incorrect. It has zig-zag edges, unlike the shape outside of difference().
--
Sent from: http://forum.openscad.org/
The shape does have z-zag edges. This is what it looks like away from the
edges when zoomed in.
[image: image.png]
The shape is larger than the block so it cuts away from its edges, where it
is smoother.
On Tue, 18 Aug 2020 at 20:26, jamcultur nyponen@gmail.com wrote:
When I extrude the shape outside of difference(), the shape is correct.
When
I extrude the shape inside of difference() the shape is different and
incorrect. It has zig-zag edges, unlike the shape outside of difference().
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Hi,
As a test, try changing your difference command to an intersection. Then
look at the edges of your curved shape. That will help you see what is
going on.
A workaround for the situation is to increase the number of extrusion
layers until the zigzags are so small that they don't matter.
Cheers,
Steve
On 2020-08-18 12:25 p.m., jamcultur wrote:
When I extrude the shape outside of difference(), the shape is correct. When
I extrude the shape inside of difference() the shape is different and
incorrect. It has zig-zag edges, unlike the shape outside of difference().
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
The issue is in the linear_extrude with twist.
Try this:
difference() {
translate([-10, -10, 0])
cube([20, 20, 20]);
extrude_it();
}
translate([21, 0, 0])
extrude_it();
module extrude_it() {
linear_extrude(21, twist=45, slices=10, convexity=3)
square2([1, 30], center=true);
}
module square2(size,center) {
union(){
for(i=[0:size[1]])
translate([0,i-size[1]/2])
square(size[0](1+i1e-4),center=true);
}
}
The refinement of the square "corrects" the twist issue.
Em ter., 18 de ago. de 2020 às 20:26, jamcultur nyponen@gmail.com
escreveu:
When I extrude the shape outside of difference(), the shape is correct.
When
I extrude the shape inside of difference() the shape is different and
incorrect. It has zig-zag edges, unlike the shape outside of difference().
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Ronaldo wrote
The issue is in the linear_extrude with twist.
Try this:
...
That is a big improvement. Thank you for the helpful response!
--
Sent from: http://forum.openscad.org/
The refinement of the polygon to be extruded should insert noncollinear
points otherwise the primitive polygon or linear_extrude will discard them.
Em ter., 18 de ago. de 2020 às 21:52, jamcultur nyponen@gmail.com
escreveu:
Ronaldo wrote
The issue is in the linear_extrude with twist.
Try this:
...
That is a big improvement. Thank you for the helpful response!
--
Sent from: http://forum.openscad.org/
OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org