bug: projection of child on complex import_stl object

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

bug: projection of child on complex import_stl object

clothbot
Hi Clifford and Marius,

Could you give the attached testcase a try?  It unzips into a folder called "operations".  Modify the OPENSCAD path at the top of the Makefile and run "make all".

For some reason, my code can slice a dxf file from the basic cube example but not the more complex "adns2610_dev_circuit_inv.stl" included.  I get the following output when I run it:

--snip--
echo "difference() {" > test_cube.scad
echo "  cube(size=10.0);" >> test_cube.scad
echo "  cube(size=8.0);" >> test_cube.scad
echo "}" >> test_cube.scad
/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -s test_cube.stl test_cube.scad
echo "use <slicer.scad>" > test_slicer.scad
echo "slicer(slice_z_index=5,slice_z_thickness=0.25) {" >> test_slicer.scad
echo "  import_stl("'"'"test_cube.stl"'"'");" >> test_slicer.scad
echo "}" >> test_slicer.scad
/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -x test_slicer.dxf test_slicer.scad
Compiling library `/Users/andrewplumb/Projects/clothbot/github/clothbot/eda/openscad/operations/slicer.scad'.
echo "use <slicer.scad>" > adns2610_test.scad
echo "slicer(slice_z_index=0,slice_z_thickness=0.25) {" >> adns2610_test.scad
echo "  import_stl("'"'"adns2610_dev_circuit_inv.stl"'"'");" >> adns2610_test.scad
echo "}" >> adns2610_test.scad
/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -x adns2610_test.dxf adns2610_test.scad
Compiling library `/Users/andrewplumb/Projects/clothbot/github/clothbot/eda/openscad/operations/slicer.scad'.
Error !!!!!!!!!!!!!!!!!!!!!!!
Error !!!!!!!!!!!!!!!!!!!!!!!
ERROR: Illegal polygonal object - make sure all polygons are defined with the same winding order. Skipping affected object.
--end-snip--

It's still very much a work in progress, but the full set of code can be found here: http://github.com/clothbot/eda/tree/master/openscad/

The code to generate adns2610_dev_circuit_inv.stl is in http://github.com/clothbot/eda/tree/master/openscad/libraries/avago/

When I run my slice() operator via the "adns2610_render_part=7" of adns-2610.scad I get valid data out, so my guess is that either the STL is bad (Meshlab didn't have any trouble with it though) or there's a bug somewhere in projection(), child() and/or import_stl().

Thanks!

Andrew.




--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/




operations.zip (12K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: bug: projection of child on complex import_stl object

kintel
Administrator
On Jun 26, 2010, at 04:55 AM, Andrew Plumb wrote:
>
> Could you give the attached testcase a try?  It unzips into a folder called "operations".  Modify the OPENSCAD path at the top of the Makefile and run "make all".
>
I've given it a try and here is my take on it so far:

First of all, the object adns2610_dev_circuit_inv.stl has 3 null faces. This can be verified in MeshLab and will make OpenSCAD complain also without using the projection module by just importing it and rendering it using F6.
Removing the null faces in MeshLab kills this problem.
The fact that OpenSCAD appears to export STL's which cannot be used is of course not good :/

With the null-faces removed, the model renders fine, but I'm unable to do either unions, subtractions or projections:
Unions work with F5 and fails with F6.
Subtractions and projections fail with both F5 and F6.

Even your simple STL example fails rendering with F5 with this test:
 difference() {
   import_stl("test_cube.stl");
   translate([2,2,2]) cylinder(h=10);
 }

I've committed some fixes which catch some of these exceptions to keep OpenSCAD from crashing, and added some info about these problems to the TODO list.

As it appears to me, STL import is largely broken and shouldn't be trusted.
This is pretty hardcore stuff to debug, so the simpler test cases you manage to produce, the bigger the chances to motivate someone to dig into this are.

~/= Marius

--
We are Elektropeople for a better living.





Reply | Threaded
Open this post in threaded view
|

Re: bug: projection of child on complex import_stl object

clothbot
Hi Marius,

Thanks for giving it a shot.  I hadn't tried removing null faces in Meshlab; confirmed that it finds them on my end too.

I'll see if I can narrow in on the sequence of operations that triggers the null face generation on more basic primitives.

As always, thanks for all the work you two are doing on this!

Andrew.

--

"The future is already here.  It's just not very evenly distributed" -- William Gibson

Me: http://clothbot.com/wiki/