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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
//------------------------------------------------
//--- 010 Editor v8.0.1 Binary Template
//
// File: ctb, cbddlp, photon
// Authors: Tiago Conceição
//------------------------------------------------
LittleEndian();
struct HEADER {
uint Magic <fgcolor=cBlack, bgcolor=cRed>;
uint Version <fgcolor=cBlack, bgcolor=cRed>;
float BedSizeX <fgcolor=cBlack, bgcolor=cRed>;
float BedSizeY <fgcolor=cBlack, bgcolor=cRed>;
float BedSizeZ <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown1 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown2 <fgcolor=cBlack, bgcolor=cRed>;
float TotalHeightMilimeter <fgcolor=cBlack, bgcolor=cRed>;
float LayerHeightMilimeter <fgcolor=cBlack, bgcolor=cRed>;
float LayerExposureSeconds <fgcolor=cBlack, bgcolor=cRed>;
float BottomExposureSeconds <fgcolor=cBlack, bgcolor=cRed>;
float LightOffDelay <fgcolor=cBlack, bgcolor=cRed>;
uint BottomLayersCount <fgcolor=cBlack, bgcolor=cRed>;
uint ResolutionX <fgcolor=cBlack, bgcolor=cRed>;
uint ResolutionY <fgcolor=cBlack, bgcolor=cRed>;
uint PreviewLargeOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint LayersDefinitionOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint LayerCount <fgcolor=cBlack, bgcolor=cRed>;
uint PreviewSmallOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint PrintTime <fgcolor=cBlack, bgcolor=cRed>;
uint ProjectorType <fgcolor=cBlack, bgcolor=cRed>;
uint PrintParametersOffsetAddress <fgcolor=cBlack, bgcolor=cRed>;
uint PrintParametersSize <fgcolor=cBlack, bgcolor=cRed>;
uint AntiAliasLevel <fgcolor=cBlack, bgcolor=cRed>;
ushort LightPWM <fgcolor=cBlack, bgcolor=cRed>;
ushort BottomLightPWM <fgcolor=cBlack, bgcolor=cRed>;
uint EncryptionKey <fgcolor=cBlack, bgcolor=cRed>;
uint SlicerOffset <fgcolor=cBlack, bgcolor=cRed>;
uint SlicerSize <fgcolor=cBlack, bgcolor=cRed>;
} header;
struct PREVIEW {
uint ResolutionX <fgcolor=cBlack, bgcolor=cRed>;
uint ResolutionY <fgcolor=cBlack, bgcolor=cRed>;
uint ImageOffset <fgcolor=cBlack, bgcolor=cRed>;
uint ImageLength <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown1 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown2 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown3 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown4 <fgcolor=cBlack, bgcolor=cRed>;
byte Data[ImageLength] <fgcolor=cBlack, bgcolor=cRed>;
};
struct PRINT_PARAMETERS {
float BottomLiftHeight <fgcolor=cBlack, bgcolor=cRed>;
float BottomLiftSpeed <fgcolor=cBlack, bgcolor=cRed>;
float LiftHeight <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed <fgcolor=cBlack, bgcolor=cRed>;
float VolumeMl <fgcolor=cBlack, bgcolor=cRed>;
float WeightG <fgcolor=cBlack, bgcolor=cRed>;
float CostDollars <fgcolor=cBlack, bgcolor=cRed>;
float BottomLightOffDelay <fgcolor=cBlack, bgcolor=cRed>;
float LightOffDelay <fgcolor=cBlack, bgcolor=cRed>;
uint BottomLayerCount <fgcolor=cBlack, bgcolor=cRed>;
uint Padding1 <fgcolor=cBlack, bgcolor=cRed>;
uint Padding2 <fgcolor=cBlack, bgcolor=cRed>;
uint Padding3 <fgcolor=cBlack, bgcolor=cRed>;
uint Padding4 <fgcolor=cBlack, bgcolor=cRed>;
};
struct SLICER_INFO {
float BottomLiftDistance2 <fgcolor=cBlack, bgcolor=cRed>;
float BottomLiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float LiftHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterLift <fgcolor=cBlack, bgcolor=cRed>;
uint MachineNameAddress <fgcolor=cBlack, bgcolor=cRed>;
uint MachineNameSize <fgcolor=cBlack, bgcolor=cRed>;
uint EncryptionMode <fgcolor=cBlack, bgcolor=cRed>; // 0/8 for cbddlp files, 0xF (15) for ctb files, 0x2000000F (536870927) for v3 ctb and 1073741839 for v4 ctb files to allow per layer parameters
uint MysteriousId <fgcolor=cBlack, bgcolor=cRed>; // v3 = 305419896 | v4 lightoff? = 27093086 | v4 rest? = 27093090
uint AntiAliasLevel <fgcolor=cBlack, bgcolor=cRed>;
uint SoftwareVersion <fgcolor=cBlack, bgcolor=cRed>; // ctb v3 = 17171200 | ctb v4 pro = 16777216
float RestTimeAfterRetract <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterLift2 <fgcolor=cBlack, bgcolor=cRed>;
uint TransitionLayerCount <fgcolor=cBlack, bgcolor=cRed>;
uint Padding1 <fgcolor=cBlack, bgcolor=cRed>;
uint Padding2 <fgcolor=cBlack, bgcolor=cRed>;
uint Padding3 <fgcolor=cBlack, bgcolor=cRed>;
if(MachineNameAddress > 0 && MachineNameSize > 0)
{
char MachineName[MachineNameSize] <fgcolor=cBlack, bgcolor=cRed>;
}
};
if(header.PreviewLargeOffsetAddress > 0)
{
FSeek(header.PreviewLargeOffsetAddress);
PREVIEW previewLarge <fgcolor=cBlack, bgcolor=cYellow>;
}
if(header.PreviewSmallOffsetAddress > 0)
{
FSeek(header.PreviewSmallOffsetAddress);
PREVIEW previewSmall <fgcolor=cBlack, bgcolor=cYellow>;
}
if(header.PrintParametersOffsetAddress > 0){
FSeek(header.PrintParametersOffsetAddress);
PRINT_PARAMETERS parameters <fgcolor=cBlack, bgcolor=cYellow>;
}
if(header.SlicerOffset > 0){
FSeek(header.SlicerOffset);
SLICER_INFO SlicerInfo <fgcolor=cBlack, bgcolor=cYellow>;
}
if(header.Version >= 4)
{
struct PRINT_PARAMETERS_V4
{
char Disclaimer[320] <fgcolor=cBlack, bgcolor=cYellow>;
float BottomRetractSpeed <fgcolor=cWhite, bgcolor=cBlue>;
float BottomRetractSpeed2 <fgcolor=cWhite, bgcolor=cBlue>;
uint Padding1 <fgcolor=cWhite, bgcolor=cBlue>;
float Four1 <fgcolor=cWhite, bgcolor=cBlue>; // 4?
uint Padding2 <fgcolor=cWhite, bgcolor=cBlue>;
float Four2 <fgcolor=cWhite, bgcolor=cBlue>; // 4?
float RestTimeAfterRetract <fgcolor=cWhite, bgcolor=cBlue>;
float RestTimeAfterLift <fgcolor=cWhite, bgcolor=cBlue>;
float RestTimeBeforeLift <fgcolor=cWhite, bgcolor=cBlue>;
float BottomRetractHeight2 <fgcolor=cWhite, bgcolor=cBlue>;
float Unknown1 <fgcolor=cWhite, bgcolor=cBlue>; // 2955.996 or uint:1161347054 but changes
uint Unknown2 <fgcolor=cWhite, bgcolor=cBlue>; // 73470 but changes
uint Unknown3 <fgcolor=cWhite, bgcolor=cBlue>; // 5?
uint Unknown4 <fgcolor=cWhite, bgcolor=cBlue>; // 139 but changes
uint Padding3 <fgcolor=cWhite, bgcolor=cBlue>;
uint Padding4 <fgcolor=cWhite, bgcolor=cBlue>;
uint Padding5 <fgcolor=cWhite, bgcolor=cBlue>;
uint Padding6 <fgcolor=cWhite, bgcolor=cBlue>;
uint Unknown5 <fgcolor=cWhite, bgcolor=cBlue>; // 23047 but changes
uint Unknown6 <fgcolor=cWhite, bgcolor=cBlue>; // 320 but changes
byte Reserved[420] <fgcolor=cWhite, bgcolor=cBlue>;
} printParametersV4;
}
typedef struct() {
float LayerPositionZ <fgcolor=cBlack, bgcolor=cRed>;
float LayerExposure <fgcolor=cBlack, bgcolor=cRed>;
float LightOffSeconds <fgcolor=cBlack, bgcolor=cRed>;
uint DataAddress <fgcolor=cBlack, bgcolor=cRed>;
uint DataSize <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown1 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown2 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown3 <fgcolor=cBlack, bgcolor=cRed>;
uint Unknown4 <fgcolor=cBlack, bgcolor=cRed>;
} LAYER_DATA;
typedef struct() {
LAYER_DATA LayerData <fgcolor=cBlack, bgcolor=cRed>;
uint TotalSize <fgcolor=cBlack, bgcolor=cRed>;
float LiftHeight <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed <fgcolor=cBlack, bgcolor=cRed>;
float LiftHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float LiftSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed <fgcolor=cBlack, bgcolor=cRed>;
float RetractHeight2 <fgcolor=cBlack, bgcolor=cRed>;
float RetractSpeed2 <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeBeforeLift <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterLift <fgcolor=cBlack, bgcolor=cRed>;
float RestTimeAfterRetract <fgcolor=cBlack, bgcolor=cRed>;
float LightPWM <fgcolor=cBlack, bgcolor=cRed>;
} LAYER_DATAEX;
typedef struct(int size) {
byte layerDataBlock[size] <fgcolor=cBlack, bgcolor=cGreen>;
} LAYER_RLE;
FSeek(header.LayersDefinitionOffsetAddress);
struct LAYERS {
local int aa;
local int i;
local uint currentPos;
for( aa = 0; aa < header.AntiAliasLevel; aa++)
{
for( i = 0; i < header.LayerCount; i++ ){
LAYER_DATA layerData <fgcolor=cBlack, bgcolor=cYellow>;
currentPos = FTell();
if(header.Version >= 3)
{
FSeek(layerData.DataAddress - 84);
LAYER_DATAEX layerDataEx;
}
FSeek(layerData.DataAddress);
LAYER_RLE layerRLE(layerData.DataSize);
FSeek(currentPos);
}
}
} layers;
|