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

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 GetSystemVariable methods 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

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
从acdbmgd.dll导出的内容,方便参考,格式如下: 类:Autodesk.AutoCAD.DatabaseServices.TextStyleTableRecord:Autodesk.AutoCAD.DatabaseServices.SymbolTableRecord New() 方法: {dtor}() {dtor}() {dtor}() {dtor}() ApplyPaperOrientationTransform(Viewport) ApplyPartialUndo(DwgFiler,RXClass) Audit(AuditInfo) Cancel() Close() CloseAndPage(Boolean) CopyFrom(RXObject) CreateExtensionDictionary() DisableUndoRecording(Boolean) Dispose() DowngradeOpen() DowngradeToNotify(Boolean) DwgIn(DwgFiler) DwgOut(DwgFiler) DxfIn(DxfFiler) DxfOut(DxfFiler) Erase() Erase(Boolean) HandOverTo(DBObject,Boolean,Boolean) ReleaseExtensionDictionary() RemoveField(ObjectId) ResetScaleDependentProperties() SetObjectIdsInFlux() SetPaperOrientation(Boolean) SwapIdWith(ObjectId,Boolean,Boolean) SwapReferences(IdMapping) UpgradeOpen() ViewportDraw(ViewportDraw) XDataTransformBy(Matrix3d) 函数: Clone() AS System.Object CompareTo(Object) AS System.Int32 CreateObjRef(Type) AS System.Runtime.Remoting.ObjRef DecomposeForSave(DwgVersion) AS Autodesk.AutoCAD.DatabaseServices.DecomposeForSaveReplacementRecord DeepClone(DBObject,IdMapping,Boolean) AS Autodesk.AutoCAD.DatabaseServices.DBObject Equals(Object) AS System.Boolean GetHashCode() AS System.Int32 GetLifetimeService() AS System.Object GetObjectSaveVersion(DwgFiler) AS Autodesk.AutoCAD.DatabaseServices.FullDwgVersion GetObjectSaveVersion(DxfFiler) AS Autodesk.AutoCAD.DatabaseServices.FullDwgVersion GetPersistentReactorIds() AS Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection GetReactors() AS System.Collections.Generic.List`1[[Autodesk.AutoCAD.Runtime.RXObject, acdbmgd, Version=17.1.0.0, Culture=neutral, PublicKeyToken=null]] GetRXClass() AS Autodesk.AutoCAD.Runtime.RXClass GetType() AS System.Type GetXDataForApplication(String) AS Autodesk.AutoCAD.DatabaseServices.ResultBuffer HasPersistentReactor(ObjectId) AS System.Boolean InitializeLifetimeService() AS System.Object QueryX(RXClass) AS System.IntPtr RemoveField() AS Autodesk.AutoCAD.DatabaseServices.ObjectId RemoveField(String) AS Autodesk.AutoCAD.DatabaseServices.ObjectId SetAttributes(DrawableTraits) AS System.Int32 SetField(Field) AS Autodesk.AutoCAD.DatabaseServices.ObjectId SetField(String,Field) AS Autodesk.AutoCAD.DatabaseServices.ObjectId SetFromStyle() AS System.Boolean ToString() AS System.String UpgradeFromNotify() AS System.Boolean ViewportDrawLogicalFlags(ViewportDraw) AS System.Int32 WblockClone(RXObject,IdMapping,Boolean) AS Autodesk.AutoCAD.DatabaseServices.DBObject WorldDraw(WorldDraw) AS System.Boolean X(RXClass) AS System.IntPtr 属性: AcadObject AS System.Object 可读不可写 Annotative AS Autodesk.AutoCAD.DatabaseServices.AnnotativeStates 可读可写 AutoDelete AS System.Boolean 可读可写 BigFontFileName AS System.String 可读可写 ClassID AS System.Guid 可读不可写 Database AS Autodesk.AutoCAD.DatabaseServices.Database 可读不可写 Drawable AS Autodesk.AutoCAD.GraphicsInterface.Drawable 可读不可写 DrawableType AS Autodesk.AutoCAD.GraphicsInterface.DrawableType 可读不可写 ExtensionDictionary AS Autodesk.AutoCAD.DatabaseServices.ObjectId 可读不可写 FileName AS System.String 可读可写 FlagBits AS System.Byte 可读可写 Font AS Autodesk.AutoCAD.GraphicsInterface.FontDescriptor 可读可写 Handle AS Autodesk.AutoCAD.DatabaseServices.Handle 可读不可写 HasFields AS System.Boolean 可读不可写 HasSaveVersionOverride AS System.Boolean 可读可写 Id AS Autodesk.AutoCAD.DatabaseServices.ObjectId 可读不可写 IsAProxy AS System.Boolean 可读不可写 IsCancelling AS System.Boolean 可读不可写 IsDependent AS System.Boolean 可读不可写 IsDisposed AS System.Boolean 可读不可写 IsErased AS System.Boolean 可读不可写 IsEraseStatusToggled AS System.Boolean 可读不可写 IsModified AS System.Boolean 可读不可写 IsModifiedGraphics AS System.Boolean 可读不可写 IsModifiedXData AS System.Boolean 可读不可写 IsNewObject AS System.Boolean 可读不可写 IsNotifyEnabled AS System.Boolean 可读不可写 IsNotifying AS System.Boolean 可读不可写 IsObjectIdsInFlux AS System.Boolean 可读不可写 IsPersistent AS System.Boolean 可读不可写 IsReadEnabled AS System.Boolean 可读不可写 IsReallyClosing AS System.Boolean 可读不可写 IsResolved AS System.Boolean 可读不可写 IsShapeFile AS System.Boolean 可读可写 IsTransactionResident AS System.Boolean 可读不可写 IsUndoing AS System.Boolean 可读不可写 IsVertical AS System.Boolean 可读可写 IsWriteEnabled AS System.Boolean 可读不可写 MergeStyle AS Autodesk.AutoCAD.DatabaseServices.DuplicateRecordCloning 可读可写 Name AS System.String 可读可写 ObjectBirthVersion AS Autodesk.AutoCAD.DatabaseServices.FullDwgVersion 可读不可写 ObjectId AS Autodesk.AutoCAD.DatabaseServices.ObjectId 可读不可写 ObliquingAngle AS System.Double 可读可写 OwnerId AS Autodesk.AutoCAD.DatabaseServices.ObjectId 可读可写 PaperOrientation AS Autodesk.AutoCAD.DatabaseServices.PaperOrientationStates 可读不可写 PriorSize AS System.Double 可读可写 TextSize AS System.Double 可读可写 UndoFiler AS Autodesk.AutoCAD.DatabaseServices.DwgFiler 可读不可写 UnmanagedObject AS System.IntPtr 可读不可写 XData AS Autodesk.AutoCAD.DatabaseServices.ResultBuffer 可读可写 XScale AS System.Double 可读可写 -------------------------------- 类:Autodesk.AutoCAD.DatabaseServices.TextVerticalMode:System.Enum 函数: CompareTo(Object) AS System.Int32 Equals(Object) AS System.Boolean GetHashCode() AS System.Int32 GetType() AS System.Type GetTypeCode() AS System.TypeCode ToString() AS System.String ToString(IFormatProvider) AS System.String ToString(String,IFormatProvider) AS System.String ToString(String) AS System.String 字段: TextBase AS TextVerticalMode TextBottom AS TextVerticalMode TextTop AS TextVerticalMode TextVerticalMid AS TextVerticalMode value__ AS Int32
AutoCAD .NET API(应用程序编程接口)是用于在AutoCAD软件中定制和扩展功能的编程工具。它提供了一组功能强大的类和方法,使开发人员能够通过编程方式访问和操作AutoCAD的各种对象和功能。 要下载AutoCAD .NET API,可以按照以下步骤进行操作: 1. 打开Autodesk官方网站,进入AutoCAD的下载页面。 2. 在页面上,找到AutoCAD .NET API的下载选项。通常可以在“附加工具”或“开发者工具”部分中找到。 3. 单击下载链接,选择适用于您的操作系统版本的AutoCAD .NET API软件包。 4. 点击下载按钮,等待下载完成。 在下载完成后,您可以按照以下步骤安装AutoCAD .NET API: 1. 打开下载文件的位置,双击运行安装程序。 2. 遵循安装程序的指示,选择您想要安装的文件夹和配置选项。 3. 完成安装后,您可以在指定的文件夹中找到安装文件和示例代码。 安装完成后,您可以开始使用AutoCAD .NET API来开发自定义功能。您可以使用.NET编程语言(如C#或VB.NET)来编写代码,并使用AutoCAD .NET API中的类和方法来访问和操作AutoCAD中的对象,如图形、图层、块等。您还可以创建自定义命令、工具栏、菜单和对话框,以及执行各种操作,如绘制、修改、查询和导出CAD数据。 总之,要下载AutoCAD .NET API,只需前往官方网站下载页面,并按照指示进行下载和安装即可。安装完成后,您可以使用AutoCAD .NET API进行自定义开发和定制AutoCAD软件的功能。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值