ObjectARX的SDK的C# [英] ObjectARX SDK for c#

查看:412
本文介绍了ObjectARX的SDK的C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有关过去的几天我一直在寻找样本code。与步骤,它可以帮助我了解AutoCAD的API。这样我就可以用code在C#。

For last two days I have looking for sample code with steps which may help me to understand the Autocad API. so I can use the code in C#.

[CommandMethod("LISTGEn")]
public static void ListEntities()
        {
            Document acDoc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
            Database acCurDb = acDoc.Database;

            using (Transaction acTrans = acCurDb.TransactionManager.StartTransaction())
            {
                // Open the Block table record for read
                BlockTable acBlkTbl;
                acBlkTbl = acTrans.GetObject(acCurDb.BlockTableId,OpenMode.ForRead) as BlockTable;

                // Open the Block table record Model space for read
                BlockTableRecord acBlkTblRec;
                acBlkTblRec = acTrans.GetObject(acBlkTbl[BlockTableRecord.ModelSpace],OpenMode.ForRead) as BlockTableRecord;

                int nCnt = 0;
                acDoc.Editor.WriteMessage("\nModel space objects: ");

                // Step through each object in Model space and
                // display the type of object found
                foreach (ObjectId acObjId in acBlkTblRec)
                {
                    acDoc.Editor.WriteMessage("\n" + acObjId.ObjectClass.DxfName);

                    nCnt = nCnt + 1;
                }
                acDoc.Editor.WriteMessage(nCnt.ToString());
                // If no objects are found then display a message
                if (nCnt == 0)
                {
                    acDoc.Editor.WriteMessage("\n No objects found");
                }

                // Dispose of the transaction
            }

        } 

我可以运行上面的code,但它不正常。这是我很难理解如何得到它与AutoCAD的工作。我有OjectARX SDK参考,
我与VS2010的工作和AutoCAD 2012感谢您的帮助。

I can run the above code, but it's not functioning properly. It's difficult for me to understand how to get it work with Autocad. I have OjectARX SDK referenced, I am working with VS2010 and Autocad 2012. Thank You for your help.

推荐答案

好吧,我得到了它只能是被要求的事情

Ok, I got it only thing that is being required

1)是创建一个类库

2。)然后需要在类输入上面code。

2.) Then need to enter the above code in the class.

3)建立由pressing F5项目。

3.) Build your project by pressing F5.

4。)一个DLL将在项目的bin /调试/文件夹中创建

4.) A DLL will be created in the bin/debug/ folder of your project

5)打开AutoCAD的。

5.) Open Autocad.

6。)收件NETLOAD命令。

6.) Write netload command.

7。)选择创建的DLL,然后写入命令LISTGEN比KABOOM它会显示在你的项目中的所有对象。

7.) Select the DLL created and then write command "LISTGEN" and than kaboom it will show all the objects in your project.

这篇关于ObjectARX的SDK的C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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