STL import question

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

STL import question

gibell

I've been importing stl objects into OpenSCAD.  If I import an object where the interior has been hollowed out, openSCAD seems to remove this hollow interior and give me a solid object.  I guess my object has two shells, and it removes the inner shell.  Why can't it just keep both shells?  Is there any way to keep both shells?

To make a trivial example, if I take

difference() {
  cube(size=20,center=true);
  cube(size=10, center=true);
}

Then export stl and import_stl, the object is missing the hollow cube in the middle.

Reply | Threaded
Open this post in threaded view
|

Re: STL import question

Mark Hornby
Does your object allow you to add a narrow passage between the inner and
outer shells?

difference() {
   cube(size=20, center=true);
   cube(size=10, center=true);

   cube([11,1,1],center=false);
}



Reply | Threaded
Open this post in threaded view
|

Re: STL import question

gibell
In reply to this post by gibell
Mark Wrote:
> Does your object allow you to add a narrow passage
> between the inner and outer shells?

Problem is my starting object is in an STL file with inner and outer shells, and I'm trying to "punch a hole between them" exactly as you did.  But when I import the STL file into OpenSCAD, the inner shell disappears.

I tried to separate the inner and outer shells in Blender and store them in two separate STL files, but I couldn't figure out how to do it.  Probably is possible, I just don't know Blender.

-George


Reply | Threaded
Open this post in threaded view
|

Re: STL import question

Steven Dick


On Tue, Oct 26, 2010 at 9:33 AM, <[hidden email]> wrote:
I tried to separate the inner and outer shells in Blender and store them in two separate STL files, but I couldn't figure out how to do it.  Probably is possible, I just don't know Blender.


I'm not sure if it can be done in blender either, but it is trivial in meshlab.

Second face select tool, tooltip "Select connected components in a region".

Hold the alt key or whatever makes the cursor have an eye next to it and select a few triangles on one surface. (it will select all of one surface.)  The eye means it only selects visible faces, not everything, otherwise it will select both surfaces and the next step will delete everything.

Then pick the second delete tool ("delete selected faces and verticies").
That should leave you with the inside, which you can then save.  (If it deletes everything, then your inside and outside are connected, and you will need to go back and delete the connecting faces and try again.)

Then, close that and reopen the original file and do it all over again, but before the delete, choose filters -> selection -> invert selection.  Uncheck verticies, hit apply, then delete faces and verticies as before.  Now you should have the outside only.

Reply | Threaded
Open this post in threaded view
|

Re: STL import question

kintel
Administrator
In reply to this post by gibell
On Oct 26, 2010, at 01:15 AM, [hidden email] wrote:

> I guess my object has two shells, and it removes the inner shell.  Why can't it just keep both shells?  Is there any way to keep both shells?
>
This is a limitation on how meshes are imported into CGAL (the underlying geometry library we use). At the time of loading, we don't know which meshes constitute negative volumes since the STL file doesn't provide this information.
For more discussion, see this thread from July: "bugs: export/import hollow stl models bug", started by Andrew Plumb.

 -Marius


Reply | Threaded
Open this post in threaded view
|

Re: STL import question

clothbot
On 2010-11-01, at 8:58 PM, Marius Kintel wrote:

> On Oct 26, 2010, at 01:15 AM, [hidden email] wrote:
>
>> I guess my object has two shells, and it removes the inner shell.  Why can't it just keep both shells?  Is there any way to keep both shells?
>>
> This is a limitation on how meshes are imported into CGAL (the underlying geometry library we use). At the time of loading, we don't know which meshes constitute negative volumes since the STL file doesn't provide this information.
> For more discussion, see this thread from July: "bugs: export/import hollow stl models bug", started by Andrew Plumb.

Yeah, you run into similar problems if you do a rotate_extrude of any 2D shape with holes in it.  

The work-around that I've found works best is to make two "macro models", one of the positive space and the other of the negative space, and do a higher-level difference() as the final object.  The bonus is you can render the "holes" separately to more easily visualize the interior pathways.

Think hollow donut:

difference() {
  rotate_extrude(convexity=10) translate([5,0]) difference() {
        circle(r=4,center=true);
        circle(r=2,center=true);
  }
  cube(size=10,center=false);
}

translate([0,0,10]) difference() {
  rotate_extrude(convexity=10) translate([5,0])
        circle(r=4,center=true);
  rotate_extrude(convexity=10) translate([5,0])
        circle(r=2,center=true);
  cube(size=10,center=false);
}


Andrew.


--

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

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