This commit is contained in:
xds
2026-03-22 21:47:30 +03:00
parent 495d8a5bd3
commit d9dad0f7d9
2 changed files with 25 additions and 7 deletions

View File

@@ -98,14 +98,24 @@ def _estimate_weight(file_info: FileInfo, density_g_cm3: float,
logger.debug("Walls: perimeter=%.1f mm/layer, thickness=%.1f mm, volume=%.1f mm3", logger.debug("Walls: perimeter=%.1f mm/layer, thickness=%.1f mm, volume=%.1f mm3",
perimeter_per_layer_mm, wall_thickness_total, wall_volume_mm3) perimeter_per_layer_mm, wall_thickness_total, wall_volume_mm3)
# Top + bottom solid layers volume # Top + bottom solid layers volume (use interior footprint, excluding walls)
solid_layers = TOP_SOLID_LAYERS + BOTTOM_SOLID_LAYERS solid_layers = TOP_SOLID_LAYERS + BOTTOM_SOLID_LAYERS
solid_volume_mm3 = footprint_mm2 * layer_height_mm * solid_layers solid_volume_mm3 = footprint_mm2 * layer_height_mm * solid_layers
logger.debug("Solid top/bottom: footprint=%.1f mm2, layers=%d, volume=%.1f mm3", logger.debug("Solid top/bottom: footprint=%.1f mm2, layers=%d, volume=%.1f mm3",
footprint_mm2, solid_layers, solid_volume_mm3) footprint_mm2, solid_layers, solid_volume_mm3)
# Interior volume for infill (total volume minus walls minus top/bottom) # Shell = walls + top/bottom. Cap at 75% of volume so infill always matters.
interior_volume_mm3 = max(volume_mm3 - wall_volume_mm3 - solid_volume_mm3, 0) shell_volume_mm3 = wall_volume_mm3 + solid_volume_mm3
max_shell = volume_mm3 * 0.75
if shell_volume_mm3 > max_shell:
scale = max_shell / shell_volume_mm3
wall_volume_mm3 *= scale
solid_volume_mm3 *= scale
shell_volume_mm3 = max_shell
logger.debug("Shell capped: scale=%.2f, shell=%.1f mm3", scale, shell_volume_mm3)
# Interior volume for infill (total volume minus shell)
interior_volume_mm3 = volume_mm3 - shell_volume_mm3
infill_volume_mm3 = interior_volume_mm3 * (infill_percent / 100.0) infill_volume_mm3 = interior_volume_mm3 * (infill_percent / 100.0)
logger.debug("Infill: interior=%.1f mm3, infill%%=%d, infill_volume=%.1f mm3", logger.debug("Infill: interior=%.1f mm3, infill%%=%d, infill_volume=%.1f mm3",
interior_volume_mm3, infill_percent, infill_volume_mm3) interior_volume_mm3, infill_percent, infill_volume_mm3)
@@ -152,11 +162,18 @@ def _estimate_print_time(file_info: FileInfo, layer_height_mm: float,
outer_wall_time_s, inner_wall_time_s, wall_time_s) outer_wall_time_s, inner_wall_time_s, wall_time_s)
# Infill time: total infill length / speed # Infill time: total infill length / speed
# infill_length = infill_volume / (line_width * layer_height) # Use weight-based total volume, then subtract shell (capped same as weight calc)
total_filament_mm3 = weight_grams / density_g_cm3 * 1000.0 total_filament_mm3 = weight_grams / density_g_cm3 * 1000.0
wall_volume_mm3 = perimeter_per_layer_mm * WALL_COUNT * LINE_WIDTH_MM * layer_height_mm * num_layers wall_volume_mm3 = perimeter_per_layer_mm * WALL_COUNT * LINE_WIDTH_MM * layer_height_mm * num_layers
solid_volume_mm3 = footprint_mm2 * layer_height_mm * (TOP_SOLID_LAYERS + BOTTOM_SOLID_LAYERS) solid_volume_mm3 = footprint_mm2 * layer_height_mm * (TOP_SOLID_LAYERS + BOTTOM_SOLID_LAYERS)
infill_volume_mm3 = max(total_filament_mm3 - wall_volume_mm3 - solid_volume_mm3, 0) shell_volume_mm3 = wall_volume_mm3 + solid_volume_mm3
max_shell = volume_mm3 * 0.75
if shell_volume_mm3 > max_shell:
scale = max_shell / shell_volume_mm3
wall_volume_mm3 *= scale
solid_volume_mm3 *= scale
shell_volume_mm3 = max_shell
infill_volume_mm3 = max(total_filament_mm3 - shell_volume_mm3, 0)
infill_length_mm = infill_volume_mm3 / (LINE_WIDTH_MM * layer_height_mm) infill_length_mm = infill_volume_mm3 / (LINE_WIDTH_MM * layer_height_mm)
infill_time_s = infill_length_mm / SPEED_INFILL infill_time_s = infill_length_mm / SPEED_INFILL
logger.debug("Infill time: length=%.0f mm, time=%.0fs", infill_length_mm, infill_time_s) logger.debug("Infill time: length=%.0f mm, time=%.0fs", infill_length_mm, infill_time_s)

View File

@@ -39,8 +39,9 @@
</div> </div>
<div v-if="mat.color_options?.length" class="mt-3 flex flex-wrap gap-1.5"> <div v-if="mat.color_options?.length" class="mt-3 flex flex-wrap gap-1.5">
<span v-for="c in mat.color_options" :key="c" class="rounded-full bg-gray-100 px-2 py-0.5 text-[10px] text-gray-600"> <span v-for="c in mat.color_options" :key="c.hex" class="inline-flex items-center gap-1 rounded-full bg-gray-100 px-2 py-0.5 text-[10px] text-gray-600">
{{ c }} <span class="inline-block h-3 w-3 rounded-full border border-gray-300 flex-shrink-0" :style="{ backgroundColor: c.hex }"></span>
{{ c.name }}
</span> </span>
</div> </div>
</div> </div>