2015中的对象句柄

2015中的对象句柄

本文介绍了从vb.net获取AutoCAD 2015中的对象句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我设法将Visual Studio链接到AutoCAD 2015,但是我很难从vb中获取AutoCAD项目中文本对象的句柄.

I have managed to link my Visual Studio to my AutoCAD 2015, but I am struggling to get a handle on a text object within my AutoCAD project from vb.

我想知道是否有人对从vb代码中获取AutoCAD对象的句柄有任何建议或提示.

I was wondering if anyone had any suggestions or tips as to how I could get a handle on an AutoCAD object from my vb code.

最终,我希望能够从我的vb代码中更改该对象的文本.

Ultimately I want to be able to change the text of this object from my vb code.

任何帮助或建议都值得赞赏..

Any help or suggestions are appreciated..

非常感谢

推荐答案

我建议您从我的第一个插件开始教程,然后此 AutoCAD .NET培训材料(培训材料的完整列表) 此处)显示在此视频.

I would suggest you start with My First Plugin tutorial then this AutoCAD .NET Training material (full list of training material here) that is presented at this video.

这是一个简单的示例,说明如何在模型空间中列出所有AutoCAD实体:

Here is a quick example on how list all AutoCAD entities on Model Space:

[CommandMethod("listAllOnModelSpace")]
public static void CmdListAllEntitiesOnModelSpace()
{
  Database db = Application.DocumentManager.MdiActiveDocument.Database;
  using (Transaction trans = db.TransactionManager.StartTransaction())
  {
    BlockTableRecord mSpace = trans.GetObject(SymbolUtilityServices.GetBlockModelSpaceId(db), OpenMode.ForRead) as BlockTableRecord;
    foreach(ObjectId entityId in mSpace)
    {
      Entity entity = trans.GetObject(entityId, OpenMode.ForRead) as Entity;
    }
    trans.Commit();
  }
}

在C#中就已经有了,但是您可以将其翻译为VB.NET 此处.

Just had this in C#, but you may translate to VB.NET here.

这篇关于从vb.net获取AutoCAD 2015中的对象句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 14:52