public class StlMeshImporter extends java.lang.Object implements Importer
A JavaFX importer for ASCII and binary STL files.
For further details see the package page.
Import process
Prepare the importer (opt.) | Read the file | React (opt.) | Access the imported data | Clean up (recom'd) |
Sample code
Following structure of the application-jar is assumed:
../app/MyApp.class
../app/resources/MyModel.stl
StlMeshImporter stlImporter = new StlMeshImporter(); try { URL modelUrl = this.getClass().getResource("resources/MyModel.stl"); stlImporter.read(modelUrl); } catch (ImportException e) { // handle exception } TriangleMesh stlMesh = stlImporter.getImport();
Constructor and Description |
---|
StlMeshImporter()
Creates a STL mesh importer.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Disposes of the imported data.
|
void |
close()
Disposes of the imported data and closes the importer.
|
double |
getCreaseAngle()
Gets the crease angle for normals generation measured in degrees.
|
javafx.scene.shape.TriangleMesh |
getImport()
Gets the TriangleMesh from the imported file.
|
java.util.EnumSet<StlImportOption> |
getOptions()
Gets a copy of the import options enum set.
|
java.lang.String |
getSolidName()
Gets the solid name from the imported ASCII file or
the header from the imported binary file.
|
void |
onFileImported()
Method is invoked upon completion of import.
|
void |
read(java.io.File file)
Imports a 3D model file passed as a File object.
|
void |
read(java.lang.String filePath)
Imports a 3D model file with the passed file path.
|
void |
read(java.net.URL url)
Imports a 3D model file from the passed location.
|
void |
setCreaseAngle(double degrees)
Sets the crease angle for normals generation measured in degrees.
|
void |
setOptions(java.util.EnumSet<StlImportOption> options)
Sets the import options.
|
void |
setOptions(StlImportOption... options)
Sets the import options.
|
public double getCreaseAngle()
Default value: 45
getCreaseAngle
in interface Importer
public void setCreaseAngle(double degrees)
Default value: 45
setCreaseAngle
in interface Importer
degrees
- crease angle for generating normalspublic java.util.EnumSet<StlImportOption> getOptions()
StlImportOption.NONE
.public void setOptions(StlImportOption... options)
StlImportOption.NONE
.options
- a sequence or an array of import optionsjava.lang.IllegalArgumentException
- if options is null
, its length is 0, or
StlImportOption.NONE
is not the sole elementpublic void setOptions(java.util.EnumSet<StlImportOption> options)
StlImportOption.NONE
.options
- enum set of import optionsjava.lang.IllegalArgumentException
- if options is null
, its size is 0, or
StlImportOption.NONE
is not the sole elementpublic void read(java.io.File file)
public void read(java.lang.String filePath)
public void read(java.net.URL url)
public void onFileImported()
onFileImported
in interface Importer
public javafx.scene.shape.TriangleMesh getImport()
public java.lang.String getSolidName()
null
if no TriangleMesh is importedpublic void clear()
Copyright (C) 2013-2014 InteractiveMesh e.K.