discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Removing all surfaces in the X-Y Plane

HE
Hisham Elsafti
Wed, Jan 8, 2020 10:42 AM

Dear all,

I am an inexperienced OpenSCAD user. I would like to prepare an STL file
for a 2D simulation in OpenFOAM using cfMesh's cartesian2DMesh generator
(if you can suggest a workflow I would appreciate it). Whats is needed is a
ribbon surface that represents the out-of-plane extrude. This means that if
my 2D simulation has the Z-axis as the out-of-plane axis, then I need to
have the X-axis direction on all surfaces. My geometry is simple I create a
union of a couple of cubes. How can I then remove the X-Y plane surfaces of
the union. I would like to avoid inputting the points with their
coordinates directly to reduce overhead calculations and maintain things
parametric. So if you know the magic trick, I would really appreciate it!

Best regards,
Hisham

Dear all, I am an inexperienced OpenSCAD user. I would like to prepare an STL file for a 2D simulation in OpenFOAM using cfMesh's cartesian2DMesh generator (if you can suggest a workflow I would appreciate it). Whats is needed is a ribbon surface that represents the out-of-plane extrude. This means that if my 2D simulation has the Z-axis as the out-of-plane axis, then I need to have the X-axis direction on all surfaces. My geometry is simple I create a union of a couple of cubes. How can I then remove the X-Y plane surfaces of the union. I would like to avoid inputting the points with their coordinates directly to reduce overhead calculations and maintain things parametric. So if you know the magic trick, I would really appreciate it! Best regards, Hisham
BL
Bryan Lee
Wed, Jan 8, 2020 10:54 AM

I'm not entirely clear on what you're asking.

Does
projection()
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection
Do what you're looking for?
With "projection(cut=true)" you can slice a model into layers.

Or, if you want the entire model, maybe
resize()
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize
with one dimension set to "0.0001"?  But I think that gives you the same
thing as "projection(cut=false)"...

Thus Hisham Elsafti hast written on Wed, Jan 08, 2020 at 11:42:43AM +0100, and, according to prophecy, it shall come to pass that:

Dear all,

I am an inexperienced OpenSCAD user. I would like to prepare an STL file
for a 2D simulation in OpenFOAM using cfMesh's cartesian2DMesh generator
(if you can suggest a workflow I would appreciate it). Whats is needed is a
ribbon surface that represents the out-of-plane extrude. This means that if
my 2D simulation has the Z-axis as the out-of-plane axis, then I need to
have the X-axis direction on all surfaces. My geometry is simple I create a
union of a couple of cubes. How can I then remove the X-Y plane surfaces of
the union. I would like to avoid inputting the points with their
coordinates directly to reduce overhead calculations and maintain things
parametric. So if you know the magic trick, I would really appreciate it!

Best regards,
Hisham

I'm not entirely clear on what you're asking. Does projection() https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection Do what you're looking for? With "projection(cut=true)" you can slice a model into layers. Or, if you want the entire model, maybe resize() https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize with one dimension set to "0.0001"? But I think that gives you the same thing as "projection(cut=false)"... Thus Hisham Elsafti hast written on Wed, Jan 08, 2020 at 11:42:43AM +0100, and, according to prophecy, it shall come to pass that: > Dear all, > > I am an inexperienced OpenSCAD user. I would like to prepare an STL file > for a 2D simulation in OpenFOAM using cfMesh's cartesian2DMesh generator > (if you can suggest a workflow I would appreciate it). Whats is needed is a > ribbon surface that represents the out-of-plane extrude. This means that if > my 2D simulation has the Z-axis as the out-of-plane axis, then I need to > have the X-axis direction on all surfaces. My geometry is simple I create a > union of a couple of cubes. How can I then remove the X-Y plane surfaces of > the union. I would like to avoid inputting the points with their > coordinates directly to reduce overhead calculations and maintain things > parametric. So if you know the magic trick, I would really appreciate it! > > Best regards, > Hisham > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
AG
Alex Gibson
Wed, Jan 8, 2020 11:52 AM

Hi Hisham

As Bryan mentioned, projection() has several modes, one of which might do
the job for you, but I'm also struggling to understand exactly what you need
to achieve here.

Without worrying too much about the purpose, can you describe what is the
output that you are looking to get from OpenSCAD, and what is the source
material?

Pictures/screenshots welcome!

Cheers,

Alex Gibson

admg consulting

edumaker limited

. Project management
. Operations & Process improvement
. 3D Printing

-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of Bryan
Lee
Sent: 08 January 2020 10:55
To: OpenSCAD general discussion
Subject: Re: [OpenSCAD] Removing all surfaces in the X-Y Plane

I'm not entirely clear on what you're asking.

Does
projection()

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection
Do what you're looking for?
With "projection(cut=true)" you can slice a model into layers.

Or, if you want the entire model, maybe
resize()

https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize
with one dimension set to "0.0001"?  But I think that gives you the same
thing as "projection(cut=false)"...

Thus Hisham Elsafti hast written on Wed, Jan 08, 2020 at 11:42:43AM +0100,
and, according to prophecy, it shall come to pass that:

Dear all,

I am an inexperienced OpenSCAD user. I would like to prepare an STL file
for a 2D simulation in OpenFOAM using cfMesh's cartesian2DMesh generator
(if you can suggest a workflow I would appreciate it). Whats is needed is

a

ribbon surface that represents the out-of-plane extrude. This means that

if

my 2D simulation has the Z-axis as the out-of-plane axis, then I need to
have the X-axis direction on all surfaces. My geometry is simple I create

a

union of a couple of cubes. How can I then remove the X-Y plane surfaces

of

the union. I would like to avoid inputting the points with their
coordinates directly to reduce overhead calculations and maintain things
parametric. So if you know the magic trick, I would really appreciate it!

Best regards,
Hisham


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

Hi Hisham As Bryan mentioned, projection() has several modes, one of which might do the job for you, but I'm also struggling to understand exactly what you need to achieve here. Without worrying too much about the purpose, can you describe what is the output that you are looking to get from OpenSCAD, and what is the source material? Pictures/screenshots welcome! Cheers, Alex Gibson admg consulting edumaker limited . Project management . Operations & Process improvement . 3D Printing -----Original Message----- From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of Bryan Lee Sent: 08 January 2020 10:55 To: OpenSCAD general discussion Subject: Re: [OpenSCAD] Removing all surfaces in the X-Y Plane I'm not entirely clear on what you're asking. Does projection() https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/3D_to_2D_Projection Do what you're looking for? With "projection(cut=true)" you can slice a model into layers. Or, if you want the entire model, maybe resize() https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Transformations#resize with one dimension set to "0.0001"? But I think that gives you the same thing as "projection(cut=false)"... Thus Hisham Elsafti hast written on Wed, Jan 08, 2020 at 11:42:43AM +0100, and, according to prophecy, it shall come to pass that: > Dear all, > > I am an inexperienced OpenSCAD user. I would like to prepare an STL file > for a 2D simulation in OpenFOAM using cfMesh's cartesian2DMesh generator > (if you can suggest a workflow I would appreciate it). Whats is needed is a > ribbon surface that represents the out-of-plane extrude. This means that if > my 2D simulation has the Z-axis as the out-of-plane axis, then I need to > have the X-axis direction on all surfaces. My geometry is simple I create a > union of a couple of cubes. How can I then remove the X-Y plane surfaces of > the union. I would like to avoid inputting the points with their > coordinates directly to reduce overhead calculations and maintain things > parametric. So if you know the magic trick, I would really appreciate it! > > Best regards, > Hisham > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
H
hsafti
Wed, Jan 8, 2020 12:05 PM

Hi guys,

Thanks a lot for your quick response. I am sorry for struggling to explain
myself. If you consider page 4 of this document
http://cfmesh.com/wp-content/uploads/2015/09/User_Guide-cfMesh_v1.1.pdf I
would like to turn a volume enclosed shape like Fig. 5 into a hollow shape
like Fig.4. Because all side surfaces are X-Y plane surfaces, I thought it
might be a useful condition.

I think projection may not be the optimum solution but it is nice to know
this capability.

I produce a union of several cubes:

<code> union(){ translate(v=[-6, -0.1, -0.005]){ cube(size=[21, 0.2, 1.01]); }; translate(v=[0, 0.1, -0.005]){ cube(size=[0.2, 3.0, 1.01]); }; translate(v=[-5.0, 3.1, -0.005]){ cube(size=[10, 10, 1.01]); }; }; </code>

And would like to export only the outer surface and delete the front and
back surfaces!

Best regards,
Hisham

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

Hi guys, Thanks a lot for your quick response. I am sorry for struggling to explain myself. If you consider page 4 of this document http://cfmesh.com/wp-content/uploads/2015/09/User_Guide-cfMesh_v1.1.pdf I would like to turn a volume enclosed shape like Fig. 5 into a hollow shape like Fig.4. Because all side surfaces are X-Y plane surfaces, I thought it might be a useful condition. I think projection may not be the optimum solution but it is nice to know this capability. I produce a union of several cubes: <code> union(){ translate(v=[-6, -0.1, -0.005]){ cube(size=[21, 0.2, 1.01]); }; translate(v=[0, 0.1, -0.005]){ cube(size=[0.2, 3.0, 1.01]); }; translate(v=[-5.0, 3.1, -0.005]){ cube(size=[10, 10, 1.01]); }; }; </code> And would like to export only the outer surface and delete the front and back surfaces! Best regards, Hisham -- Sent from: http://forum.openscad.org/
AG
Alex Gibson
Wed, Jan 8, 2020 12:25 PM

Hi Hisham, that makes sense.

So you're trying to remove the top and bottom face of an STL, leaving the
sides intact, deliberately producing a non-manifold object.

If you're trying to do this as a one-off, the quickest way is to download
'meshmixer', open the exported STL file from OpenSCAD, select the triangles
on the surfaces you don't want and hit delete.

If you need to do this for a batch of files and make a workflow, you could
use this:  https://www.thingiverse.com/thing:62666

It's an STL file to OpenSCAD converter - takes an STL mesh and turns it into
an OpenSCAD code polygon.  You could then edit that polygon to remove all
the faces where all points are on the same Z height (IE they are flat on the
XY plane).  Not sure if it will produce an error if you try to render the
STL as it will certainly be non-manifold, but if it works it's highly
reproducible...

Cheers,

Alex Gibson

admg consulting

edumaker limited

. Project management
. Operations & Process improvement
. 3D Printing

-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
hsafti
Sent: 08 January 2020 12:06
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] Removing all surfaces in the X-Y Plane

Hi guys,

Thanks a lot for your quick response. I am sorry for struggling to explain
myself. If you consider page 4 of this document
http://cfmesh.com/wp-content/uploads/2015/09/User_Guide-cfMesh_v1.1.pdf I
would like to turn a volume enclosed shape like Fig. 5 into a hollow shape
like Fig.4. Because all side surfaces are X-Y plane surfaces, I thought it
might be a useful condition.

I think projection may not be the optimum solution but it is nice to know
this capability.

I produce a union of several cubes:

<code> union(){ translate(v=[-6, -0.1, -0.005]){ cube(size=[21, 0.2, 1.01]); }; translate(v=[0, 0.1, -0.005]){ cube(size=[0.2, 3.0, 1.01]); }; translate(v=[-5.0, 3.1, -0.005]){ cube(size=[10, 10, 1.01]); }; }; </code>

And would like to export only the outer surface and delete the front and
back surfaces!

Best regards,
Hisham

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

Hi Hisham, that makes sense. So you're trying to remove the top and bottom face of an STL, leaving the sides intact, deliberately producing a non-manifold object. If you're trying to do this as a one-off, the quickest way is to download 'meshmixer', open the exported STL file from OpenSCAD, select the triangles on the surfaces you don't want and hit delete. If you need to do this for a batch of files and make a workflow, you could use this: https://www.thingiverse.com/thing:62666 It's an STL file to OpenSCAD converter - takes an STL mesh and turns it into an OpenSCAD code polygon. You could then edit that polygon to remove all the faces where all points are on the same Z height (IE they are flat on the XY plane). Not sure if it will produce an error if you try to render the STL as it will certainly be non-manifold, but if it works it's highly reproducible... Cheers, Alex Gibson admg consulting edumaker limited . Project management . Operations & Process improvement . 3D Printing -----Original Message----- From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of hsafti Sent: 08 January 2020 12:06 To: discuss@lists.openscad.org Subject: Re: [OpenSCAD] Removing all surfaces in the X-Y Plane Hi guys, Thanks a lot for your quick response. I am sorry for struggling to explain myself. If you consider page 4 of this document http://cfmesh.com/wp-content/uploads/2015/09/User_Guide-cfMesh_v1.1.pdf I would like to turn a volume enclosed shape like Fig. 5 into a hollow shape like Fig.4. Because all side surfaces are X-Y plane surfaces, I thought it might be a useful condition. I think projection may not be the optimum solution but it is nice to know this capability. I produce a union of several cubes: <code> union(){ translate(v=[-6, -0.1, -0.005]){ cube(size=[21, 0.2, 1.01]); }; translate(v=[0, 0.1, -0.005]){ cube(size=[0.2, 3.0, 1.01]); }; translate(v=[-5.0, 3.1, -0.005]){ cube(size=[10, 10, 1.01]); }; }; </code> And would like to export only the outer surface and delete the front and back surfaces! Best regards, Hisham -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
F
fred
Wed, Jan 8, 2020 2:32 PM

Another option that might be even easier is to use the Inkscape (free, multi-platform) svg editor with the Path to OpenSCAD extension installed.
SVG to OpenSCAD Bezier - InkScape extension by gaellafond

It has a somewhat documented feature in that an open path generates a user-specified wall thickness line rather than an enclosed polygon/path. This means that if you create a path such as in figure 4 but don't close the end, merely overlap the lines, then use the extension to create an OpenSCAD output, it will be identical to figure 4. Because of the user-specified wall thickness, it's still a 3-dimensional object.
The creator of the extension states that he will not be supporting/developing the extension, as it is native in the newest version of Inkscape. This would require the process to be changed within Inkscape to offset the original drawing to create the "thin-wall" extrusion.
Of course if a thin wall is unacceptable, the real answer remains Meshmixer.
Another work flow option in Meshmixer is to use the Edit/Plane Cut feature and select No Fill, then slice away the top and bottom of the envelope. It's a good bit faster for those shapes which permit entire planes to be vaporized.

|
|
|
|  |  |

|

|
|
|  |
SVG to OpenSCAD Bezier - InkScape extension by gaellafond

[UPDATE] OpenSCAD 2019-05 has added native SVG support, so I won't maintain this extension anymore.https://en.wi...
|

|

|

The suggestion for Meshmixer was one that popped into my alleged mind too, as the methodology described is spot on.

On Wednesday, January 8, 2020, 7:27:50 AM EST, Alex Gibson <alex@alexgibson.net> wrote:  

Hi Hisham, that makes sense.

So you're trying to remove the top and bottom face of an STL, leaving the
sides intact, deliberately producing a non-manifold object.

If you're trying to do this as a one-off, the quickest way is to download
'meshmixer', open the exported STL file from OpenSCAD, select the triangles
on the surfaces you don't want and hit delete.

If you need to do this for a batch of files and make a workflow, you could
use this:  https://www.thingiverse.com/thing:62666

It's an STL file to OpenSCAD converter - takes an STL mesh and turns it into
an OpenSCAD code polygon.  You could then edit that polygon to remove all
the faces where all points are on the same Z height (IE they are flat on the
XY plane).  Not sure if it will produce an error if you try to render the
STL as it will certainly be non-manifold, but if it works it's highly
reproducible...

Cheers,

Alex Gibson

Another option that might be even easier is to use the Inkscape (free, multi-platform) svg editor with the Path to OpenSCAD extension installed. SVG to OpenSCAD Bezier - InkScape extension by gaellafond It has a somewhat documented feature in that an open path generates a user-specified wall thickness line rather than an enclosed polygon/path. This means that if you create a path such as in figure 4 but don't close the end, merely overlap the lines, then use the extension to create an OpenSCAD output, it will be identical to figure 4. Because of the user-specified wall thickness, it's still a 3-dimensional object. The creator of the extension states that he will not be supporting/developing the extension, as it is native in the newest version of Inkscape. This would require the process to be changed within Inkscape to offset the original drawing to create the "thin-wall" extrusion. Of course if a thin wall is unacceptable, the real answer remains Meshmixer. Another work flow option in Meshmixer is to use the Edit/Plane Cut feature and select No Fill, then slice away the top and bottom of the envelope. It's a good bit faster for those shapes which permit entire planes to be vaporized. | | | | | | | | | | | SVG to OpenSCAD Bezier - InkScape extension by gaellafond [UPDATE] OpenSCAD 2019-05 has added native SVG support, so I won't maintain this extension anymore.https://en.wi... | | | The suggestion for Meshmixer was one that popped into my alleged mind too, as the methodology described is spot on. On Wednesday, January 8, 2020, 7:27:50 AM EST, Alex Gibson <alex@alexgibson.net> wrote: Hi Hisham, that makes sense. So you're trying to remove the top and bottom face of an STL, leaving the sides intact, deliberately producing a non-manifold object. If you're trying to do this as a one-off, the quickest way is to download 'meshmixer', open the exported STL file from OpenSCAD, select the triangles on the surfaces you don't want and hit delete. If you need to do this for a batch of files and make a workflow, you could use this:  https://www.thingiverse.com/thing:62666 It's an STL file to OpenSCAD converter - takes an STL mesh and turns it into an OpenSCAD code polygon.  You could then edit that polygon to remove all the faces where all points are on the same Z height (IE they are flat on the XY plane).  Not sure if it will produce an error if you try to render the STL as it will certainly be non-manifold, but if it works it's highly reproducible... Cheers, Alex Gibson
C
cbernhardt
Thu, Jan 9, 2020 2:19 PM

I wrote a program to read and write STL files that works inside AutoCAD.  The
program colors the triangles based on the Z value of the normal vector of
each triangle.  For your purpose (I think) that you want to eliminate all
triangles that have non zero Z values for the normal vector.  Doing so will
produce a model that looks like the attached picture.  If you are somewhat
experienced in programming you could write a program that reads the STL file
and eliminates the triangles that have non zero Z values in their normal
vectors.
If you are not into programming you can open the STL file ( as long as it is
an ASCII file) in a text editor and erase all the triangles that do not have
“0” (zero) as the last number in the line that begins with “facet normal”
For example, here are several lines from the STL file produced by your
OpenSCAD code:
facet normal -1 -0 0
outer loop
vertex -6 0.0999994 1.005
vertex -6 -0.0999994 -0.00499916
vertex -6 -0.0999994 1.005
endloop
endfacet
facet normal 0 0 1
outer loop
vertex 5 13.1 1.005
vertex 0.2 3.1 1.005
vertex 5 3.1 1.005
endloop
endfacet

For your purpose erase the line that reads “facet normal 0 0 1” and the
following 6 lines.  This will erase a single triangle.  Continue editing the
entire file and erase all triangles that do not have a “0” as the last digit
in the facet normal line.
I cannot seem to get the Insert Image function to work, so here is a link to
the modified STL file and image.
http://www.carols62.com/test3.stl
http://www.carols62.com/test3.jpg

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

I wrote a program to read and write STL files that works inside AutoCAD. The program colors the triangles based on the Z value of the normal vector of each triangle. For your purpose (I think) that you want to eliminate all triangles that have non zero Z values for the normal vector. Doing so will produce a model that looks like the attached picture. If you are somewhat experienced in programming you could write a program that reads the STL file and eliminates the triangles that have non zero Z values in their normal vectors. If you are not into programming you can open the STL file ( as long as it is an ASCII file) in a text editor and erase all the triangles that do not have “0” (zero) as the last number in the line that begins with “facet normal” For example, here are several lines from the STL file produced by your OpenSCAD code: facet normal -1 -0 0 outer loop vertex -6 0.0999994 1.005 vertex -6 -0.0999994 -0.00499916 vertex -6 -0.0999994 1.005 endloop endfacet facet normal 0 0 1 outer loop vertex 5 13.1 1.005 vertex 0.2 3.1 1.005 vertex 5 3.1 1.005 endloop endfacet For your purpose erase the line that reads “facet normal 0 0 1” and the following 6 lines. This will erase a single triangle. Continue editing the entire file and erase all triangles that do not have a “0” as the last digit in the facet normal line. I cannot seem to get the Insert Image function to work, so here is a link to the modified STL file and image. http://www.carols62.com/test3.stl http://www.carols62.com/test3.jpg -- Sent from: http://forum.openscad.org/
H
hsafti
Thu, Jan 9, 2020 6:20 PM

Dear all,

Thanks a lot for all your help and support and congratulations on this
really active community spirit. It is in fact the motivation behind using
OpenSCAD to use it inside Python scripts to automate preprocessing. I even
use openpyscad which to my experience does not support the projection method
(not bad, I can still make and call an openScad script if needed). Using an
external tool manually will kill the purpose of the whole thing. I am
currently considering planning to use Python's meshio library to
conviniently read the stl file, filter points with z>0 and consider only
surfaces with verticies only from the remaining points, rewrite as stl or
some other format. Theoretically this should work but you all know how these
things go south in reality :D

So thanks again to all!

Best regards,
Hisham

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

Dear all, Thanks a lot for all your help and support and congratulations on this really active community spirit. It is in fact the motivation behind using OpenSCAD to use it inside Python scripts to automate preprocessing. I even use openpyscad which to my experience does not support the projection method (not bad, I can still make and call an openScad script if needed). Using an external tool manually will kill the purpose of the whole thing. I am currently considering planning to use Python's meshio library to conviniently read the stl file, filter points with z>0 and consider only surfaces with verticies only from the remaining points, rewrite as stl or some other format. Theoretically this should work but you all know how these things go south in reality :D So thanks again to all! Best regards, Hisham -- Sent from: http://forum.openscad.org/
H
hsafti
Thu, Jan 9, 2020 6:47 PM

Sorry .. Just came tired from work! Of course I will remove surfaces based on
surface normal or use a utility from cfMesh that produces the surface I need
from an X-Y planar sketch ... This is maybe why both ideas got mixed in my
head!

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

Sorry .. Just came tired from work! Of course I will remove surfaces based on surface normal or use a utility from cfMesh that produces the surface I need from an X-Y planar sketch ... This is maybe why both ideas got mixed in my head! -- Sent from: http://forum.openscad.org/
AG
Alex Gibson
Thu, Jan 9, 2020 8:03 PM

So a manual edit in Meshmixer would be out of the picture.

You are already aware of automating OpenSCAD - do you use the command line
instance of OpenSCAD?

So this can get you a folder-full of STL files.

'All' you need to do is in Python or something else (I have used GREP or
even MS Excel before, have very patchy programming skills!) parse the STL
files in an automation script.
You would only need to identify and delete each triangle where ALL 3 points
have the same Z value.

Good luck!

Alex Gibson

admg consulting

edumaker limited

. Project management
. Operations & Process improvement
. 3D Printing

-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of
hsafti
Sent: 09 January 2020 18:21
To: discuss@lists.openscad.org
Subject: Re: [OpenSCAD] Removing all surfaces in the X-Y Plane

Dear all,

Thanks a lot for all your help and support and congratulations on this
really active community spirit. It is in fact the motivation behind using
OpenSCAD to use it inside Python scripts to automate preprocessing. I even
use openpyscad which to my experience does not support the projection method
(not bad, I can still make and call an openScad script if needed). Using an
external tool manually will kill the purpose of the whole thing. I am
currently considering planning to use Python's meshio library to
conviniently read the stl file, filter points with z>0 and consider only
surfaces with verticies only from the remaining points, rewrite as stl or
some other format. Theoretically this should work but you all know how these
things go south in reality :D

So thanks again to all!

Best regards,
Hisham

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

--
This email has been checked for viruses by AVG.
https://www.avg.com

So a manual edit in Meshmixer would be out of the picture. You are already aware of automating OpenSCAD - do you use the command line instance of OpenSCAD? So this can get you a folder-full of STL files. 'All' you need to do is in Python or something else (I have used GREP or even MS Excel before, have very patchy programming skills!) parse the STL files in an automation script. You would only need to identify and delete each triangle where ALL 3 points have the same Z value. Good luck! Alex Gibson admg consulting edumaker limited . Project management . Operations & Process improvement . 3D Printing -----Original Message----- From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of hsafti Sent: 09 January 2020 18:21 To: discuss@lists.openscad.org Subject: Re: [OpenSCAD] Removing all surfaces in the X-Y Plane Dear all, Thanks a lot for all your help and support and congratulations on this really active community spirit. It is in fact the motivation behind using OpenSCAD to use it inside Python scripts to automate preprocessing. I even use openpyscad which to my experience does not support the projection method (not bad, I can still make and call an openScad script if needed). Using an external tool manually will kill the purpose of the whole thing. I am currently considering planning to use Python's meshio library to conviniently read the stl file, filter points with z>0 and consider only surfaces with verticies only from the remaining points, rewrite as stl or some other format. Theoretically this should work but you all know how these things go south in reality :D So thanks again to all! Best regards, Hisham -- Sent from: http://forum.openscad.org/ _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org -- This email has been checked for viruses by AVG. https://www.avg.com
H
hsafti
Thu, Jan 9, 2020 11:37 PM

Hi Alex and all,

Thanks again for your helpful tips. Python saves the day once more. Using
the numpy-stl library, one can do this short code:

import numpy
from stl import mesh

mesh3D = mesh.Mesh.from_file('mesh3D.stl')

indecies=[]
for i in range(len(mesh3D.normals)):
if mesh3D.normals[i][2] ==0:
indecies.append(i)

verticeCount = len(indecies)
data = numpy.zeros(verticeCount, dtype=mesh.Mesh.dtype)

mesh2D = mesh.Mesh(data, remove_empty_areas=False)

for k in range(verticeCount):
mesh2D.v0[k] = mesh3D.v0[indecies[k]]
mesh2D.v1[k] = mesh3D.v1[indecies[k]]
mesh2D.v2[k] = mesh3D.v2[indecies[k]]

mesh2D.save('mesh2D.stl')

Thanks again and until next time ;-)

http://forum.openscad.org/file/t2716/result.png

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

Hi Alex and all, Thanks again for your helpful tips. Python saves the day once more. Using the numpy-stl library, one can do this short code: import numpy from stl import mesh mesh3D = mesh.Mesh.from_file('mesh3D.stl') indecies=[] for i in range(len(mesh3D.normals)): if mesh3D.normals[i][2] ==0: indecies.append(i) verticeCount = len(indecies) data = numpy.zeros(verticeCount, dtype=mesh.Mesh.dtype) mesh2D = mesh.Mesh(data, remove_empty_areas=False) for k in range(verticeCount): mesh2D.v0[k] = mesh3D.v0[indecies[k]] mesh2D.v1[k] = mesh3D.v1[indecies[k]] mesh2D.v2[k] = mesh3D.v2[indecies[k]] mesh2D.save('mesh2D.stl') Thanks again and until next time ;-) <http://forum.openscad.org/file/t2716/result.png> -- Sent from: http://forum.openscad.org/
HJ
Hugo Jackson
Wed, Jan 15, 2020 10:05 PM

Far more times than I care to admit, I’ve mistakenly click on the render button right after a render is finished. I do that just out of unsupervised muscle memory or something… I don’t know… but I suspect I’m not the only one who does this. Often this is no big deal, but when the render itself took 15 or more minutes to complete its frustrating to have to sit through the whole process again. I MEANT to save too STL… but oh no… have to wait for it to render again and hope I don’t make the same mistake again.

We already have a somewhat related warning… when you click to save an STL file OpenSCAD will warn you if you’ve made any changes to the source file to alert you to the possibility that you may not be saving the file that you think you are.

So while I’m sitting here waiting for that 2nd unnecessary render to finish I thought I’d pop this off to the list as I’m thinking that with a preferences adjustable value, openSCAD could come up with a dialog that read something like “Are you sure you want to render? The last render of this object took 48 minutes”.

Is this doable? Worthwhile? Easy or hard?

Far more times than I care to admit, I’ve mistakenly click on the render button right after a render is finished. I do that just out of unsupervised muscle memory or something… I don’t know… but I suspect I’m not the only one who does this. Often this is no big deal, but when the render itself took 15 or more minutes to complete its frustrating to have to sit through the whole process again. I MEANT to save too STL… but oh no… have to wait for it to render again and hope I don’t make the same mistake again. We already have a somewhat related warning… when you click to save an STL file OpenSCAD will warn you if you’ve made any changes to the source file to alert you to the possibility that you may not be saving the file that you think you are. So while I’m sitting here waiting for that 2nd unnecessary render to finish I thought I’d pop this off to the list as I’m thinking that with a preferences adjustable value, openSCAD could come up with a dialog that read something like “Are you sure you want to render? The last render of this object took 48 minutes”. Is this doable? Worthwhile? Easy or hard?
DM
Doug Moen
Wed, Jan 15, 2020 11:41 PM

I'd like to be able to cancel a render.

On Wed, Jan 15, 2020, at 5:05 PM, Hugo Jackson wrote:

Far more times than I care to admit, I’ve mistakenly click on the
render button right after a render is finished. I do that just out of
unsupervised muscle memory or something… I don’t know… but I suspect
I’m not the only one who does this. Often this is no big deal, but when
the render itself took 15 or more minutes to complete its frustrating
to have to sit through the whole process again. I MEANT to save too
STL… but oh no… have to wait for it to render again and hope I don’t
make the same mistake again.

We already have a somewhat related warning… when you click to save an
STL file OpenSCAD will warn you if you’ve made any changes to the
source file to alert you to the possibility that you may not be saving
the file that you think you are.

So while I’m sitting here waiting for that 2nd unnecessary render to
finish I thought I’d pop this off to the list as I’m thinking that with
a preferences adjustable value, openSCAD could come up with a dialog
that read something like “Are you sure you want to render? The last
render of this object took 48 minutes”.

Is this doable? Worthwhile? Easy or hard?


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

I'd like to be able to cancel a render. On Wed, Jan 15, 2020, at 5:05 PM, Hugo Jackson wrote: > Far more times than I care to admit, I’ve mistakenly click on the > render button right after a render is finished. I do that just out of > unsupervised muscle memory or something… I don’t know… but I suspect > I’m not the only one who does this. Often this is no big deal, but when > the render itself took 15 or more minutes to complete its frustrating > to have to sit through the whole process again. I MEANT to save too > STL… but oh no… have to wait for it to render again and hope I don’t > make the same mistake again. > > We already have a somewhat related warning… when you click to save an > STL file OpenSCAD will warn you if you’ve made any changes to the > source file to alert you to the possibility that you may not be saving > the file that you think you are. > > So while I’m sitting here waiting for that 2nd unnecessary render to > finish I thought I’d pop this off to the list as I’m thinking that with > a preferences adjustable value, openSCAD could come up with a dialog > that read something like “Are you sure you want to render? The last > render of this object took 48 minutes”. > > Is this doable? Worthwhile? Easy or hard? > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org >
M
MichaelAtOz
Thu, Jan 16, 2020 12:05 AM

a. I moved this to a separate topic.

b.

doug.moen wrote

I'd like to be able to cancel a render.

You can click the close button to the right of the progress meter, but if it
has reached the final global union that is a single call to CGAL so won't
cancel until it returns.

Re re-render warning, due to cache, re-renders should be almost instant.
What are you doing that makes it time consuming?


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.

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

a. I moved this to a separate topic. b. doug.moen wrote > I'd like to be able to cancel a render. You can click the close button to the right of the progress meter, but if it has reached the final global union that is a single call to CGAL so won't cancel until it returns. Re re-render warning, due to cache, re-renders should be almost instant. What are you doing that makes it time consuming? ----- 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. -- Sent from: http://forum.openscad.org/
HJ
Hugo Jackson
Thu, Jan 16, 2020 7:06 AM

On Jan 15, 2020, at 4:05 PM, MichaelAtOz oz.at.michael@gmail.com wrote:

Re re-render warning, due to cache, re-renders should be almost instant.
What are you doing that makes it time consuming?

I don’t know what I’m doing, but the particular design I’m working on employs a half a dozen toruses and those torus’s are hulled. I’ve replaced most of the primitive modules (like circle, cube etc.) with routines that create point lists that are then made into polygons and linear extruded. For most of my projects I don’t notice a performance hit for either preview or render but perhaps I’m missing something. I’m thinking that perhaps I’m doing something that doesn’t cache so when I render it has to start over?
I’d be happy to show my code, but I don’t know how useful it would be given that its highly modified from ‘pure’ openSCAD. Given that… any suggestions you might have for what to look for?

> On Jan 15, 2020, at 4:05 PM, MichaelAtOz <oz.at.michael@gmail.com> wrote: > > > Re re-render warning, due to cache, re-renders should be almost instant. > What are you doing that makes it time consuming? > I don’t know what I’m doing, but the particular design I’m working on employs a half a dozen toruses and those torus’s are hulled. I’ve replaced most of the primitive modules (like circle, cube etc.) with routines that create point lists that are then made into polygons and linear extruded. For most of my projects I don’t notice a performance hit for either preview or render but perhaps I’m missing something. I’m thinking that perhaps I’m doing something that doesn’t cache so when I render it has to start over? I’d be happy to show my code, but I don’t know how useful it would be given that its highly modified from ‘pure’ openSCAD. Given that… any suggestions you might have for what to look for?
M
MichaelAtOz
Thu, Jan 16, 2020 11:00 PM

What are your Edit/Preferences/Advance/CGAL cache sizes?
That will affect re-render performance if to small.
I have both at 2048MB.


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.

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

What are your Edit/Preferences/Advance/CGAL cache sizes? That will affect re-render performance if to small. I have both at 2048MB. ----- 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. -- Sent from: http://forum.openscad.org/
HJ
Hugo Jackson
Thu, Jan 16, 2020 11:38 PM

WOW!!!! So grateful for your advice. My cache size was just set to the default 100MB… reset it to 2048 and presto… 1st render took 25 minutes… rerender was immediate! What will I do with all my spare time now?

Seeing as this bottleneck just sort of crept up on me and I don’t think I had any reason to presume openSCAD could be improved to reduce rerender times I’m just wondering if there are any other preference settings that should be adjusted… is there some docs on the settings that you know of that I can look up? If polyset cache is undersized is it just going to result in some kind of slow down or will it precipitate some kind of warning. Is Enable for OpenGL 1.x best left enabled? Is 16000000 an appropriate rendering limit? And forcing goldfeather? I have no idea what that even means.

Regardless… thanks so much… I’m very grateful!

On Jan 16, 2020, at 3:00 PM, MichaelAtOz oz.at.michael@gmail.com wrote:

What are your Edit/Preferences/Advance/CGAL cache sizes?
That will affect re-render performance if to small.
I have both at 2048MB.


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.

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


OpenSCAD mailing list
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

WOW!!!! So grateful for your advice. My cache size was just set to the default 100MB… reset it to 2048 and presto… 1st render took 25 minutes… rerender was immediate! What will I do with all my spare time now? Seeing as this bottleneck just sort of crept up on me and I don’t think I had any reason to presume openSCAD could be improved to reduce rerender times I’m just wondering if there are any other preference settings that should be adjusted… is there some docs on the settings that you know of that I can look up? If polyset cache is undersized is it just going to result in some kind of slow down or will it precipitate some kind of warning. Is Enable for OpenGL 1.x best left enabled? Is 16000000 an appropriate rendering limit? And forcing goldfeather? I have no idea what that even means. Regardless… thanks so much… I’m very grateful! > On Jan 16, 2020, at 3:00 PM, MichaelAtOz <oz.at.michael@gmail.com> wrote: > > What are your Edit/Preferences/Advance/CGAL cache sizes? > That will affect re-render performance if to small. > I have both at 2048MB. > > > > ----- > 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. > > -- > Sent from: http://forum.openscad.org/ > > _______________________________________________ > OpenSCAD mailing list > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
M
MichaelAtOz
Fri, Jan 17, 2020 12:19 AM

boxcarmib wrote

I’m just wondering if there are any other preference settings that should
be adjusted… is there some docs on the settings that you know of that I
can look up?

Hmmm...seems not.

If polyset cache is undersized is it just going to result in some kind of
slow down or will it precipitate some kind of warning.

AFAIK just slows down as it re-renders what is no longer in cache.

Is Enable for OpenGL 1.x best left enabled?

No, unless you have an old system.

Is 16000000 an appropriate rendering limit?

This affects preview, I think it will look bad if too low, but if too high,
preview movement can get clunky.
I have it at 1 billion.

And forcing goldfeather? I have no idea what that even means.

It is a different algorithm, only needed where there is a GPU compatibility
problem.
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Preview_doesn't_appear_to_work_at_all


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.

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

boxcarmib wrote > I’m just wondering if there are any other preference settings that should > be adjusted… is there some docs on the settings that you know of that I > can look up? Hmmm...seems not. > If polyset cache is undersized is it just going to result in some kind of > slow down or will it precipitate some kind of warning. AFAIK just slows down as it re-renders what is no longer in cache. > Is Enable for OpenGL 1.x best left enabled? No, unless you have an old system. > Is 16000000 an appropriate rendering limit? This affects preview, I think it will look bad if too low, but if too high, preview movement can get clunky. I have it at 1 billion. > And forcing goldfeather? I have no idea what that even means. It is a different algorithm, only needed where there is a GPU compatibility problem. https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/FAQ#Preview_doesn't_appear_to_work_at_all ----- 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. -- Sent from: http://forum.openscad.org/