discuss@lists.openscad.org

OpenSCAD general discussion Mailing-list

View all threads

Cut Object out of cube doesn't work

E
epe
Thu, Nov 23, 2017 10:05 AM

Hey,

I'm trying to cut an imported stl model out of a cube but it always throws
an error (WARNING: Object may not be a valid 2-manifold and may need
repair!).

I already tried to fix it with Netfabb. But in that case it throws a
different error (ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR:
assertion violation! Expr: e->incident_sface() != SFace_const_handle() File:
/opt/mxe/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_S2/SM_const_decorator.h
Line: 326).

I tried my code with an example model and it worked without any problems. So
there must be a problem with my imported model. Maybe somebody has an idea
what i could try to get this work.

My code:
model_filename = "mri_vessel_extract_fixed.stl";
model_rotate = [0,0,0];
model_translate = [0,0,0];
model_scale = 1;

difference(){
translate([103.5,-133,16.9]){
cube(size=[30,11.5,10]);
}
scale(model_scale)
translate(v = model_translate)
rotate(model_rotate)
import(model_filename);
}

I uploaded the two models in my dropbox so you can try it yourself. Maybe I
just did anything else wrong.
https://www.dropbox.com/sh/dhjhagjhd9s19g7/AABqT30nO4eJC-qfjAQiSi8oa?dl=0
https://www.dropbox.com/sh/dhjhagjhd9s19g7/AABqT30nO4eJC-qfjAQiSi8oa?dl=0

Thank you in advance

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

Hey, I'm trying to cut an imported stl model out of a cube but it always throws an error (WARNING: Object may not be a valid 2-manifold and may need repair!). I already tried to fix it with Netfabb. But in that case it throws a different error (ERROR: CGAL error in CGAL_Nef_polyhedron3(): CGAL ERROR: assertion violation! Expr: e->incident_sface() != SFace_const_handle() File: /opt/mxe/usr/x86_64-w64-mingw32.static/include/CGAL/Nef_S2/SM_const_decorator.h Line: 326). I tried my code with an example model and it worked without any problems. So there must be a problem with my imported model. Maybe somebody has an idea what i could try to get this work. My code: model_filename = "mri_vessel_extract_fixed.stl"; model_rotate = [0,0,0]; model_translate = [0,0,0]; model_scale = 1; difference(){ translate([103.5,-133,16.9]){ cube(size=[30,11.5,10]); } scale(model_scale) translate(v = model_translate) rotate(model_rotate) import(model_filename); } I uploaded the two models in my dropbox so you can try it yourself. Maybe I just did anything else wrong. https://www.dropbox.com/sh/dhjhagjhd9s19g7/AABqT30nO4eJC-qfjAQiSi8oa?dl=0 <https://www.dropbox.com/sh/dhjhagjhd9s19g7/AABqT30nO4eJC-qfjAQiSi8oa?dl=0> Thank you in advance -- Sent from: http://forum.openscad.org/
M
MichaelAtOz
Fri, Nov 24, 2017 2:40 AM

epe wrote

I'm trying to cut an imported stl model out of a cube but it always throws
an error (WARNING: Object may not be a valid 2-manifold and may need
repair!).

Meshlab shows it has a problem (the ...fixed.stl)
http://forum.openscad.org/file/t359/td22541.jpg
The top bit is not manifold.
The lower red circle shows what looks like a infinitely thin face, that's
likely a problem, there are similar ones in the middle area at the base of
the T too.

Fixing that is sometimes not easy. I'll have a look a bit later...


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

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/

epe wrote > I'm trying to cut an imported stl model out of a cube but it always throws > an error (WARNING: Object may not be a valid 2-manifold and may need > repair!). Meshlab shows it has a problem (the ...fixed.stl) <http://forum.openscad.org/file/t359/td22541.jpg> The top bit is not manifold. The lower red circle shows what looks like a infinitely thin face, that's likely a problem, there are similar ones in the middle area at the base of the T too. Fixing that is sometimes not easy. I'll have a look a bit later... ----- Admin - PM me if you need anything, or if I've done something stupid... 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/
M
MichaelAtOz
Fri, Nov 24, 2017 2:49 AM

Close up of that area in Netfabb
http://forum.openscad.org/file/t359/td22541_B.jpg


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

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/

Close up of that area in Netfabb <http://forum.openscad.org/file/t359/td22541_B.jpg> ----- Admin - PM me if you need anything, or if I've done something stupid... 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/
M
MichaelAtOz
Fri, Nov 24, 2017 3:24 AM

http://forum.openscad.org/file/t359/td22541_C.jpg
There you go, hollowed out cube.
Here's the file, if you're happy with the pointy end bits cut off...
mri_vessel_extract_fixed_Md.stl
http://forum.openscad.org/file/t359/mri_vessel_extract_fixed_Md.stl


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

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/

<http://forum.openscad.org/file/t359/td22541_C.jpg> There you go, hollowed out cube. Here's the file, if you're happy with the pointy end bits cut off... mri_vessel_extract_fixed_Md.stl <http://forum.openscad.org/file/t359/mri_vessel_extract_fixed_Md.stl> ----- Admin - PM me if you need anything, or if I've done something stupid... 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/
M
MichaelAtOz
Fri, Nov 24, 2017 3:26 AM

BTW what vessel?


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

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/

BTW what vessel? ----- Admin - PM me if you need anything, or if I've done something stupid... 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/
E
epe
Fri, Nov 24, 2017 8:54 AM

Thanks a lot. It works perfectly.
Can you tell me what you exactly did so I can understand it better and do it
myself in the future?

MichaelAtOz wrote

BTW what vessel?

The model is a small part of a brain vessel extracted from a MRI.

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

Thanks a lot. It works perfectly. Can you tell me what you exactly did so I can understand it better and do it myself in the future? MichaelAtOz wrote > BTW what vessel? The model is a small part of a brain vessel extracted from a MRI. -- Sent from: http://forum.openscad.org/
CC
Chris Camacho
Fri, Nov 24, 2017 11:11 AM

jeeze and all this time I just thought STL's would never work for this
because they are just a soup of triangles and not a "mathematical" volume

I shall have to find some "tidy" STL's to play with!!!

On 24/11/17 03:24, MichaelAtOz wrote:

http://forum.openscad.org/file/t359/td22541_C.jpg
There you go, hollowed out cube.
Here's the file, if you're happy with the pointy end bits cut off...
mri_vessel_extract_fixed_Md.stl
http://forum.openscad.org/file/t359/mri_vessel_extract_fixed_Md.stl


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

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
Discuss@lists.openscad.org
http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org

jeeze and all this time I just thought STL's would never work for this because they are just a soup of triangles and not a "mathematical" volume I shall have to find some "tidy" STL's to play with!!! On 24/11/17 03:24, MichaelAtOz wrote: > <http://forum.openscad.org/file/t359/td22541_C.jpg> > There you go, hollowed out cube. > Here's the file, if you're happy with the pointy end bits cut off... > mri_vessel_extract_fixed_Md.stl > <http://forum.openscad.org/file/t359/mri_vessel_extract_fixed_Md.stl> > > > > ----- > Admin - PM me if you need anything, or if I've done something stupid... > > 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 > Discuss@lists.openscad.org > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
M
MichaelAtOz
Sat, Nov 25, 2017 9:31 PM

epe wrote

Can you tell me what you exactly did so I can understand it better and do
it
myself in the future?
I was able to fille the model, but I can't get rid of the little thin
faces.

Firstly some experience of what looks wrong helps.

But start with Meshlab, Render/Show Non Manif Edges & Show Non Manif
Vertices.
If any are non-zero, Filters/Selection/Select non Manifold (Edges &/or
Vertices).
Also try Filter/Select/Select Self Interseting Faces.
Then go looking for the coloured bits.
Then, this is where it is an art, start looking at the vertices/edges around
there.
Set Render/Show Non Faux Edges.
Rotate/Translate/Zoom examine the area.
You may see a hole, or something doesn't render right.
In this case it was a face that jutted out seemingly without volume.
(You could try the following in Meshlab, but I switch to Netfabb)
In Netfabb Click the repair icon (Red Cross).
Rotate/Translate/Zoom examine the area. Wrong things are easier to spot than
in Meshlab.
Then start selecting vertices and deleting them trying to make a neat hole,
you will see
edges/vertices that also look wrong, delete them. Work on one area at a
time.
If it's on a protruding bit, look at the opposite side, probably trim that
too.
Zoom in real close, things like this are wrong, blow them away too...
http://forum.openscad.org/file/t359/Problem_site_in_Netfabb.jpg
Then Right-click the hole, try Close Trivial Holes. Try Close All Holes.
If that doesn't work reshape the hole a bit. Try again.
Click the Update button, make sure there are zero holes.
Rotate/Translate/Zoom examine the area. Make sure it looks 'right'

Then Click Apply Repair.
Click Part/Export Part, export the STL.

Test it.

Note that there have been many STLs which I couldn't fix.


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

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/

epe wrote > Can you tell me what you exactly did so I can understand it better and do > it > myself in the future? > I was able to fille the model, but I can't get rid of the little thin > faces. Firstly some experience of what looks wrong helps. But start with Meshlab, Render/Show Non Manif Edges & Show Non Manif Vertices. If any are non-zero, Filters/Selection/Select non Manifold (Edges &/or Vertices). Also try Filter/Select/Select Self Interseting Faces. Then go looking for the coloured bits. Then, this is where it is an art, start looking at the vertices/edges around there. Set Render/Show Non Faux Edges. Rotate/Translate/Zoom examine the area. You may see a hole, or something doesn't render right. In this case it was a face that jutted out seemingly without volume. (You could try the following in Meshlab, but I switch to Netfabb) In Netfabb Click the repair icon (Red Cross). Rotate/Translate/Zoom examine the area. Wrong things are easier to spot than in Meshlab. Then start selecting vertices and deleting them trying to make a neat hole, you will see edges/vertices that also look wrong, delete them. Work on one area at a time. If it's on a protruding bit, look at the opposite side, probably trim that too. Zoom in real close, things like this are wrong, blow them away too... <http://forum.openscad.org/file/t359/Problem_site_in_Netfabb.jpg> Then Right-click the hole, try Close Trivial Holes. Try Close All Holes. If that doesn't work reshape the hole a bit. Try again. Click the Update button, make sure there are zero holes. Rotate/Translate/Zoom examine the area. Make sure it looks 'right' Then Click Apply Repair. Click Part/Export Part, export the STL. Test it. Note that there have been many STLs which I couldn't fix. ----- Admin - PM me if you need anything, or if I've done something stupid... 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/