从 vb.net 获取 AutoCAD 2015 中对象的句柄 [英] Get handle of Object in AutoCAD 2015 from vb.net

查看:51
本文介绍了从 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..

先谢谢你

推荐答案

我建议您从 My First Plugin<开始/a> 教程然后是这个 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 here.

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆