Get handle of Object in AutoCAD 2015 from vb.net

℡╲_俬逩灬. 提交于 2020-01-04 02:59:10

问题


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.

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.

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

Any help or suggestions are appreciated..

Thank You in adavance


回答1:


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.

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();
  }
}

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



来源:https://stackoverflow.com/questions/33125471/get-handle-of-object-in-autocad-2015-from-vb-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!