SketchUp / sketchup-stl

A SketchUp Ruby Extension that adds STL (STereoLithography) file format import and export.
http://extensions.sketchup.com/content/sketchup-stl
MIT License
248 stars 68 forks source link

export to stl failing #138

Open Kcalvin opened 10 years ago

Kcalvin commented 10 years ago

I am working with local school technical instructor to try to print SU model parts for park pavilion I am building. I've created verifiable hollow solids in SU that give volume in entity properties box, and have no hidden faces, and have been checked with solid inspector. (Thank you Tom Tom!) The tech instructor is telling me the .stl files are not exporting water-tight geometry. He is using autodesk inventor 2014 with all updates to examine the stl file, and finding SU export problems. He has been able to resolve some of those by running free version of Netfabb twice for each component file to fix issues in .stl file. What can I do about this? I understand the .stl plug-in was developed by Sketchup Team, so would assume there might be some support for these types of issues.

Here is link to one of the .stl files that I exported and was problematic:

https://www.dropbox.com/s/65k63xj2vwt19mf/Back%20plate%20section%20A.stl

And here is link to SU file that I exported from:

https://www.dropbox.com/s/ah0oitkgvq0b8gl/Fir%20St.%20Park%20Pavilion%203D%20print%20file.skp

Thoughts anyone?

Kris

thomthom commented 10 years ago

I get "Web page not available" for both of those links when I click the download button.

thomthom commented 10 years ago

I was able to download by using Save to my Dropbox.

thomthom commented 10 years ago

The STL plugin was developed by different community members. A couple of years ago the SketchUp team merged these contributions into this open source project. I'm not 100% sure of the support status of this project.

However, I looked at the STL file linked, and imported into SketchUp it came in as a solid. So I'm not sure what the error is here. The issue is that Inventor cannot load it? Can we have more details to what these errors are?

I do notice that the SKP file doesn't have proper normals for all the geometry - as in you can see the backside is facing outward here and there. (The blue side facing out instead of the white site.) Could this be the issue?

My initials round-trip SKP->STL->SKP is working fine. Need more info here.

Kcalvin commented 10 years ago

Thom Thom,

OH MY!-- a reply from the SketchUp guru himself! This is so cool. Did I mention how excited I was to hear about, find and use your solid inspector?

OK, calming down now.

I did not know that reverse face orientation was considered an "improper normal" or potentially problematic. I don't know why faces do this, but I do know how to reverse them. I will give that a try. Also, I will go back to HS tech instructor and see about getting more detail on the export errors he is experiencing with my .stl file.

I'll be back with better explanation as soon as possible.

Thank you!

Kris

On Thu, May 8, 2014 at 7:44 AM, Thomas Thomassen notifications@github.comwrote:

The STL plugin was developed by different community members. A couple of years ago the SketchUp team merged these contributions into this open source project. I'm not 100% sure of the support status of this project.

However, I looked at the STL file linked, and imported into SketchUp it came in as a solid. So I'm not sure what the error is here. The issue is that Inventor cannot load it? Can we have more details to what these errors are?

I do notice that the SKP file doesn't have proper normals for all the geometry - as in you can see the backside is facing outward here and there. (The blue side facing out instead of the white site.) Could this be the issue?

My initials round-trip SKP->STL->SKP is working fine. Need more info here.

— Reply to this email directly or view it on GitHubhttps://github.com/SketchUp/sketchup-stl/issues/138#issuecomment-42558252 .

Earthwood Timber Frame Homes 148 W Barclay Dr. Sisters, OR 97759 W- 541.549.0924 C- 541.408.5949

www.earthwoodhomes.com www.fishermansquay.com

jimfoltz commented 10 years ago

Reversed Faces may indeed be the problem.

Here is the .stl loaded in NetFabb Basic. Note the Red area.

2014-05_24

Here is the Red area zoomed in:

2014-05_25

And finally the SketchUp component (with back faces set to red.)

2014-05_27

When I reverse the face in SketchUp then export as STL, then NetFabb reports no problems (all green model.)

thomthom commented 10 years ago

hmm... for solids it should be possible to correct this - as long as we can figure out a way to determine what is "inside" and "outside".

I think it would be good if the exporter just reversed the orientation of the point data for the faces it export when it detect an inverted face like that. But it would probably be nice to expose that as a function the users can invoke to correct the SketchUp model as well.

thomthom commented 10 years ago

I think if we can determine the orientation of one face we can orient the rest.

Shoot a ray from the face's centroid in the direction of it's normal - ignore all geometry that doesn't belong to the face's parent. Let the ray exit the boundingbox of the face's parent - if it passes through an odd number of faces it's oriented "inwards".

thomthom commented 10 years ago

For the orienting:

  1. Given the start face it iterates its edges.
  2. Since we are fixing only manifolds each edge will have two faces. Put the other face in the queue to process next.
  3. Then it checks if the edge is reversed in both faces - if it is then one of them needs to be flipped.
  4. Mark the face as processed once done looping the edges.
Kcalvin commented 10 years ago

Still working to determine if reverse faces causing the export issues to .stl Have two fellows with 3D printers exploring the problem. One has indicated that it is appears from his end the export is significantly improved in files without reverse faces. We'll run a few more print jobs and let you know. The rest of what you are talking about above is way over my pay grade--and head. But your discussion has been a big help regardless. I'll contact SU support to better understand what actually causes a reverse face to develop when modeling, as I've got a lot of them in my detailed timber frame model--especially in the joinery as Jim pointed out.

thomthom commented 10 years ago

The thing here is that SketchUp isn't a solid modeller. It's a surface modeller so it deals with polygons on an individual level. The orientation of a face depend on the order of the points you create the face with. You can try this by drawing a shape clock-wise and counter-clockwise and see the difference. (Except when drawing on the ground - special SketchUp magic happens there.)

Other software packages that let you model surfaces like SketchUp usually doesn't display the backside of faces. It'll be transparent so you'd see through it - therefore you'd have to address the issue. SketchUp on the other hand has taken a different approach and make the face visible from either side, regardless. This can often be convenient as often you just want it to look nice so you don't care about "direction" of the face.

But outside of the SketchUp world applications are often more strict so it matters more when you are exporting - especially solids. In general it pays to keep track of the front side and back side of a face and make sure they are oriented. Tools will generally work better as the geometry is more predictable. You'll often see users of rendering engines run into this when they use displacement maps as the displacement will happen in the direction (normal) of the face.

So this isn't actually a bug in the SketchUp system - it's a side-effect of how SketchUp is a surface polygon modeller which puts some responsibility on the user to orient the faces. Many users will create a special "modelling" style where they switch to monocrome view and set the backside colour bright red. That way you see quickly when a face is not pointing in the incorrect direction.

Kcalvin commented 10 years ago

Thom Thom,

OK I get it. Wonderful advice and direction for me on future file prep for 3D printing. Interesting this issue was never mentioned in the instructional videos I found on preparing a file for 3D printing. Another interesting thing we found is that exporting a component to .stl with a hidden face creates problems. Entity info indicates component as solid and solid inspector finds no errors. Yet I'm told by the folks doing the printing that the .stl file is not providing them with watertight geometry. So the take-away is that in addition to solid verification, a careful visual inspection of all faces--not just for being reversed, but also hidden is needed prior to export.

We're getting there!

Thanks a million.

Kris

On Wed, May 14, 2014 at 12:05 PM, Thomas Thomassen <notifications@github.com

wrote:

The thing here is that SketchUp isn't a solid modeller. It's a surface modeller so it deals with polygons on an individual level. The orientation of a face depend on the order of the points you create the face with. You can try this by drawing a shape clock-wise and counter-clockwise and see the difference. (Except when drawing on the ground - special SketchUp magic happens there.)

Other software packages that let you model surfaces like SketchUp usually doesn't display the backside of faces. It'll be transparent so you'd see through it - therefore you'd have to address the issue. SketchUp on the other hand has taken a different approach and make the face visible from either side, regardless. This can often be convenient as often you just want it to look nice so you don't care about "direction" of the face.

But outside of the SketchUp world applications are often more strict so it matters more when you are exporting - especially solids. In general it pays to keep track of the front side and back side of a face and make sure they are oriented. Tools will generally work better as the geometry is more predictable. You'll often see users of rendering engines run into this when they use displacement maps as the displacement will happen in the direction (normal) of the face.

So this isn't actually a bug in the SketchUp system - it's a side-effect of how SketchUp is a surface polygon modeller which puts some responsibility on the user to orient the faces. Many users will create a special "modelling" style where they switch to monocrome view and set the backside colour bright red. That way you see quickly when a face is not pointing in the incorrect direction.

— Reply to this email directly or view it on GitHubhttps://github.com/SketchUp/sketchup-stl/issues/138#issuecomment-43123417 .

Earthwood Timber Frame Homes 148 W Barclay Dr. Sisters, OR 97759 W- 541.549.0924 C- 541.408.5949

www.earthwoodhomes.com www.fishermansquay.com

thomthom commented 10 years ago

Ah, visibility of entities - hadn't thought of that. I'll add that as an issue.