-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathSTLTemplate.bt
executable file
·57 lines (50 loc) · 1.25 KB
/
STLTemplate.bt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//--------------------------------------
//--- 010 Editor v3.0.5 Binary Template
//
// File: STLTemplate.bt
// Author: ZiZi
// E-mail: [email protected]
// Revision: 1.2
// Purpose: Defines a template for
// parsing STL 3D-data files.
//-----------------------------------
typedef struct {
CHAR Caption[80];
DWORD trCount;
} STLFILEHEADER <read=STLFILEHEADERRead>;
string STLFILEHEADERRead(STLFILEHEADER &x)
{
return x.Caption;
};
typedef struct {
FLOAT x;
FLOAT y;
FLOAT z;
} tVector3f <read=tVector3fRead>;
string tVector3fRead( tVector3f &v ) {
string s;
SPrintf( s, "(%6.2f %6.2f %6.2f)", v.x, v.y, v.z );
return s;
};
typedef struct {
tVector3f Normal;
tVector3f Point0;
tVector3f Point1;
tVector3f Point2;
WORD Flags <format=hex>;
} STLTRIANGLE;
//---------------------------------------------
LittleEndian();
SetBackColor( cLtAqua );
local CHAR text_sign[5];
ReadBytes( text_sign, FTell(), 5);
if (text_sign=="solid")
{
Warning("Is ASCII STL");
return;
}
STLFILEHEADER stlh;
SetBackColor( cNone );
local int64 n=(FileSize()-84)/50;
if (stlh.trCount!=n) Warning("File corrupted: stlh.trCount must be equal %Ld", n);
STLTRIANGLE Data[n];