EaBIM一直以来积极响应国家“十二五”推进建筑业信息化的号召,对建筑领域的信息技术开展深入技术交流和探讨!致力于打造“BIM-建筑师-生态技术”三位一体综合资源交流共享平台,希望为BIM与可持续设计理念及技术的普及做出微小的贡献!!!

EaBIM

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 8194|回复: 136
打印 上一主题 下一主题

[资料] AutoCAD .NET API基础(一) AutoCAD 对象层次结构(4)

[复制链接]

1514

主题

7465

帖子

1万

积分

admin

Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10

积分
12406

社区QQ达人

跳转到指定楼层
楼主
发表于 2014-1-8 16:15:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
4The Graphical and Nongraphical Objects
图形对象和非图形对象
Graphical objects, also known as entities, are the visible objects (lines, circles, raster images, and so forth) that make up a drawing. Adding graphical objects to a drawing is done by referencing the correct block table record, and then using the AppendEntity method with the new object to append it to the drawing.
图形对象,又成为实体,是组成图形的可见对象(线、圆、光栅图像等等)。向当前图形添加图形对象的方法是,通过对正确的块表记录的引用,使用AppendEntity方法将要添加的新对象添加到图形中。
To modify or query objects, obtain a reference to the object from the appropriate block table record, and then use the methods or properties of the object itself. Each graphical object has methods that perform most of the same functionality as the AutoCAD editing commands such as Copy, Erase, Move, Mirror, and so forth.
要修改或查询对象,先从相应的块表记录里获得对该对象的引用,然后调用该对象自己的方法或属性。每个图形对象都拥有一些方法,这些方法实现了与大部分AutoCAD编辑命令相同的功能,像复制、删除、移动、镜像,等等。
These objects also have methods to retrieve the extended data (xdata), highlight and unhighlight, and set the properties from another entity. Most graphical objects have some properties in common with each other such as LayerId,LinetypeId, Color, and Handle. Each graphical object also has specific properties, such as Center,StartPoint, Radius, and FitTolerance.
这些对象还有一些方法,用于检索扩展数据(xdata)、亮显和取消亮显、从别的实体设置属性等。大多数图形对象都拥有一些彼此共有的属性,比如LayerIdLinetypeIdColorHandle等。另外每个图形对象还拥有自己特有的属性,比如CenterStartPointRadius,以及FitTolerance等。
Nongraphical objects are the invisible (informational) objects that are part of a drawing, such as Layers, Linetypes, Dimension styles, Table styles, and so forth. To create a new symbol table records, use the Add method on the owner table or use the SetAt method to add a dictionary to the named object dictionary. To modify or query these objects, use the methods or properties of the object itself. Each nongraphical object has methods and properties specific to its purpose; all have methods to retrieve extended data (xdata), and erase themselves.
非图形对象是图形中那部分不可见的(信息性质的)对象,像图层、线型、标注式样、表示样,等等。要新建一个符号表记录,调用该符号表的Add方法,或调用SetAt方法向命名对象字典添加一个字典。要修改或查询这些对象,调用这些对象自己的相应的方法或属性。每个非图形对象都拥有特定功能的方法和属性,所有非图形对象都拥有检索扩展数据、删除自己的方法。

5The Collection Objects
集合对象
AutoCAD groups most graphical and nongraphical objects into collections or container objects. Although collections contain different types of data, they can be processed using similar techniques. Each collection has a method for adding an object to or obtaining an item from a collection. Most collections use the Add or SetAt methods to add an object to a collection.
AutoCAD使用集合或容器对象对大部分图形对象和非图形对象进行了分组。尽管集合包含不同的数据类型,仍可用相似的技术对它们进行处理。每个集合都拥有把一个对象添加到集合里的方法和从集合里获取一个集合项的方法。大多数集合调用Add方法或SetAt方法将一个对象添加到集合里。
Most collections offer similar methods and properties to make them easy to use and learn. The Count property returns a zero-based count of the objects in a collection, while the Item function returns an object from a collection. Examples of collection members in the AutoCAD .NET API are:
大多数集合都提供类似的方法和属性,以便于使用和学习。Count属性返回集合里从0开始的对象计数,Item函数从集合里返回一个对象。AutoCAD .NET API中的集合成员举例如下:
·
Layer table record in the Layers symbol table 图层符号表中的图层表记录;
·
Layout in the ACAD_LAYOUT dictionary  ACAD_LAYOUT字典中的布局;
·
Document in the DocumentCollection 文档集合中的文档;
·
Attributes in a block reference 块参考中的属性;


6Non-Native Graphical and Nongraphical Objects非本地的图形对象和非图形对象
The AutoCAD .NET API is a cross implementation of ObjectARX and ActiveX Automation. While you can access ActiveX Automation from ObjectARX, .NET API makes working with the two rather seamless. As you work with objects using the native .NET API, you can access the equivalent COM object from a property. In some cases, the COM object is the only way to access an AutoCAD feature programmatically. Some examples of properties that expose COM objects through the .NET API are, Preferences, Menubar, MenuGroups, AcadObject and AcadApplication.
AutoCAD .NET API编程接口是ObjectARXActiveX Automation两种编程接口交叉实现的。当然你可以从ObjectARX访问ActiveX Automation,但通过.NET API,你可以几乎无缝的使用这两种编程技术。正像你使用本地.NET API处理对象一样,你可以从属性访问相同的COM对象。有些情况下,使用COM对象是编程访问AutoCAD功能的唯一途径。COM对象通过.NET API公开的属性的例子如:PreferencesMenubarMenuGroupsAcadObjectAcadApplication等。
Note: When working with COM objects, you will want to make sure you reference the AutoCAD 2011 type library. For information on COM Interop, see Use COM Interoperability with .NET.
注意:当与COM对象打交道时,请确认你引用了AutoCAD2011的类型库。关于COM互操作的信息,见Use COM Interoperability with .NEThttp://docs.autodesk.com/ACD/2011/ENU/filesMDG/WS73099cc142f48755-5c83e7b1120018de8c0-23ce.htm)(尚未翻译)。
The Preferences property of the Application object provides access to a set of COM objects, each corresponding to a tab in the Options dialog box. Together, these objects provide access to all the registry-stored settings in the Options dialog box. You can also set and modify options (and system variables that are not part of the Options dialog box) with the SetSystemVariable and GetSystemVariablemethods of the Application object. For more information about using the Preferences object, see the ActiveX and VBA Developer’s Guide.
Application对象的Preferences属性用来访问一组COM对象,其中的每个COM对象对应选项对话框里的一个选项页,这些对象一起用来访问选项对话框里全部的注册表存储的选项设置。你可以使用Application对象的SetSystemVariable方法GetSystemVariable方法来设置和修改选项(当然也可以设置和修改哪些不在选项对话框里的系统变量)。使用Preferences对象的更多信息,见ActiveXVBA开发指南。
Accessing COM objects is useful if you are working with existing code that might have been originally developed for VB or VBA, or even when working with a third-party library that might work with the AutoCAD ActiveX Automation library with the .NET API. Like the Preferences object, you can also access utilities which translate coordinates or define a new point based on an angle and distance using the Utility object which can be accessed from the AcadApplication COM object which is the equivalent of the Application object in the .NET API.
当你与最初可能是用VBVBA开发的代码打交道时,或者当你与那些使用了AutoCAD ActiveX Automation库和AutoCAD .NET API的第三方库打交道时,访问COM对象技术很有用。像Preferences对象那样,你还可以使用Utility对象的诸如转换坐标、基于角和距离定义新点等实用功能,Utility对象可通过COM对象AcadApplication访问,同等地,也可以通过.NET API中的Application对象访问。
Note: When working with both the AutoCAD .NET API and ActiveX Automation, and you create custom functions that might need to return an object, it is recommended to return an ObjectId instead of the object itself. For information on Object Ids, see Work with ObjectIds.
注意:当使用了AutoCAD .NET APIActiveX Automation两种技术时,如果你创建的自定义函数需要返回一个对象,建议返回ObjectId而不是对象本身,见使用ObjectIds

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 转播转播 分享分享 分享淘帖 支持支持 反对反对

相关帖子

工作时间:工作日的9:00-12:00/13:30-18:00,节假日不在线,请勿留言

0

主题

1

帖子

8

积分

BIM书童

Rank: 1

积分
8
推荐
发表于 2014-9-3 16:42:41 | 只看该作者
本帖最后由 xixiyu 于 2014-9-3 16:47 编辑

AutoCAD.NET,刚入门

6

主题

701

帖子

1171

积分

BIM项目负责人

Rank: 5Rank: 5Rank: 5Rank: 5Rank: 5

积分
1171
3F
发表于 2014-5-13 10:18:56 | 只看该作者
路过!!!
不发表意见……

0

主题

843

帖子

1280

积分

BIM经理

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

积分
1280
5F
发表于 2014-5-13 10:28:48 | 只看该作者
(*^__^*) 嘻嘻……

19

主题

878

帖子

1359

积分

BIM经理

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

积分
1359
7F
发表于 2014-5-22 15:20:56 | 只看该作者
路过!!!
不发表意见……

1

主题

827

帖子

1316

积分

BIM经理

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

积分
1316
8F
发表于 2014-5-22 15:36:33 | 只看该作者
(*^__^*) 嘻嘻……

2

主题

885

帖子

1615

积分

BIM经理

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

积分
1615
9F
发表于 2014-6-13 14:48:20 | 只看该作者
顶......
楼下跟上.....

1514

主题

7465

帖子

1万

积分

admin

Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10

积分
12406

社区QQ达人

11F
 楼主| 发表于 2014-8-5 10:40:03 | 只看该作者
ganxiefenxiang
工作时间:工作日的9:00-12:00/13:30-18:00,节假日不在线,请勿留言

6

主题

870

帖子

1737

积分

BIM经理

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

积分
1737
13F
发表于 2014-8-20 14:08:06 | 只看该作者
顶......
楼下跟上.....

28

主题

763

帖子

1425

积分

BIM经理

Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6Rank: 6

积分
1425
16F
发表于 2014-8-20 14:09:10 | 只看该作者
路过!!!
不发表意见……
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|EaBIM网 ( 苏ICP备2020058923号-1  苏公网安备32011502011255号

GMT+8, 2024-11-27 01:59

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表