我是脑死亡,需要一只手。
我正在尝试在单个实体上实现更新。
测试平台有点人为的,但你应该明白这个想法(我希望)
我试图编码它以显示回报......
问题是:
选择一个实体后,acdbEntUpd()返回RTERROR(-5001)
和ERRNO为5
,我的头疼,我要睡觉,希望编程仙女能解决这个问题
评论是内联的
- [assembly: CommandClass(typeof(KdubTesting.TestCommands))]
- namespace KdubTesting
- {
- // CodeHimBelongaKdub © Jun 2008
- public partial class Kdub_API
- {
- //====================================================================================
- [DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
- public static extern int acdbEntUpd(Int64 adsName);
- //====================================================================================
- /*
- Acad::ErrorStatus acdbGetAdsName(
- ads_name& objName,
- AcDbObjectId obj
- );
- This function fills in objName with the ads_name that corresponds to the objId object ID.
- Returns Acad::eOk if successful. If objId is 0, then Acad::eNullObjectId is returned.
- */
- [DllImport("acdb18.dll", CallingConvention = CallingConvention.Cdecl,
- EntryPoint = "?acdbGetAdsName@@YA?AW4ErrorStatus@Acad@@AAY01JVAcDbObjectId@@@Z")]
- public extern static ErrorStatus acdbGetAdsName(out Int64 objName, ObjectId objId );
- //====================================================================================
- }
- // CodeHimBelongaKdub © Jun 2008
- public partial class TestCommands
- {
- [CommandMethod("EntUpd")]
- static public void TestacdbEntUpd()
- {
- Document doc = AcadApp.DocumentManager.MdiActiveDocument;
- Editor ed = doc.Editor;
- Database db = doc.Database;
-
- PromptEntityResult res = ed.GetEntity("\nSelect an entity to Regen:");
- ObjectId id = res.ObjectId;
- Int64 adsName;
- ErrorStatus es;
- using(Transaction tr = db.TransactionManager.StartTransaction())
- {
- es = Kdub_API.acdbGetAdsName(out adsName, id);
- ed.WriteMessage("\n adsName is {0} ", adsName);
- ed.WriteMessage("\n ErrorStatus is {0} ", es);
- int apiReturn = Kdub_API.acdbEntUpd(adsName);
- /*
- * If acdbEntUpd() succeeds, it returns RTNORM ( 5100 )
- * otherwise, it returns RTERROR.(-5001 )
- * When acdbEntUpd() fails, it sets the system variable ERRNO
- * to a value that indicates the reason for the failure.
- */
- ed.WriteMessage("\n api acdbEntUpd_Return is {0} ", apiReturn);
- ed.WriteMessage("\n System variable ERRNO is {0} ", AcadApp.GetSystemVariable("ERRNO"));
- /*
- * Returns
- * Command: EntUpd
- *Select an entity to Regen:
- *
- * adsName is 8793785127955584200
- * ErrorStatus is OK
- * api acdbEntUpd_Return is -5001
- * System variable ERRNO is 5
- */
- tr.Commit();
- }
- }
- }
- }
本帖以下内容被隐藏保护;需要你回复后,才能看到! 游客,如果您要查看本帖隐藏内容请 回复 |