大修参数,改prusa版本到2.9.4

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-29 01:01:24 +08:00
parent 2dbecfe0d4
commit 72e3a165ac
21 changed files with 402 additions and 306 deletions

3
.gitignore vendored
View File

@@ -3,4 +3,5 @@ uploads/*
tmp/*
venv
instance
huey_queue.*
huey_queue.*
prusaslicer/*

79
502_err.html Normal file
View File

@@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>502 - AIO 切片服务器未连接</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: #f8f9fa;
color: #333;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.container {
background: #fff;
padding: 40px;
border-radius: 10px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
max-width: 500px;
text-align: center;
}
.icon {
font-size: 60px;
margin-bottom: 20px;
}
h1 {
font-size: 24px;
margin-bottom: 15px;
color: #dc3545;
}
p {
font-size: 16px;
line-height: 1.6;
margin-bottom: 20px;
color: #555;
text-align: left;
}
.suggestions {
background: #f1f3f5;
padding: 15px;
border-radius: 6px;
text-align: left;
font-size: 14px;
}
.suggestions ul {
margin: 10px 0 0 0;
padding-left: 20px;
}
.suggestions li {
margin-bottom: 8px;
}
</style>
</head>
<body>
<div class="container">
<div class="icon">🔌</div>
<h1>AIO 切片服务器连接失败 (502)</h1>
<p>非常抱歉,公共代理服务器目前无法连接到后端的树莓派 AIO 切片服务。这通常是由于物理设备离线或网络异常导致的。</p>
<div class="suggestions">
<strong>可能的原因:</strong>
<ul>
<li>树莓派尚未通电或正在启动中。</li>
<li>树莓派所在的局域网断网,或未能成功连接到互联网。</li>
</ul>
<strong>建议操作:</strong>
<ul>
<li>请检查机器电源,稍等片刻后刷新页面重试。</li>
<li>若问题仍然存在,请<strong>联系管理员</strong>检查网络配置。</li>
<li>在局域网失效时,您可以尝试通过连接<strong>树莓派的本地热点</strong>直接进行文件传输。</li>
</ul>
</div>
</div>
</body>
</html>

View File

@@ -225,5 +225,16 @@
"Slicing Engine Configurations": "Slicer-Engine-Konfigurationen",
"Slicing Engine": "Slicer-Engine",
"Select the engine to be used globally. Ensure the selected engine is installed and accessible on the server.": "Wählen Sie die Engine aus, die global verwendet werden soll. Stellen Sie sicher, dass die ausgewählte Engine installiert und auf dem Server zugänglich ist.",
"Material Profile": "Materialprofil"
"Material Profile": "Materialprofil",
"Custom": "Benutzerdefiniert",
"Skirt/Brim": "Sürz / Rand",
"Support material": "Stützmaterial",
"Perimeter": "Umriss",
"External perimeter": "Externer Umriss",
"Solid infill": "Solide Füllung",
"Overhang perimeter": "Überhang Umriss",
"Internal infill": "Interne Füllung",
"Bridge infill": "Brückefüllung",
"Top solid infill": "Oberste solide Füllung",
"Others": "Andere"
}

View File

@@ -225,5 +225,16 @@
"Slicing Engine Configurations": "Slicing Engine Configurations",
"Slicing Engine": "Slicing Engine",
"Select the engine to be used globally. Ensure the selected engine is installed and accessible on the server.": "Select the engine to be used globally. Ensure the selected engine is installed and accessible on the server.",
"Material Profile": "Material Profile"
"Material Profile": "Material Profile",
"Custom": "Custom",
"Skirt/Brim": "Skirt/Brim",
"Support material": "Support material",
"Perimeter": "Perimeter",
"External perimeter": "External perimeter",
"Solid infill": "Solid infill",
"Overhang perimeter": "Overhang perimeter",
"Internal infill": "Internal infill",
"Bridge infill": "Bridge infill",
"Top solid infill": "Top solid infill",
"Others": "Others"
}

View File

@@ -225,5 +225,16 @@
"Slicing Engine Configurations": "切片引擎配置",
"Slicing Engine": "切片引擎",
"Select the engine to be used globally. Ensure the selected engine is installed and accessible on the server.": "选择要全局使用的引擎。确保所选引擎已安装且在服务器上可访问。",
"Material Profile": "材料配置"
"Material Profile": "材料配置",
"Custom": "自定义",
"Skirt/Brim": "裙边",
"Support material": "支撑材料",
"Perimeter": "轮廓",
"External perimeter": "外部轮廓",
"Solid infill": "实体填充",
"Overhang perimeter": "悬垂轮廓",
"Internal infill": "内部填充",
"Bridge infill": "桥接填充",
"Top solid infill": "顶部实体填充",
"Others": "其他"
}

View File

@@ -21,15 +21,7 @@
<div id="canvas-container" class="w-100 h-100 d-block overflow-hidden"></div>
<!-- Legend Overlay -->
<div class="position-absolute top-0 start-0 m-3 p-2 rounded shadow bg-dark bg-opacity-75 border border-secondary" style="color: #eee; font-size: 0.85rem; pointer-events: auto; z-index: 10;">
<div class="mb-1 legend-item user-select-none" data-type="WALL-OUTER" style="cursor: pointer; transition: opacity 0.2s;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #eb8b38;"></span>{{ _('Outer Wall') }}</div>
<div class="mb-1 legend-item user-select-none" data-type="WALL-INNER" style="cursor: pointer; transition: opacity 0.2s;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #4080cf;"></span>{{ _('Inner Wall') }}</div>
<div class="mb-1 legend-item user-select-none" data-type="FILL" style="cursor: pointer; transition: opacity 0.2s;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #ccc04b;"></span>{{ _('Infill') }}</div>
<div class="mb-1 legend-item user-select-none" data-type="SKIN" style="cursor: pointer; transition: opacity 0.2s;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #9e60b3;"></span>{{ _('Skin/TopBottom') }}</div>
<div class="mb-1 legend-item user-select-none" data-type="SUPPORT" style="cursor: pointer; transition: opacity 0.2s;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #57b357;"></span>{{ _('Support') }}</div>
<div class="mb-1 legend-item user-select-none" data-type="SKIRT" style="cursor: pointer; transition: opacity 0.2s;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #00ffff;"></span>{{ _('Skirt') }}</div>
<div class="mb-1 legend-item user-select-none" data-type="SUPPORT-INTERFACE" style="cursor: pointer; transition: opacity 0.2s;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #2b6b2b;"></span>{{ _('Support Interface') }}</div>
<div class="mb-1 legend-item user-select-none" data-type="TRAVEL" style="cursor: pointer; transition: opacity 0.2s; opacity: 0.4;"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: #405060;"></span>{{ _('Travel (Move)') }}</div>
<div id="legend-overlay" class="position-absolute top-0 start-0 m-3 p-2 rounded shadow bg-dark bg-opacity-75 border border-secondary" style="color: #eee; font-size: 0.85rem; pointer-events: auto; z-index: 10;">
</div>
<!-- Bottom Slider (Intra-Layer Progress) -->
@@ -57,34 +49,6 @@
<script>
document.addEventListener('DOMContentLoaded', async function() {
const COLORS = {
'WALL-OUTER': new THREE.Color(0xeb8b38),
'WALL-INNER': new THREE.Color(0x4080cf),
'FILL': new THREE.Color(0xccc04b),
'SKIN': new THREE.Color(0x9e60b3),
'SUPPORT': new THREE.Color(0x57b357),
'SKIRT': new THREE.Color(0x00ffff),
'SUPPORT-INTERFACE': new THREE.Color(0x2b6b2b),
'TRAVEL': new THREE.Color(0x405060),
'DEFAULT': new THREE.Color(0xaaaaaa)
};
// Additional aliases mapped to basic COLORS
const COLOR_ALIASES = {
'External perimeter': COLORS['WALL-OUTER'],
'Overhang perimeter': COLORS['WALL-OUTER'],
'Perimeter': COLORS['WALL-INNER'],
'Internal infill': COLORS['FILL'],
'Solid infill': COLORS['FILL'],
'Top solid infill': COLORS['FILL'],
'Bridge infill': COLORS['FILL'],
'Support material': COLORS['SUPPORT'],
'Skirt/Brim': COLORS['SKIRT'],
'Support material interface': COLORS['SUPPORT-INTERFACE']
};
// Merge aliases into COLORS
Object.assign(COLORS, COLOR_ALIASES);
// Inject printer machine dimensions via Jinja
const bedWidth = {{ machine_width | default(220) }};
@@ -94,29 +58,39 @@ document.addEventListener('DOMContentLoaded', async function() {
const offsetY = {{ offset_y | default(0.0) }};
// Type indices for shader visibility filtering
const TYPE_INDEX = {
'TRAVEL': 0, 'WALL-OUTER': 1, 'WALL-INNER': 2,
'FILL': 3, 'SKIN': 4, 'SUPPORT': 5, 'DEFAULT': 6,
'SKIRT': 7, 'SUPPORT-INTERFACE': 8
};
let COLORS = {};
let TYPE_INDEX = {};
let gcodeMat = null;
// Aliases for TYPE_INDEX
const TYPE_INDEX_ALIASES = {
'External perimeter': 1,
'Overhang perimeter': 1,
'Perimeter': 2,
'Internal infill': 3,
'Solid infill': 3,
'Top solid infill': 3,
'Bridge infill': 3,
'Support material': 5,
'Skirt/Brim': 7,
'Support material interface': 8
const SLICER_CONFIGS = {
'Cura': [
{ id: 'TRAVEL', label: '{{ _("Travel (Move)") }}', color: 0x405060, defaultShow: false },
{ id: 'WALL-OUTER', label: '{{ _("Outer Wall") }}', color: 0xeb8b38, defaultShow: true },
{ id: 'WALL-INNER', label: '{{ _("Inner Wall") }}', color: 0x4080cf, defaultShow: true },
{ id: 'FILL', label: '{{ _("Infill") }}', color: 0xccc04b, defaultShow: true },
{ id: 'SKIN', label: '{{ _("Skin/TopBottom") }}', color: 0x9e60b3, defaultShow: true },
{ id: 'SUPPORT', label: '{{ _("Support") }}', color: 0x57b357, defaultShow: true },
{ id: 'SKIRT', label: '{{ _("Skirt") }}', color: 0x00ffff, defaultShow: true },
{ id: 'SUPPORT-INTERFACE', label: '{{ _("Support Interface") }}', color: 0x2b6b2b, defaultShow: true },
{ id: 'DEFAULT', label: '{{ _("Others") }}', color: 0xaaaaaa, defaultShow: true }
],
'Prusa': [
{ id: 'TRAVEL', label: '{{ _("Travel (Move)") }}', color: 0x405060, defaultShow: false },
{ id: 'Custom', label: '{{ _("Custom") }}', color: 0xd0e0ff, defaultShow: true },
{ id: 'Skirt/Brim', label: '{{ _("Skirt/Brim") }}', color: 0x00FFFF, defaultShow: true },
{ id: 'Support material', label: '{{ _("Support material") }}', color: 0x90EE90, defaultShow: true },
{ id: 'Perimeter', label: '{{ _("Perimeter") }}', color: 0xFFFFE0, defaultShow: true },
{ id: 'External perimeter', label: '{{ _("External perimeter") }}', color: 0xFFA500, defaultShow: true },
{ id: 'Solid infill', label: '{{ _("Solid infill") }}', color: 0x800080, defaultShow: true },
{ id: 'Overhang perimeter', label: '{{ _("Overhang perimeter") }}', color: 0x00008B, defaultShow: true },
{ id: 'Internal infill', label: '{{ _("Internal infill") }}', color: 0x8B0000, defaultShow: true },
{ id: 'Bridge infill', label: '{{ _("Bridge infill") }}', color: 0x0000FF, defaultShow: true },
{ id: 'Top solid infill', label: '{{ _("Top solid infill") }}', color: 0xFF0000, defaultShow: true },
{ id: 'Support material interface', label: '{{ _("Support Interface") }}', color: 0x2b6b2b, defaultShow: true },
{ id: 'DEFAULT', label: '{{ _("Others") }}', color: 0xaaaaaa, defaultShow: true }
]
};
// Merge aliases into TYPE_INDEX
Object.assign(TYPE_INDEX, TYPE_INDEX_ALIASES);
let layers = [];
let scene, camera, renderer, controls;
let group = new THREE.Group();
@@ -125,102 +99,90 @@ document.addEventListener('DOMContentLoaded', async function() {
const layerDisplay = document.getElementById('layer-display');
const progressSlider = document.getElementById('progress-slider');
// Shader material for high-speed dynamic feature visibility
const gcodeMat = new THREE.ShaderMaterial({
uniforms: {
uShowOuter: { value: 1.0 },
uShowInner: { value: 1.0 },
uShowInfill: { value: 1.0 },
uShowSkin: { value: 1.0 },
uShowSupport: { value: 1.0 },
uShowSkirt: { value: 1.0 },
uShowSupportInterface: { value: 1.0 },
uShowTravel: { value: 0.0 },
uShowDefault: { value: 1.0 }
},
vertexShader: `
attribute float pType;
varying vec3 vColor;
varying float vType;
void main() {
vColor = color;
vType = pType;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,
fragmentShader: `
varying vec3 vColor;
varying float vType;
uniform float uShowOuter;
uniform float uShowInner;
uniform float uShowInfill;
uniform float uShowSkin;
uniform float uShowSupport;
uniform float uShowSkirt;
uniform float uShowSupportInterface;
uniform float uShowTravel;
uniform float uShowDefault;
void main() {
float show = 1.0;
int t = int(vType + 0.5);
if (t == 0) show = uShowTravel;
else if (t == 1) show = uShowOuter;
else if (t == 2) show = uShowInner;
else if (t == 3) show = uShowInfill;
else if (t == 4) show = uShowSkin;
else if (t == 5) show = uShowSupport;
else if (t == 7) show = uShowSkirt;
else if (t == 8) show = uShowSupportInterface;
else show = uShowDefault;
if (show < 0.5) discard;
gl_FragColor = vec4(vColor, 1.0);
}
`,
vertexColors: true,
side: THREE.DoubleSide,
linewidth: 1
});
// Binding the Legend Buttons
const uniformMap = {
'WALL-OUTER': 'uShowOuter',
'WALL-INNER': 'uShowInner',
'FILL': 'uShowInfill',
'SKIN': 'uShowSkin',
'SUPPORT': 'uShowSupport',
'SKIRT': 'uShowSkirt',
'SUPPORT-INTERFACE': 'uShowSupportInterface',
'TRAVEL': 'uShowTravel'
};
const uniformMapAliases = {
'External perimeter': 'uShowOuter',
'Overhang perimeter': 'uShowOuter',
'Perimeter': 'uShowInner',
'Internal infill': 'uShowInfill',
'Solid infill': 'uShowInfill',
'Top solid infill': 'uShowInfill',
'Bridge infill': 'uShowInfill',
'Support material': 'uShowSupport',
'Skirt/Brim': 'uShowSkirt',
'Support material interface': 'uShowSupportInterface'
};
Object.assign(uniformMap, uniformMapAliases);
document.querySelectorAll('.legend-item').forEach(el => {
el.addEventListener('click', function() {
const t = this.dataset.type;
const uniformName = uniformMap[t];
if (uniformName) {
const currentVal = gcodeMat.uniforms[uniformName].value;
const newVal = currentVal > 0.5 ? 0.0 : 1.0;
gcodeMat.uniforms[uniformName].value = newVal;
this.style.opacity = newVal > 0.5 ? "1.0" : "0.4";
function setupSlicerConfig(text) {
let slicerType = 'Cura'; // default
if (text.substring(0, 500).includes('generated by PrusaSlicer')) {
slicerType = 'Prusa';
}
const config = SLICER_CONFIGS[slicerType];
// 1. Build uniforms & shader strings dynamically
let uniformsObj = {};
let fragmentUniformsDecl = '';
let fragmentUniformsLogic = '';
let overlayHTML = '';
config.forEach((c, idx) => {
COLORS[c.id] = new THREE.Color(c.color);
TYPE_INDEX[c.id] = idx;
const uniformName = 'uShow' + idx;
uniformsObj[uniformName] = { value: c.defaultShow ? 1.0 : 0.0 };
fragmentUniformsDecl += `uniform float ${uniformName};\n`;
if (idx === 0) {
fragmentUniformsLogic += `if (t == 0) show = ${uniformName};\n`;
} else {
fragmentUniformsLogic += ` else if (t == ${idx}) show = ${uniformName};\n`;
}
// Build Legend UI
const hexColor = '#' + c.color.toString(16).padStart(6, '0');
const opacityStyle = c.defaultShow ? '1.0' : '0.4';
overlayHTML += `
<div class="mb-1 legend-item user-select-none" data-id="${c.id}" data-uniform="${uniformName}" style="cursor: pointer; transition: opacity 0.2s; opacity: ${opacityStyle};"><span class="d-inline-block rounded-circle me-2 border border-dark" style="width: 12px; height: 12px; background: ${hexColor};"></span>${c.label}</div>`;
});
});
// Add fallback condition
fragmentUniformsLogic += ` else show = 1.0;\n`;
document.getElementById('legend-overlay').innerHTML = overlayHTML;
gcodeMat = new THREE.ShaderMaterial({
uniforms: uniformsObj,
vertexShader: `
attribute float pType;
varying vec3 vColor;
varying float vType;
void main() {
vColor = color;
vType = pType;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}
`,
fragmentShader: `
varying vec3 vColor;
varying float vType;
${fragmentUniformsDecl}
void main() {
float show = 1.0;
int t = int(vType + 0.5);
${fragmentUniformsLogic}
if (show < 0.5) discard;
gl_FragColor = vec4(vColor, 1.0);
}
`,
vertexColors: true,
side: THREE.DoubleSide,
linewidth: 1
});
// Legend binding
document.querySelectorAll('.legend-item').forEach(el => {
el.addEventListener('click', function() {
const uniformName = this.dataset.uniform;
if (uniformName && gcodeMat.uniforms[uniformName]) {
const currentVal = gcodeMat.uniforms[uniformName].value;
const newVal = currentVal > 0.5 ? 0.0 : 1.0;
gcodeMat.uniforms[uniformName].value = newVal;
this.style.opacity = newVal > 0.5 ? "1.0" : "0.4";
}
});
});
}
function init3D() {
const container = document.getElementById('canvas-container');
@@ -268,6 +230,7 @@ document.addEventListener('DOMContentLoaded', async function() {
document.getElementById('loading-overlay').classList.add('d-none');
document.getElementById('preview-container').classList.remove('d-none');
setupSlicerConfig(gcodeText);
init3D();
parseGCode(gcodeText);
@@ -299,6 +262,13 @@ document.addEventListener('DOMContentLoaded', async function() {
const lines = text.split('\n');
let current = { x: 0, y: 0, z: 0, e: 0 };
let relativeE = false; // Track M83 (relative) vs M82 (absolute)
// Dynamically compute width and layer height based on gcode info if possible
let extWidth = 0.4;
let layerHeight = 0.2;
let pWidth = extWidth;
let currentTypeStr = 'DEFAULT';
let currentExtrudePoints = [];
@@ -345,12 +315,25 @@ document.addEventListener('DOMContentLoaded', async function() {
if (!chunk) continue;
let upperChunk = chunk.toUpperCase();
if (upperChunk.startsWith(';LAYER:')) {
if (upperChunk.startsWith('M82')) relativeE = false;
else if (upperChunk.startsWith('M83')) relativeE = true;
if (upperChunk.startsWith(';LAYER:') || upperChunk.startsWith(';LAYER_CHANGE')) {
flushLayer();
} else if (upperChunk.startsWith(';LAYER_HEIGHT:')) {
let lh = parseFloat(chunk.substring(14));
if (!isNaN(lh) && lh > 0) layerHeight = lh;
} else if (upperChunk.startsWith(';HEIGHT:')) {
let lh = parseFloat(chunk.substring(8));
if (!isNaN(lh) && lh > 0) layerHeight = lh;
} else if (upperChunk.startsWith(';WIDTH:')) {
let w = parseFloat(chunk.substring(7));
if (!isNaN(w) && w > 0) pWidth = w;
} else if (upperChunk.startsWith(';TYPE:')) {
currentTypeStr = chunk.substring(6).trim();
} else if (chunk.startsWith(';') && COLORS[chunk.substring(1).trim()] !== undefined) {
currentTypeStr = chunk.substring(1).trim();
} else if (upperChunk.startsWith(';') && chunk.includes(' perimeter')) {
// Heuristics for Prusa/Slic3r specific comments like `; External perimeter`
currentTypeStr = chunk.substring(1).trim();
} else if (upperChunk.startsWith(';') && chunk.includes(' infill')) {
// Heuristics for Prusa/Slic3r specific comments like `; Internal infill`
@@ -365,24 +348,35 @@ document.addEventListener('DOMContentLoaded', async function() {
let next = { x: current.x, y: current.y, z: current.z, e: current.e };
let parts = upperChunk.split(/\s+/);
let hasMove = false;
let hasE = false;
let eVal = 0;
for (let p of parts) {
if (p.startsWith('X')) { let v = parseFloat(p.substring(1)); if(!isNaN(v)) { next.x = v; hasMove = true; } }
if (p.startsWith('Y')) { let v = parseFloat(p.substring(1)); if(!isNaN(v)) { next.y = v; hasMove = true; } }
if (p.startsWith('Z')) { let v = parseFloat(p.substring(1)); if(!isNaN(v)) { next.z = v; hasMove = true; } }
if (p.startsWith('E')) { let v = parseFloat(p.substring(1)); if(!isNaN(v)) { next.e = v; } }
if (p.startsWith('E')) { let v = parseFloat(p.substring(1)); if(!isNaN(v)) { eVal = v; hasE = true; } }
}
if (hasMove && !isNaN(next.x) && !isNaN(next.y) && !isNaN(next.z)) {
let isExtrude = (next.e > current.e);
let isExtrude = false;
if (hasE) {
if (relativeE) {
next.e = current.e + eVal;
isExtrude = eVal > 0;
} else {
next.e = eVal;
isExtrude = next.e > current.e;
}
}
// Cura uses G0 for travel generally
if (upperChunk.startsWith('G0') && !upperChunk.includes('E')) isExtrude = false;
let activeType = isExtrude ? currentTypeStr : 'TRAVEL';
// Special case for default aliases like "; External perimeter" which we stored in currentTypeStr
let resolvedType = activeType;
if (isExtrude && Object.keys(COLOR_ALIASES).includes(activeType)) {
resolvedType = activeType;
if (isExtrude && COLORS[activeType] === undefined) {
resolvedType = 'DEFAULT';
}
let col = COLORS[resolvedType] || COLORS['DEFAULT'];
@@ -393,8 +387,8 @@ document.addEventListener('DOMContentLoaded', async function() {
let dy = next.y - current.y;
let dist = Math.sqrt(dx*dx + dy*dy);
if (dist > 0.0001) {
let hw = 0.4 / 2.0; // 0.4mm wire width
let hh = 0.2 / 2.0; // 0.2mm layer height roughly
let hw = pWidth / 2.0;
let hh = layerHeight / 2.0;
let nx = -(dy / dist) * hw;
let ny = (dx / dist) * hw;
@@ -450,15 +444,23 @@ document.addEventListener('DOMContentLoaded', async function() {
for(let k=0; k<6; k++) { currentExtrudeColors.push(col.r*0.8, col.g*0.8, col.b*0.8); currentExtrudeTypes.push(tIdx); }
}
} else {
currentTravelPoints.push(current.x, current.y, current.z);
currentTravelPoints.push(next.x, next.y, next.z);
// Travel lines get slight vertical offset for visibility
let zOff = 0.05;
currentTravelPoints.push(current.x, current.y, current.z + zOff);
currentTravelPoints.push(next.x, next.y, next.z + zOff);
currentTravelColors.push(col.r, col.g, col.b, col.r, col.g, col.b);
currentTravelTypes.push(tIdx, tIdx);
}
current.x = next.x; current.y = next.y; current.z = next.z; current.e = next.e;
// Update E based on parsed G-code execution type
if (hasE) {
if (relativeE) current.e += eVal;
else current.e = eVal;
}
current.x = next.x; current.y = next.y; current.z = next.z;
}
} else if (chunk.startsWith('G92')) {
} else if (upperChunk.startsWith('G92')) {
let parts = chunk.split(/\s+/);
for (let p of parts) {
if (p.startsWith('E')) { let v = parseFloat(p.substring(1)); if(!isNaN(v)) current.e = v; }

View File

@@ -31,7 +31,7 @@ class PrusaSlicerEngine:
try:
# Base command
command = [
"prusa-slicer",
"/home/lhye200/AIO_3D_Print_Exp/prusaslicer/prusa-slicer",
"-g", stl_filepath,
"--output", gcode_filepath
]
@@ -82,7 +82,7 @@ class PrusaSlicerEngine:
tmp_ini_filename = f"tmp_{uuid.uuid4().hex}.ini"
tmp_ini_path = os.path.join(app.config['UPLOAD_FOLDER'], tmp_ini_filename)
# print(all_configs)
print(f'****tmp_ini_path: {tmp_ini_path}')
with open(tmp_ini_path, 'w') as f:
for key, value in all_configs.items():
f.write(f"{key} = {value}\n")

View File

@@ -4,7 +4,9 @@ material_type = petg
[settings]
filament_adhesiveness_category = 300
; filament_adhesiveness_category = 300
idle_temperature = 160
first_layer_bed_temperature = 70
cool_plate_temp = 70
eng_plate_temp = 0
hot_plate_temp = 70

View File

@@ -4,6 +4,8 @@ material_type = pla
[settings]
idle_temperature = 150
first_layer_bed_temperature = 60
cool_plate_temp = 50
eng_plate_temp = 45
hot_plate_temp = 50
@@ -50,7 +52,7 @@ slow_down_layer_time = 6
filament_start_gcode = ;filament start gcode
nozzle_temperature = 190
temperature_vitrification = 100
filament_adhesiveness_category = 100
; filament_adhesiveness_category = 100
nozzle_temperature_range_low = 190
nozzle_temperature_range_high = 240
additional_cooling_fan_speed = 0

View File

@@ -4,7 +4,9 @@ material_type = petg
[settings]
filament_adhesiveness_category = 300
; filament_adhesiveness_category = 300
idle_temperature = 160
first_layer_bed_temperature = 70
cool_plate_temp = 60
eng_plate_temp = 0
hot_plate_temp = 70

View File

@@ -4,6 +4,8 @@ material_type = tpu
[settings]
idle_temperature = 130
first_layer_bed_temperature = 55
cool_plate_temp = 30
eng_plate_temp = 30
hot_plate_temp = 30
@@ -50,7 +52,7 @@ slow_down_layer_time = 12
filament_start_gcode = ;filament start gcode\n
nozzle_temperature = 200
temperature_vitrification = 60
filament_adhesiveness_category = 600
; filament_adhesiveness_category = 600
additional_cooling_fan_speed = 0
nozzle_temperature_range_low = 200
nozzle_temperature_range_high = 250

View File

@@ -4,6 +4,8 @@ material_type = pla
[settings]
idle_temperature = 150
first_layer_bed_temperature = 60
cool_plate_temp = 50
eng_plate_temp = 45
hot_plate_temp = 60
@@ -50,7 +52,7 @@ slow_down_layer_time = 10
filament_start_gcode = ;filament start gcode
nozzle_temperature = 220
temperature_vitrification = 60
filament_adhesiveness_category = 100
; filament_adhesiveness_category = 100
nozzle_temperature_range_low = 200
nozzle_temperature_range_high = 270
additional_cooling_fan_speed = 0

View File

@@ -4,6 +4,8 @@ material_type = pla
[settings]
idle_temperature = 150
first_layer_bed_temperature = 60
cool_plate_temp = 50
eng_plate_temp = 45
hot_plate_temp = 50
@@ -50,7 +52,7 @@ slow_down_layer_time = 14
filament_start_gcode = ;filament start gcode
nozzle_temperature = 220
temperature_vitrification = 60
filament_adhesiveness_category = 100
; filament_adhesiveness_category = 100
nozzle_temperature_range_low = 190
nozzle_temperature_range_high = 240
additional_cooling_fan_speed = 0

View File

@@ -4,7 +4,8 @@ material_type = petg
[settings]
filament_adhesiveness_category = 300
; filament_adhesiveness_category = 300
idle_temperature = 160
cool_plate_temp = 60
eng_plate_temp = 0
hot_plate_temp = 70

View File

@@ -4,6 +4,8 @@ material_type = pla
[settings]
idle_temperature = 150
first_layer_bed_temperature = 60
cool_plate_temp = 50
eng_plate_temp = 45
hot_plate_temp = 50
@@ -50,7 +52,7 @@ slow_down_layer_time = 6
filament_start_gcode = ;filament start gcode
nozzle_temperature = 190
temperature_vitrification = 100
filament_adhesiveness_category = 100
; filament_adhesiveness_category = 100
nozzle_temperature_range_low = 190
nozzle_temperature_range_high = 240
additional_cooling_fan_speed = 0

View File

@@ -4,6 +4,8 @@ material_type = pla
[settings]
idle_temperature = 150
first_layer_bed_temperature = 60
cool_plate_temp = 50
eng_plate_temp = 45
hot_plate_temp = 50
@@ -50,7 +52,7 @@ slow_down_layer_time = 14
filament_start_gcode = ;filament start gcode
nozzle_temperature = 220
temperature_vitrification = 60
filament_adhesiveness_category = 100
; filament_adhesiveness_category = 100
nozzle_temperature_range_low = 190
nozzle_temperature_range_high = 240
additional_cooling_fan_speed = 0

View File

@@ -4,6 +4,8 @@ material_type = pla
[settings]
idle_temperature = 150
first_layer_bed_temperature = 60
cool_plate_temp = 50
eng_plate_temp = 45
hot_plate_temp = 50
@@ -50,7 +52,7 @@ slow_down_layer_time = 12
filament_start_gcode = ;filament start gcode
nozzle_temperature = 220
temperature_vitrification = 60
filament_adhesiveness_category = 100
; filament_adhesiveness_category = 100
nozzle_temperature_range_low = 190
nozzle_temperature_range_high = 240
additional_cooling_fan_speed = 0

View File

@@ -40,62 +40,55 @@ retract_layer_change = 1
retract_length = 0.8
retract_length_toolchange = 1
z_hop = 0.4
z_hop_types = Slope Lift
retract_restart_extra = 0
retract_restart_extra_toolchange = 0
retract_speed = 30
single_extruder_multi_material = 1
change_filament_gcode =
start_filament_gcode = ;Do nothing
wipe = 1
z_hop_types = Slope Lift
before_layer_gcode = ;BEFORE_LAYER_CHANGE\n;[layer_z]\nG92 E0\n
default_print_profile = 0.20mm Standard @Creality Ender-3 V3 SE 0.4 nozzle
machine_start_gcode = M220 S100 ;Reset Feedrate \nM221 S100 ;Reset Flowrate \n \nM140 S[bed_temperature_initial_layer_single] ;Set final bed temp \nG28 ;Home \n \nG92 E0 ;Reset Extruder \nG1 Z2.0 F3000 ;Move Z Axis up \nM104 S[nozzle_temperature_initial_layer] ;Set final nozzle temp \nG1 X-2.1 Y20 Z0.28 F5000.0 ;Move to start position \nM190 S[bed_temperature_initial_layer_single] ;Wait for bed temp to stabilize \nM109 S[nozzle_temperature_initial_layer] ;Wait for nozzle temp to stabilize \nG1 X-2.1 Y145.0 Z0.28 F1500.0 E15 ;Draw the first line \nG1 X-2.4 Y145.0 Z0.28 F5000.0 ;Move to side a little \nG1 X-2.4 Y20 Z0.28 F1500.0 E30 ;Draw the second line \nG92 E0 ;Reset Extruder \nG1 E-1.0000 F1800 ;Retract a bit \nG1 Z2.0 F3000 ;Move Z Axis up \nG1 E0.0000 F1800
machine_end_gcode = G91 ;Relative positionning \nG1 E-2 F2700 ;Retract a bit \nG1 E-2 Z0.2 F2400 ;Retract and raise Z \nG1 X5 Y5 F3000 ;Wipe out \nG1 Z10 ;Raise Z more \nG90 ;Absolute positionning \n \nG1 X0 Y220 ;Present print \nM106 S0 ;Turn-off fan \nM104 S0 ;Turn-off hotend \nM140 S0 ;Turn-off bed \n \nM84 X Y E ;Disable all steppers but Z
start_gcode = M220 S100 ;Reset Feedrate \nM221 S100 ;Reset Flowrate \n \nM140 S{first_layer_bed_temperature[0]} ;Set final bed temp \nG28 ;Home \n \nG92 E0 ;Reset Extruder \nG1 Z2.0 F3000 ;Move Z Axis up \nM104 S{idle_temperature[0]} ;Set final nozzle temp \nG1 X-2.1 Y20 Z0.28 F5000.0 ;Move to start position \nM190 S{first_layer_bed_temperature[0]} ;Wait for bed temp to stabilize \nM109 S{idle_temperature[0]} ;Wait for nozzle temp to stabilize \nG1 X-2.1 Y145.0 Z0.28 F1500.0 E15 ;Draw the first line \nG1 X-2.4 Y145.0 Z0.28 F5000.0 ;Move to side a little \nG1 X-2.4 Y20 Z0.28 F1500.0 E30 ;Draw the second line \nG92 E0 ;Reset Extruder \nG1 E-1.0000 F1800 ;Retract a bit \nG1 Z2.0 F3000 ;Move Z Axis up \nG1 E0.0000 F1800
end_gcode = G91 ;Relative positionning \nG1 E-2 F2700 ;Retract a bit \nG1 E-2 Z0.2 F2400 ;Retract and raise Z \nG1 X5 Y5 F3000 ;Wipe out \nG1 Z10 ;Raise Z more \nG90 ;Absolute positionning \n \nG1 X0 Y220 ;Present print \nM106 S0 ;Turn-off fan \nM104 S0 ;Turn-off hotend \nM140 S0 ;Turn-off bed \n \nM84 X Y E ;Disable all steppers but Z
machine_max_acceleration_travel = 5000,5000
machine_pause_gcode = M25
bed_exclude_area = 0x0
layer_gcode =
scan_first_layer = 0
nozzle_type = brass
auxiliary_fan = 0
pause_print_gcode = M25
after_layer_gcode =
printer_model = Creality Ender-3 V3 SE
printer_structure = i3
bbl_use_printhost = 0
bed_mesh_max = 99999,99999
bed_mesh_min = -99999,-99999
bed_mesh_probe_distance = 50,50
best_object_pos = 0.5,0.5
; printer_structure = i3
; bed_mesh_max = 99999,99999
; bed_mesh_min = -99999,-99999
; bed_mesh_probe_distance = 50,50
; best_object_pos = 0.5,0.5
cooling_tube_length = 5
cooling_tube_retraction = 91.5
creality_flush_time = 86.0
disable_m73 = 0
emit_machine_limits_to_gcode = 1
enable_filament_ramming = 1
; disable_m73 = 0
machine_limits_usage = emit_to_gcode
; enable_filament_ramming = 1
extra_loading_move = -2
fan_kickstart = 0
fan_speedup_overhangs = 1
fan_speedup_time = 0
; fan_kickstart = 0
; fan_speedup_overhangs = 1
; fan_speedup_time = 0
high_current_on_filament_swap = 0
machine_LED_light_exist = 0
machine_load_filament_time = 11
machine_platform_motion_enable = 0
machine_unload_filament_time = 0
manual_filament_change = 1
nozzle_hrc = 0
nozzle_volume = 0
; machine_LED_light_exist = 0
filament_load_time = 11
; machine_platform_motion_enable = 0
filament_unload_time = 0
; manual_filament_change = 1
; nozzle_hrc = 0
; nozzle_volume = 0
parking_pos_retraction = 92
preferred_orientation = 0
printable_area = 0x0,220x0,220x220,0x220
purge_in_prime_tower = 1
support_multi_bed_types = 1
time_cost = 0
; preferred_orientation = 0
bed_shape = 0x0,220x0,220x220,0x220
; purge_in_prime_tower = 1
; support_multi_bed_types = 1
; time_cost = 0
use_firmware_retraction = 0
use_relative_e_distances = 1
z_offset = 0
retract_lift_above = 0
retract_lift_below = 0
retract_lift_enforce = All Surfaces
wipe_distance = 2
; retract_lift_enforce = All Surfaces
; wipe_distance = 2

View File

@@ -4,28 +4,26 @@ show_name = Grid Support
[settings]
support_material = 1
support_line_width = 0.4
support_interface_filament = 0
support_on_build_plate_only = 0
support_material_auto = 1
support_material_extrusion_width = 0.4
support_material_interface_extruder = 0
support_top_z_distance = 0.2
support_interface_loop_pattern = 0
support_interface_top_layers = 2
support_interface_spacing = 0.5
support_interface_speed = 100%
support_base_pattern = rectilinear
support_base_pattern_spacing = 2.5
support_speed = 50
support_threshold_angle = 30
support_object_xy_distance = 0.35
support_material_pattern = rectilinear
support_material_spacing = 2.5
support_material_speed = 50
support_material_threshold = 30
support_material_xy_spacing = 0.35
support_type = normal(auto)
support_material_style = Grid
support_interface_bottom_layers = 2
tree_support_branch_angle = 45
tree_support_wall_count = 0
; support_type = normal(auto)
support_material_style = grid
support_material_bottom_interface_layers = 2
support_angle = 0
support_material_angle = 0
support_bottom_interface_spacing = 0.5
support_bottom_z_distance = 0.2
support_critical_regions_only = 0
@@ -34,17 +32,3 @@ support_interface_not_for_body = 1
support_interface_pattern = auto
support_remove_small_overhang = 1
support_xy_overrides_z = xy_overrides_z
tree_support_adaptive_layer_height = 1
tree_support_angle_slow = 25
tree_support_auto_brim = 1
tree_support_branch_angle_organic = 40
tree_support_branch_diameter = 2
tree_support_branch_diameter_angle = 5
tree_support_branch_diameter_double_wall = 3
tree_support_branch_diameter_organic = 2
tree_support_branch_distance = 5
tree_support_branch_distance_organic = 1
tree_support_brim_width = 3
tree_support_tip_diameter = 0.8
tree_support_top_rate = 30%

View File

@@ -3,29 +3,27 @@ show_name = Snug Support
[settings]
enable_support = 1
support_line_width = 0.4
support_interface_filament = 0
support_on_build_plate_only = 0
support_material = 1
support_material_auto = 1
support_material_extrusion_width = 0.4
support_material_interface_extruder = 0
support_top_z_distance = 0.2
support_interface_loop_pattern = 0
support_interface_top_layers = 2
support_interface_spacing = 0.5
support_interface_speed = 100%
support_base_pattern = rectilinear
support_base_pattern_spacing = 2.5
support_speed = 50
support_threshold_angle = 30
support_object_xy_distance = 0.35
support_material_pattern = rectilinear
support_material_spacing = 2.5
support_material_speed = 50
support_material_threshold = 30
support_material_xy_spacing = 0.35
support_type = normal(auto)
support_style = Snug
support_interface_bottom_layers = 2
tree_support_branch_angle = 45
tree_support_wall_count = 0
; support_type = normal(auto)
support_material_style = snug
support_material_bottom_interface_layers = 2
support_angle = 0
support_material_angle = 0
support_bottom_interface_spacing = 0.5
support_bottom_z_distance = 0.2
support_critical_regions_only = 0
@@ -34,17 +32,3 @@ support_interface_not_for_body = 1
support_interface_pattern = auto
support_remove_small_overhang = 1
support_xy_overrides_z = xy_overrides_z
tree_support_adaptive_layer_height = 1
tree_support_angle_slow = 25
tree_support_auto_brim = 1
tree_support_branch_angle_organic = 40
tree_support_branch_diameter = 2
tree_support_branch_diameter_angle = 5
tree_support_branch_diameter_double_wall = 3
tree_support_branch_diameter_organic = 2
tree_support_branch_distance = 5
tree_support_branch_distance_organic = 1
tree_support_brim_width = 3
tree_support_tip_diameter = 0.8
tree_support_top_rate = 30%

View File

@@ -3,29 +3,27 @@ show_name = Tree Support
[settings]
enable_support = 1
support_line_width = 0.4
support_interface_filament = 0
support_on_build_plate_only = 0
support_material = 1
support_material_auto = 1
support_material_extrusion_width = 0.4
support_material_interface_extruder = 0
support_top_z_distance = 0.2
support_interface_loop_pattern = 0
support_interface_top_layers = 2
support_interface_spacing = 0.5
support_interface_speed = 100%
support_base_pattern = rectilinear
support_base_pattern_spacing = 2.5
support_speed = 50
support_threshold_angle = 30
support_object_xy_distance = 0.35
support_material_pattern = rectilinear
support_material_spacing = 2.5
support_material_speed = 50
support_material_threshold = 30
support_material_xy_spacing = 0.35
support_type = normal(auto)
support_style = Organic
support_interface_bottom_layers = 2
tree_support_branch_angle = 45
tree_support_wall_count = 0
; support_type = normal(auto)
support_material_style = organic
support_material_bottom_interface_layers = 2
support_angle = 0
support_material_angle = 0
support_bottom_interface_spacing = 0.5
support_bottom_z_distance = 0.2
support_critical_regions_only = 0
@@ -35,16 +33,19 @@ support_interface_pattern = auto
support_remove_small_overhang = 1
support_xy_overrides_z = xy_overrides_z
tree_support_adaptive_layer_height = 1
tree_support_angle_slow = 25
tree_support_auto_brim = 1
tree_support_branch_angle_organic = 40
tree_support_branch_diameter = 2
tree_support_branch_diameter_angle = 5
tree_support_branch_diameter_double_wall = 3
tree_support_branch_diameter_organic = 2
tree_support_branch_distance = 5
tree_support_branch_distance_organic = 1
tree_support_brim_width = 3
tree_support_tip_diameter = 0.8
tree_support_top_rate = 30%
support_tree_angle = 45
; tree_support_wall_count = 0
; tree_support_adaptive_layer_height = 1
support_tree_angle_slow = 25
; tree_support_auto_brim = 1
; tree_support_branch_angle_organic = 40
support_tree_branch_diameter = 2
support_tree_branch_diameter_angle = 5
support_tree_branch_diameter_double_wall = 3
; tree_support_branch_diameter_organic = 2
support_tree_branch_distance = 5
; tree_support_branch_distance_organic = 1
; tree_support_brim_width = 3
support_tree_tip_diameter = 0.8
support_tree_top_rate = 30%