Nabble has removed Mailing-list integration.
Posts created here DO NOT GET SENT TO THE MAILING LIST.
Mailing-list emails DO NOT GET POSTED TO THE FORUM.
So basically the Forum is now out of date, we are looking into migrating the history.
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 [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
If you look at the thrown together view you will see this. ![]() 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. ![]() On Tue, 18 Aug 2020 at 16:00, jamcultur <[hidden email]> wrote: I'm having a problem using difference() with an object I created with _______________________________________________ OpenSCAD mailing list [hidden email] 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/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.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 <[hidden email]> wrote: I tried increasing slices to 100 and 200. There are no inside out bits, but _______________________________________________ OpenSCAD mailing list [hidden email] 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/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
The shape does have z-zag edges. This is what it looks like away from the edges when zoomed in. ![]() 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 <[hidden email]> wrote: When I extrude the shape outside of difference(), the shape is correct. When _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by jamcultur
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 > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by jamcultur
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+i*1e-4),center=true); } } The refinement of the square "corrects" the twist issue. Em ter., 18 de ago. de 2020 às 20:26, jamcultur <[hidden email]> escreveu: When I extrude the shape outside of difference(), the shape is correct. When _______________________________________________ OpenSCAD mailing list [hidden email] 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/ _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.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 <[hidden email]> escreveu: Ronaldo wrote _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
In reply to this post by nophead
On Tue, Aug 18, 2020 at 05:04:15PM +0100, nop head wrote:
> 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. WELL...... For example this: difference () { linear_extrude (height=10, twist=360, convexity = 10,$fn=20) square ([10,10]); translate ([0,0,-1]) cube (14.2); } clearly shows a jagged edge near the Z-axis. (those elswhere: I haven't investigated) Now, normally with say "cylinder" or "sphere" you can increase $fn and get the model to match more closely to the expected mathematical shape. Here you can increase $fn too and.... That doesn't help. The issue is that the inside edge of the square (the edge that starts out on the X axis.) is multiplied into two triangles at each slice. Both of these triangles are "skinny". One has a base (smallest edge) near the Z axis of about 10mm/$fn and the other is a triangle with base 2*pi*10mm. The first triangle is completely vertical. The other is at an angle of about atan (1/(2*pi)) . So these meet at an angle close to 90 degrees. It doesn't matter how fine you make the slices: These triangles keep meeting at that angle. When you approximate a sphere with more and more triangular patches, the angle between the patches approaches: "flat". So the curved nature of the object is better approximated the more triangles you use. But here increasing the number of triangles does not help. IMHO, an extra $fa or something should be added to linear_extrude. When the angle between such a pair of triangles exceeds $fa, then the triangles should be split.until the angles become less than $fa. So in my example, the first, half-way split would give us FOUR triangles, One of them still vertical on the Z axis, but now the other triangle touching the Z axis with its tip is already at atan (1/pi) a much bigger angle, closer to vertical... If in my example, you replace the square with this almost-square: polygon ([[0,0], [10,0],[10,10], [0,10], [0.001,5],[0.0011,2.5],[0.001,1.25], [0.0011,0.625] ]); the desired mathematical shape is already approximated a lot more closely. it would be useful and "complete" for the openscad language if the language would support something that allows a user to specify how accurate to approximate the mathematical object. (Note that i've fixed one side, not the other, so you can compare the results in one object.). When you move the square a bit to the -x direction, you'll get much more pronounced spikes that the TS is also seeing. These artefacts make some objects difficult to 3D print. They also end up having a lousy fit... Roger. > > There is nothing wrong with difference(). > > On Tue, 18 Aug 2020 at 16:35, jamcultur <[hidden email]> 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 > > [hidden email] > > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org > > > _______________________________________________ > OpenSCAD mailing list > [hidden email] > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- ** [hidden email] ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** The plan was simple, like my brother-in-law Phil. But unlike Phil, this plan just might work. _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Excellent research (even if I am away from my machine, and find it very hard to follow without trying it) and a very patient reply.
Cheers, RobW On 19 August 2020 7:56:43 am AEST, Rogier Wolff <[hidden email]> wrote: On Tue, Aug 18, 2020 at 05:04:15PM +0100, nop head wrote:Well everything is jagged in OpenSCAD, there are no curves. The twisted _______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Rob W
Lake Tyers Beach, Victoria, Australia |
Since its come up before, I decided to open an issue on github regarding how to fix these jagged edges (without requiring user workarounds): https://github.com/openscad/openscad/issues/3411 On Tue, Aug 18, 2020 at 6:28 PM Rob Ward <[hidden email]> wrote:
_______________________________________________ OpenSCAD mailing list [hidden email] http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org |
Free forum by Nabble | Edit this page |