0564.测试.zip在ORD旗舰版中出现了插入多个单元软件直接崩退的问题,也不会报错,在原来的ORD 10.08版本中就没有出现过这种情况,这是我的测试代码和文件,请各位老师帮忙看看是什么问题导致的, 谢谢
我安装的版本号是Setup_OpenRoadsDesignerUltimateforChina_x64_10.10.20.26, SDK版本号是Setup_CIMPlatformSDK_x64_10.10.20.28
wyx.cel
您用您的代码加载上面的cel文件,看看是否会报错.
麻烦老师运行一下我的代码中的这个过程, 看看在您那崩溃吗
老师, 用我那个代码,能加载出来单元库, 没问题
换用PInvoke技术调用c/c++的函数来完成从单元库中放置单元的工作吧,COM接口可能在这种频繁调用的情况下有些问题。
[DllImport("ustation.dll")] public unsafe static extern uint mdlCell_placeCell(DPoint3d* rOrigin, DPoint3d* scale, bool trueScale, DMatrix3d* rotMatrix, short* attributes, uint ggroup, bool relativeMode, uint baseLevel, int sharedFlag, long cellName, long library); [DllImport("ustation.dll")] public unsafe static extern uint mdlElmdscr_read(long* elemDescrPP, uint filePos, long modelRef, int expandSharedCells, uint* readFilePos); public unsafe static void TempFunction() { MsApp.AttachCellLibrary(@"D:\CellLib1.dgn"); DPoint3d rOrigin = DPoint3d.Zero; DPoint3d scale = new DPoint3d(1, 1, 1); DMatrix3d rotMatrix = DMatrix3d.Identity; string cellName = "MyCell1"; IntPtr intPtr = Marshal.StringToHGlobalUni(cellName); uint filePos = mdlCell_placeCell(&rOrigin, &scale, false, &rotMatrix, null, 0, false, 0, 0, intPtr.ToInt64(), 0); long elmdscr; mdlElmdscr_read(&elmdscr, filePos, Session.Instance.GetActiveDgnModel().GetNative().ToInt64(), 0, null); BIM.Element cellEle = MsApp.MdlCreateElementFromElementDescrP(elmdscr); MessageBox.Show(cellEle.ID.ToString()); Marshal.FreeHGlobal(intPtr); }