encima / encima/jsc3d

[PATCH INCLUDED] Binary STLs entitled 'solid ...' trigger ascii STL loader

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
HTML
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
1. get Build_plate.stl from http://www.thingiverse.com/thing:12890
2. feed to jsc3d

due to my naive test, jsc3d thinks this is an ascii STL when really it's a
binary STL entitled 'solid Build Plate'

--- jsc3d.js 2011-10-28 14:39:03.277821883 +1100
+++ ../../webskein/jsc3d.js 2011-10-28 14:52:34.491680315 +1100
@@ -4170,8 +4170,8 @@
mesh.vertexBuffer = [];
mesh.indexBuffer = [];
mesh.faceNormalBuffer = [];

- if (data.substring(0, 5).toLowerCase() == 'solid') {
+ if (data.match(/^solid[\s\S]*facet\s*normal/i)) {
/*
we have an ASCII STL file.

perhaps it would be better to run the full face pattern against it rather than
this small snippet? Otherwise we'll still have this bug with binary STLs
entitled 'solid .... facet normal'.
```

Original issue reported on code.google.com by `triffid....@gmail.com` on 28 Oct 2011 at 4:02

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.