Could not load an STL file in 3D Viewer

When I try to import an STL into 3D Viewer I receive a window saying: “Could not load file” and gives the directory to the file. The log says: “Looks like an ASCII STL”.
The error message in the console is as followed:

java.lang.NullPointerException
	at ij3d.ContentCreator.createContent(ContentCreator.java:106)
	at ij3d.ContentCreator.createContent(ContentCreator.java:98)
	at ij3d.Image3DUniverse.createContent(Image3DUniverse.java:1195)
	at ij3d.Image3DUniverse.addContentLater(Image3DUniverse.java:1776)
	at ij3d.Executer.importFile(Executer.java:260)
	at ij3d.Executer.importSTL(Executer.java:275)
	at ij3d.Image3DMenubar.actionPerformed(Image3DMenubar.java:602)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:376)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:833)
	at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:877)
	at java.awt.Component.processMouseEvent(Component.java:6535)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
	at java.awt.Component.processEvent(Component.java:6300)
	at java.awt.Container.processEvent(Container.java:2236)
	at java.awt.Component.dispatchEventImpl(Component.java:4891)
	at java.awt.Container.dispatchEventImpl(Container.java:2294)
	at java.awt.Component.dispatchEvent(Component.java:4713)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
	at java.awt.Container.dispatchEventImpl(Container.java:2280)
	at java.awt.Window.dispatchEventImpl(Window.java:2750)
	at java.awt.Component.dispatchEvent(Component.java:4713)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
	at java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.awt.EventQueue$3.run(EventQueue.java:709)
	at java.awt.EventQueue$3.run(EventQueue.java:703)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.awt.EventQueue$4.run(EventQueue.java:731)
	at java.awt.EventQueue$4.run(EventQueue.java:729)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

The object is as followed, I am able to upload the same structure without the ‘fillet’ smoothing to make it appear more cylinderical. Though I never had any of these problems until recently, not sure what changed.

Try to open it in the software Blender and then export it again as a *.stl or *.obj file which can be opened by the 3D viewer, see:

If you send the STL I can check it as well. I’ve seen this happen before, and I think it had to do with specific conditions in the geometries of the mesh.

the STL was sent to your email.

I tried opening them up in Blender but the files didn’t show in the directory for some reason.

What produced this STL?

@Bio7’s solution is right, because this STL actually breaks a convention. If you pop it open in a text editor, then you’ll see a bunch of garbage and a leading line that starts with the word “solid”. The convention for binary STLs is to never begin the 80 character header with the word “solid” (indeed, you can see this is how 3D viewer checks if an STL is ASCII or not).

I’ve replied via email with a properly formed version of this STL.

1 Like

That’s so odd, I produced this .stl in Solidworks. Plus Blender, doesn’t seem to be able to see the files in the directory. So is there another method, so I don’t run into this problem again?

I generally find meshlab more useful than blender for these things.

This issue has come up other places, and there seems to be a suggested solution on the STL reader side here.

2 Likes

Hi, i am new to this forum

i have used 3D Viewer to open an Stl file,
i keep receiving errors, i open it with Blender and Meshlab and exported it as stl file but i still getting the same errors from 3D Viewer. Please could anyone help? Thanks in advance

this is the error

[INFO] Reading available sites from https://imagej.net/
3D [dev] 1.6.0-scijava-2-pre11-daily-experimental daily

Exception in thread “Thread-8” java.lang.NullPointerException
at ij3d.ContentCreator$HyperStackIterator.(ContentCreator.java:280)
at ij3d.ContentCreator$HyperStackIterator.getIterable(ContentCreator.java:267)
at ij3d.ContentCreator$FileIterator.getIterable(ContentCreator.java:207)
at ij3d.ContentCreator.getImages(ContentCreator.java:183)
at ij3d.gui.ContentCreatorDialog.createContent(ContentCreatorDialog.java:177)
at ij3d.gui.ContentCreatorDialog.showDialog(ContentCreatorDialog.java:163)
at ij3d.Executer.addC(Executer.java:202)
at ij3d.Executer.access$000(Executer.java:97)
at ij3d.Executer$1.run(Executer.java:195)
Exception in thread “Thread-9” java.lang.NullPointerException
at ij3d.ContentCreator$HyperStackIterator.(ContentCreator.java:280)
at ij3d.ContentCreator$HyperStackIterator.getIterable(ContentCreator.java:267)
at ij3d.ContentCreator$FileIterator.getIterable(ContentCreator.java:207)
at ij3d.ContentCreator.getImages(ContentCreator.java:183)
at ij3d.gui.ContentCreatorDialog.createContent(ContentCreatorDialog.java:177)
at ij3d.gui.ContentCreatorDialog.showDialog(ContentCreatorDialog.java:163)
at ij3d.Executer.addC(Executer.java:202)
at ij3d.Executer.access$000(Executer.java:97)
at ij3d.Executer$1.run(Executer.java:195)