Skip to content

Commit

Permalink
// the split cna fail on binary stls
Browse files Browse the repository at this point in the history
  • Loading branch information
madhephaestus committed Jul 29, 2024
1 parent 1b53766 commit 2f1e543
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/main/java/eu/mihosoft/vrl/v3d/ext/imagej/STLLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ public ArrayList<Point3f> parse(File f) throws IOException {
// determine if this is a binary or ASCII STL
// and send to the appropriate parsing method
// Hypothesis 1: this is an ASCII STL
BufferedReader br = new BufferedReader(new FileReader(f));
String line = br.readLine();
String[] words = line.trim().split("\\s+");
if (line.indexOf('\0') < 0 && words[0].equalsIgnoreCase("solid")) {
//System.out.println("Looks like an ASCII STL");
parseAscii(f);
br.close();
return vertices;
}
br.close();
try { BufferedReader br = new BufferedReader(new FileReader(f));
String line = br.readLine();
String[] words = line.trim().split("\\s+");
if (line.indexOf('\0') < 0 && words[0].equalsIgnoreCase("solid")) {
//System.out.println("Looks like an ASCII STL");
parseAscii(f);
br.close();
return vertices;
}
br.close();}catch(java.lang.NullPointerException ex) {}// the split cna fail on binary stls
// Hypothesis 2: this is a binary STL
FileInputStream fs = new FileInputStream(f);

Expand Down

0 comments on commit 2f1e543

Please sign in to comment.