Creo钣金文件导入APS后SurfaceBodies.Count为零的问题求助
问题:APS环境下读取Creo钣金文件无法获取正确的曲面体数量
我在将Creo钣金文件加载到APS应用时遇到了一个问题:无法从SheetMetalComponentDefinition对象中获取正确的曲面体数量,返回值始终为0,但本地使用安装的Inventor实例运行时一切正常。
核心代码
获取曲面体数量的逻辑:
SheetMetalComponentDefinition scd = (SheetMetalComponentDefinition)partDocument.ComponentDefinition; var bCount = scd.SurfaceBodies.Count;
两种环境的初始化代码差异
- 本地Inventor环境:通过以下方式初始化InventorServer,执行后能得到有效的曲面体计数:
InventorServer server = inv.GetInventorServer();
- APS云端环境:通过插件的
Activate方法初始化InventorServer,此时SurfaceBodies.Count返回0:
public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime) { Trace.TraceInformation(": UpdateIPTParam (" + Assembly.GetExecutingAssembly().GetName().Version.ToString(4) + "): initializing... "); // Initialize AddIn members. _inventorServer = addInSiteObject.InventorServer; Automation = new SampleAutomation(_inventorServer); }
已准备好示例Creo测试文件,恳请各位提供排查思路或解决方案,谢谢!
内容的提问来源于stack exchange,提问作者OldBloke
相关产品推荐
相关产品推荐

