Userspace polygon issues

classic Classic list List threaded Threaded
19 messages Options
Reply | Threaded
Open this post in threaded view
|

Userspace polygon issues

acwest
Due to issues I have had with CGAL generated shapes forming
non-manifold STL files, making them difficult to import into other
tools, I have been focusing on doing as much of my design as possible
in userspace, generating 3D polyhedrons. This has been a lot of work
due to limited support in the codebase, particularly as I am limited
to running in the 2015 version. It would definitely be nice to have
some 3d union, difference, and intersection functions for polyhedrons,
but up until now I have been making do.
I am having a couple of problems with this approach. One of these is
that the internal code-base does not always seem to be able to handle
userspace polygons properly. For example, I have a complex shape which
is totally manifold, forms a single object, and renders perfectly, if
I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
properly mirrored, but if I display both the original shape and the
mirrored one, the show properly in the preview but either go
non-manifold or vanish entirely when rendered.
I also have issues when trying to union my shape with other shapes, it
always works fine in preview, but when I render, it may work, or it
may give an assertion failure and leave my shape out of the final
rendering. Actually, in the example I am including a screenshot of,
there was no error or warning at all when it rendered, it just removed
my shape...
Does anybody have any suggestions on what I can do to work around
this? There are shapes that would be REALLY annoying for my to do in
userspace, but if I can't find a workaround or solution for this, I am
going to have to do so...

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

duct_with_mirror_preview.png (982K) Download Attachment
duct_with_mirror_render.png (829K) Download Attachment
mirror_render.png (896K) Download Attachment
mirror_preview.png (909K) Download Attachment
duct_render.png (899K) Download Attachment
duct_preview.png (913K) Download Attachment
duct_union_preview.png (920K) Download Attachment
duct_union_render.png (826K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

nophead
2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.

Another tip is to clear the cache before F6. Preview can cache corrupted meshes.

When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.

On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
Due to issues I have had with CGAL generated shapes forming
non-manifold STL files, making them difficult to import into other
tools, I have been focusing on doing as much of my design as possible
in userspace, generating 3D polyhedrons. This has been a lot of work
due to limited support in the codebase, particularly as I am limited
to running in the 2015 version. It would definitely be nice to have
some 3d union, difference, and intersection functions for polyhedrons,
but up until now I have been making do.
I am having a couple of problems with this approach. One of these is
that the internal code-base does not always seem to be able to handle
userspace polygons properly. For example, I have a complex shape which
is totally manifold, forms a single object, and renders perfectly, if
I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
properly mirrored, but if I display both the original shape and the
mirrored one, the show properly in the preview but either go
non-manifold or vanish entirely when rendered.
I also have issues when trying to union my shape with other shapes, it
always works fine in preview, but when I render, it may work, or it
may give an assertion failure and leave my shape out of the final
rendering. Actually, in the example I am including a screenshot of,
there was no error or warning at all when it rendered, it just removed
my shape...
Does anybody have any suggestions on what I can do to work around
this? There are shapes that would be REALLY annoying for my to do in
userspace, but if I can't find a workaround or solution for this, I am
going to have to do so...
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
Oddly enough, even if the two shapes have no overlap at all, by even a
significant margin, I can't get them to render properly. I have tried
with a large visible gap between the two parts, and it still discard
the polyhedron, which is definitely valid.

On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:

>
> 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>
> Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>
> When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>
> On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>>
>> Due to issues I have had with CGAL generated shapes forming
>> non-manifold STL files, making them difficult to import into other
>> tools, I have been focusing on doing as much of my design as possible
>> in userspace, generating 3D polyhedrons. This has been a lot of work
>> due to limited support in the codebase, particularly as I am limited
>> to running in the 2015 version. It would definitely be nice to have
>> some 3d union, difference, and intersection functions for polyhedrons,
>> but up until now I have been making do.
>> I am having a couple of problems with this approach. One of these is
>> that the internal code-base does not always seem to be able to handle
>> userspace polygons properly. For example, I have a complex shape which
>> is totally manifold, forms a single object, and renders perfectly, if
>> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> properly mirrored, but if I display both the original shape and the
>> mirrored one, the show properly in the preview but either go
>> non-manifold or vanish entirely when rendered.
>> I also have issues when trying to union my shape with other shapes, it
>> always works fine in preview, but when I render, it may work, or it
>> may give an assertion failure and leave my shape out of the final
>> rendering. Actually, in the example I am including a screenshot of,
>> there was no error or warning at all when it rendered, it just removed
>> my shape...
>> Does anybody have any suggestions on what I can do to work around
>> this? There are shapes that would be REALLY annoying for my to do in
>> userspace, but if I can't find a workaround or solution for this, I am
>> going to have to do so...
>> _______________________________________________
>> 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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
In reply to this post by nophead
While I have been limiting myself to the most recent release version
(2015???), I decided to try the most recent RC4 version, so see if
things are improved. Unfortunately, it is totally unusable for me, as
the code generated thousands of warnings for:
WARNING: len() parameter could not be converted, in file
../util/util.scad, line 21
The length checks it is warning about are part of my type checking
functions. Is there any way to reduce the warning level? I understand
the reason for the warnings, but it makes it VERY difficult to work
with the same code in multiple versions of the software, and I will
have to rewrite significant parts of my library to use functionality
that doesn't exist in the older version of openSCAD

On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:

>
> 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>
> Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>
> When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>
> On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>>
>> Due to issues I have had with CGAL generated shapes forming
>> non-manifold STL files, making them difficult to import into other
>> tools, I have been focusing on doing as much of my design as possible
>> in userspace, generating 3D polyhedrons. This has been a lot of work
>> due to limited support in the codebase, particularly as I am limited
>> to running in the 2015 version. It would definitely be nice to have
>> some 3d union, difference, and intersection functions for polyhedrons,
>> but up until now I have been making do.
>> I am having a couple of problems with this approach. One of these is
>> that the internal code-base does not always seem to be able to handle
>> userspace polygons properly. For example, I have a complex shape which
>> is totally manifold, forms a single object, and renders perfectly, if
>> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> properly mirrored, but if I display both the original shape and the
>> mirrored one, the show properly in the preview but either go
>> non-manifold or vanish entirely when rendered.
>> I also have issues when trying to union my shape with other shapes, it
>> always works fine in preview, but when I render, it may work, or it
>> may give an assertion failure and leave my shape out of the final
>> rendering. Actually, in the example I am including a screenshot of,
>> there was no error or warning at all when it rendered, it just removed
>> my shape...
>> Does anybody have any suggestions on what I can do to work around
>> this? There are shapes that would be REALLY annoying for my to do in
>> userspace, but if I can't find a workaround or solution for this, I am
>> going to have to do so...
>> _______________________________________________
>> 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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

nophead
Yes len should never have been changed. It is a total pain. You have to use is_list to check it is a list first even though it is documented to return undef for a scalar.


Unless this is reverted it will lead to a wall of complaints and slow adoption of the new release.

On Wed, 17 Apr 2019, 12:25 A. Craig West, <[hidden email]> wrote:
While I have been limiting myself to the most recent release version
(2015???), I decided to try the most recent RC4 version, so see if
things are improved. Unfortunately, it is totally unusable for me, as
the code generated thousands of warnings for:
WARNING: len() parameter could not be converted, in file
../util/util.scad, line 21
The length checks it is warning about are part of my type checking
functions. Is there any way to reduce the warning level? I understand
the reason for the warnings, but it makes it VERY difficult to work
with the same code in multiple versions of the software, and I will
have to rewrite significant parts of my library to use functionality
that doesn't exist in the older version of openSCAD

On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
>
> 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>
> Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>
> When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>
> On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>>
>> Due to issues I have had with CGAL generated shapes forming
>> non-manifold STL files, making them difficult to import into other
>> tools, I have been focusing on doing as much of my design as possible
>> in userspace, generating 3D polyhedrons. This has been a lot of work
>> due to limited support in the codebase, particularly as I am limited
>> to running in the 2015 version. It would definitely be nice to have
>> some 3d union, difference, and intersection functions for polyhedrons,
>> but up until now I have been making do.
>> I am having a couple of problems with this approach. One of these is
>> that the internal code-base does not always seem to be able to handle
>> userspace polygons properly. For example, I have a complex shape which
>> is totally manifold, forms a single object, and renders perfectly, if
>> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> properly mirrored, but if I display both the original shape and the
>> mirrored one, the show properly in the preview but either go
>> non-manifold or vanish entirely when rendered.
>> I also have issues when trying to union my shape with other shapes, it
>> always works fine in preview, but when I render, it may work, or it
>> may give an assertion failure and leave my shape out of the final
>> rendering. Actually, in the example I am including a screenshot of,
>> there was no error or warning at all when it rendered, it just removed
>> my shape...
>> Does anybody have any suggestions on what I can do to work around
>> this? There are shapes that would be REALLY annoying for my to do in
>> userspace, but if I can't find a workaround or solution for this, I am
>> going to have to do so...
>> _______________________________________________
>> 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

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
In my case I am using it as part of an isArray function definition, so it shouldn't be too painful. It's a VERY common idiom, and warni. Gs seem to cause a lot of overhead in the ui. My hode, which normally renders in around a minute, was well running for much longer than that with no sign of completion due to all of the warnings

On Wed, 17 Apr 2019, 07:43 nop head, <[hidden email]> wrote:
Yes len should never have been changed. It is a total pain. You have to use is_list to check it is a list first even though it is documented to return undef for a scalar.


Unless this is reverted it will lead to a wall of complaints and slow adoption of the new release.

On Wed, 17 Apr 2019, 12:25 A. Craig West, <[hidden email]> wrote:
While I have been limiting myself to the most recent release version
(2015???), I decided to try the most recent RC4 version, so see if
things are improved. Unfortunately, it is totally unusable for me, as
the code generated thousands of warnings for:
WARNING: len() parameter could not be converted, in file
../util/util.scad, line 21
The length checks it is warning about are part of my type checking
functions. Is there any way to reduce the warning level? I understand
the reason for the warnings, but it makes it VERY difficult to work
with the same code in multiple versions of the software, and I will
have to rewrite significant parts of my library to use functionality
that doesn't exist in the older version of openSCAD

On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
>
> 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>
> Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>
> When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>
> On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>>
>> Due to issues I have had with CGAL generated shapes forming
>> non-manifold STL files, making them difficult to import into other
>> tools, I have been focusing on doing as much of my design as possible
>> in userspace, generating 3D polyhedrons. This has been a lot of work
>> due to limited support in the codebase, particularly as I am limited
>> to running in the 2015 version. It would definitely be nice to have
>> some 3d union, difference, and intersection functions for polyhedrons,
>> but up until now I have been making do.
>> I am having a couple of problems with this approach. One of these is
>> that the internal code-base does not always seem to be able to handle
>> userspace polygons properly. For example, I have a complex shape which
>> is totally manifold, forms a single object, and renders perfectly, if
>> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> properly mirrored, but if I display both the original shape and the
>> mirrored one, the show properly in the preview but either go
>> non-manifold or vanish entirely when rendered.
>> I also have issues when trying to union my shape with other shapes, it
>> always works fine in preview, but when I render, it may work, or it
>> may give an assertion failure and leave my shape out of the final
>> rendering. Actually, in the example I am including a screenshot of,
>> there was no error or warning at all when it rendered, it just removed
>> my shape...
>> Does anybody have any suggestions on what I can do to work around
>> this? There are shapes that would be REALLY annoying for my to do in
>> userspace, but if I can't find a workaround or solution for this, I am
>> going to have to do so...
>> _______________________________________________
>> 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

_______________________________________________
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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

nophead
@kintel please can we have len reverted to match it's long documented spec

On Wed, 17 Apr 2019, 13:25 A. Craig West, <[hidden email]> wrote:
In my case I am using it as part of an isArray function definition, so it shouldn't be too painful. It's a VERY common idiom, and warni. Gs seem to cause a lot of overhead in the ui. My hode, which normally renders in around a minute, was well running for much longer than that with no sign of completion due to all of the warnings

On Wed, 17 Apr 2019, 07:43 nop head, <[hidden email]> wrote:
Yes len should never have been changed. It is a total pain. You have to use is_list to check it is a list first even though it is documented to return undef for a scalar.


Unless this is reverted it will lead to a wall of complaints and slow adoption of the new release.

On Wed, 17 Apr 2019, 12:25 A. Craig West, <[hidden email]> wrote:
While I have been limiting myself to the most recent release version
(2015???), I decided to try the most recent RC4 version, so see if
things are improved. Unfortunately, it is totally unusable for me, as
the code generated thousands of warnings for:
WARNING: len() parameter could not be converted, in file
../util/util.scad, line 21
The length checks it is warning about are part of my type checking
functions. Is there any way to reduce the warning level? I understand
the reason for the warnings, but it makes it VERY difficult to work
with the same code in multiple versions of the software, and I will
have to rewrite significant parts of my library to use functionality
that doesn't exist in the older version of openSCAD

On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
>
> 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>
> Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>
> When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>
> On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>>
>> Due to issues I have had with CGAL generated shapes forming
>> non-manifold STL files, making them difficult to import into other
>> tools, I have been focusing on doing as much of my design as possible
>> in userspace, generating 3D polyhedrons. This has been a lot of work
>> due to limited support in the codebase, particularly as I am limited
>> to running in the 2015 version. It would definitely be nice to have
>> some 3d union, difference, and intersection functions for polyhedrons,
>> but up until now I have been making do.
>> I am having a couple of problems with this approach. One of these is
>> that the internal code-base does not always seem to be able to handle
>> userspace polygons properly. For example, I have a complex shape which
>> is totally manifold, forms a single object, and renders perfectly, if
>> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> properly mirrored, but if I display both the original shape and the
>> mirrored one, the show properly in the preview but either go
>> non-manifold or vanish entirely when rendered.
>> I also have issues when trying to union my shape with other shapes, it
>> always works fine in preview, but when I render, it may work, or it
>> may give an assertion failure and leave my shape out of the final
>> rendering. Actually, in the example I am including a screenshot of,
>> there was no error or warning at all when it rendered, it just removed
>> my shape...
>> Does anybody have any suggestions on what I can do to work around
>> this? There are shapes that would be REALLY annoying for my to do in
>> userspace, but if I can't find a workaround or solution for this, I am
>> going to have to do so...
>> _______________________________________________
>> 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

_______________________________________________
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
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
The discussion of this in the archives is rather extensive, I really don't see what is gained by the check. If the user wasn't expecting the documented behaviour, they will get an undef warning in any case

On Wed, 17 Apr 2019, 08:37 nop head, <[hidden email]> wrote:
@kintel please can we have len reverted to match it's long documented spec

On Wed, 17 Apr 2019, 13:25 A. Craig West, <[hidden email]> wrote:
In my case I am using it as part of an isArray function definition, so it shouldn't be too painful. It's a VERY common idiom, and warni. Gs seem to cause a lot of overhead in the ui. My hode, which normally renders in around a minute, was well running for much longer than that with no sign of completion due to all of the warnings

On Wed, 17 Apr 2019, 07:43 nop head, <[hidden email]> wrote:
Yes len should never have been changed. It is a total pain. You have to use is_list to check it is a list first even though it is documented to return undef for a scalar.


Unless this is reverted it will lead to a wall of complaints and slow adoption of the new release.

On Wed, 17 Apr 2019, 12:25 A. Craig West, <[hidden email]> wrote:
While I have been limiting myself to the most recent release version
(2015???), I decided to try the most recent RC4 version, so see if
things are improved. Unfortunately, it is totally unusable for me, as
the code generated thousands of warnings for:
WARNING: len() parameter could not be converted, in file
../util/util.scad, line 21
The length checks it is warning about are part of my type checking
functions. Is there any way to reduce the warning level? I understand
the reason for the warnings, but it makes it VERY difficult to work
with the same code in multiple versions of the software, and I will
have to rewrite significant parts of my library to use functionality
that doesn't exist in the older version of openSCAD

On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
>
> 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>
> Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>
> When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>
> On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>>
>> Due to issues I have had with CGAL generated shapes forming
>> non-manifold STL files, making them difficult to import into other
>> tools, I have been focusing on doing as much of my design as possible
>> in userspace, generating 3D polyhedrons. This has been a lot of work
>> due to limited support in the codebase, particularly as I am limited
>> to running in the 2015 version. It would definitely be nice to have
>> some 3d union, difference, and intersection functions for polyhedrons,
>> but up until now I have been making do.
>> I am having a couple of problems with this approach. One of these is
>> that the internal code-base does not always seem to be able to handle
>> userspace polygons properly. For example, I have a complex shape which
>> is totally manifold, forms a single object, and renders perfectly, if
>> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> properly mirrored, but if I display both the original shape and the
>> mirrored one, the show properly in the preview but either go
>> non-manifold or vanish entirely when rendered.
>> I also have issues when trying to union my shape with other shapes, it
>> always works fine in preview, but when I render, it may work, or it
>> may give an assertion failure and leave my shape out of the final
>> rendering. Actually, in the example I am including a screenshot of,
>> there was no error or warning at all when it rendered, it just removed
>> my shape...
>> Does anybody have any suggestions on what I can do to work around
>> this? There are shapes that would be REALLY annoying for my to do in
>> userspace, but if I can't find a workaround or solution for this, I am
>> going to have to do so...
>> _______________________________________________
>> 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

_______________________________________________
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
_______________________________________________
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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

nophead
Exactly. And the only workarounds make code longer, which cannot be progress.

On Wed, 17 Apr 2019, 14:29 A. Craig West, <[hidden email]> wrote:
The discussion of this in the archives is rather extensive, I really don't see what is gained by the check. If the user wasn't expecting the documented behaviour, they will get an undef warning in any case

On Wed, 17 Apr 2019, 08:37 nop head, <[hidden email]> wrote:
@kintel please can we have len reverted to match it's long documented spec

On Wed, 17 Apr 2019, 13:25 A. Craig West, <[hidden email]> wrote:
In my case I am using it as part of an isArray function definition, so it shouldn't be too painful. It's a VERY common idiom, and warni. Gs seem to cause a lot of overhead in the ui. My hode, which normally renders in around a minute, was well running for much longer than that with no sign of completion due to all of the warnings

On Wed, 17 Apr 2019, 07:43 nop head, <[hidden email]> wrote:
Yes len should never have been changed. It is a total pain. You have to use is_list to check it is a list first even though it is documented to return undef for a scalar.


Unless this is reverted it will lead to a wall of complaints and slow adoption of the new release.

On Wed, 17 Apr 2019, 12:25 A. Craig West, <[hidden email]> wrote:
While I have been limiting myself to the most recent release version
(2015???), I decided to try the most recent RC4 version, so see if
things are improved. Unfortunately, it is totally unusable for me, as
the code generated thousands of warnings for:
WARNING: len() parameter could not be converted, in file
../util/util.scad, line 21
The length checks it is warning about are part of my type checking
functions. Is there any way to reduce the warning level? I understand
the reason for the warnings, but it makes it VERY difficult to work
with the same code in multiple versions of the software, and I will
have to rewrite significant parts of my library to use functionality
that doesn't exist in the older version of openSCAD

On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
>
> 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>
> Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>
> When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>
> On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>>
>> Due to issues I have had with CGAL generated shapes forming
>> non-manifold STL files, making them difficult to import into other
>> tools, I have been focusing on doing as much of my design as possible
>> in userspace, generating 3D polyhedrons. This has been a lot of work
>> due to limited support in the codebase, particularly as I am limited
>> to running in the 2015 version. It would definitely be nice to have
>> some 3d union, difference, and intersection functions for polyhedrons,
>> but up until now I have been making do.
>> I am having a couple of problems with this approach. One of these is
>> that the internal code-base does not always seem to be able to handle
>> userspace polygons properly. For example, I have a complex shape which
>> is totally manifold, forms a single object, and renders perfectly, if
>> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> properly mirrored, but if I display both the original shape and the
>> mirrored one, the show properly in the preview but either go
>> non-manifold or vanish entirely when rendered.
>> I also have issues when trying to union my shape with other shapes, it
>> always works fine in preview, but when I render, it may work, or it
>> may give an assertion failure and leave my shape out of the final
>> rendering. Actually, in the example I am including a screenshot of,
>> there was no error or warning at all when it rendered, it just removed
>> my shape...
>> Does anybody have any suggestions on what I can do to work around
>> this? There are shapes that would be REALLY annoying for my to do in
>> userspace, but if I can't find a workaround or solution for this, I am
>> going to have to do so...
>> _______________________________________________
>> 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

_______________________________________________
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
_______________________________________________
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
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

Parkinbot
Since is_list() is not available in older OpenSCAD versions I ve changed my
codebase to use

mylist = 1;
mylist = [1];
echo(mylist[0] != undef);

This expression works down to 2015.



--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
My new solution for this is:
function is_undef(o) =
  undef == o;

function is_string(o) =
  o == undef || len(o) == undef ?
    false
  :
    len(str(o, o)) == len(o) * 2;

function is_list(o) =
  o == undef || is_string(o) ?
    false
  :
    len(o) != undef;

function is_bool(o) =
  (o == undef || is_string(o)) ?
    false
  :
    str(o) == "true" || str(o) == "false";

function is_num(o) =
  (o == undef || is_string(o) || is_list(o) || is_bool(o)) ?
    false
  :
    true;

I then have to comment out that part of the code if I am using a
recent version, or leave it uncommented in version 2015.

On Thu, Apr 18, 2019 at 3:38 AM Parkinbot <[hidden email]> wrote:

>
> Since is_list() is not available in older OpenSCAD versions I ve changed my
> codebase to use
>
> mylist = 1;
> mylist = [1];
> echo(mylist[0] != undef);
>
> This expression works down to 2015.
>
>
>
> --
> 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
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
In reply to this post by acwest
I am getting exactly the same issues in version 2019.01-RC4 (git 2a697e4)

I have screenshots showing the two objects I am trying to union, with
a gap of a full millimetre (or unit point, I suppose) between them.
There is no way that this is not a bug in how the cgal code is
working. At this point I have no way to workaround the issue, other
than moving the entire design into userspace, which seems somewhat
ridiculous.
I am also curious why rendered polyhedrons display differently in the
console output. Objects created normally display:
Top level object is a 3D object:
Simple: yes
Vertices: 286
Halfedges: 858
Edges: 429
Halffacets: 290
Facets: 145
Volumes: 2

while polyhedrons display:
Top level object is a 3D object:
Facets: 12

Never mind, That was the solution to my problem. I am sure I remember
the documentation for polyhedron saying that faces should be clockwise
when viewed from the inside outwards, but that certainly isn't what it
says now. I am going to reverse my faces, and that should fix
everything....

On Wed, Apr 17, 2019 at 7:19 AM A. Craig West <[hidden email]> wrote:

>
> Oddly enough, even if the two shapes have no overlap at all, by even a
> significant margin, I can't get them to render properly. I have tried
> with a large visible gap between the two parts, and it still discard
> the polyhedron, which is definitely valid.
>
> On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
> >
> > 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
> >
> > Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
> >
> > When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
> >
> > On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
> >>
> >> Due to issues I have had with CGAL generated shapes forming
> >> non-manifold STL files, making them difficult to import into other
> >> tools, I have been focusing on doing as much of my design as possible
> >> in userspace, generating 3D polyhedrons. This has been a lot of work
> >> due to limited support in the codebase, particularly as I am limited
> >> to running in the 2015 version. It would definitely be nice to have
> >> some 3d union, difference, and intersection functions for polyhedrons,
> >> but up until now I have been making do.
> >> I am having a couple of problems with this approach. One of these is
> >> that the internal code-base does not always seem to be able to handle
> >> userspace polygons properly. For example, I have a complex shape which
> >> is totally manifold, forms a single object, and renders perfectly, if
> >> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
> >> properly mirrored, but if I display both the original shape and the
> >> mirrored one, the show properly in the preview but either go
> >> non-manifold or vanish entirely when rendered.
> >> I also have issues when trying to union my shape with other shapes, it
> >> always works fine in preview, but when I render, it may work, or it
> >> may give an assertion failure and leave my shape out of the final
> >> rendering. Actually, in the example I am including a screenshot of,
> >> there was no error or warning at all when it rendered, it just removed
> >> my shape...
> >> Does anybody have any suggestions on what I can do to work around
> >> this? There are shapes that would be REALLY annoying for my to do in
> >> userspace, but if I can't find a workaround or solution for this, I am
> >> going to have to do so...
> >> _______________________________________________
> >> 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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

duct_separated_render.png (100K) Download Attachment
duct_separated_preview.png (145K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

nophead
If you don't get the Simple, Vertices, etc it means CGAL isn't involved at all. So yes it will display invalid polyhedra. If CGAL is used it will always complain and make the object disappear if there is anything wrong with it. But you only get the error message once and then the empty result is cached.

On Thu, 18 Apr 2019 at 14:23, A. Craig West <[hidden email]> wrote:
I am getting exactly the same issues in version 2019.01-RC4 (git 2a697e4)

I have screenshots showing the two objects I am trying to union, with
a gap of a full millimetre (or unit point, I suppose) between them.
There is no way that this is not a bug in how the cgal code is
working. At this point I have no way to workaround the issue, other
than moving the entire design into userspace, which seems somewhat
ridiculous.
I am also curious why rendered polyhedrons display differently in the
console output. Objects created normally display:
Top level object is a 3D object:
Simple: yes
Vertices: 286
Halfedges: 858
Edges: 429
Halffacets: 290
Facets: 145
Volumes: 2

while polyhedrons display:
Top level object is a 3D object:
Facets: 12

Never mind, That was the solution to my problem. I am sure I remember
the documentation for polyhedron saying that faces should be clockwise
when viewed from the inside outwards, but that certainly isn't what it
says now. I am going to reverse my faces, and that should fix
everything....

On Wed, Apr 17, 2019 at 7:19 AM A. Craig West <[hidden email]> wrote:
>
> Oddly enough, even if the two shapes have no overlap at all, by even a
> significant margin, I can't get them to render properly. I have tried
> with a large visible gap between the two parts, and it still discard
> the polyhedron, which is definitely valid.
>
> On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
> >
> > 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
> >
> > Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
> >
> > When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
> >
> > On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
> >>
> >> Due to issues I have had with CGAL generated shapes forming
> >> non-manifold STL files, making them difficult to import into other
> >> tools, I have been focusing on doing as much of my design as possible
> >> in userspace, generating 3D polyhedrons. This has been a lot of work
> >> due to limited support in the codebase, particularly as I am limited
> >> to running in the 2015 version. It would definitely be nice to have
> >> some 3d union, difference, and intersection functions for polyhedrons,
> >> but up until now I have been making do.
> >> I am having a couple of problems with this approach. One of these is
> >> that the internal code-base does not always seem to be able to handle
> >> userspace polygons properly. For example, I have a complex shape which
> >> is totally manifold, forms a single object, and renders perfectly, if
> >> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
> >> properly mirrored, but if I display both the original shape and the
> >> mirrored one, the show properly in the preview but either go
> >> non-manifold or vanish entirely when rendered.
> >> I also have issues when trying to union my shape with other shapes, it
> >> always works fine in preview, but when I render, it may work, or it
> >> may give an assertion failure and leave my shape out of the final
> >> rendering. Actually, in the example I am including a screenshot of,
> >> there was no error or warning at all when it rendered, it just removed
> >> my shape...
> >> Does anybody have any suggestions on what I can do to work around
> >> this? There are shapes that would be REALLY annoying for my to do in
> >> userspace, but if I can't find a workaround or solution for this, I am
> >> going to have to do so...
> >> _______________________________________________
> >> 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
_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
I was wrong about the inverted polyhedron, unfortunately. With some
testing I have determined that the documentation is correct that the
primary requirement is for all of the faces to be consistently
oriented. The difference in how it dispays seems to be based on how
many objects there are. A single polyhedron, no matter how complex,
renders with just a count of facets. if there are multiple objects, or
two objects that have been unioned into one, it gives the complete
list.
I have narrowed my problem down to one particular section of the
polyhedron (it is generated in multiple sections, but is manifold). If
this section is on it's own, it renders properly, but if a second
shape exists anywhere in space, CGAL fails with an error (this is in
the 2015 version, I wouldn't be surprised if the line numbers were
different in the later code):

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
violation! Expr: pe_prev->is_border() ||
!internal::Plane_constructor::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate()
File: /Users/kintel/code/OpenSCAD/openscad-2015.03-3/../libraries/install/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
Line: 251

On Thu, Apr 18, 2019 at 3:28 PM nop head <[hidden email]> wrote:

>
> If you don't get the Simple, Vertices, etc it means CGAL isn't involved at all. So yes it will display invalid polyhedra. If CGAL is used it will always complain and make the object disappear if there is anything wrong with it. But you only get the error message once and then the empty result is cached.
>
> On Thu, 18 Apr 2019 at 14:23, A. Craig West <[hidden email]> wrote:
>>
>> I am getting exactly the same issues in version 2019.01-RC4 (git 2a697e4)
>>
>> I have screenshots showing the two objects I am trying to union, with
>> a gap of a full millimetre (or unit point, I suppose) between them.
>> There is no way that this is not a bug in how the cgal code is
>> working. At this point I have no way to workaround the issue, other
>> than moving the entire design into userspace, which seems somewhat
>> ridiculous.
>> I am also curious why rendered polyhedrons display differently in the
>> console output. Objects created normally display:
>> Top level object is a 3D object:
>> Simple: yes
>> Vertices: 286
>> Halfedges: 858
>> Edges: 429
>> Halffacets: 290
>> Facets: 145
>> Volumes: 2
>>
>> while polyhedrons display:
>> Top level object is a 3D object:
>> Facets: 12
>>
>> Never mind, That was the solution to my problem. I am sure I remember
>> the documentation for polyhedron saying that faces should be clockwise
>> when viewed from the inside outwards, but that certainly isn't what it
>> says now. I am going to reverse my faces, and that should fix
>> everything....
>>
>> On Wed, Apr 17, 2019 at 7:19 AM A. Craig West <[hidden email]> wrote:
>> >
>> > Oddly enough, even if the two shapes have no overlap at all, by even a
>> > significant margin, I can't get them to render properly. I have tried
>> > with a large visible gap between the two parts, and it still discard
>> > the polyhedron, which is definitely valid.
>> >
>> > On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
>> > >
>> > > 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
>> > >
>> > > Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
>> > >
>> > > When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
>> > >
>> > > On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
>> > >>
>> > >> Due to issues I have had with CGAL generated shapes forming
>> > >> non-manifold STL files, making them difficult to import into other
>> > >> tools, I have been focusing on doing as much of my design as possible
>> > >> in userspace, generating 3D polyhedrons. This has been a lot of work
>> > >> due to limited support in the codebase, particularly as I am limited
>> > >> to running in the 2015 version. It would definitely be nice to have
>> > >> some 3d union, difference, and intersection functions for polyhedrons,
>> > >> but up until now I have been making do.
>> > >> I am having a couple of problems with this approach. One of these is
>> > >> that the internal code-base does not always seem to be able to handle
>> > >> userspace polygons properly. For example, I have a complex shape which
>> > >> is totally manifold, forms a single object, and renders perfectly, if
>> > >> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
>> > >> properly mirrored, but if I display both the original shape and the
>> > >> mirrored one, the show properly in the preview but either go
>> > >> non-manifold or vanish entirely when rendered.
>> > >> I also have issues when trying to union my shape with other shapes, it
>> > >> always works fine in preview, but when I render, it may work, or it
>> > >> may give an assertion failure and leave my shape out of the final
>> > >> rendering. Actually, in the example I am including a screenshot of,
>> > >> there was no error or warning at all when it rendered, it just removed
>> > >> my shape...
>> > >> Does anybody have any suggestions on what I can do to work around
>> > >> this? There are shapes that would be REALLY annoying for my to do in
>> > >> userspace, but if I can't find a workaround or solution for this, I am
>> > >> going to have to do so...
>> > >> _______________________________________________
>> > >> 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
>> _______________________________________________
>> 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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
Well, I found the actual problem, and while the behaviour is a bit
inexplicable, it was easy to fix once I found it. There was a bug in
my polygon triangularisation code which would improperly split up a
polygon that had collinear sides, if it still formed a triangle.I
suspect it was turning it into a large triangle and a degenerate
triangle. This is definitely a bug in my code, but I haver no idea why
the cgal code was okay with it as long as it was part of the only
shape in the space, but not if there exists a second shape. Magic...

On Thu, Apr 18, 2019 at 4:03 PM A. Craig West <[hidden email]> wrote:

>
> I was wrong about the inverted polyhedron, unfortunately. With some
> testing I have determined that the documentation is correct that the
> primary requirement is for all of the faces to be consistently
> oriented. The difference in how it dispays seems to be based on how
> many objects there are. A single polyhedron, no matter how complex,
> renders with just a count of facets. if there are multiple objects, or
> two objects that have been unioned into one, it gives the complete
> list.
> I have narrowed my problem down to one particular section of the
> polyhedron (it is generated in multiple sections, but is manifold). If
> this section is on it's own, it renders properly, but if a second
> shape exists anywhere in space, CGAL fails with an error (this is in
> the 2015 version, I wouldn't be surprised if the line numbers were
> different in the later code):
>
> ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
> violation! Expr: pe_prev->is_border() ||
> !internal::Plane_constructor::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate()
> File: /Users/kintel/code/OpenSCAD/openscad-2015.03-3/../libraries/install/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
> Line: 251
>
> On Thu, Apr 18, 2019 at 3:28 PM nop head <[hidden email]> wrote:
> >
> > If you don't get the Simple, Vertices, etc it means CGAL isn't involved at all. So yes it will display invalid polyhedra. If CGAL is used it will always complain and make the object disappear if there is anything wrong with it. But you only get the error message once and then the empty result is cached.
> >
> > On Thu, 18 Apr 2019 at 14:23, A. Craig West <[hidden email]> wrote:
> >>
> >> I am getting exactly the same issues in version 2019.01-RC4 (git 2a697e4)
> >>
> >> I have screenshots showing the two objects I am trying to union, with
> >> a gap of a full millimetre (or unit point, I suppose) between them.
> >> There is no way that this is not a bug in how the cgal code is
> >> working. At this point I have no way to workaround the issue, other
> >> than moving the entire design into userspace, which seems somewhat
> >> ridiculous.
> >> I am also curious why rendered polyhedrons display differently in the
> >> console output. Objects created normally display:
> >> Top level object is a 3D object:
> >> Simple: yes
> >> Vertices: 286
> >> Halfedges: 858
> >> Edges: 429
> >> Halffacets: 290
> >> Facets: 145
> >> Volumes: 2
> >>
> >> while polyhedrons display:
> >> Top level object is a 3D object:
> >> Facets: 12
> >>
> >> Never mind, That was the solution to my problem. I am sure I remember
> >> the documentation for polyhedron saying that faces should be clockwise
> >> when viewed from the inside outwards, but that certainly isn't what it
> >> says now. I am going to reverse my faces, and that should fix
> >> everything....
> >>
> >> On Wed, Apr 17, 2019 at 7:19 AM A. Craig West <[hidden email]> wrote:
> >> >
> >> > Oddly enough, even if the two shapes have no overlap at all, by even a
> >> > significant margin, I can't get them to render properly. I have tried
> >> > with a large visible gap between the two parts, and it still discard
> >> > the polyhedron, which is definitely valid.
> >> >
> >> > On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
> >> > >
> >> > > 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
> >> > >
> >> > > Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
> >> > >
> >> > > When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
> >> > >
> >> > > On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
> >> > >>
> >> > >> Due to issues I have had with CGAL generated shapes forming
> >> > >> non-manifold STL files, making them difficult to import into other
> >> > >> tools, I have been focusing on doing as much of my design as possible
> >> > >> in userspace, generating 3D polyhedrons. This has been a lot of work
> >> > >> due to limited support in the codebase, particularly as I am limited
> >> > >> to running in the 2015 version. It would definitely be nice to have
> >> > >> some 3d union, difference, and intersection functions for polyhedrons,
> >> > >> but up until now I have been making do.
> >> > >> I am having a couple of problems with this approach. One of these is
> >> > >> that the internal code-base does not always seem to be able to handle
> >> > >> userspace polygons properly. For example, I have a complex shape which
> >> > >> is totally manifold, forms a single object, and renders perfectly, if
> >> > >> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
> >> > >> properly mirrored, but if I display both the original shape and the
> >> > >> mirrored one, the show properly in the preview but either go
> >> > >> non-manifold or vanish entirely when rendered.
> >> > >> I also have issues when trying to union my shape with other shapes, it
> >> > >> always works fine in preview, but when I render, it may work, or it
> >> > >> may give an assertion failure and leave my shape out of the final
> >> > >> rendering. Actually, in the example I am including a screenshot of,
> >> > >> there was no error or warning at all when it rendered, it just removed
> >> > >> my shape...
> >> > >> Does anybody have any suggestions on what I can do to work around
> >> > >> this? There are shapes that would be REALLY annoying for my to do in
> >> > >> userspace, but if I can't find a workaround or solution for this, I am
> >> > >> going to have to do so...
> >> > >> _______________________________________________
> >> > >> 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
> >> _______________________________________________
> >> 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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
I am going to have to debug the code, I think. It is still have
problems, although I thought it was okay.

On Thu, Apr 18, 2019 at 5:07 PM A. Craig West <[hidden email]> wrote:

>
> Well, I found the actual problem, and while the behaviour is a bit
> inexplicable, it was easy to fix once I found it. There was a bug in
> my polygon triangularisation code which would improperly split up a
> polygon that had collinear sides, if it still formed a triangle.I
> suspect it was turning it into a large triangle and a degenerate
> triangle. This is definitely a bug in my code, but I haver no idea why
> the cgal code was okay with it as long as it was part of the only
> shape in the space, but not if there exists a second shape. Magic...
>
> On Thu, Apr 18, 2019 at 4:03 PM A. Craig West <[hidden email]> wrote:
> >
> > I was wrong about the inverted polyhedron, unfortunately. With some
> > testing I have determined that the documentation is correct that the
> > primary requirement is for all of the faces to be consistently
> > oriented. The difference in how it dispays seems to be based on how
> > many objects there are. A single polyhedron, no matter how complex,
> > renders with just a count of facets. if there are multiple objects, or
> > two objects that have been unioned into one, it gives the complete
> > list.
> > I have narrowed my problem down to one particular section of the
> > polyhedron (it is generated in multiple sections, but is manifold). If
> > this section is on it's own, it renders properly, but if a second
> > shape exists anywhere in space, CGAL fails with an error (this is in
> > the 2015 version, I wouldn't be surprised if the line numbers were
> > different in the later code):
> >
> > ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
> > violation! Expr: pe_prev->is_border() ||
> > !internal::Plane_constructor::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate()
> > File: /Users/kintel/code/OpenSCAD/openscad-2015.03-3/../libraries/install/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
> > Line: 251
> >
> > On Thu, Apr 18, 2019 at 3:28 PM nop head <[hidden email]> wrote:
> > >
> > > If you don't get the Simple, Vertices, etc it means CGAL isn't involved at all. So yes it will display invalid polyhedra. If CGAL is used it will always complain and make the object disappear if there is anything wrong with it. But you only get the error message once and then the empty result is cached.
> > >
> > > On Thu, 18 Apr 2019 at 14:23, A. Craig West <[hidden email]> wrote:
> > >>
> > >> I am getting exactly the same issues in version 2019.01-RC4 (git 2a697e4)
> > >>
> > >> I have screenshots showing the two objects I am trying to union, with
> > >> a gap of a full millimetre (or unit point, I suppose) between them.
> > >> There is no way that this is not a bug in how the cgal code is
> > >> working. At this point I have no way to workaround the issue, other
> > >> than moving the entire design into userspace, which seems somewhat
> > >> ridiculous.
> > >> I am also curious why rendered polyhedrons display differently in the
> > >> console output. Objects created normally display:
> > >> Top level object is a 3D object:
> > >> Simple: yes
> > >> Vertices: 286
> > >> Halfedges: 858
> > >> Edges: 429
> > >> Halffacets: 290
> > >> Facets: 145
> > >> Volumes: 2
> > >>
> > >> while polyhedrons display:
> > >> Top level object is a 3D object:
> > >> Facets: 12
> > >>
> > >> Never mind, That was the solution to my problem. I am sure I remember
> > >> the documentation for polyhedron saying that faces should be clockwise
> > >> when viewed from the inside outwards, but that certainly isn't what it
> > >> says now. I am going to reverse my faces, and that should fix
> > >> everything....
> > >>
> > >> On Wed, Apr 17, 2019 at 7:19 AM A. Craig West <[hidden email]> wrote:
> > >> >
> > >> > Oddly enough, even if the two shapes have no overlap at all, by even a
> > >> > significant margin, I can't get them to render properly. I have tried
> > >> > with a large visible gap between the two parts, and it still discard
> > >> > the polyhedron, which is definitely valid.
> > >> >
> > >> > On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
> > >> > >
> > >> > > 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
> > >> > >
> > >> > > Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
> > >> > >
> > >> > > When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
> > >> > >
> > >> > > On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
> > >> > >>
> > >> > >> Due to issues I have had with CGAL generated shapes forming
> > >> > >> non-manifold STL files, making them difficult to import into other
> > >> > >> tools, I have been focusing on doing as much of my design as possible
> > >> > >> in userspace, generating 3D polyhedrons. This has been a lot of work
> > >> > >> due to limited support in the codebase, particularly as I am limited
> > >> > >> to running in the 2015 version. It would definitely be nice to have
> > >> > >> some 3d union, difference, and intersection functions for polyhedrons,
> > >> > >> but up until now I have been making do.
> > >> > >> I am having a couple of problems with this approach. One of these is
> > >> > >> that the internal code-base does not always seem to be able to handle
> > >> > >> userspace polygons properly. For example, I have a complex shape which
> > >> > >> is totally manifold, forms a single object, and renders perfectly, if
> > >> > >> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
> > >> > >> properly mirrored, but if I display both the original shape and the
> > >> > >> mirrored one, the show properly in the preview but either go
> > >> > >> non-manifold or vanish entirely when rendered.
> > >> > >> I also have issues when trying to union my shape with other shapes, it
> > >> > >> always works fine in preview, but when I render, it may work, or it
> > >> > >> may give an assertion failure and leave my shape out of the final
> > >> > >> rendering. Actually, in the example I am including a screenshot of,
> > >> > >> there was no error or warning at all when it rendered, it just removed
> > >> > >> my shape...
> > >> > >> Does anybody have any suggestions on what I can do to work around
> > >> > >> this? There are shapes that would be REALLY annoying for my to do in
> > >> > >> userspace, but if I can't find a workaround or solution for this, I am
> > >> > >> going to have to do so...
> > >> > >> _______________________________________________
> > >> > >> 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
> > >> _______________________________________________
> > >> 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

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

nophead
This is definitely a bug in my code, but I haver no idea why the cgal code was okay with it as long as it was part of the only shape in the space, 
 
If there is only one polyhedron CGAL is never called. OpenSCAD represents polyhedra and the results of extrudes and primitives like cube with PolySets. These are simple polygon soups and don't care about topology. When you do 3D union, intersection or difference then they get converted to NefPolhedra and passed to CGAL. This is where it matters that they are manifold and errors are generated.
 

On Thu, 18 Apr 2019 at 22:28, A. Craig West <[hidden email]> wrote:
I am going to have to debug the code, I think. It is still have
problems, although I thought it was okay.

On Thu, Apr 18, 2019 at 5:07 PM A. Craig West <[hidden email]> wrote:
>
> Well, I found the actual problem, and while the behaviour is a bit
> inexplicable, it was easy to fix once I found it. There was a bug in
> my polygon triangularisation code which would improperly split up a
> polygon that had collinear sides, if it still formed a triangle.I
> suspect it was turning it into a large triangle and a degenerate
> triangle. This is definitely a bug in my code, but I haver no idea why
> the cgal code was okay with it as long as it was part of the only
> shape in the space, but not if there exists a second shape. Magic...
>
> On Thu, Apr 18, 2019 at 4:03 PM A. Craig West <[hidden email]> wrote:
> >
> > I was wrong about the inverted polyhedron, unfortunately. With some
> > testing I have determined that the documentation is correct that the
> > primary requirement is for all of the faces to be consistently
> > oriented. The difference in how it dispays seems to be based on how
> > many objects there are. A single polyhedron, no matter how complex,
> > renders with just a count of facets. if there are multiple objects, or
> > two objects that have been unioned into one, it gives the complete
> > list.
> > I have narrowed my problem down to one particular section of the
> > polyhedron (it is generated in multiple sections, but is manifold). If
> > this section is on it's own, it renders properly, but if a second
> > shape exists anywhere in space, CGAL fails with an error (this is in
> > the 2015 version, I wouldn't be surprised if the line numbers were
> > different in the later code):
> >
> > ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
> > violation! Expr: pe_prev->is_border() ||
> > !internal::Plane_constructor::get_plane(pe_prev->facet(),pe_prev->facet()->plane()).is_degenerate()
> > File: /Users/kintel/code/OpenSCAD/openscad-2015.03-3/../libraries/install/include/CGAL/Nef_3/polyhedron_3_to_nef_3.h
> > Line: 251
> >
> > On Thu, Apr 18, 2019 at 3:28 PM nop head <[hidden email]> wrote:
> > >
> > > If you don't get the Simple, Vertices, etc it means CGAL isn't involved at all. So yes it will display invalid polyhedra. If CGAL is used it will always complain and make the object disappear if there is anything wrong with it. But you only get the error message once and then the empty result is cached.
> > >
> > > On Thu, 18 Apr 2019 at 14:23, A. Craig West <[hidden email]> wrote:
> > >>
> > >> I am getting exactly the same issues in version 2019.01-RC4 (git 2a697e4)
> > >>
> > >> I have screenshots showing the two objects I am trying to union, with
> > >> a gap of a full millimetre (or unit point, I suppose) between them.
> > >> There is no way that this is not a bug in how the cgal code is
> > >> working. At this point I have no way to workaround the issue, other
> > >> than moving the entire design into userspace, which seems somewhat
> > >> ridiculous.
> > >> I am also curious why rendered polyhedrons display differently in the
> > >> console output. Objects created normally display:
> > >> Top level object is a 3D object:
> > >> Simple: yes
> > >> Vertices: 286
> > >> Halfedges: 858
> > >> Edges: 429
> > >> Halffacets: 290
> > >> Facets: 145
> > >> Volumes: 2
> > >>
> > >> while polyhedrons display:
> > >> Top level object is a 3D object:
> > >> Facets: 12
> > >>
> > >> Never mind, That was the solution to my problem. I am sure I remember
> > >> the documentation for polyhedron saying that faces should be clockwise
> > >> when viewed from the inside outwards, but that certainly isn't what it
> > >> says now. I am going to reverse my faces, and that should fix
> > >> everything....
> > >>
> > >> On Wed, Apr 17, 2019 at 7:19 AM A. Craig West <[hidden email]> wrote:
> > >> >
> > >> > Oddly enough, even if the two shapes have no overlap at all, by even a
> > >> > significant margin, I can't get them to render properly. I have tried
> > >> > with a large visible gap between the two parts, and it still discard
> > >> > the polyhedron, which is definitely valid.
> > >> >
> > >> > On Wed, Apr 17, 2019 at 4:44 AM nop head <[hidden email]> wrote:
> > >> > >
> > >> > > 2015 is so long ago l don't remember what issues it had. In general though the way to avoid this type of issue is to make sure vertices are either exactly numerically the same, or different by a significant margin. Close vertices get merged and that breaks topology.
> > >> > >
> > >> > > Another tip is to clear the cache before F6. Preview can cache corrupted meshes.
> > >> > >
> > >> > > When objects disappear without an error it is usually because the error was generated earlier and an empty mesh was cached.
> > >> > >
> > >> > > On Wed, 17 Apr 2019, 02:24 A. Craig West, <[hidden email]> wrote:
> > >> > >>
> > >> > >> Due to issues I have had with CGAL generated shapes forming
> > >> > >> non-manifold STL files, making them difficult to import into other
> > >> > >> tools, I have been focusing on doing as much of my design as possible
> > >> > >> in userspace, generating 3D polyhedrons. This has been a lot of work
> > >> > >> due to limited support in the codebase, particularly as I am limited
> > >> > >> to running in the 2015 version. It would definitely be nice to have
> > >> > >> some 3d union, difference, and intersection functions for polyhedrons,
> > >> > >> but up until now I have been making do.
> > >> > >> I am having a couple of problems with this approach. One of these is
> > >> > >> that the internal code-base does not always seem to be able to handle
> > >> > >> userspace polygons properly. For example, I have a complex shape which
> > >> > >> is totally manifold, forms a single object, and renders perfectly, if
> > >> > >> I put it in a scale([-1, 1, 1]) or mirror([1, 0, 0]) module, it is
> > >> > >> properly mirrored, but if I display both the original shape and the
> > >> > >> mirrored one, the show properly in the preview but either go
> > >> > >> non-manifold or vanish entirely when rendered.
> > >> > >> I also have issues when trying to union my shape with other shapes, it
> > >> > >> always works fine in preview, but when I render, it may work, or it
> > >> > >> may give an assertion failure and leave my shape out of the final
> > >> > >> rendering. Actually, in the example I am including a screenshot of,
> > >> > >> there was no error or warning at all when it rendered, it just removed
> > >> > >> my shape...
> > >> > >> Does anybody have any suggestions on what I can do to work around
> > >> > >> this? There are shapes that would be REALLY annoying for my to do in
> > >> > >> userspace, but if I can't find a workaround or solution for this, I am
> > >> > >> going to have to do so...
> > >> > >> _______________________________________________
> > >> > >> 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
> > >> _______________________________________________
> > >> 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

_______________________________________________
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
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

MichaelAtOz
Administrator
In reply to this post by acwest
acwest wrote
> I haver no idea why
> the cgal code was okay with it as long as it was part of the only
> shape in the space, but not if there exists a second shape. Magic...

Whenever debugging polys add a cube(1); that will force a union() and hence
CGAL during render.
Also use Design/Flush_caches often, particularly if you think something is
strange, as nophead says CGAL cache prevents error messages reoccurring.



-----
Admin - email* me if you need anything, or if I've done something stupid...

* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
Sent from: http://forum.openscad.org/

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Admin - email* me if you need anything,
or if I've done something stupid...
* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work.
Obviously inclusion of works of previous authors is not included in the above.


The TPP is no simple “trade agreement.” Fight it! http://www.ourfairdeal.org/ time is running out!
Reply | Threaded
Open this post in threaded view
|

Re: Userspace polygon issues

acwest
It turns out my triangulation code wasn't correctly handling convex polygons with some collinear vertices. I found the fastest solution was to create a point in the centre of the convex polygon, and join all of the vertices to that point. Of course, first you need a convex polygon, but I solved that a while ago. 

On Thu, 18 Apr 2019, 20:53 MichaelAtOz, <[hidden email]> wrote:
acwest wrote
> I haver no idea why
> the cgal code was okay with it as long as it was part of the only
> shape in the space, but not if there exists a second shape. Magic...

Whenever debugging polys add a cube(1); that will force a union() and hence
CGAL during render.
Also use Design/Flush_caches often, particularly if you think something is
strange, as nophead says CGAL cache prevents error messages reoccurring.



-----
Admin - email* me if you need anything, or if I've done something stupid...

* click on my MichaelAtOz label, there is a link to email me.

Unless specifically shown otherwise above, my contribution is in the Public Domain; to the extent possible under law, I have waived all copyright and related or neighbouring rights to this work. Obviously inclusion of works of previous authors is not included in the above.

The TPP is no simple “trade agreement.”   Fight it! http://www.ourfairdeal.org/   time is running out!
--
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