前言
BricsCAD二次开发时,使用c#语言开发,在安装目录下的API目录下有个README.txt。
Create a class library using the class library wizard under your preferred .NET language. There are currently two DLLs that need to be referenced, BrxMgd.DLL and TD_Mgd.DLL. These DLLs are located in your BricsCAD installation folder. An important note: when referencing these two DLLs, its important to set the 'Copy Local' property to false. All other DLLs such as referenced COM DLLs or satellite DLLs can have their the 'Copy Local' property to true, or as needed by your project.
意思是BrxMgd.DLL and TD_Mgd.DLL这两库必需引入,同时Copy Local必需设为false,下面遇到的问题就是Copy Local设为true引起的,或者说由于以前设为true过,导致Debug目录下这两文件,必需手动删除
。
问题
在操作BricCAD块信息时,用到一些API,在取Bricscad.ApplicationServices.DocumentManager.MdiActiveDocument对象时有时会报错,
或者报System.ArgumentException异常
或者
外部组件发生异常
在 _CxxThrowException(Void* , _s__ThrowInfo* )
在 OdDbTransactionManager.createObject(OdSmartPtr<OdDbTransactionManager>* )
在 Teigha.DatabaseServices.Database.get_TransactionManager()
或者如下图错误
图上有显示问题出在TD_Mgd.dll
解决办法
- 选中TD_Mgd.dll库,在属性面板里将复制本地或Copy Local设为false
- 将输出目录Debug下TD_Mgd.dll删除(如果有的话)