suwoodblender/blenderpython/fixed_test.py

70 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 修复材质问题后的SUWImpl测试
print("🎯 修复测试开始...")
try:
# 测试路径设置
import sys
import os
current_dir = os.path.dirname(os.path.abspath(__file__))
if current_dir not in sys.path:
sys.path.append(current_dir)
print(f"✅ 路径设置完成: {current_dir}")
# 测试SUWImpl导入和运行
from suw_impl import SUWImpl, Point3d, Vector3d
# 创建实例并初始化
impl = SUWImpl.get_instance()
print("✅ SUWImpl实例创建成功")
# 启动系统(应该不再有材质错误)
impl.startup()
print("✅ SUWImpl系统启动完成")
# 测试几何类
p1 = Point3d(10, 20, 30)
p2 = Point3d.parse("40,50,60")
v1 = Vector3d(1, 0, 0).normalize()
print(f"✅ 几何测试完成: {p1}{p2}, vector: {v1}")
# 测试基本命令
impl.c00({"uid": "fixed_test_001"})
impl.c01({"uid": "fixed_test_001",
"unit_drawing": "test.dwg", "drawing_name": "修复测试"})
print("✅ 基本命令测试完成")
# 测试Blender功能
try:
import bpy
# 创建测试立方体
bpy.ops.mesh.primitive_cube_add(location=(5, 5, 5))
cube = bpy.context.active_object
cube.name = "FIXED_TEST_CUBE"
print(f"✅ Blender测试立方体创建: {cube.name}")
# 显示成功弹窗
def draw_success(self, context):
self.layout.label(text="🎉 SUWImpl修复测试成功")
self.layout.label(text="材质系统已修复,所有功能正常")
bpy.context.window_manager.popup_menu(
draw_success, title="测试成功", icon='INFO')
except Exception as e:
print(f"⚠️ Blender功能测试失败: {e}")
print("🎉 修复测试完成!所有核心功能正常运行")
except Exception as e:
print(f"❌ 修复测试失败: {e}")
import traceback
traceback.print_exc()
print("🎯 修复测试结束!")