Bambu Studio 发现 xx个开放边

目录

admesh修复

[我现在加载blender标注正方体,水平直接切割,切割完导出glb, Bambu Studio 发现有25条开放边](#我现在加载blender标注正方体,水平直接切割,切割完导出glb, Bambu Studio 发现有25条开放边)

bpy修复:


Bambu Studio 自带修复功能

admesh修复

bash 复制代码
apt install admesh

admesh -b repaired.stl zft_print.stl

我现在加载blender标注正方体,水平直接切割,切割完导出glb, Bambu Studio 发现有25条开放边

bpy修复:

测试效果,会改变物体,不可取

python 复制代码
# fix_model.py - 适配 Blender 5.0+
import bpy, sys

# 解析参数
argv = sys.argv
argv = argv[argv.index("--") + 1:]  # 获取 -- 之后的参数
input_file = argv[0]
output_file = argv[1]
voxel_size = float(argv[2]) if len(argv) > 2 else 0.15
merge_objects = argv[3].lower() == 'true' if len(argv) > 3 else False

print(f"输入: {input_file}")
print(f"输出: {output_file}")
print(f"体素大小: {voxel_size}mm")
print(f"合并物体: {merge_objects}")

# 清空场景
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete()

# 导入 GLB/GLTF
bpy.ops.import_scene.gltf(filepath=input_file)
print(f"导入完成,物体数量: {len(bpy.data.objects)}")

# 确保所有物体都是MESH类型
mesh_objects = [obj for obj in bpy.data.objects if obj.type == 'MESH']
if not mesh_objects:
	raise Exception("没有找到网格物体")

print(f"网格物体数量: {len(mesh_objects)}")

# 如果需要合并所有物体
if merge_objects and len(mesh_objects) > 1:
	# 取消所有选择
	bpy.ops.object.select_all(action='DESELECT')
	# 选择所有网格物体
	for obj in mesh_objects:
		obj.select_set(True)
	# 设置活动物体
	bpy.context.view_layer.objects.active = mesh_objects[0]
	# 合并
	bpy.ops.object.join()
	mesh_objects = [bpy.context.active_object]
	print("物体已合并")

# 对每个网格物体进行Voxel Remesh
for obj in mesh_objects:
	print(f"处理物体: {obj.name}")

	# 取消所有选择
	bpy.ops.object.select_all(action='DESELECT')

	# 选择当前物体
	obj.select_set(True)
	bpy.context.view_layer.objects.active = obj

	# 确保在物体模式
	bpy.ops.object.mode_set(mode='OBJECT')

	# 添加 Remesh 修改器(Voxel)
	mod = obj.modifiers.new(name="VoxelRemesh", type='REMESH')
	mod.mode = 'VOXEL'
	mod.voxel_size = voxel_size
	mod.use_remove_disconnected = False

	# 应用修改器
	bpy.ops.object.modifier_apply(modifier=mod.name)

	# 进入编辑模式,清理顶点
	bpy.ops.object.mode_set(mode='EDIT')
	bpy.ops.mesh.select_all(action='SELECT')
	bpy.ops.mesh.remove_doubles(threshold=0.0001)
	bpy.ops.mesh.normals_make_consistent(inside=False)
	bpy.ops.object.mode_set(mode='OBJECT')

	print(f"  Remesh 完成,顶点数: {len(obj.data.vertices)}")

# 选择所有网格物体用于导出
bpy.ops.object.select_all(action='DESELECT')
for obj in mesh_objects:
	obj.select_set(True)
if mesh_objects:
	bpy.context.view_layer.objects.active = mesh_objects[0]

bpy.ops.wm.stl_export(filepath=output_file)
# 导出为 STL
# bpy.ops.export_mesh.stl(filepath=output_file, use_selection=True, use_mesh_modifiers=True, batch_mode='OBJECT' if len(mesh_objects) > 1 else 'OFF')

print(f"\n✅ Voxel Remesh 完成 → {output_file}")
print(f"   处理了 {len(mesh_objects)} 个物体")
相关推荐
Nturmoils4 小时前
哪个服务在跑我自己都说不清,干脆让 doubao-seed-evolving 给我撸了个服务管理器
人工智能
「QT(C++)开发工程师」5 小时前
AI Agent 术语
人工智能·ai作画·aigc·ai编程·ai写作
颜酱5 小时前
03 | 实现节点1 — 抽取关键词
前端·人工智能·后端
风吹心凉5 小时前
python3基础2026.7.22
开发语言·python
qq_452396235 小时前
第五篇:《接口与错误处理:Go 的哲学》
开发语言·后端·golang
Escalating_xu5 小时前
C++可变参数模板与引用折叠精讲
开发语言·c++
灵机一物5 小时前
企业选型参考:2026 CXL 内存扩展方案六强测评与落地指南
服务器·网络·数据库·人工智能
Web极客码5 小时前
如何用三段式确定性剪枝,为 LLM Agent 砍掉 35% 的 Token 成本?
服务器·人工智能·算法·机器学习
wuyk5555 小时前
59.嵌入式C语言高级宏定义实战:多行宏、字符串化与符号拼接
c语言·开发语言·stm32·单片机·嵌入式硬件·物联网·51单片机