Trying to emboss imported STL object using difference()

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

Trying to emboss imported STL object using difference()

donc
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
Reply | Threaded
Open this post in threaded view
|

Re: Trying to emboss imported STL object using difference()

lar3ry
What does the console tell you?
Any error messages?




--
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: Trying to emboss imported STL object using difference()

MichaelAtOz'
In reply to this post by donc
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:[hidden email]] On Behalf Of donc
> Sent: Wed, 30 Dec 2020 05:27
> To: [hidden email]
> 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
> [hidden email]
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


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


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

Re: Trying to emboss imported STL object using difference()

tp3
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
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
-- Torsten
Reply | Threaded
Open this post in threaded view
|

Re: Trying to emboss imported STL object using difference()

OpenSCAD mailing list-2
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 <[hidden email]> 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
[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: Trying to emboss imported STL object using difference()

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

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

Re: Trying to emboss imported STL object using difference()

lar3ry
In reply to this post by donc
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/

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

Re: Trying to emboss imported STL object using difference()

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

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

Re: Trying to emboss imported STL object using difference()

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

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

Re: Trying to emboss imported STL object using difference()

cacb
In reply to this post by donc
On 30.12.2020 20:01, donc wrote:

> 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>
>
Here's your STL repaired using polyfix, it works with your OpenSCAD code
now.

polyhedron 0 ==== volume=4446.65, dtol=0.01, atol=1e-06, maxiter=10
iteration 0: vertices=5256 faces=1752
              warning: 18 zero area faces.
              warning: nonmanifold edges: uc(1)=5256
              merged 4360 vertices
              removed 18 collapsed or zero area faces
              split 17 faces
              total changes=4395
              no warnings

iteration 1: vertices=896 faces=1752
              total changes=0
              no warnings

Summary:
              polyhedron 0: vertices=896 faces=1752 : no warnings

Carsten Arnholm

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

logo_1.stl (117K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Trying to emboss imported STL object using difference()

MichaelAtOz
Administrator
In reply to this post by donc

Carsten's fixed STL does work even though it has self-intersections:

 

 

But when looking at CGAL ERRORs,

 

> The real lid is a polygon base which I extruded and added screw holes to.

> All in OpenSCAD.

 

You could also have a bad polygon, they can also lead to CGAL ERRORs.

See https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Primitive_Solids#Mis-ordered_faces

But as you are extruding it prob. not, always worth a look with F12.

 

Your STL had self-intersections:

(top)

 

(bottom)

 

 

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of donc

> Sent: Thu, 31 Dec 2020 06:01

> To: [hidden email]

> Subject: Re: [OpenSCAD] Trying to emboss imported STL object using difference()

>

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

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, 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.
Reply | Threaded
Open this post in threaded view
|

Re: Trying to emboss imported STL object using difference()

donc
In reply to this post by cacb
I am not surprised that the logo STL had some issues. It was a PITA to create
and I had never done anything like that before.

I have never used polyfix. I will keep that in mind if I ever get another
suspect mesh.

I really like the projection, extrude method. That works like a champ since
this object has a uniform projection all along its height.

I went ahead and made that change in my program.

Thanks again.

Don




--
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: Trying to emboss imported STL object using difference()

lar3ry
You might want to look at Inkscape for tracing logos to create 2D figures, as
they are directly importable into OpenSCAD.



--
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: Trying to emboss imported STL object using difference()

cacb
In reply to this post by MichaelAtOz
On 30.12.2020 23:54, MichaelAtOz wrote:
> Carsten's fixed STL does work even though it has self-intersections:

That's interesting. How does a triangle self-intersect?

Which software did you use to find/visualise self-intersections?

Carsten Arnholm

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

Re: Trying to emboss imported STL object using difference()

cacb
On 2020-12-31 12:35, Carsten Arnholm wrote:
> On 30.12.2020 23:54, MichaelAtOz wrote:
>> Carsten's fixed STL does work even though it has self-intersections:
>
> That's interesting. How does a triangle self-intersect?

Ok, I realise now it probably means partially overlapping triangles. If
so the mesh is no good.

Carsten Arnholm

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

Re: Trying to emboss imported STL object using difference()

MichaelAtOz
Administrator

Carsten, I used NetFabb, this one doesn't show on the MeshLab select/self-intersections.

 

This is the back face of your repaired STL.

 

Note in the red flagged section, the vertical line in the middle of the pink looks wobbly.

Similarly in the blue flagged section, but needs zoom to see.

 

Here I deleted the triangles on each side, there is a yellow line remaining.

Given your repair deletes zero area triangles, I imagine it is a needle like sliver,

where small number floats make it potentially break the surface around it.

 

I did similar in MeshLab, it also shows an extraneous line.

 

The tools I have and/or my driving skills can't drill deeper.

 

 

> -----Original Message-----

> From: Discuss [mailto:[hidden email]] On Behalf Of [hidden email]

> Sent: Thu, 31 Dec 2020 22:48

> To: OpenSCAD general discussion

> Subject: Re: [OpenSCAD] Trying to emboss imported STL object using difference()

>

> On 2020-12-31 12:35, Carsten Arnholm wrote:

> > On 30.12.2020 23:54, MichaelAtOz wrote:

> >> Carsten's fixed STL does work even though it has self-intersections:

> >

> > That's interesting. How does a triangle self-intersect?

>

> Ok, I realise now it probably means partially overlapping triangles. If

> so the mesh is no good.

>

> Carsten Arnholm

>

> _______________________________________________

> OpenSCAD mailing list

> [hidden email]

> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org


Virus-free. www.avg.com

_______________________________________________
OpenSCAD mailing list
[hidden email]
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
OpenSCAD Admin - email* me if you need anything, or if I've done something stupid...
* on the Forum, 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.