discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Trying to emboss imported STL object using difference()

D
donc
Tue, Dec 29, 2020 6:27 PM

Hello.

This is my first post. Started using OpenSCAD about a month ago and just ran
into a problem.

I was finishing up a sensor box lid for a non-profit I help out and was
going to emboss their logo. In the past, I had traced the 2d logo in Blender
and then gave it some height. In Blender I have taken this logo object and
used the boolean difference operation to "emboss" it.

I thought I would do the same in OpenSCAD so I imported the STL and tried to
do a difference(). It shows up correctly in preview but when I do a render
there isn't anything removed by the difference and I have the original
object.

I think it might be because there are multiple "pieces" in the logo. I tried
with a simple cylinder from Blender and was able to put a hole in the object
in OpenSCAD.

I am including an image showing the logo object after I imported the STL.

Thanks,

Don
http://forum.openscad.org/file/t3066/Screen_Shot_2020-12-29_at_1.png

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

Hello. This is my first post. Started using OpenSCAD about a month ago and just ran into a problem. I was finishing up a sensor box lid for a non-profit I help out and was going to emboss their logo. In the past, I had traced the 2d logo in Blender and then gave it some height. In Blender I have taken this logo object and used the boolean difference operation to "emboss" it. I thought I would do the same in OpenSCAD so I imported the STL and tried to do a difference(). It shows up correctly in preview but when I do a render there isn't anything removed by the difference and I have the original object. I think it might be because there are multiple "pieces" in the logo. I tried with a simple cylinder from Blender and was able to put a hole in the object in OpenSCAD. I am including an image showing the logo object after I imported the STL. Thanks, Don <http://forum.openscad.org/file/t3066/Screen_Shot_2020-12-29_at_1.png> -- Sent from: http://forum.openscad.org/
L
lar3ry
Tue, Dec 29, 2020 7:42 PM

What does the console tell you?
Any error messages?

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

What does the console tell you? Any error messages? -- Sent from: http://forum.openscad.org/
MM
Michael Marx
Wed, Dec 30, 2020 12:35 AM

STL is likely non-manifold.
Post it, or email me if you don't want it public, and I can check it.

-----Original Message-----
From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of donc
Sent: Wed, 30 Dec 2020 05:27
To: discuss@lists.openscad.org
Subject: [OpenSCAD] Trying to emboss imported STL object using difference()

Hello.

This is my first post. Started using OpenSCAD about a month ago and just ran
into a problem.

I was finishing up a sensor box lid for a non-profit I help out and was
going to emboss their logo. In the past, I had traced the 2d logo in Blender
and then gave it some height. In Blender I have taken this logo object and
used the boolean difference operation to "emboss" it.

I thought I would do the same in OpenSCAD so I imported the STL and tried to
do a difference(). It shows up correctly in preview but when I do a render
there isn't anything removed by the difference and I have the original
object.

I think it might be because there are multiple "pieces" in the logo. I tried
with a simple cylinder from Blender and was able to put a hole in the object
in OpenSCAD.

I am including an image showing the logo object after I imported the STL.

Thanks,

Don
http://forum.openscad.org/file/t3066/Screen_Shot_2020-12-29_at_1.png

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

STL is likely non-manifold. Post it, or email me if you don't want it public, and I can check it. > -----Original Message----- > From: Discuss [mailto:discuss-bounces@lists.openscad.org] On Behalf Of donc > Sent: Wed, 30 Dec 2020 05:27 > To: discuss@lists.openscad.org > Subject: [OpenSCAD] Trying to emboss imported STL object using difference() > > Hello. > > This is my first post. Started using OpenSCAD about a month ago and just ran > into a problem. > > I was finishing up a sensor box lid for a non-profit I help out and was > going to emboss their logo. In the past, I had traced the 2d logo in Blender > and then gave it some height. In Blender I have taken this logo object and > used the boolean difference operation to "emboss" it. > > I thought I would do the same in OpenSCAD so I imported the STL and tried to > do a difference(). It shows up correctly in preview but when I do a render > there isn't anything removed by the difference and I have the original > object. > > I think it might be because there are multiple "pieces" in the logo. I tried > with a simple cylinder from Blender and was able to put a hole in the object > in OpenSCAD. > > I am including an image showing the logo object after I imported the STL. > > Thanks, > > Don > <http://forum.openscad.org/file/t3066/Screen_Shot_2020-12-29_at_1.png> > > > > -- > 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
TP
Torsten Paul
Wed, Dec 30, 2020 12:38 AM

Another option might be to import the 2D shape into OpenSCAD.

I'm not sure what Blender can export, OpenSCAD would need
either SVG or DXF (and is a bit picky about DXF).

ciao,
Torsten.

Another option might be to import the 2D shape into OpenSCAD. I'm not sure what Blender can export, OpenSCAD would need either SVG or DXF (and is a bit picky about DXF). ciao, Torsten.
F
fred
Wed, Dec 30, 2020 2:40 AM

And yet another option is to use the extension Path to OpenSCAD from within Inkscape, although that opens up a whole new ball of wax, whatever that means. I use it frequently with great success. The extension creates polygon points based on the Inkscape vector image and the desired extrusion thickness. There's a scale factor in the resulting OpenSCAD code that has to be remarked out or set to one, else one gets too-small output.

On Tuesday, December 29, 2020, 7:39:01 PM EST, Torsten Paul <torsten.paul@gmx.de> wrote:  

Another option might be to import the 2D shape into OpenSCAD.

I'm not sure what Blender can export, OpenSCAD would need
either SVG or DXF (and is a bit picky about DXF).

ciao,
  Torsten.


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

And yet another option is to use the extension Path to OpenSCAD from within Inkscape, although that opens up a whole new ball of wax, whatever that means. I use it frequently with great success. The extension creates polygon points based on the Inkscape vector image and the desired extrusion thickness. There's a scale factor in the resulting OpenSCAD code that has to be remarked out or set to one, else one gets too-small output. On Tuesday, December 29, 2020, 7:39:01 PM EST, Torsten Paul <torsten.paul@gmx.de> wrote: Another option might be to import the 2D shape into OpenSCAD. I'm not sure what Blender can export, OpenSCAD would need either SVG or DXF (and is a bit picky about DXF). ciao,   Torsten. _______________________________________________ OpenSCAD mailing list Discuss@lists.openscad.org http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
C
cbernhardt
Wed, Dec 30, 2020 3:14 PM

I have never used Blender to draw anything, but I used my CAD program (Auto
CAD) to sketch your logo and export as a DXF.  Having multiple objects in a
DXF has never caused me a problem unless they are not manifold.
http://forum.openscad.org/file/t1309/test.jpg

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

I have never used Blender to draw anything, but I used my CAD program (Auto CAD) to sketch your logo and export as a DXF. Having multiple objects in a DXF has never caused me a problem unless they are not manifold. <http://forum.openscad.org/file/t1309/test.jpg> -- Sent from: http://forum.openscad.org/
L
lar3ry
Wed, Dec 30, 2020 5:23 PM

Well, I slept on it and it came to me.

First, as someone pointed out, you may have a bad STL. You did not mention
the source of the lid, but if it's an STL, and you are trying to emboss one
stl into the other, one or both STLs may be the problem.

So here's something to try.
Import the logo.stl
make a projection of it
position and extrude it
difference or union that with the lid.

Here's a logo with multiple unconnected pieces put into and onto cubes.
You can just substitute your logo, and if it still fails to render, it is
likely because you are trying to emboss into a bad imported stl, in which
case, you should try to reproduce the lid with OpenSCAD.

Oh, and BTW, You can also drag and drop SVG files into OpenSCAD, and
Inkscape is your friend.
http://forum.openscad.org/file/t2121/Oilers_embossed.png
And the code to produce it...

module lid() {
translate([0,0,2])
color("blue",1)
cube([90,90,4],center=true);
}

module logo(){

translate([0,0,3])

	linear_extrude(2)
		projection()
			import("J:/Make/3D/Prints/Gifts/Oilers.stl");

}

difference(){
lid();
logo();
}

translate([95,0,0])
union(){
lid();
logo();
}

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

Well, I slept on it and it came to me. First, as someone pointed out, you may have a bad STL. You did not mention the source of the lid, but if it's an STL, and you are trying to emboss one stl into the other, one or both STLs may be the problem. So here's something to try. Import the logo.stl make a projection of it position and extrude it difference or union that with the lid. Here's a logo with multiple unconnected pieces put into and onto cubes. You can just substitute your logo, and if it still fails to render, it is likely because you are trying to emboss into a bad imported stl, in which case, you should try to reproduce the lid with OpenSCAD. Oh, and BTW, You can also drag and drop SVG files into OpenSCAD, and Inkscape is your friend. <http://forum.openscad.org/file/t2121/Oilers_embossed.png> And the code to produce it... module lid() { translate([0,0,2]) color("blue",1) cube([90,90,4],center=true); } module logo(){ # translate([0,0,3]) linear_extrude(2) projection() import("J:/Make/3D/Prints/Gifts/Oilers.stl"); } difference(){ lid(); logo(); } translate([95,0,0]) union(){ lid(); logo(); } -- Sent from: http://forum.openscad.org/
D
donc
Wed, Dec 30, 2020 7:01 PM

Wow! You had a very productive sleep.
This was a great idea. Soon as I started reading I thought it would work and
it did!

I was just trying to emboss the logo STL onto a standard cube for testing.
The real lid is a polygon base which I extruded and added screw holes to.
All in OpenSCAD.

There must have been something wrong in the STL but I did a 3d print check
in Blender and it didn't find any non-manifold geometry. I went back and I
did get a console error but it had scrolled off the window. It was

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
violation! Expr: e_below != SHalfedge_handle() File:
/Users/kintel/code/OpenSCAD/libraries/install/include/CGAL/Nef_3/SNC_FM_decorator.h
Line: 427

I will go ahead and post the STL if you want to take a look.
logo.stl http://forum.openscad.org/file/t3066/logo.stl

Anyway, I will add this projection trick to my mental OpenSCAD tool box.

BTW, I must say. I don't post often but I read a lot of computer forums and
you guys are the most helpful I have run across.

Thanks to everyone that answered.

Don

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

Wow! You had a very productive sleep. This was a great idea. Soon as I started reading I thought it would work and it did! I was just trying to emboss the logo STL onto a standard cube for testing. The real lid is a polygon base which I extruded and added screw holes to. All in OpenSCAD. There must have been something wrong in the STL but I did a 3d print check in Blender and it didn't find any non-manifold geometry. I went back and I did get a console error but it had scrolled off the window. It was ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e_below != SHalfedge_handle() File: /Users/kintel/code/OpenSCAD/libraries/install/include/CGAL/Nef_3/SNC_FM_decorator.h Line: 427 I will go ahead and post the STL if you want to take a look. logo.stl <http://forum.openscad.org/file/t3066/logo.stl> Anyway, I will add this projection trick to my mental OpenSCAD tool box. BTW, I must say. I don't post often but I read a lot of computer forums and you guys are the most helpful I have run across. Thanks to everyone that answered. Don -- Sent from: http://forum.openscad.org/
L
lar3ry
Wed, Dec 30, 2020 8:09 PM

I used your logo as is, commented out the linear_extrude() and projection(),
so it would just use the STL, and it worked fine.

There are only reason I can think of that might make it work on mine and not
on yours is that I am using OpenSCAD version 2020.12-RC3

Here's my modified code:

module lid() {
translate([0,0,2])
color("blue",1)
cube([90,90,4],center=true);
}

module logo(){
translate([0,0,6])
// linear_extrude(2)
// projection()
import("J:/Downloads/logo.stl");
}

difference(){
lid();
logo();
}

translate([95,0,0])
union(){
lid();
logo();
}

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

I used your logo as is, commented out the linear_extrude() and projection(), so it would just use the STL, and it worked fine. There are only reason I can think of that might make it work on mine and not on yours is that I am using OpenSCAD version 2020.12-RC3 Here's my modified code: module lid() { translate([0,0,2]) color("blue",1) cube([90,90,4],center=true); } module logo(){ translate([0,0,6]) // linear_extrude(2) // projection() import("J:/Downloads/logo.stl"); } difference(){ lid(); logo(); } translate([95,0,0]) union(){ lid(); logo(); } -- Sent from: http://forum.openscad.org/
L
lar3ry
Wed, Dec 30, 2020 8:33 PM

Very interesting. I modified my program to try to difference and union the
logo straight from your STL.

I removed the linear_extrude and the projection in the logo module.

It failed to render the logo, and gave me an error:

ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion
violation! Expr: e_below != SHalfedge_handle()
File:
/mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_3/SNC_FM_decorator.h
Line: 426, location unknown

Then I commented out the difference code.
It still failed to render the logo, and gave the same error.

Then I translated the logo high enough so that it did not intersect with the
cube, and leaving the difference code commented out, it still failed to
render the logo.

Then I tried reversing the order of the lid(); and logo(); in the union()
code.
That did not render the logo, but gave me the error.

Here's the final program in this test sequence. Render it, then chamge the
order of lid(); and logo(); in the union code. I am hoping that someone can
figure out why this error shows up in one case, and not the other.

module lid() {
translate([0,0,2])
color("blue",1)
cube([90,90,4],center=true);
}

module logo(){
translate([0,0,12])
// linear_extrude(2)
// projection()
color("yellow",1)
import("J:/Downloads/logo.stl");
}

//difference(){
// lid();
// logo();
// }

translate([95,0,0])
union(){
lid();
logo();
}

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

Very interesting. I modified my program to try to difference and union the logo straight from your STL. I removed the linear_extrude and the projection in the logo module. It failed to render the logo, and gave me an error: ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e_below != SHalfedge_handle() File: /mxe/usr/x86_64-w64-mingw32.static.posix/include/CGAL/Nef_3/SNC_FM_decorator.h Line: 426, location unknown Then I commented out the difference code. It still failed to render the logo, and gave the same error. Then I translated the logo high enough so that it did not intersect with the cube, and leaving the difference code commented out, it still failed to render the logo. Then I tried reversing the order of the lid(); and logo(); in the union() code. That did not render the logo, but gave me the error. Here's the final program in this test sequence. Render it, then chamge the order of lid(); and logo(); in the union code. I am hoping that someone can figure out why this error shows up in one case, and not the other. module lid() { translate([0,0,2]) color("blue",1) cube([90,90,4],center=true); } module logo(){ translate([0,0,12]) // linear_extrude(2) // projection() color("yellow",1) import("J:/Downloads/logo.stl"); } //difference(){ // lid(); // logo(); // } translate([95,0,0]) union(){ lid(); logo(); } -- Sent from: http://forum.openscad.org/