深居浅出AutoCAD二次开发


[第一版] 深居浅出 AutoCAD 二次开发 开发基础 李冠亿 2010-5-11 http://www.BimCad.org 说明 AutoCAD 以其通用的格式、完善的图形绘制功能及强大的图形编辑功能在各行业计算机辅助设计方 面发挥着举足轻重的作用,对其进行二次开发能以更高精度、速度的进行计算机辅助设计,提高工作效 率。 如今 AutoCAD 支持的二次开发语言比较丰富,不管在哪种开发语言下对其进行二次开发 AutoCAD 的 运行原理、程序设计的方法及开发思路是不变的。综合各种开发语言的性能、功能、开发周期、开发难 度以及未来的趋势得出结论:在.NET(C#)环境下对其进行二次开发最为合适。 本书力求循序渐进、由浅入深,详细介绍 AutoCAD 二次开发原理与技术。以.NET(C#)环境下二次开 发为主线,并介绍.NET(C#)调用 ObjectARX(C++)程序的方法,从而实现在 C#环境中构建程序框架(易于实 现与修改),必要的时候在 C++环境中实现复杂或目前未托管的程序功能。融入 C++程序让.NET(C#)开发即 便捷高效又功能强大。本书在详细的介绍 AutoCAD 基本对象及功能实现的同时结合丰富的开发实例以拓 展开发的思路、指导实践开发的过程。 本书内容安排如下: 第一章“概述” 主要介绍 AutoCAD 软件的功能用途以及开发环境。 第二章“AutoCAD 操作应用” 简单介绍软件的应用操作。 第三章“程序设计基础” 主要介绍程序设计的基础。 第四章“数据库基础” 主要介绍数据库相关的基础知识。 第五章 “AutoCAD.NET 开发” 主要介绍 AutoCAD.NET APIs 及 AutoCAD 开发的基本方法与过程。 第六章“开发实例” 详细介绍 AutoCAD 的开发过程以及开发思路。 本书版权属于数字建筑网(http://www.BimCad.org)站长李冠亿所有。由于时间及水平有限,本书 难免 存在不足与错误,作者还会对本书不断修改、扩充加以完善。读者有任何AutoCAD开发上的困难,需求 或心得体会欢迎联系作者(E-mail:lgy125247653@163.com ,QQ:738656768, MSN: BIM.CAD@hotmail.com ) 或登陆数字建筑网(http://www.BimCad.org)进行交流。本书的新版本及开发实例的源代码可以 在http://www.BimCad.org/Downloads 链接中下载。 希望这本书能对您了解 AutoCAD 二次开发技术有所帮助。 李冠亿 2010-5-11 [www.BimCad.org]深居浅出 AutoCAD 二次开发 I 目录 第一章 概述 ............................................................................................................................................................................................ 1 【一】AUTOCAD功能特点 .................................................................................................................................................................... 1 【二】二次开发内容 ........................................................................................................................................................................... 1 【三】二次开发方式 ........................................................................................................................................................................... 1 【1】AutoLISP .................................................................................................................................................................................. 3 【2】ADS .......................................................................................................................................................................................... 3 【3】ObjectARX ............................................................................................................................................................................... 4 【4】VisualLISP ................................................................................................................................................................................ 5 【5】VBA .......................................................................................................................................................................................... 5 【6】AutoCAD .NET .......................................................................................................................................................................... 6 【四】开发方式对比 ........................................................................................................................................................................... 7 【1】开发方式能力范围对比 ......................................................................................................................................................... 7 【2】开发环境的难易程度及学习时间对比 ................................................................................................................................. 7 【3】开发环境性能对比 ................................................................................................................................................................. 8 【4】各开发方式能力对比 ............................................................................................................................................................. 8 第二章 AUTOCAD操作应用 ................................................................................................................................................................. 9 【一】基本界面 ................................................................................................................................................................................... 9 【二】基本功能 ................................................................................................................................................................................. 11 第三章 程序设计基础 .......................................................................................................................................................................... 14 【一】数据类型 ................................................................................................................................................................................. 14 【1】值类型 .................................................................................................................................................................................. 14 (1)简单类型 ................................................................................................................................................................................................................. 14 (1.1)整数类型 ......................................................................................................................................................................................................... 14 (1.2)布尔类型 ........................................................................................................................................................................................................ 14 (1.3)实数类型 ........................................................................................................................................................................................................ 14 (1.4)字符类型 ........................................................................................................................................................................................................ 14 (2)结构类型 ................................................................................................................................................................................................................ 15 (3)枚举类型 ................................................................................................................................................................................................................ 15 【2】引用类型 .............................................................................................................................................................................. 15 (1)类 ............................................................................................................................................................................................................................. 15 (2)代表 ......................................................................................................................................................................................................................... 16 (3)数组 ......................................................................................................................................................................................................................... 16 (4)接口 ......................................................................................................................................................................................................................... 17 【二】运算符、表达式 ..................................................................................................................................................................... 17 【三】程序流程 ................................................................................................................................................................................. 24 【1】顺序程序 .............................................................................................................................................................................. 24 【2】分支程序 .............................................................................................................................................................................. 24 (1)if语句 ....................................................................................................................................................................................................................... 24 (2)switch语句 ............................................................................................................................................................................................................... 26 (3)try、catch、finally表达式 ..................................................................................................................................................................................... 27 【3】循环程序 .............................................................................................................................................................................. 28 (1)while语句 ................................................................................................................................................................................................................ 28 (2)do-while语句 ........................................................................................................................................................................................................... 29 (3)for语句 ..................................................................................................................................................................................................................... 29 (4)foreach语句 ............................................................................................................................................................................................................. 30 【四】数据结构 ................................................................................................................................................................................. 31 [www.BimCad.org]深居浅出 AutoCAD 二次开发 II 【1】线性结构 .............................................................................................................................................................................. 31 (1)线性表 ..................................................................................................................................................................................................................... 31 (2)栈 .............................................................................................................................................................................................................................. 32 (3)列队 .......................................................................................................................................................................................................................... 32 【2】非线性结构 ........................................................................................................................................................................... 33 (1)树 .............................................................................................................................................................................................................................. 33 (2)二叉树 ..................................................................................................................................................................................................................... 33 (3)图 .............................................................................................................................................................................................................................. 34 【3】数据排序、查找 ................................................................................................................................................................... 35 (1)排序 ......................................................................................................................................................................................................................... 35 (1)冒泡排序 ............................................................................................................................................................................................................ 35 (2)选择排序 ............................................................................................................................................................................................................ 36 (3)插入排序 ............................................................................................................................................................................................................ 36 (4)希尔排序 ............................................................................................................................................................................................................ 37 (2)查找 ......................................................................................................................................................................................................................... 37 (1)线性查找 ............................................................................................................................................................................................................ 37 (2)折半查找 ............................................................................................................................................................................................................ 38 【五】算法 ........................................................................................................................................................................................ 38 【1】穷举法 .................................................................................................................................................................................. 38 【2】贪心法 .................................................................................................................................................................................. 38 【3】分治法 .................................................................................................................................................................................. 39 【4】回溯法 .................................................................................................................................................................................. 39 【5】动态规划法 .......................................................................................................................................................................... 39 【6】分枝界限法 .......................................................................................................................................................................... 39 【7】递归算法 .............................................................................................................................................................................. 39 【六】函数 ........................................................................................................................................................................................ 40 【七】事件 ........................................................................................................................................................................................ 41 【八】.NET简介 ................................................................................................................................................................................ 42 【九】C#简介 ................................................................................................................................................................................... 47 【十】编码规范 ................................................................................................................................................................................. 48 第四章 数据库基础 .............................................................................................................................................................................. 48 【一】数据模型 ................................................................................................................................................................................. 48 【二】关系型数据库 ......................................................................................................................................................................... 49 【三】SQL语言 ................................................................................................................................................................................. 49 【四】数据库设计范式 ..................................................................................................................................................................... 51 【五】DWG数据库 ............................................................................................................................................................................ 51 第五章 AUTOCAD.NET开发 .............................................................................................................................................................. 53 【一】AUTOCAD.NET开发环境及实现方法 ...................................................................................................................................... 53 【1】创建项目 .............................................................................................................................................................................. 53 【2】编译、调试 .......................................................................................................................................................................... 56 【3】加载程序 .............................................................................................................................................................................. 60 【4】程序部署 .............................................................................................................................................................................. 62 【5】托管C++程序 ...................................................................................................................................................................... 68 【二】AUTOCAD对象 ........................................................................................................................................................................ 76 【1】Application(应用程序) .......................................................................................................................................................... 78 【2】Document(文档) ................................................................................................................................................................... 86 【3】Editor(命令行) ...................................................................................................................................................................... 92 【4】Database(数据库) ............................................................................................................................................................... 101 【5】Transaction (事务) .............................................................................................................................................................. 115 【6】DBObject(数据库对象) ....................................................................................................................................................... 118 (1) SymbolTable(符号表)、SymbolTableRecord(符号表记录) .............................................................................................................................126 (1.1) BlockTabLe (块表)、BlockTableRecord(块表记录) ...................................................................................................................................128 [www.BimCad.org]深居浅出 AutoCAD 二次开发 III (1.2) DimStyleTable(尺寸标注样式表) 、DimStyleTableRecord(标注样式表记录) ......................................................................................132 (1.3) LayerTable (层表)、LayerTableRecord(层表记录) ...................................................................................................................................135 (1.4) LinetypeTable (线型表)、LinetypeTableRecord(线型表记录) ................................................................................................................138 (1.5) RegAppTable (应用程序注册表)、RegAppTableRecord(应用程序注册表记录) ..................................................................................139 (1.6) TextStyleTable (文字样式表)、TextStyleTableRecord(文字样式表记录) ..............................................................................................140 (1.7) UCSTable (用户坐标系表) 、UcsTableRecord(用户坐标系表记录) ......................................................................................................141 (1.8) ViewportTable (视口表)、ViewportTableRecord(视口表记录) ..............................................................................................................142 (1.9) ViewTable (视图表)、ViewTableRecord(视图表记录) .............................................................................................................................144 (2) DBDictionary (词典) .............................................................................................................................................................................................145 (3) DataTable(数据表) ...............................................................................................................................................................................................148 (4) Xrecord(扩展记录) ...............................................................................................................................................................................................151 (5) Field (字段) ...........................................................................................................................................................................................................152 (6) Entity(实体对象) ..................................................................................................................................................................................................155 (6.1) DBPoint (点) ..................................................................................................................................................................................................164 (6.2)Curve(曲线) ...................................................................................................................................................................................................165 (6.2.1)Line(直线) ..............................................................................................................................................................................................170 (6.2.2) Polyline3d (三维多段线) .....................................................................................................................................................................172 (6.2.3)Arc(圆弧) ................................................................................................................................................................................................174 (6.2.4)Circle(圆) ................................................................................................................................................................................................176 (6.2.5) Ellipse (椭圆) .........................................................................................................................................................................................178 (6.2.6)Leader(引线) ..........................................................................................................................................................................................181 (6.2.7) Spline (样条曲线) .................................................................................................................................................................................184 (6.2.8) XLine (构造线) ......................................................................................................................................................................................187 (6.2.8) Ray (射线) .............................................................................................................................................................................................188 (6.3)DBText(单行文字) .........................................................................................................................................................................................189 (6.3.1) AttributeDefinition(属性定义) ............................................................................................................................................................190 (6.3.2) AttributeReference (属性参照) ...........................................................................................................................................................192 (6.4)MText(多行文字) ..........................................................................................................................................................................................195 (6.5) BlockReference(块参照) ..............................................................................................................................................................................199 (6.5.1) Table(表格) ...........................................................................................................................................................................................201 (6.6) Dimension(标注) ..........................................................................................................................................................................................216 (6.6.1) AlignedDimension(对齐标注) .............................................................................................................................................................222 (6.6.2) ArcDimension(弧长标注) ....................................................................................................................................................................224 (6.6.3) RotatedDimension(转角标注) .............................................................................................................................................................226 (6.6.4) DiametricDimension (直径标注) .........................................................................................................................................................228 (6.6.5) RadialDimension(半径标注) ................................................................................................................................................................230 (6.6.6) OrdinateDimension(坐标标注) ...........................................................................................................................................................232 (6.6.7) LineAngularDimension2(角度标注) ....................................................................................................................................................234 (6.7) Region (面域) ................................................................................................................................................................................................236 (6.8) Surface (表面) ...............................................................................................................................................................................................239 (6.8.1) ExtrudedSurface(拉伸表面) ................................................................................................................................................................241 (6.8.2) LoftedSurface (放样表面) ....................................................................................................................................................................243 (6.8.3) PlaneSurface(平面表面) ......................................................................................................................................................................244 (6.8.4) RevolvedSurface (旋转表面) ...............................................................................................................................................................245 (6.8.5) SweptSurface (扫掠表面) ....................................................................................................................................................................247 (6.9) Solid3d (三维实体) .......................................................................................................................................................................................249 (6.10) Body (形体) .................................................................................................................................................................................................258 (6.11) Hatch (填充) ...............................................................................................................................................................................................259 【7】Overrule(规则重定义) ........................................................................................................................................................ 263 (1) ObjectOverrule (数据库对象重定义) ................................................................................................................................................................264 (2) DrawableOverrule(可视化对象规则重定义) ....................................................................................................................................................265 (3) GripOverrule(夹点重定义) ..................................................................................................................................................................................266 (4) OsnapOverrule (对象捕捉重定义) .....................................................................................................................................................................268 (5) GeometryOverrule (几何重定义) .......................................................................................................................................................................268 (6) HighlightOverrule (高亮重定义) .........................................................................................................................................................................269 (7) PropertiesOverrule (属性重定义) ......................................................................................................................................................................269 (8) TransformOverrule (变形重定义) ......................................................................................................................................................................269 【8】Jig(步骤模仿) ...................................................................................................................................................................... 270 [www.BimCad.org]深居浅出 AutoCAD 二次开发 IV (1)EntityJig(单实体步骤模仿) ..................................................................................................................................................................................271 (2) DrawJig (拖拽步骤模仿) .....................................................................................................................................................................................272 【9】几何类库 ............................................................................................................................................................................ 273 (1)Vector3d(三维向量) .............................................................................................................................................................................................273 (2)Matrix3d(三维矩阵) .............................................................................................................................................................................................277 (3)Tolerance(容差) ....................................................................................................................................................................................................280 (4) Point3d (三维点) ..................................................................................................................................................................................................281 (5) Curve3d(三维曲线) ..............................................................................................................................................................................................284 (5.1) LinearEntity3d(三维线性对象) ...................................................................................................................................................................286 (5.2)CircularArc3d(三维圆弧) ..............................................................................................................................................................................287 (6)Plane(平面) ............................................................................................................................................................................................................288 【10】用户界面 .......................................................................................................................................................................... 289 (1)PaletteSet(面板) ....................................................................................................................................................................................................289 (2)RibbonTab(面板式菜单) ......................................................................................................................................................................................293 【11】枚举类型 .......................................................................................................................................................................... 293 (1)OpenMode .............................................................................................................................................................................................................293 (2)Intersect .................................................................................................................................................................................................................293 (3)ObjectSnapModes .................................................................................................................................................................................................295 (4)DragStatus .............................................................................................................................................................................................................296 (5)PromptStatus .........................................................................................................................................................................................................297 (6) BooleanOperationType ........................................................................................................................................................................................297 (7) SweepOptionsAlignOption ..................................................................................................................................................................................297 (8) SubentityType .......................................................................................................................................................................................................298 (9) HatchPatternType ................................................................................................................................................................................................298 (10) DataType .............................................................................................................................................................................................................298 (11) PaletteSetStyles ..................................................................................................................................................................................................299 【三】基本操作 ............................................................................................................................................................................... 301 【1】实体对象 ............................................................................................................................................................................ 301 (1)创建对象 ...............................................................................................................................................................................................................301 (1.1)创建直线 .......................................................................................................................................................................................................301 (1.2)创建圆 ............................................................................................................................................................................................................301 (1.3)创建圆弧 .......................................................................................................................................................................................................302 (1.4)创建椭圆(椭圆弧) ........................................................................................................................................................................................303 (1.5)创建多段线 ...................................................................................................................................................................................................303 (1.6)创建引线 .......................................................................................................................................................................................................304 (1.7)创建单行文字 ...............................................................................................................................................................................................304 (1.8)创建多行文字 ...............................................................................................................................................................................................305 (1.9)创建填充 .......................................................................................................................................................................................................305 (1.10)创建标注 .....................................................................................................................................................................................................306 (1.11)创建面域 .....................................................................................................................................................................................................309 (1.12)创建表面 .....................................................................................................................................................................................................309 (1.13)创建三维对象 .............................................................................................................................................................................................310 (1.13)创建表格 .....................................................................................................................................................................................................313 (1.14)创建属性定义 .............................................................................................................................................................................................313 (1.15)创建属性参照 .............................................................................................................................................................................................314 (2)编辑对象 ...............................................................................................................................................................................................................314 (2.1)移动 ................................................................................................................................................................................................................314 (2.2)复制 ................................................................................................................................................................................................................314 (2.3)旋转 ................................................................................................................................................................................................................315 (2.4)缩放 ................................................................................................................................................................................................................315 (2.5)镜像 ................................................................................................................................................................................................................315 (2.6)偏移 ................................................................................................................................................................................................................316 (2.7)阵列 ................................................................................................................................................................................................................316 (2.8)设置动态块属性 ...........................................................................................................................................................................................317 (2.9)改变对象绘图次序 .......................................................................................................................................................................................318 (2.10)写块克隆对象 .............................................................................................................................................................................................318 (3)几何关系 ...............................................................................................................................................................................................................319 (3.1)角度与弧度转换 ...........................................................................................................................................................................................319 [www.BimCad.org]深居浅出 AutoCAD 二次开发 V (3.2)夹角 ................................................................................................................................................................................................................319 (3.3)距离 ................................................................................................................................................................................................................320 (3.4)相对点 ............................................................................................................................................................................................................320 (3.5)中点 ................................................................................................................................................................................................................321 (3.6)重合 ................................................................................................................................................................................................................321 (3.7)相交 ................................................................................................................................................................................................................322 (3.8)平行 ................................................................................................................................................................................................................323 (3.9)垂直 ................................................................................................................................................................................................................323 (3.10)布尔运算 .....................................................................................................................................................................................................323 【2】数据库 ................................................................................................................................................................................ 324 (1)数据库操作 ...........................................................................................................................................................................................................324 (1.1)获得数据库 ...................................................................................................................................................................................................324 (1.2)获得对象 .......................................................................................................................................................................................................324 (1.3)删除对象 .......................................................................................................................................................................................................325 (1.4)数据库克隆 ...................................................................................................................................................................................................325 (2)块表操作 ...............................................................................................................................................................................................................326 (2.1)获取块表 .......................................................................................................................................................................................................326 (2.2)获取块表记录 ...............................................................................................................................................................................................326 (2.3)添加对象到块表记录 ...................................................................................................................................................................................327 (2.4)添加块表记录(图块)到块表 ........................................................................................................................................................................327 (2.5)模型空间 .......................................................................................................................................................................................................328 (3)层表操作 ...............................................................................................................................................................................................................329 (3.1)获得层表 .......................................................................................................................................................................................................329 (3.2)获得层表记录 ...............................................................................................................................................................................................330 (3.3)设置当前图层 ...............................................................................................................................................................................................331 (3.4)新建层表记录(图层) ....................................................................................................................................................................................331 (3.5)删除层表记录(图层) ....................................................................................................................................................................................332 (3.6)删除与图层关联的对象 ..............................................................................................................................................................................333 (4)词典操作 ...............................................................................................................................................................................................................333 (4.1)命名对象词典 ...............................................................................................................................................................................................333 (4.2)对象扩展词典 ...............................................................................................................................................................................................334 【3】用户交互 ............................................................................................................................................................................ 335 (1)输入数据 ...............................................................................................................................................................................................................335 (1.1) 输入关键字 .................................................................................................................................................................................................335 (1.2) 输入实数 .....................................................................................................................................................................................................335 (1.3) 输入整数 .....................................................................................................................................................................................................336 (1.4) 输入角度 .....................................................................................................................................................................................................336 (1.5) 输入矩形角点区域 .....................................................................................................................................................................................336 (1.6) 输入点 ..........................................................................................................................................................................................................337 (1.7) 输入距离 .....................................................................................................................................................................................................337 (1.8) 输入文件名 .................................................................................................................................................................................................338 (1.9) 输入路径 .....................................................................................................................................................................................................338 (2)选择对象 ...............................................................................................................................................................................................................339 (2.1) 选择单个对象 .............................................................................................................................................................................................339 (2.2) 选择集合 .....................................................................................................................................................................................................340 (2.4) 选择所有对象 .............................................................................................................................................................................................341 (2.5) 选择多边形区域内对象 ............................................................................................................................................................................342 (2.6) 选择视图窗口区域内对象 ........................................................................................................................................................................344 (2.7) 选择处于夹取状态的对象 ........................................................................................................................................................................345 (3)输出消息 ...............................................................................................................................................................................................................345 (3.1) 命令行提示 .................................................................................................................................................................................................345 (3.2) 打开帮助网页 .............................................................................................................................................................................................346 (3.2)警告框 ............................................................................................................................................................................................................346 (4)用户界面 ...............................................................................................................................................................................................................346 (4.1)应用程序界面 ...............................................................................................................................................................................................346 (4.2)面板 ................................................................................................................................................................................................................347 (4.3)菜单 ................................................................................................................................................................................................................347 【4】数据文件 ............................................................................................................................................................................ 350 [www.BimCad.org]深居浅出 AutoCAD 二次开发 VI (1)TXT文件 .................................................................................................................................................................................................................350 (2)Excel文件 ...............................................................................................................................................................................................................350 (3)Access数据库 ........................................................................................................................................................................................................351 第六章 开发实例 ................................................................................................................................................................................ 354 【一】程序示例 ............................................................................................................................................................................... 354 【二】数据库 .................................................................................................................................................................................. 361 【1】块表 .................................................................................................................................................................................... 361 (1)创建图块(添加块表记录到块表) .......................................................................................................................................................................361 (2)添加对象到模型空间 ..........................................................................................................................................................................................362 【2】层表 .................................................................................................................................................................................... 363 (1)创建图层(添加层表记录到层表) .......................................................................................................................................................................363 (2)删除图层(删除层表记录) ....................................................................................................................................................................................365 【3】命名对象词典 ..................................................................................................................................................................... 367 【三】实体对象 ............................................................................................................................................................................... 369 【1】添加对象 ............................................................................................................................................................................ 369 (1)添加基本图形对象 ...............................................................................................................................................................................................369 (2)添加三维对象 .......................................................................................................................................................................................................372 (3)添加图块 ...............................................................................................................................................................................................................374 (4)添加带属性的块 ...................................................................................................................................................................................................377 【2】编辑对象 ............................................................................................................................................................................ 380 (1)几何变形 ...............................................................................................................................................................................................................380 (2)扩展数据 ...............................................................................................................................................................................................................382 (3)注释比例 ...............................................................................................................................................................................................................384 (4)显示次序 ...............................................................................................................................................................................................................387 (5)驱动动态块 ...........................................................................................................................................................................................................390 【四】用户交互 ............................................................................................................................................................................... 394 【1】输出信息 ............................................................................................................................................................................ 394 (1)命令行消息 ...........................................................................................................................................................................................................394 (2)消息框提示 ...........................................................................................................................................................................................................394 (3)帮助网页 ...............................................................................................................................................................................................................395 【2】输入信息 ............................................................................................................................................................................ 397 (1)选择单个对象 .......................................................................................................................................................................................................397 (2)选择集合 ...............................................................................................................................................................................................................398 (3)输入数据 ...............................................................................................................................................................................................................399 【3】用户界面 ............................................................................................................................................................................ 401 (1)对话框 ...................................................................................................................................................................................................................401 (1.1)模态对话框 ...................................................................................................................................................................................................404 (1.2)非模态对话框 ...............................................................................................................................................................................................406 (2)面板 ........................................................................................................................................................................................................................408 (3)菜单 ........................................................................................................................................................................................................................410 (3.1)带式菜单 .......................................................................................................................................................................................................410 (3.2)右键菜单 .......................................................................................................................................................................................................412 【五】事件 ...................................................................................................................................................................................... 415 【六】步骤模仿 ............................................................................................................................................................................... 417 【七】规则重定义 ........................................................................................................................................................................... 420 【八】数据文件 ............................................................................................................................................................................... 422 附录 ...................................................................................................................................................................................................... 425 附录一:AUTOCAD版本对应的注册表信息 .................................................................................................................................... 425 附录二:AUTOCAD常用操作快捷键 ................................................................................................................................................ 426 附录三:AUTOCAD系统变量 ............................................................................................................................................................ 428 附录四:AUTOCAD字符对照表 ........................................................................................................................................................ 437 附录五:AUTOCAD颜色值表 ............................................................................................................................................................ 439 附录六:常用ARX函数 .................................................................................................................................................................... 447 [www.BimCad.org]深居浅出 AutoCAD 二次开发 VII 附录七:ARX类与托管类对应关系 ................................................................................................................................................ 452 附录八:ARX函数与托管类函数对应关系 .................................................................................................................................... 463 [www.BimCad.org]深居浅出 AutoCAD 二次开发 1 第一章 概述 CAD (Computer Aided Design)计算机辅助设计,是计算机技术的一个重要的应用领域。AutoCAD 是美国 Autodesk 公司 开发的交互式绘图软件,用于二维及三维设计、绘图的系统工具,用户可以使用它来创建、浏览、管理、打印、输出、共享 及准确复用富含信息的设计图形。 Autodesk 公司成立于 1982 年 1 月,在近二十年的发展历程中,不断丰富和完善 AutoCAD 系统,并连续推出各个新版 本使 AutoCAD 由一个功能非常有限的绘图软件发展到了现在功能强大、性能稳定、市场占有率位居世界第一的 CAD 系统, 在城市规划、建筑、测绘、机械、电子、造船、汽车等许多行业得到了广泛的应用。统计资料表明,目前世界上有 75% 的 设计部门、数百万的用户应用此软件,大约有 50 万套 AutoCAD 软件安装在各企业中运行。 AutoCAD 的更新升级的速度非常快,每个新版本都会加入一些更新更强大的功能。从 AutoCAD2000 开始,增添了如 AutoCAD 设计中心(ADC)、多文档设计环境(MDE)、Internet 驱动、新的对象捕捉功能、增强的标注功能以及局部打开和局 部加载的功能;AutoCAD 2005 新增了图纸集功能和用于显示可能会在图形生命周期中修改的数据的字段对象;AutoCAD2006 新增了动态块功能,动态块中定义了一些自定义特性,可用于在位调整块,而无需重新定义该块或插入另一个块; AutoCAD2008 增添了自动缩放注释”及多重引线,AutoCAD2010 增强了三维功能,更大的突破是参数化绘图功能,可以在图 纸上建立对象之间的几何关系及约束关系。AutoCAD 系统在不断完善,功能在不断增强。 虽然 AutoCAD 本身的功能集已经足以协助用户完成各种设计工作,但用户还可以通过 Autodesk 以及数千家软件开发商 开发的五千多种应用软件把 AutoCAD 改造成为满足各专业领域的专用设计工具。AutoCAD 荣登全球绘图软件的龙头宝座, 主要是因为它具有开放的体系结构。它允许用户和开发者采用高级编程语言对其进行扩充和修改(即二次开发)能最大限度地 满足用户的特殊要求。 【一】AutoCAD 功能特点 【1】具有完善的图形绘制功能。 【2】有强大的图形编辑功能。 【3】可以采用多种方式进行二次开发或用户定制。 【4】可以进行多种图形格式的转换,具有较强的数据交换能力。 【5】支持多种硬件设备。 【6】支持多种操作平台。 【7】具有通用性、易用性,适用于各类用户。 【二】二次开发内容 【1】编写各种用户自定义函数并形成若干 LISP、ARX、VLX、ADS、DLL 文件,以及一些 DCL 文件。 【2】建立符合自己要求的菜单文件,一般可在 AutoCAD 原菜单文件内添加自己的内容,对于 AutoCAD2000 以后版本可增 加部分菜单文件,然后经交互方式加入到系统中去。 【3】在系统的 ACAD.LSP 或类似文件中加入某些内容以便进行各种初始化操作,如在启动时立即装入一些文件等。 【4】通过系统对话框设置某些路径。这些操作在程序开发成功后向其它 AutoCAD 系统上安装应用,特别是需要大批安装时, 需要进行很多文件检索、内容增删、子目录创建、文件拷贝、系统设置等繁琐工作,如能令上述工作全部自动进行,使整个 二次开发程序在无人干预的情况下嵌入系统,大大提高工作效率。 【三】二次开发方式 AutoCAD 第一版于 1982 年 11 月推出,其二次开发语言及工具也在不断地涌现。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 2 二次开发的接口原理: 开发环境对应的编程语言: [www.BimCad.org]深居浅出 AutoCAD 二次开发 3 【1】AutoLISP AutoLISP 的全名是 LIST Processing Language,出现于 1985 年推出的 AutoCAD R2.18 中,是一种嵌入在 AutoCAD 内 部的编程语言,是 LISP 原版的一个子集,一直是低版本 AutoCAD 的首选编程语言。AutoLISP 是一种表处理语言,是被解释 执行的,任何一个语句键入后就能马上执行,对于交互式的程序开发非常方便。其缺点是继承了 LISP 语言的编程规则而导 致繁多的括号。 【2】ADS ADS 的全名是 AutoCAD Development System,是 AutoCAD 的 C 语言开发系统,ADS 本质上是一组可以用 C 语言编写 AutoCAD 应用程序的头文件和目标库,直接利用用户熟悉的各种流行的 C 语言编译器,将应用程序编译成可执行的文件在 AutoCAD 环境下运行,这种可以在 AutoCAD 环境中直接运行的可执行文件叫做 ADS 应用程序。ADS 由于其速度快,又采用 结构化的编程体系,因而很适合于高强度的数据处理,如二次开发的机械设计 CAD、工程分析 CAD、建筑结构 CAD、土木 工程 CAD、化学工程 CAD、电气工程 CAD 等。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 4 【3】ObjectARX ObjectARX 是一种崭新的开发 AutoCAD 应用程序的工具,以 C++为编程语言,采用先进的面向对象的编程原理,提供 可与 AutoCAD 直接交互的开发环境,能使用户方便快捷地开发出高效简洁的 Auto CAD 应用程序。ObjectARX 并没有包含在 AutoCAD 中,可在 AutoDesk 公司网站中去下载,ObjectARX 能够对 AutoCAD 的所有事务进行完整的、先进的、面向对象的 设计与开发,并且开发的应用程序速度更快、集成度更高、稳定性更强。ObjectARX 从本质上讲,是一种特定的 C++编程环 境,包括一组动态链接库(DLL),这些库与 AutoCAD 在同一地址空间运行并能直接利用 AutoCAD 核心数据结构和代码,库中 包含一组通用工具,使得二次开发者可以充分利用 AutoCAD 的开放结构,直接访问 AutoCAD 数据库结构、图形系统以及 CAD 几何造型核心,以便能在运行期间实时扩展 AutoCAD 的功能,创建能全面享受 AutoCAD 固有命令的新命令。ObjectARX 的 核心是两组关键的API,即 AcDb(Auto CAD数据库)和AcEd(Auto CAD编译器),另外还有其它的一些重要库组件,如AcRX(Auto CAD 实时扩展)、AcGi(Auto CAD 图形接口)、AcGe(Auto CAD 几何库)、ADSRX(Auto CAD 开发系统实时扩展)。ObjectARX 还 可以按需要加载应用程序;使用 ObjectARX 进行应用开发还可以在同一水平上与 Windows 系统集成,并与其它 Windows 应 用程序实现交互操作。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 5 【4】VisualLISP VisualLISP 已经被完整地集成到 AutoCAD 中,为开发者提供了崭新的、增强的集成开发环境,一改过去在 AutoCAD 中 内嵌 AtuoLISP 运行引擎的机制,这样开发者可以直接使用 AutoCAD 中的对象和反应器,进行更底层的开发。用它开发 AutoLISP 程序的时间被大大地缩短,原始代码能被保密,以防盗版和被更改;能帮助大家使用 ActiveX 对象及其事件;使用 了流行的有色代码编辑器和完善的调试工具,使大家很容易创建和分析 LISP 程序的运行情况。在 VisualLISP 中新增了一些 函数:如基于 AutoLISP 的 ActiveX/COM 自动化操作接口;用于执行基于 Auto CAD 内部事件的 LISP 程序的对象反应器;新 增了能够对操作系统文件进行操作的函数。 【5】VBA VBA 即 Mcrosoft office 中的 Visual Basic for Applications,被集成到 AutoCAD 中。VBA 为开发者提供了一种新的选择, 也为用户访问 AutoCAD 中丰富的技术框架打开一条新的通道。VBA 和 AutoCAD 中强大的 ActiveX 自动化对象模型的结合, 代表了一种新型的定制 AutoCAD 的模式构架。通过 VBA,我们可以操作 AutoCAD,控制 ActiveX 和其它一些应用程序,使之 相互之间发生互易活动。不过在 2010 以后的新版本中 AutoCAD 将不再支持 VBA 开发。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 6 【6】AutoCAD .NET 从 AutoCAD 2006 开始,Autodesk 为其开发增加了.NET API。.NET API 提供了一系列托管的外包类(Managed Wrapper Class),使开发人员可在.NET 框架下,使用任何支持.NET 的语言,如 VB.NET、C# 和 Managed C++等对 AutoCAD 进行二 次开发。其优点是完全面向对象,在拥有与 C++相匹配的强大功能的同时,具有方便易用的特点,是较理想的 AutoCAD 二 次开发工具。 .NET API 与传统 ObjectARX 的区别主要源于在.NET 环境下开发应用程序与在 VC 环境下开发应用程序的区别。首先, 在 VC 环境下,程序员需要自己管理内存的申请和释放,而.NET 采用了垃圾回收机制,由.NET 框架自行判断内存回收的时 机并实行回收,从而解决了令 C++程序员头痛的内存泄漏问题。也正是由于这个特点,在.NET 环境下不能象在 C++环境下 那样利用析构函数释放其他的资源,需要程序员在程序中显式地释放。在.NET API 中,主要通过 Dispose 函数进行资源的释 放。 其次,ObjectARX 中的各种反应器(Reactor)在.NET API 中由外包类映射为各种事件(Event),可通过定义这些事件的响 应函数来响应 AutoCAD 的各种操作。同时对于错误信息的处理也从函数返回值改变为通常异常来处理,使其更好地兼容.NET。 由于 VB.NET、C#等语言都是完全面向对象的,没有全局函数的概念,所以.NET API 将 ObjectARX 下的全局函数封装为.NET API 下的某些对象或对象的属性,如 ObjectARX 下与用户交互的系列全局函数被封装为 CommandLinePrompt 类。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 7 【四】开发方式对比 【1】开发方式能力范围对比 【2】开发环境的难易程度及学习时间对比 [www.BimCad.org]深居浅出 AutoCAD 二次开发 8 【3】开发环境性能对比 【4】各开发方式能力对比 [www.BimCad.org]深居浅出 AutoCAD 二次开发 9 第二章 AutoCAD 操作应用 在开发之前对于 AutoCAD 到底能做什么、需要怎么做,必须很清楚。要精通 AutoCAD 的二次开发很有必要对其功能及 应用详细的了解。 【一】基本界面 主要界面包括:标题栏、菜单栏、工具栏、状态栏、命令行,绘图区域等。 【1】标题栏 标题栏用于显示当前正在运行的程序名及文件名等信息。 【2】菜单栏与快捷菜单 (1)菜单栏几乎包括了 AutoCAD 中全部的功能和命令。 (2)快捷菜单又称为上下文相关菜单。在绘图区域、工具栏、状态行、模型与布局选项卡以及一些对话框上右击时出现, 该菜单中的命令与 AutoCAD 当前状态相关。使用它们可以在不启动菜单栏的情况下快速、高效地完成某些操作。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 10 【3】工具栏 工具栏是应用程序调用命令的另一种方式,它包含许多由图标表示的命令按钮。AutoCAD 提供了二十多个已命名的工 具栏。 【4】绘图窗口 [www.BimCad.org]深居浅出 AutoCAD 二次开发 11 绘图窗口是用户绘图的工作区域,所有的绘图结果都反映在这个窗口中。可以根据需要关闭其周围和里面的各个工具栏, 以增大绘图空间。如果图纸比较大,需要查看未显示部分时,可以单击窗口右边与下边滚动条上的箭头,或拖动滚动条上的 滑块来移动图纸。 在绘图窗口中除了显示当前的绘图结果外,还显示了当前使用的坐标系类型以及坐标原点、X 轴、Y 轴、Z 轴的方向等。 默认情况下,坐标系为世界坐标系(WCS)。 绘图窗口的下方有“模型”和“布局”选项卡,单击其标签可以在模型空间或图纸空 间之间来回切换。 【5】命令行 “命令行”窗口位于绘图窗口的底部,用于接收用户输入的命令,并显示 AutoCAD 提示信息。 【6】状态行 状态行用来显示 AutoCAD 当前的状态,如当前光标的坐标、命令和按钮的说明等。 在绘图窗口中移动光标时,状态 行的“坐标”区将动态地显示当前坐标值。坐标显示取决于所选择的模式和程序中运行的命令,共有“相对”、“绝对”和“无”3 种 模式。 状态行中还包括如“捕捉”、“栅格”、“正交”、“极轴”、“对象捕捉”、“对象追踪”、DUCS、DYN、“线宽”、“模型”(或“图 纸”)10 个功能按钮。 【二】基本功能 【1】绘图功能 [www.BimCad.org]深居浅出 AutoCAD 二次开发 12 作为一个通用绘图软件 AutoCAD 主要包括一些点、线、面、体等基本几何对象以及表格、文字、标注等对象的绘制。 【2】编辑功能 主要包括几何对象的变换、变形操作,显示、打印效果的操作。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 13 [www.BimCad.org]深居浅出 AutoCAD 二次开发 14 第三章 程序设计基础 程序设计是进行二次开发的基础。本章结合AutoCAD开发特点介绍程序设计基础及开发环境与开发语言(C#)。 【一】数据类型 【1】值类型 (1)简单类型 简单类型也称为纯量类型,是直接由一系列元素构成的数据类型。 (1.1)整数类型 整数类型的变量的值为数学中的整数。 sbyte 有符号8位整数(-128到127) byte 无符号8位整数(0 到255) short 有符号16位整数(-32,768 到32,767) ushort 无符号16位整数(0到65,535) int 有符号32位整数(-2,147,483,648到2,147,483,647) uint 无符号32位整数(0到4,294,967,295) long 有符号64位整数(9,223,372,036,854,775,808到9,223,372,036,854,775,807) ulong 无符号64位整数(0到18,446,744,073,709,551,615) (1.2)布尔类型 布尔类型是用来表示真和假这两个逻辑概念的。布尔类型表示的逻辑变量只有两种取值:真或假。在C#中分别采用true 和false两个值来表示。 (1.3)实数类型 (1.3.1)浮点类型 数学中的实数不仅包括整数而且包括小数,小数在C#中采用两种数据类型来表示单精度float和双精度double它们的差别 在于取值范围和精度不同计算机对浮点数的运算速度大大低于对整数的运算在对精度要求不是很高的浮点数计算中我们可 以采用float型而采用double型获得的结果将更为精确当然如果在程序中大量地使用双精度类浮点数将会占用更多的内存单 元而且计算机的处理任务也将更加繁重 ␀ 单精度 取值范围在正负1.5*10−45到3.4*1038之间精度为7位数 ␀ 双精度 取值范围在正负5.0*10−324到1.7*10308之间精度为15 到16位数 (1.3.2)十进制类型 十进制类型(decimal)主要用于方便我们在金融和货币方面的计算在现代的企业应用程序中不可避免地要进行大量的这 方面的计算和处理。十进制类型是一种高精度128位数据类型它所表示的范围从大约1.0*10-28到7.9*1028的28至29位有效数 字注意该精度是用位数(digits)而不是以小数位(decimalplaces)来表示的运算结果准确到28个小数位十进制类型的取值范围 比double类型的范围要小得多但它更精确当定义一个decimal变量并赋值给它时使用m下标以表明它是一个十进制类型如 decimal d_value = 1.0m;如果省略了m在变量被赋值之前它将被编译器当作双精度double 类型来处理。 (1.4)字符类型 除了数字以外计算机处理的信息主要就是字符了字符包括数字字符英文字母表达符号等。C#提供的字符类型按照国际 上公认的标准采用Unicode字符集一个Unicode的标准字符长度为16位。用它可以来表示世界上大多种语言可以按以下方法给 一个字符变量赋值如char c = 'A';另外我们还可以直接通过十六进制转义符前缀\x 或Unicode 表示法给字符型变量赋值前缀 \u 如下面对字符型变量的赋值写法都是正确的char c = '\x0032'; //char c = '\u0032'; // 常用的转义字符及其含义 转义字符 转义字符的意义 ASCII 代码 [www.BimCad.org]深居浅出 AutoCAD 二次开发 15 \n 回车换行 10 \t 横向跳到下一制表位置 9 \b 退格 8 \r 回车 13 \f 走纸换页 12 \\ 反斜线符"\" 92 \' 单引号符 39 \” 双引号符 34 \a 鸣铃 7 \ddd 1~3 位八进制数所代表的字符 \xhh 1~2 位十六进制数所代表的字符 (2)结构类型 对于一些复杂的数据类型,比如一个建筑构件可能包括长度,截面积,材料等信息,如果按照简单类型来管理每一条记 录都要存放到三个不同的变量当中这样工作量很大,数据之间的关联也不好对应。在实际生活中我们经常把一组相关的信息 放在一起,把一系列相关的变量组织成为一个单一实体的过程,我们称为生成结构的过程。这个单一实体的类型就叫做结构 类型。每一个变量称为结构的成员结构类型的变量,采用struct来进行声明。 (3)枚举类型 枚举enum 实际上是为一组在逻辑上密不可分的整数值提供便于记忆的符号。枚举类型的储存形式其实是(int)整形数据。 public enum FilterType { Curve, Dimension, Polyline, BlockRef, Circle, Line, Arc, Text, MText } 实际上FilterType.Curve 代表0,FilterType.Dimension代表1。 用以下方法可以把一个字符型变量转换成枚举型变量: FilterType V = FilterType.Dimension; string SV = V.ToString(); V = (FilterType)Enum.Parse(typeof(FilterType), SV); 【2】引用类型 引用类型是指变量不直接存储所包含的值,而是指向它所要存储的值。也就是说引用类型存储实际数据的引用值的地址。 (1)类 类是面向对象编程的基本单位,是一种包含数据成员、函数成员和嵌套类型的数据结构。类的数据成员有常量、域和事 件函数。成员包括方法、属性、索引指示器、运算符、构造函数和析构函数类和结构。(结构也都包含了自己的成员但它们 之间最主要的区别在于类是引用类型而结构是值类型) 1、类的声明 申明关键字:attributes、class-modifiers、class、identifier、class-base、class-body (其中 attributes、class-modifiers、 class-base 和 class-body 为可选项Attributes 为属性集 class-modifiers 为类的修饰符关键词 class 后跟随类的名称 identifier, class-base 和 class-body 表示继承方式和基类名。) 类的修饰符可以是以下几种之一或者是它们的组合 在类的声明中同一修饰符不允许出现多次 new 仅允许在嵌套类声明时使用,表明类中隐藏了由基类中继承而来的与基类中同名的成员。 public 表示不限制对该类的访问 protected 表示只能从所在类和所在类派生的子类进行访问 [www.BimCad.org]深居浅出 AutoCAD 二次开发 16 internal 只有其所在类才能访问。 private 只有对包.Net 中的应用程序或库才能访问。 abstract 抽象类,不允许建立类的实例。 sealed 密封类,不允许被继承。 C# 中用如下的方法声明类: namespace BIMCAD { class MyClass { ... } } 2、类的成员 1)类本身所声明的 2)从基类中继承的 成员类型 1)成员常量:与类相关联的常量值 2)域:类中的变量 3)成员方法:复杂执行类中的计算和其它操作 4)属性:定义类中的值,并对它们进行读写 5)事件:捕获发生的动作 6)索引指示器:允许像使用数组那样为类添加路径列表 7)操作符:定义类中特有的操作 8)构造函数和析构函数:分别用于对类的实例进行初始化和销毁 (2)代表 在C和C++里指针是最强有力的工具之一,由于滥用指针会给程序的安全性埋下了隐患,C#语言中取消了指针这个概念。 但是我们声明这段程序是非安全unsafe的则仍然可以在C#中使用指针。 delegate它实际上相当于C#中的函数指针原型。与指针不同的是代表在C#是类型安全的。在声明代表时只需要指定代 表指向的原型的类型,它不能有返回值也不能带有输出类型的参数。比如我们可以声明一个指向int类型函数原型的代表 delegate int MyDelegate();如果我们声明了自己的一个代表那么它就是对系统定义的类System.delegate的一个扩展。在代表 的实例中我们可以封装一个静态方法,也可以封装一个非静态的方法。 (3)数组 在进行批量处理数据的时候,我们要用到数组数组是一组类型相同的有序数据数组。按照数组名、数据元素的类型和维 数来进行描述。C#中提供System.Array类是所有数组类型的基类。 数组的声明格式: non-array-type [ dim-separators ] array-instance name 比如声明一个直线数组 Line[] lines = new Line[3]; 在定义数组的时候,可以预先指定数组元素的个数这时在[]中定义数组的元素个数,它的个数可以通过“数组名.Length” 获得,而在使用数组的时候可以在[]中加入下标来取得对应的数组元素。C#中的数组元素的下标是从0开始的也就是说第一 个元素对应的下标为0以后逐个增加。 在AutoCAD开发中我们常要把一些对象几何起来处理,常会遇到以下两个问题: 1、对象的个数不确定 2、对象的类型可能不同,如点与线要放在一个数组集合里面处理。 下面介绍两个特殊的数组用: 1、List<>(用于处理类型相同个数不同的对象数组) [www.BimCad.org]深居浅出 AutoCAD 二次开发 17 如果我们要定义一个直线数组来存入一个DWG图纸里面的所有直线,由于DWG图纸是不确定的,在定义的时候数组元 素的个数是不确定的,我们没有办法用类似Line[] lines = new Line[3];的方法来预先定义一个数组,这时候我们需要用到List<> 数组来定义List Lines = new List();遇到不同的DWG图纸时把读出的直线用Lines.Add(line);方法存入数组中即 可,存入之后我们除了可以像一般的去数组元素操作Line line = Lines[2];一样引用到数组里面的元素,可以用如:Clear()、 Contains()、Lines.Equals()等List<>数组特有的方法来处理数组。 下面的程序段是实现把DWG图纸中的文本与曲线分别存入相应的数组: List TEXT = new List(); List CURVE = new List(); using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead); foreach (ObjectId id in btr) { Entity ent = (Entity)trans.GetObject(id, OpenMode.ForRead); if (ent is DBText) { TEXT.Add((DBText)ent); } if (ent is Curve) { CURVE.Add((Curve)ent); } } trans.Commit(); } 2、ArrayList (用于处理类型不确定个数也不确定的数组) 对于更一般的情况,如果我们想在一个数组中即放直线又放圆弧,对于数组中的元素类型也不确定,我们可以用ArrayList Mix = new ArrayList();来处理,在引用数组元素的时候做一个类型判断来处理即可 if (Mix[l] is Line) { } else if (Mix[l] is Arc) { } (4)接口 一个接口定义一个协定。实现某接口的类或结构必须遵守该接口定义的协定(接口定义的成员函数)。一个接口可以从多 个基接口继承;一个类只能从一个基类中派生;但一个类或结构可以实现多个接口。 接口可以包含方法、属性、事件和索引器。接口本身不提供它所定义的成员的实现。接口只指定实现该接口的类或结构 必须提供的成员。 【二】运算符、表达式 类 别 运算符 算术运算符 + – * / % 逻辑运算符 & | ^ ~ && || ! 字符串连接运算符 + 增量和减量运算符 ++ – – 移位运算符 << >> [www.BimCad.org]深居浅出 AutoCAD 二次开发 18 比较运算符 == != < > <= >= 赋值运算符 = += –= *= /= %= &= |= ^= <<= >>= 成员访问运算符(用于对象和结构) . 索引运算符(用于数组和索引器) [] 数据类型转换运算符 () 条件运算符 (三元运算符) ?: 委托连接和删除运算符 + – 对象创建运算符 new 类型信息运算符 sizeof (只用于不安全的代码) is typeof as 溢出异常控制运算符 checked unchecked 间接寻址运算符 * –> & (只用于不安全代码) [] 命名空间别名限定符 :: 空接合运算符 ?? 逻辑关系表 p q p & q p | q p ^ q !p False False False False False True True False False True True False False True False True True True True True True True False False 【1】[] 方括号 ([]) 用于数组、索引器和属性,也可用于指针。 1、数组类型是一种后 [] : int[] fib = new int[100]; //创建一个有100元素的数组 若要访问数组的一个元素,则用方括号括起所需元素的索引: fib[0] = fib[1] = 1; for( int i=2; i<100; ++i ) fib[i] = fib[i-1] + fib[i-2];// 如果数组索引超出范围,则会引发异常。 2、不能重载数组索引运算符;但类型可以定义采用一个或多个参数的索引器和属性。索引器参数括在方括号中(就像数组索 引一样),但索引器参数可声明为任何类型(这与数组索引不同,数组索引必须为整数)。 h["a"] = 123; 3、方括号还用于指定属性: [CommandMethod("HELLO")] 4、可以使用方括号来指定指针索引: unsafe fixed ( int* p = fib ) { p[0] = p[1] = 1; for( int i=2; i<100; ++i ) p[i] = p[i-1] + p[i-2]; } 【2】() 1、用于指定表达式中的运算顺序外 2、指定强制转换或类型转换:(Circle)var把一个变量强制转换为Circle类型 【3】. 点运算符 (.) 用于成员访问。点运算符指定类型或命名空间的成员。例如,点运算符用于访问 .NET Framework 类库中 的特定方法: 【4】:: 命名空间别名限定符运算符 (::),用于查找标识符。它通常放置在两个标识符之间,例如: global::System.Console.WriteLine("Hello World"); [www.BimCad.org]深居浅出 AutoCAD 二次开发 19 命名空间别名限定符可以是 global。这将调用全局命名空间中的查找,而不是在别名命名空间中。 【5】+ +运算符既可作为一元运算符也可作为二元运算符。 1、一元+运算符是为所有数值类型预定义的。对数值类型进行一元+运算的结果就是操作数的值。 2、二元+运算符是为数值类型和字符串类型预定义的。 对于数值类型,+计算两个操作数之和。 当其中的一个操作数是字符串类型或两个操作数都是字符串类型时+将操作数的字符串表示形式串联在一起。 委托类型也提供二元 + 运算符,该运算符执行委托串联。 【6】- - 运算符既可作为一元运算符也可作为二元运算符。 1、一元-运算符是为所有数值类型预定义的。数值类型的一元-运算的结果是操作数的反数。 2、二元-运算符是为所有数值类型和枚举类型预定义的,其功能是从第一个操作数中减去第二个操作数。 委托类型也提供二元-运算符,该运算符执行委托移除。 【7】* 乘法运算符 (*),用于计算操作数的积。另外还用作取消引用运算符,允许读取和写入指针。 所有数值类型都具有预定义的乘法运算符。 * 运算符还用来声明指针类型和取消引用指针。该运算符只能在不安全的上下文中使用,通过 unsafe 关键字的使用来表示, 并且需要 /unsafe 编译器选项。取消引用运算符也称为间接寻址运算符。 【8】/ 除法运算符 (/) 用第二个操作数除第一个操作数。所有数值类型都具有预定义的除法运算符。 【9】% 模数运算符 (%) 计算第二个操作数除第一个操作数后的余数。所有数值类型都具有预定义的模数运算符。 【10】& & 运算符既可作为一元运算符也可作为二元运算符。 一元 & 运算符返回操作数的地址(要求 unsafe 上下文)。 为整型和 bool 类型预定义了二进制 & 运算符。 1、对于整型,& 计算操作数的逻辑按位“与”。 2、对于 bool 操作数,& 计算操作数的逻辑“与”;也就是说,当且仅当两个操作数均为 true 时,结果才为 true。 & 运算符计算两个运算符,与第一个操作数的值无关。 【11】| 二元 | 运算符是为整型和 bool 类型预定义的。 1、对于整型,| 计算操作数的按位“或”结果。 2、对于 bool 操作数,| 计算操作数的逻辑“或”结果;也就是说,当且仅当两个操作数均为 false 时,结果才为 false。 【12】^ 二元 ^ 运算符是为整型和 bool 类型预定义的。 1、对于整型,^ 将计算操作数的按位“异或”。 2、对于 bool 操作数,^ 将计算操作数的逻辑“异或”;也就是说,当且仅当只有一个操作数为 true 时,结果才为 true。 【13】! 逻辑非运算符 (!) 是对操作数求反的一元运算符。为 bool 定义了该运算符,当且仅当操作数为 false 时才返回 true。 【14】~ ~ 运算符对操作数执行按位求补运算,其效果相当于反转每一位。按位求补运算符是为 int、uint、long 和 ulong 类型 预定义的。 【15】= 赋值运算符 (=) 将右操作数的值存储在左操作数表示的存储位置、属性或索引器中,并将值作为结果返回。操作数的类 型必须相同(或右边的操作数必须可以隐式转换为左边操作数的类型)。 【16】< 所有数值和枚举类型都定义“小于”关系运算符 (<),如果第一个操作数小于第二个操作数,该运算符返回 true,否则返 回 false。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 20 【17】> 所有数值类型和枚举类型都定义“大于”关系运算符 >,如果第一个操作数大于第二个操作数,它将返回 true,否则返回 false。 【18】?: 条件运算符 (?:) 根据布尔型表达式的值返回两个值中的一个。条件运算符的格式如下 condition ? first_expression : second_expression; 如果条件为 true,则计算第一表达式并以它的计算结果为准;如果为 false,则计算第二表达式并以它的计算结果为准。只 计算两个表达式中的一个。 使用条件运算符,可以更简洁、雅观地表达那些否则可能要求 if-else 结构的计算。例如,为在 sin 函数的计算中避免被零 除,可编写为 if (x != 0.0) s = Math.Sin(x) / x; else s = 1.0; 或使用条件运算符, s = x != 0.0 ? Math.Sin(x) / x : 1.0; 【19】++ 增量运算符 (++) 将操作数加 1。增量运算符可以出现在操作数之前或之后: 1、第一种形式是前缀增量操作。该操作的结果是操作数加 1 之后的值。 2、第二种形式是后缀增量操作。该运算的结果是操作数增加之前的值。 数值类型和枚举类型具有预定义的增量运算符。用户定义的类型可重载++运算符。在枚举时通常允许整型运算 【20】-- 减量运算符 (--) 将操作数减 1。减量运算符可以出现在操作数之前或之后:--variable 和 variable--。第一种形式是前缀 减量操作。该运算的结果是操作数减小“之后”的值。第二种形式是后缀减量操作。该运算的结果是操作数减小“之前”的值。 数值类型和枚举类型具有预定义的增量运算符。 用户定义的类型可重载--运算符。在枚举时通常允许整型运算。 【21】&& 条件“与”运算符 (&&) 执行其 bool 操作数的逻辑“与”运算,但仅在必要时才计算第二个操作数。 操作 x && y 对应于操作 x & y 不同的是,如果 x 为 false,则不计算 y(因为不论 y 为何值,“与”操作的结果都为 false)。这被称作为“短路”计算。 不能重载条件“与”运算符,但常规逻辑运算符和运算符 true 与 false 的重载,在某些限制条件下也被视为条件逻辑运算符 的重载。 【22】|| 条件“或”运算符 (||) 执行 bool 操作数的逻辑“或”运算,但仅在必要时才计算第二个操作数。 操作 x || y 对应于操作 x | y 不同的是,如果 x 为 true,则不计算 y(因为不论 y 为何值,“或”操作的结果都为 true)。这被称作为“短路”计算。 不能重载条件“或”运算符,但规则逻辑运算符和运算符 true 与 false 的重载,在某些限制条件下也被视为条件逻辑运算符 的重载。 【23】<< 左移运算符 (<<) 将第一个操作数向左移动第二个操作数指定的位数。第二个操作数的类型必须是 int。 1、如果第一个操作数是 int 或 uint(32 位数),则移位数由第二个操作数的低 5 位给出。 2、如果第一个操作数是 long 或 ulong(64 位数),则移位数由第二个操作数的低 6 位给出。 第一个操作数的高序位被放弃,低序空位用 0 填充。移位操作从不导致溢出。 用户定义的类型可重载 << 运算符;第一个操作数的类型必须为用户定义的类型,第二个操作数的类型必须为 int。重载二 元运算符时,也会隐式重载相应的赋值运算符(如果有)。 【24】>> [www.BimCad.org]深居浅出 AutoCAD 二次开发 21 右移运算符 (>>) 将第一个操作数向右移动第二个操作数所指定的位数。 1、如果第一个操作数为 int 或 uint(32 位数),则移位数由第二个操作数的低五位给出(第二个操作数 & 0x1f)。 2、如果第一个操作数为 long 或 ulong(64 位数),则移位数由第二个操作数的低六位给出(第二个操作数 & 0x3f)。 如果第一个操作数为 int 或 long,则右移位是算术移位(高序空位设置为符号位)。如果第一个操作数为 uint 或 ulong 类型, 则右移位是逻辑移位(高位填充 0)。 用户定义的类型可重载 >> 运算符;第一个操作数的类型必须为用户定义的类型,第二个操作数的类型必须为 int。重载二 元运算符时,也会隐式重载相应的赋值运算符(如果有)。 【25】== 对于预定义的值类型,如果操作数的值相等,则相等运算符 (==) 返回 true,否则返回 false。对于 string 以外的引用 类型,如果两个操作数引用同一个对象,则 == 返回 true。对于 string 类型,== 比较字符串的值。 用户定义的值类型可重载 == 运算符。用户定义的引用类型也可重载 == 运算符,尽管在默认情况下,无论对于预定义的引 用类型还是用户定义的引用类型,== 的行为都与上面描述的相同。如果重载 ==,则还必须重载 !=。在枚举时通常允许整型 运算。 【26】!= 如果操作数相等,则不等运算符 (!=) 返回 false,否则,返回 true。为所有类型(包括字符串和对象)预定义了不等运算 符。用户定义的类型可重载 != 运算符。 对于预定义的值类型,如果操作数的值不同,则不等运算符 (!=) 返回 true,否则,返回 false。对于 string 以外的引用类型, 如果两个操作数引用不同的对象,则 != 返回 true。对于 string 类型,!= 比较字符串的值。 用户定义的值类型可重载 != 运算符(请参见 operator)。用户定义的引用类型也可重载 != 运算符,尽管在默认情况下,无论 对于预定义的引用类型还是用户定义的引用类型,!= 的行为都与上面描述的相同。如果重载 !=,则还必须重载 ==。在枚举 时通常允许整型运算。 【27】<= 所有数值和枚举类型都定义了“小于等于”关系运算符 (<=),如果第一个操作数小于或等于第二个操作数,则该运算符将 返回 true,否则返回 false。 【28】>= 所有数值类型和枚举类型都定义“大于等于”关系运算符 >=,如果第一个操作数大于或等于第二个操作数,该运算符将 返回 true,否则返回 false。 【29】+= 加法赋值运算符。 x += y 等效于 x = x + y 不同的是 x 只计算一次。+ 运算符的含义取决于 x 和 y 的类型(例如,对于数值操作数,其含义为相加;对于字符串操作 数,其含义为串联)。 不能直接重载 += 运算符,但用户定义的类型可以重载 + 运算符 【30】-= 减法赋值运算符。 x -= y 等效于 x = x - y 不同的是 x 只计算一次。- 运算符的含义取决于 x 和 y 的类型(例如,对于数值操作数,其含义为相减;对于委托操作数, 其含义为移除)。 不能直接重载 -= 运算符,但用户定义的类型可重载 - 运算符 【31】*= 二元乘法赋值运算符。 x *= y 等效于 x = x * y 不同的是 x 只计算一次。为数值类型预定义了 * 运算符以执行乘法操作。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 22 不能直接重载 *= 运算符,但用户定义的类型可重载 * 运算符 【32】/= 除法赋值运算符。 x /= y 等效于 x = x / y 不同的是 x 只计算一次。为数值类型预定义了 / 运算符以执行除法操作。 不能直接重载 /= 运算符,但用户定义的类型可重载 / 运算符。对于所有复合赋值运算符,隐式重载二元运算符会重载等效 的复合赋值。 【33】%= 模块赋值运算符。 x %= y 等效于 x = x % y 不同的是 x 只计算一次。为数值类型预定义了 % 运算符,以计算相除后的余数。 不能直接重载 %= 运算符,但用户定义的类型可重载 % 运算符 【34】&= “与”赋值运算符。 x &= y 等效于 x = x & y 不同的是 x 只计算一次。& 运算符对整数操作数执行按位逻辑“与”运算,对 bool 操作数执行逻辑“与”运算。 不能直接重载 &= 运算符,但用户定义的类型可重载二元 & 运算符 【35】|= “或”赋值运算符。 x |= y 等效于 x = x | y 不同的是 x 只计算一次。| 运算符对整型操作数执行按位逻辑“或”运算,对布尔操作数执行逻辑“或”运算。 不能直接重载 |= 运算符,但用户定义的类型可以重载 | 运算符 【36】^= “异或”赋值运算符。 x ^= y 按如下规则计算: x = x ^ y 不同的是 x 只计算一次。^ 运算符对整数操作数执行按位“异或”运算,对 bool 操作数执行逻辑“异或”运算。 不能直接重载 ^= 运算符,但用户定义的类型可重载 ! 运算符 【37】<<= 左移赋值运算符。 x <<= y 按如下规则计算: x = x << y 不同的是 x 只计算一次。<< 运算符将 x 向左移动 y 指定的位数。 不能直接重载 <<= 运算符,但用户定义的类型可重载 << 运算符 【38】>>= 右移赋值运算符。 x >>= y 按如下规则计算: x = x >> y [www.BimCad.org]深居浅出 AutoCAD 二次开发 23 不同的是 x 只计算一次。>> 运算符根据 y 指定的量对 x 进行右移位。 不能直接重载 >>= 运算符,但用户定义的类型可重载 >> 运算符 【39】-> -> 运算符将指针取消引用与成员访问组合在一起。 以下形式的表达式 x->y (其中 x 为 T* 类型的指针,y 为 T 的成员)等效于(*x).y -> 运算符只能在非托管代码中使用,不能重载 -> 运算符。 【40】?? 如果 ?? 运算符的左操作数非空,该运算符将返回左操作数,否则返回右操作数。可空类型可以包含值,或者可以是未 定义的。?? 运算符定义当可空类型分配给非可空类型时返回的默认值。如果在将可空类型分配给非可空类型时不使用 ?? 运 算符,将生成编译时错误。如果使用强制转换,并且当前未定义可空类型,将发生 InvalidOperationException 异常。 如要给层高赋值,当取到的x为空的时候默认吧3000附给层高:int Hight = x ?? 3000; 【41】is is 操作符被用于动态地检查运行时对象类型是否和给定的类型兼容。 如:判断一个变量的数据类型是否为DBText类型 if (ent is DBText) { } 【42】as as 操作符用于通过引用转换或装箱转换将一个值显式地转换成指定的引用类型, 不像显式类型转换as 不会产生任何异常,如果转换不可以进行那么结果值为null。 如要把获得的对象转换成BlockTable 类型 BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable 【43】typeof typeof 操作符用于获得系统原型对象的类型。 如要获得Line 类型的系统原型typeof(Line); 【44】new 创建一个新对象。 new constructor[(arguments)] 参数 constructor 必选项。对象的构造函数。如果构造函数没有参数,则可以省略圆括号。 arguments 可选项。任意传递给新对象构造函数的参数。 如:Point3d Point = new Point3d(10, 10, 0);创建一个坐标为(10,10,0)的点。 【45】using表达式 1、表示导入命名空间。在进行大型项目的开发过程中需要维护开发人员编写的类库,引用命名空间可以方便管理大家在命 名名字一样的类的时候可以指明具体是哪个类。 命名空间的层次:可用”.”符号把命名空间进行层次划分: using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; 就表示Autodesk.AutoCAD下级的命名空间,这样做是为了把命名空间的功能分类,使用起来更有条理。 2、定义一个范围,在范围结束时自动Dispose销毁对象。如使用AutoCAD中的事务: Transaction tr = db.TransactionManager.StartTransaction(); //处理过程 tr.Commit(); tr.Dispose(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 24 如果我们可以用using语句写成: using (Transaction trans = db.TransactionManager.StartTransaction()) { //处理过程 trans.Commit(); } 运行出using时程序会自动dispose掉trans对象释放内存。 3、定义别名。当同一个cs引用了两个不同的命名空间,但两个命名空间都包括了一个相同名字的类型的时候。当须要用到这 个类型的时候,就每个地点都要用细致命名空间的办法来区分这些相同名字的类型。而用别名的要领会更简洁,用到哪个类 就给哪个类做别名声明就可以了。如: System.Data下有DataTable类、而Autodesk.AutoCAD.DatabaseServices下也有一个同样名字的DataTable类,为了程序中把这两 个类区分开我们可以: using DataTable = Autodesk.AutoCAD.DatabaseServices.DataTable; 那么出现在程序中的DataTable就是命名空间Autodesk.AutoCAD.DatabaseServices下的DataTable了。 【三】程序流程 程序流程是指计算机处理数据的过程,是计算机处理问题的步骤、过程。 【1】顺序程序 顺序结构用来表示一个计算操作序列。计算过程从所描述的第一个操作开始,顺序依次执行后续的操作,直到序列的左 后一个操作。顺序程序是程序设计的基础,复杂的程序都是由基本的顺序语句嵌入循环或分支语句中实现功能。 如下面一段代码就是 AutoCAD 二次开发中常用到的,用于将一个对象添加到当前模型空间的代码: using (Transaction trans = Database db=HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); entId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } 【2】分支程序 分支程序提供了再两种或多种分支中选择其中一个的逻辑。 (1)if 语句 形式 1: if(表达式) 语句 如果表达式的值为真,则执行其后的语句, 否则不执行该语句 形式 2: if(表达式) [www.BimCad.org]深居浅出 AutoCAD 二次开发 25 语句 1; else 语句 2; 如果表达式的值为真,则执行语句 1,否则执行语句 2 。 形式 3: if(表达式 1) 语句 1; else if(表达式 2) 语句 2; else if(表达式 3) 语句 3; … else if(表达式 m) 语句 m; else 语句 n; 对于形式 2 的更一般情况,当有多个分支选择时,可用形式 3 下面这个例子用于判断指点的起点坐标值范围: [www.BimCad.org]深居浅出 AutoCAD 二次开发 26 if (line.StartPoint.X < 0) ed.WriteMessage("直线起点X坐标<0"); else ed.WriteMessage("直线X坐标>0"); *if 语句的嵌套 if (line.StartPoint.X < 0) { ed.WriteMessage("直线起点X坐标<0"); if (line.StartPoint.Y < 0) ed.WriteMessage("直线起点Y坐标<0"); else ed.WriteMessage("直线起点Y坐标>0"); } else { ed.WriteMessage("直线X坐标>0"); } (2)switch 语句 Switch 语句是为了简化 if 语句二出现的,可以理解为 Switch 语句的功能是 if 语句功能的子集,能处理 if 语句的特殊化 的形式。对于要判断的表达式单一,而且结果的可能性是离散的有限种情况我们可以用 switch 语句来判断。 形式: switch (expression) { case label : statementlist case label : statementlist ... default : statementlist } 参数 expression 要求值的表达式。 label 根据 expression 来匹配的标识符。如果 label === expression,则立即从冒号后的 statementlist 处开始执行,直到遇到 一个可选的 break 语句,或到达 switch 语句的最后。 statementlist 要被执行的一个或多个语句。 我们来做一个对比,下面是用 if 语句判断对象的类型: if (obj.GetType().Name = "Line") ed.WriteMessage("对象是直线"); else if (obj.GetType().Name = "Circle") ed.WriteMessage("对象是圆"); else if (obj.GetType().Name = "Arc") ed.WriteMessage("对象是圆弧"); 以上 if 语句的特点: 1、 判断的对象都是 obj.GetType().Name,在判断到结果为真之前 obj.GetType().Name 语句会不断被执行 2、 判断的结果是离散的有限种可能。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 27 如果写成 switch 语句如下: switch (obj.GetType().Name) { case "Line": ed.WriteMessage("对象是直线"); break; case "Circle": ed.WriteMessage("对象是圆"); break; case "Arc": ed.WriteMessage("对象是圆弧"); break; } obj.GetType().Name只被执行一次,运行效率比用if语句判断高,而且程序写起来也比较简洁,思路比较清晰。 (3)try、catch、finally 表达式 为了避免程序发生异常,我们可以用 try catch 语句。 try 包含你要防护的代码,称为防护块. 防护块如果出现异常,会自动生成异常对象并抛出. catch 捕捉特定的异常,并在其中进行适当处理. try { //被防护的代码 } catch(异常类名 异常变量名) { //异常处理 } finally { //无论如何都要执行的语句 } 我们来看一个例子,定义一个只有三个元素的直线数组,却要引用数组中第 5 个元素,程序会引发异常: Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; try { Line[] lines= new Line[3]; lines[5] = new Line(new Point3d(), new Point3d(100, 100, 0)); } catch (System.Exception ex) { ed.WriteMessage(ex.Message); return; } ed.WriteMessage("执行不到的语句"); 执行命令后得到如下结果: [www.BimCad.org]深居浅出 AutoCAD 二次开发 28 出现异常后程序return;出去了,ed.WriteMessage("执行不到的语句");实际上没有执行。 如果我们将代码这样写: Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; try { Line[] lines= new Line[3]; lines[5] = new Line(new Point3d(), new Point3d(100, 100, 0)); } catch (System.Exception ex) { ed.WriteMessage(ex.Message); return; } finally { ed.WriteMessage("执行到finally语句"); } 会得到如下结果: 在这里不管是否return;程序总能执行到finally里面的语句。 【3】循环程序 循环结构描述了重复计算的过程,通常由三部分组成:初始化、循环体和循环条件。 (1)while 语句 形式:while(表达式)语句 while 语句是先判断条件是否满足,再执行其中的循环语句,如下一段代码是循环让用户选取 CAD 中对象的代码,当用 户按下 ESC 或没有选择对象按下空格或回车后择退出。 while (true) { using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; [www.BimCad.org]深居浅出 AutoCAD 二次开发 29 BlockTableRecord btr = trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; PromptPointOptions pntops1 = new PromptPointOptions("\n选择起点"); PromptPointResult pntres1 = ed.GetPoint(pntops1); } (2)do-while 语句 形式: do 语句 while(表达式); do-while 与 while 的区别在于 do-while 先执行语句再进行判断时候还需要循环。因此, do-while 循环至少要执行一次循环语 句。 (3)for 语句 形式: for(表达式 1;表达式 2;表达式 3) 语句 它的执行过程如下: 1) 先求解表达式 1。 2) 求解表达式 2,若其值为真,则执行 for 语句中指定的内嵌语句,然后执行下面语句;若其值为假,则结束循环 3) 求解表达式 3。 4) 步继续执行。 循环结束,执行 for 语句下面的一个语句 [www.BimCad.org]深居浅出 AutoCAD 二次开发 30 for 循环是用得比较多的循环形式,它可以很准确的控制循环的次数,以下代码用于获得 List TEXT 数组中的每个 DBText 对象: for (int i = 0; i < TEXT.Count(); i++) { } (4)foreach 语句 要遍历一个对象集合中的每个对象可以用 foreach 语句,以下代码用于遍历 CAD 块表中的所有对象: BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead); foreach (ObjectId id in btr) { } *循环的嵌套 几种循环的比较: 四种循环都可以用来处理同一个问题,一般可以互相代替。但一般不提倡用 goto 型循环。 while 和 do-while 循环,循 环体中应包括使循环趋于结束的语句。for 语句功能最强。 用 while 和 do-while 循环时,循环变量初始化的操作应在 while 和 do-while 语句之前完成,而 for 语句可以在表达式 1 中实现循环变量的初始化。 (*)break 和 continue break 语句用于终止最近的封闭循环或它所在的 switch 语句。控制传递给终止语句后面的语句(如果有的话)。 continue 语句将控制权传递给它所在的封闭迭代语句的下一次迭代。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 31 【四】数据结构 数据结构是程序设计的重要理论和技术基础,是指数据元素的集合(或数据对象)及元素间的相互关系和构造方法。元素 之间的相互关系是数据的逻辑结构,数据元素及元素元素之间的关系的储存形式称为储存结构(物理结构)。 【1】线性结构 (1)线性表 1、顺序存储: 顺序存储是指用一组地址连续的存储单元依次存储线性表中的数据元素,逻辑上相邻的两个元素在物理位置上也相邻。 2、链式存储: 用节点来存储数据元素,节点的数据域储存数据元素的值,指针域储存当前元素的前驱或后即节点的信息。节点之间通 过指针域构成一个链表。 插入节点: 删除节点: [www.BimCad.org]深居浅出 AutoCAD 二次开发 32 (2)栈 栈是只能通过访问它的一端来实现数据存储和检索的一种线性数据结构(先进后出的线性表)。表达式的求职、括号匹配、 计算机语言的实现、将递归过程转变为非递归过程处理,都要用到栈结构。 1、顺序存储: 用一组地址连续的存储单元依次存储自栈顶到栈底的数据元素,同时附设指针 top 指示栈顶元素的位置。 2、链式存储 用链表的形式储存栈。 (3)列队 列队只允许在表的一端插入元素,而在另一端删除元素的线性数据结构(先进先出的线性表)。处理排队、顺序任务、离 散时间的计算机模拟等常用到列队结构。 1、顺序存储 利用一组地址连续的存储单元存放列队中的元素,并设置头指针和尾指针分别指向对了的首元素和尾元素。 2、链式存储 用链表的形式储存列队。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 33 【2】非线性结构 (1)树 树是一个数据元素可以有两个或两个以上的直接后继元素的线性表。树可以用来描述客观世界中的层次关系。 (2)二叉树 二叉树是 n(>=0)个节点的有限集合,它或者是空树(n=0),或者是由一个根节点及两颗不想交的且分别称为左、右字数的 二叉树组成。 1、顺序储存 [www.BimCad.org]深居浅出 AutoCAD 二次开发 34 2、链式储存 可以用二叉链表或三叉链表(一个节点包含有两个或三个指针)来储存二叉树。 (3)图 图是除首节点没有前驱、末节点没有后继之外,一个节点只有唯一的一个直接前驱和唯一的一个直接后继的 1、邻接矩阵储存 利用一个矩阵来表示图中顶点之间的关系。对于具有 n 个顶点的图 G=(V,E)其邻接矩阵是一个 n 阶方阵。 2、邻接链表储存 为图的每个顶点建立一个单链表,第 i 个单链表中的节点表示依附于顶点 vi 的边(对于有向图是以 vi 为尾的弧)。邻接链 表中的节点有表节点和表头节点两种类型。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 35 adjvex:指示与顶点 vi 邻接的顶点的序号。 nextarc:指示吓一跳边或弧的节点。 Info:储存与边或弧有关的信息。 data:储存顶点名。 firstarc:指示邻接表的第一个节点(邻接顶点) 【3】数据排序、查找 (1)排序 排序操作是指使得含 n 个记录相应关键字为{K1,K2,…Kn}内容为{R1,R2,…,Rn}的文件按照他们的关键字满足如下递增 (或递减)关系:Kj1<=Kj2<=…<=Kjn(或 Kj1>=Kj2>=…>=Kjn)。简单的说就是将一个无序的序列调整为一个有序的序列的 过程,排序的主要目的是为了方便的查找。 (1)冒泡排序 n 个记录进行冒泡排序的方法是:首先将第一个记录的关键字和第二个记录的关键字进行比较,若为逆序,则交换这两 个记录的值,然后比较第二个记录和第三个记录的关键字,依次类推,直至第 n-1 个记录和第 n 个记录的的关键字比较过为 止。 在最坏的情况下比较次数为 次,移动次数为 次。冒泡排序是一种稳定的排序方法,其时间 夫再度为 O(n2),空间复杂度为 O(1)。 算法: public class BubbleSorter { public void Sort(int[] list) { int i, j, temp; bool done = false; j = 1; while ((j < list.Length) && (!done)) { done = true; for (i = 0; i < list.Length - j; i++) { if (list[i] > list[i + 1]) { done = false; temp = list[i]; [www.BimCad.org]深居浅出 AutoCAD 二次开发 36 list[i] = list[i + 1]; list[i + 1] = temp; } } j++; } } } (2)选择排序 选择排序是通过 n-i(1<=i<=n)次关键字之间的比较,从 n-i+1 个记录中选出关键字最小的记录,并和第 i 个记录进行交 换,当 i 等于 n 时所有记录有序排列。 最坏的情况下移动次数为 3(n-1),比较次数为 ,其时间夫再度为 O(n2),空间复杂度为 O(1)。 算法: public class SelectionSorter { private int min; public void Sort(int[] list) { for (int i = 0; i < list.Length - 1; i++) { min = i; for (int j = i + 1; j < list.Length; j++) { if (list[j] < list[min]) min = j; } int t = list[min]; list[min] = list[i]; list[i] = t; } } } (3)插入排序 插入排序的方法是:在插入第 i 个记录时,R1,R2,Ri-1 排好序,这是将 Ri 的关键字 ki 依次与关键字 ki-1,ki-2 等进行比较, 从而找到应该插入的位置并将 Ri 插入,插入位置气候的记录依次向后移动。 最坏的情况下,比较次数为 次,移动次数 次,其时间夫再度为 O(n2),空间复杂度为 O(1)。 算法: public class InsertionSorter { public void Sort(int[] list) { for (int i = 1; i < list.Length; i++) { int t = list[i]; int j = i; while ((j > 0) && (list[j - 1] > t)) [www.BimCad.org]深居浅出 AutoCAD 二次开发 37 { list[j] = list[j - 1]; --j; } list[j] = t; } } } (4)希尔排序 希尔排序的做法是:先将整个待排序记录序列分割成若干序列,然后分别进行插入排序,待整个序列中的记录基本有序 时在对全体记录进行依次插入排序。 算法: public class ShellSorter { public void Sort(int[] list) { int inc; for (inc = 1; inc <= list.Length / 9; inc = 3 * inc + 1) ; for (; inc > 0; inc /= 3) { for (int i = inc + 1; i <= list.Length; i += inc) { int t = list[i - 1]; int j = i; while ((j > inc) && (list[j - inc - 1] > t)) { list[j - 1] = list[j - inc - 1]; j -= inc; } list[j - 1] = t; } } } } (2)查找 查找是对数据集合的基本运算。查找主要进行两种操作: 1、查询某个特定数据元素是否在表中(如:在 AutoCAD 二次开发中我们常需要查找某个名字的图层是否在层表中) 2、检索某个特定元素的属性(如:在 AutoCAD 二次开发中某对象的位置或图层) (1)线性查找 所谓线性查找,就是顺序访问要查找的几何,在线性时间内查找出结果。其时间复杂度为 O(n)。 算法: public static int Liner Sort(int[] num, int number) { for (int i = 0; i < num.Count(); i++) { if (num[i] == number) [www.BimCad.org]深居浅出 AutoCAD 二次开发 38 return i; } return 0; } (2)折半查找 如果不是从一组随机的序列里查找,而是从一组排好序的序列里找出某个元素的位置,则用折半查找算法更快。其时间 复杂度为 log2(n)。 算法: public static int BsearchSort(int[] num, int number) { int mid; int low = 0; int high = num.GetLength(); while (low <= high) { mid = (low + high) / 2; if (number == num[mid]) return mid; else if (number > num[mid]) low = mid + 1; else high = mid - 1; } return 0; } 【五】算法 一个程序应包括: 1、对数据的描述:在程序中要指定数据的类型和数据的组织形式,即数据结构(data structure)。 2、对操作的描述:即操作步骤,也就是算法(algorithm)。 算法的特性: 1、有穷性,一个算法必须在执行过程,在有穷时间解决问题。 2、确定性,算法中指令有确切的含义,在相同条件下有唯一的执行路径,且对于同样的数据有相同的计算结果。 3、可行性,可以实现计算表达式的求解。 4、输入,一个算法有零个或多个输入。 5、输出,一个算法有一个或多个输出。 在实际应用中,算法的表现形式千变万化,但许多算法的设计思想具有相似之处。归纳起来,常用的算法大致可分为以 下几类: 【1】穷举法 基本思想是在一个可能存在可行状态(可行解)的状态全集中依次遍历所有的元素,并判断是否为可行状态。 平时我们用的最多的“遍历”操作就是基于穷举算法,例如当前 AutoCAD 中打开有多个文档我需要把这些文档全部关闭, 就需要用穷举的算法,依次得到这些文档将其关闭。 DocumentCollection docs = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager; foreach (Document doc in docs) { doc.CloseAndDiscard(); } 【2】贪心法 基本思想是试图通过局部最优解得到全局最优解。贪心算法在解决问题的策略上是仅根据当前已有的信息作出选择,而 且一旦作出了选择不管将来有什么结果。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 39 【3】分治法 基本思想是把一个规模较大的问题划分成相似的小问题,分而治之、各个求解,再得整个问题的解。 步骤: 1、分解:将原问题分解成一系列子问题。 2、求解:递归的求解各子问题。(如果子问题足够小直接求解) 3、合并:将子问题的解合并成原问题的解。 【4】回溯法 基本思想是一步一步向前试探,等有多种选择时任意选择一种,只要可行就继续向前,一旦失败时就后退回来选择其它 可能性。 【5】动态规划法 基本思想是把大问题分解为若干小问题,通过求解子问题来得到原问题的解。由于这些子问题相互包含,为了复用已计 算的结果,常把计算的中间结果全部保存起来,自底向上多路经地求解计算原问题的解。动态规划算法常用于求解具有某种 最优性质的问题。 步骤: 1、找出最优解的性质,并刻画其结构特征。 2、递归的定义最优解的值。 3、以自底向上的方式计算出最优值。 4、根据计算最优值时得到的信息构造一个最优解。 【6】分枝界限法 基本思想是在表示问题空间的树上进行系统搜索时采用广度优先策略,同时利用最优解属性的上下界来控制搜索的分 枝。 【7】递归算法 递归是指子程序(或函数)直接调用自己或通过一系列调用语句简洁调用自己,是一种描述问题和解决问题的常用方法。 使用递归技术往往使函数的定义和算法描述简洁易于理解。 递归有两个要素: 1、边界条件,即确定递归到合适终止(递归出口)。 2、递归模式,即大问题是如何分解为小问题的(递归体)。 如果我们要遍历一个文件夹中所有子文件夹的每个文件,子文件夹下面有有子文件夹,按照常规的思想很难处理,我们 可以用递归的方法解决: static void DirSearch(string sDir) { try { foreach (string d in Directory.GetDirectories(sDir)) { foreach (string f in Directory.GetFiles(d)) { //处理代码 } DirSearch(d); //递归查询 调用自己 } } catch (Exception excpt) { //异常处理 [www.BimCad.org]深居浅出 AutoCAD 二次开发 40 } } 【六】函数 为了使程序的层次结构清晰,便于程序的编写、阅读、调试。我们可以用函数来组织程序。 形式: 1、无参函数的定义形式 类型标识符 函数名() { 声明部分 语句 } 2、有参函数定义的一般形式 类型标识符 函数名(参数表列) { 声明部分 语句 } 类型标识符: 1、标识函数是公有函数还是私有函数还是受保护函数 public、private、protected 2、标识函数类型静态函数、虚函数、重写函数、抽象函数 static、virtual、override、abstract 3、标识函数返回值类型,无返回值则定义为 void 参数类型: 1、ref ref 是传地址,相当于 C++里面的&,在函数里改变这个参数的值,退出函数后,这个参数值的改变会保留,不用 ref 的 时候,参数一般都是原值的一份拷贝,在函数内改变参数值不影响函数外面的原值,用 ref 不产生新的拷贝,就是它本身被 传递进去了 2、out out 表示输出参数,这是 C#里新增的,使用 out 时要注意,out 参数必须是未赋值的,只能是而且必须是在函数内部对 它进行赋值。在函数内部对 out 参数赋值的时候,不能将赋值语句放在不确定执不执行的块中,例如 if,switch,try 等。放 在 finally 中可以,finally 是绝对执行的,而且里面不能存在 return。 看下面这个例子,不管是值类型的还是引用类型的变量用 ref 和 out 参数原值都会被改变,区别在于 out 类型做参数必 须给它附有初值。 [CommandMethod("Parm")] public void Parm() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; string p1 = "没变"; string p2 = "没变"; parm1(ref p1); parm2(p2); ed.WriteMessage("参数1{0} 参数2{1}", p1, p2); } public static void parm1(ref string word) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 41 word = "改变"; } public static void parm2(string word) { word = "改变"; } 【七】事件 事件为类和类的实例提供了向外界发送通知的能力,而索引指示器则可以像数组那样对对象进行索引访问。AutoCAD 中 的事件取代了 ARX 开发中的反应器。 如你想要在一个 DWG 文件加载完成后对图纸自动做一些操作,或者再双击某个实体对象的时候弹出一个对话框显示对 象的属性,要扑捉到这些动作做出相应的反应,就需要在程序中注册事件来扑捉相关的动作,然后在事件指向的函数中做出 相应的反应。 如我们给 DataBase 添加新建对象的事件: 如已经有一个DataBase对象Database db = HostApplicationServices.WorkingDatabase; 1、注册事件扑捉相关的动作: db.ObjectAppended += new ObjectEventHandler(db_ObjectAppended); 2、填写事件指向的函数,做相关的操作,在 db_DwgFileOpened 函数中添加响应事件的代码: void db_DwgFileOpened(object sender, DatabaseIOEventArgs e) { //事件响应代码 } 3、当不需要对一个动作做出相应的反应的时候可以取消这个事件: db.ObjectAppended -= new ObjectEventHandler(db_ObjectAppended);注销对事件的声明。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 42 【八】.NET 简介 .NET 就是 Microsoft®的 XML Web 服务平台。.NET 使编程工作变得更加容易,开发投资的回报率趋于最大化,任何编程 语言都可以用来编写 XML Web 服务(如:C、C++、Visual Basic、Cobol、Perl、Python 和 Java 等),程序员可以选择最熟悉 的语言来编程,这大大提高了开发效率。并不会因为使用了不同的语言而失去跨服务或跨组件的调试能力。 【1】运行原理 .Net 程序主要依靠.Net Framework 来生成及部署。.Net Framework 由两部分组成,分别是公共语言运行时(CLR),统一 类库集(FCL)。公共语言运行时(CLR):包括两部分分别为,公共语言规范(CLS)及公共类型规范(CTS)。统一类库集(FCL):涵 盖了我们以后开发中要用到的基本框架类,ADO.NET,WINFORM,WEBFORM,WEBSERVICES 等类库集。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 43 【2】开发环境 开发环境是编写代码编译程序的工具。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 44 (1)菜单 通过菜单你可以便捷的使用编译环境的功能。 (2)“代码设计”窗口 在代码设计窗口中编辑程序的代码。 (2) “解决方案资源管理器”窗口 [www.BimCad.org]深居浅出 AutoCAD 二次开发 45 在解决方案资源管理器中可以浏览组成当前解决方案的全部项目以及各项目的所有文件。 (3)“类视图”窗口 在类视图窗口中可以查看项目中的类和类型的层次结构。 (4)“属性”窗口 属性窗口用于以声明方式为解决方案中的不同元素设置属性和事件。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 46 (4)工具箱 工具箱包含各种工具,可以通过拖动动作方便的将一些元素添加到项目中。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 47 【九】C#简介 C#是由 Microsoft 开发的一种新型编程语言,由于它是从 C 和 C++ 中派生出来的,具有 C++功能的同时又像 VB 一样 简单 Java 一样易用,同时也具有 Delphi 的一些优点。吸取了其他类似语言的经验,是.NET 平台的代表语言。 【1】关键字 abstract enum long stackalloc as event namespace static base explicit new string bool extern null struct break false object switch byte finally operator this case fixed out throw catch float override true char for params try checked foreach private typeof class goto protected uint const if public ulong continue implicit readonly unchecked decimal in ref unsafe default int return ushort delegate interface sbyte using do internal sealed virtual double is short void else lock sizeof while 【2】程序结构 [www.BimCad.org]深居浅出 AutoCAD 二次开发 48 【十】编码规范 写一个可运行的程序不难,可要写出高效率、易于维护的代码就有很多讲究。程序设计员应该规范的编码,养成良好的 编程习惯。 【1】命名规范 Pascal 形式:所有单词第一个字母大写,其他字母小写(如:BimCad)。 Camel 形式:除了第一个单词,所有单词第一个字母大写,其他字母小写(如:bimCad)。 1、类:类名使用 Pascal 大小写形式,类名要与文件名相同,用有意义描述性的词语命名。 public class BimCad { } 2、域:域都定义为 Private 类型,使用 Camel 大小写形式,用有意义描述性的词语命名。 Private int bimCad; 3、属性:属性定义为 public 或 protected 类型, 使用 Pascal 大小写形式,用有意义描述性的词语命名。 public int BimCad; 4、方法:方法名使用 Pascal 大小写形式。方法变量及形式参数使用 Camel 大小写形式。用有意义描述性的词语命名。 void BimCad (string autoCad) { int autoDesk; } 【2】程序组织规范 避免使用大文件,一个文件的代码超控制在 300~400 行。 避免写太长的方法,一个典型的方法代码在 1~25 行之间。 避免在程序中使用固定数值,用常量代替。 避免代码中使用具体的路径和驱动器名。 使用相对路径,并使路径可编程。 避免使用很多成员变量。声明局部变量,并传递给方法。 避免在方法间共享成员变量。 必要时使用枚举类型。少用数字或字符串来指示离散值。 不必在所有方法中捕捉一般异常。 第四章 数据库基础 数据库是依照某种数据模型组织起来并存放二级存储器中的数据集合。DWG 图纸实际上就是一个小型的数据库,里面 存放了相关的表里面记录着图形化的非图形化的 AutoCAD 对象,而且在 AutoCAD 二次开发中也会常要用外部数据库记录处 理图形对象数据,因此很有必要对数据库知有所了解。 【一】数据模型 【1】层次型 层次模型是较早用于数据库技术的一种数据模型,它是按层次结构来组织数据的。层次结构也叫树形结构,树中的每个 结点代表一种实体类型。这些结点应满足:有且仅有一个结点无双亲,这个结点称为根结点;其他结点有且仅有一个双亲结 点。 【2】网状型 在网状模型中,结点间的联系可以是任意的,任何两个结点间都能发生联系,更适于描述客观世界。该模型允许:一个 结点可以有多个双亲结点;多个结点无双亲结点。 【3】关系型 [www.BimCad.org]深居浅出 AutoCAD 二次开发 49 关系模型是在层次和网状模型之后发展起来的,它表示实体间联系的方法与层次模型和网状模型不同。所谓关系模型, 就是将数据及数据间的联系都组织成关系的形式的一种数据模型。在关系模型中,数据被组织成一些二维表格,一个二维表 称为一个关系。在关系型数据库系统中,对数据的全部操作都可以归结为关系的运算。 【4】面向对象型 面向对象的数据库在应用系统开发速度和维护等方面有着极大的优越性。面向对象数据库系统产生于 80 年代后期,它 利用类的设施来描述复杂对象,利用类中封装的方法来模拟对象的复杂行为,利用继承性来实现对象的结构和方法的重用。 面向对象数据库系统对一些特定应用领域(例如 CAD 等),能较好地满足其应用需求。但是,这种纯粹的面向对象数据库系统 并不支持 SQL 语言,在通用性方面失去了优势,因而其应用领域受到了很大的局限。 【二】关系型数据库 【1】表:关系数据库的主要特点之一就是用表的方式组织数据。表是 SQL 语言存放数据、查找数据以及更新数据的基本数 据结构在 SQL 语言中,表有严格的定义,它是一种二维表,规定如下: (1)一张表都有一个名字,通常称为表名或关系名。表名必须以字母开头,最大长度为 30 个字符。 (2)一张表可以由若干列组成,列名唯一,列名也称作属性名。 (3)表中的一行称为一个元组,它相当于一条记录。 (4)同一列的数据必须具有相同的数据类型。 (5)表中的每一个列值必须是不可分割的基本数据项。 【2】属性:一张表格中的一列,相当于记录中的一个数据项(或称为字段) 【3】域:属性的取值范围 【4】元组:表格中的一行。相当于记录值。 【5】关键字:用一个或若干个属性集合的值标识这些元组。 【6】分量:每一行对应的属性值。 【7】记录型:表格的框架。 【8】同质文件:一个表格数据。 【9】关系:数据被组织成若干张二维表,每张表称为一个关系。 【三】SQL 语言 SQL 全称是“结构化查询语言(Structured Query Language)”,是高级的非过程化编程语言,允许用户在高层数据结构上 工作。不要求用户指定对数据的存放方法,也不需要用户了解具体的数据存放方式,具有完全不同底层结构的不同数据库系 统可以使用相同的 SQL 语言作为数据输入与管理的接口。它以记录集合作为操纵对象,所有 SQL 语句接受集合作为输入, 返回集合作为输出,这种集合特性允许一条 SQL 语句的输出作为另一条 SQL 语句的输入,所以 SQL 语言可以嵌套,这使他 具有极大的灵活性和强大的功能,在多数情况下,在其他语言中需要一大段程序实现的一个单独事件只需要一个 SQL 语句就 可以达到目的,这也意味着用 SQL 语言可以写出非常复杂的语句。 【1】创建表 当用户需要新的数据结构或表存放数据时,需要生成表。 语法: CREATE TABLE 表名 [表约束] (列名 1 数据类型 [缺省值 1,列约束 1] (列名 2 数据类型 [缺省值 2,列约束 2] … 列名 n 数据类型 [缺省值 n,列约束 n] [TABLESPACE 表空间名称] [STORAGE (存贮的子句)] [ENABLE 约束名] [DISABLE 约束名] 【2】插入数据 [www.BimCad.org]深居浅出 AutoCAD 二次开发 50 向表中插入数据。 语法: INSERT INTO 表名[(列名 1,…)] VALUES(值 1,值 2,…,值 n) [子查询]; 【3】修改数据 对表中已有数据进行修改。 语法: UPDATE 表名 SET 列名 1=表达式 1,列名 2=表达式 2,… WHERE 条件; 【4】删除数据 删除表中已有数据,不能删除不存在的数据。 语法: DELETE FROM 表名 WHERE 条件; 【5】修改表结构 (1)在已存在的表中增加新列。 语法: ALTER TABLE 表名 ADD(新列名 数据类型(长度)); (2)增加已有列的数据类型。 语法: ALTER TABLE 表名 MODIFY(列名 VARCHAR2(25)); 【6】删除表 将已经存在的表删除。 语法: DROP TABLE 表名; 【7】查询语句 按照一定的关系,一定的条件查找数据。 语法: SELECT [DISTINCT|ALL] {*|模式名.] {表名|视图名| 快照名] .*…| {表达式[列别名]…} } [, [模式名. ] {表名| 视图名|} .*…| 表达式[列别名] ]… FROM [模式名.] {表名|视图名|快照名} [@数据库链名] [表别名] [, [模式名.] {表名|视图名|快照名} [@数据库链名] [表别名] ]… [WHERE 条件] [START WITH 条件 CONNECT BY 条件] [GROUP BY 表达式[,表达式] …[HAVING 条件] [UNION|UNION ALL |INTERSECT|MINUS]SELECT 命令 [ORDER BY{表达式|位置} [ASC|DESC] [, {表达式|位置[ASC|DESC]}]…] [www.BimCad.org]深居浅出 AutoCAD 二次开发 51 【四】数据库设计范式 数据库设计范式,是数据库设计的原则: 【1】第一范式 对于表中的每一行,必须且仅仅有唯一的行值。在一行中的每一列仅有唯一的值并且具有原子性。(第一范式是通过把 重复的组放到每个独立的表中,把这些表通过一对多关联联系起来这种方式来消除重复组的。) 【2】第二范式 非主键列是主键的子集,非主键列活动必须完全依赖整个主键。主键必须有唯一性的元素,一个主键可以由一个或更多 的组成唯一值的列组成。一旦创建,主键无法改变,外键关联一个表的主键。主外键关联意味着一对多的关系。(第二范式 处理冗余数据的删除问题。当某张表中的信息依赖于该表中其它的不是主键部分的列的时候,通常会违反第二范式。) 【3】第三范式 非主键列互不依赖。(第三范式规则查找以消除没有直接依赖于第一范式和第二范式形成的表的主键的属性。我们为没 有与表的主键关联的所有信息建立了一张新表。每张新表保存了来自源表的信息和它们所依赖的主键。) 【4】第四范式 禁止主键列和非主键列一对多关系不受约束 。 【5】第五范式 表分割成尽可能小的块,为了排除在表中所有的冗余。 【五】DWG 数据库 DWG 文件实际上是一个小型的数据库文件,里面存放着各种符号表与一个命名对象词典。(DWG 文件格式见附录) 先了解他们的关系,以后的章节中会详细介绍各种表对象与表记录对象及词典的操作: CAD 数据库里面的关系表分为两大类(1)符号表(2)命名对象词典 [www.BimCad.org]深居浅出 AutoCAD 二次开发 52 以上这些表都是创建一个 DWG 图纸时 DataBase 中系统默认创建的符号表及词典。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 53 第五章 AutoCAD.NET 开发 .NET环境下对AutoCAD进行二次开发主要是用到AutoCAD.NET APIs 对AutoCAD 应用程序进行操作。AutoCAD .NET API 使用户可通过编程的方法利用程序集或库显示的 AutoCAD 和图形文件的对象来操纵它们。通过显示的对象,它们可被许多 不同的编程语言和环境访问。更多的编程环境可以编程访问 AutoCAD。在.NET API 出现之前,开发人员只能局限于使用 ActiveX 自动操作和支持 COM 的语言、AutoLISP 和 ObjectARX 的 C++。通过使用应用程序本地化的.NET API 或显示的 ActiveX/COM 库与其它 Windows 应用程序(例如 Microsoft Excel 和 Word)共享数据比以前要方便得多。.NET 框架是为 32 位 及 64 位操作系统而设计,而 VBA 只为 32 位操作系统设计。相对于传统编程语言,如 C++、.NET 具有更低的学习成本来访 问高级接口。 ObjectARX 托管封装类提供给 ObjectARX SDK,这样你就可以使用 Microsoft .NET Framework 所支持的任何语言来编写 程序。托管封装类实现了数据库功能并使你可以编制读写 DWG 文件的程序。托管封装类同时还提供了对 AutoCAD 界面元素 的访问,包括命令行、特性对话框、AutoCAD 编辑器及发布和打印组件。 你可以用任意版本的 VisualStudio.NET 编译器来编译你的程序(不必像用 C++开发时需要考虑编译环境与 SDK 版本的对 应关系)最终是要得到一个可在 AutoCAD 中加载的 DLL 文件,目前 AutoCAD .NET API 二次开发还存在版本问题,但要使用 不同版本的 AutoCAD 你几乎不用修改你的代码,只需要加载不同版本的 AutoCAD.NET API 库文件后重新编译你的程序就能 在新版本的 AutoCAD 中被加载运行。 【一】AutoCAD.NET 开发环境及实现方法 这里介绍下.NET 环境下对 AutoCAD 进行二次开发的实现过程以及一些设置方法。 【1】创建项目 (1)新建一个 C#工程 (2)添加引用:\Program Files\AutoCAD 2010 目录下的 agmgd.dll 和 acdbmgd.dll 两个库文件,并把引用的 DLL 文件 的“复制本地(Copy Local)”属性设置为 False [www.BimCad.org]深居浅出 AutoCAD 二次开发 54 (3)设置工程的属性,在“调试(Debug)”选项卡中把“启动外部程序(Start external program )”项指向 AutoCAD 主程序 (:\Program Files\AutoCAD 2010 目录下的 acad.exe)的路径,这样以后可以直接点击调试或者按 F5 自动启动 AutoCAD 程序进行调试。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 55 (4)加入命名空间 using Autodesk.AutoCAD.DatabaseServices;// (Database, DBPoint, Line, Spline) using Autodesk.AutoCAD.Geometry ;//(Point3d, Line3d, Curve3d) using Autodesk.AutoCAD.ApplicationServices;// (Application, Document) using Autodesk.AutoCAD.Runtime;// (CommandMethodAttribute, RXObject, CommandFlag) using Autodesk.AutoCAD.EditorInput ;//(Editor, PromptXOptions, PromptXResult) *主要引用的 DLL 及命名空间 请参考 AutoCAD 托管封装类参考 Managed Class Reference 来获取可用的托管封装类的完整列表。 ObjectARX 托管封装类存在于下面 3 个库中: 1、acdbmgd.dll 包含的是对 ObjectDBX™ API 的封装。这个 DLL 是 Autodesk® RealDWG SDK 的一部分。 -用于在图形文件中对对象进行操作。 主要包含的命名空间: Autodesk.AutoCAD.Colors Autodesk.AutoCAD.DatabaseServices Autodesk.AutoCAD.Geometry Autodesk.AutoCAD.Runtime Autodesk.AutoCAD.GraphicsInterface Autodesk.AutoCAD.LayerManager 2、acmgd.dll 包含的是对大多数 AutoCAD API 的封装。 -用于对 AutoCAD 应用程序进行操作。 主要包含的命名空间如下 Autodesk.AutoCAD.ApplicationServices Autodesk.AutoCAD.EditorInput Autodesk.AutoCAD.Windows Autodesk.AutoCAD.Windows.ToolPalette [www.BimCad.org]深居浅出 AutoCAD 二次开发 56 Autodesk.AutoCAD.Internal.Windows Autodesk.AutoCAD.Internal.Forms 3、AcCui.dll -用于操作用户自定义文件。 主要包含的命名空间如下: Autodesk.AutoCAD.Customization Autodesk.AutoCAD.Customization.Interop (5)添加常用的引用 using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application; using DBTransMan= Autodesk.AutoCAD.DatabaseServices.TransactionManager; using doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; (6)声明命令: [CommandMethod("Create", "MyCommand", CommandFlags.Modal)] public void command() { } *加载程序后自动运行命令的方法 namespace CAD { public class CAD: IExtensionApplication { public void Initialize() { //程序加载后立即执行的代码 } public void Terminate() { } } } 【2】编译、调试 程序编写好之后按快捷键 F6 或者点击菜单“生成”->“生成解决方案”之后就能编译本工程,编译成功后,会在工程目录的 bin\Debug 文件夹下生成了本工程的 DLL 文件。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 57 如果编译不成功,编译环境会在下面的错误列表中显示错误及警告,双击错误行,会自动跳转到错误的位置,依次改正 后,重新执行编译操作则可编译成功。 编译成功后可看见如下提示: 编译成功后在需要调试的代码行按 F9 设置断点: [www.BimCad.org]深居浅出 AutoCAD 二次开发 58 设置好断点后按快捷键“F5”或点击菜单“调试”->“启动调试”启动调试,编译环境会自动打开 AutoCAD 程序。 在 AutoCAD 中加载编译生成的 DLL 文件后运行你自定义的命令,程序执行到你设置断点的行会自动中断。 你可以按快捷键 F11 或点击菜单“调试”->“逐语句”执行。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 59 也可以按快捷键 F10 或点击菜单“调试”->“逐过程”执行。 也可以按快捷键 F5 或点击菜单“调试”->“继续”执行。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 60 在调试的过程中将鼠标移动到变量字符上会在旁边提示框,或在自动窗口中显示相关变量的信息。 【3】加载程序 打开 AutodCAD 在命令栏输入 NETLOAD 命令会弹出“选择.NET 程序集”对话框,选择编译好的 DLL 文件在 AutoCAD 就 可以像使用 AutoCAD 自带的命令及面板或者菜单一样使用自己定制的东西了。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 61 *自动加载应用程序 自动加载.NET 开发的 DLL 程序库需要修改注册表信息 HKEY_LOCAL_MACHINE 下的 AutoCAD 相应版本下的 Application 项下创建一个新项里面设以下四个个键值: "DESCRIPTION"(应用程序描述) "LOADCTRLS"(加载控制-控制程序随 CAD 加载的方式,设为 Ox02 随 CAD 启动一起加载) "LOADER"(应用程序路径) "MANAGED"(程序形式-设为 Ox01,告诉 CAD 这是托管程序) 注: 1、具体各版本对应的注册表信息见附录。 2、注册表键值"LOADCTRLS"控制说明,控制 ARX 程序的加载方式 0x01:Load the application upon detection of proxy object.当代理对像被控知时另载相应 ARX 程序. 0x02:Load the application upon AutoCAD startup.当 AutoCAD 启动时加载相应 ARX 程序. 0x04:Load the application upon invocation of a command.当输入命令时加载相应 ARX 程序. 0x08:Load the application upon request by the user or another application.当有用户或别的程序请求时加载相应 ARX 程序. 0x10:Do not load the application.从不加载该应用程序. 0x20:Load the application transparently.显式加载该应该程序. 以 AutoCAD2010 为例: [www.BimCad.org]深居浅出 AutoCAD 二次开发 62 注册表文件实现方法: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:804\Applications\XXX] "DESCRIPTION"="MyDll" "LOADCTRLS"=dword:00000014 "LOADER"="X:\\XXX.dll" "MANAGED"=dword:00000001 把以上文本复制到一个文本文件中,再把扩展名改为 reg 运行后,启动 AutoCAD 应用程序就会自动加载"X:\\XXX.dll"应 用程序。 程序实现方法: private static void AutoLoad(string dname, string desc, string dpath) { RegistryKey LocalMachine = Registry.LocalMachine; RegistryKey Applications = LocalMachine.OpenSubKey("SOFTWARE\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\Applications", true); RegistryKey MyPrograrm = Applications.CreateSubKey(dname); MyPrograrm.SetValue("DESCRIPTION", desc, RegistryValueKind.String); MyPrograrm.SetValue("LOADCTRLS", 14, RegistryValueKind.DWord); MyPrograrm.SetValue("LOADER", dpath, RegistryValueKind.String); MyPrograrm.SetValue("MANAGED", 1, RegistryValueKind.DWord); } 注:需要引用 Microsoft.Win32 命名空间。 【4】程序部署 程序完成后要将其部署到目标环境中用户才能使用。下面介绍如何部署你的应用程序: (1)添加安装程序项目 将你的程序打包成一个安装文件,安装的时候自动解压到指定的目录下。 右键单击“解决方案”依次选择“添加”->“新建项目”。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 63 再弹出的“添加新项目”对话框选择“安装项目”点击确定。 在当前解决方案中会自动生成一个安装项目。 在右键单击安装项目的“应用程序文件夹”,依次选择“添加”->“项目输出”。 在弹出的“添加项目输出组”中选择主程序,点击“确定”。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 64 选中“安装项目”在解决方案管理器中单击“自定义操作编辑按钮”。 在“自定义操作”中把“安装”、“提交”、“卸载”几个操作指定主程序。 把每个操作的 CustomActionData 属性改为/DP_TargetDir="[TARGETDIR]\" (2) 创建安装程序类 修改注册表信息,让 AutoCAD 启动后自动加载部署好的程序。 右键选中主程序依次选择“添加”->“新建项”。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 65 在弹出的“添加新项”中选择安装程序类,点击“添加”按钮。 在主程序中会自动生成一个安装程序类。 在生成的 Installer1.Designer.cs 中输入如下代码(以 AutoCAD2010 为例,其他版本的注册表位置请参照附录的对应表格): public override void Install(System.Collections.IDictionary stateSaver) [www.BimCad.org]深居浅出 AutoCAD 二次开发 66 { base.Install(stateSaver); stateSaver.Add("TargetDir", Context.Parameters["DP_TargetDir"].ToString()); } public override void Commit(System.Collections.IDictionary savedState) { base.Commit(savedState); string installdir = savedState["TargetDir"].ToString(); string installpath = installdir + "AutoCADProgram.dll";//部署好的DLL的路径 AddToReg("AutoCADProgram", "程序描述", installpath); } public override void Uninstall(System.Collections.IDictionary savedState) { DelFromReg("AutoCADProgram"); base.Uninstall(savedState); } /// /// 添加注册表信息 /// /// 注册表项名 /// 程序描述 /// 程序路径 private static void AddToReg(string dname, string desc, string dpath) { try { RegistryKey LocalMachine = Registry.LocalMachine; RegistryKey Applications = LocalMachine.OpenSubKey("SOFTWARE\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\Applications", true); RegistryKey MyPrograrm = Applications.CreateSubKey(dname); MyPrograrm.SetValue("DESCRIPTION", desc, RegistryValueKind.String); MyPrograrm.SetValue("LOADCTRLS", 14, RegistryValueKind.DWord); MyPrograrm.SetValue("LOADER", dpath, RegistryValueKind.String); MyPrograrm.SetValue("MANAGED", 1, RegistryValueKind.DWord); } catch { } } /// /// 注销注册表信息 /// /// 注册表名 private static void DelFromReg(string dname) { RegistryKey rk = Registry.LocalMachine; RegistryKey rk0 = rk.OpenSubKey("SOFTWARE\\Autodesk\\AutoCAD\\R18.0\\ACAD-8001:804\\Applications", true); string[] subkeys = rk0.GetSubKeyNames(); List keys = new List(); keys.AddRange(subkeys); if (keys.Contains(dname)) [www.BimCad.org]深居浅出 AutoCAD 二次开发 67 { rk0.DeleteSubKeyTree(dname); } } (3)生成安装文件 安装项目的属性中可以设置安装文件的基本参数,如默认安装路径,版权信息等属性。 设置好属性后右键选择安装项目,点“生成“按钮。 会在安装程序的 Debug 目录下打包好安装程序。 运行安装程序就可以自动部署应用程序了。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 68 【5】托管 C++程序 用.NET 与 C++(非托管)开发各有优势,.NET 开发简单便捷效率高。但是目前.NET APIs 还没有托管所有 C++所能实现 的所有功能,如果将 C++代码封装为托管代码让.NET 调用,则在.NET 环境下开发即可以方便快捷又能实现 C++程序的强大 功能,让.NET 环境下 AutoCAD 二次开发如虎添翼。下面介绍如何托管 C++程序供.NET 程序调用。 (1)ObjectARX(C++)实现方法 (1.1) 安装 ObjectARX SDK 首先安装 AutoCAD 与 Microsoft Visual Studio.net 及 ARX 包。(VS 必须安装 MicrosoftVisualStudio2008ServicePack1 补 丁) AutoCAD 与 ARX 及 VS 版本对应关系如下: AutoCAD 版本 ARX 版本 VS 版本 CAD(R12) ARX1 VC2 CAD(R14) ARX202 VC4.2 CAD2000/2002(R15/R15.6) ObjectARX2002 VC6 CAD2004(R16) ObjectARX2004 Vs2002(VC7.0) CAD2005(R16.1) ObjectARX2005 Vs2003(VC7.1) CAD2006(R16.2) ObjectARX2006 VS2003(VC7.1) CAD2007(R17) ObjectARX2007 VS2005(VC8.0) CAD2008(R17.1) ObjectARX2008 VS2005(VC8.0) CAD2009R(R17.2) ObjectARX2009 VS2005(VC8.0) CAD2010(R18) ObjectARX2010 VS2008(VC8.0) ARX 下载地址如下: AutoCAD 版本 类型 下载地址 2011 32 位和 64 位 http://download.autodesk.com/esd/objectarx/2011/ObjectARX_2011_Win_64_and_32Bit.exe 2010 32 位和 64 位 http://download.autodesk.com/akdlm/esd/dlm/objectarx/ObjectARX_2010_Win_64_and_32Bit.exe 2009 32 位和 64 位 http://download.autodesk.com/esd/objectarx/2009/ObjectARX_2009_Win_64_and_32Bit.exe 2008 32 位 http://download.autodesk.com/esd/objectarx/2008/ObjectARX_2008_32Bit.exe [www.BimCad.org]深居浅出 AutoCAD 二次开发 69 64 位 http://download.autodesk.com/esd/objectarx/2008/ObjectARX_2008_64Bit.exe 2007 Core http://download.autodesk.com/esd/objectarx/2007/Arx_Core.exe SDK http://download.autodesk.com/esd/objectarx/2007/Arx_All.exe 2006 Core http://download.autodesk.com/WebPub/autocad/oarx2006/Arx_Core.exe SDK http://download.autodesk.com/WebPub/autocad/oarx2006/Arx_All.exe 2005 Core http://download.autodesk.com/WebPub/Developer/autocad/Arx_Core2005.exe SDK http://download.autodesk.com/WebPub/Developer/autocad/Arx_All2005.exe 2004 Core http://download.autodesk.com/WebPub/autocad/oarx/arx_core.exe SDK http://download.autodesk.com/WebPub/autocad/oarx/arx_sdk.exe 2002 Core http://download.autodesk.com/pub/objectarx/objectarx_2002/K030.arx.plus.core.zip SDK http://download.autodesk.com/pub/objectarx/objectarx_2002/K030.arx.plus.all.zip 2000 Core http://download.autodesk.com/pub/objectarx/ObjectArxCore.exe SDK http://download.autodesk.com/pub/objectarx/ObjectArxSDK.exe R14 SDK http://download.autodesk.com/Pub/developer/sdk/obarxsdk.exe 解压运行相应的 ArxWizards.msi 文件安装,安装完成后打开你的 Microsoft Visual Studio 中会有 工 具条,这个就是 ObjectARX 开发工具条。用它你可以方便的在 ARX 开发中注册新的命令、定义新的数据类型、查看帮组等 等。 (1.2)配置 Microsoft Visual Studio.net 开发环境 加入包含文件,及库文件目录:点击 工具->选项 设置包含文件,选择到解压 ObjectARX 目录下的 inc 目录 [www.BimCad.org]深居浅出 AutoCAD 二次开发 70 设置库文件,选择到解压 ObjectARX 目录下的 lib 目录 (1.3)编译 ARX 程序 首先新建一个项目,单击 文件->新建->项目 新建项目 [www.BimCad.org]深居浅出 AutoCAD 二次开发 71 选择 C++开发工具,并选择 ObjectARX 工程类型,输入工程名点击“确定”按钮 进入下一步设置 MFC 支持 [www.BimCad.org]深居浅出 AutoCAD 二次开发 72 选择 ObjectARX 菜单的 a> 菜单,来添加命令 会自动生成注册好的命令代码,我们只需要在 static void OnlyPMPM(void) { } 之间输入我们的程序即可 输入完程序后点击生成->生成就会自动在\DEBUG文件夹下生成一个ARX的文件 [www.BimCad.org]深居浅出 AutoCAD 二次开发 73 (1.4)AutoCAD 中加载 ARX 程序 选择 工具->加载应用程序,选择 ARX 程序文件,加载成功后就可以使用自定义的命令 加载 ARX 程序后,就可以像用 CAD 自带的命令一样使用自定义的 CAD 功能了。 (2)托管 C++程序 将 C++代码封装为.NET 托管代码,以供.NET 程序调用。 (2.1)添加头文件 按照(1)中的方法建立 C++项目,并给项目添加自定义函数的头文件及程序文件。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 74 示例代码: #pragma once static class Function { public: static void hello(void); }; (2.2)添加程序文件 示例代码: #include "StdAfx.h" #include "Function.h" void Function::hello(void) { ACHAR str[]= L"C++程序"; ads_alert(str); }; namespace BaseFunction { __gc public class CppFunction { public: static void Hello() { Function().hello(); } }; } 其中的__gc public class CppFunction类实现的就是把非托管代码Function().hello()转换为Hello()托管代码的功能。可以 按照类似的方法封装非托管C++代码为托管代码。 (2.3)编译生成 DLL 文件 设置项目的 Character Set 和 Common Language Runtime support 属性: [www.BimCad.org]深居浅出 AutoCAD 二次开发 75 编译生成dll文件 (3)在.NET环境中调用托管C++程序 (3.1)引用DLL 按照【1】的方法建立一个C#动态库工程,在工程中添加C++工程生成的dll的引用 (3.2)引用命名空间 引用C++环境中自定义托管类的命名空间 using BaseFunction; (3.3)使用托管类的函数 [CommandMethod("CppFunction")] public void CppFun() { CppFunction.Hello(); } 这样就可以在.NET中结合C++程序的强大功能了。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 76 【二】AutoCAD 对象 对象是 AutoCAD .NET API 的主要构造块。每一个显示的对象均精确代表一个AutoCAD 组件,它们之间又组成了不同 的程序集和命名空间。 AutoCAD 程序运行原理: AutoCAD .NET API 有许多不同类型的对象。 例如: 直线、圆弧、文字和标注等图形对象都是对象。 线型与标注样式等样式设置都是对象。 图层、组合和块等组织结构都是对象。 视图和视口等图形显示都是对象。 甚至 DWG 数据库里面的关系表、图形文档、AutoCAD 应用程序本身也是对象。 DWG 文件实际上是一个数据库文件,里面存放着图形对象及非图形对象的数据。DWG 文件通过 Database 类被读取到 AutoCAD 应用程序中,Application 类将 Database 中的数据按照指定的形式显示在 Document 中,用户可以查看 Document, 也可以通过 Editor 类与应用程序交互编辑 Document 的内容,Application 即时的把 Document 的修改的信息更新到 Database 中。二次开发的 ObjectARX 程序就是扩展 Application 的功能。 AutoCAD 对象作用关系: DWG 文件 Database Application Document 前台视图 ObjectARX 程序 Editor [www.BimCad.org]深居浅出 AutoCAD 二次开发 77 AutoCAD 对象派生关系: [www.BimCad.org]深居浅出 AutoCAD 二次开发 78 【1】Application(应用程序) Application 对象是每次打开的 AutoCAD 应用程序实例。主要的作用是维持 Document(文档)与 Database(数据库)之间的 一致。应用程序把数据库中的信息显示在文档上供用户查看,当用户操作文档更新文档时把更新的数据保存回数据库。通过 Application 对象你可以获得操作当前应用程序相关的对象。也可以通过它的属性及方法设置 AutoCAD 程序的参数及系统变 量。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 79 类定义: public sealed class Application { // Fields private static TabbedDialogEventHandler DisplayingCustomizeDialog; private static TabbedDialogEventHandler DisplayingDraftingSettingsDialog; private static TabbedDialogEventHandler DisplayingOptionDialog; private static EventHandler EnterModal; private static EventHandler Idle; private static EventHandler LeaveModal; private unsafe static CApplicationReactorImpl* m_appReactor; private static bool m_bCustomizationMode; private static DataBindings m_DataBindings; private static ArrayList m_defaultContextMenuExts; private static List m_disabledWindows; private static DocumentCollection m_docman; private static DocumentWindowCollection m_docWinMan; private static InfoCenter m_InfoCenter; private static List m_modelessWindows; private static ArrayList m_objectContextMenuExts; private static EventHandler m_pBeginCustomizationModeEvent; private static BeginDoubleClickEventHandler m_pBeginDoubleClickEvent; private static EventHandler m_pBeginQuitEvent; private static EventHandler m_pEndCustomizationModeEvent; [www.BimCad.org]深居浅出 AutoCAD 二次开发 80 private static PreTranslateMessageEventHandler m_pPreTranslateMessageEvent; private static EventHandler m_pQuitAbortedEvent; private static EventHandler m_pQuitWillStartEvent; private static SystemVariableChangedEventHandler m_pSystemVariableChangedEvent; private static SystemVariableChangingEventHandler m_pSystemVariableChangingEvent; private static Publisher m_Publisher; private static UserConfigurationManager m_userConfigMan; private static bool m_winformsLoaded; private static bool m_wpfLoaded; // Events public static event EventHandler BeginCustomizationMode; public static event BeginDoubleClickEventHandler BeginDoubleClick; public static event EventHandler BeginQuit; public static event TabbedDialogEventHandler DisplayingCustomizeDialog; public static event TabbedDialogEventHandler DisplayingDraftingSettingsDialog; public static event TabbedDialogEventHandler DisplayingOptionDialog; public static event EventHandler EndCustomizationMode; public static event EventHandler EnterModal; public static event EventHandler Idle; public static event EventHandler LeaveModal; public static event PreTranslateMessageEventHandler PreTranslateMessage; public static event EventHandler QuitAborted; public static event EventHandler QuitWillStart; public static event SystemVariableChangedEventHandler SystemVariableChanged; public static event SystemVariableChangingEventHandler SystemVariableChanging; // Methods static Application(); private Application(); internal static unsafe void addCustomizeDlgTab(CAdUiTabExtensionManager* pTabMgr); public static void AddDefaultContextMenuExtension(ContextMenuExtension menuExtension); internal static unsafe void addDrawingSettingsDlgTab(CAdUiTabExtensionManager* pTabMgr); private static void AddModelessWindow(WeakReference form); public static void AddObjectContextMenuExtension(RXClass runtimeClass, ContextMenuExtension menuExtension); internal static unsafe void addOptionsDlgTab(CAdUiTabExtensionManager* pTabMgr); internal static unsafe void addTab(CAdUiTabExtensionManager* pTabMgr, string name, TabbedDialogExtension extension); internal static unsafe void addTabs(CAdUiTabExtensionManager* pTabMgr); internal static unsafe void addTabs(CAdUiTabExtensionManager* pTabMgr, Hashtable tabs); internal static void CalculateWinformsOrWpfLoaded(ref bool winformsLoaded, ref bool wpfLoaded); internal static void CleanUp(); public static void DoDragDrop(DependencyObject dragSource, object data, DragDropEffects allowedEffects, DropTarget target); public static void DoDragDrop(Control control, object data, DragDropEffects allowedEffects, DropTarget target); public static string EvaluateDiesel(string dieselCmd); [return: MarshalAs(UnmanagedType.U1)] [MethodImpl(MethodImplOptions.NoInlining)] private static unsafe bool FilterAndPreProcessMessageWPF(tagMSG* msg); [www.BimCad.org]深居浅出 AutoCAD 二次开发 81 [return: MarshalAs(UnmanagedType.U1)] [MethodImpl(MethodImplOptions.NoInlining)] private static unsafe bool FilterMessageWinForms(tagMSG* msg); private static void FireCustomizationModeChangeEvent([MarshalAs(UnmanagedType.U1)] bool enterCustomizationMode); private static unsafe int FirePreTranslateMessage(tagMSG* msg); [MethodImpl(MethodImplOptions.NoInlining)] private static unsafe int FirePreTranslateMessageWorker(tagMSG* msg); private static unsafe HWND__* GetSafeOwner(HWND__* owner); public static object GetSystemVariable(string name); public static WhoHasInfo GetWhoHasInfo(string pathname); internal static void Initialize(); public static void InvokeContextHelp(IntPtr window, int contextId); public static void InvokeContextHelp(IntPtr window, int contextId, string helpPrefix); public static void InvokeContextHelp(IntPtr window, int contextId, string helpPrefix, HelpEventArgs hlpevent); public static void InvokeHelp(string fileName, string topic); [return: MarshalAs(UnmanagedType.U1)] public static bool InvokeHelpForExternal(string functionName); [return: MarshalAs(UnmanagedType.U1)] public static bool IsFileLocked(string pathname); [return: MarshalAs(UnmanagedType.U1)] internal static bool IsWinformsAssembly(Assembly a); [return: MarshalAs(UnmanagedType.U1)] internal static bool IsWpfAssembly(Assembly a); internal static void OnCustomizationModeChange([MarshalAs(UnmanagedType.U1)] bool enterCustomizationMode); private static void OnFormClosed_Persistence(object sender, EventArgs e); private static void OnFormLoad_Persistence(object sender, EventArgs e); internal static void OnIdle(); [MethodImpl(MethodImplOptions.NoInlining)] private static void OnIdleWinForms(); [MethodImpl(MethodImplOptions.NoInlining)] private static void OnIdleWPF(); internal static void OnModal([MarshalAs(UnmanagedType.U1)] bool enterModal); [MethodImpl(MethodImplOptions.NoInlining)] private static void OnModalWinforms([MarshalAs(UnmanagedType.U1)] bool modal); [MethodImpl(MethodImplOptions.NoInlining)] private static void OnModalWPF([MarshalAs(UnmanagedType.U1)] bool modal); internal static unsafe int OnPreTranslateMessage(tagMSG* msg); [MethodImpl(MethodImplOptions.NoInlining)] internal static void OnWinformsLoaded(); private static void OnWpfFormClosed_Persistence(object sender, EventArgs e); private static void OnWpfFormLoad_IconWorkaround(object sender, EventArgs e); private static void OnWpfFormLoad_Persistence(object sender, EventArgs e); [MethodImpl(MethodImplOptions.NoInlining)] internal static void OnWpfLoaded(); [return: MarshalAs(UnmanagedType.U1)] [MethodImpl(MethodImplOptions.NoInlining)] private static unsafe bool PreProcessMessageWinForms(tagMSG* msg); public static void Quit(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 82 private static void reactorAddRef(int flag); private static void reactorRelease(int flag); private static void RemoveDeadWindows(); public static void RemoveDefaultContextMenuExtension(ContextMenuExtension menuExtension); public static void RemoveObjectContextMenuExtension(RXClass runtimeClass, ContextMenuExtension menuExtension); public static void SetSystemVariable(string name, object value); public static void ShowAlertDialog(string message); public static DialogResult ShowModalDialog(Form formToShow); public static DialogResult ShowModalDialog(IntPtr owner, Form formToShow); public static DialogResult ShowModalDialog(IWin32Window owner, Form formToShow); public static DialogResult ShowModalDialog(IntPtr owner, Form formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static DialogResult ShowModalDialog(IWin32Window owner, Form formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static bool? ShowModalWindow(Window formToShow); public static bool? ShowModalWindow(IntPtr owner, Window formToShow); public static bool? ShowModalWindow(Window owner, Window formToShow); public static bool? ShowModalWindow(IntPtr owner, Window formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static bool? ShowModalWindow(Window owner, Window formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static void ShowModelessDialog(Form formToShow); public static void ShowModelessDialog(IntPtr owner, Form formToShow); public static void ShowModelessDialog(IWin32Window owner, Form formToShow); public static void ShowModelessDialog(IntPtr owner, Form formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static void ShowModelessDialog(IWin32Window owner, Form formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static void ShowModelessWindow(Window formToShow); public static void ShowModelessWindow(IntPtr owner, Window formToShow); public static void ShowModelessWindow(Window owner, Window formToShow); public static void ShowModelessWindow(IntPtr owner, Window formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static void ShowModelessWindow(Window owner, Window formToShow, [MarshalAs(UnmanagedType.U1)] bool persistSizeAndPosition); public static void UpdateScreen(); // Properties public static object AcadApplication { get; } public static bool DisplayTextScreen { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public static DocumentCollection DocumentManager { get; } public static DocumentWindowCollection DocumentWindowCollection { get; } public static InfoCenter InfoCenter { get; } public static bool IsInBackgroundMode { [return: MarshalAs(UnmanagedType.U1)] get; } public static bool IsInCustomizationMode { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public static bool IsInPlaceServer { [return: MarshalAs(UnmanagedType.U1)] get; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 83 public static bool IsQuiescent { [return: MarshalAs(UnmanagedType.U1)] get; } public static Window MainWindow { get; } public static object MenuBar { get; } public static object MenuGroups { get; } public static Window NonInPlaceMainWindow { get; } public static object Preferences { get; } public static Publisher Publisher { get; } public static IEnumerable RecentDocuments { get; } public static StatusBar StatusBar { get; } public static DataBindings UIBindings { get; } public static UserConfigurationManager UserConfigurationManager { get; } public static Version Version { get; } internal static bool WinformsLoaded { [return: MarshalAs(UnmanagedType.U1)] get; } internal static bool WpfLoaded { [return: MarshalAs(UnmanagedType.U1)] get; } } 属性: 属性 数据类型 意义 AcadApplication object 得到应用程序对象(只读) DocumentManager DocumentCollection 得到文档集合对象(只读) ocumentWindowCollection Autodesk.AutoCAD.ApplicationServices.DocumentWindowCollection 得到 DocumentWindow 对象 集合(只读) InfoCenter Autodesk.AutoCAD.Windows.InfoCenter 得到 InfoCenter 对象(只读) MainWindow Autodesk.AutoCAD.Windows.Window 获得主窗口对象(只读) MenuBar object 获得菜单条对象(只读) MenuGroups object 获得菜单组对象(只读) Publisher Autodesk.AutoCAD.Publishing.Publisher 获得 Publisher 对象(只读) StatusBar Autodesk.AutoCAD.Windows.StatusBar 获得状态栏对象(只读) UserConfigurationManager Autodesk.AutoCAD.ApplicationServices.UserConfigurationManager 获得 UserConfigurationManager 对象(只读) Version System.Version 获得版本对象(只读) 方法: 方法 参数解释 作用 Void AddDefaultContextMenuExtension ( ContextMenuExtension menuExtension ) menuExtension 要添加的快捷菜单 添加默认模式中的快捷菜单 Void AddObjectContextMenuExtension ( RXClass runtimeClass, ContextMenuExtension menuExtension ) 1、RXClass 有上下文菜单运行时的类 2、menuExtension 要添加的快捷菜单 在给定的类中添加上下文菜 单 [www.BimCad.org]深居浅出 AutoCAD 二次开发 84 Object GetSystemVariable ( string name ) name 系统变量名 得到相应名称的系统变量值 WhoHasInfo GetWhoHasInfo ( string pathname ) pathname 完整文件名 得到文件信息,相当于 WHOHAS 命令 bool IsFileLocked ( string pathname ) pathname 完整文件名 文件是否锁定状态 void Quit() 无 退出程序 void RemoveDefaultContextMenuExtension ( ContextMenuExtension menuExtension ) menuExtension 要移除的快捷菜单 移除默认模式中的快捷菜单 void RemoveObjectContextMenuExtension ( RXClass runtimeClass, ContextMenuExtension menuExtension ) 1、RXClass 有上下文菜单运行时的类 2、menuExtension 要添加的快捷菜单 移除给定的类中上下文菜单 void SetSystemVariable ( string name, object value ) 1、name 系统变量名 2、object 值 设置系统变量 void ShowAlertDialog ( string message ) message 警告信息 弹出警告窗口 System.Windows.Forms.DialogResult ShowModalDialog ( Form formToShow ) formToShow 要加载的用户自定义窗口 加载一个模态窗口 void ShowModelessDialog ( Form formToShow ) formToShow 要加载的用户自定义窗口 加载一个非模态窗口 Void UpdateScreen() 无 整个屏幕刷新 事件: [www.BimCad.org]深居浅出 AutoCAD 二次开发 85 事件 意义 BeginQuit 即将退出 PreTranslateMessage 消息被处理之前 QuitAborted 退出被中止 QuitWillStart 将要退出 SystemVariableChanged 系统变量被改变 SystemVariableChanging 正在改变系统变量 [www.BimCad.org]深居浅出 AutoCAD 二次开发 86 【2】Document(文档) Document(文档)对象实际上就是 Database(数据库)在显示给用户看的视图,一个文档与一个 Database(数据库)是一一 对应的。它按照 Application(应用程序)的规定把 Database(数据库)中的对象显示给用户,同时用户对 Document(文档)的操 作也会通过 Application(应用程序)写回到数据库,在后台修改数据库的时候为防止前台文档也在同时修改所以必须先锁住文 档,操作完成后再给文档解锁。 获取当前文档的方法: Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; [www.BimCad.org]深居浅出 AutoCAD 二次开发 87 类定义: public sealed class Document : DisposableWrapper { // Fields private Editor m_editor; internal unsafe CEditorReactorImpl* m_editorReactor; private Manager m_gsManager; internal DocumentBeginCloseEventHandler m_pBeginDocumentCloseEvent; internal EventHandler m_pCloseAbortedEvent; internal EventHandler m_pCloseWillStartEvent; internal CommandEventHandler m_pCommandCancelledEvent; internal CommandEventHandler m_pCommandEndedEvent; internal CommandEventHandler m_pCommandFailedEvent; internal CommandEventHandler m_pCommandWillStartEvent; internal EventHandler m_pImpliedSelectionChangedEvent; internal EventHandler m_pLispCancelledEvent; internal EventHandler m_pLispEndedEvent; internal LispWillStartEventHandler m_pLispWillStartEvent; internal UnknownCommandEventHandler m_pUnknownCommandEvent; private Hashtable m_userData; // Events public event DocumentBeginCloseEventHandler BeginDocumentClose; public event EventHandler CloseAborted; public event EventHandler CloseWillStart; public event CommandEventHandler CommandCancelled; [www.BimCad.org]深居浅出 AutoCAD 二次开发 88 public event CommandEventHandler CommandEnded; public event CommandEventHandler CommandFailed; public event CommandEventHandler CommandWillStart; public event EventHandler ImpliedSelectionChanged; public event EventHandler LispCancelled; public event EventHandler LispEnded; public event LispWillStartEventHandler LispWillStart; public event UnknownCommandEventHandler UnknownCommand; // Methods private unsafe Document(AcApDocument* pImp); public Bitmap CapturePreviewImage(uint modopt(IsLong) width, uint modopt(IsLong) height); internal void cleanUp(); public void CloseAndDiscard(); public void CloseAndSave(string fileName); private void CloseInternal([MarshalAs(UnmanagedType.U1)] bool discard, string fileName); internal static unsafe Document Create(AcApDocument* doc); [EditorBrowsable(EditorBrowsableState.Advanced)] public static Document Create(IntPtr unmanagedPointer); protected sealed override void DeleteUnmanagedObject(); public void DowngradeDocOpen([MarshalAs(UnmanagedType.U1)] bool bPromptForSave); internal void FireBeginDocumentClose(DocumentBeginCloseEventArgs e); internal void FireCloseAborted(EventArgs e); internal void FireCloseWillStart(EventArgs e); internal void FireCommandCancelled(CommandEventArgs e); internal void FireCommandEnded(CommandEventArgs e); internal void FireCommandFailed(CommandEventArgs e); internal void FireCommandWillStart(CommandEventArgs e); internal void FireImpliedSelectionChanged(EventArgs e); internal void FireLispCancelled(EventArgs e); internal void FireLispEnded(EventArgs e); internal void FireLispWillStart(LispWillStartEventArgs e); internal void FireUnknownCommand(UnknownCommandEventArgs e); public static Document FromAcadDocument(object acadDocument); internal static unsafe Document FromAcadDocumentWorker(IUnknown* acadDocument); internal unsafe AcApDocument* GetImpObj(); public DocumentLock LockDocument(); public DocumentLock LockDocument(DocumentLockMode lockMode, string globalCommandName, string localCommandName, [MarshalAs(UnmanagedType.U1)] bool promptIfFails); public DocumentLockMode LockMode(); public DocumentLockMode LockMode([MarshalAs(UnmanagedType.U1)] bool bIncludeMyLocks); public void PopDbmod(); public void PushDbmod(); internal void reactorAddRef(int flag); internal void reactorRelease(int flag); public void SendStringToExecute(string command, [MarshalAs(UnmanagedType.U1)] bool activate, [MarshalAs(UnmanagedType.U1)] bool wrapUpInactiveDoc, [MarshalAs(UnmanagedType.U1)] bool echoCommand); public Database TryGetDatabase(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 89 public void UpgradeDocOpen(); // Properties public object AcadDocument { get; } public string CommandInProgress { get; } public Database Database { get; } public Editor Editor { get; } public Manager GraphicsManager { get; } public bool IsActive { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsReadOnly { [return: MarshalAs(UnmanagedType.U1)] get; } public string Name { get; } public StatusBar StatusBar { get; } public TransactionManager TransactionManager { get; } public Hashtable UserData { get; } public Window Window { get; } } 属性: 属性 数据类型 意义 AcadDocument object 得到当前文档对象(只读) Database Autodesk.AutoCAD.DatabaseServices.Database 得到相应文档的数据库对象(只读) Editor Autodesk.AutoCAD.EditorInput.Editor 得到 Editor 对象(只读) GraphicsManager Autodesk.AutoCAD.GraphicsSystem.Manager 得到 GraphicsManager 对象(只读) IsActive bool 判断是否是活动文档(只读) Name string 获得获得文档的文件名(只读) StatusBar Autodesk.AutoCAD.Windows.StatusBar 获得状态栏对象(只读) TransactionManager Autodesk.AutoCAD.ApplicationServices.TransactionManager 获得 TransactionManager 对象(只读) UserData Hashtable 获得 UserData(只读) Window Autodesk.AutoCAD.Windows.Window 获得 Window 对象(只读) 方法: 方法 参数 作用 Bitmap CapturePreviewImage ( uint modopt(IsLong) width, uint modopt(IsLong) height ) 1、width 图像宽度 2、height 图像高度 捕捉预览图像 void CloseAndDiscard() 无 关闭文档不保存 void CloseAndSave ( string fileName ) fileName 保存的文件名路径 关闭保存 DocumentLock LockDocument() 无 锁文档的方法,在处理完成时用调用文档锁的 Dispose()方法即可解锁。 需要锁文档的四种情况: 1、Interacts with AutoCAD from a modeless dialog box [www.BimCad.org]深居浅出 AutoCAD 二次开发 90 如用非模态窗口交互操作文档。 2、Accesses a loaded document other than the current document 要处理的文档不是当前文档。 3、Used as a COM server 使用 COM 服务。 4、Registers a command with the Session command flag。 没锁文档程序调试时会出现以下错误提示: DocumentLockMode LockMode() 无 是否可以设置权限的文件锁定 void SendStringToExecute ( string command, bool activate, bool wrapUpInactiveDoc, bool echoCommand ) 1、command 发送的命令 2、activate 文档是否活动 3、wrapUpInactiveDoc 完成活动文 档切换时是否列队当前活动文档 4、echoCommand 发送的命令是否 响应 向命令栏发送命令 Void UpgradeDocOpen() 无 升级打开模式(通常由只读打开成可写) void DowngradeDocOpen ( bool bPromptForSave ) bPromptForSave 是否能保存 降级打开模式 事件: 事件 意义 BeginDocumentClose 准备关闭文档 CloseAborted 关闭被中止 CloseWillStart 关闭将要开始 CommandCancelled 命令被取消 CommandEnded 命令执行结束 CommandFailed 命令执行失败 CommandWillStart 命令将要开始执行 UnknownCommand 遇到未知命令 [www.BimCad.org]深居浅出 AutoCAD 二次开发 91 ImpliedSelectionChanged [www.BimCad.org]深居浅出 AutoCAD 二次开发 92 【3】Editor(命令行) Editor 就是 AutoCAD 界面中的命令行,是用户跟应用程序交互的工具。AutoCAD 与用户的交互功能基本输入与输出功 能都在 Editor 对象中实现。 类定义: public sealed class Editor : MarshalByRefObject { // Fields private unsafe AcMgInputContextReactor* m_contextReactor; private Document m_doc; private DraggingEndedEventHandler m_pDraggingEndedEvent; private DraggingEventHandler m_pDraggingEvent; private EventHandler m_pEnteringQuiescentStateEvent; private EventHandler m_pLeavingQuiescentStateEvent; private unsafe AcMgPointFilter* m_pointFilter; private unsafe AcMgPointMonitor* m_pointMonitor; private PromptDoubleResultEventHandler m_pPromptedForAngleEvent; private PromptPointResultEventHandler m_pPromptedForCornerEvent; private PromptDoubleResultEventHandler m_pPromptedForDistanceEvent; private PromptDoubleResultEventHandler m_pPromptedForDoubleEvent; private PromptEntityResultEventHandler m_pPromptedForEntityEvent; private PromptIntegerResultEventHandler m_pPromptedForIntegerEvent; private PromptStringResultEventHandler m_pPromptedForKeywordEvent; private PromptNestedEntityResultEventHandler m_pPromptedForNestedEntityEvent; private PromptPointResultEventHandler m_pPromptedForPointEvent; private PromptSelectionResultEventHandler m_pPromptedForSelectionEvent; private PromptStringResultEventHandler m_pPromptedForStringEvent; private PromptForEntityEndingEventHandler m_pPromptForEntityEndingEvent; private PromptForSelectionEndingEventHandler m_pPromptForSelectionEndingEvent; private PromptAngleOptionsEventHandler m_pPromptingForAngleEvent; private PromptPointOptionsEventHandler m_pPromptingForCornerEvent; private PromptDistanceOptionsEventHandler m_pPromptingForDistanceEvent; private PromptDoubleOptionsEventHandler m_pPromptingForDoubleEvent; private PromptEntityOptionsEventHandler m_pPromptingForEntityEvent; private PromptIntegerOptionsEventHandler m_pPromptingForIntegerEvent; private PromptKeywordOptionsEventHandler m_pPromptingForKeywordEvent; private PromptNestedEntityOptionsEventHandler m_pPromptingForNestedEntityEvent; private PromptPointOptionsEventHandler m_pPromptingForPointEvent; [www.BimCad.org]深居浅出 AutoCAD 二次开发 93 private PromptSelectionOptionsEventHandler m_pPromptingForSelectionEvent; private PromptStringOptionsEventHandler m_pPromptingForStringEvent; private RolloverEventHandler m_pRolloverEvent; private SelectionAddedEventHandler m_pSelectionAddedEvent; private SelectionRemovedEventHandler m_pSelectionRemovedEvent; internal const string PauseToken = @"\"; // Events public event DraggingEventHandler Dragging; public event DraggingEndedEventHandler DraggingEnded; public event EventHandler EnteringQuiescentState; public event EventHandler LeavingQuiescentState; public event PointFilterEventHandler PointFilter; public event PointMonitorEventHandler PointMonitor; public event PromptDoubleResultEventHandler PromptedForAngle; public event PromptPointResultEventHandler PromptedForCorner; public event PromptDoubleResultEventHandler PromptedForDistance; public event PromptDoubleResultEventHandler PromptedForDouble; public event PromptEntityResultEventHandler PromptedForEntity; public event PromptIntegerResultEventHandler PromptedForInteger; public event PromptStringResultEventHandler PromptedForKeyword; public event PromptNestedEntityResultEventHandler PromptedForNestedEntity; public event PromptPointResultEventHandler PromptedForPoint; public event PromptSelectionResultEventHandler PromptedForSelection; public event PromptStringResultEventHandler PromptedForString; public event PromptForEntityEndingEventHandler PromptForEntityEnding; public event PromptForSelectionEndingEventHandler PromptForSelectionEnding; public event PromptAngleOptionsEventHandler PromptingForAngle; public event PromptPointOptionsEventHandler PromptingForCorner; public event PromptDistanceOptionsEventHandler PromptingForDistance; public event PromptDoubleOptionsEventHandler PromptingForDouble; public event PromptEntityOptionsEventHandler PromptingForEntity; public event PromptIntegerOptionsEventHandler PromptingForInteger; public event PromptKeywordOptionsEventHandler PromptingForKeyword; public event PromptNestedEntityOptionsEventHandler PromptingForNestedEntity; public event PromptPointOptionsEventHandler PromptingForPoint; public event PromptSelectionOptionsEventHandler PromptingForSelection; public event PromptStringOptionsEventHandler PromptingForString; public event RolloverEventHandler Rollover; public event SelectionAddedEventHandler SelectionAdded; public event SelectionRemovedEventHandler SelectionRemoved; // Methods internal Editor(Document doc); private void addInputContextEvent(long flag); internal void cleanUp(); public PromptResult DoPrompt(PromptOptions opt); public PromptResult Drag(Jig jig); [www.BimCad.org]深居浅出 AutoCAD 二次开发 94 public PromptPointResult Drag(PromptDragOptions options); public PromptPointResult Drag(SelectionSet selection, string message, DragCallback callback); public void DrawVector(Point3d from, Point3d to, int color, [MarshalAs(UnmanagedType.U1)] bool drawHighlighted); public void DrawVectors(ResultBuffer rb, Matrix3d transform); internal void FireDragging(DraggingEventArgs e); internal void FireDraggingEnded(DraggingEndedEventArgs e); internal void FireEnteringQuiescentState(EventArgs e); internal void FireLeavingQuiescentState(EventArgs e); internal void FirePromptedForAngle(PromptDoubleResultEventArgs e); internal void FirePromptedForCorner(PromptPointResultEventArgs e); internal void FirePromptedForDistance(PromptDoubleResultEventArgs e); internal void FirePromptedForDouble(PromptDoubleResultEventArgs e); internal void FirePromptedForEntity(PromptEntityResultEventArgs e); internal void FirePromptedForInteger(PromptIntegerResultEventArgs e); internal void FirePromptedForKeyword(PromptStringResultEventArgs e); internal void FirePromptedForNestedEntity(PromptNestedEntityResultEventArgs e); internal void FirePromptedForPoint(PromptPointResultEventArgs e); internal void FirePromptedForSelection(PromptSelectionResultEventArgs e); internal void FirePromptedForString(PromptStringResultEventArgs e); internal void FirePromptForEntityEnding(PromptForEntityEndingEventArgs e); internal void FirePromptForSelectionEnding(PromptForSelectionEndingEventArgs e); internal void FirePromptingForAngle(PromptAngleOptionsEventArgs e); internal void FirePromptingForCorner(PromptPointOptionsEventArgs e); internal void FirePromptingForDistance(PromptDistanceOptionsEventArgs e); internal void FirePromptingForDouble(PromptDoubleOptionsEventArgs e); internal void FirePromptingForEntity(PromptEntityOptionsEventArgs e); internal void FirePromptingForInteger(PromptIntegerOptionsEventArgs e); internal void FirePromptingForKeyword(PromptKeywordOptionsEventArgs e); internal void FirePromptingForNestedEntity(PromptNestedEntityOptionsEventArgs e); internal void FirePromptingForPoint(PromptPointOptionsEventArgs e); internal void FirePromptingForSelection(PromptSelectionOptionsEventArgs e); internal void FirePromptingForString(PromptStringOptionsEventArgs e); internal void FireRollover(RolloverEventArgs e); internal void FireSelectionAdded(SelectionAddedEventArgs e); internal void FireSelectionRemoved(SelectionRemovedEventArgs e); public PromptDoubleResult GetAngle(PromptAngleOptions options); public PromptDoubleResult GetAngle(string message); public int GetCommandVersion(); public PromptPointResult GetCorner(PromptCornerOptions options); public PromptPointResult GetCorner(string message, Point3d basePoint); public ViewTableRecord GetCurrentView(); public PromptDoubleResult GetDistance(PromptDistanceOptions options); public PromptDoubleResult GetDistance(string message); public PromptDoubleResult GetDouble(PromptDoubleOptions options); public PromptDoubleResult GetDouble(string message); public PromptEntityResult GetEntity(PromptEntityOptions options); public PromptEntityResult GetEntity(string message); public PromptFileNameResult GetFileNameForOpen(PromptOpenFileOptions options); [www.BimCad.org]深居浅出 AutoCAD 二次开发 95 public PromptFileNameResult GetFileNameForOpen(string message); public PromptFileNameResult GetFileNameForSave(PromptSaveFileOptions options); public PromptFileNameResult GetFileNameForSave(string message); public PromptIntegerResult GetInteger(PromptIntegerOptions options); public PromptIntegerResult GetInteger(string message); public PromptResult GetKeywords(PromptKeywordOptions options); public PromptResult GetKeywords(string message, params string[] globalKeywords); public PromptNestedEntityResult GetNestedEntity(PromptNestedEntityOptions options); public PromptNestedEntityResult GetNestedEntity(string message); public PromptPointResult GetPoint(PromptPointOptions options); public PromptPointResult GetPoint(string message); public PromptSelectionResult GetSelection(); public PromptSelectionResult GetSelection(PromptSelectionOptions options); public PromptSelectionResult GetSelection(SelectionFilter filter); public PromptSelectionResult GetSelection(PromptSelectionOptions options, SelectionFilter filter); public PromptResult GetString(PromptStringOptions options); public PromptResult GetString(string message); public int GetViewportNumber(Point point); public int InitCommandVersion(int nVersion); public Point PointToScreen(Point3d pt, int viewportNumber); public Point3d PointToWorld(Point pt); public Point3d PointToWorld(Point pt, int viewportNumber); public void Regen(); private void removeInputContextEvent(long flag); internal PromptStatus RunCommand(params object[] parameter); public PromptSelectionResult SelectAll(); public PromptSelectionResult SelectAll(SelectionFilter filter); public PromptSelectionResult SelectCrossingPolygon(Point3dCollection polygon); public PromptSelectionResult SelectCrossingPolygon(Point3dCollection polygon, SelectionFilter filter); public PromptSelectionResult SelectCrossingWindow(Point3d pt1, Point3d pt2); public PromptSelectionResult SelectCrossingWindow(Point3d pt1, Point3d pt2, SelectionFilter filter); public PromptSelectionResult SelectCrossingWindow(Point3d pt1, Point3d pt2, SelectionFilter filter, [MarshalAs(UnmanagedType.U1)] bool forceSubEntitySelection); public PromptSelectionResult SelectFence(Point3dCollection fence); public PromptSelectionResult SelectFence(Point3dCollection fence, SelectionFilter filter); public PromptSelectionResult SelectImplied(); public PromptSelectionResult SelectLast(); public PromptSelectionResult SelectPrevious(); public PromptSelectionResult SelectWindow(Point3d pt1, Point3d pt2); public PromptSelectionResult SelectWindow(Point3d pt1, Point3d pt2, SelectionFilter filter); public PromptSelectionResult SelectWindowPolygon(Point3dCollection polygon); public PromptSelectionResult SelectWindowPolygon(Point3dCollection polygon, SelectionFilter filter); public void SetCurrentView(ViewTableRecord value); public void SetImpliedSelection(SelectionSet selectionSet); public void SetImpliedSelection(ObjectId[] selectedObjects); public Point3d Snap(string snapMode, Point3d input); public EditorUserInteraction StartUserInteraction(Control modalForm); public EditorUserInteraction StartUserInteraction(Window window); [www.BimCad.org]深居浅出 AutoCAD 二次开发 96 public void SwitchToModelSpace(); public void SwitchToPaperSpace(); public int TurnForcedPickOff(); public int TurnForcedPickOn(); public void UpdateScreen(); public void UpdateTiledViewportsFromDatabase(); public void UpdateTiledViewportsInDatabase(); public ObjectId ViewportIdFromNumber(int viewportNumber); public void WriteMessage(string message); public void WriteMessage(string message, params object[] parameter); // Properties public ObjectId ActiveViewportId { get; } public Matrix3d CurrentUserCoordinateSystem { get; set; } public ObjectId CurrentViewportObjectId { get; } public Document Document { get; } public bool IsDragging { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsQuiescent { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsQuiescentForTransparentCommand { [return: MarshalAs(UnmanagedType.U1)] get; } public bool MouseHasMoved { [return: MarshalAs(UnmanagedType.U1)] get; } public bool UseCommandLineInterface { [return: MarshalAs(UnmanagedType.U1)] get; } } 属性: 属性 数据类型 意义 ActiveViewportId ObjectId 得到活动视口 ObjectId (只读) CurrentUserCoordinateSystem Matrix3d 得到当前用户坐标系(只读) CurrentViewportObjectId ObjectId 得到当前视口 ObjectId (只读) Document Autodesk.AutoCAD.ApplicationServices.Document 得到 Edtior 所属的 Document 对象(只读) IsDragging bool 判断屏幕是否正在移动(只读) IsQuiescent bool 判断是否为静态的(只读) MouseHasMoved bool 判断鼠标是否移动(只读) UseCommandLineInterface bool 返回 UseCommandLineInterface 值(只读) 方法: 方法 参数 作用 PromptDoubleResult GetAngle message 消息 提示用户选取角度 ( string message ) PromptIntegerResult GetInteger ( string message ) message 消息 提示用户输入整数 [www.BimCad.org]深居浅出 AutoCAD 二次开发 97 PromptResult GetKeywords ( string message, params string[] globalKeywords ) 1、message 消息 2、globalKeywords 获取的字符数组 提示用户输入关键字 PromptPointResult GetPoint ( string message ) message 消息 提示用户选取一点 PromptDoubleResult GetDistance ( string message ) message 消息 提示用户输入一个距离 PromptEntityResult GetEntity ( string message ) message 消息 提示用户选择实体 PromptResult GetString ( string message ) message 消息 获取用户输入字符 PromptFileNameResult GetFileNameForOpen ( string message ) message 消息 提示框提示用户输入准备打开的文件 PromptFileNameResult GetFileNameForSave ( string message ) message 消息 提示框提示用户输入准备保存的文件 PromptSelectionResult GetSelection() 获取用户框选集合 PromptSelectionResult GetSelection ( SelectionFilter filter ) filter 类型过滤器 获取过滤器指定类型的用户框选集合 [www.BimCad.org]深居浅出 AutoCAD 二次开发 98 PromptSelectionResult SelectAll ( SelectionFilter filter ) filter 类型过滤器 选择过滤器指定类型的所有对象 PromptSelectionResult SelectAll() 选择所有对象 PromptSelectionResult SelectCrossingPolygon ( Point3dCollection polygon, SelectionFilter filter ) 1、polygon 多边形顶点 2、filter 类型过滤器 根据多边形范围和过滤器选取对象 PromptSelectionResult SelectCrossingWindow ( Point3d pt1, Point3d pt2 ) 1、pt1 窗口区域角点 1 2、pt2 窗口区域角点 2 选定窗口区域内的对象 PromptSelectionResult SelectCrossingWindow ( Point3d pt1, Point3d pt2, SelectionFilter filter ) 1、pt1 窗口区域角点 1 2、pt2 窗口区域角点 2 3、filter 选定类型过滤器 PromptSelectionResult SelectFence ( Point3dCollection fence ) fence 栅格点集 选定栅格点内对象 PromptSelectionResult SelectFence ( Point3dCollection fence, SelectionFilter filter ) 1、fence 栅格点集 2、filter 选定类型过滤器 PromptSelectionResult SelectLast() 选取最后一个生成对象 PromptSelectionResult SelectPrevious() 选取上一次创建的选择集中对象 PromptSelectionResult SelectWindowPolygon ( Point3dCollection polygon ) polygon 多边形区域顶点 选取多边形区域内对象 PromptSelectionResult SelectWindowPolygon ( Point3dCollection polygon, SelectionFilter filter ) 1、polygon 多边形区域顶点 2、filter 选定类型过滤器 PromptSelectionResult 选取夹取状态的对象 [www.BimCad.org]深居浅出 AutoCAD 二次开发 99 SelectImplied() void SwitchToModelSpace() 转换到模型空间视图 void SwitchToPaperSpace() 转换到图纸空间视图 int TurnForcedPickOff() 自动扑捉关闭 int TurnForcedPickOn() 自动扑捉打开 void UpdateScreen() 刷新屏幕 void Regen() 重绘屏幕 void UpdateTiledViewportsFromDatabase() 根据数据库刷新标题视口 ObjectId ViewportIdFromNumber ( int viewportNumber ) viewportNumber 视口号 由视口号得到视口 ID void WriteMessage ( string message ) message 消息 命令行中写消息 void WriteMessage ( string message, params object[] parameter ) 1、message 消息 2、parameter 消息参数 命令行中写消息 EditorUserInteraction StartUserInteraction ( Control modalForm modalForm 模态窗体 从模态窗体切入 AutoCAD 编辑操作,完成后 程序焦点返回窗体 ) PromptResult DoPrompt ( PromptOptions opt ) opt 操作提示 输入提示指定选项,返回的提示操作的结果 PromptResult Drag ( Jig jig ) jig Jig 类对象 开始 Jig 操作 PromptPointResult Drag ( PromptDragOptions options ) options 拖动选项 提示用户拖动修改图形,预览效果,不修改 数据库 [www.BimCad.org]深居浅出 AutoCAD 二次开发 100 PromptPointResult Drag ( SelectionSet selection, string message, DragCallback callback ) 1、selection 选择集 2、message 消息 3、callback 提示用户拖动修改图形进行设置 Void DrawVector ( Point3d from, Point3d to, int color, bool drawHighlighted ) 1、from 向量起始点 2、to 向量终点 3、color 向量颜色 4、drawHighlighted 高亮 在屏幕上画一个由始点到终点的向量,可选 颜色与是否高亮(非实体对象,只用于显示) void DrawVectors ( ResultBuffer rb, Matrix3d transform ) 1、rb 向量集合 2、transform 变换方式 在屏幕上按照变换方式显示向量集合,可选 颜色与是否高亮(非实体对象,只用于显示) int GetViewportNumber ( System.Drawing.Point point ) point 要获取视口的点像素 根据屏幕上点像素获取视口编号 int GetCommandVersion() 无 获得命令得版本 PromptPointResult GetCorner ( PromptCornerOptions options ) options 选项参数 获得用户输入的矩形的角点 ViewTableRecord GetCurrentView() 无 获得当前视图(视图表中的当前视图表记录) System.Drawing.Point PointToScreen ( Point3d pt, int viewportNumber ) 1、pt 三维点 2、viewportNumber 视口号 指定点的屏幕像素 Point3d PointToWorld ( System.Drawing.Point pt ) pt 屏幕像素点 得到屏幕像素点的 Point3d 点坐标 [www.BimCad.org]深居浅出 AutoCAD 二次开发 101 【4】Database(数据库) Database 是 DWG 文件在内存中的表示,是用来储存数据库对象的容器。Database 中主要储存量大容器对象:Symbol Tables(符号表)与 NameDictionaries(命名对象词典),容器中储存着所有的图形对象和大部分的非图形对象。 获取当前数据库的方法: (1) Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; (2) Database db = HostApplicationServices.WorkingDatabase; 类定义: public sealed class Database : RXObject { // Events public event EventHandler AbortDxfIn; public event EventHandler AbortDxfOut; public event EventHandler AbortSave; public event IdMappingEventHandler BeginDeepClone; public event IdMappingEventHandler BeginDeepCloneTranslation; public event EventHandler BeginDxfIn; public event EventHandler BeginDxfOut; public event BeginInsertEventHandler BeginInsert; public event DatabaseIOEventHandler BeginSave; public event BeginWblockBlockEventHandler BeginWblockBlock; public event BeginWblockEntireDatabaseEventHandler BeginWblockEntireDatabase; public event BeginWblockObjectsEventHandler BeginWblockObjects; public event BeginWblockSelectedObjectsEventHandler BeginWblockSelectedObjects; public static event EventHandler DatabaseConstructed; public event EventHandler DatabaseToBeDestroyed; public event EventHandler DeepCloneAborted; public event EventHandler DeepCloneEnded; public event EventHandler Disposed; public event DatabaseIOEventHandler DwgFileOpened; public event EventHandler DxfInComplete; public event EventHandler DxfOutComplete; [www.BimCad.org]深居浅出 AutoCAD 二次开发 102 public event EventHandler InitialDwgFileOpenComplete; public event EventHandler InsertAborted; public event EventHandler InsertEnded; public event IdMappingEventHandler InsertMappingAvailable; public event ObjectEventHandler ObjectAppended; public event ObjectErasedEventHandler ObjectErased; public event ObjectEventHandler ObjectModified; public event ObjectEventHandler ObjectOpenedForModify; public event ObjectEventHandler ObjectReappended; public event ObjectEventHandler ObjectUnappended; public event EventHandler PartialOpenNotice; public event ProxyResurrectionCompletedEventHandler ProxyResurrectionCompleted; public event DatabaseIOEventHandler SaveComplete; public event SystemVariableChangedEventHandler SystemVariableChanged; public event SystemVariableChangingEventHandler SystemVariableWillChange; public event EventHandler WblockAborted; public event EventHandler WblockEnded; public event IdMappingEventHandler WblockMappingAvailable; public event WblockNoticeEventHandler WblockNotice; public static event EventHandler XrefAttachAborted; public event EventHandler XrefAttachEnded; public event XrefBeginOperationEventHandler XrefBeginAttached; public event XrefBeginOperationEventHandler XrefBeginOtherAttached; public event XrefBeginOperationEventHandler XrefBeginRestore; public event XrefComandeeredEventHandler XrefComandeered; public event XrefPreXrefLockFileEventHandler XrefPreXrefLockFile; public event XrefRedirectedEventHandler XrefRedirected; public event EventHandler XrefRestoreAborted; public event EventHandler XrefRestoreEnded; public event XrefSubCommandAbortedEventHandler XrefSubCommandAborted; public event XrefSubCommandStartEventHandler XrefSubCommandStart; // Methods public Database(); public Database([MarshalAs(UnmanagedType.U1)] bool buildDefaultDrawing, [MarshalAs(UnmanagedType.U1)] bool noDocument); internal Database(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public void AbortDeepClone(IdMapping idMap); public ObjectId AddDBObject(DBObject appendIt); public void ApplyPartialOpenFilters(SpatialFilter spatialFilter, LayerFilter layerFilter); public ObjectId AttachXref(string fileName, string blockName); public void Audit(AuditInfo info); public void AuditXData(AuditInfo info); public void BindXrefs(ObjectIdCollection xrefIds, [MarshalAs(UnmanagedType.U1)] bool insertBind); public string ClassDxfName(RXClass getMyDxfName); public void CloseInput([MarshalAs(UnmanagedType.U1)] bool closeFile); public int CountEmptyObjects(int flags); public void CountHardReferences(ObjectIdCollection ids, int[] count); [www.BimCad.org]深居浅出 AutoCAD 二次开发 103 internal static Database Create(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public void DeepCloneObjects(ObjectIdCollection identifiers, ObjectId id, IdMapping mapping, [MarshalAs(UnmanagedType.U1)] bool deferTranslation); public void DetachXref(ObjectId xrefId); public void DisablePartialOpen(); public void DisableUndoRecording([MarshalAs(UnmanagedType.U1)] bool disable); public void DxfIn(string fileName, string logFilename); public void DxfOut(string fileName, int precision, DwgVersion version); public void DxfOut(string fileName, int precision, [MarshalAs(UnmanagedType.U1)] bool saveThumbnailImage); public int EraseEmptyObjects(int flags); public FieldEvaluationResult EvaluateFields(); public FieldEvaluationResult EvaluateFields(FieldEvaluationContext context); public FieldEvaluationResult EvaluateFields(FieldEvaluationContext context, string prop); public void ForceWblockDatabaseCopy(); public static Database FromAcadDatabase(object acadDatabase); public static List GetAllDatabases(); public DimStyleTableRecord GetDimensionStyleChildData(RXClass classDescriptor); public ObjectId GetDimensionStyleChildId(RXClass classDescriptor, ObjectId parentStyle); public ObjectId GetDimensionStyleParentId(ObjectId childStyle); public ObjectIdCollection GetDimRecentStyleList(); public DimStyleTableRecord GetDimstyleData(); public XrefGraph GetHostDwgXrefGraph([MarshalAs(UnmanagedType.U1)] bool includeGhosts); internal unsafe AcDbDatabase* GetImpObj(); public LineWeight GetNearestLineWeight(int weight); public ObjectId GetObjectId([MarshalAs(UnmanagedType.U1)] bool createIfNotFound, Handle objHandle, int identifier); public DwgVersion[] GetSupportedDxfOutVersions(); public DwgVersion[] GetSupportedSaveVersions(); public ObjectIdCollection GetViewports([MarshalAs(UnmanagedType.U1)] bool bGetPaperspaceVports); public StringCollection GetVisualStyleList(); public void Insert(Matrix3d transform, Database dataBase, [MarshalAs(UnmanagedType.U1)] bool preserveSourceDatabase); public ObjectId Insert(string blockName, Database dataBase, [MarshalAs(UnmanagedType.U1)] bool preserveSourceDatabase); public ObjectId Insert(string sourceBlockName, string destinationBlockName, Database dataBase, [MarshalAs(UnmanagedType.U1)] bool preserveSourceDatabase); [return: MarshalAs(UnmanagedType.U1)] public static bool IsObjectNonPersistent(ObjectId id); [return: MarshalAs(UnmanagedType.U1)] public bool IsValidLineWeight(int weight); public void LoadLineTypeFile(string lineTypeName, string filename); public void LoadMlineStyleFile(string mlineStyleName, string fileName); public static void MarkObjectNonPersistent(ObjectId id, [MarshalAs(UnmanagedType.U1)] bool value); public ObjectId OverlayXref(string fileName, string blockName); public void Purge(ObjectIdCollection ids); public void Purge(ObjectIdGraph idGraph); public void ReadDwgFile(IntPtr drawingFile, [MarshalAs(UnmanagedType.U1)] bool allowCPConversion, string password); public void ReadDwgFile(string fileName, FileOpenMode mode, [MarshalAs(UnmanagedType.U1)] bool allowCPConversion, string password); public void ReadDwgFile(string fileName, FileShare fileSharing, [MarshalAs(UnmanagedType.U1)] bool allowCPConversion, string password); [www.BimCad.org]深居浅出 AutoCAD 二次开发 104 public void ReclaimMemoryFromErasedObjects(ObjectIdCollection ids); public void ReloadXrefs(ObjectIdCollection xrefIds); public void ResolveXrefs([MarshalAs(UnmanagedType.U1)] bool useThreadEngine, [MarshalAs(UnmanagedType.U1)] bool doNewOnly); public void RestoreForwardingXrefSymbols(); public void RestoreOriginalXrefSymbols(); public void Save(); public void SaveAs(string fileName, DwgVersion version); public void SaveAs(string fileName, SecurityParameters security); public void SaveAs(string fileName, [MarshalAs(UnmanagedType.U1)] bool bBakAndRename, DwgVersion version, SecurityParameters security); public void SetDimstyleData(DimStyleTableRecord style); public TimeZone SetTimeZoneAsUtcOffset(double offset); public void SetWorldPaperspaceUcsBaseOrigin(Point3d origin, OrthographicView orthoView); public void SetWorldUcsBaseOrigin(Point3d origin, OrthographicView orthoView); public string TimeZoneDescription(TimeZone tz); public double TimeZoneOffset(TimeZone tz); [return: MarshalAs(UnmanagedType.U1)] public bool TryGetObjectId(Handle objHandle, out ObjectId id); public void UnloadXrefs(ObjectIdCollection xrefIds); public void UpdateExt([MarshalAs(UnmanagedType.U1)] bool doBestFit); public Database Wblock(); public Database Wblock(ObjectId blockId); public Database Wblock(ObjectIdCollection outObjIds, Point3d basePoint); public void Wblock(Database outputDataBase, ObjectIdCollection outObjIds, Point3d basePoint, DuplicateRecordCloning cloning); public void WblockCloneObjects(ObjectIdCollection identifiers, ObjectId id, IdMapping mapping, DuplicateRecordCloning cloning, [MarshalAs(UnmanagedType.U1)] bool deferTranslation); public Point3d WorldPaperspaceUcsBaseOrigin(OrthographicView orthoView); public Point3d WorldUcsBaseOrigin(OrthographicView orthoView); public void XBindXrefs(ObjectIdCollection xrefSymbolIds, [MarshalAs(UnmanagedType.U1)] bool insertBind); // Properties public object AcadDatabase { get; } public bool AllowExtendedNames { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double Angbase { get; set; } public bool Angdir { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool AnnoAllVisible { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool AnnotativeDwg { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int ApproxNumObjects { get; } public int Attmode { get; set; } public int Aunits { get; set; } public int Auprec { get; set; } public ObjectId BlockTableId { get; } public ObjectId ByBlockLinetype { get; } public ObjectId ByLayerLinetype { get; } public bool CameraDisplay { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 105 public double CameraHeight { get; set; } public AnnotationScale Cannoscale { get; set; } public Color Cecolor { get; set; } public double Celtscale { get; set; } public ObjectId Celtype { get; set; } public LineWeight Celweight { get; set; } public double Chamfera { get; set; } public double Chamferb { get; set; } public double Chamferc { get; set; } public double Chamferd { get; set; } public ObjectId Clayer { get; set; } public ObjectId Cmaterial { get; set; } public int Cmljust { get; set; } public double Cmlscale { get; set; } public ObjectId CmlstyleID { get; set; } public ObjectId ColorDictionaryId { get; } public ObjectId ContinuousLinetype { get; } public int Cshadow { get; set; } public ObjectId CurrentSpaceId { get; } public ObjectId CurrentViewportTableRecordId { get; } public ObjectId DataLinkDictionaryId { get; } public DataLinkManager DataLinkManager { get; } public int DgnFrame { get; set; } public int Dimadec { get; set; } public bool Dimalt { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int Dimaltd { get; set; } public double Dimaltf { get; set; } public double Dimaltrnd { get; set; } public int Dimalttd { get; set; } public int Dimalttz { get; set; } public int Dimaltu { get; set; } public int Dimaltz { get; set; } public string Dimapost { get; set; } public int Dimarcsym { get; set; } public bool Dimaso { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int DimAssoc { get; set; } public double Dimasz { get; set; } public int Dimatfit { get; set; } public int Dimaunit { get; set; } public int Dimazin { get; set; } public ObjectId Dimblk { get; set; } public ObjectId Dimblk1 { get; set; } public ObjectId Dimblk2 { get; set; } public double Dimcen { get; set; } public Color Dimclrd { get; set; } public Color Dimclre { get; set; } public Color Dimclrt { get; set; } public int Dimdec { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 106 public double Dimdle { get; set; } public double Dimdli { get; set; } public char Dimdsep { [return: MarshalAs(UnmanagedType.U2)] get; [param: MarshalAs(UnmanagedType.U2)] set; } public double Dimexe { get; set; } public double Dimexo { get; set; } public int Dimfrac { get; set; } public double Dimfxlen { get; set; } public bool DimfxlenOn { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double Dimgap { get; set; } public double Dimjogang { get; set; } public int Dimjust { get; set; } public ObjectId Dimldrblk { get; set; } public double Dimlfac { get; set; } public bool Dimlim { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public ObjectId Dimltex1 { get; set; } public ObjectId Dimltex2 { get; set; } public ObjectId Dimltype { get; set; } public int Dimlunit { get; set; } public LineWeight Dimlwd { get; set; } public LineWeight Dimlwe { get; set; } public string Dimpost { get; set; } public double Dimrnd { get; set; } public bool Dimsah { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double Dimscale { get; set; } public bool Dimsd1 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimsd2 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimse1 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimse2 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimsho { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimsoxd { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public ObjectId Dimstyle { get; set; } public ObjectId DimStyleTableId { get; } public int Dimtad { get; set; } public int Dimtdec { get; set; } public double Dimtfac { get; set; } public int Dimtfill { get; set; } public Color Dimtfillclr { get; set; } public bool Dimtih { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimtix { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double Dimtm { get; set; } public int Dimtmove { get; set; } public bool Dimtofl { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimtoh { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Dimtol { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int Dimtolj { get; set; } public double Dimtp { get; set; } public double Dimtsz { get; set; } public double Dimtvp { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 107 public ObjectId Dimtxsty { get; set; } public double Dimtxt { get; set; } public bool Dimtxtdirection { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int Dimtzin { get; set; } public bool Dimupt { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int Dimzin { get; set; } public bool DispSilh { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public ObjectId dragvs { get; set; } public byte DrawOrderCtl { get; set; } public int DwfFrame { get; set; } public bool DwgFileWasSavedByAutodeskSoftware { [return: MarshalAs(UnmanagedType.U1)] get; } public int DxEval { get; set; } public double Elevation { get; set; } public EndCap EndCaps { get; set; } public Point3d Extmax { get; set; } public Point3d Extmin { get; set; } public double Facetres { get; set; } public FileDependencyManager FileDependencyManager { get; } public string Filename { get; } public double Filletrad { get; set; } public bool Fillmode { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public string FingerprintGuid { get; set; } public ObjectId GeoDataObject { get; } public ObjectId GroupDictionaryId { get; } public int HaloGap { get; set; } public Handle Handseed { get; set; } public int HideText { get; set; } public DbHomeView HomeView { get; set; } public bool HpInherit { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point2d HpOrigin { get; set; } public string HyperlinkBase { get; set; } public int Indexctl { get; set; } public Point3d Insbase { get; set; } public UnitsValue Insunits { get; set; } public Color Interferecolor { get; set; } public ObjectId Interfereobjvs { get; set; } public ObjectId Interferevpvs { get; set; } public int IntersectColor { get; set; } public int IntersectDisplay { get; set; } public bool IsEmr { [return: MarshalAs(UnmanagedType.U1)] get; } public int Isolines { get; set; } public bool IsPartiallyOpened { [return: MarshalAs(UnmanagedType.U1)] get; } public JoinStyle JoinStyle { get; set; } public MaintenanceReleaseVersion LastSavedAsMaintenanceVersion { get; } public DwgVersion LastSavedAsVersion { get; } public double Latitude { get; set; } public int LayerEval { get; set; } public LayerFilterTree LayerFilters { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 108 public int LayerNotify { get; set; } public LayerStateManager LayerStateManager { get; } public ObjectId LayerTableId { get; } public ObjectId LayerZero { get; } public ObjectId LayoutDictionaryId { get; } public double LensLength { get; set; } public int LightGlyphDisplay { get; set; } public byte LightingUnits { get; set; } public bool LightsInBlocks { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Limcheck { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point2d Limmax { get; set; } public Point2d Limmin { get; set; } public ObjectId LinetypeTableId { get; } public bool LineWeightDisplay { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double LoftAng1 { get; set; } public double LoftAng2 { get; set; } public double LoftMag1 { get; set; } public double LoftMag2 { get; set; } public int LoftNormals { get; set; } public int LoftParam { get; set; } public double Longitude { get; set; } public double Ltscale { get; set; } public int Lunits { get; set; } public int Luprec { get; set; } public int MaintenanceReleaseVersion { get; } public ObjectId MaterialDictionaryId { get; } public int Maxactvp { get; set; } public MeasurementValue Measurement { get; set; } public string Menu { get; } public bool Mirrtext { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public ObjectId MLeaderstyle { get; set; } public ObjectId MLeaderStyleDictionaryId { get; } public ObjectId MLStyleDictionaryId { get; } public bool MsLtScale { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double MsOleScale { get; set; } public ObjectId NamedObjectsDictionaryId { get; } public double NorthDirection { get; set; } public int NumberOfSaves { get; } public ObjectContextManager ObjectContextManager { get; } public int ObscuredColor { get; set; } public int ObscuredLineType { get; set; } public bool OleStartUp { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public MaintenanceReleaseVersion OriginalFileMaintenanceVersion { get; } public string OriginalFileName { get; } public MaintenanceReleaseVersion OriginalFileSavedByMaintenanceVersion { get; } public DwgVersion OriginalFileSavedByVersion { get; } public DwgVersion OriginalFileVersion { get; } public bool Orthomode { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 109 public ObjectId PaperSpaceVportId { get; } public int PdfFrame { get; set; } public int Pdmode { get; set; } public double Pdsize { get; set; } public double Pelevation { get; set; } public Point3d Pextmax { get; set; } public Point3d Pextmin { get; set; } public Point3d Pinsbase { get; set; } public bool Plimcheck { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point2d Plimmax { get; set; } public Point2d Plimmin { get; set; } public bool PlineEllipse { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool Plinegen { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double Plinewid { get; set; } public ObjectId PlotSettingsDictionaryId { get; } public bool PlotStyleMode { [return: MarshalAs(UnmanagedType.U1)] get; } public ObjectId PlotStyleNameDictionaryId { get; } public PlotStyleDescriptor PlotStyleNameId { get; set; } public string ProjectName { get; set; } public bool Psltscale { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double PsolHeight { get; set; } public double PsolWidth { get; set; } public ObjectId PucsBase { get; set; } public ObjectId Pucsname { get; } public Point3d Pucsorg { get; } public OrthographicView PucsOrthographic { get; } public Vector3d Pucsxdir { get; } public Vector3d Pucsydir { get; } public bool Qtextmode { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public ObjectId RegAppTableId { get; } public bool Regenmode { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool RetainOriginalThumbnailBitmap { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int Saveproxygraphics { get; set; } public ObjectId SectionManagerId { get; } public SecurityParameters SecurityParameters { get; set; } public int Shadedge { get; set; } public int Shadedif { get; set; } public double ShadowPlaneLocation { get; set; } public int ShowHist { get; set; } public double Sketchinc { get; set; } public bool Skpoly { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int SolidHist { get; set; } public int SortEnts { get; set; } public bool Splframe { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int Splinesegs { get; set; } public int Splinetype { get; set; } public double StepSize { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 110 public double StepsPerSec { get; set; } public string StyleSheet { get; set; } public DatabaseSummaryInfo SummaryInfo { get; set; } public int Surftab1 { get; set; } public int Surftab2 { get; set; } public int Surftype { get; set; } public int Surfu { get; set; } public int Surfv { get; set; } public ObjectId Tablestyle { get; set; } public ObjectId TableStyleDictionaryId { get; } public DateTime Tdcreate { get; } public TimeSpan Tdindwg { get; } public DateTime Tducreate { get; } public DateTime Tdupdate { get; } public TimeSpan Tdusrtimer { get; } public DateTime Tduupdate { get; } public double Textsize { get; set; } public ObjectId Textstyle { get; set; } public ObjectId TextStyleTableId { get; } public double Thickness { get; set; } public Bitmap ThumbnailBitmap { get; set; } public bool TileMode { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int TileModeLightSynch { get; set; } public TimeZone TimeZone { get; set; } public double Tracewid { get; set; } public TransactionManager TransactionManager { get; } public int Treedepth { get; set; } public int TStackAlign { get; set; } public int TstackSize { get; set; } public ObjectId UcsBase { get; set; } public ObjectId Ucsname { get; } public Point3d Ucsorg { get; } public OrthographicView UcsOrthographic { get; } public ObjectId UcsTableId { get; } public Vector3d Ucsxdir { get; } public Vector3d Ucsydir { get; } public bool UndoRecording { [return: MarshalAs(UnmanagedType.U1)] get; } public int Unitmode { get; set; } public int UpdateThumbnail { get; set; } public int Useri1 { get; set; } public int Useri2 { get; set; } public int Useri3 { get; set; } public int Useri4 { get; set; } public int Useri5 { get; set; } public double Userr1 { get; set; } public double Userr2 { get; set; } public double Userr3 { get; set; } public double Userr4 { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 111 public double Userr5 { get; set; } public bool Usrtimer { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public string VersionGuid { get; set; } public double ViewportScaleDefault { get; set; } public ObjectId ViewportTableId { get; } public ObjectId ViewTableId { get; } public bool Visretain { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public ObjectId VisualStyleDictionaryId { get; } public bool Worldview { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int XclipFrame { get; set; } public ObjectId XrefBlockId { get; } public bool XrefEditEnabled { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } } 属性: 属性 数据类型 意义 AcadDatabase object 得到当前数据库(只读) BlockTableId ObjectId 得到块表 ObjectId (只读) Filename string 得到文件名(只读) Orthomode bool 如果设置为 true 则绘图区域为正交模式,false 为一般模式 方法: 方法 参数 作用 void AbortDeepClone ( IdMapping idMap ) idMap DeepClone 的 Id 映射 中止深度克隆 ObjectId AddDBObject ( DBObject appendIt ) appendIt 要添加到数据库的 DBObject 对象 数据库中添加 DBObject 对象 void ApplyPartialOpenFilters ( SpatialFilter spatialFilter, Autodesk.AutoCAD.DatabaseServices.Filters. LayerFilter layerFilter ) 1、spatialFilter 图纸范围 2、layerFilter 图层范围 局部打开数据库(使用前必须 用在 ReadDwgFile()方法打开 数据库之后,closeInput()之前) ObjectId AttachXref ( string fileName, string blockName ) 1、fileName 文件名 2、blockName 块名 引用外部文件为块定义: ObjectId refid = db.OverlayXref(@"c:\drwing.d wg", name);/ 把外部文件变为 块定义 BlockReference br = new BlockReference(Point3d.Origin, refid); // 通过块定义添加块 参照 void closeFile 是否要关闭文件 是否关闭 ReadDwgFile()方法 [www.BimCad.org]深居浅出 AutoCAD 二次开发 112 CloseInput ( bool closeFile ) 后台打开的文件。 void CountHardReferences ( ObjectIdCollection ids, int[] count ) 1、ids 要在数据库中查找的 ID 集合 2、count 是否存在标识集合 如果 ids[n]在数据库中存在那 么 count[n]的值被置 1 int CountEmptyObjects ( int flags ) flags 枚举型ZeroLengthCurve - 计数为零长度曲 线(AcDbCurve 派生如线,折线,样条等物) EmptyText - 计数空文本/ Mtext 对象(只包含空 格,制表符,进入和/或新行) AllEmptyObj - 计数所有空物体 空对象的数量 void DeepCloneObjects ( ObjectIdCollection identifiers, ObjectId id, IdMapping mapping, bool deferTranslation ) 1、identifiers 要深度克隆的 ObjectId 集合 2、id 克隆到所述者的 ObjectId 3、mapping 返回 ObjectId 集合对象跟克隆所属 对象的关系 4、deferTranslation 克隆是否完成 深度克隆对象集合,如果克隆 的 Entity 对象要即时显示需要 执行对象的 Draw()方法。 void Purge ( ObjectIdCollection ids ) ids 查找的对象 ID 集合 返回源 ids 中的 id 指向的对象 在数据库中没有硬所有隶属 关系的对象 id 集合 void Purge ( ObjectIdGraph idGraph ) idGraph 数据库中的图形对象 id 返回可以被安全删除的对象 id void ForceWblockDatabaseCopy() 无 禁止写块克隆 int EraseEmptyObjects ( int flags ) flags 枚举型ZeroLengthCurve - 计数为零长度曲 线(AcDbCurve 派生如线,折线,样条等物) EmptyText - 计数空文本/ Mtext 对象(只包含空 格,制表符,进入和/或新行) AllEmptyObj - 计数所有空物体 删除空对象,返回删除个数 ObjectId GetObjectId ( bool createIfNotFound, Handle objHandle, int identifier ) 1、createIfNotFound 是否没找到输入的句柄的 ID 就新建一个 ID 2、objHandle 对象句柄 3、identifier 未启用 由 Handle 获得 ObjectId Void Save() 无 保存文件 [www.BimCad.org]深居浅出 AutoCAD 二次开发 113 void SaveAs ( string fileName, DwgVersion version ) 1、fileName 另存为的文件名 2、version 另存的版本 DWG 数据库另存为 DwgVersion[] GetSupportedDxfOutVersions() 无 支持的输出 DXF 的 DWG 版本 DwgVersion[] GetSupportedSaveVersions() 无 支持的 DWG 版本 void Insert ( Matrix3d transform, Database dataBase, bool preserveSourceDatabase ) 1、transform 变换矩阵 2、dataBase 要插入的数据库对象 3、preserveSourceDatabase 插入数据库是否保 持原样 将一个数据库插入到当前数 据库中 ObjectId Insert ( string sourceBlockName, string destinationBlockName, Database dataBase, bool preserveSourceDatabase ) 1、sourceBlockName 资源块名 2、destinationBlockName 新建的快表记录名 3、dataBase 资源数据库 4、preserveSourceDatabase 资源数据库是否保 持原样 以资源数据库中的一个块插 入本数据库 void ReadDwgFile ( string fileName, FileOpenMode mode, bool allowCPConversion, string password ) 1、fileName 文件名 2、mode 打开方式 3、allowCPConversion 是否允许转换版本 4、password 密码 后台读 DWG 文件,即你可以 不用把 DWG 图纸打开到 Document 中就可以后台读取 DWG 里面的信息。 void ReadDwgFile ( string fileName, FileShare fileSharing, bool allowCPConversion, string password ) 1、fileName 文件名 2、fileSharing 共享方式 3、allowCPConversion 是否允许转换版本 4、password 密码 后台读 DWG 文件,即你可以 不用把 DWG 图纸打开到 Document 中就可以后台读取 DWG 里面的信息。 Database Wblock ( ObjectIdCollection outObjIds, Point3d basePoint ) 1、outObjIds 复制的 ObjectId 集合 2、basePoint 基点 数据库之间复制对象 Database Wblock ( ObjectId blockId ) blockId 块 ObjectId 数据库之间复制块 [www.BimCad.org]深居浅出 AutoCAD 二次开发 114 LoadLineTypeFile ( string lineTypeName, string filename ) 1、lineTypeName 线型名 2、filename 线型文件名 建立线型文件名与线型名对 应关系。 事件: 事件 意义 BeginSave 开始保存 DatabaseConstructed 由 DWG 文件建立数据库完成 ObjectAppended 向数据库添加对象 ObjectErased 删除对象 ObjectModified 修改对象 ObjectOpenedForModify 为修改打开对象 [www.BimCad.org]深居浅出 AutoCAD 二次开发 115 【5】Transaction (事务) Transaction (事务)是用来控制数据库操作的对象。当打开处理数据库对象的时候 Transaction 提供了自动关闭的机制, 以避免打开对象后忘记关闭而导致下次操作该对象出错。 作用: 1、用于添加、删除、编辑数据库对象 事务将对多个对象的多步操作封装为一个原子操作,如果事务提交则操作过程全部执行,如果事务被终止则取消所有的 操作。在事务中调用 AddNewlyCreatedDBObject()方法可以向数据库中添加数据库对象。 2、用于获得数据库对象指针 在一个事务开启到关闭期间可以通过 GetObject()函数同时打开多个数据库对象,并且在事务结束之前打开对象的指针 都有效,这样使得在一个操作过程中不用反复的打开、关闭对象操作。 3、用于打包一连串对数据库操作的动作 一连串对数据库的操作可以组织在事务中来控制。事务的开始到提交、或终止这段过程叫事务的边界,事务的边界是由 开发者控制的,为了避免错误建议将事务的边界控制在尽可能小的范围,总之事务处理完成后记得要提交或者终止。提交后 边界之内的操作将全部执行,终止后边界之内的操作将全部滚回。 Database db = HostApplicationServices.WorkingDatabase; //当前数据库 using (Transaction tr = db.TransactionManager.StartTransaction()) //using,自动调用Dispose方法 { //处理过程 tr.Commit(); //事务提交 } 事务嵌套: 事务的嵌套是指在一个事务的边界当中嵌入另一个事务,事务管理器会将事务保存在堆栈中,最近的事务在堆栈顶部可 以通过 TransactionManager.TopTransaction()方法获得。当事务嵌套时,里层的事务可以使用外层事务打开的对象,如果最 里层的事务终止了,则在此事务内的所有对象操作将取消,对象返回到此事务开始时候得状态,对象指针也将不再可用,需 要注意的是在事务嵌套使用的时候必须一层一层的提交。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 116 而且必须父层的事务提交后,子层的事务才能生效,否则退回。 类定义: public class Transaction : RXObject { // Methods protected internal Transaction(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void Abort(); public virtual void AddNewlyCreatedDBObject(DBObject obj, [MarshalAs(UnmanagedType.U1)] bool add); private void CheckTopTransaction(); public virtual void Commit(); protected override void DeleteUnmanagedObject(); public DBObjectCollection GetAllObjects(); internal unsafe AcTransaction* GetImpObj(); public virtual DBObject GetObject(ObjectId id, OpenMode mode); [www.BimCad.org]深居浅出 AutoCAD 二次开发 117 public virtual DBObject GetObject(ObjectId id, OpenMode mode, [MarshalAs(UnmanagedType.U1)] bool openErased); public virtual DBObject GetObject(ObjectId id, OpenMode mode, [MarshalAs(UnmanagedType.U1)] bool openErased, [MarshalAs(UnmanagedType.U1)] bool forceOpenOnLockedLayer); // Properties public virtual TransactionManager TransactionManager { get; } } 属性: 属性 数据类型 意义 TransactionManager Autodesk.AutoCAD.DatabaseServices.TransactionManager 事务管理员(只读) 方法: 方法 参数 作用 void Abort() 终止(事务期间的操作不执行) void Commit() 提交(事务期间的操作全部执行) DBObjectCollection GetAllObjects() 事务期间打开的对象集合 DBObject GetObject ( ObjectId id, Autodesk.AutoCAD.DatabaseServices.OpenMode mode ) 1、id 对象 ObjectId 2、mode 打开方式 打开对象 DBObject GetObject ( ObjectId id, Autodesk.AutoCAD.DatabaseServices.OpenMode mode, bool openErased ) 1、id 对象 ObjectId 2、mode 打开方式 3、openErased 对象是否可以删除 DBObject GetObject ( ObjectId id, Autodesk.AutoCAD.DatabaseServices.OpenMode mode, bool openErased, bool forceOpenOnLockedLayer ) 1、id 对象 ObjectId 2、mode 打开方式 3、openErased 对象是否可以删除 4、forceOpenOnLockedLayer (true 锁定图层必须打开) void AddNewlyCreatedDBObject ( DBObject obj, bool add ) 1、obj 对象 2、add(true:添加 false:删除) 添加新对象到数据库 [www.BimCad.org]深居浅出 AutoCAD 二次开发 118 【6】DBObject(数据库对象) DBObject 是所有数据库对象的基类是一个抽象类,所有的数据库对象都是由它派生,他的属性方法在所有的子类中都 适用。 程序中的对象可能存在两种状态 1、在内存中(实例化但是没添加到数据库中):可以任意修改对象的属性。2、在数据库 中:需要打开才能进行属性修改。 *类别判断 (1)方法一:写typename参数的时候比较容易写错,不推荐使用。 if (obj.GetType().Name.ToString() == typename) // typename(类型名):”DBtext”、”Line”..... { // 操作 } else { // 操作 } (2)方法二:类型比较 if (obj.GetType() == typeof(type)) // type(类型):DBtext、Line.... { // 操作 } else { // 操作 } (3)方法三:通过ObjectId获取对象类型比较,可以不用得到具体对象 if (id.ObjectClass.Equals(RXClass.GetClass(typeof(type)))) // type(类型):DBtext、Line.... { // 操作 } else { // 操作 } (4)方法四:用 is 语句判断 [www.BimCad.org]深居浅出 AutoCAD 二次开发 119 if (obj is type) // type(类型):DBtext、Line.... { // 操作 } else { // 操作 } *类型转换 (1)强制转换:转换之前先判断一下能不能转换成所要的类型,否则程序会发生异常 DBObject obj; if (obj is Line)//DBtext、Circle.... { Line l = (Line)o; //类型转换成功 } else { //类型转换失败 } 或者可以写成这样: DBObject obj; try { Line l = (Line)o; //类型转换成功 } catch { //类型转换失败 } (2) 非强制转换:如果转换不成功则转换的结果为空 DBObject obj ; Line l = obj as Line; if (l == null) { //类型转换失败 } else { //类型转换成功 } *关系 数据库中的对象之间的基本关系 [www.BimCad.org]深居浅出 AutoCAD 二次开发 120 1、硬所有:对象在数据库中的储存关系(符号表里面的所属关系)。 2、软所有:对象逻辑上的包含关系(词典里面的包含关系)。 3、硬指针:对象属性的外键(对象属性与其他符号表记录的关系)。 4、软指针:对象属性逻辑上的指向(对象的扩展数据对应的词典对象)。 克隆 克隆一个对象可以通过运算符“=”、Clone()、DeepClone()、WblockClone()四种方法。 1、浅度克隆:Clone()与”=”类似只能签层次的克隆对象的基本属性。 2、深度克隆:DeepClone()可以克隆对象的软所有与硬所有关系。 3、写块克隆:WblockClone()可以在不同的数据库之间克隆对象的硬所有与硬指针关系。 类定义: public abstract class DBObject : Drawable { // Fields private EventHandler m_pCancelledEvent; private ObjectEventHandler m_pCopiedEvent; private ObjectErasedEventHandler m_pErasedEvent; private EventHandler m_pGoodbyeEvent; private EventHandler m_pModifiedEvent; private EventHandler m_pModifiedXDataEvent; private EventHandler m_pModifyUndoneEvent; private ObjectClosedEventHandler m_pObjectClosedEvent; private EventHandler m_pOpenedForModifyEvent; private EventHandler m_pReappendedEvent; private ObjectEventHandler m_pSubObjectModifiedEvent; [www.BimCad.org]深居浅出 AutoCAD 二次开发 121 private EventHandler m_pUnappendedEvent; private static Dictionary s_map; // Events public event EventHandler Cancelled; public event ObjectEventHandler Copied; public event ObjectErasedEventHandler Erased; public event EventHandler Goodbye; public event EventHandler Modified; public event EventHandler ModifiedXData; public event EventHandler ModifyUndone; public event ObjectClosedEventHandler ObjectClosed; public event EventHandler OpenedForModify; public event EventHandler Reappended; public event ObjectEventHandler SubObjectModified; public event EventHandler Unappended; // Methods private void !DBObject(); static DBObject(); protected internal DBObject(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); private void ~DBObject(); public void AddContext(ObjectContext context); public void ApplyPaperOrientationTransform(Viewport viewport); public virtual void ApplyPartialUndo(DwgFiler undoFiler, RXClass classObj); public virtual void Audit(AuditInfo auditInfo); [Obsolete("Use Transaction instead")] public void Cancel(); [Obsolete("Use Transaction instead")] public void Close(); [Obsolete("Use Transaction instead")] public void CloseAndPage([MarshalAs(UnmanagedType.U1)] bool onlyWhenClean); public void CreateExtensionDictionary(); public virtual DecomposeForSaveReplacementRecord DecomposeForSave(DwgVersion version); public DBObject DeepClone(DBObject ownerPointer, IdMapping idMap, [MarshalAs(UnmanagedType.U1)] bool isPrimary); protected override void DeleteUnmanagedObject(); public void DisableUndoRecording([MarshalAs(UnmanagedType.U1)] bool disable); protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool); public void DowngradeOpen(); public void DowngradeToNotify([MarshalAs(UnmanagedType.U1)] bool wasWritable); public void DwgIn(DwgFiler filer); public void DwgOut(DwgFiler filer); public void DxfIn(DxfFiler filer); public void DxfOut(DxfFiler filer); public void Erase(); public void Erase([MarshalAs(UnmanagedType.U1)] bool erasing); public static ObjectId FromAcadObject(object acadObj); public DBObjectEventExtender GetEventExtender([MarshalAs(UnmanagedType.U1)] bool create); [www.BimCad.org]深居浅出 AutoCAD 二次开发 122 public ObjectId GetField(); public ObjectId GetField(string propertyName); internal unsafe AcDbObject* GetImpObj(); public virtual FullDwgVersion GetObjectSaveVersion(DwgFiler filer); public virtual FullDwgVersion GetObjectSaveVersion(DxfFiler filer); public IParameter GetParameterInterface(string name, [MarshalAs(UnmanagedType.U1)] bool runtimeInterface); public ObjectIdCollection GetPersistentReactorIds(); [Obsolete("Use GetTransientReactors() instead.")] public List GetReactors(); public List GetTransientReactors(); public ResultBuffer GetXDataForApplication(string applicationName); public void HandOverTo(DBObject newPointer, [MarshalAs(UnmanagedType.U1)] bool keepXData, [MarshalAs(UnmanagedType.U1)] bool keepExtensionDictionary); [return: MarshalAs(UnmanagedType.U1)] public bool HasContext(ObjectContext context); [return: MarshalAs(UnmanagedType.U1)] public bool HasPersistentReactor(ObjectId objId); [return: MarshalAs(UnmanagedType.U1)] public static bool IsCustomObject(ObjectId id); public void ReleaseExtensionDictionary(); public void RemoveContext(ObjectContext context); public ObjectId RemoveField(); public void RemoveField(ObjectId id); public ObjectId RemoveField(string propertyName); public void ResetScaleDependentProperties(); public ObjectId SetField(Field field); public ObjectId SetField(string propertyName, Field field); [return: MarshalAs(UnmanagedType.U1)] public bool SetFromStyle(); public void SetObjectIdsInFlux(); public void SetPaperOrientation([MarshalAs(UnmanagedType.U1)] bool bPaperOrientation); protected internal override int SubSetAttributes(DrawableTraits traits); protected internal override void SubViewportDraw(ViewportDraw vd); protected internal override int SubViewportDrawLogicalFlags(ViewportDraw vd); [return: MarshalAs(UnmanagedType.U1)] protected internal override bool SubWorldDraw(WorldDraw wd); [return: MarshalAs(UnmanagedType.U1)] public bool SupportsCollection(string collectionName); public void SwapIdWith(ObjectId otherId, [MarshalAs(UnmanagedType.U1)] bool swapExtendedData, [MarshalAs(UnmanagedType.U1)] bool swapExtensionDictionary); public virtual void SwapReferences(IdMapping idMap); [return: MarshalAs(UnmanagedType.U1)] public bool UpgradeFromNotify(); public void UpgradeOpen(); public DBObject WblockClone(RXObject ownerPointer, IdMapping idMap, [MarshalAs(UnmanagedType.U1)] bool isPrimary); public void XDataTransformBy(Matrix3d transform); // Properties [www.BimCad.org]深居浅出 AutoCAD 二次开发 123 [Category("Misc")] public object AcadObject { get; } public AnnotativeStates Annotative { get; set; } [Category("Misc")] public Guid ClassID { get; } public Database Database { get; } [XmlIgnore] public virtual Drawable Drawable { get; } [Category("Misc")] public ObjectId ExtensionDictionary { get; } [Category("Misc")] public Handle Handle { get; } [Category("Misc")] public bool HasFields { [return: MarshalAs(UnmanagedType.U1)] get; } public bool HasSaveVersionOverride { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public override ObjectId Id { get; } [Category("Misc")] public bool IsAProxy { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsCancelling { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsErased { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsEraseStatusToggled { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsModified { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsModifiedGraphics { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsModifiedXData { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsNewObject { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsNotifyEnabled { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsNotifying { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsObjectIdsInFlux { [return: MarshalAs(UnmanagedType.U1)] get; } public override bool IsPersistent { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsReadEnabled { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsReallyClosing { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsTransactionResident { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsUndoing { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsWriteEnabled { [return: MarshalAs(UnmanagedType.U1)] get; } [Category("Misc")] public virtual DuplicateRecordCloning MergeStyle { get; set; } [Category("Misc")] public virtual FullDwgVersion ObjectBirthVersion { get; } [Category("Misc")] public ObjectId ObjectId { get; } [Category("Misc")] public virtual ObjectId OwnerId { get; set; } public PaperOrientationStates PaperOrientation { get; } public DwgFiler UndoFiler { get; } public virtual ResultBuffer XData { get; set; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 124 属性: 属性 数据类型 意义 Database Database 对象所属的数据库 ExtensionDictionary ObjectId 对象的扩展词典 Handle Handle 对象的 Handle,Handle 是对象在一个数据库中的唯一标 识,对象一旦创建 Handle 就不会被改变。 IsErased bool 判断对象是否被删除 IsWriteEnabled bool 判断对象是否可写 XData ResultBuffer 获得对象的 Xdata ObjectId ObjectId 获得对象的 ObjectId,ObjectId 是所有数据库对象在内存 中的唯一标识,它是每次打开 DWG 文件时数据库自动分 配创建的记录, 也就是说 ObjectId 会随着每次打开 DWG 图形而改变。 Handle 与 ObjectId 的关系: 1、通过 Handle 获得 ObjectId: Handle handle=id.Handle; 2、通过 ObjectId 获得 Handle: ObjectId id = db.GetObjectId(false, handle, 0); 3、通过长整型数字获得 Handle: Handle handle = new Handle(value); 方法: 方法 参数 作用 void AddContext ( ObjectContext context ) Context 注释 给对象添加注释信息 可以给对象添加注释,目前 AutoCAD 中的注释对象只有 AnnotationScale(比例注释)今后应该 还会扩充一些其他的注释性对象。 AnnotationScale(比例注释)对象添以 后,把你需要注释的比例添加进注释 比例列表,再不同的比例下被注释的 对象现实的尺寸大小是不变的 bool HasContext ( ObjectContext context ) Context 注释 判断对象是否含有指定注释信息 void RemoveContext ( Context 注释 删除指定注释信息 [www.BimCad.org]深居浅出 AutoCAD 二次开发 125 ObjectContext context ) void ApplyPaperOrientationTransform ( Autodesk.AutoCAD.DatabaseServices.Viewport viewport ) viewport 要适应到图纸空间的视口 数据库中添加 DBObject 对象 void Cancel() 关闭当前所有的操作 void Close() 关闭对象 void Erase() 删除对象(删除后对象只是做了删除 标记,此对象不被显示,还会保存在 数据库中。直到文件关闭再次打开此 记录才从数据库中完全删除。) void CreateExtensionDictionary() 创建对象扩展词典 void ReleaseExtensionDictionary() 删除对象扩展词典 DBObject DeepClone ( DBObject ownerPointer, IdMapping idMap, bool isPrimary ) 1、ownerPointer 要深度克隆的对象 的所有者 2、idMap Id 映射 3、isPrimary 是主对象还是从对象 深度克隆对象,用于复制对象和他的 隶属关系引用(ownerPointer),仅仅在 单数据库中克隆对象。如果克隆 Entity 对象需要立即在图形中显示需 要执行 Entity.Draw()方法。 DBObject WblockClone ( RXObject ownerPointer, IdMapping idMap, bool isPrimary ) 1、ownerPointer 要写块克隆的对象 的所有者 2、idMap Id 映射 3、isPrimary 是主对象还是从对象 写块克隆对象,用于拷贝对象硬所有 关系和硬指针,忽略软引用,可以在 不同的数据库中克隆对象。 void DowngradeOpen() 降级打开,如果当前是可写打开,调 用方法后变为可读打开 void UpgradeOpen() 升级打开,如果当前是可读打开,调 用方法后变为可写打开 ObjectId SetField ( Field field ) Field 字段 设置字段 ObjectId SetField ( string propertyName, Field field ) 1、propertyName 属性名 2、field 字段 ObjectId GetField() 获得字段 ObjectId GetField ( string propertyName ) propertyName 属性名 [www.BimCad.org]深居浅出 AutoCAD 二次开发 126 ObjectId RemoveField() 删除字段 Void RemoveField ( Autodesk.AutoCAD.DatabaseServices.ObjectId id ) Id 字段 ObjectId Void ObjectId RemoveField ( string propertyName ) propertyName 字段名 (1) SymbolTable(符号表)、SymbolTableRecord(符号表记录) SymbolTable(符号表)是 AutoCAD 表对象的基类,符号表是容器对象,用来存放 SymbolTableRecord(符号表记录)。 符号表结构: 类定义: public abstract class SymbolTable : DBObject, IEnumerable { // Fields private bool m_skipDeleted; // Methods internal protected SymbolTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public ObjectId Add(SymbolTableRecord value); internal protected virtual SymbolTable Copy(); public virtual SymbolTableEnumerator GetEnumerator(); internal unsafe AcDbSymbolTable* GetImpObj(); [return: MarshalAs(UnmanagedType.U1)] public bool Has(ObjectId id); [return: MarshalAs(UnmanagedType.U1)] public bool Has(string key); [www.BimCad.org]深居浅出 AutoCAD 二次开发 127 internal protected virtual IEnumerator IEnumerableGetEnumerator(); // Properties public SymbolTable IncludingErased { get; } public ObjectId this[string key] { get; } internal protected bool SkipDeleted { [return: MarshalAs(UnmanagedType.U1)] get; } } 属性: 属性 数据类型 意义 IncludingErased SymbolTable 返回擦除了的符号表 方法: 方法 参数解释 作用 ObjectId Add ( SymbolTableRecord value ) value 符号表记录 给符号表添加一条表记录 bool Has ( ObjectId id ) id 符号表记录 ObjectId 判断符号表中是否有给定 ObjectId 的表记录 bool Has ( string key ) key 符号表记录名 判断符号表中是否有给定表名的表记录 SymbolTableRecord(符号表记录) SymbolTableRecord(符号表记录)是组成符号表的元素。特定的符号表中只能储存特定的符号表记录,如:块表中,只能 储存块表记录。 类定义: public abstract class SymbolTableRecord : DBObject { // Methods protected internal SymbolTableRecord(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbSymbolTableRecord* GetImpObj(); // Properties public bool IsDependent { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsResolved { [return: MarshalAs(UnmanagedType.U1)] get; } public string Name { get; set; } } 属性: [www.BimCad.org]深居浅出 AutoCAD 二次开发 128 属性 数据类型 意义 IsDependent bool 此符号表记录是否依赖于附属 xref 图纸 IsResolved bool 确定此符号表记录是否是一 xref 的一部分 Name string 符号表记录的名字 (1.1) BlockTabLe (块表)、BlockTableRecord(块表记录) BlockTabLe (块表)是储存 BlockTableRecord(块表记录)的容器。 块表结构: 获取块表的方法: ObjectId BlockTableId = HostApplicationServices.WorkingDatabase.BlockTableId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); trans.Commit(); } 类定义: public sealed class BlockTable : SymbolTable, IEnumerable { // Methods internal BlockTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } BlockTableRecord(块表记录) 块表记录是存放 AutoCAD 可见对象(Entity)的容器,一个储存在块表中的块记录就是 AutoCAD 图形中的块定义或匿名块, 块定义可以通过块参照添加到模型空间中显示。模型空间和图纸空间本身也是特殊的块表记录,储存在其中的对象会自动通 过 AutoCAD 的图形系统接口在绘图区域显示几何图形。 类定义: public class BlockTableRecord : SymbolTableRecord, IEnumerable { // Fields private static BlockInsertionPointsEventHandler m_blockInsertionPoints; private bool m_bSkipDeleted; private static int m_nInsPtCount; public static string modopt(IsConst) modopt(IsConst) ModelSpace; public static string modopt(IsConst) modopt(IsConst) PaperSpace; [www.BimCad.org]深居浅出 AutoCAD 二次开发 129 // Events public static event BlockInsertionPointsEventHandler BlockInsertionPoints; // Methods static BlockTableRecord(); public BlockTableRecord(); protected internal BlockTableRecord(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public ObjectId AppendEntity(Entity entity); public void AssumeOwnershipOf(ObjectIdCollection entitiesToMove); protected internal virtual BlockTableRecord Copy(); private static void DecrementInsPtHandlerCount(); public ObjectIdCollection GetAnonymousBlockIds(); public ObjectIdCollection GetBlockReferenceIds([MarshalAs(UnmanagedType.U1)] bool directOnly, [MarshalAs(UnmanagedType.U1)] bool forceValidity); public BlockTableRecordEnumerator GetEnumerator(); public ObjectIdCollection GetErasedBlockReferenceIds(); internal unsafe AcDbBlockTableRecord* GetImpObj(); public Database GetXrefDatabase([MarshalAs(UnmanagedType.U1)] bool incrementUnresolved); protected internal virtual IEnumerator IEnumerableGetEnumerator(); private static void IncrementInsPtHandlerCount(); public void UpdateAnonymousBlocks(); // Properties public ObjectId BlockBeginId { get; } public ObjectId BlockEndId { get; } public BlockScaling BlockScaling { get; set; } public string Comments { get; set; } public ObjectId DrawOrderTableId { get; } public bool Explodable { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool HasAttributeDefinitions { [return: MarshalAs(UnmanagedType.U1)] get; } public bool HasPreviewIcon { [return: MarshalAs(UnmanagedType.U1)] get; } public BlockTableRecord IncludingErased { get; } public bool IsAnonymous { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsDynamicBlock { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsFromExternalReference { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsFromOverlayReference { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsLayout { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsUnloaded { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public ObjectId LayoutId { get; set; } public Point3d Origin { get; set; } public string PathName { get; set; } public Bitmap PreviewIcon { get; set; } protected internal bool SkipDeleted { [return: MarshalAs(UnmanagedType.U1)] get; } public UnitsValue Units { get; set; } public XrefStatus XrefStatus { get; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 130 属性: 属性 数据类型 意义 BlockBeginId ObjectId 返回块表记录起始对象的 ObjectId(只读) BlockEndId ObjectId 返回块表记录最后一个对象的 ObjectId(只读) BlockScaling Autodesk.AutoCAD.DatabaseServices.BlockScaling 块比例 Explodable bool 块参照是否能被炸开 HasAttributeDefinitions bool 是否含有属性定义 HasPreviewIcon bool 是否有预览图像 IsAnonymous bool 是否匿名块 IsDynamicBlock bool 是否动态块 Origin Point3d 块的原点 PathName string 引用的外部参照的文件名 PreviewIcon Bitmap 预览图标 DrawOrderTableId ObjectId DrawOrderTable 的 ObjectId,DrawOrderTable 可 以控制块表记录中的对象的绘图次序 方法: 方法 参数解释 作用 ObjectId AppendEntity ( Entity entity ) entity 实体对象 在块表记录中添加一个实体 对象 void AssumeOwnershipOf ( ObjectIdCollection entitiesToMove ) entitiesToMove 要进行关系转移的对象集合 块表记录之间移动实体 ObjectIdCollection GetAnonymousBlockIds() 无 获得匿名块 ID 集合 ObjectIdCollection GetBlockReferenceIds ( bool directOnly, bool forceValidity ) 1、directOnly true 嵌套块,父块引用不包含 在内 false 不是嵌套块 2、forceValidity 当 directOnly 为 false 时有用 获得块引用 ID 集合 Void UpdateAnonymousBlocks() 无 更新匿名块 *几个重要的概念: 1、ModelSpace(模型空间)是一条名为*Model_Space 的特殊块表记录,保存在其中的可视化图形对象(Entity),可以在绘图 区域中的模型空间中显示。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 131 获取模型空间 ObjectId 的方法: (1) ObjectId ModelSpaseID = SymbolUtilityServices.GetBlockModelSpaceId(HostApplicationServices.WorkingDatabase); (2) BlockTable bt = (BlockTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead); ObjectId ModelSpaseID = bt[BlockTableRecord.ModelSpace]; (3) BlockTable bt = (BlockTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead); ObjectId ModelSpaseID =bt["*Model_Space"] ; 2、PaperSpace(图纸空间)是一条名为*Paper_Space 的特殊块表记录。保存在其中的可视化图形对象(Entity)可以在绘图区域 中的图纸空间中显示。 获取图纸空间 ObjectId 的方法: (1) ObjectId PaperSpaseID = SymbolUtilityServices. GetBlockPaperSpaceId (HostApplicationServices.WorkingDatabase); (2) BlockTable bt = (BlockTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead); [www.BimCad.org]深居浅出 AutoCAD 二次开发 132 ObjectId ModelSpaseID = bt[BlockTableRecord.PaperSpace]; (3) BlockTable bt = (BlockTable)trans.GetObject(HostApplicationServices.WorkingDatabase.BlockTableId, OpenMode.ForRead); ObjectId ModelSpaseID =bt["*Paper_Space"] ; 3、BlockTableRecord(块表记录)储存到块表中叫“块定义”或“匿名块”。 4、“块定义”或“匿名块”以 BlockReference(块参照)的形式在模型空间中显示,显示出来的图形就是 AutoCAD 中的图块。 5、块定义中可以通过 AttributeDefinition(属性定义)给块定义添加属性,定义在块中的 AttributeDefinition(属性定义)需要通 过 AttributeReference(属性参照)添加到 BlockReference(块参照)中随块参照一起显示。做法见属性定义和属性参照相关章节。 (1.2) DimStyleTable(尺寸标注样式表) 、DimStyleTableRecord(标注样式表记录) 尺寸标注也是 AutoCAD 数据库中块表记录中的一种对象。一个完整的尺寸对象由尺寸标注线,尺寸界线,尺寸箭头和 尺寸文字构成 DimStyleTable(尺寸标注样式表)是储存尺寸标注样式的容器,其中储存的标注样式可以在“标注样式管理器”中查看: [www.BimCad.org]深居浅出 AutoCAD 二次开发 133 类定义: public sealed class DimStyleTable : SymbolTable, IEnumerable { // Methods internal DimStyleTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } DimStyleTableRecord(标注样式表记录) 类定义: public class DimStyleTableRecord : SymbolTableRecord { // Methods public DimStyleTableRecord(); protected internal DimStyleTableRecord(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public ObjectId GetArrowId(DimArrowFlag whichArrow); internal unsafe AcDbDimStyleTableRecord* GetImpObj(); // Properties public virtual int Dimadec { get; set; } public virtual bool Dimalt { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimaltd { get; set; } public virtual double Dimaltf { get; set; } public virtual double Dimaltrnd { get; set; } public virtual int Dimalttd { get; set; } public virtual int Dimalttz { get; set; } public virtual int Dimaltu { get; set; } public virtual int Dimaltz { get; set; } public virtual string Dimapost { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 134 public virtual int Dimarcsym { get; set; } public virtual double Dimasz { get; set; } public virtual int Dimatfit { get; set; } public virtual int Dimaunit { get; set; } public virtual int Dimazin { get; set; } public ObjectId Dimblk { get; virtual set; } public ObjectId Dimblk1 { get; virtual set; } public ObjectId Dimblk2 { get; virtual set; } public virtual double Dimcen { get; set; } public virtual Color Dimclrd { get; set; } public virtual Color Dimclre { get; set; } public virtual Color Dimclrt { get; set; } public virtual int Dimdec { get; set; } public virtual double Dimdle { get; set; } public virtual double Dimdli { get; set; } public virtual char Dimdsep { [return: MarshalAs(UnmanagedType.U2)] get; [param: MarshalAs(UnmanagedType.U2)] set; } public virtual double Dimexe { get; set; } public virtual double Dimexo { get; set; } public virtual int Dimfrac { get; set; } public virtual double Dimfxlen { get; set; } public virtual bool DimfxlenOn { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual double Dimgap { get; set; } public virtual double Dimjogang { get; set; } public virtual int Dimjust { get; set; } public virtual ObjectId Dimldrblk { get; set; } public virtual double Dimlfac { get; set; } public virtual bool Dimlim { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual ObjectId Dimltex1 { get; set; } public virtual ObjectId Dimltex2 { get; set; } public virtual ObjectId Dimltype { get; set; } public virtual int Dimlunit { get; set; } public virtual LineWeight Dimlwd { get; set; } public virtual LineWeight Dimlwe { get; set; } public virtual string Dimpost { get; set; } public virtual double Dimrnd { get; set; } public virtual bool Dimsah { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual double Dimscale { get; set; } public virtual bool Dimsd1 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimsd2 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimse1 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimse2 { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimsoxd { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimtad { get; set; } public virtual int Dimtdec { get; set; } public virtual double Dimtfac { get; set; } public virtual int Dimtfill { get; set; } public virtual Color Dimtfillclr { get; set; } public virtual bool Dimtih { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 135 public virtual bool Dimtix { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual double Dimtm { get; set; } public virtual int Dimtmove { get; set; } public virtual bool Dimtofl { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimtoh { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimtol { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimtolj { get; set; } public virtual double Dimtp { get; set; } public virtual double Dimtsz { get; set; } public virtual double Dimtvp { get; set; } public virtual ObjectId Dimtxsty { get; set; } public virtual double Dimtxt { get; set; } public virtual bool Dimtxtdirection { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimtzin { get; set; } public virtual bool Dimupt { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimzin { get; set; } public bool IsModifiedForRecompute { [return: MarshalAs(UnmanagedType.U1)] get; } } (1.3) LayerTable (层表)、LayerTableRecord(层表记录) LayerTable(层表)是存放 LayerTableRecord(层表记录)的容器,储存在层表中的层表记录即为图层,我们可以在“图层特 性管理器”中看见: 结构: [www.BimCad.org]深居浅出 AutoCAD 二次开发 136 类定义: public sealed class LayerTable : SymbolTable { // Fields private bool m_skipHidden; private bool m_skipReconciled; // Methods internal LayerTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal protected sealed override SymbolTable Copy(); public void GenerateUsageData(); public sealed override SymbolTableEnumerator GetEnumerator(); internal unsafe AcDbLayerTable* GetImpObj(); public unsafe void GetUnreconciledLayers(AcArray >* modopt(IsImplicitlyDereferenced) idArray); // Properties public bool HasUnreconciledLayers { [return: MarshalAs(UnmanagedType.U1)] get; } public LayerTable IncludingHidden { get; } public LayerTable SkippingReconciled { get; } } 属性: 属性 数据类型 材质 HasUnreconciledLayers bool 是否含有未经核实层 IncludingHidden LayerTable 包括隐藏层 SkippingReconciled LayerTable 跳过未经许可层 LayerTableRecord(层表记录) LayerTableRecord 是层表的组成元素。 类定义: public class LayerTableRecord : SymbolTableRecord { // Methods public LayerTableRecord(); protected internal LayerTableRecord(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe Color GetColorOverride(ObjectId viewportId, bool* modopt(IsImplicitlyDereferenced) isOvr); internal unsafe AcDbLayerTableRecord* GetImpObj(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 137 internal unsafe ObjectId GetLinetypeObjectIdOverride(ObjectId viewportId, bool* modopt(IsImplicitlyDereferenced) isOvr); internal unsafe LineWeight GetLineWeightOverride(ObjectId viewportId, bool* modopt(IsImplicitlyDereferenced) isOvr); internal unsafe ObjectId GetPlotStyleNameIdOverride(ObjectId viewportId, bool* modopt(IsImplicitlyDereferenced) isOvr); internal unsafe string GetPlotStyleNameOverride(ObjectId viewportId, bool* modopt(IsImplicitlyDereferenced) isOvr); public LayerViewportProperties GetViewportOverrides(ObjectId viewportId); [return: MarshalAs(UnmanagedType.U1)] public bool HasViewportOverrides(ObjectId viewportId); public void RemoveAllOverrides(); internal void RemoveColorOverride(ObjectId viewportId); internal void RemoveLinetypeOverride(ObjectId viewportId); internal void RemoveLineWeightOverride(ObjectId viewportId); internal void RemovePlotStyleOverride(ObjectId viewportId); internal void RemoveViewportOverrides(ObjectId viewportId); internal void SetColorOverride(Color color, ObjectId viewportId); internal void SetLinetypeObjectIdOverride(ObjectId ltid, ObjectId viewportId); internal void SetLineWeightOverride(LineWeight weight, ObjectId viewportId); internal void SetPlotStyleNameIdOverride(ObjectId newId, ObjectId viewportId); internal void SetPlotStyleNameOverride(string newName, ObjectId viewportId); // Properties public Color Color { get; set; } public string Description { get; set; } public EntityColor EntityColor { get; } public bool HasOverrides { [return: MarshalAs(UnmanagedType.U1)] get; } public bool IsFrozen { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsHidden { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsLocked { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsOff { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsPlottable { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsReconciled { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsUsed { [return: MarshalAs(UnmanagedType.U1)] get; } public ObjectId LinetypeObjectId { get; set; } public LineWeight LineWeight { get; set; } public ObjectId MaterialId { get; set; } public string PlotStyleName { get; set; } public ObjectId PlotStyleNameId { get; set; } public Transparency Transparency { get; set; } public bool ViewportVisibilityDefault { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } } 属性: 属性 ObjectId 材质 Color Autodesk.AutoCAD.Colors.Color 图层名 Description string 图层描述 EntityColor Autodesk.AutoCAD.Colors.EntityColor 本层实体颜色 HasOverrides bool 本层的属性在任何试图中是否有重定义 IsFrozen bool 是否被冻结(冻结后本层不可见,不能新增对 [www.BimCad.org]深居浅出 AutoCAD 二次开发 138 象,也不能被编辑) IsHidden bool 是否隐藏 IsLocked bool 是否锁定(锁定后本层可见,本层上的对象不能 被修改,但本层可以新建对象) IsOff bool 是否关闭(关闭后本层的对象时可以被编辑的) IsUsed bool 是否使用过(只读) LinetypeObjectId ObjectId 本层线形 ObjectId LineWeight Autodesk.AutoCAD.DatabaseServices.LineWeight 本层线宽 MaterialId ObjectId 材质 ObjectId PlotStyleName string Transparency Autodesk.AutoCAD.Colors.Transparency 透明度 ViewportVisibilityDefault bool 如果图层被冻结在新视口中任然保持冻结 方法: 方法 参数解释 作用 LayerViewportProperties GetViewportOverrides ( ObjectId viewportId ) viewportId 视口 ObjectId 检索所有表记录属性在指定视口中的重写 bool HasViewportOverrides ( ObjectId viewportId ) viewportId 视口 ObjectId 此层在指定的视口下属性是否有重写 void RemoveAllOverrides() 删除所有属性重写 (1.4) LinetypeTable (线型表)、LinetypeTableRecord(线型表记录) LinetypeTable (线型表)是储存线型表记录的容器,储存在其中的线型表记录可以在“线型管理器”中看到: [www.BimCad.org]深居浅出 AutoCAD 二次开发 139 类定义: public sealed class LinetypeTable : SymbolTable, IEnumerable { // Methods internal LinetypeTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } LinetypeTableRecord(线型表记录) 类定义: public class LinetypeTableRecord : SymbolTableRecord { // Methods public LinetypeTableRecord(); protected internal LinetypeTableRecord(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public double DashLengthAt(int index); internal unsafe AcDbLinetypeTableRecord* GetImpObj(); public void SetDashLengthAt(int index, double value); public void SetShapeIsUcsOrientedAt(int index, [MarshalAs(UnmanagedType.U1)] bool isOriented); public void SetShapeNumberAt(int index, int shapeNumber); public void SetShapeOffsetAt(int index, Vector2d offset); public void SetShapeRotationAt(int index, double rotation); public void SetShapeScaleAt(int index, double scale); public void SetShapeStyleAt(int index, ObjectId id); public void SetTextAt(int index, string value); [return: MarshalAs(UnmanagedType.U1)] public bool ShapeIsUcsOrientedAt(int index); public int ShapeNumberAt(int index); public Vector2d ShapeOffsetAt(int index); public double ShapeRotationAt(int index); public double ShapeScaleAt(int index); public ObjectId ShapeStyleAt(int index); public string TextAt(int index); // Properties public string AsciiDescription { get; set; } public string Comments { get; set; } public bool IsScaledToFit { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int NumDashes { get; set; } public double PatternLength { get; set; } } (1.5) RegAppTable (应用程序注册表)、RegAppTableRecord(应用程序注册表记录) RegAppTable (应用程序注册表)主要用于标识扩展数据的注册应用程序。 类定义: public sealed class RegAppTable : SymbolTable, IEnumerable { [www.BimCad.org]深居浅出 AutoCAD 二次开发 140 // Methods internal RegAppTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } RegAppTableRecord(应用程序注册表记录) 类定义: public class RegAppTableRecord : SymbolTableRecord { // Methods public RegAppTableRecord(); protected internal RegAppTableRecord(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } (1.6) TextStyleTable (文字样式表)、TextStyleTableRecord(文字样式表记录) TextStyleTable (文字样式表)是储存文字样式表记录的容器,储存在文字样式表中的文字样式记录可以在“文字样式管理器” 中查看: 类定义: public sealed class TextStyleTable : SymbolTable, IEnumerable { // Methods internal TextStyleTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } TextStyleTableRecord(文字样式表记录) 类定义: public class TextStyleTableRecord : SymbolTableRecord { // Methods public TextStyleTableRecord(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 141 protected internal TextStyleTableRecord(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbTextStyleTableRecord* GetImpObj(); // Properties public string BigFontFileName { get; set; } public string FileName { get; set; } public byte FlagBits { get; set; } public virtual FontDescriptor Font { get; set; } public bool IsShapeFile { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsVertical { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Angle)] public double ObliquingAngle { get; set; } [UnitType(UnitType.Distance)] public double PriorSize { get; set; } [UnitType(UnitType.Distance)] public double TextSize { get; set; } [UnitType(UnitType.Unitless)] public double XScale { get; set; } } (1.7) UCSTable (用户坐标系表) 、UcsTableRecord(用户坐标系表记录) UCSTable (用户坐标系表) 是存放用户坐标系表记录的容器,存放在其中的用户坐标系表记录可以在“UCS”界面中查看: 类定义: public sealed class UcsTable : SymbolTable, IEnumerable { // Methods internal UcsTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } [www.BimCad.org]深居浅出 AutoCAD 二次开发 142 UcsTableRecord(用户坐标系表记录) 类定义: public class UcsTableRecord : SymbolTableRecord { // Methods public UcsTableRecord(); protected internal UcsTableRecord(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbUCSTableRecord* GetImpObj(); public Point3d GetUcsBaseOrigin(OrthographicView view); public void SetUcsBaseOrigin(Point3d origin, OrthographicView view); // Properties public Point3d Origin { get; set; } public Vector3d XAxis { get; set; } public Vector3d YAxis { get; set; } } (1.8) ViewportTable (视口表)、ViewportTableRecord(视口表记录) AutoCAD 环境中图形屏幕上用于显示图形的一个矩形区域称为视口,可以把整个图形屏幕作为一个视口,也可以把整个 视图屏幕设置成多个视口。当前视口中显示的复杂图形按不同的窗口大小设置,并以视图名为表示以视口表记录的形式记录 在视口表中。在需要时,显示指定视图以满足对图形编辑和浏览的需要。 视图的管理包括视图的定义,显示,属性设置和查询等功能。在 AutoCAD 的交互环境中,用户可以使用 VIEW 命令对视图进 行命名,保存,恢复和删除。在 ARX 应用程序中,主要是通过使图表类及视图表记录类的成员函数实现视图的管理功能。 ViewportTable (视口表)是存放视口表记录的容器,存放在其中的视口表记录可以在“视口”管理器中看见: [www.BimCad.org]深居浅出 AutoCAD 二次开发 143 类定义: public sealed class ViewportTable : SymbolTable, IEnumerable { // Methods internal ViewportTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } ViewportTableRecord(视口表记录) 类定义: public class ViewportTableRecord : AbstractViewTableRecord { // Methods public ViewportTableRecord(); protected internal ViewportTableRecord(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbViewportTableRecord* GetImpObj(); public ObjectId GetPreviousBackground(DrawableType type); public void SetPreviousBackground(ObjectId value, DrawableType type); // Properties public short CircleSides { get; set; } public bool FastZoomsEnabled { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool GridAdaptive { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool GridBoundToLimits { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool GridEnabled { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool GridFollow { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point2d GridIncrements { get; set; } public short GridMajor { get; set; } public bool GridSubdivisionRestricted { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IconAtOrigin { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IconEnabled { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsometricSnapEnabled { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point2d LowerLeftCorner { get; set; } public int Number { get; } [UnitType(UnitType.Angle)] public double SnapAngle { get; set; } public Point2d SnapBase { get; set; } public bool SnapEnabled { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point2d SnapIncrements { get; set; } public short SnapPair { get; set; } public ToneOperatorParameters ToneOperatorParameters { get; set; } public bool UcsFollowMode { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool UcsSavedWithViewport { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point2d UpperRightCorner { get; set; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 144 (1.9) ViewTable (视图表)、ViewTableRecord(视图表记录) ViewTable (视图表)是存放视图表记录的容器,存放在其中的视图表记录可以在“视图管理器”中查看: 类定义: public sealed class ViewTable : SymbolTable { // Methods internal ViewTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); } ViewTableRecord(视图表记录) 类定义: public class ViewTableRecord : AbstractViewTableRecord { // Methods public ViewTableRecord(); protected internal ViewTableRecord(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public void DisassociateUcsFromView(); internal unsafe AcDbViewTableRecord* GetImpObj(); // Properties public AnnotationScale AnnotationScale { get; set; } public string CategoryName { get; set; } public bool IsPaperspaceView { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsUcsAssociatedToView { [return: MarshalAs(UnmanagedType.U1)] get; } public string LayerState { get; set; } public ObjectId Layout { get; set; } public ObjectId LiveSection { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 145 [XmlIgnore] public Bitmap Thumbnail { get; set; } public bool ViewAssociatedToViewport { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } } (2) DBDictionary (词典) DBDictionary (词典)是一般的容器对象,用于储存非图形对象。与符号表不同的是,符号表里面只能存取固定符号表记 录的对象,而词典可以同时保存多种由 DBObject 类派生的对象(Entity)除外(词典中也可以存放词典)。常用于保存在词典中 的对象有 DataTable(数据表)Xrecord(扩展记录)。 词典主要以两种方式存在一种是存储在数据库中用来保存整个图纸的数据叫 NameDictionaries(命名对象词典),一种是 储存在对象中用于保存对象的信息数据叫 ExtensionDictionary(对象扩展词典)。 1、NameDictionaries(命名对象词典) 每个 DWG 数据库都有一个命名对象词典,命名对象词典通常用来储存全局的扩展数据。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 146 2、ExtensionDictionary(对象扩展词典) 所有数据库对象都可以包含一个扩展词典,用于储存用户自定义的数据,与命名对象词典不同的是,储存的这些数据时 对象级别的即对象的附属信息。 类定义: public class DBDictionary : DBObject, IDictionary { // Fields private bool m_bSkipDeleted; // Methods public DBDictionary(); protected internal DBDictionary(IntPtr obj, [MarshalAs(UnmanagedType.U1)] bool autoDelete); [return: MarshalAs(UnmanagedType.U1)] public bool Contains(ObjectId objId); [return: MarshalAs(UnmanagedType.U1)] public bool Contains(string entryName); protected virtual DBDictionary Copy(); public void CopyTo(DBDictionaryEntry[] array, int index); public virtual ObjectId GetAt(string entryName); public DbDictionaryEnumerator GetEnumerator(); internal unsafe AcDbDictionary* GetImpObj(); void Icollection.CopyTo(Array array, int index); void Idictionary.Add(object key, object value); void Idictionary.Clear(); [return: MarshalAs(UnmanagedType.U1)] bool Idictionary.Contains(object key); [return: MarshalAs(UnmanagedType.U1)] protected bool Idictionary.get_IsFixedSize(); [return: MarshalAs(UnmanagedType.U1)] protected bool Idictionary.get_IsReadOnly(); [return: MarshalAs(UnmanagedType.U1)] protected bool Idictionary.get_IsSynchronized(); object Idictionary.get_Item(object key); protected Icollection Idictionary.get_Keys(); protected object Idictionary.get_SyncRoot(); protected Icollection Idictionary.get_Values(); IdictionaryEnumerator Idictionary.GetEnumerator(); void Idictionary.Remove(object key); void Idictionary.set_Item(object key, object value); Ienumerator Ienumerable.GetEnumerator(); public virtual string NameAt(ObjectId objId); public void Remove(ObjectId objId); public ObjectId Remove(string key); public ObjectId SetAt(string searchKey, DBObject newValue); public void SetName(string oldName, string newName); [www.BimCad.org]深居浅出 AutoCAD 二次开发 147 // Properties public virtual int Count { get; } public DBDictionary IncludingErased { get; } protected virtual bool IsFixedSize { [return: MarshalAs(UnmanagedType.U1)] get; } protected virtual bool IsReadOnly { [return: MarshalAs(UnmanagedType.U1)] get; } protected virtual bool IsSynchronized { [return: MarshalAs(UnmanagedType.U1)] get; } public object this[string key] { get; set; } protected Icollection Keys { get; } public override DuplicateRecordCloning MergeStyle { get; set; } protected internal bool SkipDeleted { [return: MarshalAs(UnmanagedType.U1)] get; } protected object SyncRoot { get; } protected virtual bool System.Collections.Icollection.IsSynchronized { [return: MarshalAs(UnmanagedType.U1)] get; } protected object System.Collections.Icollection.SyncRoot { get; } protected virtual bool System.Collections.Idictionary.IsFixedSize { [return: MarshalAs(UnmanagedType.U1)] get; } protected virtual bool System.Collections.Idictionary.IsReadOnly { [return: MarshalAs(UnmanagedType.U1)] get; } protected Icollection System.Collections.Idictionary.Keys { get; } protected virtual Icollection System.Collections.Idictionary.Values { get; } public bool TreatElementsAsHard { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } protected virtual Icollection Values { get; } } 属性: 属性 数据类型 材质 Count int 存在词典里面的对象数目 IncludingErased DBDictionary 返回词典中包含已删除对象的词典(只读) MergeStyle Autodesk.AutoCAD.DatabaseServices.DuplicateRecordCloning 合并样式 TreatElementsAsHard bool whether elements are treated hard or not 方法: 方法 参数解释 作用 bool Contains ( ObjectId objId ) id 索引 是否包含 ObjectId 为 objId 的对象 bool Contains ( string entryName ) entryName 对象名 是否包含名字为 entryName 的对象 void Remove ( ObjectId objId ) objId 对象 ObjectId 删除 ObjectId 为 objId 的对象 ObjectId Remove ( key 对象关键字 删除名字为 entryName 的对象 [www.BimCad.org]深居浅出 AutoCAD 二次开发 148 string key ) DBDictionary Copy() 复制词典 void CopyTo ( DBDictionaryEntry[] array, int index ) 1、array 对象数组 2、index 拷贝的起始索引 拷贝从索引为 index 开始的对象到对象 数组 ObjectId GetAt ( string entryName ) entryName 对象名 获得词典中名字为 entryName 的对象的 ObjectId string NameAt ( ObjectId objId ) objId 对象 ObjectId 获得词典中 ObjectId 为 objId 的对象名 ObjectId SetAt ( string searchKey, DBObject newValue ) 1、searchKey 对象关键字 2、newValue 要添加的对象 将对象添加到词典 void SetName ( string oldName, string newName ) 1、oldName 旧名字 2、newName 新名字 修改词典中对象的关键字 DbDictionaryEnumerator GetEnumerator() 获得当前指向的对象 (3) DataTable(数据表) DataTable(数据表)是 AutoCAD 中用来组织数据的表格,是一个用来存放数据的数据库对象,可以放在命名对象词典中 存放图纸全局信息数据,也可以放在对象扩展词典中存放对象的属性数据,他比 XRecord 的优势在于:用表格形式组织数据 更加有条理。 类定义: public class DataTable : DBObject { // Methods public DataTable(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 149 protected internal DataTable(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void AppendColumn(CellType type, string columnName); public virtual void AppendRow(DataCellCollection row, [MarshalAs(UnmanagedType.U1)] bool validate); public void Assign(DataTable other); public virtual DataCell GetCellAt(int row, int col); public virtual DataColumn GetColumnAt(int index); public virtual int GetColumnIndexAtName(string name); public virtual string GetColumnNameAt(int index); public virtual CellType GetColumnTypeAt(int index); internal unsafe AcDbDataTable* GetImpObj(); public virtual DataCellCollection GetRowAt(int index); public virtual void InsertColumnAt(int index, CellType type, string columnName); public virtual void InsertRowAt(int index, DataCellCollection row, [MarshalAs(UnmanagedType.U1)] bool validate); public virtual void RemoveColumnAt(int index); public virtual void RemoveRowAt(int index); public virtual void SetCellAt(int row, int col, DataCell cell); public virtual void SetRowAt(int index, DataCellCollection row, [MarshalAs(UnmanagedType.U1)] bool validate); // Properties public virtual int NumColsGrowSize { get; set; } public virtual int NumColsPhysicalSize { get; set; } public virtual int NumColumns { get; } public virtual int NumRows { get; } public virtual int NumRowsGrowSize { get; set; } public virtual int NumRowsPhysicalSize { get; set; } public virtual string TableName { get; set; } } 属性: 属性 数据类型 材质 TableName string 表名 NumRows int 行数 NumColumns int 列数 NumRowsGrowSize int 行宽度 NumColsGrowSize int 列宽度 NumRowsPhysicalSize int 行物理容量宽度 NumColsPhysicalSize int 列物理容量宽度 方法: 方法 参数解释 作用 void AppendColumn ( Autodesk.AutoCAD.DatabaseServices.CellType type, string columnName ) 1、 type 单元格数据类型 2、 columnName 列名 在表格中添加一列 [www.BimCad.org]深居浅出 AutoCAD 二次开发 150 void AppendRow ( DataCellCollection row, bool validate ) 1、 row 行单元格集合 2、 validate 是否验证没列的数据类型 在表格中添加列 void Assign ( DataTable other ) Other 要复制的表格 复制另一表格对象 DataCell GetCellAt ( int row, int col ) 1、 row 要获得的单元格行索引 2、 col 要获得的单元格列索引 获得单元格 DataColumn GetColumnAt ( int index ) index 要获得的列索引 获得指定列 DataCellCollection GetRowAt ( int index ) Index 要获得的行索引 获得指定行 int GetColumnIndexAtName ( string name ) name 列名 通过列名获得列索引 Autodesk.AutoCAD.DatabaseServices.CellType GetColumnTypeAt ( int index ) index 列索引 获得指定列数据类型 void InsertColumnAt ( int index, Autodesk.AutoCAD.DatabaseServices.CellType type, string columnName ) 1、index 要插入在此之前的列索引 2、type 插入列的数据类型 3、columnName 插入列的列名 插入列 void InsertRowAt ( int index, DataCellCollection row, bool validate 1、index 要在此行之前插入行的行索引 2、row 要插入的行 3、validate 是否检查每列数据类型是否匹配 插入行 [www.BimCad.org]深居浅出 AutoCAD 二次开发 151 ) void RemoveColumnAt ( int index ) index 要删除的列索引 删除指定列 void RemoveRowAt ( int index ) index 要删除的行索引 删除指定行 void SetCellAt ( int row, int col, DataCell cell ) 1、row 要设置的单元格的行索引 2、col 要设置的单元格的列索引 3、cell 设置的单元格 设置指定单元格 void SetRowAt ( int index, DataCellCollection row, bool validate ) 1、index 要设置行的行索引 2、validate 是否检查每列是否符合列数据类型 设置行 (4) Xrecord(扩展记录) Xrecord(扩展记录)最大可储存 2GB 的数据。 类定义: public class Xrecord : DBObject { // Methods public Xrecord(); internal Xrecord(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbXrecord* GetImpObj(); // Properties public ResultBuffer Data { get; set; } public override DuplicateRecordCloning MergeStyle { get; set; } public bool XlateReferences { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } } 属性: 属性 数据类型 材质 Data ResultBuffer 数据 MergeStyle Autodesk.AutoCAD.DatabaseServices.DuplicateRecordCloning 合并样式 [www.BimCad.org]深居浅出 AutoCAD 二次开发 152 XlateReferences bool whether references are to be translated (5) Field (字段) 字段是储存表达式的容器,可以储存字符、指向系统变量的表达式、公式表达式等。这些表达式用于显示可能会在图形 生命周期中修改的数据。 字段更新时,将显示最新的数据。字段可以插入到任意种类的文字(公差除外)中,其中包括表单 元、属性和属性定义中的文字。在块编辑器中进行操作时,可以将块占位符字段用于块属性定义中。 没有值的字段将显示连字符 (----),无效字段将显示井号 (####)。 类定义: public class Field : DBObject { // Methods public Field(); public Field(string fieldCode); protected internal Field(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Field(string fieldCode, [MarshalAs(UnmanagedType.U1)] bool textField); public void ConvertToTextField(); public void Evaluate(); public void Evaluate(int evaluationOptions, Database database); public Field[] GetChildren(); public object GetData(string key); public string GetFieldCode(); public string GetFieldCode(FieldCodeFlags flags); public FieldCodeWithChildren GetFieldCodeWithChildren(); public FieldCodeWithChildren GetFieldCodeWithChildren(FieldCodeFlags flags); internal unsafe AcDbField* GetImpObj(); public string GetStringValue(); internal unsafe Field[] MarshalChildren(AcArray > modopt(IsConst)* modopt(IsImplicitlyDereferenced) fields); public void SetData(string key, object data); public void SetData(string key, object data, [MarshalAs(UnmanagedType.U1)] bool recursive); public void SetFieldCode(string fieldCode); public void SetFieldCodeWithChildren(FieldCodeWithChildren fieldCode); public void SetFieldCodeWithChildren(FieldCodeFlags flag, FieldCodeWithChildren fieldCode); internal void SetFieldCodeWithChildren(string fieldCode, FieldCodeFlags flag, Field[] children); // Properties public DataType DataType { get; } public FieldEvaluationOptions EvaluationOption { get; set; } public FieldEvaluationStatusResult EvaluationStatus { get; } public string EvaluatorId { get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 153 public FieldFilingOptions FilingOption { get; set; } public string Format { get; set; } public HyperLink HyperLink { get; set; } public bool IsTextField { [return: MarshalAs(UnmanagedType.U1)] get; } public FieldState State { get; } public object Value { get; } } 属性: 属性 数据类型 意义 DataType DataType 数据类型 IsTextField bool 是否是文本表达式域 Value object 显示字符 Format string 格式 EvaluationOption FieldEvaluationOptions EvaluationStatus FieldEvaluationStatusResult EvaluatorId string FilingOption FieldFilingOptions HyperLink Autodesk.AutoCAD.DatabaseServices.HyperLink 超级连接 方法: 方法 参数 作用 Void ConvertToTextField() 把字段转换为字符型字段 Field[] GetChildren() 获得子字段 object GetData ( string key ) Key 关键字 获得关键字对应的数据 void SetData ( string key, object data ) 1、key 关键字 2、data 数据对象 设置数据 void SetFieldCode ( string fieldCode ) fieldCode 字段表达式 设置字段表达式 string GetFieldCode() 获得字段表达式 string GetFieldCode ( FieldCodeFlags flags ) Flags 字段表达式标志 FieldCodeWithChildren GetFieldCodeWithChildren() used to get a field code in various forms string GetStringValue() 字段显示值 void 设置子字段 [www.BimCad.org]深居浅出 AutoCAD 二次开发 154 SetFieldCodeWithChildren ( FieldCodeFlags flag, FieldCodeWithChildren fieldCode ) 构造函数: 构造函数 参数解释 Field() Field ( string fieldCode ) fieldCode 字段表达式 Field ( string fieldCode, bool textField ) 1、fieldCode 字段表达式 2、textField 是否是纯文本字段 *字段相应的表达式、公式可以在“字段”对话框中的“表达式”栏中查看。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 155 (6) Entity(实体对象) Entity(实体对象)是所有可见对象的基类,可见对象都继承它的属性和方法。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 156 类定义: public abstract class Entity : DBObject [www.BimCad.org]深居浅出 AutoCAD 二次开发 157 { // Methods protected internal Entity(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public void AddSubentityPaths(FullSubentityPath[] subPaths); public void BoundingBoxIntersectWith(Entity entityPointer, Intersect intersectType, Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker); public void BoundingBoxIntersectWith(Entity entityPointer, Intersect intersectType, Plane projectionPlane, Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker); public void DeleteSubentityPaths(FullSubentityPath[] subPaths); public void Draw(); public void Explode(DBObjectCollection entitySet); public IntPtrCollection GetGraphicsMarkersAtSubentityPathIntPtr(FullSubentityPath subPath); public void GetGripPoints(Point3dCollection gripPoints, IntegerCollection snapModes, IntegerCollection geometryIds); [return: MarshalAs(UnmanagedType.U1)] public bool GetGripPoints(GripDataCollection grips, double curViewUnitSize, int gripSize, Vector3d curViewDir, GetGripPointsFlags bitFlags); [return: MarshalAs(UnmanagedType.U1)] public bool GetGripPointsAtSubentityPath(FullSubentityPath subPath, GripDataCollection grips, double curViewUnitSize, int gripSize, Vector3d curViewDir, GetGripPointsFlags bitFlags); internal unsafe AcDbEntity* GetImpObj(); public void GetObjectSnapPoints(ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds); public void GetObjectSnapPoints(ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds, Matrix3d insertionMat); public virtual Plane GetPlane(); public void GetStretchPoints(Point3dCollection stretchPoints); public Entity GetSubentity(FullSubentityPath id); public Extents3d GetSubentityGeometricExtents(FullSubentityPath subPath); public FullSubentityPath[] GetSubentityPathsAtGraphicsMarker(SubentityType type, int gsMark, Point3d pickPoint, Matrix3d viewTransform, int numInserts, ObjectId[] entityAndInsertStack); public Entity GetTransformedCopy(Matrix3d transform); public void Highlight(); public void Highlight(FullSubentityPath subId, [MarshalAs(UnmanagedType.U1)] bool highlightAll); public void IntersectWith(Entity entityPointer, Intersect intersectType, Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker); public void IntersectWith(Entity entityPointer, Intersect intersectType, Plane projectionPlane, Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker); [return: MarshalAs(UnmanagedType.U1)] public bool IsContentSnappable(); public void List(); public void MoveGripPointsAt(IntegerCollection indices, Vector3d offset); public void MoveGripPointsAt(IntPtr[] appData, Vector3d offset, MoveGripPointsFlags bitFlags); public void MoveGripPointsAtSubentityPaths(FullSubentityPath[] subPaths, IntPtr[] appData, Vector3d offset, MoveGripPointsFlags bitFlags); public void MoveStretchPointsAt(IntegerCollection indices, Vector3d offset); public void RecordGraphicsModified([MarshalAs(UnmanagedType.U1)] bool setModified); public virtual void SaveAs(WorldDraw mode, SaveType st); public void SetDatabaseDefaults(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 158 public void SetDatabaseDefaults(Database sourceDatabase); public virtual void SetDragStatus(DragStatus status); public virtual void SetGripStatus(GripStatus status); public virtual void SetLayerId(ObjectId newValue, [MarshalAs(UnmanagedType.U1)] bool allowHidden); public void SetPropertiesFrom(Entity entityPointer); public void SetSubentityGripStatus(GripStatus status, FullSubentityPath subentity); public void TransformBy(Matrix3d transform); public void TransformSubentityPathsBy(FullSubentityPath[] subPaths, Matrix3d transform); public void Unhighlight(); public void Unhighlight(FullSubentityPath subId, [MarshalAs(UnmanagedType.U1)] bool highlightAll); // Properties [Category("Misc")] public ObjectId BlockId { get; } [Category("Misc")] public string BlockName { get; } [Category("3D Visualization")] public bool CastShadows { [return: MarshalAs(UnmanagedType.U1)] get; virtual [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool CloneMeForDragging { [return: MarshalAs(UnmanagedType.U1)] get; } [Category("Geometry")] public virtual CollisionType CollisionType { get; } [Category("General")] public Color Color { get; virtual set; } [Category("General")] public int ColorIndex { get; virtual set; } [Category("Geometry")] public virtual Matrix3d CompoundObjectTransform { get; } public virtual Matrix3d Ecs { get; } [Category("3D Visualization")] public ObjectId EdgeStyleId { get; set; } [Category("General")] public EntityColor EntityColor { get; } [Category("3D Visualization")] public ObjectId FaceStyleId { get; set; } public bool ForceAnnoAllVisible { [return: MarshalAs(UnmanagedType.U1)] get; virtual [param: MarshalAs(UnmanagedType.U1)] set; } [Category("Geometry")] public virtual Extents3d GeometricExtents { get; } [Category("General")] public HyperLinkCollection Hyperlinks { get; } [Category("Geometry")] public virtual bool IsPlanar { [return: MarshalAs(UnmanagedType.U1)] get; } [Category("General")] public string Layer { get; virtual set; } [Category("General")] public ObjectId LayerId { get; virtual set; } [Category("General")] [www.BimCad.org]深居浅出 AutoCAD 二次开发 159 public string Linetype { get; virtual set; } [Category("General")] public ObjectId LinetypeId { get; virtual set; } [Category("General"), UnitType(UnitType.Unitless)] public double LinetypeScale { get; virtual set; } [Category("General")] public LineWeight LineWeight { get; virtual set; } [Category("3D Visualization")] public string Material { get; set; } [Category("3D Visualization")] public ObjectId MaterialId { get; set; } [Category("3D Visualization")] public Mapper MaterialMapper { get; set; } [Category("General")] public string PlotStyleName { get; virtual set; } [Category("General")] public PlotStyleDescriptor PlotStyleNameId { get; virtual set; } [Category("3D Visualization")] public bool ReceiveShadows { [return: MarshalAs(UnmanagedType.U1)] get; virtual [param: MarshalAs(UnmanagedType.U1)] set; } [Category("General")] public Transparency Transparency { get; virtual set; } [Category("General")] public bool Visible { [return: MarshalAs(UnmanagedType.U1)] get; virtual [param: MarshalAs(UnmanagedType.U1)] set; } [Category("3D Visualization")] public ObjectId VisualStyleId { get; set; } } 属性: 属性 数据类型 意义 BlockId ObjectId 对象所属块 ID BlockName string 对象所属块名 Color Autodesk.AutoCAD.Colors.Color 对象颜色 ColorIndex int 对象颜色值 Ecs Matrix3d 用于从对象坐标系(OCS)到世界坐标系(WCS)转换此对 象向量或点的矩阵 IsPlanar bool 对象是否平面图形 Layer string 对象的图层名 LayerId ObjectId 对象图层的 ObjectId Linetype string 对象线型名 LinetypeId ObjectId 对象线型 ObjectId LineWeight Autodesk.AutoCAD.DatabaseServices.LineWeight 对象线宽 Transparency Autodesk.AutoCAD.Colors.Transparency 对象的透明度 Visible bool 对象是否可视 GeometricExtents Extents3d 获得对象边界(由边界可以获得对象的左下和右上点) 方法: [www.BimCad.org]深居浅出 AutoCAD 二次开发 160 方法 参数解释 作用 Void BoundingBoxIntersectWith ( Entity entityPointer, Autodesk.AutoCAD.DatabaseServices.Inters ect intersectType, Plane projectionPlane, Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker ) 1、entityPointer 与此对象相 交的对象 2、intersectType 相交方式 3、projectionPlane 相交投影 平面 4、points 交点集合 5、thisGraphicSystemMarker 对象的 GS 标志 6、otherGraphicSystemMarker GS 标记所指向的对象指针 得到两个对象边界的交点 Point3dCollection(参数 points) 常见对象的边界: void BoundingBoxIntersectWith ( Entity entityPointer, Autodesk.AutoCAD.DatabaseServices.Inters ect intersectType, Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker ) 1、entityPointer 与此对象相 交的对象 2、intersectType 相交方式 3、points 交点集合 4、thisGraphicSystemMarker 对象的图形系统标记 5、otherGraphicSystemMarker GS 标记所指向的对象指针 Void Draw() 无 刷新重绘图形 void Explode ( DBObjectCollection entitySet ) entitySet 炸开实体得到的实 体集 炸开一个实体,对于复杂实体可以得到一个炸开 后的实体集合 DBObjectCollection(参数 entitySet) (函数实际上实现的就 EXPLODE 命令的功能,把块 或组合对象分解成基本的直线、多段线、圆、圆 弧、椭圆、文字等基本曲线或文字) bool GetGripPoints ( GripDataCollection grips, double curViewUnitSize, int gripSize, Vector3d curViewDir, GetGripPointsFlags bitFlags ) 1、grips 2、curViewUnitSize 3、gripSize 4、curViewDir 5、bitFlags 得到对象夹点(参数 grips) 常见对象的夹点: void GetGripPoints ( Point3dCollection gripPoints, IntegerCollection snapModes, IntegerCollection geometryIds ) 1、gripPoints 2、snapModes 3、geometryIds [www.BimCad.org]深居浅出 AutoCAD 二次开发 161 void GetObjectSnapPoints ( ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds ) 1、snapMode 捕捉模式 2、gsSelectionMark 3、pickPoint 4、lastPoint 5、viewTransform 6、snapPoints 7、geometryIds 得到对象扑捉点(参数 snapPoints) void GetObjectSnapPoints ( ObjectSnapModes snapMode, int gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds, Matrix3d insertionMat ) 1、snapMode 捕捉模式 2、gsSelectionMark 3、pickPoint 4、lastPoint 5、viewTransform 6、snapPoints 7、geometryIds 8、insertionMat Plane GetPlane() 无 返回包含此对象的平面 void GetStretchPoints ( Point3dCollection stretchPoints ) stretchPoints 延伸点 得到对象的延伸点, Point3dCollectio(参数 stretchPoints) Entity GetTransformedCopy ( Matrix3d transform ) transform 转换矩阵 得到按照 transform 矩阵变换的复制对象 Void Highlight() 无 高亮对象 Void IntersectWith ( Entity entityPointer, Autodesk.AutoCAD.DatabaseServices.Inters ect intersectType, Plane projectionPlane, Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker ) 1、entityPointer 相交对象 2、intersectType 相交形式 3、projectionPlane 相交投影 平面 4、points 交点集合 5、thisGraphicSystemMarker 图形系统标记(默认 0) 6、otherGraphicSystemMarker 其他图形系统标记(默认 0) 获得对象交点(由 points 参数返回) 常见对象的交点形式: Void IntersectWith ( Entity entityPointer, Autodesk.AutoCAD.DatabaseServices.Inters ect intersectType, 1、entityPointer 相交对象 2、intersectType 相交形式 3、points 交点集合 4、thisGraphicSystemMarker 图形系统标记(默认 0) 5、otherGraphicSystemMarker [www.BimCad.org]深居浅出 AutoCAD 二次开发 162 Point3dCollection points, int thisGraphicSystemMarker, int otherGraphicSystemMarker ) 其他图形系统标记(默认 0) Void List() 无 在命令栏显示出对象的详细信息 void MoveGripPointsAt ( IntegerCollection indices, Vector3d offset ) 1、indices 夹点序号集合 2、offset 偏移向量 移动夹点,定义了夹点移动实体的行为 void MoveStretchPointsAt ( IntegerCollection indices, Vector3d offset ) 1、indices 延伸点序号集合 2、offset 偏移向量 移动拉伸点,定义了拉升点移动实体的行为 void RecordGraphicsModified ( bool setModified ) setModified 是否更新 参数修改是否更新到图形 void SetDatabaseDefaults() 按照数据库标准设置对象属性(Color、Layer、 Linetype、Linetype、scale、Visibility、 Plot style name、Line weight) void SetDragStatus ( DragStatus status ) Status 拖拽状态 设置拖拽状态 void SetGripStatus ( GripStatus status ) Status 夹点状态 设置夹点状态 void SetLayerId ( ObjectId newValue, bool allowHidden ) 1、newValue 要设置图层的 ObjectId 2、allowHidden 是否允许设置 隐藏的图层 设置对象的图层 Void SetPropertiesFrom ( Entity entityPointer ) entityPointer 要拷贝属性的 对象 相当于格式刷操作,拷贝一个对象的属性(Color、 Layer、Linetype、Linetype scale、Visibility ) Void SetSubentityGripStatus ( GripStatus status, 1、status 夹点状态 2、subentity 要设置夹点状态 的对象 设置对象的夹点状态 [www.BimCad.org]深居浅出 AutoCAD 二次开发 163 FullSubentityPath subentity ) void TransformBy ( Matrix3d transform ) Transform 变换矩阵 根据变换矩阵 Transform 将对象变形 void TransformSubentityPathsBy ( FullSubentityPath[] subPaths, Matrix3d transform ) 1、subPaths 要进行变换的对 象集合 2、transform 变换矩阵 将对象集合subPaths 按照 transform进行几何变换 Void Unhighlight() 无 取消对象高亮 FullSubentityPath[] GetSubentityPathsAtGraphicsMarker ( SubentityType type, int gsMark, Point3d pickPoint, Matrix3d viewTransform, int numInserts, ObjectId[] entityAndInsertStack ) 1、type 子实体类型 2、gsMark GS 标记 3、pickPoint 选择点 4、viewTransform 变形矩阵 5、numInserts 6、entityAndInsertStack 通过 GS 标记获得子实体路径。 GS 标记、子实体、子实体路径 复杂的图形(Region、Body、Solid、Mline)的显 示是由简单的图元在图形系统 Graphics System(GS)中显示的,每一个在图形系统中用来表 现复杂实体的基本图元都是这个实体的子实体。 GS 标记是用来记录这些用于标记这些子对象 的编号。 子实体路径(FullSubentPath)用来唯一标示一 个复杂实体的子实体,以便更准确的描述复杂实 体的属性。 IntPtrCollection GetGraphicsMarkersAtSubentityPathIntPtr ( FullSubentityPath subPath ) subPath 子实体路径 通过子实体路径获得 GS 标记 [www.BimCad.org]深居浅出 AutoCAD 二次开发 164 (6.1) DBPoint (点) 点是构成几何元素最常用的基本对象。 类定义: public class DBPoint : Entity { // Methods public DBPoint(); public DBPoint(Point3d position); protected internal DBPoint(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbPoint* GetImpObj(); // Properties [Category("Geometry"), UnitType(UnitType.Angle)] public double EcsRotation { get; set; } [Category("Geometry")] public Vector3d Normal { get; set; } [Category("Geometry")] public Point3d Position { get; set; } [Category("General"), UnitType(UnitType.Distance)] public double Thickness { get; set; } } 属性: 属性 数据类型 意义 Normal Vector3d 法相向量 Position Point3d 位置 EcsRotation double Thickness double 厚度 构造函数: 重载类函数 参数描述 DBPoint() 无参数 public DBPoint ( Point3d position ) Point3d position 几何点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 165 (6.2)Curve(曲线) Curve(曲线)是 AutoCAD 所有线条(直线、多段线、圆弧、圆、椭圆)的基类。 类定义: public abstract class Curve : Entity { // Methods protected internal Curve(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void Extend(double newParameter); public virtual void Extend([MarshalAs(UnmanagedType.U1)] bool extendStart, Point3d toPoint); public virtual Point3d GetClosestPointTo(Point3d givenPoint, [MarshalAs(UnmanagedType.U1)] bool extend); public virtual Point3d GetClosestPointTo(Point3d givenPoint, Vector3d direction, [MarshalAs(UnmanagedType.U1)] bool extend); public virtual double GetDistanceAtParameter(double value); public virtual double GetDistAtPoint(Point3d point); public virtual Vector3d GetFirstDerivative(Point3d point); public virtual Vector3d GetFirstDerivative(double value); internal unsafe AcDbCurve* GetImpObj(); public virtual DBObjectCollection GetOffsetCurves(double offsetDist); public virtual DBObjectCollection GetOffsetCurvesGivenPlaneNormal(Vector3d normal, double offsetDist); public virtual Curve GetOrthoProjectedCurve(Plane planeToProjectOn); public virtual double GetParameterAtDistance(double dist); public virtual double GetParameterAtPoint(Point3d point); public virtual Point3d GetPointAtDist(double value); public virtual Point3d GetPointAtParameter(double value); public virtual Curve GetProjectedCurve(Plane planeToProjectOn, Vector3d projectionDirection); public virtual Vector3d GetSecondDerivative(Point3d point); public virtual Vector3d GetSecondDerivative(double value); public virtual DBObjectCollection GetSplitCurves(DoubleCollection value); public virtual DBObjectCollection GetSplitCurves(Point3dCollection points); public virtual void ReverseCurve(); // Properties [UnitType(UnitType.Area), Category("Geometry")] public virtual double Area { get; } [Category("Geometry")] public bool Closed { [return: MarshalAs(UnmanagedType.U1)] get; } [Category("Geometry"), UnitType(UnitType.AngleNotTransformed)] public virtual double EndParam { get; } [Category("Geometry")] public virtual Point3d EndPoint { get; set; } [Category("Geometry")] public virtual bool IsPeriodic { [return: MarshalAs(UnmanagedType.U1)] get; } [Category("Geometry")] public virtual Spline Spline { get; } [Category("Geometry"), UnitType(UnitType.AngleNotTransformed)] public virtual double StartParam { get; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 166 [Category("Geometry")] public virtual Point3d StartPoint { get; set; } } 属性: 属性 数据类型 意义 Area double 曲线范围的面积 Closed bool 曲线是否闭合 EndParam double 沿曲线方向上终点的值(曲线上终点至始点的距离,也就是曲线的长度) EndPoint Point3d 终点 IsPeriodic bool 曲线是否是固定的 Spline Spline 返回曲线的逼近样条曲线 StartParam double 沿曲线方向上始点的值(一般为 0) StartPoint Point3d 始点 方法: 方法 参数 作用 void Extend ( bool extendStart, Point3d toPoint ) 1、extendStart 若为 true 则延伸 始点若为 false 则延伸终点(bool 型) 2、toPoint 延伸至点(Point3d) 延伸曲线 void Extend ( double newParameter ) newParameter 新的始点或终点 段比(按照比例延伸) Point3d GetClosestPointTo ( Point3d givenPoint, bool extend ) 1、givenPoint 判断点 2、extend 是否延伸本曲线 true 延伸 false 不延伸 返回曲线上离指定点距离最近的点 (通过 extend 参数我们可以获得曲线上的点或者曲线 的延伸点) Point3d GetClosestPointTo ( Point3d givenPoint, Vector3d direction, bool extend ) 1、givenPoint 判断点 2、direction 投影面的法向向量 3、extend 是否延伸本曲线 true 延伸 false 不延伸 double GetDistanceAtParameter ( double value ) value 曲线段比 曲线段比为 value 的点到始点的曲线距离 [www.BimCad.org]深居浅出 AutoCAD 二次开发 167 double GetDistAtPoint ( Point3d point ) point 曲线上一点 曲线上给定一点到始点的曲线距离 Vector3d GetFirstDerivative ( double value ) value 曲线段比 曲线段比为 value 的点上的一阶导数 Vector3d GetFirstDerivative ( Point3d point ) point 曲线上一点 曲线上给定一点的一阶导数(斜率) 用这个函数我们可以得到任意曲线在任意点的切线 与垂线: DBObjectCollection GetOffsetCurves ( double offsetDist ) offsetDist 偏移距离 曲线按照 offsetDist 偏移得到的对象集合 DBObjectCollection GetOffsetCurvesGivenPlaneNormal ( Vector3d normal, double offsetDist ) 1、normal 指定平面的法向向量 2、offsetDist 偏移距离 曲线在指定平面上曲线按照 offsetDist 偏移得到的对 象集合 Curve GetOrthoProjectedCurve ( Plane planeToProjectOn ) planeToProjectOn 投影平面 曲线在指定平面上的投影 double GetParameterAtDistance ( double dist ) dist 距离始点的曲线距离 曲线上距始点距离为 dist 的点的段比 double GetParameterAtPoint ( Point3d point ) point 曲线上一点(取值范围:曲 线上的点) 曲线上一点的段比 Point3d GetPointAtDist ( value 曲线段比 曲线段比 value 的点到起点的距离 [www.BimCad.org]深居浅出 AutoCAD 二次开发 168 double value ) Point3d GetPointAtParameter ( double value ) value 曲线段比 (StartParam –EndParam 之间) 曲线段比为 value 的点 Curve GetProjectedCurve ( Plane planeToProjectOn, Vector3d projectionDirection ) 1、planeToProjectOn 投影平面 2、投影曲线方向 Vector3d GetSecondDerivative ( double value ) value 曲线段比 曲线上段比为 value 的点上的二阶导数 Vector3d GetSecondDerivative ( Point3d point ) point 曲线上一点 曲线上给定一点的一阶导数 DBObjectCollection GetSplitCurves ( DoubleCollection value ) value 曲线上的参数集合 获得曲线的分裂曲线 DBObjectCollection GetSplitCurves ( Point3dCollection points ) points 曲线上的散列点集合 根据曲线上的点获得曲线的分裂曲线 Void ReverseCurve() 无 曲线变为原函数的反函数曲线 *曲线上 Point、Distance 和 Parameter Point:曲线上的点 Distance:曲线上一点到起点的曲线长度 Parameter:曲线的段比(段比是 AutoCAD 中描述点在曲线某段直线上的位置的量,实现由曲线向直线的过度) EndParam StartParam 直线 直线长度 0 多段线 曲线段数 N=节点数 P-1 0 圆弧 弧长 0 圆 周长 0 [www.BimCad.org]深居浅出 AutoCAD 二次开发 169 [www.BimCad.org]深居浅出 AutoCAD 二次开发 170 (6.2.1)Line(直线) 类定义: public class Line : Curve { // Methods public Line(); public Line(Point3d pointer1, Point3d pointer2); protected internal Line(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbLine* GetImpObj(); // Properties [UnitType(UnitType.Angle)] public double Angle { [Category("Geometry")] get; } public Vector3d Delta { [Category("Geometry")] get; } public override Point3d EndPoint { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public double Length { [Category("Geometry")] get; } public Vector3d Normal { [Category("Geometry")] get; set; } public override Point3d StartPoint { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public double Thickness { [Category("General")] get; set; } } 属性: 属性 数据类型 作用 Angle double 描述直线与 X 轴方向的夹角,取值范围在 0~2PI 之间 Delta Vector3d 始点到终点的三维向量 Endpoint Point3d 终点 StartPoint Point3d 始点 Length double 长度 Normal Vector3d WCS 坐标系中直线法向单位向量 Thickness double 直线线宽值 [www.BimCad.org]深居浅出 AutoCAD 二次开发 171 构造函数: 重载类函数 参数描述 Line() 无参数 Line ( Point3d pointer1, Point3d pointer2 ) 1、pointer1 起点 2、pointer2 终点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 172 (6.2.2) Polyline3d (三维多段线) 类定义: public class Polyline3d : Curve, IEnumerable { // Methods public Polyline3d(); protected internal Polyline3d(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Polyline3d(Poly3dType type, Point3dCollection vertices, [MarshalAs(UnmanagedType.U1)] bool closed); public ObjectId AppendVertex(PolylineVertex3d vertexToAppend); public void ConvertToPolyType(Poly3dType newVal); public virtual IEnumerator GetEnumerator(); internal unsafe AcDb3dPolyline* GetImpObj(); public ObjectId InsertVertexAt(ObjectId indexVertexId, PolylineVertex3d newVertex); public void InsertVertexAt(PolylineVertex3d indexVertex, PolylineVertex3d newVertex); public void SplineFit(); public void SplineFit(Poly3dType value, int segments); public void Straighten(); // Properties public bool Closed { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Distance)] public double Length { [Category("Geometry")] get; } public Poly3dType PolyType { [Category("Misc")] get; set; } } 属性: 属性 数据类型 意义 Closed bool 多段线是否闭合 Length double 多段线长度 PolyType Autodesk.AutoCAD.DatabaseServices.Poly3dType 多段线类型 方法: 方法 参数 作用 [www.BimCad.org]深居浅出 AutoCAD 二次开发 173 ObjectId AppendVertex ( PolylineVertex3d vertexToAppend ) vertexToAppend 折线向量 添加多段线折线向量 Void ConvertToPolyType ( Autodesk.AutoCAD.DatabaseServices.Poly3dType newVal ) newVal 多段线类型 转换多段线类型 ObjectId InsertVertexAt ( ObjectId indexVertexId, PolylineVertex3d newVertex ) 1、indexVertexId 插入点的向量 ID 2、newVertex 要插入的顶点向量 指定位置插入顶点向量 void InsertVertexAt ( PolylineVertex3d indexVertex, PolylineVertex3d newVertex ) 1、indexVertex 插入到其后的向量 2、newVertex 要插入的顶点向量 指定位置插入顶点向量 void SplineFit() 将多段线转换成样条曲线(所有 的顶点将会被删除) 构造函数: 构造函数 参数描述 Polyline () Polyline ( int vertices ) vertices 顶点数 [www.BimCad.org]深居浅出 AutoCAD 二次开发 174 (6.2.3)Arc(圆弧) 类定义: public class Arc : Curve { // Methods public Arc(); protected internal Arc(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Arc(Point3d center, double radius, double startAngle, double endAngle); public Arc(Point3d center, Vector3d normal, double radius, double startAngle, double endAngle); internal unsafe AcDbArc* GetImpObj(); // Properties public Point3d Center { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double EndAngle { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public double Length { [Category("Geometry")] get; } public Vector3d Normal { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public double Radius { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double StartAngle { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public double Thickness { [Category("General")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double TotalAngle { [Category("Geometry")] get; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 175 属性: 属性 数据类型 意义 Center Point3d 圆心 EndAngle double 终点角度 Length double 弧长 Normal Vector3d 法向单位向量 Radius double 半径 StartAngle double 起始点角度 Thickness double 线宽 TotalAngle Double 总角度 构造函数: 构造函数 参数描述 Arc() Arc ( Point3d center, double radius, double startAngle, double endAngle ) 1、center 圆心 2、radius 半径 3、startAngle 起始角度 4、endAngle 终止角度 Arc ( Point3d center, Vector3d normal, double radius, double startAngle, double endAngle ) 1、center 圆心 2、normal 法向向量 3、radius 半径 4、startAngle 起始角度 5、endAngle 终止角度 [www.BimCad.org]深居浅出 AutoCAD 二次开发 176 (6.2.4)Circle(圆) 类定义: public class Circle : Curve { // Methods public Circle(); protected internal Circle(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Circle(Point3d center, Vector3d normal, double radius); internal unsafe AcDbCircle* GetImpObj(); // Properties [Category("Geometry")] public Point3d Center { get; set; } [UnitType(UnitType.Distance), Category("Geometry")] public double Circumference { get; set; } [UnitType(UnitType.Distance), Category("Geometry")] public double Diameter { get; set; } [Category("Geometry")] public Vector3d Normal { get; set; } [Category("Geometry"), UnitType(UnitType.Distance)] public double Radius { get; set; } [UnitType(UnitType.Distance), Category("General")] public double Thickness { get; set; } } 属性: 属性 数据类型 意义 Center Point3d 圆心 Diameter double 直径 [www.BimCad.org]深居浅出 AutoCAD 二次开发 177 Circumference double 周长 Normal Vector3d 法向单位向量 Radius double 半径 Thickness double 线宽 构造函数: 构造函数 参数描述 Circle() Circle ( Point3d center, Vector3d normal, double radius ) 1、center 圆心 2、normal 法向向量 3、radius 半径 [www.BimCad.org]深居浅出 AutoCAD 二次开发 178 (6.2.5) Ellipse (椭圆) 类定义: public class Ellipse : Curve { // Methods public Ellipse(); protected internal Ellipse(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Ellipse(Point3d center, Vector3d unitNormal, Vector3d majorAxis, double radiusRatio, double startAngle, double endAngle); public double GetAngleAtParameter(double value); internal unsafe AcDbEllipse* GetImpObj(); public double GetParameterAtAngle(double angle); public void Set(Point3d center, Vector3d unitNormal, Vector3d majorAxis, double radiusRatio, double startAngle, double endAngle); // Properties public Point3d Center { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double EndAngle { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double EndParam { override [Category("Geometry")] get; set; } public bool IsNull { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; } public Vector3d MajorAxis { [Category("Geometry")] get; } [UnitType(UnitType.Distance)] public double MajorRadius { [Category("Geometry")] get; } public Vector3d MinorAxis { [Category("Geometry")] get; } [UnitType(UnitType.Distance)] public double MinorRadius { [Category("Geometry")] get; } public Vector3d Normal { [Category("Geometry")] get; } [UnitType(UnitType.Unitless)] public double RadiusRatio { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double StartAngle { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] [www.BimCad.org]深居浅出 AutoCAD 二次开发 179 public double StartParam { override [Category("Geometry")] get; set; } } 属性: 属性 数据类型 意义 Center Point3d 圆心 Diameter double 直径 Circumference double 周长 Normal Vector3d 法向单位向量 RadiusRatio double 半径 Thickness double 线宽 EndAngle double 终点角度 StartAngle double 起始点角度 EndParam double 终点段比 StartParam double 起点段比 IsNull bool 是否为空 MajorAxis Vector3d 长轴 MinorAxis Vector3d 短轴 MajorRadius double 长轴半径 MinorRadius double 短轴半径 方法: 方法 参数 作用 double GetAngleAtParameter ( double value ) value 段比 获得段比处的角度 double GetParameterAtAngle ( double angle ) angle 角度 获得角度处的段比 void Set ( Point3d center, Vector3d unitNormal, Vector3d majorAxis, double radiusRatio, double startAngle, double endAngle ) 1、center 中心 2、unitNormal 法向向量 3、majorAxis 长轴 4、radiusRatio 半径 5、startAngle 起始角度 6、endAngle 终止角度 设置椭圆属性 构造函数: 构造函数 参数描述 Ellipse() Ellipse ( Point3d center, Vector3d unitNormal, 1、center 圆心 2、unitNormal 法向向量 3、majorAxis 主轴 4、radiusRatio 半径 [www.BimCad.org]深居浅出 AutoCAD 二次开发 180 Vector3d majorAxis, double radiusRatio, double startAngle, double endAngle ) 5、startAngle 起始角度 6、endAngle 终止角度 [www.BimCad.org]深居浅出 AutoCAD 二次开发 181 (6.2.6)Leader(引线) 类定义: public class Leader : Curve { // Methods public Leader(); protected internal Leader(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); [return: MarshalAs(UnmanagedType.U1)] public virtual bool AppendVertex(Point3d pointToAdd); public virtual void EvaluateLeader(); public DimStyleTableRecord GetDimstyleData(); internal unsafe AcDbLeader* GetImpObj(); public virtual void RemoveLastVertex(); public void SetDimstyleData(DimStyleTableRecord style); public virtual void SetPlane(Plane value); [return: MarshalAs(UnmanagedType.U1)] public virtual bool SetVertexAt(int index, Point3d pointValue); public virtual Point3d VertexAt(int value); // Properties [UnitType(UnitType.Distance)] public double AnnoHeight { [Category("Geometry")] get; } public virtual ObjectId Annotation { [Category("Geometry")] get; set; } public virtual Vector3d AnnotationOffset { [Category("Geometry")] get; set; } public AnnotationType AnnoType { [Category("Misc")] get; } [UnitType(UnitType.Distance)] public double AnnoWidth { [Category("Geometry")] get; } [UnitType(UnitType.Distance)] public virtual double Dimasz { [Category("Lines & Arrows")] get; set; } public virtual Color Dimclrd { [Category("Lines & Arrows")] get; set; } public virtual ObjectId DimensionStyle { [Category("Misc")] get; set; } public string DimensionStyleName { [Category("Misc")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimgap { [Category("Text")] get; set; } public virtual ObjectId Dimldrblk { [Category("Lines & Arrows")] get; set; } public virtual LineWeight Dimlwd { [Category("Lines & Arrows")] get; set; } public virtual bool Dimsah { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 182 [UnitType(UnitType.Unitless)] public virtual double Dimscale { [Category("Fit")] get; set; } public virtual int Dimtad { [Category("Text")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimtxt { [Category("Text")] get; set; } public virtual Point3d FirstVertex { [Category("Geometry")] get; } public virtual bool HasArrowHead { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool HasHookLine { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; } public virtual bool IsSplined { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual Point3d LastVertex { [Category("Geometry")] get; } public virtual Vector3d Normal { [Category("Geometry")] get; } public virtual int NumVertices { [Category("Geometry")] get; } public virtual ObjectId TextStyleId { [Category("Misc")] get; set; } } 属性: 属性 数据类型 意义 AnnoHeight double 标示文字高度(只读) Annotation ObjectId 标示文字 AnnoWidth double 标示文字宽度(只读) FirstVertex Point3d 首顶点 LastVertex Point3d 末顶点 NumVertices int 顶点数 Normal Vector3d 法相向量(只读) 方法: 方法 参数 作用 bool AppendVertex ( Point3d pointToAdd ) pointToAdd 要添加的顶点 添加顶点 bool SetVertexAt ( int index, Point3d pointValue ) 1、index 顶点索引 2、pointValue 顶点 设置顶点 void RemoveLastVertex() 删除末顶点 Point3d VertexAt ( int value ) index 顶点索引 获得顶点 void Value 平面 设置平面 [www.BimCad.org]深居浅出 AutoCAD 二次开发 183 SetPlane ( Plane value ) DimStyleTableRecord GetDimstyleData() 获得标注样式数据 void SetDimstyleData( DimStyleTableRecord style ) Style 标注样式表记录 设置标注样式数据 构造函数: 构造函数 参数描述 Leader() [www.BimCad.org]深居浅出 AutoCAD 二次开发 184 (6.2.7) Spline (样条曲线) Spline (样条曲线)是经过一系列给定点的自然过渡的光滑曲线。 类定义: public class Spline : Curve { // Methods public Spline(); protected internal Spline(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Spline(Point3dCollection point, int order, double fitTolerance); public Spline(Point3dCollection point, Vector3d startTangent, Vector3d endTangent, int order, double fitTolerance); public Spline(Point3d center, Vector3d unitNormal, Vector3d majorAxis, double radiusRatio, double startAngle, double endAngle); public Spline(int degree, [MarshalAs(UnmanagedType.U1)] bool rational, [MarshalAs(UnmanagedType.U1)] bool closed, [MarshalAs(UnmanagedType.U1)] bool periodic, Point3dCollection controlPoints, DoubleCollection knots, DoubleCollection weights, double controlPointTolerance, double knotTolerance); public void ElevateDegree(int newDegree); public Point3d GetControlPointAt(int index); public Point3d GetFitPointAt(int index); internal unsafe AcDbSpline* GetImpObj(); public void InsertFitPointAt(int index, Point3d point); public void InsertKnot(double value); public void PurgeFitData(); public void RemoveFitPointAt(int index); public void SetControlPointAt(int index, Point3d point); public void SetFitPointAt(int index, Point3d point); public void SetWeightAt(int index, double weight); public Curve ToPolyline(); public Curve ToPolyline(uint numOfVertices); public Curve ToPolylineWithPrecision(int precision); public void UpdateFitData(); public double WeightAt(int index); // Properties public int Degree { [Category("Misc")] get; } public Vector3d EndFitTangent { [Category("Misc")] get; } public FitData FitData { [Category("Geometry")] get; set; } [Category("Misc"), UnitType(UnitType.Distance)] [www.BimCad.org]深居浅出 AutoCAD 二次开发 185 public double FitTolerance { get; set; } public bool HasFitData { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; } public bool IsNull { [return: MarshalAs(UnmanagedType.U1)] get; } public override bool IsPlanar { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; } public bool IsRational { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; } public int NumControlPoints { [Category("Data Points")] get; } public int NumFitPoints { [Category("Data Points")] get; } public NurbsData NurbsData { [Category("Geometry")] get; set; } public Vector3d StartFitTangent { [Category("Misc")] get; } } 属性: 属性 数据类型 意义 Degree int 样条曲线的度数(1-25 之间)(只读) EndFitTangent Vector3d 目标终点向量(只读) StartFitTangent Vector3d 目标起点向量(只读) FitData Autodesk.AutoCAD.DatabaseServices.FitData 匹配数据 FitTolerance double 匹配容差 HasFitData bool 是否有匹配数据(只读) IsNull bool 是否为空(只读) IsPlanar bool 是否为平面对象(只读) IsRational bool 是否合理(只读) NumControlPoints int 控制点数目(只读) NumFitPoints int 匹配点数量(只读)(读取之前确保 HasFitData 为 true) NurbsData Autodesk.AutoCAD.DatabaseServices.NurbsData 样条曲线数据 方法: 方法 参数 作用 void ElevateDegree ( int newDegree ) newDegree 新度数(当前度数至 25 之间) 增加度数(只能增不能减,范围:当前度数至 25 之间) Point3d GetControlPointAt ( int index ) index 控制点索引 获得控制点 void SetFitPointAt ( int index, Point3d point ) 1、index 控制点索引 2、point 要设置的控制点 设置控制点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 186 Point3d GetFitPointAt ( int index ) index 匹配点索引 获得匹配点 void RemoveFitPointAt ( int index ) index 匹配点索引 删除匹配点 void InsertFitPointAt ( int index, Point3d point ) 1、index 插入索引 2、point 插入的匹配点 插入匹配点 void SetFitPointAt( int index, Point3d point ) 1、index 插入索引 2、point 改变的控制点 设置控制点 void InsertKnot ( double value ) Value 添加节的段比值(取值范围在起点 与终点的 parameter 之间) 添加节 void PurgeFitData() 反函数曲线的匹配数据 void SetWeightAt( int index, double weight ) 1、index 控制点索引 2、weight 权重 设置控制点权重 double WeightAt ( int index ) 1、index 控制点索引 获得控制点权重 Curve ToPolyline() 转换为多段线 (系统变量 PLINETYPE 为 0 转换结构为 Polyline 类型; 系统变量 PLINETYPE 为 1 转换结构为 Polyline2d 类型; 系统变量 PLINETYPE 为 3 转换结构为 Polyline3d 类型。 如果系统变量 PLINECONVERTMODE 为 0 多段线中只包 含线段; 如果系统变量 PLINECONVERTMODE 为 1 多段线中可以 包含圆弧; Curve ToPolyline ( uint numOfVertices ) numOfVertices 节点数 Curve ToPolylineWithPrecision ( int precision Precision 精度(0-99 之间) [www.BimCad.org]深居浅出 AutoCAD 二次开发 187 ) void UpdateFitData() 更新匹配数据 构造函数: 构造函数 参数描述 Spline() Spline ( Point3dCollection point, int order, double fitTolerance ) 1、point 控制点集合 2、order 次序(2-26 之间) 3、fitTolerance 匹配容差 Spline ( Point3dCollection point, Vector3d startTangent, Vector3d endTangent, int order, double fitTolerance ) 1、point 控制点集合 2、startTangent 目标起点向量 3、endTangent 目标终点向量 4、order 次序(2-26 之间) 5、fitTolerance 匹配容差 (6.2.8) XLine (构造线) 类定义: public class Xline : Curve { // Methods public Xline(); protected internal Xline(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbXline* GetImpObj(); // Properties public Point3d BasePoint { [Category("Geometry")] get; set; } public Point3d SecondPoint { [Category("Geometry")] get; set; } public Vector3d UnitDir { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 意义 [www.BimCad.org]深居浅出 AutoCAD 二次开发 188 BasePoint Point3d 基点 SecondPoint Point3d 第二点 UnitDir Vector3d 单位向量 构造函数: 构造函数 参数描述 Xline () (6.2.8) Ray (射线) 类定义: public class Ray : Curve { // Methods public Ray(); protected internal Ray(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbRay* GetImpObj(); // Properties [Category("Geometry")] public Point3d BasePoint { get; set; } public Point3d SecondPoint { [Category("Geometry")] get; set; } public Vector3d UnitDir { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 意义 BasePoint Point3d 基点 SecondPoint Point3d 第二点 UnitDir Vector3d 单位向量 构造函数: 构造函数 参数描述 Ray () [www.BimCad.org]深居浅出 AutoCAD 二次开发 189 (6.3)DBText(单行文字) 类定义: public class DBText : Entity { // Methods public DBText(); protected internal DBText(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void AdjustAlignment(Database alternateDatabaseToUse); public void ConvertFieldToText(); public int CorrectSpelling(); internal unsafe AcDbText* GetImpObj(); public string getTextWithFieldCodes(); // Properties public Point3d AlignmentPoint { [Category("Text")] get; set; } [Category("Text"), UnitType(UnitType.Distance)] public double Height { get; set; } public TextHorizontalMode HorizontalMode { [Category("Geometry")] get; set; } public bool IsDefaultAlignment { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; } public bool IsMirroredInX { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsMirroredInY { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public AttachmentPoint Justify { [Category("Text")] get; set; } public Vector3d Normal { [Category("Geometry")] get; set; } [Category("Text"), UnitType(UnitType.AngleNotTransformed)] public double Oblique { get; set; } public Point3d Position { [Category("Geometry")] get; set; } [UnitType(UnitType.Angle), Category("Text")] public double Rotation { get; set; } public string TextString { [Category("Text")] get; set; } public ObjectId TextStyleId { [Category("Text")] get; set; } public string TextStyleName { [Category("Text")] get; } [UnitType(UnitType.Distance), Category("Text")] [www.BimCad.org]深居浅出 AutoCAD 二次开发 190 public double Thickness { get; set; } public TextVerticalMode VerticalMode { [Category("Text")] get; set; } [Category("Text"), UnitType(UnitType.Unitless)] public double WidthFactor { get; set; } } 属性: 属性 数据类型 意义 AlignmentPoint Point3d 文本的对齐点 Height double 文字高度 HorizontalMode TextHorizontalMode 文字水平对齐方式 IsDefaultAlignment bool 是否默认对齐方式 IsMirroredInX bool 显示方式是否根据 X 轴镜像 IsMirroredInY bool 显示方式是否根据 Y 轴镜像 Justify Autodesk.AutoCAD.DatabaseServices.AttachmentPoint 对齐点 Normal Vector3d 平面法向向量 Oblique double 偏离角度 Position Point3d 基点位置 Rotation double 倾斜角度弧度值 TextString string 文字内容 TextStyleName string 文字样式名 Thickness double 文字宽度 VerticalMode TextVerticalMode 垂直对齐方式 WidthFactor double 宽度系数,使得文字高度可以根据宽度按照 比例调节 方法: 方法 参数 作用 ConvertFieldToText() 如果单行文字中包含域则把域转换成文字并删除域 int CorrectSpelling() 拼写检查,如果内容全部正确返回 0 如果有错误返回 1 构造函数: 构造函数 参数描述 DBText() (6.3.1) AttributeDefinition(属性定义) AttributeDefinition(属性定义)实现在 AutoCAD 图纸中定义属性参数,是为了使读取和修改一些特定的信息提供方便,如: 我们把一个图框中的“图纸名称”做成块的属性,再需要修改或者对“图纸名称”赋值的时候我们就可以找相应名称的属性来操 作,而不用盲目的从块里面取文本出来判断。属性定义可以直接加载到模型空间中显示,但是图块中的属性定义需要通过 AttributeReference (属性参照)添加到块参照中随块参照一起显示。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 191 类定义: public class AttributeDefinition : DBText { // Methods public AttributeDefinition(); protected internal AttributeDefinition(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public AttributeDefinition(Point3d position, string value, string tag, string prompt, ObjectId style); internal unsafe AcDbAttributeDefinition* GetImpObj(); public void UpdateMTextAttributeDefinition(); // Properties public bool Constant { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int FieldLength { [Category("Misc")] get; set; } public bool Invisible { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsMTextAttributeDefinition { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool LockPositionInBlock { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public MText MTextAttributeDefinition { get; set; } public bool Preset { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public string Prompt { [Category("Text")] get; set; } public string Tag { [Category("Text")] get; set; } public bool Verifiable { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 192 属性: 属性 数据类型 说明 Constant bool 属性值是否为常数,true-常数;false-变量 FieldLength int 属性值域的长度 Invisible bool 属性是否可见 IsMTextAttributeDefinition bool 是否多行文本属性定义 LockPositionInBlock bool 在块中是否锁定位置,true-锁定;false-不锁定 MTextAttributeDefinition MText 返回属性定义中的多行文本 Preset bool 是否设置为预设值 Prompt string 属性提示 Tag string 属性标签 Verifiable bool 属性是否可验证 方法: 方法 参数解释 作用 void UpdateMTextAttributeDefinition() 通过基本属性值更新内部 Mtext 构造函数: 构造函数 参数解释 AttributeDefinition() AttributeDefinition ( Point3d position, string value, string tag, string prompt, ObjectId style ) 1、position 位置 2、value 属性值 3、tag 标签 (显示在图形里面的形式) 4、prompt 提示 5、style 属性样式 Id (6.3.2) AttributeReference (属性参照) 块定义中的属性定义随块一起显示需要借助于 AttributeReference (属性参照)。 类定义: public class AttributeReference : DBText { // Methods public AttributeReference(); protected internal AttributeReference(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public AttributeReference(Point3d position, string value, string tag, ObjectId style); internal unsafe AcDbAttribute* GetImpObj(); public void SetAttributeFromBlock(Matrix3d blockTransform); public void SetAttributeFromBlock(AttributeDefinition definition, Matrix3d blockTransform); [Category("Text")] public void UpdateMTextAttribute(); // Properties public int FieldLength { [Category("Text")] get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 193 public bool Invisible { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsConstant { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } public bool IsMTextAttribute { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsPreset { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } public bool IsVerifiable { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } public bool LockPositionInBlock { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public MText MTextAttribute { get; set; } public string Tag { [Category("Text")] get; set; } } 属性: 属性 数据类型 意义 FieldLength Point3d 域长度 Invisible bool 是否不可见(false 可见,true 不可见) IsConstant bool 是否是常数(true 常数,false 非常数) bool IsMTextAttribute bool 是否多行文字属性(true 是 false 不是) IsPreset bool 属性值为预设的用户不可修改 IsVerifiable bool 是否需要验证用户输入 LockPositionInBlock bool 在块中是否不可移动(true 不可移动,false 可移动) MTextAttribute MText 获得多行文字属性的多行文字 Tag string 属性标记 方法: 方法 参数解释 作用 void SetAttributeFromBlock ( AttributeDefinition definition, Matrix3d blockTransform ) 1、definition 属性定义 2、blockTransform 变形矩阵 通过块设置属性 void SetAttributeFromBlock ( Matrix3d blockTransform ) blockTransform 变形矩阵 UpdateMTextAttribute() 更新多行文字属性 构造函数: 构造函数 参数解释 AttributeReference() [www.BimCad.org]深居浅出 AutoCAD 二次开发 194 AttributeReference ( Point3d position, string value, string tag, ObjectId style ) 1、position 位置 2、value 属性值 3、tag 标签 (显示在图形里面的形式) 4、style 属性样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 195 (6.4)MText(多行文字) 类定义: public class MText : Entity { // Methods public MText(); protected internal MText(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public void ConvertFieldToText(); public int CorrectSpelling(); public void ExplodeFragments(MTextFragmentCallback enumerator); public void ExplodeFragments(MTextFragmentCallback enumerator, object userData); public void ExplodeFragments(MTextFragmentCallback enumerator, object userData, WorldDraw context); public Point3dCollection GetBoundingPoints(); public double GetColumnHeight(int index); internal unsafe AcDbMText* GetImpObj(); public string getMTextWithFieldCodes(); public void SetAttachmentMovingLocation(AttachmentPoint value); public void SetColumnHeight(int index, double height); public int SetContentsRtf(string value); public void SetDynamicColumns(double width, double gutter, [MarshalAs(UnmanagedType.U1)] bool auto_height); public void SetStaticColumns(double width, double gutter, int count); // Properties [UnitType(UnitType.Distance)] public double ActualHeight { [Category("Geometry")] get; } [UnitType(UnitType.Distance)] public double ActualWidth { [Category("Geometry")] get; } public static string AlignChange { [Category("Text")] get; } [UnitType(UnitType.Distance)] public double Ascent { [Category("Text")] get; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 196 public AttachmentPoint Attachment { [Category("Text")] get; set; } public bool BackgroundFill { [return: MarshalAs(UnmanagedType.U1)] [Category("Text")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Color BackgroundFillColor { [Category("Misc")] get; set; } [UnitType(UnitType.Unitless)] public double BackgroundScaleFactor { [Category("Misc")] get; set; } public Transparency BackgroundTransparency { [Category("Misc")] get; set; } public static string BlockBegin { [Category("Misc")] get; } public static string BlockEnd { [Category("Misc")] get; } public static string ColorChange { [Category("Misc")] get; } public bool ColumnAutoHeight { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public int ColumnCount { get; set; } public bool ColumnFlowReversed { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public double ColumnGutterWidth { get; set; } public ColumnType ColumnType { get; set; } public double ColumnWidth { get; set; } public string Contents { [Category("Text")] get; set; } [UnitType(UnitType.Distance)] public double Descent { [Category("Text")] get; } public Vector3d Direction { [Category("Text")] get; set; } public FlowDirection FlowDirection { [Category("Text")] get; set; } public static string FontChange { [Category("Text")] get; } public double Height { get; set; } public static string HeightChange { [Category("Text")] get; } public static string LineBreak { [Category("Text")] get; } [UnitType(UnitType.Distance)] public double LineSpaceDistance { [Category("Text")] get; set; } [UnitType(UnitType.Unitless)] public double LineSpacingFactor { [Category("Text")] get; set; } public LineSpacingStyle LineSpacingStyle { [Category("Text")] get; set; } public Point3d Location { [Category("Geometry")] get; set; } public static string NonBreakSpace { [Category("Text")] get; } public Vector3d Normal { [Category("Geometry")] get; set; } public static string ObliqueChange { [Category("Text")] get; } public static string OverlineOff { [Category("Text")] get; } public static string OverlineOn { [Category("Text")] get; } public static string ParagraphBreak { [Category("Text")] get; } [UnitType(UnitType.Angle)] public double Rotation { [Category("Text")] get; set; } public static string StackStart { [Category("Text")] get; } public string Text { get; } [UnitType(UnitType.Distance)] public double TextHeight { [Category("Text")] get; set; } public ObjectId TextStyleId { [Category("Text")] get; set; } public string TextStyleName { [Category("Text")] get; } public static string TrackChange { [Category("Text")] get; } public static string UnderlineOff { [Category("Text")] get; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 197 public static string UnderlineOn { [Category("Text")] get; } public bool UseBackgroundColor { [return: MarshalAs(UnmanagedType.U1)] [Category("Text")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Distance)] public double Width { [Category("Text")] get; set; } public static string WidthChange { [Category("Text")] get; } } 属性: 属性 数据类型 说明 ActualHeight double 实际高度 ActualWidth double 实际宽度 Ascent double 提升文字(常用于对齐表格或格线) Attachment Autodesk.AutoCAD.DatabaseServices.AttachmentPoint 对齐点 BackgroundFill bool 是否填充背景 BackgroundFillColor Autodesk.AutoCAD.Colors.Color 背景颜色 BackgroundScaleFactor double 背景缩放比例 BackgroundTransparency Transparency 背景透明度 ColumnAutoHeight bool 是否自动根据文本尺寸设定列高 ColumnCount int 列数 ColumnGutterWidth double 列距 ColumnType Autodesk.AutoCAD.DatabaseServices.ColumnType 列类型 ColumnWidth double 列宽 Contents string 文字内容 Descent double 最高行高度 Direction Vector3d 表格方向 FlowDirection Autodesk.AutoCAD.DatabaseServices.FlowDirection 文字方向 Height double LineSpaceDistance double 线到文字距离 Location Point3d 基点 Normal Vector3d 法相向量 Rotation double 转角 TextHeight double 文字高度 Text string 纯文本的 Contents TextStyleName string 文字样式名 UseBackgroundColor bool 是否用背景的颜色 Width double 最宽行宽度 方法: 方法 参数解释 作用 void ConvertFieldToText() 如果文本中含有“字段”对 象,则把“字段”转化为文本 并删除“字段”对象 Point3dCollection GetBoundingPoints() 获得边界点,下标对应的边 界点 [0]-左上角点 [1]-右上角点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 198 [2]-左下角点 [3]-右下角点 double GetColumnHeight ( int index ) Index 列索引 获得列高 void SetColumnHeight ( int index, double height ) 1、index 列索引 2、height 列高度 设置列高 void SetDynamicColumns ( double width, double gutter, bool auto_height ) 1、width 高度 2、gutter 列距 3、auto_height 是否自动设置列高 设置列类型为动态列 void SetStaticColumns ( double width, double gutter, int count ) 1、width 高度 2、gutter 列距 3、auto_height 自动设置列高设置 设置列类型为静态列 void SetAttachmentMovingLocation ( Autodesk.AutoCAD.DatabaseServices.AttachmentPoint value ) Value 对齐点 设置对齐点 构造函数: 构造函数 参数解释 MText() [www.BimCad.org]深居浅出 AutoCAD 二次开发 199 (6.5) BlockReference(块参照) 块参照即 AutoCAD 图纸中的块,他把块定义或者外部 DWG 文件变成类似实体对象添加到模型空间来显示。 public class BlockReference : Entity { // Fields private AttributeCollection mpAttColl; // Methods public BlockReference(Point3d position, ObjectId blockTableRecord); protected internal BlockReference(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); private void ~BlockReference(); public virtual void ConvertToStaticBlock(); public virtual void ConvertToStaticBlock(string newBlockName); protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool); public virtual void ExplodeToOwnerSpace(); public Extents3d GeometryExtentsBestFit(); public Extents3d GeometryExtentsBestFit(Matrix3d parentTransform); internal unsafe AcDbBlockReference* GetImpObj(); public virtual void ResetBlock(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 200 // Properties public ObjectId AnonymousBlockTableRecord { [Category("Misc")] get; } public AttributeCollection AttributeCollection { [Category("Text")] get; } public ObjectId BlockTableRecord { [Category("Misc")] get; virtual set; } public Matrix3d BlockTransform { [Category("Geometry")] get; virtual set; } public UnitsValue BlockUnit { [Category("Misc")] get; set; } public DynamicBlockReferencePropertyCollection DynamicBlockReferencePropertyCollection { [Category("Misc")] get; } public ObjectId DynamicBlockTableRecord { [Category("Misc")] get; } public bool IsDynamicBlock { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } public string Name { [Category("Misc")] get; } public Vector3d Normal { [Category("Geometry")] get; virtual set; } public Point3d Position { [Category("Geometry")] get; virtual set; } [UnitType(UnitType.Angle)] public double Rotation { [Category("Misc")] get; virtual set; } public Scale3d ScaleFactors { [Category("Geometry")] get; virtual set; } public virtual bool TreatAsBlockRefForExplode { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } [UnitType(UnitType.Unitless)] public double UnitFactor { [Category("Misc")] get; } } 属性: 属性 数据类型 说明 AnonymousBlockTableRecord ObjectId 匿名块对应的块表记录 ObjectId(只读) AttributeCollection Autodesk.AutoCAD.DatabaseServices.Attri buteCollection 块参照属性集合(只读) BlockTableRecord ObjectId 普通块对应的快表记录 ObjectId(只读) BlockTransform Matrix3d 块变形 BlockUnit Autodesk.AutoCAD.DatabaseServices.Unit sValue 块单位 DynamicBlockReferencePropertyCollection Autodesk.AutoCAD.DatabaseServices.Dyn amicBlockReferencePropertyCollection 动态块属性集合(只读) DynamicBlockTableRecord ObjectId 动态块对应的块表记录 ObjectId(只读) IsDynamicBlock bool 判断块是否为动态块(true 是,false 否) (只读) Name string 对应的快表记录名(只读) Normal Vector3d 法相向量(只读) Position Point3d 基点 Rotation double 转角 ScaleFactors Scale3d 缩放比例 TreatAsBlockRefForExplode bool 是否被炸开过,初始值为 false 当块被 炸开过值为 true(只读) UnitFactor double 单位比例 方法: 方法 参数解释 作用 void ConvertToStaticBlock() 将一个动态块转换为匿名的静态块 [www.BimCad.org]深居浅出 AutoCAD 二次开发 201 void ConvertToStaticBlock ( string newBlockName ) newBlockName 块名 将一个动态块转换为静态块 void ExplodeToOwnerSpace() 在块所属空间炸开 Extents3d GeometryExtentsBestFit() 块的边界 Extents3d GeometryExtentsBestFit ( Matrix3d parentTransform ) parentTransform 变形矩 阵 void ResetBlock() 将动态块还原为默认状态 构造函数: 构造函数 参数解释 BlockReference ( Point3d position, ObjectId blockTableRecord ) 1、position 基点 2、blockTableRecord 对应的块表记录 (6.5.1) Table(表格) 表格是 AutoCAD 引用的外部数据表以块参照的形式在图形中的显示。在 AutoCAD 中我们常用 Table 来组织一些明细表, 材料表之类的表格。表格的数据与 Excel 连接我们需要借助 DataLink(数据连接器)来连接 Excel 文件。 类定义: public class Table : BlockReference, IEnumerable { // Fields private CellRange m_cells; private ColumnsCollection m_columns; private RowsCollection m_rows; // Methods public Table(); protected internal Table(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); [Obsolete("Use Cell functionality instead.")] public virtual CellAlignment Alignment(RowType type); [Obsolete("Use Table.Cells[row,column].Alignment instead.")] public virtual CellAlignment Alignment(int row, int col); [www.BimCad.org]深居浅出 AutoCAD 二次开发 202 [Obsolete("Use Table.Cells[row,column].AttachmentPoint instead.")] public virtual Point3d AttachmentPoint(int row, int col); [Obsolete("Use Cell functionality instead.")] public virtual Color BackgroundColor(RowType type); [Obsolete("Use Table.Cells[row,column].BackgroundColor instead.")] public virtual Color BackgroundColor(int row, int col); [Obsolete("Use Table.Cells[row,column].Contents[i].Rotation instead.")] public virtual double BlockRotation(int row, int col); [Obsolete("Use Table.Cells[row,column].Contents[i].Scale instead.")] public virtual double BlockScale(int row, int col); [Obsolete("Use Table.Cells[row,column].Contents[i].BlockTableRecordId instead.")] public virtual ObjectId BlockTableRecordId(int row, int col); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use CellRange.CanDeleteColumns instead")] public virtual bool CanDeleteColumns(int index, int nCount); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use CellRange.CanDeleteRows instead")] public virtual bool CanDeleteRows(int index, int nCount); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Columns[column].CanInsertColumn instead")] public virtual bool CanInsertColumn(int index); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Rows[row].CanInsertRow instead")] public virtual bool CanInsertRow(int index); [Obsolete("Use Table.Cells[row,column].StyleOverrides instead.")] public virtual TableStyleOverride[] CellStyleOverrides(int row, int col); public virtual TableCellType CellType(int row, int col); public virtual void ClearSubSelection(); [Obsolete("Use Cell functionality instead.")] public virtual void ClearTableStyleOverrides(int options); [Obsolete("Use Table.Columns[col].Width instead.")] public virtual double ColumnWidth(int col); [Obsolete("Use Cell functionality instead.")] public virtual Color ContentColor(RowType type); [Obsolete("Use Table.Cells[row,column].ContentColor instead.")] public virtual Color ContentColor(int row, int col); public virtual void CopyFrom(LinkedTableData source, TableCopyOptions options); public virtual CellRange CopyFrom(LinkedTableData source, TableCopyOptions options, CellRange sourceRange, CellRange targetRange); public virtual CellRange CopyFrom(Table source, TableCopyOptions options, CellRange sourceRange, CellRange targetRange); [Obsolete("Use Table.Cells[row,column].Contents.Add or InsertAt instead.")] public virtual int CreateContent(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].DataType instead.")] public virtual DataType DataType(RowType type); [Obsolete("Use Table.Cells[row,column].DataType instead.")] public virtual DataType DataType(int row, int col); [Obsolete("Use Table.Cells[row,column].DeleteCellContent instead.")] public virtual void DeleteCellContent(int row, int col); [www.BimCad.org]深居浅出 AutoCAD 二次开发 203 public virtual void DeleteColumns(int col, int columns); [Obsolete("Use CellRange.DeleteContent instead.")] public virtual void DeleteContent(CellRange); [Obsolete("Use Table.Cells[row,column].Contents.Clear instead.")] public virtual void DeleteContent(int row, int column); [Obsolete("Use Table.Cells[row,column].Contents.RemoveAt instead.")] public virtual void DeleteContent(int row, int column, int contentIndex); public virtual void DeleteRows(int row, int rows); [Obsolete("Use Table.Cells[row,column].FieldId instead.")] public virtual ObjectId FieldId(int row, int col); public virtual void Fill(CellRange fillRange, CellRange sourceRange, TableFillOptions options); [Obsolete("Use Table.Cells[row,column].DataFormat instead.")] public virtual string Format(RowType type); [Obsolete("Use Table.Cells[row,column].DataFormat instead.")] public virtual string Format(int row, int col); public virtual void GenerateLayout(); [Obsolete("Use Table.Cells[row,column].Contents[i].GetBlockAttributeValue instead.")] public virtual string GetBlockAttributeValue(int row, int col, ObjectId attributeDefinitionId); [Obsolete("Use Table.Cells[row,column].Contents[i].GetBlockAttributeValue instead.")] public virtual string GetBlockAttributeValue(int row, int column, int contentIndex, ObjectId attDefId); [Obsolete("Use Table.Cells[row,column].Contents[i].BlockTableRecordId instead.")] public virtual ObjectId GetBlockTableRecordId(int row, int column, int contentIndex); public virtual double GetBreakHeight(int index); public virtual Vector3d GetBreakOffset(int index); public virtual double GetBreakSpacing(); [Obsolete("Use Table.Cells[row,column].GetExtents instead.")] public virtual void GetCellExtents(int row, int col, [MarshalAs(UnmanagedType.U1)] bool isOuterCell, Point3dCollection pts); [Obsolete("Use Table.Cells[row,column].State instead.")] public virtual CellStates GetCellState(int row, int column); [Obsolete("Use Table.Cells[row,column].Style instead.")] public virtual string GetCellStyle(int row, int column); [Obsolete("Use Table.Columns[i].Name instead.")] public virtual string GetColumnName(int index); [Obsolete("Use Table.Cells[row,column].ContentColor instead.")] public virtual Color GetContentColor(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].ContentLayout instead.")] public virtual CellContentLayout GetContentLayout(int row, int column); [Obsolete("Use Table.Cells[row,column].ContentTypes instead.")] public virtual CellContentTypes GetContentTypes(int row, int column); [Obsolete("Use Table.Cells[row,column].Content[i].ContentTypes instead.")] public virtual CellContentTypes GetContentTypes(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].GetCustomData instead.")] public virtual int GetCustomData(int row, int column); [Obsolete("Use Table.Cells[row,column].SetCustomData instead.")] public virtual object GetCustomData(int row, int column, string key); [Obsolete("Use Table.Cells[row,column].DataFormat instead.")] public virtual string GetDataFormat(int row, int column); [Obsolete("Use Table.Cells[row,column].Contents[i].DataFormat instead.")] [www.BimCad.org]深居浅出 AutoCAD 二次开发 204 public virtual string GetDataFormat(int row, int column, int contentIndex); public virtual ObjectIdCollection GetDataLink(); [Obsolete("CellRange.GetDataLink instead.")] public virtual ObjectIdCollection GetDataLink(CellRange range); [Obsolete("Use Table.Cells[row,column].DataLink instead.")] public virtual ObjectId GetDataLink(int row, int column); [Obsolete("Use Table.Cells[row,column].GetDataLinkRange instead.")] public virtual CellRange GetDataLinkRange(int row, int column); [Obsolete("Use Table.Cells[row,column].Contents[i].DataType instead.")] public virtual DataTypeParameter GetDataType(int row, int column, int contentIndex); [Obsolete("Use Table.Cells instead.")] public virtual TableEnumerator GetEnumerator(); [Obsolete("Use Table.Cells instead.")] public virtual TableEnumerator GetEnumerator(CellRange range, TableEnumeratorOption option); [Obsolete("Use Table.Cells[row,column].Contents[i].FieldId instead.")] public virtual ObjectId GetFieldId(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].Contents[i].Formula instead.")] public virtual string GetFormula(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Color instead.")] public virtual Color GetGridColor(int row, int column, GridLineType gridLineType); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.DoubleLineSpacing instead.")] public virtual double GetGridDoubleLineSpacing(int row, int column, GridLineType gridLineType); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.LineStyle instead.")] public virtual GridLineStyle GetGridLineStyle(int row, int column, GridLineType gridLineType); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Linetype instead.")] public virtual ObjectId GetGridLinetype(int row, int column, GridLineType gridLineType); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.LineWeight instead.")] public virtual LineWeight GetGridLineWeight(int row, int column, GridLineType gridLineType); public virtual GridPropertyParameter GetGridProperty(int row, int column, GridLineType gridLineType); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.IsVisible instead.")] public virtual Visibility GetGridVisibility(int row, int column, GridLineType gridLineType); internal unsafe AcDbTable* GetImpObj(); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].Contents[i].IsAutoScale instead.")] public virtual bool GetIsAutoScale(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Margin instead.")] public virtual double GetMargin(int row, int column, CellMargins margin); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].IsMergeAllEnabled instead.")] public virtual bool GetMergeAllEnabled(int row, int column); [Obsolete("Use Table.Cells[row,column].GetMergeRange instead.")] public virtual CellRange GetMergeRange(int row, int column); [Obsolete("Use Table.Cells[row,column].Contents.Count instead.")] public virtual int GetNumberOfContents(int row, int column); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Overrides instead.")] public virtual CellProperties GetOverrides(int row, int column, GridLineType gridLineType); [Obsolete("Use Table.Cells[row,column].Contents[i].Overrides instead.")] public virtual CellProperties GetOverrides(int row, int column, int contentIndex); [www.BimCad.org]深居浅出 AutoCAD 二次开发 205 [Obsolete("Use Table.Cells[row,column].Contents[i].Rotation instead.")] public virtual double GetRotation(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].Contents[i].Scale instead.")] public virtual double GetScale(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].Contents[i].TextHeight instead.")] public virtual double GetTextHeight(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].Contents[i].TextString instead.")] public virtual string GetTextString(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].Contents[i].SetTextString instead.")] public virtual string GetTextString(int row, int column, int contentIndex, FormatOption formatOption); [Obsolete("Use Table.Cells[row,column].Contents[i].TextStyleId instead.")] public virtual ObjectId GetTextStyleId(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].ToolTip instead.")] public virtual string GetToolTip(int row, int column); [Obsolete("Use Table.Cells[row,column].Content[i].Value instead.")] public virtual object GetValue(int row, int column, int contentIndex); [Obsolete("Use Table.Cells[row,column].Content[i].GetValue instead.")] public virtual object GetValue(int row, int column, int contentIndex, FormatOption formatOption); [Obsolete("Use Cell functionality instead.")] public virtual Color GridColor(GridLineType gridlineType, RowType type); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Color instead.")] public virtual Color GridColor(int row, int col, CellEdgeMasks edge); [Obsolete("Use Cell functionality instead.")] public virtual LineWeight GridLineWeight(GridLineType gridlineType, RowType type); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.LineWeight instead.")] public virtual LineWeight GridLineWeight(int row, int col, CellEdgeMasks edge); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Cell functionality instead.")] public virtual bool GridVisibility(GridLineType gridlineType, RowType type); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Visibility instead.")] public virtual bool GridVisibility(int row, int col, CellEdgeMasks edge); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].Contents[i].HasFormula instead.")] public virtual bool HasFormula(int row, int column, int contentIndex); public virtual TableHitTestInfo HitTest(Point3d point, Vector3d viewVector); [Obsolete("Use Table.Cells instead.")] IEnumerator IEnumerable.GetEnumerator(); public virtual void InsertColumns(int col, double width, int columns); public virtual void InsertColumnsAndInherit(int col, int inheritFrom, int numCols); public virtual void InsertRows(int row, double height, int rows); public virtual void InsertRowsAndInherit(int index, int inheritFrom, int numRows); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].Contents[i].IsAutoScale instead.")] public virtual bool IsAutoScale(int row, int col); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Cell functionality instead.")] public virtual bool IsBackgroundColorNone(RowType type); [www.BimCad.org]深居浅出 AutoCAD 二次开发 206 [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].IsBackgroundColorNone instead.")] public virtual bool IsBackgroundColorNone(int row, int col); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].IsContentEditable instead.")] public virtual bool IsContentEditable(int row, int column); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].IsEmpty instead.")] public virtual bool IsEmpty(int row, int column); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].IsFormatEditable instead.")] public virtual bool IsFormatEditable(int row, int column); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].IsLinked instead.")] public virtual bool IsLinked(int row, int column); [return: MarshalAs(UnmanagedType.U1)] [Obsolete("Use Table.Cells[row,column].GetMergeRange instead.")] public bool IsMergedCell(int row, int col, out CellRange range); public virtual void MergeCells(CellRange range); [Obsolete("Use Table.Columns[col].MinimumWidth instead.")] public virtual double MinimumColumnWidth(int col); [Obsolete("Use Table.Rows[col].MinimumHeight instead.")] public virtual double MinimumRowHeight(int row); [Obsolete("Use Table.Cells[row,column].Contents.Move instead.")] public virtual void MoveContent(int row, int column, int fromIndex, int toIndex); public virtual void RecomputeTableBlock([MarshalAs(UnmanagedType.U1)] bool forceUpdate); [Obsolete("Use Cell functionality instead.")] public virtual void RemoveAllOverrides(int row, int column); public virtual void RemoveDataLink(); [Obsolete("Use Table.Cells[row,column].RemoveDataLink instead.")] public virtual void RemoveDataLink(int row, int column); public virtual void ReselectSubRegion(FullSubentityPath[] paths); [Obsolete("Use Table.Cells[row,column].Contents(i).ResetValue instead.")] public virtual void ResetValue(int row, int col); [Obsolete("Use Table.Rows[col].Height instead.")] public virtual double RowHeight(int row); [Obsolete("Use Row functionality instead.")] public virtual RowType RowType(int row); public virtual TableHitTestInfo Select(Point3d pickingPoint, Vector3d hitTestViewDirection, Vector3d hitTestViewOrientation, [MarshalAs(UnmanagedType.U1)] bool allowOutside, [MarshalAs(UnmanagedType.U1)] bool inPickFirst, FullSubentityPath[] paths); public virtual CellRange SelectSubRegion(Point3d cornerPoint1, Point3d cornerPoint2, Vector3d selectionViewDirection, Vector3d hitTestViewDirection, SelectType selectionType, [MarshalAs(UnmanagedType.U1)] bool includeCurrentSelection, [MarshalAs(UnmanagedType.U1)] bool inPickFirst, FullSubentityPath[] paths); [Obsolete("Use Cell functionality instead.")] public virtual void SetAlignment(CellAlignment align, int rowTypes); [Obsolete("Use Table.Cells[row,column].Alignment instead.")] public virtual void SetAlignment(int row, int col, CellAlignment align); [Obsolete("Use Table.Cells[row,column].Contents[i].IsAutoScale instead.")] [www.BimCad.org]深居浅出 AutoCAD 二次开发 207 public virtual void SetAutoScale(int row, int col, [MarshalAs(UnmanagedType.U1)] bool autoFit); [Obsolete("Use Cell functionality instead.")] public virtual void SetBackgroundColor(Color color, int rowTypes); [Obsolete("Use Table.Cells[row,column].BackgroundColor instead.")] public virtual void SetBackgroundColor(int row, int col, Color color); [Obsolete("Use Cell functionality instead.")] public virtual void SetBackgroundColorNone([MarshalAs(UnmanagedType.U1)] bool value, int rowTypes); [Obsolete("Use Table.Cells[row,column].IsBackgroundColorNone instead.")] public virtual void SetBackgroundColorNone(int row, int col, [MarshalAs(UnmanagedType.U1)] bool value); [Obsolete("Use Table.Cells[row,column].Contents[i].GetBlockAttributeValue instead.")] public virtual void SetBlockAttributeValue(int row, int col, ObjectId attributeDefinitionId, string value); [Obsolete("Use Table.Cells[row,column].Contents[i].GetBlockAttributeValue instead.")] public virtual void SetBlockAttributeValue(int row, int column, int contentIndex, ObjectId attDefId, string value); [Obsolete("Use Table.Cells[row,column].Contents[i].Rotation instead.")] public virtual void SetBlockRotation(int row, int col, double rotationalAngle); [Obsolete("Use Table.Cells[row,column].Contents[i].Scale instead.")] public virtual void SetBlockScale(int row, int col, double scale); [Obsolete("Use Table.Cells[row,column].Contents[i].BlockTableRecordId instead.")] public virtual void SetBlockTableRecordId(int row, int col, ObjectId blockId, [MarshalAs(UnmanagedType.U1)] bool autoFit); [Obsolete("Use Table.Cells[row,column].Contents[i].BlockTableRecordId instead.")] public virtual void SetBlockTableRecordId(int row, int column, int contentIndex, ObjectId blockId, [MarshalAs(UnmanagedType.U1)] bool autoFit); public virtual void SetBreakHeight(int index, double height); public virtual void SetBreakOffset(int index, Vector3d offset); public virtual void SetBreakSpacing(double spacing); [Obsolete("Use Table.Cells[row,column].State instead.")] public virtual void SetCellState(int row, int column, CellStates cellState); [Obsolete("Use Table.Cells[row,column].Style instead.")] public virtual void SetCellStyle(int row, int column, string styleName); [Obsolete("Use Cell functionality instead.")] public virtual void SetCellType(int row, int col, TableCellType type); [Obsolete("Use Table.Columns[i].Name instead.")] public virtual void SetColumnName(int index, string name); public virtual void SetColumnWidth(double width); [Obsolete("Use Table.Columns[col].Width instead.")] public virtual void SetColumnWidth(int col, double width); [Obsolete("Use Cell functionality instead.")] public virtual void SetContentColor(Color color, int rowType); [Obsolete("Use Table.Cells[row,column].ContentColor instead.")] public virtual void SetContentColor(int row, int col, Color color); [Obsolete("Use Table.Cells[row,column].ContentColor instead.")] public virtual void SetContentColor(int row, int column, int contentIndex, Color color); [Obsolete("Use Table.Cells[row,column].ContentLayout instead.")] public virtual void SetContentLayout(int row, int column, CellContentLayout layout); [Obsolete("Use Table.Cells[row,column].SetCustomData instead.")] public virtual void SetCustomData(int row, int column, int data); [Obsolete("Use Table.Cells[row,column].SetCustomData instead.")] public virtual void SetCustomData(int row, int column, string key, object value); [www.BimCad.org]深居浅出 AutoCAD 二次开发 208 [Obsolete("Use Table.Cells[row,column].DataFormat instead.")] public virtual void SetDataFormat(int row, int column, string format); [Obsolete("Use Table.Cells[row,column].Contents[i].DataFormat instead.")] public virtual void SetDataFormat(int row, int column, int contentIndex, string format); [Obsolete("CellRange.SetDataLink instead.")] public virtual void SetDataLink(CellRange range, ObjectId dataLinkId, [MarshalAs(UnmanagedType.U1)] bool bUpdate); [Obsolete("Use Table.Cells[row,column].DataLink instead.")] public virtual void SetDataLink(int row, int column, ObjectId dataLinkId, [MarshalAs(UnmanagedType.U1)] bool bUpdate); [Obsolete("Use Table.Cells[row,column].DataType instead.")] public virtual void SetDataType(DataType nDataType, UnitType nUnitType, int rowTypes); [Obsolete("Use Table.Cells[row,column].DataType instead.")] public virtual void SetDataType(int row, int col, DataType nDataType, UnitType nUnitType); [Obsolete("Use Table.Cells[row,column].Contents[i].DataType instead.")] public virtual void SetDataType(int row, int column, int contentIndex, DataTypeParameter dataType); [Obsolete("Use Table.Cells[row,column].FieldId instead.")] public virtual void SetFieldId(int row, int col, ObjectId fieldId); [Obsolete("Use Table.Cells[row,column].Contents[i].FieldId instead.")] public virtual void SetFieldId(int row, int column, int contentIndex, ObjectId fieldId, CellOption option); [Obsolete("Use Table.Cells[row,column].DataFormat instead.")] public virtual void SetFormat(string pFormat, int rowTypes); [Obsolete("Use Table.Cells[row,column].DataFormat instead.")] public virtual void SetFormat(int row, int col, string pFormat); [Obsolete("Use Table.Cells[row,column].Contents[i].Formula instead.")] public virtual void SetFormula(int row, int column, int contentIndex, string formula); [Obsolete("Use Cell functionality instead.")] public virtual void SetGridColor(Color color, int borders, int rows); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Color instead.")] public virtual void SetGridColor(int row, int column, GridLineType gridLineType, Color color); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Color instead.")] public virtual void SetGridColor(int row, int col, short edges, Color color); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.DoubleLineSpacing instead.")] public virtual void SetGridDoubleLineSpacing(int row, int column, GridLineType gridLineType, double spacing); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.LineStyle instead.")] public virtual void SetGridLineStyle(int row, int column, GridLineType gridLineType, GridLineStyle lineStyle); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Linetype instead.")] public virtual void SetGridLinetype(int row, int column, GridLineType gridLineType, ObjectId linetype); [Obsolete("Use Cell functionality instead.")] public virtual void SetGridLineWeight(LineWeight lineWeight, int borders, int rows); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.LineWeight instead.")] public virtual void SetGridLineWeight(int row, int column, GridLineType gridLineType, LineWeight lineWeight); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.LineWeight instead.")] public virtual void SetGridLineWeight(int row, int col, short edges, LineWeight value); public virtual void SetGridProperty(CellRange rangeIn, GridLineType gridLineTypes, GridPropertyParameter gridProp); public virtual void SetGridProperty(int row, int column, GridLineType gridLineType, GridPropertyParameter gridProperty); [Obsolete("Use Cell functionality instead.")] public virtual void SetGridVisibility([MarshalAs(UnmanagedType.U1)] bool visible, int borders, int rows); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.IsVisible instead.")] public virtual void SetGridVisibility(int row, int column, GridLineType gridLineType, Visibility visibility); [www.BimCad.org]深居浅出 AutoCAD 二次开发 209 [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Visibility instead.")] public virtual void SetGridVisibility(int row, int col, short edges, [MarshalAs(UnmanagedType.U1)] bool value); [Obsolete("Use Table.Cells[row,column].Contents[i].IsAutoScale instead.")] public virtual void SetIsAutoScale(int row, int column, int contentIndex, [MarshalAs(UnmanagedType.U1)] bool autoFit); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Margin instead.")] public virtual void SetMargin(int row, int column, CellMargins margin, double value); [Obsolete("Use Table.Cells[row,column].IsMergeAllEnabled instead.")] public virtual void SetMergeAllEnabled(int row, int column, [MarshalAs(UnmanagedType.U1)] bool enable); [Obsolete("Use Table.Cells[row,column].{Top,Bottom,Left,Right}Edge.Overrides instead.")] public virtual void SetOverrides(int row, int column, GridLineType gridLineType, CellProperties @override); [Obsolete("Use Table.Cells[row,column].Contents[i].Overrides instead.")] public virtual void SetOverrides(int row, int column, int contentIndex, CellProperties @override); [Obsolete("Use Table.Cells[row,column].Contents[i].Rotation instead.")] public virtual void SetRotation(int row, int column, int contentIndex, double angle); public virtual void SetRowHeight(double height); [Obsolete("Use Table.Rows[col].Height instead.")] public virtual void SetRowHeight(int row, double height); [Obsolete("Use Table.Cells[row,column].Contents[i].Scale instead.")] public virtual void SetScale(int row, int column, int contentIndex, double scale); public virtual void SetSize(int numRows, int numCols); [Obsolete("Use Cell functionality instead.")] public virtual void SetTextHeight(double height, int rowTypes); [Obsolete("Use Table.Cells[row,column].TextHeight instead.")] public virtual void SetTextHeight(int row, int col, double height); [Obsolete("Use Table.Cells[row,column].Contents[i].TextHeight instead.")] public virtual void SetTextHeight(int row, int column, int contentIndex, double height); [Obsolete("Use Table.Cells[row,column].Contents[i].Rotation instead.")] public virtual void SetTextRotation(int row, int col, RotationAngle rot); [Obsolete("Use Table.Cells[row,column].TextString instead.")] public virtual void SetTextString(int row, int col, string value); [Obsolete("Use Table.Cells[row,column].Contents[i].TextString instead.")] public virtual void SetTextString(int row, int column, int contentIndex, string text); [Obsolete("Use Cell functionality instead.")] public virtual void SetTextStyle(ObjectId id, int rowTypes); [Obsolete("Use Table.Cells[row,column].TextStyleId instead.")] public virtual void SetTextStyle(int row, int col, ObjectId id); [Obsolete("Use Table.Cells[row,column].Contents[i].TextStyleId instead.")] public virtual void SetTextStyleId(int row, int column, int contentIndex, ObjectId id); [Obsolete("Use Table.Cells[row,column].ToolTip instead.")] public virtual void SetToolTip(int row, int column, string toolTip); [Obsolete("Use Table.Cells[row,column].Contents(i).Value instead.")] public virtual void SetValue(int row, int col, object pValue); [Obsolete("Use Table.Cells[row,column].Content[i].Value instead.")] public virtual void SetValue(int row, int column, int contentIndex, object value); [Obsolete("Use Table.Cells[row,column].Contents(i).Value instead.")] public virtual void SetValue(int row, int col, string pText, ParseOption nOption); [Obsolete("Use Table.Cells[row,column].Content[i].SetValue instead.")] public virtual void SetValue(int row, int column, int contentIndex, object value, ParseOption parseOption); [www.BimCad.org]深居浅出 AutoCAD 二次开发 210 [Obsolete("Use Table.Cells[row,column].Content[i].SetValue instead.")] public virtual void SetValue(int row, int column, int contentIndex, string value, ParseOption parseOption); public virtual void SuppressRegenerateTable([MarshalAs(UnmanagedType.U1)] bool suppress); [Obsolete("Use Cell functionality instead.")] public virtual TableStyleOverride[] TableStyleOverrides(); [Obsolete("Use Cell functionality instead.")] public virtual double TextHeight(RowType type); [Obsolete("Use Table.Cells[row,column].TextHeight instead.")] public virtual double TextHeight(int row, int col); [Obsolete("Use Table.Cells[row,column].Contents[i].Rotation instead.")] public virtual RotationAngle TextRotation(int row, int col); [Obsolete("Use Table.Cells[row,column].TextString instead.")] public virtual string TextString(int row, int col); [Obsolete("Use Table.Cells[row,column].TextString instead.")] public virtual string TextString(int row, int col, FormatOption nOption); [Obsolete("Use Table.Cells[row,column].TextString instead.")] public virtual string TextStringConst(int row, int col); [Obsolete("Use Cell functionality instead.")] public virtual ObjectId TextStyle(RowType type); [Obsolete("Use Table.Cells[row,column].TextStyleId instead.")] public virtual ObjectId TextStyle(int row, int col); [Obsolete("Use Table.Cells[row,column].DataType instead.")] public virtual UnitType UnitType(RowType type); [Obsolete("Use Table.Cells[row,column].DataType instead.")] public virtual UnitType UnitType(int row, int col); public virtual void UnmergeCells(CellRange range); public virtual void UpdateDataLink(UpdateDirection dir, UpdateOption option); [Obsolete("Use Table.Cells[row,column].UpdateDataLink instead.")] public virtual void UpdateDataLink(int row, int column, UpdateDirection dir, UpdateOption option); [Obsolete("Use Table.Cells[row,column].Contents(i).Value instead.")] public virtual object Value(int row, int col); // Properties public bool BreakEnabled { virtual [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual TableBreakFlowDirection BreakFlowDirection { get; set; } public virtual TableBreakOptions BreakOptions { get; set; } public CellRange Cells { get; } public ColumnsCollection Columns { get; } public virtual Vector3d Direction { [Category("Geometry")] get; set; } public virtual FlowDirection FlowDirection { [Category("Table")] get; set; } public virtual bool HasSubSelection { [return: MarshalAs(UnmanagedType.U1)] [Category("Table")] get; } [Category("Table"), UnitType(UnitType.Distance)] public virtual double Height { get; set; } [Obsolete("Use Table.Cells[row, column].HorizontalLine.Margin instead."), UnitType(UnitType.Distance), Category("Table")] public virtual double HorizontalCellMargin { get; set; } [Obsolete("Use Cell functionality instead.")] [www.BimCad.org]深居浅出 AutoCAD 二次开发 211 public virtual bool IsHeaderSuppressed { [return: MarshalAs(UnmanagedType.U1)] [Category("Table")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [Obsolete("Use Cell functionality instead.")] public virtual bool IsTitleSuppressed { [return: MarshalAs(UnmanagedType.U1)] [Category("Table")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [Category("Table"), UnitType(UnitType.Distance)] public virtual double MinimumTableHeight { get; } [UnitType(UnitType.Distance), Category("Table")] public virtual double MinimumTableWidth { get; } [Obsolete("Use Table.Columns.Count instead.")] public virtual int NumColumns { [Category("Table")] get; set; } [Obsolete("Use Table.Rows.Count instead.")] public virtual int NumRows { [Category("Table")] get; set; } public RowsCollection Rows { get; } public virtual CellRange SubSelection { [Category("Table")] get; set; } public virtual ObjectId TableStyle { [Category("Table")] get; set; } public string TableStyleName { [Category("Table")] get; } [Category("Table"), Obsolete("Use Table.Cells[row, column].VerticalLine.Margin instead."), UnitType(UnitType.Distance)] public virtual double VerticalCellMargin { get; set; } [UnitType(UnitType.Distance), Category("Table")] public virtual double Width { get; set; } } 属性: 属性 数据类型 说明 Direction Vector3d 表格在世界坐标系中的水平方向 Height double 表格总高度 Width double 表格宽度 HorizontalCellMargin double 单元格水平边界 VerticalCellMargin double 单元格垂直边界 IsHeaderSuppressed bool 表格头是否被压缩 IsTitleSuppressed bool 表格标题是否被压缩 MinimumTableHeight double 表格最小高度(只读) MinimumTableWidth double 表格最小宽度(只读) NumColumns int 单元格列数 NumRows int 单元格行数 SubSelection CellRange 选中行 TableStyle ObjectId 表格样式 ObjectId TableStyleName string 表格样式名 方法: 方法 参数解释 作用 Autodesk.AutoCAD.DatabaseServices.CellClass CellClass ( string styleName ) styleName 单元格样式名 通过单元格样式名获得单元格类型 [www.BimCad.org]深居浅出 AutoCAD 二次开发 212 double Margin ( CellMargins cellMargin, string styleName ) 1、cellMargin 单元格边界 2、styleName 单元格样式名 设置单元格边界 ObjectId PostTableStyleToDatabase ( Database databasePointer, string styleName ) 1、databasePointer 数据库 2、styleName 表格样式名 把表格样式添加到数据库 Autodesk.AutoCAD.DatabaseServices.CellAlignment Alignment ( Autodesk.AutoCAD.DatabaseServices.RowType rowType ) rowType 行类型 设置表格对齐方式 void SetBackgroundColor ( Autodesk.AutoCAD.Colors.Color color, int rowTypes ) 1、color 颜色 2、rowTypes 行数 设置单元格背景颜色 void SetBackgroundColorNone ( bool value, int rowTypes ) 1、是否清空颜色 2、rowTypes 行类型 清空单元格背景颜色 void SetCellClass ( Autodesk.AutoCAD.DatabaseServices.CellClass cellClass, tring styleName ) 1、cellClass 单元格类型 2、styleName 表格样式名 根据表格样式,设置单元格类型 void SetColor ( Autodesk.AutoCAD.Colors.Color color, int rowTypes ) 1、color 颜色 2、rowTypes 行类型 设置单元格颜色 Autodesk.AutoCAD.Colors.Color BackgroundColor ( Autodesk.AutoCAD.DatabaseServices.RowType rowType ) rowType 获得 rowType 的背景颜色 void SetGridColor ( Autodesk.AutoCAD.Colors.Color color, int gridLineTypes, int rowTypes 1、color 颜色 2、gridLineTypes 表格线类型 3、rowTypes 表格行类型 设置表格线颜色 [www.BimCad.org]深居浅出 AutoCAD 二次开发 213 ) void SetGridVisibility ( bool visible, int gridLineTypes, int rowTypes ) 1、visible 表格是否可见 2、gridLineTypes 表格线类型 3、rowTypes 表格行类型 设置表格是否可见 void SetMargin ( CellMargins cellMargin, double margin, string styleName ) 1、cellMargin 单元格边界 2、margin 边界值 3、styleName 单元格样式名 设置单元格边界 void SetTextHeight ( double height, int rowTypes ) 1、height 文字高度 2、rowTypes 单元格行类型 设置单元格的文字高度 void SetTextStyle ( ObjectId id, int rowTypes ) 1、id 文字样式的 ObjectId 2、rowTypes 单元格类型 设置单元格的文字样式 void SetTextStyle ( ObjectId id, string styleName ) 1、id 文字样式的 ObjectId 2、styleName 样式名 设置单元格的文字样式 Autodesk.AutoCAD.Colors.Color Color ( Autodesk.AutoCAD.DatabaseServices.RowType rowType ) rowType 行类型 获得 rowType 的颜色 Autodesk.AutoCAD.DatabaseServices.DataType DataType ( Autodesk.AutoCAD.DatabaseServices.RowType rowType ) rowType 行类型 获得 rowType 的数据类型 string Format ( Autodesk.AutoCAD.DatabaseServices.RowType rowType ) rowType 行类型 获得 rowType 的格式 [www.BimCad.org]深居浅出 AutoCAD 二次开发 214 Autodesk.AutoCAD.Colors.Color GridColor ( Autodesk.AutoCAD.DatabaseServices.GridLineType gridLineType, Autodesk.AutoCAD.DatabaseServices.RowType rowType ) 1、gridLineType 表格线类型 2、rowType 行类型 获得表格线颜色 Autodesk.AutoCAD.DatabaseServices.LineWeight GridLineWeight ( Autodesk.AutoCAD.DatabaseServices.GridLineType gridLineType, Autodesk.AutoCAD.DatabaseServices.RowType rowType ) 1、gridLineType 表格线类型 2、rowType 行类型 获得表格线宽 bool GridVisibility ( Autodesk.AutoCAD.DatabaseServices.GridLineType gridLineType, Autodesk.AutoCAD.DatabaseServices.RowType rowType ) 1、gridLineType 表格线类型 2、rowType 行类型 表格线是否可见 void SetAlignment ( Autodesk.AutoCAD.DatabaseServices.CellAlignment alignment, int rowTypes ) 1、alignment 对齐方式 2、rowTypes 行类型 设置对齐方式 void SetDataType ( Autodesk.AutoCAD.DatabaseServices.DataType nDataType, Autodesk.AutoCAD.DatabaseServices.UnitType nUnitType, Autodesk.AutoCAD.DatabaseServices.RowType rowTypes ) 1、nDataType 数据类型 2、nUnitType 单元类型 3、rowTypes 行类型 设置数据类型 void SetFormat ( string pFormat, Autodesk.AutoCAD.DatabaseServices.RowType rowTypes ) 1、pFormat 格式 2、rowTypes 行类型 设置格式 void SetGridLineWeight ( Autodesk.AutoCAD.DatabaseServices.LineWeight lineWeight, int gridLineTypes, int rowTypes ) 1、lineWeight 线宽 2、gridLineTypes 表格线类型 3、rowTypes 行类型 设置表格线宽 Autodesk.AutoCAD.DatabaseServices.UnitType UnitType rowType 行类型 设置单元类型 [www.BimCad.org]深居浅出 AutoCAD 二次开发 215 ( Autodesk.AutoCAD.DatabaseServices.RowType rowType ) 构造函数: 构造函数 参数解释 Table() [www.BimCad.org]深居浅出 AutoCAD 二次开发 216 (6.6) Dimension(标注) Dimension(标注)是 AutoCAD 中标注的基类。在图形设计中,标注是图形尺寸在图纸上的直观反映。 基本标注形式: 类定义: public abstract class Dimension : Entity { // Methods protected internal Dimension(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public void FieldFromMText(MText dimMText); public void FieldToMText(MText dimMText); public string FormatMeasurement(double measurement, string dimensionText); public void GenerateLayout(); public DimStyleTableRecord GetDimstyleData(); internal unsafe AcDbDimension* GetImpObj(); private static string ReadDimensionPrefix(string sysvar); private static string ReadDimensionSuffix(string sysvar); [return: MarshalAs(UnmanagedType.U1)] private static bool ReadSuppressAngularLeadingZeros(int value); [return: MarshalAs(UnmanagedType.U1)] private static bool ReadSuppressAngularTrailingZeros(int value); [return: MarshalAs(UnmanagedType.U1)] private static bool ReadSuppressLeadingZeros(int value); [return: MarshalAs(UnmanagedType.U1)] private static bool ReadSuppressTrailingZeros(int value); [return: MarshalAs(UnmanagedType.U1)] private static bool ReadSuppressZeroFeet(int value); [return: MarshalAs(UnmanagedType.U1)] private static bool ReadSuppressZeroFeetAndInches(int value); [www.BimCad.org]深居浅出 AutoCAD 二次开发 217 [return: MarshalAs(UnmanagedType.U1)] private static bool ReadSuppressZeroInches(int value); public void RecomputeDimensionBlock([MarshalAs(UnmanagedType.U1)] bool forceUpdate); public void RemoveTextField(); public void SetDimstyleData(DimStyleTableRecord style); private static string WriteDimensionPrefix(string sysvar, string prefix); private static string WriteDimensionSuffix(string sysvar, string suffix); private static int WriteSuppressAngularLeadingZeros(int previousValue, [MarshalAs(UnmanagedType.U1)] bool newValue); private static int WriteSuppressAngularTrailingZeros(int previousValue, [MarshalAs(UnmanagedType.U1)] bool newValue); private static int WriteSuppressLeadingZeros(int previousValue, [MarshalAs(UnmanagedType.U1)] bool newValue); private static int WriteSuppressTrailingZeros(int previousValue, [MarshalAs(UnmanagedType.U1)] bool newValue); private static int WriteSuppressZeroFeet(int previousValue, [MarshalAs(UnmanagedType.U1)] bool newValue); private static int WriteSuppressZeroInches(int previousValue, [MarshalAs(UnmanagedType.U1)] bool newValue); // Properties public virtual string AlternatePrefix { [Category("Alternate Units")] get; set; } public virtual string AlternateSuffix { [Category("Alternate Units")] get; set; } public virtual bool AltSuppressLeadingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Alternate Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool AltSuppressTrailingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Alternate Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool AltSuppressZeroFeet { [return: MarshalAs(UnmanagedType.U1)] [Category("Alternate Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool AltSuppressZeroInches { [return: MarshalAs(UnmanagedType.U1)] [Category("Alternate Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool AltToleranceSuppressLeadingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool AltToleranceSuppressTrailingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool AltToleranceSuppressZeroFeet { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool AltToleranceSuppressZeroInches { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Unitless)] public virtual double CenterMarkSize { [Category("Lines & Arrows")] get; } public virtual DimensionCenterMarkType CenterMarkType { [Category("Lines & Arrows")] get; } public virtual int Dimadec { [Category("Primary Units")] get; set; } public virtual bool Dimalt { [return: MarshalAs(UnmanagedType.U1)] [Category("Alternate Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimaltd { [Category("Alternate Units")] get; set; } [UnitType(UnitType.Unitless)] public virtual double Dimaltf { [Category("Alternate Units")] get; set; } [UnitType(UnitType.Unitless)] public virtual double Dimaltmzf { [Category("Alternate Units")] get; set; } public virtual string Dimaltmzs { [Category("Alternate Units")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimaltrnd { [Category("Alternate Units")] get; set; } public virtual int Dimalttd { [Category("Tolerances")] get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 218 public virtual int Dimalttz { [Category("Alternate Units")] get; set; } public virtual int Dimaltu { [Category("Alternate Units")] get; set; } public virtual int Dimaltz { [Category("Alternate Units")] get; set; } public virtual string Dimapost { [Category("Text")] get; set; } public virtual int Dimarcsym { [Category("Text")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimasz { [Category("Lines & Arrows")] get; set; } public virtual int Dimatfit { [Category("Alternate Units")] get; set; } public virtual int Dimaunit { [Category("Primary Units")] get; set; } public virtual int Dimazin { [Category("Alternate Units")] get; set; } public ObjectId Dimblk { [Category("Lines & Arrows")] get; virtual set; } public ObjectId Dimblk1 { [Category("Lines & Arrows")] get; virtual set; } public ObjectId Dimblk2 { [Category("Lines & Arrows")] get; virtual set; } public ObjectId DimBlockId { get; set; } public Point3d DimBlockPosition { [Category("Geometry")] get; } [UnitType(UnitType.Distance)] public virtual double Dimcen { [Category("Lines & Arrows")] get; set; } public virtual Color Dimclrd { [Category("Lines & Arrows")] get; set; } public virtual Color Dimclre { [Category("Lines & Arrows")] get; set; } public virtual Color Dimclrt { [Category("Text")] get; set; } public virtual int Dimdec { [Category("Primary Units")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimdle { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimdli { [Category("Geometry")] get; set; } public virtual char Dimdsep { [return: MarshalAs(UnmanagedType.U2)] [Category("Primary Units")] get; [param: MarshalAs(UnmanagedType.U2)] set; } public ObjectId DimensionStyle { [Category("Misc")] get; set; } public virtual string DimensionStyleName { [Category("Misc")] get; set; } public string DimensionText { [Category("Text")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimexe { [Category("Lines & Arrows")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimexo { [Category("Lines & Arrows")] get; set; } public virtual int Dimfrac { [Category("Text")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimfxlen { [Category("Lines & Arrows")] get; set; } public virtual bool DimfxlenOn { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Distance)] public virtual double Dimgap { [Category("Text")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public virtual double Dimjogang { [Category("Lines & Arrows")] get; set; } public virtual int Dimjust { [Category("Text")] get; set; } public virtual ObjectId Dimldrblk { [Category("Lines & Arrows")] get; set; } [UnitType(UnitType.Unitless)] public virtual double Dimlfac { [Category("Primary Units")] get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 219 public virtual bool Dimlim { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual ObjectId Dimltex1 { [Category("Lines & Arrows")] get; set; } public virtual ObjectId Dimltex2 { [Category("Lines & Arrows")] get; set; } public virtual ObjectId Dimltype { [Category("Lines & Arrows")] get; set; } public virtual int Dimlunit { [Category("Primary Units")] get; set; } public virtual LineWeight Dimlwd { [Category("Lines & Arrows")] get; set; } public virtual LineWeight Dimlwe { get; set; } [UnitType(UnitType.Unitless)] public virtual double Dimmzf { [Category("Primary Units")] get; set; } public virtual string Dimmzs { [Category("Primary Units")] get; set; } public virtual string Dimpost { [Category("Primary Units")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimrnd { [Category("Primary Units")] get; set; } public virtual bool Dimsah { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Unitless)] public virtual double Dimscale { [Category("Fit")] get; set; } public virtual bool Dimsd1 { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimsd2 { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimse1 { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimse2 { [return: MarshalAs(UnmanagedType.U1)] [Category("Lines & Arrows")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimsoxd { [return: MarshalAs(UnmanagedType.U1)] [Category("Fit")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimtad { [Category("Text")] get; set; } public virtual int Dimtdec { [Category("Tolerances")] get; set; } [UnitType(UnitType.Unitless)] public virtual double Dimtfac { [Category("Text")] get; set; } public virtual int Dimtfill { [Category("Text")] get; set; } public virtual Color Dimtfillclr { [Category("Text")] get; set; } public virtual bool Dimtih { [return: MarshalAs(UnmanagedType.U1)] [Category("Text")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimtix { [return: MarshalAs(UnmanagedType.U1)] [Category("Fit")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Unitless)] public virtual double Dimtm { [Category("Tolerances")] get; set; } public virtual int Dimtmove { [Category("Fit")] get; set; } public virtual bool Dimtofl { [return: MarshalAs(UnmanagedType.U1)] [Category("Fit")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimtoh { [return: MarshalAs(UnmanagedType.U1)] [Category("Text")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool Dimtol { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimtolj { [Category("Tolerances")] get; set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 220 [UnitType(UnitType.Unitless)] public virtual double Dimtp { [Category("Tolerances")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimtsz { [Category("Lines & Arrows")] get; set; } [UnitType(UnitType.Unitless)] public virtual double Dimtvp { [Category("Lines & Arrows")] get; set; } [UnitType(UnitType.Distance)] public virtual double Dimtxt { [Category("Text")] get; set; } public virtual bool Dimtxtdirection { [return: MarshalAs(UnmanagedType.U1)] [Category("Text")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimtzin { [Category("Text")] get; set; } public virtual bool Dimupt { [return: MarshalAs(UnmanagedType.U1)] [Category("Text")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Dimzin { [Category("Text")] get; set; } public bool DynamicDimension { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Distance)] public double Elevation { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double HorizontalRotation { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public double Measurement { [Category("Text")] get; } public Vector3d Normal { [Category("Geometry")] get; set; } public virtual string Prefix { [Category("Primary Units")] get; set; } public virtual string Suffix { [Category("Primary Units")] get; set; } public virtual bool SuppressAngularLeadingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Primary Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool SuppressAngularTrailingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Primary Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool SuppressLeadingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Primary Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool SuppressTrailingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Primary Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool SuppressZeroFeet { [return: MarshalAs(UnmanagedType.U1)] [Category("Primary Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool SuppressZeroInches { [return: MarshalAs(UnmanagedType.U1)] [Category("Primary Units")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public AttachmentPoint TextAttachment { [Category("Geometry")] get; set; } [UnitType(UnitType.Unitless)] public double TextLineSpacingFactor { [Category("Misc")] get; set; } public LineSpacingStyle TextLineSpacingStyle { [Category("Misc")] get; set; } public Point3d TextPosition { [Category("Text")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double TextRotation { [Category("Text")] get; set; } public virtual ObjectId TextStyleId { [Category("Text")] get; set; } public virtual bool ToleranceSuppressLeadingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 221 public virtual bool ToleranceSuppressTrailingZeros { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool ToleranceSuppressZeroFeet { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool ToleranceSuppressZeroInches { [return: MarshalAs(UnmanagedType.U1)] [Category("Tolerances")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool UsingDefaultTextPosition { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; [param: MarshalAs(UnmanagedType.U1)] set; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 222 (6.6.1) AlignedDimension(对齐标注) 类定义: public class AlignedDimension : Dimension { // Methods public AlignedDimension(); protected internal AlignedDimension(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public AlignedDimension(Point3d line1Point, Point3d line2Point, Point3d dimensionLinePoint, string dimensionText, ObjectId dimensionStyle); internal unsafe AcDbAlignedDimension* GetImpObj(); // Properties public Point3d DimLinePoint { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double Oblique { [Category("Geometry")] get; set; } public Point3d XLine1Point { [Category("Geometry")] get; set; } public Point3d XLine2Point { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 说明 DimLinePoint Point3d 标注线定位点 Oblique double 角度 XLine1Point Point3d 标注点 1 XLine2Point Point3d 标注点 2 构造函数: 构造函数 参数解释 AlignedDimension() AlignedDimension ( Point3d line1Point, Point3d line2Point, 1、line1Point 标注点 1 2、line2Point 标注点 2 3、dimensionLinePoint 标注线定位点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 223 Point3d dimensionLinePoint, string dimensionText, ObjectId dimensionStyle ) 4、dimensionText 标注文字 5、dimensionStyle 标注样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 224 (6.6.2) ArcDimension(弧长标注) 类定义: public class ArcDimension : Dimension { // Methods protected internal ArcDimension(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public ArcDimension(Point3d centerPoint, Point3d xLine1Point, Point3d xLine2Point, Point3d arcPoint, string dimensionText, ObjectId dimensionStyle); internal unsafe AcDbArcDimension* GetImpObj(); // Properties [UnitType(UnitType.AngleNotTransformed)] public double ArcEndParam { [Category("Geometry")] get; set; } public Point3d ArcPoint { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double ArcStartParam { [Category("Geometry")] get; set; } public int ArcSymbolType { [Category("Text")] get; set; } public Point3d CenterPoint { [Category("Geometry")] get; set; } public bool HasLeader { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public bool IsPartial { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Point3d Leader1Point { [Category("Geometry")] get; set; } public Point3d Leader2Point { [Category("Geometry")] get; set; } public Point3d XLine1Point { [Category("Geometry")] get; set; } public Point3d XLine2Point { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 说明 ArcStartParam double 圆弧起点段比 [www.BimCad.org]深居浅出 AutoCAD 二次开发 225 ArcEndParam double 圆弧终点段比 ArcPoint Point3d 标注定位点 ArcSymbolType int 圆弧样式 0 表示标注前面加“弧” 1 表明标注前面加弧的符号 2 表示不加标识 VerticalCellMargin double 单元格垂直边界 CenterPoint Point3d 圆心 HasLeader bool 是否有说明引线 IsPartial bool 是否是局部的(今后会起作用) Leader1Point Point3d 标注说明的额外点 1 Leader2Point Point3d 标注说明的额外点 2 XLine1Point Point3d 标注起点 XLine2Point Point3d 标注终点 构造函数: 构造函数 参数解释 ArcDimension ( Point3d centerPoint, Point3d xLine1Point, Point3d xLine2Point, Point3d arcPoint, string dimensionText, ObjectId dimensionStyle ) 1、centerPoint 圆心 2、xLine1Point 标注起点 3、xLine2Point 标注终点 4、arcPoint 标注线定位点 5、dimensionText 标注文本 (若为空则显示实际标注内容) 6、dimensionStyle 标注样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 226 (6.6.3) RotatedDimension(转角标注) 类定义: public class RotatedDimension : Dimension { // Methods public RotatedDimension(); protected internal RotatedDimension(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public RotatedDimension(double rotation, Point3d line1Point, Point3d line2Point, Point3d dimensionLinePoint, string dimensionText, ObjectId dimensionStyle); internal unsafe AcDbRotatedDimension* GetImpObj(); // Properties public Point3d DimLinePoint { [Category("Geometry")] get; set; } [Category("Geometry"), UnitType(UnitType.AngleNotTransformed)] public double Oblique { get; set; } [UnitType(UnitType.AngleNotTransformed), Category("Geometry")] public double Rotation { get; set; } public Point3d XLine1Point { [Category("Geometry")] get; set; } public Point3d XLine2Point { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 说明 DimLinePoint Point3d 标注线定位点 Rotation double 转角 Oblique double 标注转角 XLine1Point Point3d 标注起点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 227 XLine2Point Point3d 标注终点 构造函数: 构造函数 参数解释 RotatedDimension() RotatedDimension ( double rotation, Point3d line1Point, Point3d line2Point, Point3d dimensionLinePoint, string dimensionText, ObjectId dimensionStyle ) 1、rotation 转角 2、line1Point 标注点 1 3、line2Point 标注点 2 4、dimensionLinePoint 标注线定位点 4、dimensionText 标注文字替换(若为空则显示实际标注内容) 5、dimensionStyle 标注样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 228 (6.6.4) DiametricDimension (直径标注) 类定义: public class DiametricDimension : Dimension { // Methods public DiametricDimension(); protected internal DiametricDimension(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public DiametricDimension(Point3d chordPoint, Point3d farChordPoint, double leaderLength, string dimensionText, ObjectId dimensionStyle); internal unsafe AcDbDiametricDimension* GetImpObj(); // Properties public Point3d ChordPoint { [Category("Geometry")] get; set; } public Point3d FarChordPoint { [Category("Geometry")] get; set; } [UnitType(UnitType.Distance)] public double LeaderLength { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 说明 Center Point3d 圆心 FarChordPoint Point3d 标注线定位点 LeaderLength double 引线长度 构造函数: 构造函数 参数解释 DiametricDimension() DiametricDimension ( Point3d chordPoint, Point3d farChordPoint, double leaderLength, string dimensionText, 1、chordPoint 圆心 2、farChordPoint 标注线定位点 3、leaderLength 引线长度 4、dimensionText 标注文字替换(若为空则显示实际标注内容) 5、dimensionStyle 标注样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 229 ObjectId dimensionStyle ) [www.BimCad.org]深居浅出 AutoCAD 二次开发 230 (6.6.5) RadialDimension(半径标注) 类定义: public class RadialDimension : Dimension { // Methods public RadialDimension(); protected internal RadialDimension(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public RadialDimension(Point3d center, Point3d chordPoint, double leaderLength, string dimensionText, ObjectId dimensionStyle); internal unsafe AcDbRadialDimension* GetImpObj(); // Properties public Point3d Center { [Category("Geometry")] get; set; } public Point3d ChordPoint { [Category("Geometry")] get; set; } [Category("Geometry"), UnitType(UnitType.Distance)] public double LeaderLength { get; set; } } 属性: 属性 数据类型 说明 Center Point3d 圆心 ChordPoint Point3d 标注线定位点 LeaderLength double 引线长度 构造函数: 构造函数 参数解释 RadialDimension() RadialDimension ( Point3d center, Point3d chordPoint, double leaderLength, string dimensionText, ObjectId dimensionStyle 1、center 圆心 2、chordPoint 标注线定位点 3、leaderLength 引线长度 4、dimensionText 标注文字替换(若为空则显示实际标注内容) 5、dimensionStyle 标注样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 231 ) [www.BimCad.org]深居浅出 AutoCAD 二次开发 232 (6.6.6) OrdinateDimension(坐标标注) 类定义: public class OrdinateDimension : Dimension { // Methods public OrdinateDimension(); protected internal OrdinateDimension(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public OrdinateDimension([MarshalAs(UnmanagedType.U1)] bool useXAxis, Point3d definingPoint, Point3d leaderEndPoint, string dimText, ObjectId dimStyle); internal unsafe AcDbOrdinateDimension* GetImpObj(); // Properties [Category("Geometry")] public Point3d DefiningPoint { get; set; } [Category("Geometry")] public Point3d LeaderEndPoint { get; set; } [Category("Geometry")] public Point3d Origin { get; set; } [Category("Geometry")] public bool UsingXAxis { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } [Category("Geometry")] public bool UsingYAxis { [return: MarshalAs(UnmanagedType.U1)] get; } } 属性: 属性 数据类型 说明 Origin Point3d 原点 UsingXAxis bool 标注线 1 起点 UsingYAxis bool 标注线 1 终点 DefiningPoint Point3d 标注点 LeaderEndPoint Point3d 引线终点 构造函数: 构造函数 参数解释 [www.BimCad.org]深居浅出 AutoCAD 二次开发 233 OrdinateDimension() OrdinateDimension ( bool useXAxis, Point3d definingPoint, Point3d leaderEndPoint, string dimText, ObjectId dimStyle ) 1、useXAxis 坐标轴,true 为标注 X 轴坐标,false 为标注 Y 轴坐标 2、definingPoint 标注点 3、leaderEndPoint 引线定位点 4、dimText 标注文字替换(若为空则显示实际标注内容) 5、dimensionStyle 标注样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 234 (6.6.7) LineAngularDimension2(角度标注) 类定义: public class LineAngularDimension2 : Dimension { // Methods public LineAngularDimension2(); protected internal LineAngularDimension2(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public LineAngularDimension2(Point3d line1Start, Point3d line1End, Point3d line2Start, Point3d line2End, Point3d arcPoint, string dimensionText, ObjectId dimensionStyle); internal unsafe AcDb2LineAngularDimension* GetImpObj(); // Properties public Point3d ArcPoint { [Category("Geometry")] get; set; } public Point3d XLine1End { [Category("Geometry")] get; set; } public Point3d XLine1Start { [Category("Geometry")] get; set; } public Point3d XLine2End { [Category("Geometry")] get; set; } public Point3d XLine2Start { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 说明 ArcPoint Point3d 标注线定位点 XLine1Start Point3d 标注线 1 起点 XLine1End Point3d 标注线 1 终点 XLine2Start Point3d 标注线 2 起点 XLine2End Point3d 标注线 2 终点 构造函数: 构造函数 参数解释 LineAngularDimension2() [www.BimCad.org]深居浅出 AutoCAD 二次开发 235 LineAngularDimension2 ( Point3d line1Start, Point3d line1End, Point3d line2Start, Point3d line2End, Point3d arcPoint, string dimensionText, ObjectId dimensionStyle ) 1、line1Start 标注线 1 起点 2、line1End 标注线 1 终点 3、line2Start 标注线 2 起点 4、line2End 标注线 2 终点 5、arcPoint 标注点定位点 6、dimensionText 标注文字替换(若为空则显示实际标注内容) 7、dimensionStyle 标注样式 Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 236 (6.7) Region (面域) 面域是具有物理特性(例如形心或质量中心)的使用形成闭合环的对象创建的二维闭合区域。环可以由 Line、Arc、Ellipse、 Circle、Spline、Polyline3d、Polyline2d 组合。组成环的对象必须闭合或通过与其他对象共享端点而形成闭合的区域,面 域可用于应用填充和着色以及分析特性(例如面积),也可以通过布尔运算,求面域之间的交、并、差集,将现有面域组合成 单个、复杂的面域。 类定义: public class Region : Entity { // Methods public Region(); protected internal Region(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void BooleanOperation(BooleanOperationType operation, Region otherRegion); public static DBObjectCollection CreateFromCurves(DBObjectCollection curveSegments); internal unsafe AcDbRegion* GetImpObj(); // Properties [Category("Geometry"), UnitType(UnitType.Area)] public virtual double Area { get; } public virtual IntPtr Body { get; set; } public virtual bool IsNull { [return: MarshalAs(UnmanagedType.U1)] get; } public virtual Vector3d Normal { [Category("Geometry")] get; } public virtual int NumChanges { [Category("Misc")] get; } [UnitType(UnitType.Distance), Category("Geometry")] public virtual double Perimeter { get; } } 属性: 属性 数据类型 意义 Area double 面积(只读) Body IntPtr 形体(内部使用) IsNull bool 是否为空(只读) Normal Vector3d 法向单位向量(只读) NumChanges int 变化次数(只读) Perimeter double 周长(只读) 方法: [www.BimCad.org]深居浅出 AutoCAD 二次开发 237 void BooleanOperation ( BooleanOperationType operation, Region otherRegion ) 1、operation 布尔运算方式 2、otherRegion 参与运算的面域 面域布尔运算 DBObjectCollection CreateFromCurves ( DBObjectCollection curveSegments ) curveSegments 基本曲线段几何 由曲线段集合创建面域 *面域布尔运算: 并集: 差集: [www.BimCad.org]深居浅出 AutoCAD 二次开发 238 交集: 构造函数: 构造函数 参数描述 Region() [www.BimCad.org]深居浅出 AutoCAD 二次开发 239 (6.8) Surface (表面) Surface (表面)AutoCAD 中所有表面对象的基类。 类定义: public class Surface : Entity { // Methods public Surface(); protected internal Surface(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual Entity[] BooleanIntersect(Solid3d solid); public virtual Entity[] BooleanIntersect(Surface surface2); public virtual Surface BooleanSubtract(Solid3d solid); public virtual Surface BooleanSubtract(Surface surface2); public virtual Surface BooleanUnion(Surface surface2); public virtual void ChamferEdges(SubentityId[] subentityIds, SubentityId baseSubentityId, double baseDist, double otherDist); public virtual Entity[] ConvertToRegion(); public static Surface CreateFrom(Entity fromEntity); public virtual Entity[] CreateInterferenceObjects(Entity ent, int flags); public virtual Entity[] CreateSectionObjects(Plane sectionPlane); public virtual void FilletEdges(SubentityId[] subentityIds, DoubleCollection radius, DoubleCollection startSetback, DoubleCollection endSetback); public virtual double GetArea(); internal unsafe AcDbSurface* GetImpObj(); public virtual Color GetSubentityColor(SubentityId subEntityId); public virtual ObjectId GetSubentityMaterial(SubentityId subEntityId); public virtual Mapper GetSubentityMaterialMapper(SubentityId subEntityId); public virtual void ImprintEntity(Entity entityToImprint); public virtual void SetSubentityColor(SubentityId subEntityId, Color color); public virtual void SetSubentityMaterial(SubentityId subEntityId, ObjectId materialId); public virtual void SetSubentityMaterialMapper(SubentityId subEntityId, Mapper mapper); public virtual SurfaceSliceResults SliceByPlane(Plane slicePlane); public virtual SurfaceSliceResults SliceBySurface(Surface slicingSurface); public virtual Solid3d Thicken(double thickness, [MarshalAs(UnmanagedType.U1)] bool bothSides); // Properties public short UIsoLineDensity { [Category("Geometry")] get; set; } public short VIsoLineDensity { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 意义 IsNormalReversed bool True:partialU.crossProduct(partialV).normalize()为负 False:partialU.crossProduct(partialV).normalize() 为正(只读) 方法: 方法 参数 作用 SurfaceSliceResults slicingSurface 剪切表面 被 slicingSurface 剪切表面剪切所得到的表面 [www.BimCad.org]深居浅出 AutoCAD 二次开发 240 SliceBySurface ( Autodesk.AutoCAD.DatabaseServices.Surface slicingSurface ) SurfaceSliceResults SliceByPlane ( Plane slicePlane ) slicePlane 剪切平面 被 slicePlane 剪切平面剪切所得到的表面 Entity[] CreateSectionObjects ( Plane sectionPlane ) sectionPlane 截面平面 创建截面 Entity[] ConvertToRegion() 转换成面域 Surface CreateFrom(Entity fromEntity) fromEntity 构成表面的对象 fromEntity 由对象创建表面 double GetArea() 获得表面积 Entity[] BooleanIntersect(Solid3d solid) Solid 三维实体 表面与三维实体 solid 的交集 Entity[] BooleanIntersect(Surface surface2) surface2 表面 表面与表面 surface2 的交集 Surface BooleanSubtract(Solid3d solid) Solid 三维实体 表面与三维实体 solid 的差集 Surface BooleanUnion(Surface surface2) surface2 表面 表面与表面 surface2 的并集 [www.BimCad.org]深居浅出 AutoCAD 二次开发 241 (6.8.1) ExtrudedSurface(拉伸表面) 类定义: public class ExtrudedSurface : Surface { // Methods public ExtrudedSurface(); protected internal ExtrudedSurface(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void CreateExtrudedSurface(Entity sweepEnt, Vector3d directionVec, SweepOptions sweepOptions); internal unsafe AcDbExtrudedSurface* GetImpObj(); public void SetExtrude(Vector3d sweepVec, SweepOptions sweepOptions); // Properties [UnitType(UnitType.Distance)] public double Height { [Category("Geometry")] get; set; } public Entity SweepEntity { get; } public SweepOptions SweepOptions { get; set; } public Vector3d SweepVec { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed)] public double TaperAngle { [Category("Geometry")] get; set; } } 属性: 属性 数据类型 意义 Height double 拉伸高度 SweepEntity Entity 拉伸面(只读) SweepOptions Autodesk.AutoCAD.DatabaseServices.SweepOptions 拉伸选项 SweepVec Vector3d 拉伸向量 TaperAngle double 拉伸倾斜角 方法: 方法 参数 作用 void 1、sweepEnt 拉伸对象 创建拉伸表面 [www.BimCad.org]深居浅出 AutoCAD 二次开发 242 CreateExtrudedSurface ( Entity sweepEnt, Vector3d directionVec, Autodesk.AutoCAD.DatabaseServices.SweepOptions sweepOptions ) 2、directionVec 拉伸向量 3、sweepOptions 拉伸选项 void SetExtrude ( Vector3d sweepVec, Autodesk.AutoCAD.DatabaseServices.SweepOptions sweepOptions ) 1、sweepVec 拉伸向量 2、sweepOptions 拉伸选项 设置拉伸参数 [www.BimCad.org]深居浅出 AutoCAD 二次开发 243 (6.8.2) LoftedSurface (放样表面) 类定义: public class LoftedSurface : Surface { // Methods public LoftedSurface(); protected internal LoftedSurface(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void CreateLoftedSurface(Entity[] crossSections, Entity[] guideCurves, Entity pathCurve, LoftOptions loftOptions); internal unsafe AcDbLoftedSurface* GetImpObj(); // Properties public bool Closed { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Entity[] CrossSections { [Category("Geometry")] get; } public Entity[] GuideCurves { [Category("Geometry")] get; } public LoftOptions LoftOptions { [Category("Misc")] get; set; } public int NumberOfCrossSections { [Category("Geometry")] get; } public Entity PathEntity { [Category("Geometry")] get; } } 属性: 属性 数据类型 意义 Closed bool 表面闭合状态 GuideCurves Entity 导线(只读) LoftOptions Autodesk.AutoCAD.DatabaseServices.LoftOptions 放样选项 NumberOfCrossSections int 变化截面数 PathEntity Entity 路径对象 方法: 方法 参数 作用 void CreateLoftedSurface ( Entity[] crossSections, Entity[] guideCurves, 1、crossSections 变化截面集合 2、guideCurves 导线 3、pathCurve 路径曲线 4、loftOptions 放样选项 创建放样表面 [www.BimCad.org]深居浅出 AutoCAD 二次开发 244 Entity pathCurve, Autodesk.AutoCAD.DatabaseServices.LoftOptions loftOptions ) (6.8.3) PlaneSurface(平面表面) 类定义: public class PlaneSurface : Surface { // Methods public PlaneSurface(); protected internal PlaneSurface(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void CreateFromRegion(Region region); internal unsafe AcDbPlaneSurface* GetImpObj(); } 方法: 方法 参数 作用 void CreateFromRegion ( Region region ) Region 面域 由面域创建表面 [www.BimCad.org]深居浅出 AutoCAD 二次开发 245 (6.8.4) RevolvedSurface (旋转表面) 类定义: public class RevolvedSurface : Surface { // Methods public RevolvedSurface(); protected internal RevolvedSurface(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void CreateRevolvedSurface(Entity revolveEntity, Point3d axisPoint, Vector3d axisDirection, double revolveAngle, double startAngle, RevolveOptions revolveOptions); internal unsafe AcDbRevolvedSurface* GetImpObj(); public void SetRevolve(Point3d axisPoint, Vector3d axisDirection, double revolveAngle, RevolveOptions revolveOptions); // Properties public Vector3d AxisDirection { [Category("Geometry")] get; set; } public Point3d AxisPoint { [Category("Geometry")] get; set; } [Category("Geometry"), UnitType(UnitType.AngleNotTransformed)] public double RevolveAngle { get; set; } public Entity RevolveEntity { get; } public RevolveOptions RevolveOptions { [Category("Geometry")] get; set; } [UnitType(UnitType.AngleNotTransformed), Category("Geometry")] public double StartAngle { get; } } 属性: 属性 数据类型 意义 AxisDirection Vector3d 旋转轴向量 AxisPoint Point3d 旋转轴经过点 RevolveAngle double 旋转角度 StartAngle double 起始旋转角 [www.BimCad.org]深居浅出 AutoCAD 二次开发 246 RevolveOptions Autodesk.AutoCAD.DatabaseServices.RevolveOptions 旋转选项 RevolveEntity Entity 旋转对象 方法: 方法 参数 作用 void CreateRevolvedSurface ( Entity revolveEntity, Point3d axisPoint, Vector3d axisDirection, double revolveAngle, double startAngle, Autodesk.AutoCAD.DatabaseServices.RevolveOptions revolveOptions ) 1、revolveEntity 旋转对象 2、axisPoint 旋转轴经过点 3、axisDirection 旋转轴向量 4、revolveAngle 旋转角度 5、startAngle 旋转起始角度 6、revolveOptions 旋转选项 创建旋转表面 void SetRevolve ( Point3d axisPoint, Vector3d axisDirection, double revolveAngle, Autodesk.AutoCAD.DatabaseServices.RevolveOptions revolveOptions ) 1、axisPoint 旋转轴经过点 2、axisDirection 旋转轴向量 3、revolveAngle 旋转角度 4、revolveOptions 旋转选项 设置旋转表面属性 [www.BimCad.org]深居浅出 AutoCAD 二次开发 247 (6.8.5) SweptSurface (扫掠表面) 类定义: public class SweptSurface : Surface { // Methods public SweptSurface(); protected internal SweptSurface(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void CreateSweptSurface(Entity sweepEnt, Entity pathEnt, SweepOptions sweepOptions); internal unsafe AcDbSweptSurface* GetImpObj(); // Properties public bool Bank { [return: MarshalAs(UnmanagedType.U1)] [Category("Geometry")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public Entity PathEntity { get; } [UnitType(UnitType.Distance)] public double PathLength { [Category("Geometry")] get; } [UnitType(UnitType.AngleNotTransformed), Category("Geometry")] public double ProfileRotation { get; set; } [Category("Geometry"), UnitType(UnitType.Unitless)] public double ScaleAlongPath { get; set; } public Entity SweepEntity { get; } public SweepOptions SweepOptions { get; set; } [UnitType(UnitType.AngleNotTransformed), Category("Geometry")] public double TwistAlongPath { get; set; } } 属性: 属性 数据类型 意义 Bank bool 扫掠面或线的边,是否沿着路径线 PathEntity Entity 扫掠路径(只读) PathLength double 路径长度(只读) ProfileRotation double 扫掠面倾斜角 ScaleAlongPath double 扫掠路径缩放比例 SweepEntity Entity 扫掠对象 SweepOptions Autodesk.AutoCAD.DatabaseServices.SweepOptions 扫掠选项 [www.BimCad.org]深居浅出 AutoCAD 二次开发 248 TwistAlongPath double 扫掠面旋转角 方法: 方法 参数 作用 void CreateSweptSurface ( Entity sweepEnt, Entity pathEnt, Autodesk.AutoCAD.DatabaseServices.SweepOptions sweepOptions ) 1、sweepEnt 扫掠对象 2、pathEnt 扫掠路径 3、sweepOptions 扫掠选项 创建扫掠表面 [www.BimCad.org]深居浅出 AutoCAD 二次开发 249 (6.9) Solid3d (三维实体) 实体对象不仅包括对象的边界和表面,还包括对象的质量、体积和质心等特性。使用实体对象构建模型比平面对象更直观、 信息更完整、歧义更少。Solid3d 模型可以做碰撞检查、三维算量,还可以通过 AutoCAD 输出实体模型的数据,提供给计算机辅 助制造程序使用或进行有限元分析。 AutoCAD 提供了多种预定义的三维实体对象,包括长方体、圆锥体、棱锥体、圆柱体、球体、楔体和圆环体等。除了预定义 的三维实体对象之外,还可以将二维对象延伸或旋转来定义新的实体对象,也可以使用并、差和交等布尔操作创建各种组合实体。 类定义: public class Solid3d : Entity { // Methods public Solid3d(); protected internal Solid3d(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void BooleanOperation(BooleanOperationType operation, Solid3d solid); public virtual void ChamferEdges(SubentityId[] subentityIds, SubentityId baseSubentityId, double baseDist, double otherDist); [return: MarshalAs(UnmanagedType.U1)] public virtual bool CheckInterference(Solid3d otherSolid); public virtual void CleanBody(); public virtual void ConvertToBrepAtSubentPaths(FullSubentityPath[] paths); public virtual Entity CopyEdge(SubentityId subEntityId); public virtual Entity CopyFace(SubentityId subEntityId); public virtual void CreateBox(double lengthAlongX, double lengthAlongY, double lengthAlongZ); public virtual void CreateExtrudedSolid(Entity sweepEntity, Vector3d directionVector, SweepOptions sweepOptions); public virtual void CreateExtrudedSolid(Entity sweepEntity, SubentityId faceSubEntityId, Vector3d directionVector, SweepOptions sweepOptions); public virtual void CreateExtrudedSolid(Entity sweepEntity, SubentityId faceSubEntityId, double height, SweepOptions sweepOptions); [www.BimCad.org]深居浅出 AutoCAD 二次开发 250 public virtual void CreateFrom(Entity fromEntity); public virtual void CreateFrustum(double height, double radiusAlongX, double radiusAlongY, double topRadius); public virtual void CreateLoftedSolid(Entity[] crossSectionCurves, Entity[] guideCurves, Entity pathCurve, LoftOptions loftOptions); public virtual void CreatePyramid(double height, int sides, double radius, double topRadius); public virtual void CreateRevolvedSolid(Entity profileEntity, Point3d axisPoint, Vector3d axisDir, double angleOfRevolution, double startAngle, RevolveOptions revolveOptions); public virtual void CreateRevolvedSolid(Entity profileEntity, SubentityId faceSubEntityId, Point3d axisPoint, Vector3d axisDir, double angleOfRevolution, double startAngle, RevolveOptions revolveOptions); public virtual void CreateSphere(double radius); public virtual void CreateSweptSolid(Entity sweepEntity, Entity pathEntity, SweepOptions sweepOptions); public virtual void CreateSweptSolid(Entity sweepEntity, SubentityId faceSubEntityId, Entity pathEntity, SweepOptions sweepOptions); public virtual void CreateTorus(double majorRadius, double minorRadius); public virtual void CreateWedge(double lengthAlongX, double lengthAlongY, double lengthAlongZ); public virtual void Extrude(Region region, double height, double taperAngle); public virtual void ExtrudeAlongPath(Region region, Curve path, double taperAngle); public virtual void ExtrudeFaces(SubentityId[] subentityIds, double height, double taper); public virtual void ExtrudeFacesAlongPath(SubentityId[] subentityIds, Curve path); public virtual void FilletEdges(SubentityId[] subentityIds, DoubleCollection radius, DoubleCollection startSetback, DoubleCollection endSetback); internal unsafe AcDb3dSolid* GetImpObj(); public virtual Region GetSection(Plane plane); public virtual Color GetSubentityColor(SubentityId subEntityId); public virtual ObjectId GetSubentityMaterial(SubentityId subEntityId); public virtual Mapper GetSubentityMaterialMapper(SubentityId subEntityId); public virtual void ImprintEntity(Entity entity); public virtual void OffsetBody(double offsetDistance); public virtual void OffsetFaces(SubentityId[] subentityIds, double offsetDistance); public virtual void RemoveFaces(SubentityId[] subentityIds); public virtual void Revolve(Region region, Point3d axisPoint, Vector3d axisDir, double angleOfRevolution); public virtual Solid3d[] SeparateBody(); public virtual void SetSubentityColor(SubentityId subEntityId, Color color); public virtual void SetSubentityMaterial(SubentityId subEntityId, ObjectId materialId); public virtual void SetSubentityMaterialMapper(SubentityId subEntityId, Mapper mapper); public virtual void ShellBody(SubentityId[] subentityIds, double offsetDistance); public virtual void Slice(Surface surface); public virtual void Slice(Plane plane); public virtual Solid3d Slice(Surface surface, [MarshalAs(UnmanagedType.U1)] bool negativeHalfToo); public virtual Solid3d Slice(Plane plane, [MarshalAs(UnmanagedType.U1)] bool negativeHalfToo); public virtual void StlOut(string fileName, [MarshalAs(UnmanagedType.U1)] bool asciiFormat); public virtual void TaperFaces(SubentityId[] subentityIds, Point3d basePoint, Vector3d draftVector, double draftAngle); public virtual void TransformFaces(SubentityId[] subentityIds, Matrix3d matrix); // Properties [UnitType(UnitType.Area)] public virtual double Area { [Category("Geometry")] get; } public virtual bool IsNull { [return: MarshalAs(UnmanagedType.U1)] get; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 251 public virtual Solid3dMassProperties MassProperties { [Category("Misc")] get; } public virtual int NumChanges { [Category("Misc")] get; } public virtual bool RecordHistory { [return: MarshalAs(UnmanagedType.U1)] [Category("Solid History")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual bool ShowHistory { [return: MarshalAs(UnmanagedType.U1)] [Category("Solid History")] get; [param: MarshalAs(UnmanagedType.U1)] set; } } 属性: 属性 数据类型 意义 Area double 表面积(只读) MassProperties Solid3dMassProperties 特性(只读) IsNull bool 是否为空(只读) RecordHistory bool 是否有历史记录 NumChanges int 变化次数(只读) ShowHistory bool 系统变量 SHOWHIST 为 1 时历史记录是否显示 方法: 方法 参数 作用 void BooleanOperation ( BooleanOperationType operation, Solid3d solid ) 1、operation 布尔运算方式 2、solid 参与运算的面域 布尔运算 bool CheckInterference ( Solid3d otherSolid ) otherSolid 三维实体 检查是否相交(碰撞检查) void CleanBody() 清理对象多余的面及边 Entity CopyEdge ( SubentityId subEntityId ) subEntityId 边对象 ObjectId 获取对象边对象(结果可能是:Line, AcDbCircle, AcDbArc, Ellipse, 或者 AcDbSpline,拷贝后子对 象的 color, layer, linetype, lineweight 随当前文档 相应设置 Entity CopyFace ( SubentityId subEntityId ) subEntityId 面对象 ObjectId 获取对象面对象(平面边界返回 Region 对象,曲 面边界返回 Body 拷贝后子对象的 color, layer, linetype, lineweight 随当前文档相应设置) Region GetSection ( Plane plane ) Plane 剖切平面 获得截面面域 Autodesk.AutoCAD.Colors.Color GetSubentityColor ( subEntityId 子实体 ObjectId 获得子实体颜色 [www.BimCad.org]深居浅出 AutoCAD 二次开发 252 SubentityId subEntityId ) void SetSubentityColor ( SubentityId subEntityId, Autodesk.AutoCAD.Colors.Color color ) 1、subEntityId 子实体 Id 2、Autodesk.AutoCAD.Colors.Color color 颜色 设置子实体颜色 ObjectId GetSubentityMaterial ( SubentityId subEntityId ) subEntityId 子实体 ObjectId 获得子实体材料 ObjectId void SetSubentityMaterial ( SubentityId subEntityId, ObjectId materialId ) 1、subEntityId 子实体 Id 2、materialId 材料 Id 设置子实体材料 void ImprintEntity ( Entity entity ) This method intersects the given entity with the solid and imprints their intersection graph onto the solid. If a closed loop of new edges is created, a new face is made. An open loop of edges can be added as a spur to an existing loop on a face or as a slit in the face. The given entity must be a kind of Curve, Solid3d, Body, Region, Trace, bSolid, or Face. void OffsetBody ( double offsetDistance ) OffsetDistance 偏移距离 偏移三维实体 void OffsetFaces ( SubentityId[] subentityIds, double offsetDistance ) 1、subentityIds 面 Id 集合 2、offsetDistance 偏移距离 三维实体里面的面 void RemoveFaces ( SubentityId[] subentityIds ) subentityIds 面 Id 删除面 Solid3d[] SeparateBody() 分解三维实体,类似平面对象的炸开 void ShellBody ( SubentityId[] subentityIds, double offsetDistance [www.BimCad.org]深居浅出 AutoCAD 二次开发 253 ) void Slice ( Plane plane ) Plane 剖切平面 剖切三维实体 Solid3d Slice ( Plane plane, bool negativeHalfToo ) 1、plane 剖切平面 2、negativeHalfToo void StlOut ( string fileName, bool asciiFormat ) 1、fileName 文件名 2、asciiFormat 如果为 ture 以 ascii 方式写文本,如果为 false 以二进制 码方式写文本 生产三维对象数据文件 void TransformFaces ( SubentityId[] subentityIds, Matrix3d matrix ) 1、subentityIds 子面实体 Id 2、matrix 变形矩阵 子面实体变形(当系统变量 SOLIDCHECK 为 1 时, 会检测出变形的方式不对时此函数返回无效实 体) void CreateBox ( double lengthAlongX, double lengthAlongY, double lengthAlongZ ) 1、lengthAlongX X 轴方向长度 2、lengthAlongY Y 轴方向长度 3、lengthAlongZ Z 轴方向长度 构造长方体 void CreateFrustum ( double height, double radiusAlongX, double radiusAlongY, double topRadius ) 1、height 高度 2、radiusAlongX 底面 X 方向半径 3、radiusAlongY 底面 Y 方向半径 4、topRadius 顶面半径 (锥体设为 0,柱体与底面设为一样) 构造:圆锥、椭圆锥、圆台、椭圆台、圆柱、椭 圆柱 void CreatePyramid ( double height, int sides, double radius, double topRadius ) 1、height 高度 2、sides 上下底面多边形变数(大于 3 才能形成闭合环) 3、radius 底面外截圆半径 4、topRadius 顶面外截圆半径(锥体 设为 0,柱体与底面设为一样) 构造:棱台、棱柱、棱锥 [www.BimCad.org]深居浅出 AutoCAD 二次开发 254 void CreateSphere ( double radius ) Radius 半径 构造球体 void CreateTorus ( double majorRadius, double minorRadius ) 1、majorRadius 主圆半径 2、minorRadius 环半径半径 构造圆环 void CreateWedge ( double lengthAlongX, double lengthAlongY, double lengthAlongZ ) 1、lengthAlongX 底面沿 X 轴长度 2、lengthAlongY 底面沿 Y 轴长度 3、lengthAlongZ 底面沿 Z 轴长度 构造楔体 void CreateExtrudedSolid ( Entity sweepEntity, Vector3d directionVector, SweepOptions sweepOptions ) 1、sweepEntity 拉伸对象 (封闭实体或面域) 2、directionVector 方向向量 3、sweepOptions 拉伸选项 构造拉伸实体 void CreateSweptSolid ( Entity sweepEntity, Entity pathEntity, SweepOptions sweepOptions ) 1、sweepEntity 拉伸对象 (封闭实体或面域) 2、pathEntity 路径 3、sweepOptions 拉伸选项 构造扫掠实体 void CreateRevolvedSolid ( Entity profileEntity, Point3d axisPoint, Vector3d axisDir, double angleOfRevolution, 1、profileEntity 旋转对象 (封闭实体或面域) 2、axisPoint 旋转轴上点 3、axisDir 旋转轴方向 4 、 angleOfRevolution 旋转角度 (0-2*PI) 构造旋转实体 [www.BimCad.org]深居浅出 AutoCAD 二次开发 255 double startAngle, RevolveOptions revolveOptions ) 5、startAngle 旋转起始角度 6、revolveOptions 旋转选项 Void CreateLoftedSolid ( Entity[] crossSectionCurves, Entity[] guideCurves, Entity pathCurve, LoftOptions loftOptions ) 1、crossSectionCurves 放样面集合 2、guideCurves 向导线集合 3、pathCurve 路径线 4、loftOptions 放样选项 构造放样三维实体 void Extrude ( Region region, double height, double taperAngle ) 1、region 被拉升面域 面域里面只能有 line, circle, arc 对 象连接 2、height 拉伸高度 3、taperAngle 倾斜角 (PI/2-PI/2) 拉伸面形成三维实体,可形成柱体(相当于 extrude 命令按照方向拉伸) void ExtrudeAlongPath ( Region region, Curve path, double taperAngle ) 1、region 被拉升面域 2、path 拉伸路径 (Line, DbArc, Circle, Ellipse, Spline, Polyline2d, 3dPolyline)路径不能自 交 3、taperAngle 倾斜角(PI/2-PI/2) 按照路径拉伸面形成三维实体,可形成扫掠实体 (相当于 extrude 命令按照路径拉伸) void Revolve ( Region region, Point3d axisPoint, Vector3d axisDir, double angleOfRevolution ) 1、region 旋转面域 2、axisPoint 旋转轴上点 旋转轴不能穿过旋转面域 3、axisDir 旋转轴方向 4、angleOfRevolution 旋转角度 (0-2*PI) 按照旋转轴旋转面域得到旋转体(相当于 revolve 命令) *三维实体布尔运算: [www.BimCad.org]深居浅出 AutoCAD 二次开发 256 并集 差集 交集: 构造函数: [www.BimCad.org]深居浅出 AutoCAD 二次开发 257 构造函数 参数描述 Solid3d() *默认构造出来的对象的基点都是在世界坐标系的原点,要修改对象的位置在构造的时候可以修改相关的“选项”参数 (sweepOptions、loftOptions、revolveOptions)的相关属性或通过修改 Entity 位置的 TransformBy()方法来改变构造出来的三维 实体的位置。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 258 (6.10) Body (形体) Body (形体) 是所有不被 Solid3d 或 Region 所覆盖的边界表示法(boundary representation)对象的类。 类定义: public class Body : Entity { // Methods public Body(); protected internal Body(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public static DBObjectCollection AcisIn(string fileName); public static void AcisOut(string fileName, DBObjectCollection entitiesOutToFile); internal unsafe AcDbBody* GetImpObj(); // Properties [Category("Misc")] public virtual IntPtr BodyPtr { get; set; } [Category("Misc")] public virtual bool IsNull { [return: MarshalAs(UnmanagedType.U1)] get; } [Category("Misc")] public virtual int NumChanges { get; } } 属性: 属性 数据类型 意义 NumChanges int 从被创建起被修改的次数(只读) IsNull bool 是否为空(只读) 方法: 方法 参数 作用 DBObjectCollection AcisIn ( string fileName ) fileName ASCII、ACIS、SAT 格式的数 据文件名 读取数据文件生成对象 void AcisOut ( string fileName, DBObjectCollection entitiesOutToFile ) 1、fileName ASCII、ACIS、SAT 格式 的数据文件名 2、entitiesOutToFile 只有 Region, Solid3d, Body 或者他们 的派生类才能写入信息到文件 将对象的数据信息写入到数据文件 [www.BimCad.org]深居浅出 AutoCAD 二次开发 259 (6.11) Hatch (填充) Hatch (填充)可以更加直观的表现图纸中对象的材质或者图形层次关系。 类定义: public class Hatch : Entity { // Methods public Hatch(); protected internal Hatch(IntPtr unmanagedObjPtr, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public void AppendLoop(HatchLoop hatchLoop); public void AppendLoop(HatchLoopTypes loopType, ObjectIdCollection dbObjIds); public Color EvaluateGradientColorAt(float value); public void EvaluateHatch([MarshalAs(UnmanagedType.U1)] bool underEstimateNumLines); public ObjectIdCollection GetAssociatedObjectIds(); public ObjectIdCollection GetAssociatedObjectIdsAt(int loopIndex); public GradientColor[] GetGradientColors(); public Line2d GetHatchLineDataAt(int index); public Line2dCollection GetHatchLinesData(); internal unsafe AcDbHatch* GetImpObj(); public HatchLoop GetLoopAt(int loopIndex); public PatternDefinition GetPatternDefinitionAt(int index); public void InsertLoopAt(int loopIndex, HatchLoop hatchLoop); public void InsertLoopAt(int loopIndex, HatchLoopTypes loopType, ObjectIdCollection dbObjIds); public HatchLoopTypes LoopTypeAt(int loopIndex); public void RemoveAssociatedObjectIds(); public void RemoveLoopAt(int loopIndex); public void SetGradient(GradientPatternType gradientType, string gradientName); public void SetGradientColors(GradientColor[] value); public void SetHatchPattern(HatchPatternType patternType, string patternName); private void SetReactors([MarshalAs(UnmanagedType.U1)] bool bAdd); // Properties [UnitType(UnitType.Area)] [www.BimCad.org]深居浅出 AutoCAD 二次开发 260 public double Area { [Category("Geometry")] get; } public bool Associative { [return: MarshalAs(UnmanagedType.U1)] [Category("Pattern")] get; [param: MarshalAs(UnmanagedType.U1)] set; } [UnitType(UnitType.Distance)] public double Elevation { [Category("Geometry")] get; set; } [UnitType(UnitType.Angle)] public double GradientAngle { [Category("Pattern")] get; set; } public string GradientName { [Category("Pattern")] get; } public bool GradientOneColorMode { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public float GradientShift { [Category("Misc")] get; set; } public GradientPatternType GradientType { [Category("Pattern")] get; } public HatchObjectType HatchObjectType { [Category("Misc")] get; set; } public HatchStyle HatchStyle { [Category("Pattern")] get; set; } public virtual bool IsGradient { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } public virtual bool IsHatch { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } public bool IsSolidFill { [return: MarshalAs(UnmanagedType.U1)] [Category("Misc")] get; } public Vector3d Normal { [Category("Misc")] get; set; } public int NumberOfHatchLines { [Category("Misc")] get; } public int NumberOfLoops { [Category("Misc")] get; } public int NumberOfPatternDefinitions { [Category("Misc")] get; } public Point2d Origin { [Category("Pattern")] get; set; } [UnitType(UnitType.Angle)] public double PatternAngle { [Category("Pattern")] get; set; } public bool PatternDouble { [return: MarshalAs(UnmanagedType.U1)] [Category("Pattern")] get; [param: MarshalAs(UnmanagedType.U1)] set; } public string PatternName { [Category("Pattern")] get; } [UnitType(UnitType.Distance)] public double PatternScale { [Category("Pattern")] get; set; } [UnitType(UnitType.Distance)] public double PatternSpace { [Category("Pattern")] get; set; } public HatchPatternType PatternType { [Category("Pattern")] get; } public float ShadeTintValue { [Category("Misc")] get; set; } } 属性: 属性 数据类型 意义 Area double 填充面积(只读) Elevation double 高程 GradientAngle double 渐变色角度 GradientName string 渐变色名 GradientOneColorMode bool True 单色,False 简便色 GradientShift float 渐变色插值 GradientType Autodesk.AutoCAD.DatabaseServices.GradientPatternType 渐变色样式 HatchObjectType Autodesk.AutoCAD.DatabaseServices.HatchObjectType 填充对象类型 HatchStyle Autodesk.AutoCAD.DatabaseServices.HatchStyle 填充样式 IsGradient bool if the Hatch object is a gradient [www.BimCad.org]深居浅出 AutoCAD 二次开发 261 IsHatch bool 填充对象是否已经被填充 IsSolidFill bool 填充对象是否为实心填充 Normal Vector3d 填充发向向量 NumberOfHatchLines int 填充边线数量(只读)如果填充对象为三 维实体则返回 0 NumberOfLoops int 边界循环总数 Origin Point2d 基点 PatternAngle double 模式角度 PatternDouble bool the value of double pattern flag for the hatch entity PatternName String 模式名 PatternScale double 模式比例 PatternSpace double 模式空间 PatternType Autodesk.AutoCAD.DatabaseServices.HatchPatternType 模式类型 ShadeTintValue float 单色模式的亮度 方法: 方法 参数 作用 void AppendLoop ( HatchLoop hatchLoop ) hatchLoop 填充环 添加填充环 HatchLoop GetLoopAt ( int loopIndex ) loopIndex 填充环索引 获得填充环 void InsertLoopAt ( int loopIndex, HatchLoop hatchLoop ) 1、loopIndex 填充环索引 2、hatchLoop 填充环 插入填充环 void RemoveLoopAt ( int loopIndex ) loopIndex 填充环索引 删除填充环 HatchLoopTypes LoopTypeAt ( int loopIndex ) loopIndex 填充环索引 获得环填充类型 Autodesk.AutoCAD.Colors.Color EvaluateGradientColorAt Value 高层 获得当前高层颜色值 [www.BimCad.org]深居浅出 AutoCAD 二次开发 262 ( float value ) void SetGradient ( Autodesk.AutoCAD.DatabaseServices. GradientPatternType gradientType, string gradientName ) 1、gradientType 渐变色类型 2、gradientName 渐变色名 设置渐变色 void SetGradientColors ( GradientColor[] value ) Value 颜色值(只能设置两种颜色) 设置渐变色颜色 GradientColor[] GetGradientColors() 获得渐变色 [www.BimCad.org]深居浅出 AutoCAD 二次开发 263 【7】Overrule(规则重定义) ObjectARX(c++)中自定义对象不能完全适用 AutoCAD 的基本命令操作,而且在文档恢复的时候很容易产生错误。 Overrule(规则重定义)允许用户自定义 AutoCAD 基本对象的显示形式、夹点、捕捉点甚至行为, Overrule 并没有对 AutoCAD 基本对象做任何改变,只是按照一定的规则从对象的扩展数据中读取数据来重新显示或者重新规定对象的行为。因此用.NET 环境下的 Overrule 方法来重定义对象规则比 ObjectARX(c++)中自定义对象更简单、更安全、更统一。 当没有加载读取重定义规则的程序打开图纸时,Overrule(规则重定义)定义的对象只显示基类图形而不会弹出显示代理 对象对话框。 类定义: public abstract class Overrule : RXObject { // Methods internal Overrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public static void AddOverrule(RXClass targetClass, Overrule overrule, [MarshalAs(UnmanagedType.U1)] bool bAtLast); internal unsafe AcRxOverrule* GetImpObj(); [return: MarshalAs(UnmanagedType.U1)] public static bool HasOverrule(RXObject overruledSubject, RXClass targetClass); [return: MarshalAs(UnmanagedType.U1)] public virtual bool IsApplicable(RXObject overruledSubject); public static void RemoveOverrule(RXClass targetClass, Overrule overrule); public abstract void SetCustomFilter(); public abstract void SetExtensionDictionaryEntryFilter(string entryName); public abstract void SetIdFilter(ObjectId[] ids); public abstract void SetNoFilter(); public abstract void SetXDataFilter(string registeredApplicationName); // Properties public static bool Overruling { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 264 属性: 属性 数据类型 意义 Overruling bool 是否启用重定义规则 方法: 方法 参数 作用 void AddOverrule ( RXClass targetClass, Overrule overrule, bool bAtLast ) 1、targetClass 重定义的类型 2、overrule 重定义规则 3、bAtLast 一般用 false 添加重定义规则,告诉系统将什么类型的显示方 式重定义为什么类型的显示方式。 bool HasOverrule ( RXObject overruledSubject, RXClass targetClass ) 1、overruledSubject 重定义规则类型 2、targetClass 重定义对象类型 是否已经重定义规则 void RemoveOverrule ( RXClass targetClass, Overrule overrule ) 1、targetClass 重定义对象类型 2、overrule 重定义规则 取消规则重定义 void SetExtensionDictionaryEntryFilter ( string entryName ) EntryName 扩展词典记录名 根据扩展词典里面是否有 EntryName 的扩展数 据来过滤要重定义的对象 void SetIdFilter ( ObjectId[] ids ) ids ObjectId 集合 只重定义指定 ObjectId 集合内的对象 void SetXDataFilter ( string registeredApplicationName ) registeredApplicationName 注册应用 程序名 只重定义指定注册应用程序 XData 的对象 (1) ObjectOverrule (数据库对象重定义) ObjectOverrule (数据库对象重定义)可以重定义数据库对象的基本行为。 public abstract class ObjectOverrule : Overrule { // Methods protected internal ObjectOverrule(); internal ObjectOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void Cancel(DBObject dbObject); [www.BimCad.org]深居浅出 AutoCAD 二次开发 265 public virtual void Close(DBObject dbObject); public virtual DBObject DeepClone(DBObject dbObject, DBObject ownerObject, IdMapping idMap, [MarshalAs(UnmanagedType.U1)] bool isPrimary); public virtual void Erase(DBObject dbObject, [MarshalAs(UnmanagedType.U1)] bool erasing); internal unsafe AcDbObjectOverrule* GetImpObj(); public virtual void Open(DBObject dbObject, OpenMode mode); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); public virtual DBObject WblockClone(DBObject dbObject, RXObject ownerObject, IdMapping idMap, [MarshalAs(UnmanagedType.U1)] bool isPrimary); } (2) DrawableOverrule(可视化对象规则重定义) DrawableOverrule(可视化对象规则重定义)可重定义可视化对象的显示形式。可以把点重新定义显示为一个圆,把线重新 定义显示成一条梁等,重定义只是将图形的显示规则做了改变,图形的基本属性,类型不会变化。 实现方法:从 DrawableOverrule 派生一个类,重写 WorldDraw 函数改变图形在绘图区域中的显示规则。 重定义显示规则基本步骤: 1、添加重定义规则 AddOverrule()。 2、添加重定义实例。 3、开启规则重定义 Overrule.Overruling = true。 类定义: public abstract class DrawableOverrule : Overrule { // Methods protected internal DrawableOverrule(); internal DrawableOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcGiDrawableOverrule* GetImpObj(); public virtual int SetAttributes(Drawable drawable, DrawableTraits traits); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); public virtual void ViewportDraw(Drawable drawable, ViewportDraw vd); public virtual int ViewportDrawLogicalFlags(Drawable drawable, ViewportDraw vd); [return: MarshalAs(UnmanagedType.U1)] public virtual bool WorldDraw(Drawable drawable, WorldDraw wd); } 方法: 方法 参数 作用 virtual int SetAttributes 1、drawable 重定义的对象 2、traits 属性描述 设置规则重定义的属性 [www.BimCad.org]深居浅出 AutoCAD 二次开发 266 ( Drawable drawable, DrawableTraits traits ) virtual void ViewportDraw ( Drawable drawable, Autodesk.AutoCAD.GraphicsInterface.ViewportDraw vd ) 1、drawable 可视化对象 2、vd 视口接口 在视口中的显示规则 virtual bool WorldDraw ( Drawable drawable, Autodesk.AutoCAD.GraphicsInterface.WorldDraw wd ) 1、drawable 可视化对象(主 要用于重定义规则对象的 类型的判断和图形基本数 据的获取) 2、wd 图形显示接口(在图 形接口中定义新的几何图 形规则) 图形显示规则(与视口无关) (3) GripOverrule(夹点重定义) GripOverrule(夹点重定义),可以自定义夹的行为。 类定义: public abstract class GripOverrule : Overrule { // Fields private readonly Dictionary> modreq(IsByValue) m_entityGripDataMap; // Methods protected internal GripOverrule(); internal GripOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual void GetGripPoints(Entity entity, Point3dCollection gripPoints, IntegerCollection snapModes, IntegerCollection geometryIds); public virtual void GetGripPoints(Entity entity, GripDataCollection grips, double curViewUnitSize, int gripSize, Vector3d curViewDir, GetGripPointsFlags bitFlags); internal unsafe AcDbGripOverrule* GetImpObj(); public virtual void GetStretchPoints(Entity entity, Point3dCollection stretchPoints); public virtual void MoveGripPointsAt(Entity entity, IntegerCollection indices, Vector3d offset); public virtual void MoveGripPointsAt(Entity entity, GripDataCollection grips, Vector3d offset, MoveGripPointsFlags bitFlags); public virtual void MoveStretchPointsAt(Entity entity, IntegerCollection indices, Vector3d offset); public virtual void OnGripStatusChanged(Entity entity, GripStatus status); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); // Properties internal Dictionary> EntityMap { get; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 267 } 方法: 方法 参数 作用 virtual void GetGripPoints ( Entity entity, GripDataCollection grips, double curViewUnitSize, int gripSize, Vector3d curViewDir, GetGripPointsFlags bitFlags ) 1、entity 夹点所在的实体对象 2、grips 夹点集合 3、curViewUnitSize 4、gripSize 5、curViewDir 6、bitFlags 获取到夹点处理函数 virtual void GetGripPoints ( Entity entity, Point3dCollection gripPoints, IntegerCollection snapModes, IntegerCollection geometryIds ) 1、entity 夹点所在的实体对象 2、gripPoints 夹点集合 3、snapModes 捕捉模式 4、geometryIds virtual void GetStretchPoints ( Entity entity, Point3dCollection stretchPoints ) 1、entity 夹点所在的实体对象 2、stretchPoints 拉升点集合 获取到拉升点处理函数 virtual void MoveGripPointsAt ( Entity entity, GripDataCollection grips, Vector3d offset, MoveGripPointsFlags bitFlags ) 1、entity 夹点所在的实体对象 2、grips 夹点集合 3、offset 偏移向量 4、bitFlags 移动夹点处理函数 virtual void MoveGripPointsAt ( Entity entity, IntegerCollection indices, Vector3d offset ) 1、entity 夹点所在的实体对象 2、indices 3、offset 偏移向量 virtual void MoveStretchPointsAt ( Entity entity, IntegerCollection indices, 1、entity 夹点所在的实体对象 2、indices 3、offset 偏移向量 移动拉伸点处理函数 [www.BimCad.org]深居浅出 AutoCAD 二次开发 268 Vector3d offset ) void OnGripStatusChanged ( Entity entity, GripStatus status ) 1、entity 夹点所在的实体对象 2、status 夹点状态 夹点状态改变处理函数 (4) OsnapOverrule (对象捕捉重定义) 重定义对象捕捉的行为。 public abstract class OsnapOverrule : Overrule { // Methods protected internal OsnapOverrule(); internal OsnapOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbOsnapOverrule* GetImpObj(); public virtual void GetObjectSnapPoints(Entity entity, ObjectSnapModes snapMode, IntPtr gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds); public virtual void GetObjectSnapPoints(Entity entity, ObjectSnapModes snapMode, IntPtr gsSelectionMark, Point3d pickPoint, Point3d lastPoint, Matrix3d viewTransform, Point3dCollection snapPoints, IntegerCollection geometryIds, Matrix3d insertionMat); [return: MarshalAs(UnmanagedType.U1)] public virtual bool IsContentSnappable(Entity entity); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); } (5) GeometryOverrule (几何重定义) 重定义几何性质。 public abstract class GeometryOverrule : Overrule { // Methods protected internal GeometryOverrule(); internal GeometryOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual Extents3d GetGeomExtents(Entity entity); internal unsafe AcDbGeometryOverrule* GetImpObj(); public virtual void IntersectWith(Entity entity, Entity ent, Intersect intType, Point3dCollection points, IntPtr thisGsMarker, IntPtr otherGsMarker); public virtual void IntersectWith(Entity entity, Entity ent, Intersect intType, Plane projPlane, Point3dCollection points, IntPtr thisGsMarker, IntPtr otherGsMarker); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); [www.BimCad.org]深居浅出 AutoCAD 二次开发 269 public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); } (6) HighlightOverrule (高亮重定义) 重定义高亮显示方式。 public abstract class HighlightOverrule : Overrule { // Methods protected internal HighlightOverrule(); internal HighlightOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcDbHighlightOverrule* GetImpObj(); public virtual void Highlight(Entity entity, FullSubentityPath subId, [MarshalAs(UnmanagedType.U1)] bool highlightAll); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); public virtual void Unhighlight(Entity entity, FullSubentityPath subId, [MarshalAs(UnmanagedType.U1)] bool highlightAll); } (7) PropertiesOverrule (属性重定义) 重定义属性。 public abstract class PropertiesOverrule : Overrule { // Methods protected internal PropertiesOverrule(); internal PropertiesOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public virtual Guid GetClassID(DBObject entity); internal unsafe AcDbPropertiesOverrule* GetImpObj(); public virtual void List(Entity entity); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); } (8) TransformOverrule (变形重定义) 重定义变形行为。 public abstract class TransformOverrule : Overrule { // Methods protected internal TransformOverrule(); internal TransformOverrule(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); [return: MarshalAs(UnmanagedType.U1)] [www.BimCad.org]深居浅出 AutoCAD 二次开发 270 public virtual bool CloneMeForDragging(Entity entity); public virtual void Explode(Entity entity, DBObjectCollection entitySet); internal unsafe AcDbTransformOverrule* GetImpObj(); public virtual Entity GetTransformedCopy(Entity entity, Matrix3d transform); [return: MarshalAs(UnmanagedType.U1)] public virtual bool HideMeForDragging(Entity entity); public sealed override void SetCustomFilter(); public sealed override void SetExtensionDictionaryEntryFilter(string entryName); public sealed override void SetIdFilter(ObjectId[] ids); public sealed override void SetNoFilter(); public sealed override void SetXDataFilter(string registeredApplicationName); public virtual void TransformBy(Entity entity, Matrix3d transform); } 【8】Jig(步骤模仿) Jig(步骤模仿)是辅助设计很有效的方法,AutoCAD 根据用户输入的参数的序列,形成图形预览,以便用户可以直观的设 计出自己想要的图形。 类定义: public abstract class Jig { // Fields private unsafe AcEdJig* m_pImp; private JigPrompts m_prompt; // Methods internal protected Jig(); internal protected abstract unsafe AcMgJig* CreateImpJig(); internal PromptResult DoIt(); protected internal virtual DynamicDimensionDataCollection GetDynamicDimensionData(double dimScale); internal unsafe AcEdJig* GetImpObj(); protected internal virtual void OnDimensionValueChanged(DynamicDimensionChangedEventArgs e); protected internal abstract SamplerStatus Sampler(JigPrompts prompts); // Properties internal JigPrompts Prompts { get; } } 属性: 属性 数据类型 意义 Prompts JigPrompts 取样参数 方法: 方法 参数 作用 PromptResult DoIt() DynamicDimensionDataCollection GetDynamicDimensionData dimScale [www.BimCad.org]深居浅出 AutoCAD 二次开发 271 ( double dimScale ) SamplerStatus Sampler ( JigPrompts prompts ) 取样过程,获取本步骤更新对象需要的参数 Editor.drag(Jig)后被自动调用。 (1)EntityJig(单实体步骤模仿) EntityJig(实体动态预览),按照指定步骤模仿特定类型的单个实体对象。 过程: 1、通过 Editor.drag(Jig)获得一个拖动动作。 2、通过 Sampler()取样函数,读取这个动作的参数(角度、距离或点)。如果构成某对象需要多个步骤,可以定义一个 Count 属性,每次 Editor.drag(Jig)的时候设置当前进行第几个步骤的采样。 3、通过 Update()用读取到的数据更新原对象。 4、获取基类(EntityJig 类)的 Entity 添加到数据库中。 EntityJig 的实现方法: [www.BimCad.org]深居浅出 AutoCAD 二次开发 272 类定义: public abstract class EntityJig : Jig { // Fields private Entity m_entity; // Methods protected internal EntityJig(Entity entity); internal protected override unsafe AcMgJig* CreateImpJig(); [return: MarshalAs(UnmanagedType.U1)] protected internal abstract bool Update(); // Properties protected internal Entity Entity { get; } } 属性: 属性 数据类型 意义 Entity Entity 模仿的对象 方法: 方法 参数 作用 bool Update() 更新对象参数 (2) DrawJig (拖拽步骤模仿) DrawJig (拖动步骤模仿)模仿多个实体对象的步骤。 类定义: public abstract class DrawJig : Jig { // Methods protected internal DrawJig(); internal protected override unsafe AcMgJig* CreateImpJig(); protected internal virtual void ViewportDraw(ViewportDraw draw); [return: MarshalAs(UnmanagedType.U1)] protected internal abstract bool WorldDraw(WorldDraw draw); } 方法: 方法 参数 作用 void ViewportDraw ( ViewportDraw draw ) draw 模仿的对象 对象在视口中的显示函数 bool WorldDraw draw 模仿的对象 对象显示函数,与视口无关 [www.BimCad.org]深居浅出 AutoCAD 二次开发 273 ( WorldDraw draw ) 【9】几何类库 几何对象中提供了对象的几何运算以及几何关系的方法,通过这些方法你可以很方便的分析图形的几何参数、对图形进 行几何变换。AutoCAD 二次开发很大一部分价值在于利用他现有的几何类来处理复杂的几何运算问题。 (1)Vector3d(三维向量) Vector3d(三维向量)是空间中带方向的长度单位,是几何计算中最重要的工具之一,几何对象的移动、旋转、坐标变换 等都涉及到向量的运算。 Vector3d.XAxis-X 轴方向单位向量(1,0,0) Vector3d.YAxis-Y 轴方向单位向量(0,1,0) Vector3d.ZAxis-Z 轴方向单位向量(0,0,1) *三维向量与点的关系:(1)三维向量=点 1-点 2 (2)点=三维向量+点 1 [www.BimCad.org]深居浅出 AutoCAD 二次开发 274 结构定义: public struct Vector3d : IFormattable { internal double m_x; internal double m_y; internal double m_z; public Vector3d(PlanarEntity plane, Vector2d vector2d); public Vector3d(double[] xyz); public Vector3d(double x, double y, double z); internal unsafe Vector3d(AcGeVector3d modopt(IsConst)* obj); public double X { get; } public double Y { get; } public double Z { get; } public static Vector3d XAxis { get; } public static Vector3d YAxis { get; } public static Vector3d ZAxis { get; } public Vector2d Convert2d(PlanarEntity plane); public double AngleOnPlane(PlanarEntity plane); public Vector3d TransformBy(Matrix3d leftSide); public Vector3d RotateBy(double angle, Vector3d axis); public Vector3d Mirror(Vector3d normalToPlane); public Vector3d MultiplyBy(double value); public Vector3d Add(Vector3d v); public Vector3d Subtract(Vector3d v); public Vector3d DivideBy(double value); public double this[int i] { get; } public Vector3d Negate(); public Vector3d GetPerpendicularVector(); public double GetAngleTo(Vector3d vector, Vector3d referenceVector); public double GetAngleTo(Vector3d vector); public Vector3d GetNormal(); public Vector3d GetNormal(Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsUnitLength(); [return: MarshalAs(UnmanagedType.U1)] public bool IsUnitLength(Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsZeroLength(); [return: MarshalAs(UnmanagedType.U1)] public bool IsZeroLength(Tolerance tolerance); public double Length { get; } public double LengthSqrd { get; } [return: MarshalAs(UnmanagedType.U1)] public bool IsParallelTo(Vector3d vector); [return: MarshalAs(UnmanagedType.U1)] public bool IsParallelTo(Vector3d vector, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsCodirectionalTo(Vector3d vector); [www.BimCad.org]深居浅出 AutoCAD 二次开发 275 [return: MarshalAs(UnmanagedType.U1)] public bool IsCodirectionalTo(Vector3d vector, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsPerpendicularTo(Vector3d vector); [return: MarshalAs(UnmanagedType.U1)] public bool IsPerpendicularTo(Vector3d vector, Tolerance tolerance); public double DotProduct(Vector3d v); public Vector3d CrossProduct(Vector3d vector); public Vector3d ProjectTo(Vector3d planeNormal, Vector3d projectDirection); public Vector3d OrthoProjectTo(Vector3d planeNormal); [return: MarshalAs(UnmanagedType.U1)] public bool IsEqualTo(Vector3d vector); [return: MarshalAs(UnmanagedType.U1)] public bool IsEqualTo(Vector3d vector, Tolerance tolerance); public int LargestElement { get; } [return: MarshalAs(UnmanagedType.U1)] public sealed override bool Equals(object obj); [return: MarshalAs(UnmanagedType.U1)] public static bool operator !=(Vector3d a, Vector3d b); [return: MarshalAs(UnmanagedType.U1)] public static bool operator ==(Vector3d a, Vector3d b); public static Vector3d operator +(Vector3d a, Vector3d b); public static Vector3d operator -(Vector3d a); public static Vector3d operator -(Vector3d a, Vector3d b); public static Vector3d operator *(Matrix3d a, Vector3d b); public static Vector3d operator *(double factor, Vector3d a); public static Vector3d operator *(Vector3d a, double factor); public static Vector3d operator /(Vector3d a, double factor); public sealed override int GetHashCode(); public string ToString(string format, IFormatProvider provider); public string ToString(IFormatProvider provider); public sealed override string ToString(); public double[] ToArray(); } 属性: 属性 数据类型 意义 Length double 向量的长度 X double 向量方向的 X 值 Y double 向量方向的 Y 值 Z double 向量方向的 Z 值 方法: 方法 参数 作用 Vector3d Add ( Vector3d v v 三维向量 向量相加,相当于“+”运算符 [www.BimCad.org]深居浅出 AutoCAD 二次开发 276 ) double AngleOnPlane ( PlanarEntity plane ) plane 平面 向量与平面的夹角 Vector2d Convert2d ( PlanarEntity plane ) plane 投影平面 将三维向量按照某个平面投影为 2 维向量 Vector3d CrossProduct ( Vector3d vector ) vector 三维向量 两个向量的叉乘 V1(dx1,dy1,dz1),V2(dx2,dy2,dz2) V1 CrossProduct(V2)=(dy1dz2-dy2dz1,dz1dx2-dz2dx1,dx1dy2-dx2dy1) Vector3d DivideBy ( double value ) value 值 向量长度除以 value 值,相当于“/”运算符 double GetAngleTo ( Vector3d vector ) vector 三维向量 向量之间的角度 Vector3d GetNormal() 法向向量 Vector3d Mirror ( Vector3d normalToPlane ) normalToPlane 镜像平面的法向 镜像向量 Vector3d MultiplyBy ( double value ) value 值 向量长度乘以 value 值, 相当于“*”运算符 Vector3d Negate() 无 向量的反向量(-x,-y,-z) Vector3d RotateBy ( double angle, Vector3d axis ) 1、angle 旋转角度 2、axis 旋转轴向量 由 axis 向量旋转 angle 角度 运算: 运算对象 1 运算符 运算对象 2 运算结果 [www.BimCad.org]深居浅出 AutoCAD 二次开发 277 Vector3d(dx1,dy1,dz1) + Vector3d(dx2,dy2,dz2) Vector3d(dx1+dx2,dy1+dy2,dz1+dz2) Vector3d(dx1,dy1,dz1) - Vector3d(dx2,dy2,dz2) Vector3d(dx1-dx2,dy1-dy2,dz1-dz2) double(k) * Vector3d(dx,dy,dz) Vector3d(k*dx,k*dy,k*dz) Vector3d(dx,dy,dz) * double(k) Vector3d(k*dx,k*dy,k*dz) Matrix3d * Vector3d(dx,dy,dz) Vector3d(dx,dy,dz) / double(k) Vector3d(dx/k,dy/k,dz/k) 构造函数: 构造函数 参数解释 Vector3d ( double x, double y, double z ) 1、x X 方向增量 2、y Y 方向增量 3、z Z 方向增量 Vector3d ( double[] xyz ) xyz 增量数组 Vector3d ( PlanarEntity plane, Vector2d vector2d ) 1、plane 所在平面 2、vector2d 二维向量 (2)Matrix3d(三维矩阵) 三维矩阵用于几何对象的变换操作(平移、旋转、投影、缩放、镜像)。 Matrix3d 形式如下: a00 a01 a02 t0 a10 a11 a12 t1 a20 a21 a22 t2 0 0 0 1 坐标的变换实际上转换成了矩阵的乘积: 结构定义: public struct Matrix3d : IFormattable [www.BimCad.org]深居浅出 AutoCAD 二次开发 278 { internal double data11; internal double data12; internal double data13; internal double data14; internal double data21; internal double data22; internal double data23; internal double data24; internal double data31; internal double data32; internal double data33; internal double data34; internal double data41; internal double data42; internal double data43; internal double data44; public Matrix3d(double[] data); internal unsafe Matrix3d(AcGeMatrix3d modopt(IsConst)* unmanagedPointer); public static Matrix3d Identity { get; } public Matrix3d PreMultiplyBy(Matrix3d leftSide); public Matrix3d PostMultiplyBy(Matrix3d rightSide); public Matrix3d Inverse(); [return: MarshalAs(UnmanagedType.U1)] public bool IsSingular(); [return: MarshalAs(UnmanagedType.U1)] public bool IsSingular(Tolerance tolerance); public Matrix3d Transpose(); [return: MarshalAs(UnmanagedType.U1)] public bool IsEqualTo(Matrix3d mat); [return: MarshalAs(UnmanagedType.U1)] public bool IsEqualTo(Matrix3d mat, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsUniscaledOrtho(); [return: MarshalAs(UnmanagedType.U1)] public bool IsUniscaledOrtho(Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsScaledOrtho(); [return: MarshalAs(UnmanagedType.U1)] public bool IsScaledOrtho(Tolerance tolerance); public double GetDeterminant(); public Vector3d Translation { get; } public CoordinateSystem3d CoordinateSystem3d { get; } public static Matrix3d Displacement(Vector3d vector); public static Matrix3d Rotation(double angle, Vector3d axis, Point3d center); public static Matrix3d Scaling(double scaleAll, Point3d center); public static Matrix3d Mirroring(Point3d pointValue); public static Matrix3d Mirroring(Plane plane); [www.BimCad.org]深居浅出 AutoCAD 二次开发 279 public static Matrix3d Mirroring(Line3d line); public static Matrix3d WorldToPlane(Vector3d normal); public static Matrix3d WorldToPlane(Plane plane); public static Matrix3d PlaneToWorld(Vector3d normal); public static Matrix3d PlaneToWorld(Plane plane); public static Matrix3d Projection(Plane projectionPlane, Vector3d projectDir); public static Matrix3d AlignCoordinateSystem(Point3d fromOrigin, Vector3d fromXAxis, Vector3d fromYAxis, Vector3d fromZAxis, Point3d toOrigin, Vector3d toXAxis, Vector3d toYAxis, Vector3d toZAxis); public double GetScale(); public double Normal { get; } public double this[int row, int column] { get; } [return: MarshalAs(UnmanagedType.U1)] public bool IsInverse(Matrix3d inv); [return: MarshalAs(UnmanagedType.U1)] public bool IsInverse(Matrix3d inv, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public sealed override bool Equals(object obj); [return: MarshalAs(UnmanagedType.U1)] public static bool operator !=(Matrix3d a, Matrix3d b); [return: MarshalAs(UnmanagedType.U1)] public static bool operator ==(Matrix3d a, Matrix3d b); public static Matrix3d operator *(Matrix3d a, Matrix3d b); public sealed override int GetHashCode(); public string ToString(string format, IFormatProvider provider); public string ToString(IFormatProvider provider); public sealed override string ToString(); public double[] ToArray(); } 属性: 属性 数据类型 意义 CoordinateSystem3d Autodesk.AutoCAD.Geometry.CoordinateSystem3d 矩阵参照的坐标系 Translation Vector3d 返回定义变换矩阵的向量 Normal double 3x3 矩阵上元素的最大值的绝对值 方法: 方法 参数 作用 double GetDeterminant() 获得矩阵的行列式 double GetScale() 获得矩阵的比例系数 Matrix3d Inverse() 获得矩阵的逆矩阵 static Matrix3d Mirroring ( Line3d line ) line 镜像直线 得到根据直线的镜像变换矩阵 static Matrix3d Mirroring ( Plane plane plane 镜像平面 得到根据平面的镜像变换矩阵 [www.BimCad.org]深居浅出 AutoCAD 二次开发 280 ) static Matrix3d Mirroring ( Point3d pointValue ) pointValue 镜像点 得到根据点的镜像变换矩阵 static Matrix3d Rotation ( double angle, Vector3d axis, Point3d center ) 1、angle 旋转角度 2、axis 旋转轴向量 3、center 旋转中心 得到旋转变换矩阵 static Matrix3d Scaling ( double scaleAll, Point3d center ) 1、scaleAll 缩放比例 2、center 基点 得到缩放变换矩阵 double[] ToArray() 无 矩阵转数组,形式如下: r0 c0 r0 c1 r0 c2 r0 c3 r1 c0 r1 c1 r1 c2 r1 c3 r2 c0 r2 c1 r2 c2 r2 c3 r3 c0 r3 c1 r3 c2 r3 c3 构造函数: 构造函数 参数解释 Matrix3d() Matrix3d ( double[] data ) Data 矩阵数据数组 (3)Tolerance(容差) Tolerance(容差),表示向量或者点的误差范围,由他可以控制几何运算时候的精度。设定好精度范围后,在一个范围内 的向量或者点计算的时候被视为相等的。 结构定义: public struct Tolerance { internal double mTolArr1; internal double mTolArr2; internal double mTolArr3; internal double mTolArr4; internal double mTolArr5; internal int mAbs; public Tolerance(double equalVector, double equalPoint); internal Tolerance(IntPtr unmanagedPointer); public double EqualPoint { get; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 281 public double EqualVector { get; } public static Tolerance Global { get; set; } } 属性: 属性 数据类型 意义 EqualPoint double 点距离误差精度 EqualVector double 向量误差精度 Global Tolerance 系统全局精度 构造函数: 构造函数 参数解释 Tolerance() Tolerance ( double equalVector, double equalPoint ) 1、equalVector 精度向量 2、equalPoint 精度点 (4) Point3d (三维点) Point3d (三维点)是三维空间中点的描述,用于表示空间的一个位置,几乎所有的几何对象的操作都可以归结为对点的 操作,如几何的平移、旋转、缩放。 结构定义: public struct Point3d : IFormattable { internal double data1; internal double data2; internal double data3; public Point3d(PlanarEntity plane, Point2d point); public Point3d(double[] xyz); public Point3d(double x, double y, double z); internal unsafe Point3d(AcGePoint3d modopt(IsConst)* unmanagedPointer); public double X { get; } public double Y { get; } public double Z { get; } public static Point3d Origin { get; } public Point3d TransformBy(Matrix3d leftSide); public Point3d RotateBy(double angle, Vector3d vector, Point3d centerPoint); public Point3d ScaleBy(double scaleFactor, Point3d centerPoint); public double this[int i] { get; } public Point3d MultiplyBy(double value); public Point3d DivideBy(double value); public Point3d Add(Vector3d value); public Point3d Subtract(Vector3d value); public Vector3d GetAsVector(); public double DistanceTo(Point3d point); [www.BimCad.org]深居浅出 AutoCAD 二次开发 282 public Vector3d GetVectorTo(Point3d point); [return: MarshalAs(UnmanagedType.U1)] public bool IsEqualTo(Point3d point); [return: MarshalAs(UnmanagedType.U1)] public bool IsEqualTo(Point3d point, Tolerance tolerance); public Point2d Convert2d(PlanarEntity plane); public Point3d OrthoProject(Plane plane); public Point3d Project(Plane plane, Vector3d vector); public Point3d Mirror(Plane plane); [return: MarshalAs(UnmanagedType.U1)] public sealed override bool Equals(object obj); [return: MarshalAs(UnmanagedType.U1)] public static bool operator !=(Point3d a, Point3d b); [return: MarshalAs(UnmanagedType.U1)] public static bool operator ==(Point3d a, Point3d b); public static Vector3d operator -(Point3d a, Point3d b); public static Point3d operator -(Point3d a, Vector3d b); public static Point3d operator +(Point3d a, Vector3d vector); public static Point3d operator *(Matrix3d mat, Point3d a); public static Point3d operator *(double value, Point3d a); public static Point3d operator *(Point3d a, double value); public static Point3d operator /(Point3d a, double value); public sealed override int GetHashCode(); public string ToString(string format, IFormatProvider provider); public string ToString(IFormatProvider provider); public sealed override string ToString(); public double[] ToArray(); } 属性: 属性 数据类型 意义 Origin Point3d 原点 X double X 坐标 Y double Y 坐标 Z double Z 坐标 方法: 方法 参数解释 作用 Point3d Add ( Vector3d value ) Value 三维向量 点加向量 Point3d Subtract ( Vector3d value ) value 三维向量 点减向量 [www.BimCad.org]深居浅出 AutoCAD 二次开发 283 Point2d Convert2d ( PlanarEntity plane ) plane 投影平面 转换为二维点 double DistanceTo ( Point3d point ) Point 点 点到点距离 Point3d DivideBy ( double value ) Value 被除数 相当于“/”运算符 bool Equals ( object obj ) Obj 判断点 判断点是否相等 Vector3d GetAsVector() 把点转化为相同坐标系下的向量 Vector3d GetVectorTo ( Point3d point ) Point 目标点 点与点之间的向量 Point3d Mirror ( Plane plane ) Plane 镜像平面 按照平面镜像点 Point3d MultiplyBy ( double value ) Value 乘数 相当于“*”运算符 Point3d Project ( Plane plane, Vector3d vector ) 1、plane 投影平面 2、vector 投影向量 按照投影平面投影向量投影点 Point3d OrthoProject ( Plane plane ) plane 投影平面 按照投影平面投影点 Point3d RotateBy ( 1、angle 转角 2、vector 旋转点的向量 3、centerPoint 旋转中心 旋转点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 284 double angle, Vector3d vector, Point3d centerPoint ) Point3d ScaleBy ( double scaleFactor, Point3d centerPoint ) 1、scaleFactor 比例因子 2、centerPoint 缩放基点 缩放点 double[] ToArray() 坐标转到 double 数组 Point3d TransformBy ( Matrix3d leftSide ) leftSide 变换举证 变形 运算: 运算对象 1 运算符 运算对象 2 运算结果 point3d(x,y,z) + Vector3d(dx,dy,dz) point3d(x+dx,y+dy,z+dz) point3d(x,y,z) - Vector3d(dx,dy,dz) point3d(x-dx,y-dy,z-dz) point3d(x1,y1,z1) - point3d(x2,y2,z2) point3d(x1-x2,y1-y2,z1-z2) double(k) * point3d(x,y,z) point3d(k*x,k*y,k*z) point3d(x,y,z) * double(k) point3d(k*x,k*y,k*z) Matrix3d * point3d(x,y,z) point3d(x,y,z) / double(k) point3d(x/k,y/k,z/k) 构造函数: 构造函数 参数解释 Point3d ( double x, double y, double z ) 1、x X 坐标 2、y Y 坐标 3、z Z 坐标 Point3d ( double[] xyz ) xyz 坐标数组 Point3d ( PlanarEntity plane, Point2d point ) 1、plane 所在平面 2、point 二维点 (5) Curve3d(三维曲线) 类定义: [www.BimCad.org]深居浅出 AutoCAD 二次开发 285 public abstract class Curve3d : Entity3d { // Methods internal Curve3d(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal static unsafe Curve3d Create(AcGeCurve3d modopt(IsConst)* unmanagedPointer); public static Curve3d Create(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Point3d EvaluatePoint(double value); public Curve3d[] Explode(Interval interval); public double GetArea(double startingParameter, double endingParameter); public double GetArea(double startingParameter, double endingParameter, Tolerance tolerance); public BoundBlock3d GetBoundBlockOf(Interval range); public PointOnCurve3d[] GetClosestPointTo(Curve3d curve3d); public PointOnCurve3d GetClosestPointTo(Point3d point); public PointOnCurve3d[] GetClosestPointTo(Curve3d curve3d, Tolerance tolerance); public PointOnCurve3d GetClosestPointTo(Point3d point, Tolerance tolerance); public double GetDistanceTo(Curve3d curve); public double GetDistanceTo(Point3d point); public double GetDistanceTo(Curve3d curve, Tolerance tolerance); public double GetDistanceTo(Point3d point, Tolerance tolerance); internal unsafe AcGeCurve3d* GetImpObj(); public Interval GetInterval(); public double GetLength(double fromParameter, double toParameter, double tolerance); public PointOnCurve3d[] GetNewSamplePoints(double fromParameter, double toParameter, double chordHeight); public PointOnCurve3d GetNormalPoint(Point3d point); public PointOnCurve3d GetNormalPoint(Point3d point, Tolerance tolerance); public BoundBlock3d GetOrthoBoundBlockOf(Interval range); public Entity3d GetOrthoProjectEntity(Plane projectionPlane); public Entity3d GetOrthoProjectEntity(Plane projectionPlane, Tolerance tolerance); public double GetParameterAtLength(double datumParameter, double length, [MarshalAs(UnmanagedType.U1)] bool direction, double tolerance); public double GetParameterOf(Point3d point); public double GetParameterOf(Point3d point, Tolerance tolerance); public PointOnCurve3d[] GetProjectedClosestPointTo(Curve3d curve3d, Vector3d projectDirection); public PointOnCurve3d GetProjectedClosestPointTo(Point3d point, Vector3d projectDirection); public PointOnCurve3d[] GetProjectedClosestPointTo(Curve3d curve3d, Vector3d projectDirection, Tolerance tolerance); public PointOnCurve3d GetProjectedClosestPointTo(Point3d point, Vector3d projectDirection, Tolerance tolerance); public Entity3d GetProjectedEntity(Plane projectionPlane, Vector3d projectDirection); public Entity3d GetProjectedEntity(Plane projectionPlane, Vector3d projectDirection, Tolerance tolerance); public Curve3d GetReverseParameterCurve(); public PointOnCurve3d[] GetSamplePoints(int numSample); public PointOnCurve3d[] GetSamplePoints(double fromParameter, double toParameter, double chordHeight); public Curve3d[] GetSplitCurves(double value); public Curve3d[] GetTrimmedOffset(double distance, Vector3d planeNormal, OffsetCurveExtensionType extensionType); public Curve3d[] GetTrimmedOffset(double distance, Vector3d planeNormal, OffsetCurveExtensionType extensionType, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsClosed(); [return: MarshalAs(UnmanagedType.U1)] [www.BimCad.org]深居浅出 AutoCAD 二次开发 286 public bool IsClosed(Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsCoplanarWith(Curve3d curve3d, out Plane plane); [return: MarshalAs(UnmanagedType.U1)] public bool IsCoplanarWith(Curve3d curve3d, out Plane plane, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsDegenerate(out Entity3d result); [return: MarshalAs(UnmanagedType.U1)] public bool IsDegenerate(out Entity3d result, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsLinear(out Line3d line); [return: MarshalAs(UnmanagedType.U1)] public bool IsLinear(out Line3d line, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(Point3d point); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(double value); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(Point3d point, out double value); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(Point3d point, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(double value, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(Point3d point, out double value, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsPeriodic(out double period); [return: MarshalAs(UnmanagedType.U1)] public bool IsPlanar(out Plane plane); [return: MarshalAs(UnmanagedType.U1)] public bool IsPlanar(out Plane plane, Tolerance tolerance); public void SetInterval(Interval value); // Properties public BoundBlock3d BoundBlock { get; } public Point3d EndPoint { get; } public bool HasEndPoint { [return: MarshalAs(UnmanagedType.U1)] get; } public bool HasStartPoint { [return: MarshalAs(UnmanagedType.U1)] get; } public BoundBlock3d OrthoBoundBlock { get; } public Point3d StartPoint { get; } } (5.1) LinearEntity3d(三维线性对象) 类定义: public abstract class LinearEntity3d : Curve3d { // Methods internal protected LinearEntity3d(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); [www.BimCad.org]深居浅出 AutoCAD 二次开发 287 public static LinearEntity3d Create(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcGeLinearEnt3d* GetImpObj(); public Line3d GetLine(); public Plane GetPerpendicularPlane(Point3d intersectionPoint); public Point3d[] IntersectWith(LinearEntity3d line); public Point3d[] IntersectWith(PlanarEntity plane); public Point3d[] IntersectWith(LinearEntity3d line, Tolerance tolerance); public Point3d[] IntersectWith(PlanarEntity plane, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsColinearTo(LinearEntity3d line); [return: MarshalAs(UnmanagedType.U1)] public bool IsColinearTo(LinearEntity3d line, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(Plane plane); [return: MarshalAs(UnmanagedType.U1)] public bool IsOn(Plane plane, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsParallelTo(LinearEntity3d line); [return: MarshalAs(UnmanagedType.U1)] public bool IsParallelTo(PlanarEntity plane); [return: MarshalAs(UnmanagedType.U1)] public bool IsParallelTo(LinearEntity3d line, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsParallelTo(PlanarEntity plane, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsPerpendicularTo(LinearEntity3d line); [return: MarshalAs(UnmanagedType.U1)] public bool IsPerpendicularTo(PlanarEntity plane); [return: MarshalAs(UnmanagedType.U1)] public bool IsPerpendicularTo(LinearEntity3d line, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsPerpendicularTo(PlanarEntity plane, Tolerance tolerance); public LinearEntity3d Overlap(LinearEntity3d line); public LinearEntity3d Overlap(LinearEntity3d line, Tolerance tolerance); public Point3d[] ProjectedIntersectWith(LinearEntity3d line, Vector3d projectionDirection); public Point3d[] ProjectedIntersectWith(LinearEntity3d line, Vector3d projectionDirection, Tolerance tolerance); // Properties public Vector3d Direction { get; } public Point3d PointOnLine { get; } } (5.2)CircularArc3d(三维圆弧) 类定义: public sealed class CircularArc3d : Curve3d { // Methods [www.BimCad.org]深居浅出 AutoCAD 二次开发 288 public CircularArc3d(); internal CircularArc3d(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public CircularArc3d(Point3d startPoint, Point3d pointOnArc, Point3d endPoint); public CircularArc3d(Point3d center, Vector3d normal, double radius); public CircularArc3d(Point3d center, Vector3d normal, Vector3d referenceVector, double radius, double startAngle, double endAngle); public Point3d[] ClosestPointToPlane(PlanarEntity plane); public Point3d[] ClosestPointToPlane(PlanarEntity plane, Tolerance tolerance); public static CircularArc3d Create(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcGeCircArc3d* GetImpObj(); public Plane GetPlane(); public Line3d GetTangent(Point3d pointValue); public Line3d GetTangent(Point3d pointValue, Tolerance tolerance); public Point3d[] IntersectWith(CircularArc3d arc); public Point3d[] IntersectWith(LinearEntity3d line); public Point3d[] IntersectWith(PlanarEntity plane); public Point3d[] IntersectWith(CircularArc3d arc, Tolerance tolerance); public Point3d[] IntersectWith(LinearEntity3d line, Tolerance tolerance); public Point3d[] IntersectWith(PlanarEntity plane, Tolerance tolerance); [return: MarshalAs(UnmanagedType.U1)] public bool IsInside(Point3d pointValue); [return: MarshalAs(UnmanagedType.U1)] public bool IsInside(Point3d pointValue, Tolerance tolerance); public Point3d[] ProjectedIntersectWith(LinearEntity3d line, Vector3d projectionDirection); public Point3d[] ProjectedIntersectWith(LinearEntity3d line, Vector3d projectionDirection, Tolerance tolerance); public void Set(Point3d startPoint, Point3d pointOnArc, Point3d endPoint); public void Set(Point3d center, Vector3d normal, double radius); public void Set(Curve3d curve1, Curve3d curve2, double radius, double param1, double param2); public void Set(Curve3d curve1, Curve3d curve2, Curve3d curve3, double param1, double param2, double param3); public void Set(Point3d center, Vector3d normal, Vector3d referenceVector, double radius, double startAngle, double endAngle); public void SetAngles(double startAngle, double endAngle); public void SetAxes(Vector3d normal, Vector3d referenceVector); // Properties public Point3d Center { get; set; } public double EndAngle { get; } public Point3d EndPoint { get; } public Vector3d Normal { get; } public double Radius { get; set; } public Vector3d ReferenceVector { get; } public double StartAngle { get; } public Point3d StartPoint { get; } } (6)Plane(平面) [www.BimCad.org]深居浅出 AutoCAD 二次开发 289 类定义: public sealed class Plane : PlanarEntity { // Methods public Plane(); public Plane(Plane source); public Plane(Point3d origin, Vector3d normal); private Plane(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); public Plane(Point3d u, Point3d origin, Point3d v); public Plane(Point3d origin, Vector3d u, Vector3d v); public Plane(double a, double b, double c, double d); public static Plane Create(IntPtr unmanagedPointer, [MarshalAs(UnmanagedType.U1)] bool autoDelete); internal unsafe AcGePlane* GetImpObj(); public double GetSignedDistanceTo(Point3d pointValue); public LineSegment3d IntersectWith(BoundedPlane boundPlane); public Line3d IntersectWith(Plane otherPlane); public LineSegment3d IntersectWith(BoundedPlane boundPlane, Tolerance tolerance); public Line3d IntersectWith(Plane otherPlane, Tolerance tolerance); public void Set(Point3d pointValue, Vector3d normal); public void Set(Point3d u, Point3d origin, Point3d v); public void Set(Point3d origin, Vector3d u, Vector3d v); public void Set(double a, double b, double c, double d); } 【10】用户界面 (1)PaletteSet(面板) PaletteSet(面板)是用户界面的容器,使 UserControl(用户自定义控件)与 AutoCAD 应用程序无缝连接,使人机交互更简 便。PaletteSet 属性的设置顺序,会影响 PaletteSet 不同效果。 类定义: [www.BimCad.org]深居浅出 AutoCAD 二次开发 290 public class PaletteSet : Window, ICollection { // Fields private int m_keepFocus; private PaletteAddContextMenuEventHandler m_pAddContextMenuEvent; private PaletteSetDestroyEventHandler m_pDestroyEvent; private PaletteSetHelpEventHandler m_pHelpEvent; private PalettePersistEventHandler m_pLoadEvent; private PaletteSetMoveEventHandler m_pMovedEvent; private PaletteActivatedEventHandler m_pPaletteActivatedEvent; private PalettePersistEventHandler m_pSaveEvent; private PaletteSetShowDockBarEventHandler m_pShowDockBarEvent; private PaletteSetSizeEventHandler m_pSizeEvent; private PaletteSetStateEventHandler m_pStateEvent; private PaletteSetTitleBarLocationChangeEventHandler m_pTitleBarLocationChanged; private bool m_visibleFirstTime; // Events public event PaletteSetHelpEventHandler Help; public event PalettePersistEventHandler Load; public event PaletteActivatedEventHandler PaletteActivated; public event PaletteAddContextMenuEventHandler PaletteAddContextMenu; public event PaletteSetDestroyEventHandler PaletteSetDestroy; public event PaletteSetMoveEventHandler PaletteSetMoved; public event PaletteSetShowDockBarEventHandler PaletteSetShowDockBar; public event PaletteSetTitleBarLocationChangeEventHandler PaletteSetTitleBarLocationChange; public event PalettePersistEventHandler Save; public event PaletteSetSizeEventHandler SizeChanged; public event PaletteSetStateEventHandler StateChanged; // Methods public PaletteSet(string name); public PaletteSet(string name, Guid toolID); public PaletteSet(string name, string cmd, Guid toolID); public void Activate(int index); public Palette Add(string name, Control control); private unsafe Palette AddCore(string name, AcMgPalette* pPal); public Palette AddVisual(string name, Visual control); internal static void CleanUp(); private void CommonConstruct(string name, string cmd, Guid toolID, [MarshalAs(UnmanagedType.U1)] bool tool); private void CopyTo(Array array, int index); public void CopyTo(Palette[] array, int index); internal void Disconnect(); [return: MarshalAs(UnmanagedType.U1)] public bool EnableTransparency([MarshalAs(UnmanagedType.U1)] bool value); internal void FireAddContextMenuItems(List menuitems, List itemsIndex, int nHitFlag, int nRightClkTab); internal void FireDestroy(); internal void FireHelp(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 291 internal unsafe void FireLoad(IUnknown* pUnk); internal void FireMoved(int x, int y); internal unsafe void FirePaletteActivated(CAdUiPalette* pActivated, CAdUiPalette* pDeactivated); internal unsafe void FireSave(IUnknown* pUnk); internal void FireShowDockBar([MarshalAs(UnmanagedType.U1)] bool bShow); internal void FireSizeChange(int cx, int cy); internal void FireStateChange(StateEventIndex value); internal void FireTitleBarLocationChange(); public IEnumerator GetEnumerator(); internal unsafe AcMgPaletteSet* GetImpObj(); public void InitializeFloatingPosition(Rect value); public void RecalculateDockSiteLayout(); public void Remove(int index); // Properties public bool Anchored { [return: MarshalAs(UnmanagedType.U1)] get; } public bool AutoRollUp { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public virtual int Count { get; } public DockSides Dock { get; set; } public DockSides DockEnabled { get; set; } private bool IsSynchronized { [return: MarshalAs(UnmanagedType.U1)] get; } public Palette this[int index] { get; } public bool KeepFocus { virtual [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public override Point Location { get; set; } public Size MinimumSize { get; set; } public string Name { get; set; } public int Opacity { get; set; } public Size PaletteSize { get; } public bool RolledUp { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } public override Size Size { get; set; } public PaletteSetStyles Style { get; set; } private object SyncRoot { get; } private bool System.Collections.ICollection.IsSynchronized { [return: MarshalAs(UnmanagedType.U1)] get; } private object System.Collections.ICollection.SyncRoot { get; } public PaletteSetTitleBarLocation TitleBarLocation { get; set; } public override bool Visible { [return: MarshalAs(UnmanagedType.U1)] get; [param: MarshalAs(UnmanagedType.U1)] set; } } 属性: 属性 数据类型 意义 Anchored bool 是否锚固(只读) AutoRollUp bool AutoRollUp 属性值 Dock DockSides 停靠模式(用于读取) DockEnabled DockSides 停靠模式 KeepFocus bool 保持焦点 Location System.Drawing.Point 基点 MinimumSize System.Drawing.Size 最小尺寸 Name string 面板名 [www.BimCad.org]深居浅出 AutoCAD 二次开发 292 Opacity int 面板透明度 RolledUp bool RolledUp 属性值 Size System.Drawing.Size 面板尺寸 Style PaletteSetStyles 面板样式 给面板样式赋值的时候可以用逻 辑运算符”|”,赋予多种样式 TitleBarLocation PaletteSetTitleBarLocation 标题标签位置 Visible bool 是否可见 方法: 方法 参数 作用 void Activate ( int index ) Index 用户控件面板索引 设置活动的面板 Palette Add ( string name, Control control ) 1、name 面板名 2、control 用户控件 添加用户控件 Palette AddVisual ( string name, Visual control ) 1、name 面板名 2、control 用户控件 添加 System.Windows.Media.Visual 类型的用户控件 void CopyTo ( Palette[] array, int index ) 1、array 面板数组 2、index 面板索引 拷贝面板 void Remove ( int index ) Index 用户控件面板索引 移除面板 [www.BimCad.org]深居浅出 AutoCAD 二次开发 293 (2)RibbonTab(面板式菜单) RibbonTab(面板式菜单)是 AutoCAD 功能,命令的界面表现。可以直观,快捷的运行 AutoCAD 命令。 使用菜单需要加入如下引用: AcDbMgd AcMgd AdWindows PresentationCore PresentationFramework WindowsBase 【11】枚举类型 (1)OpenMode 枚举对象 打开方式 OpenMode.ForNotify 通知方式,当一个对象已经通过可读或可写方式打开时,可以通过通知模式打开 OpenMode.ForRead 只读方式,一个对象可以同时被只读模式打开 256 次,之后不能再以只读或通知模式打开。 OpenMode.ForWrite 可写方式,一个对象只能被可写方式打开一次 (2)Intersect 枚举对象 相交方式 Intersect.ExtendArgument 延伸从对象 [www.BimCad.org]深居浅出 AutoCAD 二次开发 294 Intersect.ExtendBoth 两者都延伸 Intersect.ExtendThis 延伸本对象 Intersect.OnBothOperands 两者都不延伸 [www.BimCad.org]深居浅出 AutoCAD 二次开发 295 (3)ObjectSnapModes 枚举对象 扑捉方式 ObjectSnapModes.ModeEnd 端点 ObjectSnapModes.ModeMid 中点 ObjectSnapModes.ModeCenter 圆心(用于 Arc、Circle、椭圆、 椭圆弧 ) ObjectSnapModes.ModeNode 节点(用于点对象、标注文字原点等) ObjectSnapModes.ModeQuad 象限点 [www.BimCad.org]深居浅出 AutoCAD 二次开发 296 ObjectSnapModes.ModeIns 插入点(属性、块、文字的插入点) ObjectSnapModes.ModePerpindicular 垂足 ObjectSnapModes.ModeTangent 切点 ObjectSnapModes.ModeNear 最近点 (4)DragStatus 枚举对象 拖拽状态 DragStatus.DragStart 拖拽开始 DragStatus.DragEnd 拖拽结束 DragStatus.DragAbort 拖拽中止 [www.BimCad.org]深居浅出 AutoCAD 二次开发 297 (5)PromptStatus 枚举对象 选择状态 PromptStatus.OK 选择成功 PromptStatus.Cancel 选择取消 PromptStatus.Error 选择出错 PromptStatus.None 没有选中 PromptStatus.Keyword 输入关键字 PromptStatus.Modeless 从属性面板中输入 PromptStatus.Other 其他输入结果 (6) BooleanOperationType 枚举对象 布尔运算类型 BooleanOperationType.BoolIntersect 交集 BooleanOperationType.BoolSubtract 差集 BooleanOperationType.BoolUnite 并集 (7) SweepOptionsAlignOption 枚举对象 扫掠曲面对齐方式 SweepOptionsAlignOption.AlignSweepEntityToPath SweepOptionsAlignOption.NoAlignment SweepOptionsAlignOption.TranslatePathToSweepEntity SweepOptionsAlignOption.TranslateSweepEntityToPath [www.BimCad.org]深居浅出 AutoCAD 二次开发 298 (8) SubentityType 枚举对象 子对象选择类型 SubentityType.Class SubentityType.Edge 边界子实体 SubentityType.Face 面子实体 SubentityType.MlineCache SubentityType.Null 无 SubentityType.Vertex 顶点子实体 (9) HatchPatternType 枚举对象 填充类型 HatchPatternType.CustomDefined 自定义 HatchPatternType.PreDefined 预定义 HatchPatternType.UserDefined 用户定义 (10) DataType 枚举对象 填充类型 DataType.Buffer 缓冲区 [www.BimCad.org]深居浅出 AutoCAD 二次开发 299 DataType.Date 数据 DataType.Double 双精度 DataType.General 常规 DataType.Long 长整型 DataType.ObjectId ObjectId 型 DataType.Point Point2d 型 DataType.Point3d Point3d 型 DataType.Resbuf 结果缓冲区 DataType.String 字符串型 DataType.Unknown 未知型 (11) PaletteSetStyles 枚举对象 面板样式 PaletteSetStyles.NameEditable 可改名样式 PaletteSetStyles.Notify 通知样式 PaletteSetStyles.ShowAutoHideButton 显示自动隐藏按钮样式 PaletteSetStyles.ShowCloseButton 显示关闭按钮样式 PaletteSetStyles.ShowPropertiesMenu 显示属性菜单样式 [www.BimCad.org]深居浅出 AutoCAD 二次开发 300 PaletteSetStyles.ShowTabForSingle 显示标签样式 PaletteSetStyles.SingleRowDock 单行面板样式 PaletteSetStyles.Snappable Snappable PaletteSetStyles.UsePaletteNameAsTitleForSingle UsePaletteNameAsTitleForSingle [www.BimCad.org]深居浅出 AutoCAD 二次开发 301 【三】基本操作 本节分类介绍二次开发AutoCAD的基本操作及基本功能如何实现,更多的资料或交流讨论请参 阅http://www.BimCad.org的相关板块。 【1】实体对象 包括基本图形、图块、标注等实体对象的创建,及图形平移、缩放、复制、删除等操作编辑以及点、线、面、体等图形 的几何关系运算。 (1)创建对象 对象的创建主要通过实体的构造函数,详细的参数解释可以参见本章”(Entity)实体对象”小节。 常用到的命名空间: Autodesk.AutoCAD.ApplicationServices Autodesk.AutoCAD.DatabaseServices Autodesk.AutoCAD.Geometry (1.1)创建直线 /// /// 由两点创建直线 /// /// 点1 /// 点2 /// 点1为始点,点2为终点的直线 public static Line Line(Point3d pt1, Point3d pt2) { return new Line(pt1, pt2); } /// /// 由两点坐标创建直线 /// /// 起点X坐标 /// 起点Y坐标 /// 起点Z坐标 /// 终点X坐标 /// 终点Y坐标 /// 终点Z坐标 /// 直线 public static Line Line(double x1, double y1, double z1, double x2, double y2, double z2) { return new Line(new Point3d(x1, y1, z1), new Point3d(x2, y2, z2)); } (1.2)创建圆 /// /// 由圆心和半径创建圆 /// /// 圆心 /// 半径 /// public static Circle Circle(Point3d cenPt, double radius) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 302 return new Circle(cenPt, Vector3d.ZAxis, radius); } /// /// 由三点(Point3d)创建圆 /// /// 点1 /// 点2 /// 点3 /// 过三点的圆 public static Circle Circle(Point3d pt1, Point3d pt2, Point3d pt3) { Vector3d va = pt1.GetVectorTo(pt2); Vector3d vb = pt1.GetVectorTo(pt3); if (va.GetAngleTo(vb) == 0 | va.GetAngleTo(vb) == Math.PI) { return new Circle(); } else { CircularArc3d geoArc = new CircularArc3d(pt1, pt2, pt3); Point3d cenPt = new Point3d(geoArc.Center.X, geoArc.Center.Y, 0); double radius = geoArc.Radius; return new Circle(cenPt, Vector3d.ZAxis, radius); } } (1.3)创建圆弧 /// /// 由圆心、半径、起始角度和终止角度创建圆弧 /// /// 圆心 /// 半径 /// 起始角度 /// 终止角度 /// 圆弧 public static Arc Arc(Point3d cenPt, double radius, double startAng, double endAng) { return new Arc(cenPt, radius, startAng, endAng); } /// /// 由圆心、圆弧起点、圆弧终点创建圆弧 /// /// 圆心 /// 起点 /// 终点 /// public static Arc Arc(Point3d cenPt, Point3d sPt, Point3d ePt) { Line l1 = new Line(cenPt, sPt); Line l2 = new Line(cenPt, ePt); double radius = cenPt.DistanceTo(sPt); double startAng = l1.Angle; [www.BimCad.org]深居浅出 AutoCAD 二次开发 303 double endAng = l2.Angle; return new Arc(cenPt, radius, startAng, endAng); } (1.4)创建椭圆(椭圆弧) /// /// 创建椭圆 /// /// 椭圆中心 /// 长轴半径 /// 短轴半径 /// 起始角度 /// 终止角度 /// public static Ellipse Ellipse(Point3d center, Vector3d majorAxis, double radiusRatio, double startAngle, double endAngle) { Plane plane = new Plane(); Ellipse ellipse = new Ellipse(center, plane.Normal, majorAxis, radiusRatio, startAngle, endAngle); return ellipse; } (1.5)创建多段线 /// /// 由二维点集合和线宽创建二维优化多段线 /// /// 二维点集合 /// 线宽 /// 二维多段线 public static Polyline Polyline(Point2dCollection pts, double width) { try { Polyline ent = new Polyline(); for (int i = 0; i < pts.Count; i++) { ent.AddVertexAt(i, pts[i], 0, width, width); } return ent; } catch { return new Polyline(); } } /// /// 由三维点集合创建三维多段线 /// /// 三维点集合 /// 三维多段线 public static Polyline3d Polyline3d(Point3dCollection pts) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 304 try { return new Polyline3d(Poly3dType.SimplePoly, pts, false); } catch { return new Polyline3d(); } } (1.6)创建引线 /// /// 由三维点集合创建引线 /// /// 三维点集合 /// /// 引线 public static Leader Leader(Point3dCollection pts, bool splBool) { Leader ent = new Leader(); ent.IsSplined = splBool; for (int i = 0; i < pts.Count; i++) { ent.AppendVertex(pts[i]); ent.SetVertexAt(i, pts[i]); } return ent; } (1.7)创建单行文字 /// /// 由插入点、文字内容、文字样式、文字高度创建单行文字 /// /// 文字内容 /// 基点 /// 文字高度 /// 文字转角 /// 是否是包含域 /// public static DBText DBText(string textString, Point3d position, double height,double rot, bool isfield) { DBText txt = new DBText(); txt.Position = position; txt.Height = height; txt.Rotation = rot; if (isfield) { Field field = new Field(textString); txt.SetField(field); } else txt.TextString = textString; return txt; [www.BimCad.org]深居浅出 AutoCAD 二次开发 305 } (1.8)创建多行文字 /// /// 由插入点、文字内容、文字样式、文字高度、文字宽度创建多行文字 /// /// 文字内容 /// 基点 /// 文字高度 /// 宽度 /// 文字转角 /// 是否是包含域 /// public static MText Mtext(string textString,Point3d location, double height, double width,double rot,bool isfield) { MText txt = new MText(); txt.Location = location; txt.TextHeight = height; txt.Width = width; txt.Rotation = rot; if (isfield) { Field field = new Field(textString); txt.SetField(field); } else txt.Contents = textString; return txt; } (1.9)创建填充 /// /// 由边界对象集合数组、图案填充类型、填充图案名称、填充角度和填充比例创建图案填充的函数 /// /// 对象ID数组 /// 填充类型 partType:0为预定义图案;1为用户定义图案;2为自定义图案. /// 图案名称 /// 填充角度 /// 填充比例 /// 填充 public static Hatch Hatch(ObjectIdCollection[] objIds, HatchPatternType patType, string patName, double patternAngle, double patternScale) { Hatch ent = new Hatch(); ent.HatchObjectType = HatchObjectType.HatchObject; ent.PatternAngle = patternAngle; ent.PatternScale = patternScale; ent.SetHatchPattern(patType, patName); ent.Associative = true; for (int i = 0; i < objIds.Length; i++) { ent.InsertLoopAt(i, HatchLoopTypes.Default, objIds[i]); } return ent; [www.BimCad.org]深居浅出 AutoCAD 二次开发 306 } (1.10)创建标注 /// /// 以默认样式由两条尺寸界线原点和尺寸文本位置创建转角标注 /// /// 标注点1 /// 标注点2 /// 标注文本定位点 /// public static RotatedDimension RotatedDimension(Point3d pt1, Point3d pt2, Point3d ptText) { double angle = new Line(pt1, pt2).Angle; Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; RotatedDimension ent = new RotatedDimension(angle, pt1, pt2, ptText, "", style); return ent; } /// /// 由尺寸线旋转角度、两条尺寸界线原点、尺寸文本位置、尺寸文本和标注样式创建转角标注 /// /// 标注点1 /// 标注点2 /// 标注文本定位点 /// 标注替换文本 /// public static RotatedDimension RotatedDimension(Point3d pt1, Point3d pt2, Point3d ptText, string text) { double angle = new Line(pt1, pt2).Angle; Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; RotatedDimension ent = new RotatedDimension(angle, pt1, pt2, ptText, text, style); return ent; } /// /// 由圆、角度、引线长度创建直径标注 /// /// 圆 /// 角度 /// 引线长度 /// 直径标注 public static DiametricDimension DiametricDimension(Circle cir, double angle, double leaderLength) { Point3d cenPt = new Point3d(cir.Center.X, cir.Center.Y, 0); Point3d pt1 = Relation.PolarPoint(cenPt, angle, cir.Radius); Point3d pt2 = Relation.PolarPoint(cenPt, angle + 180, cir.Radius); Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; DiametricDimension ent = new DiametricDimension(pt1, pt2, leaderLength, "<>", style); return ent; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 307 /// /// 由圆弧,角度和引线长度创建半径标注 /// /// 圆 /// 角度 /// 引线长度 /// 半径标注 public static RadialDimension RadialDimension(Arc cir, double angle, double leaderLength) { Point3d cenPt = new Point3d(cir.Center.X, cir.Center.Y, 0); Point3d pt1 = Relation.PolarPoint(cenPt, angle, cir.Radius); Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; RadialDimension ent = new RadialDimension(cenPt, pt1, leaderLength, "<>", style); return ent; } /// /// 由圆,角度和引线长度创建半径标注 /// /// 圆 /// 角度 /// 引线长度 /// 半径标注 public static RadialDimension RadialDimension(Circle cir, double angle, double leaderLength) { Point3d cenPt = new Point3d(cir.Center.X, cir.Center.Y, 0); Point3d pt1 = Relation.PolarPoint(cenPt, angle, cir.Radius); Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; RadialDimension ent = new RadialDimension(cenPt, pt1, leaderLength, "<>", style); return ent; } /// /// 由两条尺寸界线原点和尺寸文本位置创建对齐标注 /// /// 点1 /// 点2 /// 尺寸文本位置 /// 对齐标注 public static AlignedDimension AlignedDimension(Point3d pt1, Point3d pt2, Point3d ptText) { Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; AlignedDimension ent = new AlignedDimension(pt1, pt2, ptText, "<>", style); return ent; } /// /// 创建圆弧标注 /// /// 要标注的圆弧 /// public static ArcDimension ArcDimension(Arc arc) [www.BimCad.org]深居浅出 AutoCAD 二次开发 308 { Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; ArcDimension ent = new ArcDimension(arc.Center, arc.StartPoint, arc.EndPoint, arc.StartPoint, "", style); return ent; } /// /// 角度标注 /// /// 标注线1 /// 标注线2 /// 定位点 /// public static LineAngularDimension2 AngleDimension(Line line1, Line line2, Point3d arcpoint) { Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; LineAngularDimension2 ent = new LineAngularDimension2(line1.StartPoint, line1.EndPoint, line2.StartPoint, line2.EndPoint, arcpoint, "", style); return ent; } /// /// 由标注起点点、长度、方向创建坐标标注X /// /// 起点 /// 方向点 /// 引线长度 /// 方向 fale为下.ture为上. /// public static OrdinateDimension DimOrdinateX(Point3d stratPoint, Point3d ordPt, double lenght, bool bo) { Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; // 由StartPoint 和ordPth点.根据方向和长度得到一终点坐标. Point3d pt1 = Relation.PolarPoint(ordPt, bo ? Relation.AngToRad(270) : Relation.AngToRad(90), lenght); OrdinateDimension entX = new OrdinateDimension(true, ordPt, pt1, "<>", style); entX.Origin = stratPoint; return entX; } /// /// 由标注点.和长度,方向创建坐标标注Y /// /// 起点 /// 方向点 /// 引线长度 /// 方向fale为左.ture为右. /// public static OrdinateDimension DimOrdinateY(Point3d stratPoint, Point3d ordPt, double lenght, bool bo) { Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; // 由ordPth点.根据方向和长度得到一终点坐标. [www.BimCad.org]深居浅出 AutoCAD 二次开发 309 Point3d pt1 = Relation.PolarPoint(ordPt, bo ? Relation.AngToRad(180) : 0, lenght); OrdinateDimension entY = new OrdinateDimension(false, ordPt, pt1, "<>", style); entY.Origin = stratPoint; return entY; } (1.11)创建面域 /// /// 由线条集合创建面域 /// /// /// public static Region Region(DBObjectCollection curveSegments) { return Autodesk.AutoCAD.DatabaseServices.Region.CreateFromCurves(curveSegments)[0] as Region; } (1.12)创建表面 /// /// 创建拉伸表面 /// /// 拉伸对象 /// 拉伸向量 /// public static ExtrudedSurface ExtrudedSurface(Entity sweepEntity, Vector3d vector) { ExtrudedSurface face = new ExtrudedSurface(); SweepOptions options = new SweepOptions(); face.CreateExtrudedSurface(sweepEntity, vector, options); return face; } /// /// 创建放样表面 /// /// 变化截面 /// 导线 /// 路径线 /// public static LoftedSurface LoftedSurface(Entity[] sections, Entity[] guideCurves, Entity pathCurve) { LoftedSurface face = new LoftedSurface(); LoftOptions options = new LoftOptions(); face.CreateLoftedSurface(sections, guideCurves, pathCurve, options); return face; } /// /// 创建平面表面 /// /// 面域 /// public static PlaneSurface PlaneSurface(Region region) [www.BimCad.org]深居浅出 AutoCAD 二次开发 310 { PlaneSurface face = new PlaneSurface(); face.CreateFromRegion(region); return face; } /// /// 创建旋转表面 /// /// 旋转对象 /// 轴线基点 /// 轴线方向 /// 旋转角度 /// 起始角度 /// public static RevolvedSurface RevolvedSurface(Entity revolveEntity,Point3d axisPoint,Vector3d axisDirection,double revolveAngle,double startAngle) { RevolvedSurface face = new RevolvedSurface(); RevolveOptions options = new RevolveOptions(); face.CreateRevolvedSurface(revolveEntity, axisPoint, axisDirection, revolveAngle, startAngle, options); return face; } /// /// 创建扫掠曲面 /// /// 扫掠对象 /// 路径对象 /// public static SweptSurface SweptSurface(Entity sweepEnt,Entity pathEnt) { SweptSurface face = new SweptSurface(); SweepOptions options = new SweepOptions(); face.CreateSweptSurface(sweepEnt, pathEnt, options); return face; } (1.13)创建三维对象 /// /// 创建长方体 /// /// 长 /// 宽 /// 高 /// public static Solid3d Box(double X, double Y, double Z) { Solid3d solid = new Solid3d(); solid.CreateBox(X,Y,Z); return solid; } /// /// 创建平截头体(圆椎体、圆柱体、圆台体) [www.BimCad.org]深居浅出 AutoCAD 二次开发 311 /// /// 平截头体高度 /// 底面X方向半径 /// 底面Y方向半径 /// 顶面X方向半径(椎体设为0) /// public static Solid3d Frustum(double height, double xRadius, double yRadius, double topxRadius) { Solid3d Solid = new Solid3d(); Solid.CreateFrustum(height, xRadius, yRadius, topxRadius); return Solid; } /// /// 棱台 /// /// 高 /// 底面多边形边数 /// 底面外切圆半径 /// 顶面外切圆半径 /// public static Solid3d Pyramid(double height, int sides, double radius, double topRadius) { Solid3d solid = new Solid3d(); solid.CreatePyramid(height, sides, radius, topRadius); return solid; } /// /// 楔体 /// /// 底面X /// 底面Y /// 底面Z /// public static Solid3d Wedge(double X, int Y, double Z) { Solid3d solid = new Solid3d(); solid.CreateWedge(X, Y, Z); return solid; } /// /// 圆环 /// /// 主圆半径 /// 圆环半径 /// public static Solid3d Torus(double majorRadius, int minorRadius) { Solid3d solid = new Solid3d(); solid.CreateTorus(majorRadius, minorRadius); return solid; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 312 /// /// 球体 /// /// 半径 /// public static Solid3d Sphere(double Radius) { Solid3d Solid = new Solid3d(); Solid.CreateSphere(Radius); return Solid; } /// /// 创建旋转三维实体 /// /// 旋转面域 /// 旋转轴上一点 /// 旋转轴方向 /// 旋转角度 /// 起始角度 /// public static Solid3d RevolvedSolid(Entity face, Point3d axisPt, Vector3d dir, double angle, double startAngle) { Solid3d Solid = new Solid3d(); RevolveOptions options = new RevolveOptions(); Solid.CreateRevolvedSolid(face, axisPt, dir, angle, startAngle, options); return Solid; } /// /// 创建拉伸实体 /// /// 拉伸对象 /// 拉伸方向向量 /// public static Solid3d ExtrudedSolid(Entity sweepEntity, Vector3d vector) { Solid3d Solid = new Solid3d(); SweepOptions Options = new SweepOptions(); Solid.CreateExtrudedSolid(sweepEntity, vector, Options); return Solid; } /// /// 扫掠实体 /// /// 扫掠面 /// 扫掠路径 /// public static Solid3d SweptSolid(Entity sweepEntity, Entity pathEntity) { Solid3d solid = new Solid3d(); SweepOptions options = new SweepOptions(); solid.CreateSweptSolid(sweepEntity, pathEntity, options); return solid; [www.BimCad.org]深居浅出 AutoCAD 二次开发 313 } (1.13)创建表格 /// /// 连接外部EXCEL表格数据,生成表格 /// /// Excel数据文件名 /// 表格插入基点 /// 数据表 public static Table Table(string filename, Point3d basePoint) { string dlName = "EXCEL"; Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; DataLinkManager dlm = db.DataLinkManager; ObjectId dlId = dlm.GetDataLink(dlName); if (dlId != ObjectId.Null) { dlm.RemoveDataLink(dlId); } DataLink dl = new DataLink(); dl.DataAdapterId = "AcExcel"; dl.Name = dlName; dl.Description = "www.bimcad.org";// description; dl.ConnectionString = filename; dl.DataLinkOption = DataLinkOption.PersistCache; dl.UpdateOption |= (int)UpdateOption.AllowSourceUpdate; dlId = dlm.AddDataLink(dl); Transaction tr = doc.TransactionManager.StartTransaction(); Table tb = new Table(); using (tr) { tr.AddNewlyCreatedDBObject(dl, true); BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead); tb.TableStyle = db.Tablestyle; tb.Position = basePoint; tb.Cells.SetDataLink(dlId, true); tb.GenerateLayout(); tr.Commit(); } dl.Dispose(); return tb; } (1.14)创建属性定义 /// /// 创建属性定义 /// /// 标记名 /// 提示 /// 属性值 /// 属性插入点位置 /// public static AttributeDefinition AttributeDefinition(string label, string prompt, string value, Point3d pt) [www.BimCad.org]深居浅出 AutoCAD 二次开发 314 { AttributeDefinition ad = new AttributeDefinition(); ad.Constant = false; ad.Tag = label; ad.Prompt = prompt; ad.TextString = value; ad.Position = pt; return ad; } (1.15)创建属性参照 /// /// 创建属性参照 /// /// /// public static AttributeReference AttributeReference(AttributeDefinition ad) { AttributeReference ar = new AttributeReference(); ar.SetAttributeFromBlock(ad, new Matrix3d()); return ar; } (2)编辑对象 图形对象通用的编辑方法包括及平移、缩放、复制、旋转、镜像、阵列等。 常用到的命名空间: System.Collections.Generic; Autodesk.AutoCAD.DatabaseServices; Autodesk.AutoCAD.Geometry; (2.1)移动 /// /// 指定基点与目标点移动实体 /// /// 实体对象 /// 基点 /// 目标点 public static void Move(Entity ent, Point3d basePt, Point3d targetPt) { Vector3d vec = targetPt - basePt; Matrix3d mt = Matrix3d.Displacement(vec); ent.TransformBy(mt); } (2.2)复制 /// /// 指定基点与目标点复制实体 /// /// 实体对象 /// 基点 /// 目标点 /// 复制的实体对象 public static Entity CopyTo(Entity ent, Point3d sourcePt, Point3d targetPt) [www.BimCad.org]深居浅出 AutoCAD 二次开发 315 { Matrix3d mt = Matrix3d.Displacement(targetPt - sourcePt); Entity entCopy = ent.GetTransformedCopy(mt); return entCopy; } (2.3)旋转 /// /// 指定基点与旋转角度旋转实体 /// /// 实体对象 /// 基点 /// 旋转角度 /// 旋转轴(XY平面内旋转则设为Vector3d.ZAxis) public static void Rotate(Entity ent, Point3d basePt, double angle, Vector3d Axis) { Matrix3d mt = Matrix3d.Rotation(angle, Axis, basePt); ent.TransformBy(mt); } (2.4)缩放 /// /// 指定基点与比例缩放实体 /// /// 实体对象 /// 基点 /// 缩放比例 public static void Scale(Entity ent, Point3d basePt, double scaleFactor) { Matrix3d mt = Matrix3d.Scaling(scaleFactor, basePt); ent.TransformBy(mt); } (2.5)镜像 /// /// 按照参照点镜像实体 /// /// 实体对象 /// 镜像点1 /// 镜像点2 public static void Mirror(Entity ent, Point3d mirrorPt1, Point3d mirrorPt2) { Line3d mirrorLine = new Line3d(mirrorPt1, mirrorPt2); Matrix3d mt = Matrix3d.Mirroring(mirrorLine); ent.TransformBy(mt); } /// /// 按照指定直线镜像实体 /// /// /// public static void Mirror(Entity ent, Line line) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 316 Line3d mirrorLine = new Line3d(line.StartPoint, line.EndPoint); Matrix3d mt = Matrix3d.Mirroring(mirrorLine); ent.TransformBy(mt); } (2.6)偏移 /// /// 获得指定偏移距的偏移对象 /// /// 待偏移曲线 /// 便宜距离 /// 偏移后对象集合 public static List Offset(Curve cur, double dis) { ObjectId ModelSpaseID = SymbolUtilityServices.GetBlockModelSpaceId(HostApplicationServices.WorkingDatabase); List Cl = new List(); try { DBObjectCollection offsetCur = cur.GetOffsetCurves(dis); foreach (var i in offsetCur) { Cl.Add((Curve)i); } } catch { } return Cl; } (2.7)阵列 /// /// 指定行数、列数、行距、列距矩形阵列实体 /// /// 要阵列的对象 /// 行数 /// 列数 /// 行距 /// 列距 /// 阵列后的对象集合 public static Entity[] ArrayRectang(Entity ent, int numRows, int numCols, double disRows, double disCols) { Entity[] ents = new Entity[numRows * numCols]; int N = 0; for (int m = 0; m < numRows; m++) { for (int n = 0; n < numCols; n++) { Matrix3d mt = Matrix3d.Displacement(new Vector3d(n * disCols, m * disRows, 0)); ents[N] = ent.GetTransformedCopy(mt); N++; } } return ents; [www.BimCad.org]深居浅出 AutoCAD 二次开发 317 } /// /// 指定圆心、阵列数量、角度圆形阵列实体 /// /// 要整列的实体对象 /// 阵列圆心 /// 阵列数量 /// 角度 /// 阵列后的实体对象 public static Entity[] ArrayPolar(Entity ent, Point3d cenPt, int numObj, double Angle) { Entity[] ents = new Entity[numObj]; ents[0] = ent; for (int i = 1; i < numObj; i++) { Matrix3d mt = Matrix3d.Rotation(Angle * i / numObj, Vector3d.ZAxis, cenPt); ents[i] = ent.GetTransformedCopy(mt); } return ents; } (2.8)设置动态块属性 /// /// 设置动态块属性 /// /// 要设置属性的动态块参照 /// 属性数组 public static void SetDynamicValue(BlockReference br, Property[] properties) { try { if (br.IsDynamicBlock) { foreach (DynamicBlockReferenceProperty dbrp in br.DynamicBlockReferencePropertyCollection) { for (int i = 0; i < properties.Length; i++) { if (dbrp.PropertyName == properties[i].PropertyName) { dbrp.Value = properties[i].Value; } } } } } catch { } } /// /// 动态块属性 /// public class Property [www.BimCad.org]深居浅出 AutoCAD 二次开发 318 { private string propertyname; private double value; public string PropertyName { get { return propertyname; } } public double Value { get { return value; } } public Property(string PropertyName, double Value) { propertyname = PropertyName; value = Value; } } (2.9)改变对象绘图次序 /// /// 改变对象的绘图次序到顶层 /// /// /// public static void MoveTop(Entity ent,Database db) { using (Transaction tr = db.TransactionManager.StartTransaction()) { ObjectIdCollection idc=new ObjectIdCollection(); idc.Add(ent.ObjectId); BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite, false); BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false); DrawOrderTable orderTable = tr.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable; orderTable.MoveToTop(idc); tr.Commit(); } } (2.10)写块克隆对象 /// /// 写块克隆对象 /// /// 对象ObjectId集合 /// 目标文件名 public static void WBClone(ObjectIdCollection idCollection, string fileName) { Database TargetDb = new Database(true, true); ObjectId IdBtr = new ObjectId(); Database db = idCollection[0].Database; IdMapping Map = new IdMapping(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 319 using (Transaction trans = TargetDb.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(TargetDb.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead); IdBtr = btr.ObjectId; db.WblockCloneObjects(idCollection, IdBtr, Map, DuplicateRecordCloning.Replace, false); TargetDb.SaveAs(fileName, DwgVersion.Current); trans.Commit(); } } (3)几何关系 介绍常用的基本几何运算的方法。 常用到的命名空间: System.Collections.Generic; Autodesk.AutoCAD.DatabaseServices; Autodesk.AutoCAD.Geometry; (3.1)角度与弧度转换 /// /// 角度转化为弧度 /// /// 角度 /// 弧度 public static double AngToRad(double angle) { return angle * Math.PI / 180; } /// /// 弧度转化为角度 /// /// 弧度 /// 角度 public static double RadToAng(double rad) { return rad * 180 / Math.PI; } (3.2)夹角 /// /// 两点组成的线段与X轴之间夹角 /// /// 起点 /// 终点 /// 角度 public static double Angle(Point3d startPt, Point3d endPt) { Line L = new Line(startPt, endPt); return L.Angle; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 320 /// /// 两直线间夹角 /// /// 线1 /// 线2 /// public static double Angle(Line line1, Line line2) { return Math.Abs(line1.Angle - line2.Angle); } (3.3)距离 /// /// 点到曲线距离 /// /// 指定点 /// 指定线 /// 是否延伸 /// 距离 public static double Distance(Point3d point, Curve cur, bool bo) { return cur.GetClosestPointTo(point, bo).DistanceTo(point); } /// /// 直线距离 /// /// 直线1 /// 直线2 /// 两线间距离 public static double Distance(Line line1, Line line2) { if (Relation.Parallel(line1, line2)) { return line1.GetClosestPointTo(line2.StartPoint, true).DistanceTo(line2.StartPoint); } else { return 0; } } (3.4)相对点 /// /// 获取与给定点指定角度和距离的点 /// /// 基点 /// 角度 /// 距离 /// 相对点 public static Point3d RelativePoint(Point3d basePt, double angle, double distance) { double[] pt = new double[3]; angle = angle * Math.PI / 180; [www.BimCad.org]深居浅出 AutoCAD 二次开发 321 pt[0] = basePt[0] + distance * Math.Cos(angle); pt[1] = basePt[1] + distance * Math.Sin(angle); pt[2] = basePt[2]; Point3d point = new Point3d(pt[0], pt[1], pt[2]); return point; } /// /// 获取与给定点相对距离的点 /// /// 起点 /// 相对X距离 /// 相对Y距离 /// public static Point3d RelativePoint(Point3d basePt, double x, double y,double z) { return new Point3d(basePt.X + x, basePt.Y + y, basePt.Z+z); } (3.5)中点 /// /// 计算两点中点 /// /// 点1 /// 点2 /// 中点 public static Point3d MidPoint(Point3d pt1, Point3d pt2) { return new Point3d((pt1.X + pt2.X) / 2.0, (pt1.Y + pt2.Y) / 2.0, 0.0); } /// /// 计算线段中点 /// /// 指定线段 /// 中点 public static Point3d MidPoint(Line line) { return MidPoint(line.StartPoint, line.EndPoint); } (3.6)重合 /// /// 判断点是否重合 /// /// 点1 /// 点2 /// 容差 /// 是否重合 public static bool Coincide(Point3d point1, Point3d point2, double allowance) { if (point1.DistanceTo(point2) < allowance) { return true; [www.BimCad.org]深居浅出 AutoCAD 二次开发 322 } else { return false; } } /// /// 判断线段是否重合 /// /// 线段1 /// 线段2 /// 容差 /// 线段是否重合 public static bool Coincide(Line line1, Line line2, double allowance) { LineSegment3d l1 = new LineSegment3d(line1.StartPoint, line1.EndPoint); LineSegment3d l2 = new LineSegment3d(line2.StartPoint, line2.EndPoint); Tolerance tol = new Tolerance(allowance, allowance); return l1.IsColinearTo(l2, tol); } /// /// 获取两条线段重合部分 /// /// 线段1 /// 线段2 /// 重合部分 public static Line Coincide(Line line1, Line line2) { LineSegment3d l1 = new LineSegment3d(line1.StartPoint, line1.EndPoint); LineSegment3d l2 = new LineSegment3d(line2.StartPoint, line2.EndPoint); LinearEntity3d l3 = l1.Overlap(l2); return new Line(l3.StartPoint, l3.EndPoint); } (3.7)相交 /// /// 给定延伸方式求曲线交点 /// /// 曲线1 /// 曲线2 /// 延伸方式 /// 交点集合 public static Point3dCollection Intersect(Curve cur1, Curve cur2, Autodesk.AutoCAD.DatabaseServices.Intersect inter) { Point3dCollection ptc = new Point3dCollection(); cur1.IntersectWith(cur2, inter, ptc, 0, 0); return ptc; } /// /// 判断点是否在曲线上 /// [www.BimCad.org]深居浅出 AutoCAD 二次开发 323 /// 指定点 /// 指定线 /// 容差 /// 点是否在直线上 public static bool Inside(Point3d pt, Curve cur, double allowance) { if (Relation.Distance(pt, cur, true) < allowance) { return true; } else { return false; } } (3.8)平行 /// /// 判断直线是否平行 /// /// 直线1 /// 直线2 /// 是否平行 public static bool Parallel(Line line1, Line line2) { Plane P = new Plane(); LineSegment3d l1 = new LineSegment3d(line1.StartPoint, line1.EndPoint); LineSegment3d l2 = new LineSegment3d(line2.StartPoint, line2.EndPoint); return l1.IsCoplanarWith(l2, out P); } (3.9)垂直 /// /// 判断直线是否垂直 /// /// 直线1 /// 直线2 /// 容差 /// 两线是否垂直 public static bool Perpendicular(Line line1, Line line2, double allowance) { LineSegment3d l1 = new LineSegment3d(line1.StartPoint, line1.EndPoint); LineSegment3d l2 = new LineSegment3d(line2.StartPoint, line2.EndPoint); Tolerance tol = new Tolerance(allowance, allowance); return l1.IsPerpendicularTo(l2, tol); } (3.10)布尔运算 /// /// 三维实体布尔运算 /// /// /// /// [www.BimCad.org]深居浅出 AutoCAD 二次开发 324 public static Solid3d BooleanOper(Solid3d solid1, Solid3d solid2, BooleanOperationType type) { solid1.BooleanOperation(type, solid2); return solid1; } 【2】数据库 对数据库的操作主要包括层表、块表、命名对象词典等数据库容器的操作。 (1)数据库操作 常用的数据库操作:获得当前数据库、获得对象、删除对象、数据库克隆等方法。 常用到的命名空间: Autodesk.AutoCAD.DatabaseServices; (1.1)获得数据库 /// /// 当前工作的数据库 /// /// public static Database WorkingDataBase() { return HostApplicationServices.WorkingDatabase; } /// /// 当前活动文档数据库 /// /// public static Database DocumentDatabase() { return Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; } (1.2)获得对象 /// /// 由对象ObjectId获得对象 /// /// ObjectId /// 打开模式 /// 数据库 /// public static DBObject GetObject(ObjectId id,OpenMode mode, Database db) { DBObject Obj; using (Transaction tr = db.TransactionManager.StartTransaction()) { Obj = tr.GetObject(id, mode) as DBObject; tr.Commit(); } return Obj; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 325 (1.3)删除对象 /// /// 删除单个对象 /// /// 要删除对象 public static void Remove(DBObject obj) { Database db = obj.Database; using (Transaction trans = db.TransactionManager.StartTransaction()) { obj.Erase(); trans.Commit(); } } /// /// 删除ObjectId集合中的对象 /// /// public static void Remove(ObjectIdCollection ids) { if (ids.Count == 0) { return; } //获得所选对象第一个ID所在的数据库 Database db = ids[0].OriginalDatabase; using (Transaction trans = db.TransactionManager.StartTransaction()) { Entity ent; foreach (ObjectId id in ids) { ent = trans.GetObject(id, OpenMode.ForWrite) as Entity; if (ent != null) ent.Erase(); } trans.Commit(); } } (1.4)数据库克隆 /// /// 数据库克隆 /// /// 克隆的对象ID集合 /// 克隆到的文件名 public static void Clone(ObjectIdCollection idCollection, string fileName) { Database ndb = new Database(true, true); ObjectId IdBtr = new ObjectId(); Database db = idCollection[0].Database; IdMapping map = new IdMapping(); using (Transaction trans = ndb.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(ndb.BlockTableId, OpenMode.ForRead); [www.BimCad.org]深居浅出 AutoCAD 二次开发 326 BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead); IdBtr = btr.ObjectId; trans.Commit(); } db.WblockCloneObjects(idCollection, IdBtr, map, DuplicateRecordCloning.Replace, false); ndb.SaveAs(fileName, DwgVersion.Current); } (2)块表操作 常用到的命名空间: Autodesk.AutoCAD.ApplicationServices; Autodesk.AutoCAD.DatabaseServices; Autodesk.AutoCAD.EditorInput; Autodesk.AutoCAD.Geometry; Autodesk.AutoCAD.Colors; (2.1)获取块表 /// /// 获取块表记录ObjectId /// /// 数据库 /// public static ObjectId Id(Database db) { return db.BlockTableId; } /// /// 获取块表 /// /// 数据库 /// public static BlockTable BlockTable(Database db) { BlockTable bt; using (Transaction tr = db.TransactionManager.StartTransaction()) { bt = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; tr.Commit(); } return bt; } (2.2)获取块表记录 /// /// 由块表记录名获得块表记录 /// /// 块表记录名 /// 数据库 /// public static BlockTableRecord GetBlock(string btrName, Database db) { BlockTableRecord block = new BlockTableRecord(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 327 using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; block = tr.GetObject(bt[btrName], OpenMode.ForRead) as BlockTableRecord; tr.Commit(); } return block; } (2.3)添加对象到块表记录 /// /// 将一个实体添加到当前空间 /// /// 对象 /// 数据库 /// public static ObjectId AddIn(Entity ent, Database db) { ObjectId id; using (Transaction tr = db.TransactionManager.StartTransaction()) { id = ((BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite, false)).AppendEntity(ent); tr.AddNewlyCreatedDBObject(ent, true); tr.Commit(); } return id; } /// /// 将一个实体添加到块表记录 /// /// 对象 /// 块定义 /// public static ObjectId AddEntToBlock(Entity ent, BlockTableRecord block) { ObjectId id = new ObjectId(); Database db = block.Database; using (Transaction transaction = db.TransactionManager.StartTransaction()) { transaction.GetObject(block.ObjectId, OpenMode.ForWrite); id = block.AppendEntity(ent); transaction.AddNewlyCreatedDBObject(ent, true); transaction.Commit(); } return id; } (2.4)添加块表记录(图块)到块表 /// /// 将块表记录加入到块表中 /// /// public static ObjectId AddIn(BlockTableRecord btr, Database db) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 328 ObjectId id = new ObjectId(); using (Transaction transaction = db.TransactionManager.StartTransaction()) { BlockTable bt = transaction.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; id = bt.Add(btr); transaction.AddNewlyCreatedDBObject(btr, true); transaction.Commit(); } return id; } (2.5)模型空间 /// /// 获得模型空间ObjectId /// /// /// public static ObjectId ModelSpaceId(Database db) { return SymbolUtilityServices.GetBlockModelSpaceId(db); } /// /// 将一个图形对象加入到指定的Database的模型空间 /// /// 实体对象 /// 数据库 /// public static ObjectId AddToModelSpace(Entity ent, Database db) { ObjectId entId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); entId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } return entId; } /// /// 将一组图形对象加入到指定的Database的模型空间 /// /// 要添加的对象集合 /// 数据库 /// public static ObjectIdCollection AddToModelSpace(DBObjectCollection entCollection, Database db) { ObjectIdCollection objIds = new ObjectIdCollection(); using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); foreach (DBObject obj in entCollection) [www.BimCad.org]深居浅出 AutoCAD 二次开发 329 { Entity ent = obj as Entity; if (ent != null) { objIds.Add(btr.AppendEntity(ent)); trans.AddNewlyCreatedDBObject(ent, true); } } trans.Commit(); } return objIds; } /// /// 将指定的块定义变成块参照添加到指定模型空间 /// /// 块定义 /// 插入点 /// 数据库 /// public static ObjectId AddToModelSpace(BlockTableRecord block, Point3d pt, Database db) { ObjectId blkrfid = new ObjectId(); using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord modelspace = trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; BlockReference br = new BlockReference(pt, block.ObjectId); // 通过块定义添加块参照 blkrfid = modelspace.AppendEntity(br); //把块参照添加到块表记录 trans.AddNewlyCreatedDBObject(br, true); // 通过事务添加块参照到数据库 foreach (ObjectId id in block) { if (id.ObjectClass.Equals(RXClass.GetClass(typeof(AttributeDefinition)))) { AttributeDefinition ad = trans.GetObject(id, OpenMode.ForRead) as AttributeDefinition; AttributeReference ar = new AttributeReference(ad.Position, ad.TextString, ad.Tag, new ObjectId()); br.AttributeCollection.AppendAttribute(ar); } } trans.Commit(); } return blkrfid; } (3)层表操作 常用到的命名空间: Autodesk.AutoCAD.ApplicationServices; Autodesk.AutoCAD.DatabaseServices; Autodesk.AutoCAD.EditorInput; Autodesk.AutoCAD.Geometry; Autodesk.AutoCAD.Runtime; Autodesk.AutoCAD.Colors; (3.1)获得层表 /// [www.BimCad.org]深居浅出 AutoCAD 二次开发 330 /// 获得层表ObjectId /// /// /// public static ObjectId Id(Database db) { return db.LayerTableId; } /// /// 获得层表 /// /// /// public static LayerTable GetLayerTable(Database db) { LayerTable layertable; using (Transaction trans = db.TransactionManager.StartTransaction()) { layertable = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite); } return layertable; } (3.2)获得层表记录 /// /// 根据图层名获得图层(没有删除标记的) /// /// 图层名 /// 数据库 /// public static LayerTableRecord GetLayer(string name, Database db) { LayerTableRecord layer = new LayerTableRecord(); using (Transaction trans = db.TransactionManager.StartTransaction()) { LayerTableRecord layer0 = new LayerTableRecord() ; LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForRead); if (lt.Has(name)) { layer0 = trans.GetObject(lt[name], OpenMode.ForRead) as LayerTableRecord; if (!layer0.IsErased) layer = layer0; } trans.Commit(); } return layer; } /// /// 获取当前图层ObjectId /// /// 数据库 /// public static LayerTableRecord GetCurrentLayer(Database db) [www.BimCad.org]深居浅出 AutoCAD 二次开发 331 { LayerTableRecord layer = new LayerTableRecord(); using (Transaction tr = db.TransactionManager.StartTransaction()) { layer = tr.GetObject(db.Clayer, OpenMode.ForRead) as LayerTableRecord; } return layer; } (3.3)设置当前图层 /// /// 设置当前层 /// /// 要设置为当前的图层 /// 数据库 public static void SetCurrentLayer(LayerTableRecord layer, Database db) { if (layer.ObjectId != ObjectId.Null) db.Clayer = layer.ObjectId; } (3.4)新建层表记录(图层) /// /// 新建一个给定名字的图层 /// /// 新增图层名 /// 数据库 /// public static ObjectId AddIn(string layerName, Database db) { ObjectId layerId = ObjectId.Null; using (Transaction trans = db.TransactionManager.StartTransaction()) { LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite); if (!lt.Has(layerName)) { LayerTableRecord ltr = new LayerTableRecord(); ltr.Name = layerName; layerId = lt.Add(ltr); trans.AddNewlyCreatedDBObject(ltr, true); } trans.Commit(); } return layerId; } /// /// 建立指定名字,颜色的图层 /// /// 新增图层名 /// 颜色值 /// 数据库 /// public static ObjectId AddIn(string layerName, short colorIndex, Database db) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 332 short colorIndex1 = (short)(colorIndex % 256);//防止输入的颜色超出256 using (Transaction trans = db.TransactionManager.StartTransaction()) { LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite); ObjectId layerId = ObjectId.Null; if (lt.Has(layerName) == false) { LayerTableRecord ltr = new LayerTableRecord(); ltr.Name = layerName; ltr.Color = Color.FromColorIndex(ColorMethod.ByColor, colorIndex1); layerId = lt.Add(ltr); trans.AddNewlyCreatedDBObject(ltr, true); } trans.Commit(); return layerId; } } (3.5)删除层表记录(图层) /// /// 删除指定名字的图层 /// /// /// public static void RemoveLayer(string layerName, Database db) { using (Transaction trans = db.TransactionManager.StartTransaction()) { LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite); LayerTableRecord currentLayer = (LayerTableRecord)trans.GetObject(db.Clayer, OpenMode.ForRead); if (currentLayer.Name.ToLower() == layerName.ToLower()) Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n不能删除当前层"); else { LayerTableRecord ltr = new LayerTableRecord(); if (lt.Has(layerName)) { ltr = trans.GetObject(lt[layerName], OpenMode.ForWrite) as LayerTableRecord; if (ltr.IsErased) Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n此层已经被删除"); else { ObjectIdCollection idCol = new ObjectIdCollection(); idCol.Add(ltr.ObjectId); db.Purge(idCol); if (idCol.Count == 0) Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n不能删除包含对象的图层"); else ltr.Erase(); } } else Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\n没有此图层"); } trans.Commit(); } [www.BimCad.org]深居浅出 AutoCAD 二次开发 333 } (3.6)删除与图层关联的对象 /// /// 删除与图层关联的对象 /// /// 图层 /// 数据库 public static void RemoveAllEntFromLayer(LayerTableRecord layer, Database db) { using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForWrite); foreach (ObjectId btrid in bt)//遍历块表 { BlockTableRecord btr = (BlockTableRecord)trans.GetObject(btrid, OpenMode.ForWrite); foreach (ObjectId eid in btr)//遍历块表记录 { Entity ent = trans.GetObject(eid, OpenMode.ForWrite) as Entity; if (ent != null) { if (ent.LayerId == layer.ObjectId) ent.Erase(); } } } trans.Commit(); } } (4)词典操作 常用命名空间: Autodesk.AutoCAD.DatabaseServices; (4.1)命名对象词典 /// /// 将一个对象加到命名对象词典 /// /// 要添加到命名对象词典的对象 /// 词典记录名 /// 数据库 public static void AddObjToNOD(DBObject dataObj, string name,Database db) { using (Transaction tr = db.TransactionManager.StartTransaction()) { DBDictionary Dict = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite) as DBDictionary; Dict.SetAt(name, dataObj); tr.Commit(); } } /// /// 获得命名对象扩展词典中的对象 /// [www.BimCad.org]深居浅出 AutoCAD 二次开发 334 /// 词典记录名 /// 词典数据库 /// public static DBObject GetObjFromNod(string name, Database db) { DBObject obj = null; using (Transaction tr = db.TransactionManager.StartTransaction()) { DBDictionary Dict = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite) as DBDictionary; obj = tr.GetObject(Dict.GetAt(name), OpenMode.ForWrite); tr.Commit(); } return obj; } (4.2)对象扩展词典 /// /// 添加一个对象到对象扩展词典 /// /// 要添加到扩展词典的对象 /// 词典对象的宿主 /// 词典记录名 public static void AddObjToExtensionDictionary(DBObject dataObj, DBObject dbObject, string Name) { Database db = dbObject.Database; using (Transaction tr = db.TransactionManager.StartTransaction()) { if (dbObject.ExtensionDictionary == new ObjectId()) dbObject.CreateExtensionDictionary(); DBDictionary extensionDic = (DBDictionary)tr.GetObject(dbObject.ExtensionDictionary, OpenMode.ForWrite, false); extensionDic.SetAt(Name, dataObj); tr.Commit(); } } /// /// 从对象扩展词典读取数据对象 /// /// 词典对象的宿主 /// 词典记录名 public static DBObject GetObjFromExtensionDictionary(DBObject dbObject, string name) { DBObject obj=null; Database db = dbObject.Database; using (Transaction tr = db.TransactionManager.StartTransaction()) { if (dbObject.ExtensionDictionary != new ObjectId()) { DBDictionary extensionDic = (DBDictionary)tr.GetObject(dbObject.ExtensionDictionary, OpenMode.ForWrite, false); obj = tr.GetObject(extensionDic.GetAt(name), OpenMode.ForWrite); } tr.Commit(); } return obj; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 335 【3】用户交互 包括获取用户输入数据,拾取对象,选择集及数据信息的显示的操作。 (1)输入数据 常用命名空间: using System; using System.Windows.Forms;//引用System.Windows.Form DLL。 using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; (1.1) 输入关键字 /// /// 提示用户输入关键字 /// /// /// /// 用户输入的字符 public static string Keywords(string message, string[] keywords) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptKeywordOptions ko = new PromptKeywordOptions(message); for (int i = 0; i < keywords.Length; i++) { ko.Keywords.Add(keywords[i]); } ko.Keywords.Default = keywords[0]; ko.AllowNone = true; PromptResult k = ed.GetKeywords(ko); if (k.Status == PromptStatus.OK) { return k.StringResult; } else { return ""; } } (1.2) 输入实数 /// /// 提示用户输入实数 /// /// /// 用户输入的实数 public static double Double(string message) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptDoubleResult d = ed.GetDouble(message); if (d.Status == PromptStatus.OK) [www.BimCad.org]深居浅出 AutoCAD 二次开发 336 { return (double)d.Value; } else { return 0.0; } } (1.3) 输入整数 /// /// 提示用户输入整数 /// /// 提示 /// 用户输入的整数 public static int Int(string message) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptIntegerResult i = ed.GetInteger(message); if (i.Status == PromptStatus.OK) { return (int)i.Value; } else { return 0; } } (1.4) 输入角度 /// /// 提示用户输入角度 /// /// 提示 /// 用户输入的角度 public static double Angle(string message) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptDoubleResult i = ed.GetAngle(message); if (i.Status == PromptStatus.OK) { return (double)i.Value; } else { return 0; } } (1.5) 输入矩形角点区域 /// /// 获取用户输入的矩形角点区域 /// /// 基点提示 /// 角点提示 [www.BimCad.org]深居浅出 AutoCAD 二次开发 337 /// 用户输入的矩形角点区域 public static Extents3d Corner(string baseword, string targetword) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Point3d basept = Point(baseword); Point3d targetpt = new Point3d(); PromptCornerOptions options = new PromptCornerOptions(targetword, basept); PromptPointResult i = ed.GetCorner(options); if (i.Status == PromptStatus.OK) { targetpt = i.Value; } Extents3d ext = new Extents3d(); ext.AddPoint(targetpt); ext.AddPoint(basept); return ext; } (1.6) 输入点 /// /// 提示用户拾取点 /// /// 提示 /// 返回Point3d public static Point3d Point(string message) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptPointResult pt = ed.GetPoint(message); if (pt.Status == PromptStatus.OK) { return (Point3d)pt.Value; } else { return new Point3d(); } } (1.7) 输入距离 /// /// 提示用户获取距离 /// /// 提示 /// public static double Distance(string message) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptDoubleResult dis = ed.GetDistance(message); if (dis.Status == PromptStatus.OK) { return dis.Value; } else { return 0; [www.BimCad.org]深居浅出 AutoCAD 二次开发 338 } } (1.8) 输入文件名 /// /// 提示框提示用户输入文件名作为文件打开 /// /// 提示 /// public static string FileNameForOpen(string message) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptFileNameResult i = ed.GetFileNameForOpen(message); if (i.Status == PromptStatus.OK) { return i.StringResult; } else { return ""; } } /// /// 提示框提示用户输入文件名作为文件保存 /// /// 提示 /// public static string FileNameForSave(string message) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; PromptFileNameResult i = ed.GetFileNameForSave(message); if (i.Status == PromptStatus.OK) { return i.StringResult; } else { return ""; } } (1.9) 输入路径 /// /// 输入文件夹路径 /// /// public static string Path() { FolderBrowserDialog path = new FolderBrowserDialog(); if (path.ShowDialog() == DialogResult.OK) { return path.SelectedPath.ToString(); } else [www.BimCad.org]深居浅出 AutoCAD 二次开发 339 { return ""; } } (2)选择对象 常用命名空间: Autodesk.AutoCAD.ApplicationServices; Autodesk.AutoCAD.DatabaseServices; Autodesk.AutoCAD.Geometry; Autodesk.AutoCAD.EditorInput; 定义的枚举类型: /// /// 类型过滤枚举类 /// public enum FilterType { Curve, Dimension, Polyline, BlockRef, Circle, Line, Arc, Text, Mtext, Polyline3d } (2.1) 选择单个对象 /// /// 选择单个实体 /// /// 选择提示 /// 实体对象 public static Entity Entity(string message) { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity=null; PromptEntityResult ent = ed.GetEntity(message); if (ent.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { entity = (Entity)transaction.GetObject(ent.ObjectId, OpenMode.ForRead, true); transaction.Commit(); } } return entity; } /// /// 过滤选择单个实体 /// /// 过滤提示 /// 错误提示 /// 选择提示 /// 过滤类型 /// true表示不包括其基类,false则表示包括其基类 /// public static Entity Entity(string optionsWord, string optionsMessage, string word, Type tp, bool bo) [www.BimCad.org]深居浅出 AutoCAD 二次开发 340 { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; PromptEntityOptions entops = new PromptEntityOptions(optionsWord); entops.SetRejectMessage(optionsMessage); entops.AddAllowedClass(tp, bo); //此处的true表示不包括其基类,false则表示包括其基类 PromptEntityResult ent = ed.GetEntity(word); if (ent.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { entity = (Entity)transaction.GetObject(ent.ObjectId, OpenMode.ForWrite, true); transaction.Commit(); } } return entity; } (2.2) 选择集合 /// /// 选择集合 /// /// public static DBObjectCollection Collection() { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionResult ents = ed.GetSelection(); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet SS = ents.Value; foreach (ObjectId id in SS.GetObjectIds()) { entity = (Entity)transaction.GetObject(id, OpenMode.ForWrite, true); if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } /// /// 过滤选择集合 /// /// 过滤类型 /// ObjectId数组 public static DBObjectCollection Collection(FilterType[] tps) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 341 Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionOptions selops = new PromptSelectionOptions(); // 建立选择的过滤器内容 TypedValue[] filList = new TypedValue[tps.Length + 2]; filList[0] = new TypedValue((int)DxfCode.Operator, ""); for (int i = 0; i < tps.Length; i++) { filList[i + 1] = new TypedValue((int)DxfCode.Start, tps[i].ToString()); } // 建立过滤器 SelectionFilter filter = new SelectionFilter(filList); // 按照过滤器进行选择 PromptSelectionResult ents = ed.GetSelection(selops, filter); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet SS = ents.Value; foreach (ObjectId id in SS.GetObjectIds()) { entity = (Entity)transaction.GetObject(id, OpenMode.ForWrite, true); if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } (2.4) 选择所有对象 /// /// 选择所有对象 /// /// public static DBObjectCollection All() { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionResult ents = ed.SelectAll(); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet ss = ents.Value; foreach (ObjectId id in ss.GetObjectIds()) { entity = transaction.GetObject(id, OpenMode.ForWrite, true) as Entity; if (entity != null) EntityCollection.Add(entity); [www.BimCad.org]深居浅出 AutoCAD 二次开发 342 } transaction.Commit(); } } return EntityCollection; } /// /// 过滤选择所有对象 /// /// public static DBObjectCollection All(FilterType[] tps) { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; // 建立选择的过滤器内容 TypedValue[] filList = new TypedValue[tps.Length + 2]; filList[0] = new TypedValue((int)DxfCode.Operator, ""); for (int i = 0; i < tps.Length; i++) { filList[i + 1] = new TypedValue((int)DxfCode.Start, tps[i].ToString()); } SelectionFilter filter = new SelectionFilter(filList); DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionResult ents = ed.SelectAll(filter); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet ss = ents.Value; foreach (ObjectId id in ss.GetObjectIds()) { entity = transaction.GetObject(id, OpenMode.ForWrite, true) as Entity; if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } (2.5) 选择多边形区域内对象 /// /// 选择多边形内对象 /// /// 多边形顶点 /// public static DBObjectCollection CrossingPolygon(Point3dCollection pc) { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; DBObjectCollection EntityCollection = new DBObjectCollection(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 343 PromptSelectionResult ents = ed.SelectCrossingPolygon(pc); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet ss = ents.Value; foreach (ObjectId id in ss.GetObjectIds()) { entity = transaction.GetObject(id, OpenMode.ForWrite, true) as Entity; if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } /// /// 过滤选择多边形内对象 /// /// 多边形顶点 /// 类型过滤集合 /// public static DBObjectCollection CrossingPolygon(Point3dCollection pc, FilterType[] tps) { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; // 建立选择的过滤器内容 TypedValue[] filList = new TypedValue[tps.Length + 2]; filList[0] = new TypedValue((int)DxfCode.Operator, ""); for (int i = 0; i < tps.Length; i++) { filList[i + 1] = new TypedValue((int)DxfCode.Start, tps[i].ToString()); } SelectionFilter filter = new SelectionFilter(filList); DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionResult ents = ed.SelectCrossingPolygon(pc, filter); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet ss = ents.Value; foreach (ObjectId id in ss.GetObjectIds()) { entity = transaction.GetObject(id, OpenMode.ForWrite, true) as Entity; if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 344 (2.6) 选择视图窗口区域内对象 /// /// 选择在窗口区域中的对象 /// /// 窗口角点1 /// 窗口角点2 /// public static DBObjectCollection CrossingWindow(Point3d pt1,Point3d pt2) { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionResult ents = ed.SelectCrossingWindow(pt1,pt2); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet ss = ents.Value; foreach (ObjectId id in ss.GetObjectIds()) { entity = transaction.GetObject(id, OpenMode.ForWrite, true) as Entity; if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } /// /// 过滤选择在窗口区域中的对象 /// /// 窗口角点1 /// 窗口角点2 /// 类型过滤集合 /// public static DBObjectCollection CrossingWindow(Point3d pt1, Point3d pt2, FilterType[] tps) { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; // 建立选择的过滤器内容 TypedValue[] filList = new TypedValue[tps.Length + 2]; filList[0] = new TypedValue((int)DxfCode.Operator, ""); for (int i = 0; i < tps.Length; i++) { filList[i + 1] = new TypedValue((int)DxfCode.Start, tps[i].ToString()); } SelectionFilter filter = new SelectionFilter(filList); DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionResult ents = ed.SelectCrossingWindow(pt1, pt2, filter); if (ents.Status == PromptStatus.OK) [www.BimCad.org]深居浅出 AutoCAD 二次开发 345 { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet ss = ents.Value; foreach (ObjectId id in ss.GetObjectIds()) { entity = transaction.GetObject(id, OpenMode.ForWrite, true) as Entity; if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } (2.7) 选择处于夹取状态的对象 /// /// 选择所有隐藏对象 /// /// public static DBObjectCollection Implied() { Database db = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Database; Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Entity entity = null; DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionResult ents = ed.SelectImplied(); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet ss = ents.Value; foreach (ObjectId id in ss.GetObjectIds()) { entity = transaction.GetObject(id, OpenMode.ForWrite, true) as Entity; if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } (3)输出消息 常用命名空间: Autodesk.AutoCAD.ApplicationServices; Autodesk.AutoCAD.DatabaseServices; Autodesk.AutoCAD.Geometry; Autodesk.AutoCAD.EditorInput; (3.1) 命令行提示 /// [www.BimCad.org]深居浅出 AutoCAD 二次开发 346 /// 命令行中显示字符 /// /// public static void Message(string message) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; ed.WriteMessage(message); } (3.2) 打开帮助网页 /// /// 弹出帮助网页 /// /// public static void Web(string url) { System.Diagnostics.Process.Start("explorer.exe", url); } (3.2)警告框 /// /// 弹出警告框 /// /// public static void Alert(string message) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(message); } (4)用户界面 (4.1)应用程序界面 常用命名空间: using System; using System.Drawing; /// /// 修改标题 /// /// 标题 public static void SetTitle(string title) { Autodesk.AutoCAD.Windows.Window MainWindow = Autodesk.AutoCAD.ApplicationServices.Application.MainWindow; MainWindow.Text = title; } /// /// 修改图标 /// /// 图标路径 public static void SetIcon(string fileName) { Autodesk.AutoCAD.Windows.Window MainWindow = Autodesk.AutoCAD.ApplicationServices.Application.MainWindow; [www.BimCad.org]深居浅出 AutoCAD 二次开发 347 MainWindow.Icon = new Icon(fileName); } (4.2)面板 常用到的命名空间: //添加 System.Windows.Forms System.Windows.Forms; //添加AcWindows.dll AdWindows.dll Autodesk.AutoCAD.Windows; Autodesk.Windows; /// /// 面板 /// /// 面板名 /// 面板标题 /// 用户控件 static public PaletteSet CPalette(string name, string title, UserControl myCtrl) { Autodesk.AutoCAD.Windows.PaletteSet ps = new Autodesk.AutoCAD.Windows.PaletteSet(title); ps.Add(name, myCtrl);//myCtrl为自定义面板类 ps.Visible = true; return ps; } (4.3)菜单 常用到的命名空间: System.Runtime.InteropServices; //添加 System.Windows.Forms System.Windows.Forms; //添加AcWindows.dll AdWindows.dll Autodesk.AutoCAD.Windows; Autodesk.Windows; Autodesk.AutoCAD.ApplicationServices; (4.3.1)面板式菜单 /// /// 菜单 /// public class CADMenu { /// /// 创建菜单按钮 /// /// 按钮名 /// 命令名 /// public static RibbonButton RibbonButton(string btName, string cmdName) { RibbonButton ribButton = new RibbonButton(); ribButton.Text = btName; ribButton.CommandParameter = cmdName; ribButton.ShowText = true; ribButton.CommandHandler = new AdskCommandHandler(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 348 return ribButton; } /// /// 创建面板 /// /// 面板名 /// public static RibbonPanel RibbonPanel(string title) { RibbonPanelSource ribSourcePanel = new RibbonPanelSource(); ribSourcePanel.Title = title; RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSourcePanel; return ribPanel; } /// /// 创建菜单标签 /// /// 标签名 /// 标签ID /// public static RibbonTab RibbonTab(string name, string id) { RibbonTab ribTab = new Autodesk.Windows.RibbonTab(); ribTab.Title = name; ribTab.Id = id; ribTab.IsActive = true; return ribTab; } /// /// 获得菜单控制 /// /// public static RibbonControl RibbonControl() { if (Autodesk.Windows.ComponentManager.Ribbon == null) Autodesk.Windows.ComponentManager.ItemInitialized += new EventHandler(ComponentManager_ItemInitialized); return ComponentManager.Ribbon; ; } /// /// 用于激活菜单 /// /// /// static void ComponentManager_ItemInitialized(object sender, RibbonItemEventArgs e) { if (Autodesk.Windows.ComponentManager.Ribbon != null) Autodesk.Windows.ComponentManager.ItemInitialized -=new EventHandler(ComponentManager_ItemInitialized); } /// /// 执行按钮的命令 [www.BimCad.org]深居浅出 AutoCAD 二次开发 349 /// public class AdskCommandHandler : System.Windows.Input.ICommand { /// /// 接口,是否可执行 /// /// 命令名 /// public bool CanExecute(object parameter) { return true; } /// /// 改变可执行状态 /// public event EventHandler CanExecuteChanged; /// /// 执行命令 /// /// 命令的名字 public void Execute(object parameter) { //is from a Ribbon Button? RibbonButton ribBtn = parameter as RibbonButton; if (ribBtn != null) Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute((String)ri bBtn.CommandParameter, true, false, true); //is from s Ribbon Textbox? RibbonTextBox ribTxt = parameter as RibbonTextBox; if (ribTxt != null) System.Windows.Forms.MessageBox.Show(ribTxt.TextValue); } } (4.3.2)右键菜单 /// /// 右键菜单 /// /// 菜单标题 /// public static ContextMenuExtension ContextMenuExtension(string title) { ContextMenuExtension m_ContextMenu = new ContextMenuExtension(); m_ContextMenu.Title = title; return m_ContextMenu; } /// /// 右键菜单项 /// /// /// public static Autodesk.AutoCAD.Windows.MenuItem MenuItem(string name) { Autodesk.AutoCAD.Windows.MenuItem mi; mi = new Autodesk.AutoCAD.Windows.MenuItem(name); [www.BimCad.org]深居浅出 AutoCAD 二次开发 350 return mi; } 【4】数据文件 外部数据文件Excel、TXT、Access等的读写操作方法。 (1)TXT 文件 常用命名空间: System; System.IO; /// /// 写TXT文件 /// /// /// public static void WriteLine(string wordsLine, string fileName) { FileStream fsm = new FileStream(fileName, FileMode.Append, FileAccess.Write); StreamWriter sw = new StreamWriter(fsm); sw.WriteLine(wordsLine); sw.Close(); } (2)Excel 文件 常用命名空间: System; //处理EXCEL文件添加COM组件 //Microsoft Excel X.0 Object Library //Microsoft Office X.0 Object Library Microsoft.Office.Interop.Excel; Microsoft.Office.Core; /// /// 把数据表保存到Excel文件 /// /// /// public static void Save(System.Data.DataTable dt, string fileName) { int columnIndex = 1; int rowIndex = 1; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.ApplicationClass(); xlApp.DefaultFilePath = fileName; xlApp.DisplayAlerts = true; xlApp.SheetsInNewWorkbook = 1; Microsoft.Office.Interop.Excel.Workbook xlBook = xlApp.Workbooks.Add(true); //将DataTable的列名导入Excel表第一行 foreach (System.Data.DataColumn column in dt.Columns) { xlApp.Cells[rowIndex, columnIndex] = column.ColumnName; [www.BimCad.org]深居浅出 AutoCAD 二次开发 351 columnIndex++; } //将DataTable中的数据导入Excel中 for (int i = 0; i < dt.Rows.Count; i++) { columnIndex = 1; rowIndex++; for (int j = 0; j < dt.Columns.Count; j++) { xlApp.Cells[rowIndex, columnIndex] = dt.Rows[i][j].ToString(); columnIndex++; } } xlBook.SaveCopyAs(fileName); xlBook.Close(false, null, null); xlBook = null; xlApp.Quit(); xlApp = null; } /// /// 读Excel(97-03格式)到数据表 /// /// Excel文件名 /// 表名 /// public static System.Data.DataTable Read(string fileName,string sheetName) { System.Data.DataTable tb = new System.Data.DataTable(); try { string strCon = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + fileName + " ;Extended Properties=Excel 8.0"; System.Data.OleDb.OleDbConnection myConn = new System.Data.OleDb.OleDbConnection(strCon); string strCom = " SELECT * FROM [" + sheetName + "] "; System.Data.OleDb.OleDbCommand Cmd = new System.Data.OleDb.OleDbCommand(strCom, myConn); System.Data.OleDb.OleDbDataAdapter da = new System.Data.OleDb.OleDbDataAdapter(Cmd); System.Data.DataSet ds = new System.Data.DataSet(); da.Fill(ds, "Table"); tb = ds.Tables[0]; } catch { } return tb; } (3)Access 数据库 常用命名空间: System; System.Collections.Generic; System.Data; //处理ACCESS文件添加组件 System.Data.OleDb; [www.BimCad.org]深居浅出 AutoCAD 二次开发 352 System.Data.SqlClient; //引用COM组件Microsoft ADO Ext . 2.8 for DLL and security ADOX; /// /// 生成Access文件 /// /// 数据库文件名 static public bool Create(string fileName) { bool success = false; try { ADOX.Catalog catalog = new Catalog(); catalog.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + ";Jet OLEDB:Engine Type=5"); success=true; } catch { } return success; } /// /// 通过SQL查询语句获得查询表 /// /// 数据库文件名 /// SQL语句 /// public static System.Data.DataTable GetTable(string fileName, string sql) { System.Data.DataTable dt; string strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" + @"Data Source=" + fileName + ";" + "Persist Security Info=False"; using (OleDbConnection objConnection = new OleDbConnection(strConnection)) { objConnection.Open(); OleDbDataAdapter myCommandd = new OleDbDataAdapter(sql, objConnection); DataSet ds = new DataSet(); myCommandd.Fill(ds, "Table"); dt = ds.Tables["Table"]; objConnection.Close(); } return dt; } /// /// 执行SQL语句 /// /// 数据库文件名 /// SQL语句数组 /// public static bool DoSQLs(string fileName, string[] sqls) { bool success = false; string strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;"; strConnection += @"Data Source=" + fileName + ";"; [www.BimCad.org]深居浅出 AutoCAD 二次开发 353 strConnection += "Persist Security Info=False"; try { using (OleDbConnection objConnection = new OleDbConnection(strConnection)) { objConnection.Open(); OleDbCommand dbCommand; for (int i = 0; i < sqls.Length; i++) { dbCommand = new System.Data.OleDb.OleDbCommand(sqls[i], objConnection); dbCommand.ExecuteNonQuery(); } objConnection.Close(); } success = true; } catch { } return success; } /// /// 更新数据表 /// /// 数据库文件名 /// 获取要更新表SQL语句 /// 更新源表 /// public static bool UpdateTable(string fileName,string sql,ref System.Data.DataTable table) { bool success = false; try { string strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;"; strConnection += @"Data Source=" + fileName + ";"; strConnection += "Persist Security Info=False"; using (OleDbConnection objConnection = new OleDbConnection(strConnection)) { objConnection.Open(); OleDbDataAdapter myCommandd = new OleDbDataAdapter(sql, objConnection); OleDbCommandBuilder cb = new OleDbCommandBuilder(myCommandd); DataSet ds = new DataSet(); myCommandd.Fill(ds, "更新表"); myCommandd.Update(table); objConnection.Close(); } success = true; } catch { } return success; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 354 第六章 开发实例 通过本章AutoCAD.NET 二次开发的实例,详细介绍二次开发实现方法。本章的源代码可以 在http://www.BimCad.org/Downloads 连接中下载。更多的实例请关注http://www.BimCad.org 相关板块。 【一】程序示例 新建项目:打开 Microsoft Visual Studio 编译环境,依次点击“文件”->“新建”->“项目”打开新建项目面板。 选择 C#语言下的“类库”工程,在工程名称处填入 Hello,点“确定” [www.BimCad.org]深居浅出 AutoCAD 二次开发 355 在生成的工程的“解决方案管理器”中鼠标右键点“添加引用” 在“添加引用”对话框中选择“浏览”选显卡,然后选择 AutoCAD 安装目录下 acdbmgd.dll,acmgd.dll 两个 DLL 库文件 [www.BimCad.org]深居浅出 AutoCAD 二次开发 356 在“解决方案管理器”中选择刚加入的 DLL 引用,在“属性”面板中将“复制本地”属性设置为 False 在“解决方案管理器”中右键选择整个工程文件,选择“属性”项。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 357 在“调试”面板中选择“启动外部程序”单选框,然后选择 AutoCAD 安装目录下的 acad.exe 文件。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 358 在 Class1 中输入如下代码: using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; namespace Hello { public class Class1 { [CommandMethod("HELLO")] public void HELLO() { Document doc = Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; ed.WriteMessage("Hello World!"); } } } 点菜单“生成解决方案” [www.BimCad.org]深居浅出 AutoCAD 二次开发 359 程序编译成功会在“输出”提示框中显示 打开 AutoCAD 应用程序,在“命令行”中输入 NETLOAD 在“选择.NET 程序集”对话框中选择刚才生成的 DLL 文件 [www.BimCad.org]深居浅出 AutoCAD 二次开发 360 在“命令行”中输入刚才自定义的命令 HELLO 就可以运行你的程序了 [www.BimCad.org]深居浅出 AutoCAD 二次开发 361 【二】数据库 数据库操作是 AutoCAD 最常用的过程,主要操作数据库的符号表、符号表记录以及词典,下面列举常用到的数据库操 作的实现方法。 【1】块表 (1)创建图块(添加块表记录到块表) 创建图块(块定义)实际上就是给 DWG 数据库中的块表中添加一条块表记录。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; namespace Sample { class AddBlock { [CommandMethod("CreateBlock")] public void Add() { Database db=HostApplicationServices.WorkingDatabase; BlockTableRecord btr = new BlockTableRecord(); btr.Name = "bimcad"; Line line = new Line(Point3d.Origin, new Point3d(10, 15, 0)); Circle circle = new Circle(Point3d.Origin, Vector3d.ZAxis, 10); btr.AppendEntity(line); btr.AppendEntity(circle); AddBlockTableRecord(btr, db); } /// /// 将块表记录加入到块表中 /// /// public ObjectId AddBlockTableRecord(BlockTableRecord btr, Database db) { ObjectId id = new ObjectId(); using (Transaction transaction = db.TransactionManager.StartTransaction()) { BlockTable bt = transaction.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; id = bt.Add(btr); transaction.AddNewlyCreatedDBObject(btr, true); transaction.Commit(); } return id; } } } 加载程序后运行"CreateBlock"命令,则创建了一个名为 bimcad 的图块。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 362 (2)添加对象到模型空间 模型空间是一条名为 BlockTableRecord.ModelSpace 的特殊块表记录(添加到其中的对象会在模型空间图纸中绘制出其 形状),将对象添加到模型空间的方法与将对象添加到块表记录的方法一样。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.AddToModelSpace))] namespace Sample { class AddToModelSpace { [CommandMethod("ToModelSpace")] public void ModelSpace() { Database db = HostApplicationServices.WorkingDatabase; DBText txt = new DBText(); txt.Position = new Point3d(); txt.TextString = "BimCAD.org"; ToModelSpace(txt, db); } /// /// 将一个图形对象加入到指定的Database的模型空间 /// /// 实体对象 /// 数据库 /// public static ObjectId ToModelSpace(Entity ent, Database db) { ObjectId entId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); [www.BimCad.org]深居浅出 AutoCAD 二次开发 363 BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); entId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } return entId; } } } 加载程序后运行"ToModelSpace"模型空间显示如下: 【2】层表 (1)创建图层(添加层表记录到层表) 本例介绍如何创建图层。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Colors; [assembly: CommandClass(typeof(Sample.CreateLayer))] namespace Sample { class CreateLayer { [CommandMethod("CreateLayer")] public void Create() { Database db = HostApplicationServices.WorkingDatabase; AddLayer("深居浅出", 1,db); } /// /// 建立指定名字,颜色的图层 /// /// 图层名 /// 颜色 /// 数据库 /// public static ObjectId AddLayer(string LayerName, short ColorIndex, Database db) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 364 short colorIndex1 = (short)(ColorIndex % 256);//防止输入的颜色超出256 using (Transaction trans = db.TransactionManager.StartTransaction()) { LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite); ObjectId layerId = ObjectId.Null; if (lt.Has(LayerName) == false) { LayerTableRecord ltr = new LayerTableRecord(); ltr.Name = LayerName; ltr.Color = Color.FromColorIndex(ColorMethod.ByColor, colorIndex1); layerId = lt.Add(ltr); trans.AddNewlyCreatedDBObject(ltr, true); } trans.Commit(); return layerId; } } } } 运行”CreateLayer”命令前,图层管理器中的显示 运行”CreateLayer”命令后,图层管理器中的显示 [www.BimCad.org]深居浅出 AutoCAD 二次开发 365 (2)删除图层(删除层表记录) 图层的删除有很多讲究,当前层、包含对象的层、已经删除的层、不在层表中的层是不能被删除的,本例介绍如何用程 序删除一个图层。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.RemoveLayerTableRecord))] namespace Sample { class RemoveLayerTableRecord { [CommandMethod("DeleteLayer")] public void Delete() { Database db = HostApplicationServices.WorkingDatabase; RemoveLayer("深居浅出", db); } /// /// 删除指定名字的图层 /// /// /// public static void RemoveLayer(string layerName, Database db) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; using (Transaction trans = db.TransactionManager.StartTransaction()) { LayerTable lt = (LayerTable)trans.GetObject(db.LayerTableId, OpenMode.ForWrite); [www.BimCad.org]深居浅出 AutoCAD 二次开发 366 LayerTableRecord currentLayer = (LayerTableRecord)trans.GetObject(db.Clayer, OpenMode.ForRead); if (currentLayer.Name.ToLower() == layerName.ToLower()) ed.WriteMessage("\n不能删除当前层"); else { LayerTableRecord ltr = new LayerTableRecord(); if (lt.Has(layerName)) { ltr = trans.GetObject(lt[layerName], OpenMode.ForWrite) as LayerTableRecord; if (ltr.IsErased) ed.WriteMessage("\n此层已经被删除"); else { ObjectIdCollection idCol = new ObjectIdCollection(); idCol.Add(ltr.ObjectId); db.Purge(idCol); if (idCol.Count == 0) ed.WriteMessage("\n不能删除包含对象的图层"); else ltr.Erase(); } } else ed.WriteMessage("\n没有此图层"); } trans.Commit(); } } } } 运行”DeleteLayer”命令以后刚才新建的图层就被删除了,层表管理器又恢复原样(如果新图层上画有对象,这些对象也 被一起删除) [www.BimCad.org]深居浅出 AutoCAD 二次开发 367 【3】命名对象词典 命名对象词典通常用来保存图纸中的全局数据。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.ToNOD))] namespace Sample { class ToNOD { [CommandMethod("ToNOD")] public void AddToNOD() { Database db = HostApplicationServices.WorkingDatabase; DataTable dt = new DataTable(); dt.TableName = "Table"; AddObjToNOD(dt,"DataTable",db); } /// /// 将一个对象加到命名对象词典 /// /// 要添加到命名对象词典的对象 /// 词典记录名 /// 数据库 public static void AddObjToNOD(DBObject dataObj, string name, Database db) { using (Transaction tr = db.TransactionManager.StartTransaction()) { DBDictionary Dict = tr.GetObject(db.NamedObjectsDictionaryId, OpenMode.ForWrite) as DBDictionary; Dict.SetAt(name, dataObj); tr.Commit(); } } } } 编译加载程序后运行命令"ToNOD"可以看到命名对象词典中数据的变化如下: [www.BimCad.org]深居浅出 AutoCAD 二次开发 368 运行前 运行后 [www.BimCad.org]深居浅出 AutoCAD 二次开发 369 【三】实体对象 实体对象是指AutoCAD图形中的可视化对象,本章主要讲解实体对象的创建及编辑。AutoCAD中的对象非常丰富,不同 对象性质也有所不同,对于不同对象的性质可以在”第五章-【二】-【6】-(6)Entity(实体对象)”小节中查看,更多的实体的添 加方法以及实体对象通用的操作方法在”第五章-【三】-【1】-(2)编辑对象”小节有详细介绍。 【1】添加对象 AutoCAD 的主要功能就是画图,所以添加实体对象是 AutoCAD 开发中用的最基本的操作。 添加实体对象主要分两个步骤: 1、实例化对象 2、将对象添加到模型空间或图纸空间中显示 (1)添加基本图形对象 在AutoCAD中添加基本图形对象。按照”第五章-【三】-【1】-(1)创建对象”小节的方法,类似的可以仿造这个例子添加 多段线,多行文本,标注等。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample. Simple))] namespace Sample { class Simple { [CommandMethod("Simple ")] public void Add() { ToModelSpace(DBText(new Point3d(-10, 20, 0), "《深居浅出AutoCAD.NET》", 5));//创建一个基点为(0, 50, 0), 文字高度为20的文字,添加到模型空间 Line L=new Line(new Point3d(40, 0, 0), new Point3d(60, 15, 0));//创建直线 OrdinateDimension ODX = OrdinateDimensionX(L.StartPoint,L.EndPoint,10,true);//创建X增量标注 ToModelSpace(L); ToModelSpace(ODX); Circle C = new Circle(Point3d.Origin, Vector3d.ZAxis, 15);//创建圆 RadialDimension RD = RadialDimension(C, 3*Math.PI / 4, 10);//创建半径标注 ToModelSpace(C); ToModelSpace(RD); } /// /// 添加对象到模型空间 /// /// 要添加的对象 /// public static ObjectId ToModelSpace(Entity ent) { Database db = HostApplicationServices.WorkingDatabase; [www.BimCad.org]深居浅出 AutoCAD 二次开发 370 ObjectId entId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); entId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } return entId; } /// /// 由插入点、文字内容、文字样式、文字高度创建单行文字 /// /// 文字内容 /// 基点 /// 文字高度 /// 文字转角 /// 是否是包含域 /// public static DBText DBText(Point3d position, string textString, double height) { DBText ent = new DBText(); ent.Position = position; ent.TextString = textString; ent.Height = height; return ent; } /// /// 由圆,角度和引线长度创建半径标注 /// /// 圆 /// 角度 /// 引线长度 /// 半径标注 public static RadialDimension RadialDimension(Circle cir, double angle, double leaderLength) { Point3d cenPt = new Point3d(cir.Center.X, cir.Center.Y, 0); Point3d pt1 = new Point3d(cenPt.X + cir.Radius * Math.Cos(angle), cenPt.Y + cir.Radius * Math.Sin(angle), cenPt.Z); Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; RadialDimension ent = new RadialDimension(cenPt, pt1, leaderLength, "<>", style); return ent; } /// /// 由标注起点点、长度、方向创建坐标标注X /// /// 起点 /// 方向点 /// 引线长度 /// 方向 fale为上.ture为下. [www.BimCad.org]深居浅出 AutoCAD 二次开发 371 /// public static OrdinateDimension OrdinateDimensionX(Point3d stratPoint, Point3d ordPt, double lenght, bool bo) { Database db = HostApplicationServices.WorkingDatabase; ObjectId style = db.Dimstyle; Point3d pt1 = new Point3d(ordPt.X + lenght * Math.Cos(bo ? 3 * Math.PI / 2 : Math.PI / 2), ordPt.Y + lenght * Math.Sin(bo ? 3 * Math.PI / 2 : Math.PI / 2), ordPt.Z); OrdinateDimension entX = new OrdinateDimension(true, ordPt, pt1, "<>", style); entX.Origin = stratPoint; return entX; } } } 按照例一的方法编译成功后在 AutoCAD 中加载运行” Simple”命令后得到如下结果: [www.BimCad.org]深居浅出 AutoCAD 二次开发 372 (2)添加三维对象 三维对象的创建与添加到数据库实际上跟简单对象没有任何不同,只是创建好的三维对象的坐标都是默认在原点,建立 好后需要将其调整到需要放置的位置。按照”第五章-【三】-【1】-(1)创建对象”小节的方法,类似的可以仿造这个例子添加 其他的三维实体。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.AddSolid))] namespace Sample { class AddSolid { [CommandMethod("AddSolid")] public void Add() { Solid3d T = Torus(200, 30); Move(T, new Point3d(100, 100, 0)); ToModelSpace(T); Solid3d B = Box(100, 300,100); Move(B, new Point3d(-300, -300, 0)); ToModelSpace(B); } /// /// 添加对象到模型空间 /// /// 要添加的对象 /// public static ObjectId ToModelSpace(Entity ent) { Database db = HostApplicationServices.WorkingDatabase; ObjectId entId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); entId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } return entId; } /// /// 圆环 /// /// 主圆半径 [www.BimCad.org]深居浅出 AutoCAD 二次开发 373 /// 圆环半径 /// public static Solid3d Torus(double MajorRadius, int MinorRadius) { Solid3d Solid = new Solid3d(); Solid.CreateTorus(MajorRadius, MinorRadius); return Solid; } /// /// 创建长方体 /// /// 长 /// 宽 /// 高 /// public static Solid3d Box(double X, double Y, double Z) { Solid3d Solid = new Solid3d(); Solid.CreateBox(X, Y, Z); return Solid; } /// /// 以原点为基点,指定目标点移动实体 /// /// 实体对象 /// 目标点 public static void Move(Entity ent, Point3d pt) { Matrix3d mt = Matrix3d.Displacement(pt - new Point3d()); ent.TransformBy(mt); } } } 在 AutoCAD 中加载运行” AddSolid”命令后得到如下结果: [www.BimCad.org]深居浅出 AutoCAD 二次开发 374 (3)添加图块 AutoCAD 中的图块就是块参照,它引用于块定义。块定义有两种形式: 1、引用外部 DWG 图纸。 2、添加在块表中的块表记录。 以下是引用块定义为块参照的例子。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.AddBlock))] namespace Sample { class AddBlock { /// ///引用外部文件为块定义插入 /// [CommandMethod("AddRefBlock")] public void Add1() { Database db = HostApplicationServices.WorkingDatabase; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord btr = trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; ObjectId refid = db.OverlayXref(@"c:\drwing.dwg", "name");// 通过外部文件获取图块定义的ObjectId BlockReference br = new BlockReference(Point3d.Origin, refid); // 通过块定义添加块参照 btr.AppendEntity(br); //把块参照添加到块表记录 trans.AddNewlyCreatedDBObject(br, true); // 通过事务添加块参照到数据库 trans.Commit(); } } /// /// 数据库中的块表记录插入 /// [CommandMethod("AddBlock")] public void Add2() { Database db = HostApplicationServices.WorkingDatabase; ObjectId blkid; //创建块定义 using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; BlockTableRecord blk = new BlockTableRecord(); blk.Name = "BLK"; [www.BimCad.org]深居浅出 AutoCAD 二次开发 375 Line L = new Line(Point3d.Origin, new Point3d(1000, 1000, 0)); Circle C = new Circle(Point3d.Origin, Vector3d.ZAxis, 500); blk.AppendEntity(L); blk.AppendEntity(C); blkid = bt.Add(blk); trans.AddNewlyCreatedDBObject(blk, true); trans.Commit(); } using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; BlockReference br = new BlockReference(new Point3d(0,0, 0), blkid); // 通过块定义创建块参照 btr.AppendEntity(br); //把块参照添加到块表记录 tr.AddNewlyCreatedDBObject(br, true); // 通过事务添加块参照到数据库 tr.Commit(); } } } } 在 AutoCAD 中加载运行” AddBlock”命令后得到如下结果: 查看块表中的块定义得到如下结果: 在 AutoCAD 中加载运行” AddRefBlock”命令后得到如下结果: [www.BimCad.org]深居浅出 AutoCAD 二次开发 376 [www.BimCad.org]深居浅出 AutoCAD 二次开发 377 (4)添加带属性的块 图块中可以添加一些属性以记录或者表现图块的参数属性(例如图框里面的标题等信息)这样既方便检索也方便显示,下 面介绍图块中是如何加入属性的。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.AddAttributeBlock))] namespace Sample { class AddAttributeBlock { [CommandMethod("AddAttributeBlock")] public void AddBlock() { Database db = HostApplicationServices.WorkingDatabase; ObjectId id; BlockTableRecord btr = new BlockTableRecord(); Line line = new Line(new Point3d(), new Point3d(30, 30, 0)); AttributeDefinition ad = AttributeDefinition("Length", "L", line.Length.ToString(), new Point3d(30, 30, 0)); btr.Name = "LineBlock"; btr.AppendEntity(line); btr.AppendEntity(ad); id = AddToBlockTable(btr); ToModelSpace(id, Point3d.Origin,db); } /// /// 创建属性 /// /// 标记名 /// 提示 /// 属性值 /// 属性插入点位置 /// public static AttributeDefinition AttributeDefinition(string Label, string Prompt, string Value, Point3d pt) { AttributeDefinition ad = new AttributeDefinition(); ad.Constant = false; ad.Tag = Label; ad.Prompt = Prompt; ad.TextString = Value; ad.Position = pt; return ad; } /// /// 将指定的块定义变成块参照添加到指定模型空间 /// /// 块定义Id [www.BimCad.org]深居浅出 AutoCAD 二次开发 378 /// 插入点 /// 数据库 /// public static ObjectId ToModelSpace(ObjectId blkid, Point3d pt, Database db) { ObjectId blkrfid = new ObjectId(); using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = trans.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable; BlockTableRecord modelspace = trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord; BlockTableRecord block = trans.GetObject(blkid, OpenMode.ForRead) as BlockTableRecord; BlockReference br = new BlockReference(pt, blkid); // 通过块定义添加块参照 blkrfid = modelspace.AppendEntity(br); //把块参照添加到块表记录 trans.AddNewlyCreatedDBObject(br, true); // 通过事务添加块参照到数据库 foreach (ObjectId id in block) { if (id.ObjectClass.Equals(RXClass.GetClass(typeof(AttributeDefinition)))) { AttributeDefinition ad = trans.GetObject(id, OpenMode.ForRead) as AttributeDefinition; AttributeReference ar = new AttributeReference(ad.Position, ad.TextString, ad.Tag, new ObjectId()); br.AttributeCollection.AppendAttribute(ar); } } trans.Commit(); } return blkrfid; } /// /// 将块表记录加入到块表中 /// /// public static ObjectId AddToBlockTable(BlockTableRecord Record) { Database db = HostApplicationServices.WorkingDatabase; ObjectId id = new ObjectId(); using (Transaction transaction = db.TransactionManager.StartTransaction()) { BlockTable table = transaction.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable; id = table.Add(Record); transaction.AddNewlyCreatedDBObject(Record, true); transaction.Commit(); } return id; } } } 在 AutoCAD 中加载运行” AddAttributeBlock”命令后得到如下结果: [www.BimCad.org]深居浅出 AutoCAD 二次开发 379 进入到块编辑,可以看到块定义里面的属性定义 [www.BimCad.org]深居浅出 AutoCAD 二次开发 380 【2】编辑对象 对于已经创建好的对象要对其属性进行修改,就要用一些方法来对他进行编辑,最基本的编辑就是其自身颜色,位置等 基本属性的修改,每种对象的相关属性在”第五章-【二】-【6】-(6)Entity(实体对象)”小节已经有详细的介绍。本节主要介绍 对象更一般化的操作方法 (1)几何变形 本例创建一个Leader(引线)对象,并以Y轴为镜像轴镜像,类似的对对象的操作还有偏移、复制、缩放、旋转,相关的 函数及操作见”第五章-【三】-【1】-(2)编辑对象”小节。 using System; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.EditEntity))] namespace Sample { class EditEntity { [CommandMethod("EditEntity")] public void EditEnt() { Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { Leader Leader = (Leader)SelectEntity("\n选择对象"); if (Leader != null) Mirror(Leader, new Point3d(0, 0, 0), new Point3d(0, 1, 0)); tr.Commit(); } } /// /// 提示用户选择单个实体 /// /// 选择提示 /// 实体对象 public static Entity SelectEntity(string word) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; Entity entity = null; PromptEntityResult ent = ed.GetEntity(word); if (ent.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { entity = (Entity)transaction.GetObject(ent.ObjectId, OpenMode.ForWrite, true); transaction.Commit(); } [www.BimCad.org]深居浅出 AutoCAD 二次开发 381 } return entity; } /// /// 指定两个镜像参照点得到实体镜像 /// /// 实体对象 /// 镜像点1 /// 镜像点2 public static Entity Mirror(Entity ent, Point3d mirrorPt1, Point3d mirrorPt2) { Line3d mirrorLine = new Line3d(mirrorPt1, mirrorPt2); Matrix3d mt = Matrix3d.Mirroring(mirrorLine); ent.TransformBy(mt); return ent; } } } 先画一个用于镜像的对象 运行命令” EditEntity”后选中对象,可以看到对象按照我们规定的镜像线翻转了。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 382 (2)扩展数据 对于实体对象只有几何信息,如果你的形状表达的是某些有其他参数信息的对象,如表现建筑对象的梁,可能要附加材 料信息,那么我们可以将这些附加的信息加入到几何对象的扩展数据中,目前可以给对象添加附加的数据有 Xdata、Xrecord、 以及 DataTable,附着到对象的做法都差不多但是 Xdata 存储数据量有限,Xrecord 储存及读取的时候条理性比较差,所以 用 DataTable 作为扩展数据最为合适。添加扩展数据时必须注意的是对象必须添加到数据库中后才能添加扩展数据。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.EntityData))] namespace Sample { class EntityData { [CommandMethod("WriteData")] public void AddData() { DataTable dt = new DataTable(); dt.TableName = "ParameterTable"; dt.AppendColumn(CellType.CharPtr, "Name"); dt.AppendColumn(CellType.CharPtr, "Meterial"); dt.AppendColumn(CellType.CharPtr, "Parameter"); DataCellCollection Row = new DataCellCollection(); DataCell Name = new DataCell(); DataCell Meterial = new DataCell(); DataCell Parameter = new DataCell(); Name.SetString("工字钢"); Meterial.SetString("Q235B"); Parameter.SetString("200*200*32*25"); Row.Add(Name); Row.Add(Meterial); Row.Add(Parameter); dt.AppendRow(Row, true); Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; PromptEntityResult ent = ed.GetEntity("\n选择要写数据的对象"); if (ent.Status == PromptStatus.OK) { using (Transaction tr = db.TransactionManager.StartTransaction()) { Entity entity = (Entity)tr.GetObject(ent.ObjectId, OpenMode.ForWrite, true); if (entity.ExtensionDictionary == new ObjectId()) entity.CreateExtensionDictionary(); [www.BimCad.org]深居浅出 AutoCAD 二次开发 383 DBDictionary extensionDic = (DBDictionary)tr.GetObject(entity.ExtensionDictionary, OpenMode.ForWrite, false); extensionDic.SetAt("ParameterTable", dt); tr.Commit(); } } } [CommandMethod("ReadData")] public void ReadData() { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; Entity entity = null; PromptEntityResult ent = ed.GetEntity("\n选择要读取数据的对象"); if (ent.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { entity = (Entity)transaction.GetObject(ent.ObjectId, OpenMode.ForRead, true); DBDictionary extensionDic = transaction.GetObject(entity.ExtensionDictionary, OpenMode.ForRead) as DBDictionary; DataTable dt = transaction.GetObject(extensionDic.GetAt("ParameterTable"), OpenMode.ForRead) as DataTable; DataCellCollection dc = dt.GetRowAt(0); string ss= dt.GetCellAt(0, 0).Value.ToString(); ed.WriteMessage("\n Name:" + dc[0].Value.ToString()); ed.WriteMessage("\n Meterial:" + dc[1].Value.ToString()); ed.WriteMessage("\n Parameter:" + dc[2].Value.ToString()); transaction.Commit(); } } } } } 运行”WriteData”命令选择要写扩展数据的对象: 再运行“ReadData“选择要读取扩展数据的对象,命令行中则显示对象的扩展数据: [www.BimCad.org]深居浅出 AutoCAD 二次开发 384 (3)注释比例 在不同的绘图比例下绘制图形经常需要考虑如标注尺寸,箭头大小等相关的比例,给对象添加注释比例后,对象的比例 会随着绘图比例的大小自动变化尺寸。目前支持注释比例的对象有:文字、多行文字、标注、图案填充、公差、多重引线、 引线、块、属性。用 AddContext()方法可以给对象添加注释比例。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; [assembly: CommandClass(typeof(Sample.AutoScale))] namespace Sample { class AutoScale { [CommandMethod("AutoScale")] public void Scale() { Database db = HostApplicationServices.WorkingDatabase; DBText txt = DBText(Point3d.Origin, "深居浅出", 100); txt.Annotative = AnnotativeStates.True; ObjectContextManager cm = db.ObjectContextManager; ObjectContextCollection occ = cm.GetContextCollection("ACDB_ANNOTATIONSCALES"); foreach (ObjectContext oc in occ) { txt.AddContext(oc); } Circle cir =new Circle(new Point3d(265, 50, 0),Vector3d.ZAxis,300); ToModelSpace(txt); ToModelSpace(cir); } /// /// 由插入点,文字内容,文字高度创建单行文字 /// /// 基点 /// 文字内容 /// 文字高度 /// 单行文字 public static DBText DBText(Point3d position, string textString, double height) { DBText ent = new DBText(); ent.Position = position; ent.TextString = textString; ent.Height = height; return ent; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 385 /// /// 把实体添加到模型空间显示 /// /// 实体对象 /// public static ObjectId ToModelSpace(Entity ent) { Database db = HostApplicationServices.WorkingDatabase; ObjectId entId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); entId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } return entId; } } } 运行“AutoScale”命令后添加了注释比例的文字的尺寸大小会随着绘图比例的变化而变化,而没有添加注释比例的圆则不会变。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 386 [www.BimCad.org]深居浅出 AutoCAD 二次开发 387 (4)显示次序 当几个对象重叠的时候,图形的显示有一定的先后顺序,顺序在前面的显示在上层,本节介绍如何改变对象的显示次序。 类似 AutoCAD 界面里面的”绘图次序”中的“前置”功能。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.MoveTop))] namespace Sample { class MoveTop { [CommandMethod("Order")] public void ToTop() { Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { Entity ent = SelectEntity("\n选择要前置的对象"); MoveTop(ent, db); tr.Commit(); } } /// /// 提示用户选择对象 /// /// /// public Entity SelectEntity(string word) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; Entity entity = null; PromptEntityResult ent = ed.GetEntity(word); if (ent.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { entity = (Entity)transaction.GetObject(ent.ObjectId, OpenMode.ForWrite, true); transaction.Commit(); } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 388 return entity; } /// /// 改变对象的绘图次序到顶层 /// /// /// public static void MoveTop(Entity ent, Database db) { using (Transaction tr = db.TransactionManager.StartTransaction()) { ObjectIdCollection idc = new ObjectIdCollection(); idc.Add(ent.ObjectId); BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForWrite, false); BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite, false); DrawOrderTable orderTable = tr.GetObject(btr.DrawOrderTableId, OpenMode.ForWrite) as DrawOrderTable; orderTable.MoveToTop(idc); tr.Commit(); } } } } 先画两个重叠的对象: 运行命令” Order”后选择要前置的对象得到如下效果: [www.BimCad.org]深居浅出 AutoCAD 二次开发 389 [www.BimCad.org]深居浅出 AutoCAD 二次开发 390 (5)驱动动态块 从 AutoCAD2006 开始引入了动态块这个概念,动态块的使用使得我们的图形更加灵活,可以通过自定义夹点或自定义 特性来操作几何图形。 这使得我们可以根据需要在位调整块参照,而不用搜索另一个块以插入或重定义现有的块。也就是 可以通过一个块定义衍生出多个特性类似的块参照。 目前用.NET 环境开发还不能自定义约束、关联以及动态块,但是我们可以用.NET 程序访问或者控制动态块的参数,看 下面的例子修改动态块的参数,使得动态块的图形变化。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.SetDynamicBlockValue))] namespace Sample { class SetDynamicBlockValue { [CommandMethod("SetDynamicBlockValue")] public void SetValue() { Database db = HostApplicationServices.WorkingDatabase; using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockReference br = (BlockReference)SelectEntity("\n选择动态块"); Property[] Properties = new Property[] { new Property("Width", 100), new Property("Height", 100) }; SetDynamicValue(br, Properties); tr.Commit(); } } /// /// 提示用户选择单个实体 /// /// 选择提示 /// 实体对象 public static Entity SelectEntity(string word) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; Entity entity = null; PromptEntityResult ent = ed.GetEntity(word); if (ent.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { entity = (Entity)transaction.GetObject(ent.ObjectId, OpenMode.ForWrite, true); transaction.Commit(); } [www.BimCad.org]深居浅出 AutoCAD 二次开发 391 } return entity; } /// /// 设置动态块属性 /// /// 要设置属性的动态块 /// /// public static void SetDynamicValue(BlockReference br, Property[] Properties) { try { if (br.IsDynamicBlock) { foreach (DynamicBlockReferenceProperty dbrp in br.DynamicBlockReferencePropertyCollection) { for (int i = 0; i < Properties.Length; i++) { if (dbrp.PropertyName == Properties[i].PropertyName) { dbrp.Value = Properties[i].Value; } } } } } catch { } } } /// /// 动态块属性 /// public class Property { private string propertyname; private double value; public string PropertyName { get { return propertyname; } } public double Value { get { return value; } } public Property(string PropertyName, double Value) { propertyname = PropertyName; value = Value; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 392 } } 加载程序运行命令后选择一个动态块: 程序自动修改其属性参数,驱动动态块的形状改变: *在修改参数的时候需要注意的一点是所定义的约束参数必须是“增量”形式其值才能被任意修改,如果为“列表”形 式则其值只能设定为列表中的值。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 393 [www.BimCad.org]深居浅出 AutoCAD 二次开发 394 【四】用户交互 绘图必不可少的需要得到一些用户输入的参数信息,同样画好的图纸也需要显示一些数据给用户查看。这就是用户与计 算机的交互。 【1】输出信息 (1)命令行消息 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.EditorMessage))] namespace Sample { class EditorMessage { [CommandMethod("EditorMessage")] public void Message() { Message("http://www.bimcad.org"); } /// /// 命令栏中显示字符 /// /// public static void Message(string word) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; ed.WriteMessage(word); } } } 加载程序后运行 EditorMessage 命令得到如下效果: (2)消息框提示 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.AlertMessage))] namespace Sample [www.BimCad.org]深居浅出 AutoCAD 二次开发 395 { class AlertMessage { [CommandMethod("AlertMessage")] public void Message() { Alert("警告!"); } /// /// 弹出警告框 /// /// public static void Alert(string message) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog(message); } } } 加载程序后运行 AlertMessage 命令得到如下效果: (3)帮助网页 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.WebMessage))] namespace Sample { class WebMessage { [CommandMethod("WebMessage")] public void Message() { Web("http://www.bimcad.org"); } /// /// 弹出帮助网页 /// /// public static void Web(string url) { System.Diagnostics.Process.Start("explorer.exe", url); } } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 396 加载程序后运行"WebMessage"命令后会弹出相关帮助网页: [www.BimCad.org]深居浅出 AutoCAD 二次开发 397 【2】输入信息 输入信息的操作包括选择对象与输入数据。 (1)选择单个对象 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.SelectEntity))] namespace Sample { class SelectEntity { [CommandMethod("SelectEntity")] public void Select() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Entity ent = Select("\n 选择对象"); ed.WriteMessage("\n 你选择的对象ObjectId:"+ent.ObjectId.ToString()); } /// /// 提示用户选择单个实体 /// /// 选择提示 /// 实体对象 public static Entity Select(string word) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; Entity entity = null; PromptEntityResult ent = ed.GetEntity(word); if (ent.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { entity = (Entity)transaction.GetObject(ent.ObjectId, OpenMode.ForWrite, true); transaction.Commit(); } } return entity; } } } 加载程序后运行"SelectEntity"命令,选择一个对象,命令行中结果如下: [www.BimCad.org]深居浅出 AutoCAD 二次开发 398 (2)选择集合 在与用户交互式的绘图的时候可能需要批量获取一些图形,而在这一批选择的时候你可能需要过滤一些不需要的类型自 动排除在你选择的集合以外,下面这个例子就是只接受选择文本、圆、直线三种类型,其余的图形将不能选中。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.Selection))] namespace Sample { /// /// 类型过滤枚举类 /// public enum FilterType { Curve, Dimension, Polyline, BlockRef, Circle, Line, Arc, Text, MText } class Selection { [CommandMethod("Selection")] public void Select() { FilterType LineType = FilterType.Line; FilterType TextType = FilterType.Text; FilterType CircleType = FilterType.Circle; FilterType[] Types = new FilterType[3]; Types[0] = LineType; Types[1] = TextType; Types[2] = CircleType; DBObjectCollection EntityCollection = GetSelection(Types); } public static DBObjectCollection GetSelection(FilterType[] tps) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Database db = doc.Database; Editor ed = doc.Editor; Entity entity = null; DBObjectCollection EntityCollection = new DBObjectCollection(); PromptSelectionOptions selops = new PromptSelectionOptions(); // 建立选择的过滤器内容 TypedValue[] filList = new TypedValue[tps.Length + 2]; filList[0] = new TypedValue((int)DxfCode.Operator, ""); for (int i = 0; i < tps.Length; i++) { filList[i + 1] = new TypedValue((int)DxfCode.Start, tps[i].ToString()); } [www.BimCad.org]深居浅出 AutoCAD 二次开发 399 // 建立过滤器 SelectionFilter filter = new SelectionFilter(filList); // 按照过滤器进行选择 PromptSelectionResult ents = ed.GetSelection(selops, filter); if (ents.Status == PromptStatus.OK) { using (Transaction transaction = db.TransactionManager.StartTransaction()) { SelectionSet SS = ents.Value; foreach (ObjectId id in SS.GetObjectIds()) { entity = (Entity)transaction.GetObject(id, OpenMode.ForWrite, true); if (entity != null) EntityCollection.Add(entity); } transaction.Commit(); } } return EntityCollection; } } } 加载程序运行"Selection"命令后框选图形上的对象后得到如下效果: (3)输入数据 对于一些绘图的数据,如点、距离、参数等数据,在绘图的过程中需要提示用户输入。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample.PickPoint))] namespace Sample { [www.BimCad.org]深居浅出 AutoCAD 二次开发 400 class PickPoint { [CommandMethod("PickPoint")] public void Pickpt() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Point3d pt = Pick("\n 拾取点"); ed.WriteMessage("\n 拾取的点坐标为:({0},{1},{2})" ,pt.X,pt.Y,pt.Z); } /// /// 提示用户拾取点 /// /// 提示 /// 返回Point3d public static Point3d Pick(string word) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; PromptPointResult pt = ed.GetPoint(word); if (pt.Status == PromptStatus.OK) { return (Point3d)pt.Value; } else { return new Point3d(); } } } } 加载程序后运行"PickPoint"命令,根据提示拾取屏幕上一点 命令行中结果如下: [www.BimCad.org]深居浅出 AutoCAD 二次开发 401 【3】用户界面 在与 AutoCAD 交互绘图的时候我们常需要用到自己定义的界面来输入输出信息。用户界面提供了更一般的信息输入与 输出的方式。 (1)对话框 对话框即用户自定义的窗体界面,可以以任意的形式组织数据的输入输出。让自定义的 Windows 界面无缝嵌入 AutoCAD 系统。 加载对话框后会在任务栏上显示对话框图标 ,如果需要跟 AutoCAD 弹出 窗体风格保持一致没有新弹出的窗体在任务栏显示可以通过设置窗体的 ShowInTaskbar 为 False 来设置窗体不在任务栏上显示。 需要注意的是,在使用对话框操作文档的时候必须先锁住文档,操作完之后再解锁。 Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; DocumentLock doclock = doc.LockDocument(); //操作过程 doclock.Dispose(); 加入自定义用户界面的步骤: 1、定义界面 右键单击项目,再弹出的菜单中依次选择“添加”->“新建项”。 在“新建项目面板”中选择“Windows”窗体,在“名称”中填写窗体名,点击“添加”按钮 [www.BimCad.org]深居浅出 AutoCAD 二次开发 402 打开“资源管理器”中生成的窗体 ,自定义形式和控件 窗体代码如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; using Autodesk.AutoCAD.ApplicationServices; namespace Sample { public partial class MyForm : Form { public MyForm() { InitializeComponent(); } [www.BimCad.org]深居浅出 AutoCAD 二次开发 403 private void button1_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; using (EditorUserInteraction edUsrInt = ed.StartUserInteraction(this)) { Point3d pt = GetPoint("\n选择点:"); this.InputText.Text = "(" + pt.X.ToString() + "," + pt.Y.ToString() + "," + pt.Z.ToString() + ")"; edUsrInt.End(); this.Focus(); } } /// /// 提示用户拾取点 /// /// 提示 /// 返回Point3d public Point3d GetPoint(string word) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; Editor ed = doc.Editor; PromptPointResult pt = ed.GetPoint(word); if (pt.Status == PromptStatus.OK) { return (Point3d)pt.Value; } else { return new Point3d(); } } private void button2_Click(object sender, EventArgs e) { this.DialogResult= System.Windows.Forms.DialogResult.OK; this.Close(); } private void button3_Click(object sender, EventArgs e) { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.Close(); } } } 2、将自定义界面嵌入AutoCAD 嵌入 AutoCAD 的窗体有两种: ModalDialog(模态对话框) ModelessDialog(非模态对话框) [www.BimCad.org]深居浅出 AutoCAD 二次开发 404 (1.1)模态对话框 ModalDialog(模态对话框)为不可切换焦点的对话框,一般用来于静态的输入或输出数据或切换至 AutoCAD 拾取对象操 作。模态窗体显示的时候程序的焦点始终保持在模态窗体上,如果需要切换到 AutoCAD 环境进行交互的时候需要 EditorUserInteraction 类来切换焦点到 AutoCAD 的命令行,用法如下: using (EditorUserInteraction edUsrInt = ed.StartUserInteraction(this)) { //交互过程 edUsrInt.End(); //交互结束. this.Focus(); } 这段操作写在窗体中要交互的地方,其中 this 是指模态窗体,ed 是指要切换到的命令行。 主程序代码如下: using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; [assembly: CommandClass(typeof(Sample.ModalDialog))] namespace Sample { class ModalDialog { [CommandMethod("ModalDialog")] public void ShowModalDialog() { using (MyForm form = new MyForm()) { Application.ShowModalDialog(form); Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(form.InputText.Text); } } } } 加载程序后运行"ModalDialog"命令,自定义界面会嵌入到AutoCAD环境,此时程序的焦点被锁定在界面上,在这个界面 上可以输入信息: [www.BimCad.org]深居浅出 AutoCAD 二次开发 405 点击“切入到 AutoCAD 拾取点”按钮窗体自动隐藏,程序焦点切换到 AutoCAD 主界面。 根据提示在屏幕上拾取点完成后,窗体自动跳出,程序焦点切换到窗体: [www.BimCad.org]深居浅出 AutoCAD 二次开发 406 点击“取消”按钮命令行无提示,点击“确定”按钮命令行显示窗体文本框中的信息: (1.2)非模态对话框 ModelessDialog(非模态对话框)为活动焦点的对话框,程序焦点可以自由的从 AutoCAD 界面到窗体之间切换,主要用于 用户与 AutoCAD 环境的即时交互操作。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; [assembly: CommandClass(typeof(Sample.ModelessDialog))] namespace Sample { class ModelessDialog { [CommandMethod("ModelessDialog")] public void ShowModelessDialog() { MyForm form = new MyForm(); Application.ShowModelessDialog(form); } } } 加载程序后运行" ModelessDialog "命令,自定义界面会嵌入到 AutoCAD 环境,此时程序的焦点可以在界面与 AutoCAD 环境自由切换。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 407 [www.BimCad.org]深居浅出 AutoCAD 二次开发 408 (2)面板 用 Autodesk.AutoCAD.Windows 命名空间下的 PaletteSet 类,我们可以开发与 AutoCAD 用户界面完全一致的用户界面, PaletteSet 属性的设置顺序,会影响 PaletteSet 不同效果。看下面这个例子在 AutoCAD 中加入用户自定义的界面。 制作面板的步骤 1、自定义控件 依次点击菜单“项目”->“添加用户控件”,创建一个用户界面的控件。 打开刚才创建好的控件 进行自定义。 2、将控件嵌入面板 using System; using Autodesk.AutoCAD.Windows; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.Palette))] namespace Sample { class Palette { [CommandMethod("PALETTE")] public void AddPalette() { MyControl mycontrol = new MyControl(); Autodesk.AutoCAD.Windows.PaletteSet ps = new Autodesk.AutoCAD.Windows.PaletteSet("面板"); ps.Visible = true; ps.Style = PaletteSetStyles.ShowAutoHideButton; ps.Dock = DockSides.None; ps.MinimumSize = new System.Drawing.Size(200, 100); ps.Size = new System.Drawing.Size(200, 100); ps.Add("用户控件", mycontrol); ps.Visible = true; [www.BimCad.org]深居浅出 AutoCAD 二次开发 409 } } } 编译后加载程序、运行"PALETTE"命令后自定义的控件就被加载到AutoCAD中的面板里面了: [www.BimCad.org]深居浅出 AutoCAD 二次开发 410 (3)菜单 菜单是一种方便操作的机制,通过菜单可以快捷的运行定义好的命令。AutoCAD 中的菜单分为带式菜单与右键菜单两种。 (3.1)带式菜单 使用菜单需要加入如下引用: AcDbMgd, AcMgd, AdWindows, PresentationCore, PresentationFramework , WindowsBase using System; using Autodesk.Windows; using Autodesk.AutoCAD.Runtime; [assembly: CommandClass(typeof(Sample.Ribbon))] namespace Sample { class Ribbon { [CommandMethod("AddRibbon")] public void AddRibbon() { RibbonControl rc = RibbonControl(); RibbonTab rt = RibbonTab("菜单标签", "1"); RibbonPanel rp = RibbonPanel("菜单面板"); RibbonButton rb = RibbonButton("菜单按钮", "菜单命令"); rp.Source.Items.Add(rb); rt.Panels.Add(rp); rc.Tabs.Add(rt); } /// /// 获得菜单控制 /// /// public static RibbonControl RibbonControl() { if (Autodesk.Windows.ComponentManager.Ribbon == null) Autodesk.Windows.ComponentManager.ItemInitialized += new EventHandler(ComponentManager_ItemInitialized); return ComponentManager.Ribbon; } /// /// 创建菜单标签 /// /// 标签名 /// 标签ID /// public static RibbonTab RibbonTab(string Name, string id) { RibbonTab ribTab = new Autodesk.Windows.RibbonTab(); ribTab.Title = Name; ribTab.Id = id; [www.BimCad.org]深居浅出 AutoCAD 二次开发 411 ribTab.IsActive = true; return ribTab; } /// /// 创建菜单面板 /// /// 面板名 /// public static RibbonPanel RibbonPanel(string Title) { RibbonPanelSource ribSourcePanel = new RibbonPanelSource(); // Autodesk.Windows ribSourcePanel.Title = Title;//now the panel RibbonPanel ribPanel = new RibbonPanel(); ribPanel.Source = ribSourcePanel; return ribPanel; } /// /// 创建菜单按钮 /// /// 按钮名 /// 命令名 /// public static RibbonButton RibbonButton(string btName, string cmdName) { RibbonButton ribButton = new RibbonButton(); ribButton.Text = btName; ribButton.CommandParameter = cmdName; ribButton.ShowText = true; ribButton.CommandHandler = new AdskCommandHandler(); return ribButton; } /// /// 用于激活菜单 /// /// /// static void ComponentManager_ItemInitialized(object sender, RibbonItemEventArgs e) { if (Autodesk.Windows.ComponentManager.Ribbon != null) Autodesk.Windows.ComponentManager.ItemInitialized -= new EventHandler(ComponentManager_ItemInitialized); } /// /// 执行按钮的命令 /// public class AdskCommandHandler : System.Windows.Input.ICommand { /// /// 是否可执行(接口) /// /// 命令名 [www.BimCad.org]深居浅出 AutoCAD 二次开发 412 /// public bool CanExecute(object parameter) { return true; } /// /// 改变可执行状态 /// public event EventHandler CanExecuteChanged; /// /// 执行命令 /// /// 命令的名字 public void Execute(object parameter) { //is from a Ribbon Button? RibbonButton ribBtn = parameter as RibbonButton; if (ribBtn != null) Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute((String)ri bBtn.CommandParameter, true, false, true); //is from s Ribbon Textbox? RibbonTextBox ribTxt = parameter as RibbonTextBox; if (ribTxt != null) System.Windows.Forms.MessageBox.Show(ribTxt.TextValue); } } } } 加载后运行"AddRibbon"命令,定义的菜单就加载到 AutoCAD 环境了: (3.2)右键菜单 右键菜单即 AutoCAD 中的快捷菜单。下面介绍如何添加右键菜单,以及注册右键菜单对应的命令。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.Windows; using Autodesk.AutoCAD.ApplicationServices; [assembly: CommandClass(typeof(Sample.ContextMeun))] namespace Sample { class ContextMeun { [www.BimCad.org]深居浅出 AutoCAD 二次开发 413 [CommandMethod("AddContextMenu")] public void AddContextMenu() { ContextMenuExtension ce = new ContextMenuExtension(); ce.Title="快捷菜单"; MenuItem mi1 = new MenuItem("创建线"); mi1.Click += new EventHandler(mi1_Click); MenuItem mi2 = new MenuItem("创建圆"); mi2.Click += new EventHandler(mi2_Click); ce.MenuItems.Add(mi1); ce.MenuItems.Add(mi2); Autodesk.AutoCAD.ApplicationServices.Application.AddDefaultContextMenuExtension(ce); } void mi1_Click(object sender, EventArgs e) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; doc.SendStringToExecute("Line \n", true, false, true); } void mi2_Click(object sender, EventArgs e) { Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument; doc.SendStringToExecute("Circle \n", true, false, true); } } } 加载程序后运行"AddContextMenu"命令,在 AutoCAD 环境中右键会多出了快捷菜单项,里面有定义好的命令: 选择“创建线”命令,则跟输入”Line”命令的效果一样。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 414 [www.BimCad.org]深居浅出 AutoCAD 二次开发 415 【五】事件 AutoCAD.NET中的事件相当于ObjectARX中的反应器,是用来捕捉某个行为发生,并要转向相应的处理函数,如:我们 在每次打开一个DWG文件的时候即时对打开的图纸做一些预处理或者DWG图纸中某个图形被删除或新增某些图形时做一些 自动处理的功能,就需要用事件来捕捉这些行为,然后做相应的反应操作,看下面这个例子: using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.DatabaseServices; [assembly: CommandClass(typeof(Sample.ObjectErasedEvent))] namespace Sample { public class ObjectErasedEvent { [CommandMethod("AddObjectErasedEvent")] public void AddEvent() { AddObjectErasedEvent(); } [CommandMethod("RemoveObjectErasedEvent")] public void RemoveEvent() { RemoveObjectErasedEvent(); } public static void AddObjectErasedEvent() { Database db=HostApplicationServices.WorkingDatabase; db.ObjectErased += new ObjectErasedEventHandler(db_ObjectErased); ; } public static void RemoveObjectErasedEvent() { Database db = HostApplicationServices.WorkingDatabase; db.ObjectErased -= new ObjectErasedEventHandler(db_ObjectErased); ; } public static void db_ObjectErased(object sender, ObjectErasedEventArgs e) { Autodesk.AutoCAD.ApplicationServices.Application.ShowAlertDialog("\n你删除的对象ObjectId为:" + e.DBObject.ObjectId.ToString()); } } } 加载程序运行” AddObjectErasedEvent”命令后,每当数据库中删除对象时,则跳出警告框显示被删除对象的ObjectId。 当然你也可以根据你自己的需要更改db_ObjectErased()函数里面的内容来对数据库中删除对象做出所需的反应。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 416 运行” RemoveObjectErasedEvent”取消事件的注册,之后删除对象的动作将不会做出反应。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 417 【六】步骤模仿 Jig 可以在预览的状态下获取用户输入要绘制图形的参数,输入完成后可以得到所输入的参数构成的图形。设计人员可 以直观看见所输入的参数构成的图形。本例通过 Jig 的方式绘制一条直线,在选取过程中可以预览到直线的形状,以便判断是 不是所需要的效果。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.EditorInput; [assembly: CommandClass(typeof(Sample. LineJigSample))] namespace Sample { class LineJigSample { [CommandMethod("LineJig")] public void Jig() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; LineJig lineJig = new LineJig(); PromptResult res = ed.Drag(lineJig); if (res.Status == PromptStatus.OK) { lineJig.SetCounter(1); res = ed.Drag(lineJig); ToModelSpace(lineJig.Entity); } } /// /// 添加对象到模型空间 /// /// 要添加的对象 /// public static ObjectId ToModelSpace(Entity ent) { Database db = HostApplicationServices.WorkingDatabase; ObjectId entId; using (Transaction trans = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)trans.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)trans.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite); entId = btr.AppendEntity(ent); trans.AddNewlyCreatedDBObject(ent, true); trans.Commit(); } return entId; } } [www.BimCad.org]深居浅出 AutoCAD 二次开发 418 public class LineJig : EntityJig { Line myline; Point3d startpoint; Point3d endpoint; int count; public LineJig() : base(new Line()) { myline = new Line(); count = 0; } protected override SamplerStatus Sampler(JigPrompts prompts) { JigPromptPointOptions pntops = new JigPromptPointOptions(); pntops.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NoZeroResponseAccepted | UserInputControls.NoNegativeResponseAccepted); pntops.UseBasePoint = false; pntops.DefaultValue = new Point3d(); if (count == 0) { pntops.Message = "\n选择起点"; PromptPointResult pntres = prompts.AcquirePoint(pntops); PromptStatus ss = pntres.Status; if (pntres.Status == PromptStatus.OK) { startpoint = pntres.Value; endpoint = pntres.Value; return SamplerStatus.OK; } } if (count == 1) { pntops.Message = "\n选择终点"; PromptPointResult pntres = prompts.AcquirePoint(pntops); if (pntres.Status == PromptStatus.OK) { endpoint = pntres.Value; return SamplerStatus.OK; } } return SamplerStatus.Cancel; } protected override bool Update() { ((Line)Entity).StartPoint = startpoint; ((Line)Entity).EndPoint = endpoint; return true; } public void SetCounter(int i) { [www.BimCad.org]深居浅出 AutoCAD 二次开发 419 this.count = i; } public Entity Entity { get { return base.Entity; } } } } 加载程序运行命令"LineJig",根据提示一边预览一边选取构成直线的两个端点,选取完成后预览到的直线就添加到模型 空间中了。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 420 【七】规则重定义 AutoCAD.NET 提供了类似 ObjectARX 自定义对象的方法,规则重定义可以重定义对象的显示形式,可以重定义对象的 夹点,以及对象的行。即线可以显示成一根管,点可以显示成一个圆。下面看看规则重定义的例子把 AutoCAD 里面的直线 变成一个空心管。 using System; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.Geometry; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.GraphicsInterface; [assembly: CommandClass(typeof(Sample.LineToPipeOverule))] namespace Sample { class LineToPipeOverule { [CommandMethod("LineToPipe")] public void Start() { LineToPipe line=new LineToPipe(10); StartOverRule(RXClass.GetClass(typeof(Line)), line); } [CommandMethod("EndOverRule")] public void End() { EndOverRule(); } /// /// 启动重定义 /// /// 要重定义的类型 /// 把要重定义的类型定义为的对象 public static void StartOverRule(RXClass CADClass, Overrule overrule) { Overrule.AddOverrule(CADClass, overrule, false); Overrule.Overruling = true; } /// /// 关闭重定义 /// public static void EndOverRule() { Overrule.Overruling = false; } } /// [www.BimCad.org]深居浅出 AutoCAD 二次开发 421 /// 线显示成管 /// public class LineToPipe : DrawableOverrule { private double r; public LineToPipe(double R) { r = R; } public override bool WorldDraw(Drawable drawable, WorldDraw wd) { if (drawable is Line) { Line line = (Line)drawable; Circle circle = new Circle(line.StartPoint, line.EndPoint - line.StartPoint, r); ExtrudedSurface pipe = new ExtrudedSurface(); pipe.CreateExtrudedSurface(circle, line.EndPoint - line.StartPoint, new SweepOptions()); pipe.WorldDraw(wd); circle.Dispose(); pipe.Dispose(); } return true; } } } 加载程序后运行命令" LineToPipe"",然后在模型空间画一根线,这根线就被重新定义了显示的形式。 运行命令" EndOverRule "关闭规则的重定义。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 422 【八】数据文件 AutoCAD 图纸是以数据库的形式记录一些图形信息和数据,这些图形数据在程序里面很难组织、检索也不能长期保存, 建立一个外部数据表甚至是外部的数据库不但可以记录图形数据甚至可以记录用户对 AutoCAD 的操作信息。 如你的图纸可能是表达一些建筑构件,那么你有可能需要把这些构件归类、统计生成一个材料信息表(BOM 表)。 本例介绍如何讲DWG 数据库中的数据读到数据文件中。这个例子将一个DWG 数据库中的数据存入一个EXCEL表格中, 有了 EXCEL 表格,就可以轻松的对数据做一些分析处理。 处理 EXCEL 文件添加 COM 组件 Microsoft Excel X.0 Object Library 和 Microsoft Office X.0 Object Library(X 代表系统中 安装的 Excel 的版本)。 using System; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.DatabaseServices; [assembly: CommandClass(typeof(Sample.ToExcel))] namespace Sample { class ToExcel { [CommandMethod("ToExcel")] public void Excel() { Database db = HostApplicationServices.WorkingDatabase; System.Data.DataTable dt = new System.Data.DataTable(); dt.TableName = "LineTable"; dt.Columns.Add("Handle", typeof(string)); dt.Columns.Add("StartPointX", typeof(double)); dt.Columns.Add("StartPointY", typeof(double)); dt.Columns.Add("StartPointZ", typeof(double)); dt.Columns.Add("EndPointX", typeof(double)); dt.Columns.Add("EndPointY", typeof(double)); dt.Columns.Add("EndPointZ", typeof(double)); using (Transaction tr = db.TransactionManager.StartTransaction()) { BlockTable bt = (BlockTable)tr.GetObject(db.BlockTableId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead); foreach (ObjectId id in btr) { System.Data.DataRow dr = dt.NewRow(); Line line = tr.GetObject(id, OpenMode.ForRead) as Line; if (line != null) { dr[0] = line.Handle.ToString(); dr[1] = line.StartPoint.X; dr[2] = line.StartPoint.Y; dr[3] = line.StartPoint.Z; dr[4] = line.EndPoint.X; dr[5] = line.EndPoint.Y; dr[6] = line.EndPoint.Z; } [www.BimCad.org]深居浅出 AutoCAD 二次开发 423 dt.Rows.Add(dr); } tr.Commit(); } SaveTo(dt, "c:\\www.bimcad.org.xlsx"); } /// /// 把数据表保存到Excel文件 /// /// /// public static void SaveTo(System.Data.DataTable dt, string fileName) { int columnIndex = 1; int rowIndex = 1; Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.ApplicationClass(); xlApp.DefaultFilePath = fileName; xlApp.DisplayAlerts = true; xlApp.SheetsInNewWorkbook = 1; Microsoft.Office.Interop.Excel.Workbook xlBook = xlApp.Workbooks.Add(true); //将DataTable的列名导入Excel表第一行 foreach (System.Data.DataColumn column in dt.Columns) { xlApp.Cells[rowIndex, columnIndex] = column.ColumnName; columnIndex++; } //将DataTable中的数据导入Excel中 for (int i = 0; i < dt.Rows.Count; i++) { columnIndex = 1; rowIndex++; for (int j = 0; j < dt.Columns.Count; j++) { xlApp.Cells[rowIndex, columnIndex] = dt.Rows[i][j].ToString(); columnIndex++; } } xlBook.SaveCopyAs(fileName); xlApp = null; xlBook = null; } } } 运行命令之前在图纸中添加一些直线用来读取信息。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 424 运行后打开 c: \www.bimcad.org.xlsx 文件,图形里面的数据就被记录在其中了。 [www.BimCad.org]深居浅出 AutoCAD 二次开发 425 附录 附录一:AutoCAD 版本对应的注册表信息 2000 SOFTWARE\Autodesk\AutoCAD\R15.0\ACAD-1:804 中文版 SOFTWARE\Autodesk\AutoCAD\R15.0\ACAD-1:409 英文版 2002 SOFTWARE\Autodesk\AutoCAD\R15.0\ACAD-1:804 中文版 SOFTWARE\Autodesk\AutoCAD\R15.0\ACAD-1:409 英文版 2004 SOFTWARE\Autodesk\AutoCAD\R16.0\ACAD-201:804 中文版 SOFTWARE\Autodesk\AutoCAD\R16.0\ACAD-201:409 英文版 2005 SOFTWARE\Autodesk\AutoCAD\R16.1\ACAD-301:804 中文版 SOFTWARE\Autodesk\AutoCAD\R16.1\ACAD-301:409 英文版 2006 SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:804 中文版 SOFTWARE\Autodesk\AutoCAD\R16.2\ACAD-4001:409 英文版 2007 SOFTWARE\Autodesk\AutoCAD\R17.0\ACAD-5001:804 中文版 SOFTWARE\Autodesk\AutoCAD\R17.0\ACAD-5001:409 英文版 2008 SOFTWARE\Autodesk\AutoCAD\R17.1\ACAD-6001:804 中文版 SOFTWARE\Autodesk\AutoCAD\R17.1\ACAD-6001:409 英文版 2009 SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7001:804 中文版 SOFTWARE\Autodesk\AutoCAD\R17.2\ACAD-7001:409 英文版 2010 SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:804 中文版 SOFTWARE\Autodesk\AutoCAD\R18.0\ACAD-8001:409 英文版 [www.BimCad.org]深居浅出 AutoCAD 二次开发 426 附录二:AutoCAD 常用操作快捷键 AutoCAD 快捷键 1、对象特性 CH,MO,PR PROPERTIES(修改特性“Ctrl+1”) BO BOUNDARY(边界\合多段线\面域) MA MATCHPROP(属性匹配) ST STYLE(文字样式) COL COLOR(设置颜色) LA LAYER(图层操作) LT LINETYPE(线形) LTS LTSCALE(线形比例) LW LWEIGHT(线宽) UN UNITS(图形单位) ATT ATTDEF(属性定义) ATE ATTEDIT(编辑属性) AL ALIGN(对齐) EXIT QUIT(退出) EXP EXPORT(输出其它格式文件) IMP IMPORT(输入文件) OP,PR OPTIONS(自定义 CAD 设置) PRINT PLOT(打印) PU PURGE(清除垃圾) R REDRAW(重新生成) REN RENAME(重命名) SN SNAP(捕捉栅格) DS DSETTINGS(设置极轴追踪) OS OSNAP(设置捕捉模式) PRE PREVIEW(打印预览) TO TOOLBAR(工具栏) V VIEW(命名视图) AA AREA(面积) DI DIST(距离) LI LIST(显示图形数据信息) 2、绘图命令: PO POINT(点) L LINE(直线) XL XLINE(射线) PL PLINE(多段线) ML MLINE(多线) SPL SPLINE(样条曲线) POL POLYGON(正多边形) REC RECTANGLE(矩形) C CIRCLE(圆) A ARC(圆弧) DO DONUT(圆环) EL ELLIPSE(椭圆) REG REGION(面域) MT MTEXT(多行文本) T MTEXT(多行文本) B BLOCK(块定义) I INSERT(插入块) W WBLOCK(定义块文件) DIV DIVIDE(等分) H BHATCH(填充) 3、修改命令: CO COPY(复制) MI MIRROR(镜像) AR ARRAY(阵列) O OFFSET(偏移) RO ROTATE(旋转) M MOVE(移动) E DEL 键*ERASE(删除) X EXPLODE(分解) TR, TRIM(修剪) EX EXTEND(延伸) S STRETCH(拉伸) LEN LENGTHEN(直线拉长) SC, SCALE(比例缩放) BR BREAK(打断) CHA, CHAMFER(倒角) F FILLET(倒圆角) PE, PEDIT(多段线编辑) ED DDEDIT(修改文本) 4、尺寸标注: DLI DIMLINEAR(直线标注) DAL DIMALIGNED(对齐标注) DRA DIMRADIUS(半径标注) DDI DIMDIAMETER(直径标注) DAN DIMANGULAR(角度标注) DCE DIMCENTER(中心标注) DOR DIMORDINATE(点标注) TOL TOLERANCE(标注形位公差) [www.BimCad.org]深居浅出 AutoCAD 二次开发 427 LE QLEADER(快速引出标注) DBA DIMBASELINE(基线标注) DCO DIMCONTINUE(连续标注) D DIMSTYLE(标注样式) DED DIMEDIT(编辑标注) DOV DIMOVERRIDE(替换标注系统变量) CTRL 快捷键 【CTRL】+1 PROPERTIES(修改特性) 【CTRL】+2 ADCENTER(设计中心) 【CTRL】+O OPEN(打开文件) 【CTRL】+N、M NEW(新建文件) 【CTRL】+P PRINT(打印文件) 【CTRL】+S SAVE(保存文件) 【CTRL】+Z UNDO(放弃) 【CTRL】+X CUTCLIP(剪切) 【CTRL】+C COPYCLIP(复制) 【CTRL】+V PASTECLIP(粘贴) 【CTRL】+B SNAP(栅格捕捉) 【CTRL】+F OSNAP(对象捕捉) 【CTRL】+G GRID(栅格) 【CTRL】+L ORTHO(正交) 【CTRL】+W (对象追踪) 【CTRL】+U (极轴) [www.BimCad.org]深居浅出 AutoCAD 二次开发 428 附录三:AutoCAD 系统变量 A ACADLSPASDOC 控制 AutoCAD 是将 acad.lsp 文件加载到所有图形中,还是仅加载到在 AutoCAD 任务中打开的第一个文件中 ACADPREFIX 存储由 ACAD 环境变量指定的目录路径(如果有的话),如果需要则添加路径分隔符 ACADVER 存储 AutoCAD 版本号 ACISOUTVER 控制 ACISOUT 命令创建的 SAT 文件的 ACIS 版本 AFLAGS 设置 ATTDEF 位码的属性标志 ANGBASE 设置相对当前 UCS 的 0 度基准角方向 ANGDIR 设置相对当前 UCS 以 0 度为起点的正角度方向 APBOX 打开或关闭 AutoSnap 靶框 APERTURE 以像素为单位设置对象捕捉的靶框尺寸 AREA 存储由 AREA、LIST 或 DBLIST 计算出来的最后一个面积 ATTDIA 控制是否使用对话框获取属性值 ATTMODE 控制属性的显示方式 ATTREQ 确定 INSERT 在插入块时是否使用缺省属性设置 AUDITCTL 控制 AUDIT 命令是否创建核查报告文件(ADT) AUNITS 设置角度单位 AUPREC 设置角度单位的小数位数 AUTOSNAP 控制 AutoSnap 标记、工具栏提示和磁吸 B BACKZ 存储当前视口后剪裁平面到目标平面的偏移值 BINDTYPE 控制绑定或在位编辑外部参照时外部参照名称的处理方式 BLIPMODE 控制点标记是否可见 C CDATE 设置日历的日期和时间 CECOLOR 设置新对象的颜色 CELTSCALE 设置当前对象的线型比例缩放因子 CELTYPE 设置新对象的线型 CELWEIGHT 设置新对象的线宽 CHAMFERA 设置第一个倒角距离 CHAMFERB 设置第二个倒角距离 CHAMFERC 设置倒角长度 CHAMFERD 设置倒角角度 CHAMMODE 设置 AutoCAD 创建倒角的输入模式 CIRCLERAD 设置缺省的圆半径 CLAYER 设置当前图层 CMDACTIVE 存储一个位码值,此位码值标识激活的是普通命令、透明命令、脚本还是对话框 CMDECHO 控制 AutoLISP 的(command)函数运行时 AutoCAD 是否回显提示和输入 CMDNAMES 显示活动命令和透明命令的名称 CMLJUST 指定多线对正方式 CMLSCALE 控制多线的全局宽度 [www.BimCad.org]深居浅出 AutoCAD 二次开发 429 CMLSTYLE 设置多线样式 COMPASS 控制当前视口中三维坐标球的开关状态 COORDS 控制状态栏上的坐标更新方式 CPLOTSTYLE 控制新对象的当前打印样式 CPROFILE 存储当前配置文件的名称 CTAB 返回图形中的当前选项卡(模型或布局)名称。通过本系统变量,用户可以确定当前的活动选项卡 CURSORSIZE 按屏幕大小的百分比确定十字光标的大小 CVPORT 设置当前视口的标识号 D DATE 存储当前日期和时间 DBMOD 用位码表示图形的修改状态 DCTCUST 显示当前自定义拼写词典的路径和文件名 DCTMAIN 本系统变量显示当前的主拼写词典的文件名 DEFLPLSTYLE 为新图层指定缺省打印样式名称 DEFPLSTYLE 为新对象指定缺省打印样式名称 DELOBJ 控制用来创建其他对象的对象将从图形数据库中删除还是保留在图形数据库中 DEMANDLOAD 在图形包含由第三方应用程序创建的自定义对象时,指定 AutoCAD 是否以及何时要求加载此应用程序 DIASTAT 存储最近一次使用对话框的退出方式 DIMADEC 控制角度标注显示精度的小数位 DIMALT 控制标注中换算单位的显示 DIMALTD 控制换算单位中小数的位数 DIMALTF 控制换算单位中的比例因子 DIMALTRND 决定换算单位的舍入 DIMALTTD 设置标注换算单位公差值的小数位数 DIMALTTZ 控制是否对公差值作消零处理 DIMALTU 设置所有标注样式族成员(角度标注除外)的换算单位的单位格式 DIMALTZ 控制是否对换算单位标注值作消零处理 DIMAPOST 指定所有标注类型(角度标注除外)换算标注测量值的文字前缀或后缀(或两者都指定) DIMASO 控制标注对象的关联性 DIMASZ 控制尺寸线、引线箭头的大小 DIMATFIT 当尺寸界线的空间不足以同时放下标注文字和箭头时,确定这两者的排列方式 DIMAUNIT 设置角度标注的单位格式 DIMAZIN 对角度标注作消零处理 DIMBLK 设置显示在尺寸线或引线末端的箭头块 DIMBLK1 当 DIMSAH 为开时,设置尺寸线第一个端点的箭头 DIMBLK2 当 DIMSAH 为开时,设置尺寸线第二个端点的箭头 DIMCEN 控制由 DIMCENTER、DIMDIAMETER 和 DIMRADIUS 绘制的圆或圆弧的圆心标记和中心线 DIMCLRD 为尺寸线、箭头和标注引线指定颜色 DIMCLRE 为尺寸界线指定颜色 DIMCLRT 为标注文字指定颜色 DIMDEC 设置标注主单位显示的小数位位数 DIMDLE 当使用小斜线代替箭头进行标注时,设置尺寸线超出尺寸界线的距离 DIMDLI 控制基线标注中尺寸线的间距 DIMDSEP 指定一个单独的字符作为创建十进制标注时使用的小数分隔符 [www.BimCad.org]深居浅出 AutoCAD 二次开发 430 DIMEXE 指定尺寸界线超出尺寸线的距离 DIMEXO 指定尺寸界线偏离原点的距离 DIMFIT 已废弃。现由 DIMATFIT 和 DIMTMOVE 代替 DIMFRAC 设置当 DIMLUNIT 被设为 4(建筑)或 5(分数)时的分数格式 DIMGAP 在尺寸线分段以放置标注文字时,设置标注文字周围的距离 DIMJUST 控制标注文字的水平位置 DIMLDRBLK 指定引线的箭头类型 DIMLFAC 设置线性标注测量值的比例因子 DIMLIM 将极限尺寸生成为缺省文字 DIMLUNIT 为所有标注类型(角度标注除外)设置单位 DIMLWD 指定尺寸线的线宽 DIMLWE 指定尺寸界线的线宽 DIMPOST 指定标注测量值的文字前缀或后缀(或两者都指定) DIMRND 将所有标注距离舍入到指定值 DIMSAH 控制尺寸线箭头块的显示 DIMSCALE 为标注变量(指定尺寸、距离或偏移量)设置全局比例因子 DIMSD1 控制是否禁止显示第一条尺寸线 DIMSD2 控制是否禁止显示第二条尺寸线 DIMSE1 控制是否禁止显示第一条尺寸界线 DIMSE2 控制是否禁止显示第二条尺寸界线 DIMSHO 控制是否重新定义拖动的标注对象 DIMSOXD 控制是否允许尺寸线绘制到尺寸界线之外 DIMSTYLE 显示当前标注样式 DIMTAD 控制文字相对尺寸线的垂直位置 DIMTDEC 设置标注主单位的公差值显示的小数位数 DIMTFAC 设置用来计算标注分数或公差文字的高度的比例因子 DIMTIH 控制所有标注类型(坐标标注除外)的标注文字在尺寸界线内的位置 DIMTIX 在尺寸界线之间绘制文字 DIMTM 当 DIMTOL 或 DIMLIM 为开时,为标注文字设置最大下偏差 DIMTMOVE 设置标注文字的移动规则 DIMTOFL 控制是否将尺寸线绘制在尺寸界线之间(即使文字放置在尺寸界线之外) DIMTOH 控制标注文字在尺寸界线外的位置 DIMTOL 将公差添加到标注文字中 DIMTOLJ 设置公差值相对名词性标注文字的垂直对正方式 DIMTP 当 DIMTOL 或 DIMLIM 为开时,为标注文字设置最大上偏差 DIMTSZ 指定线性标注、半径标注以及直径标注中替代箭头的小斜线尺寸 DIMTVP 控制尺寸线上方或下方标注文字的垂直位置 DIMTXSTY 指定标注的文字样式 DIMTXT 指定标注文字的高度,除非当前文字样式具有固定的高度 DIMTZIN 控制是否对公差值作消零处理 DIMUNIT 已废弃,现由 DIMLUNIT 和 DIMFRAC 代替 DIMUPT 控制用户定位文字的选项 DIMZIN 控制是否对主单位值作消零处理 DISPSILH 控制线框模式下实体对象轮廓曲线的显示 [www.BimCad.org]深居浅出 AutoCAD 二次开发 431 DISTANCE 存储由 DIST 计算的距离 DONUTID 设置圆环的缺省内直径 DONUTOD 设置圆环的缺省外直径 DRAGMODE 控制拖动对象的显示 DRAGP1 设置重生成拖动模式下的输入采样率 DRAGP2 设置快速拖动模式下的输入采样率 DWGCHECK 确定图形最后是否经非 AutoCAD 程序编辑 DWGCODEPAGE 存储与 SYSCODEPAGE 系统变量相同的值(出于兼容性的原因) DWGNAME 存储用户输入的图形名 DWGPREFIX 存储图形文件的“驱动器/目录”前缀 DWGTITLED 指出当前图形是否已命名 E EDGEMODE 控制 TRIM 和 EXTEND 确定剪切边和边界的方式 ELEVATION 存储当前空间的当前视口中相对于当前 UCS 的当前标高值 EXPERT 控制是否显示某些特定提示 EXPLMODE 控制 EXPLODE 是否支持比例不一致(NUS)的块 EXTMAX 存储图形范围右上角点的坐标 EXTMIN 存储图形范围左下角点的坐标 EXTNAMES 为存储于符号表中的已命名对象名称(例如线型和图层)设置参数 F FACETRATIO 控制圆柱或圆锥 ACIS 实体镶嵌面的宽高比 FACETRES 调整着色对象和渲染对象的平滑度,对象的隐藏线被删除 FILEDIA 禁止显示文件对话框 FILLETRAD 存储当前的圆角半径 FILLMODE 指定多线、宽线、二维填充、所有图案填充(包括实体填充)和宽多段线是否被填充 FONTALT 指定在找不到指定的字体文件时使用的替换字体 FONTMAP 指定要用到的字体映射文件 FRONTZ 存储当前视口中前剪裁平面到目标平面的偏移量 FULLOPEN 指示当前图形是否被局部打开 G GRIDMODE 打开或关闭栅格 GRIDUNIT 指定当前视口的栅格间距(X 和 Y 方向) GRIPBLOCK 控制块中夹点的分配 GRIPCOLOR 控制未选定夹点(绘制为轮廓框)的颜色 GRIPHOT 控制选定夹点(绘制为实心块)的颜色 GRIPS 控制“拉伸”、“移动”、“旋转”、“比例”和“镜像”夹点模式中选择集夹点的使用 GRIPSIZE 以像素为单位设置显示夹点框的大小 H HANDLES 报告应用程序是否可以访问对象句柄 HIDEPRECISION 控制消隐和着色的精度 HIGHLIGHT 控制对象的亮显。它并不影响使用夹点选定的对象 HPANG 指定填充图案的角度 HPBOUND 控制 BHATCH 和 BOUNDARY 创建的对象类型 HPDOUBLE 指定用户定义图案的交叉填充图案 [www.BimCad.org]深居浅出 AutoCAD 二次开发 432 HPNAME 设置缺省的填充图案名称[page] HPSCALE 指定填充图案的比例因子 HPSPACE 为用户定义的简单图案指定填充图案的线间距 HYPERLINKBASE 指定图形中用于所有相对超级链接的路径 I IMAGEHLT 控制是亮显整个光栅图像还是仅亮显光栅图像边框 INDEXCTL 控制是否创建图层和空间索引并保存到图形文件中 INETLOCATION 存储 BROWSER 和“浏览 Web 对话框”使用的 Internet 网址 INSBASE 存储 BASE 设置的插入基点 INSNAME 为 INSERT 设置缺省块名 INSUNITS 当从 AutoCAD 设计中心拖放块时,指定图形单位值 INSUNITSDEFSOURCE 设置源内容的单位值 INSUNITSDEFTARGET 设置目标图形的单位值 ISAVEBAK 提高增量保存速度,特别是对于大的图形 ISAVEPERCENT 确定图形文件中所允许的占用空间的总量 ISOLINES 指定对象上每个曲面的轮廓素线的数目 L LASTANGLE 存储上一个输入圆弧的端点角度 LASTPOINT 存储上一个输入的点 LASTPROMPT 存储显示在命令行中的上一个字符串 LENSLENGTH 存储当前视口透视图中的镜头焦距长度(以毫米为单位) LIMCHECK 控制在图形界限之外是否可以生成对象 LIMMAX 存储当前空间的右上方图形界限 LIMMIN 存储当前空间的左下方图形界限 LISPINIT 当使用单文档界面时,指定打开新图形时是否保留 AutoLISP 定义的函数和变量 LOCALE 显示用户运行的当前 AutoCAD 版本的国际标准化组织(ISO)语言代码 LOGFILEMODE 指定是否将文本窗口的内容写入日志文件 LOGFILENAME 指定日志文件的路径和名称 LOGFILEPATH 为同一任务中的所有图形指定日志文件的路径 LOGINNAME 显示加载 AutoCAD 时配置或输入的用户名 LTSCALE 设置全局线型比例因子 LUNITS 设置线性单位 LUPREC 设置线性单位的小数位数 LWDEFAULT 设置缺省线宽的值 LWDISPLAY 控制“模型”或“布局”选项卡中的线宽显示 LWUNITS 控制线宽的单位显示为英寸还是毫米 M MAXACTVP 设置一次最多可以激活多少视口 MAXSORT 设置列表命令可以排序的符号名或块名的最大数目 MBUTTONPAN 控制定点设备第三按钮或滑轮的动作响应 MEASUREINIT 设置初始图形单位(英制或公制) MEASUREMENT 设置当前图形的图形单位(英制或公制) MENUCTL 控制屏幕菜单中的页切换 MENUECHO 设置菜单回显和提示控制位 [www.BimCad.org]深居浅出 AutoCAD 二次开发 433 MENUNAME 存储菜单文件名,包括文件名路径 MIRRTEXT 控制 MIRROR 对文字的影响 MODEMACRO 在状态行显示字符串 MTEXTED 设置用于多行文字对象的首选和次选文字编辑器 N NOMUTT 禁止消息显示,即不反馈工况(如果这些消息在通常情况下并不禁止) O OFFSETDIST 设置缺省的偏移距离 OFFSETGAPTYPE 控制如何偏移多段线以弥补偏移多段线的单个线段所留下的间隙 OLEHIDE 控制 AutoCAD 中 OLE 对象的显示 OLEQUALITY 控制内嵌的 OLE 对象质量缺省的级别 OLESTARTUP 控制打印内嵌 OLE 对象时是否加载其源应用程序 ORTHOMODE 限制光标在正交方向移动 OSMODE 使用位码设置执行对象捕捉模式 OSNAPCOORD 控制是否从命令行输入坐标替代对象捕捉 P PAPERUPDATE 控制警告对话框的显示(如果试图以不同于打印配置文件缺省指定的图纸大小打印布局) PDMODE 控制如何显示点对象 PDSIZE 设置显示的点对象大小 PERIMETER 存储 AREA、LIST 或 DBLIST 计算的最后一个周长值 PFACEVMAX 设置每个面顶点的最大数目 PICKADD 控制后续选定对象是替换当前选择集还是追加到当前选择集中 PICKAUTO 控制“选择对象”提示下是否自动显示选择窗口 PICKBOX 设置选择框的高度 PICKDRAG 控制绘制选择窗口的方式 PICKFIRST 控制在输入命令之前(先选择后执行)还是之后选择对象 PICKSTYLE 控制编组选择和关联填充选择的使用 PLATFORM 指示 AutoCAD 工作的操作系统平台 PLINEGEN 设置如何围绕二维多段线的顶点生成线型图案 PLINETYPE 指定 AutoCAD 是否使用优化的二维多段线 PLINEWID 存储多段线的缺省宽度 PLOTID 已废弃,在 AutoCAD2000 中没有效果,但在保持 AutoCAD2000 以前版本的脚本和 LISP 程序的完整性时还可 能有用 PLOTROTMODE 控制打印方向 PLOTTER 已废弃,在 AutoCAD2000 中没有效果,但在保持 AutoCAD2000 以前版本的脚本和 LISP 程序的完整性时还可 能有用 PLQUIET 控制显示可选对话框以及脚本和批打印的非致命错误 POLARADDANG 包含用户定义的极轴角 POLARANG 设置极轴角增量 POLARDIST 当 SNAPSTYL 系统变量设置为 1(极轴捕捉)时,设置捕捉增量 POLARMODE 控制极轴和对象捕捉追踪设置 POLYSIDES 设置 POLYGON 的缺省边数 POPUPS 显示当前配置的显示驱动程序状态 PRODUCT 返回产品名称 PROGRAM 返回程序名称 [www.BimCad.org]深居浅出 AutoCAD 二次开发 434 PROJECTNAME 给当前图形指定一个工程名称 PROJMODE 设置修剪和延伸的当前“投影”模式 PROXYGRAPHICS 指定是否将代理对象的图像与图形一起保存 PROXYNOTICE 如果打开一个包含自定义对象的图形,而创建此自定义对象的应用程序尚未加载时,显示通知 PROXYSHOW 控制图形中代理对象的显示 PSLTSCALE 控制图纸空间的线型比例 PSPROLOG 为使用 PSOUT 时从 acad.psf 文件读取的前导段指定一个名称 PSQUALITY 控制 Postscript 图像的渲染质量 PSTYLEMODE 指明当前图形处于“颜色相关打印样式”还是“命名打印样式”模式 PSTYLEPOLICY 控制对象的颜色特性是否与其打印样式相关联 PSVPSCALE 为新创建的视口设置视图缩放比例因子 PUCSBASE 存储仅定义图纸空间中正交 UCS 设置的原点和方向的 UCS 名称 Q QTEXTMODE 控制文字的显示方式 R RASTERPREVIEW 控制 BMP 预览图像是否随图形一起保存 REFEDITNAME 指示图形是否处于参照编辑状态,并存储参照文件名 REGENMODE 控制图形的自动重生成 RE-INIT 初始化数字化仪、数字化仪端口和 acad.pgp 文件 RTDISPLAY 控制实时缩放(ZOOM)或平移(PAN)时光栅图像的显示 S SAVEFILE 存储当前用于自动保存的文件名 SAVEFILEPATH 为 AutoCAD 任务中所有自动保存文件指定目录的路径 SAVENAME 在保存图形之后存储当前图形的文件名和目录路径 SAVETIME 以分钟为单位设置自动保存的时间间隔 SCREENBOXES 存储绘图区域的屏幕菜单区显示的框数 SCREENMODE 存储表示 AutoCAD 显示的图形/文本状态的位码值 SCREENSIZE 以像素为单位存储当前视口的大小(X 和 Y 值) SDI 控制 AutoCAD 运行于单文档还是多文档界面 SHADEDGE 控制渲染时边的着色 SHADEDIF 设置漫反射光与环境光的比率 SHORTCUTMENU 控制“缺省”、“编辑”和“命令”模式的快捷菜单在绘图区域是否可用 SHPNAME 设置缺省的形名称 SKETCHINC 设置 SKETCH 使用的记录增量 SKPOLY 确定 SKETCH 生成直线还是多段线 SNAPANG 为当前视口设置捕捉和栅格的旋转角 SNAPBASE 相对于当前 UCS 设置当前视口中捕捉和栅格的原点 SNAPISOPAIR 控制当前视口的等轴测平面 SNAPMODE 打开或关闭“捕捉”模式 SNAPSTYL 设置当前视口的捕捉样式 SNAPTYPE 设置当前视口的捕捉样式 SNAPUNIT 设置当前视口的捕捉间距 SOLIDCHECK 打开或关闭当前 AutoCAD 任务中的实体校验 SORTENTS 控制 OPTIONS 命令(从“选择”选项卡中执行)对象排序操作 [www.BimCad.org]深居浅出 AutoCAD 二次开发 435 SPLFRAME 控制样条曲线和样条拟合多段线的显示 SPLINESEGS 设置为每条样条拟合多段线生成的线段数目 SPLINETYPE 设置用 PEDIT 命令的“样条曲线”选项生成的曲线类型 SURFTAB1 设置 RULESURF 和 TABSURF 命令所用到的网格面数目 SURFTAB2 设置 REVSURF 和 EDGESURF 在 N 方向上的网格密度 SURFTYPE 控制 PEDIT 命令的“平滑”选项生成的拟合曲面类型 SURFU 设置 PEDIT 的“平滑”选项在 M 方向所用到的表面密度 SURFV 设置 PEDIT 的“平滑”选项在 N 方向所用到的表面密度 SYSCODEPAGE 指示 acad.xmf 中指定的系统代码页 T TABMODE 控制数字化仪的使用 TARGET 存储当前视口中目标点的位置 TDCREATE 存储图形创建的本地时间和日期 TDINDWG 存储总编辑时间 TDUCREATE 存储图形创建的国际时间和日期 TDUPDATE 存储最后一次更新/保存的本地时间和日期 TDUSRTIMER 存储用户消耗的时间 TDUUPDATE 存储最后一次更新/保存的国际时间和日期 TEMPPREFIX 包含用于放置临时文件的目录名 TEXTEVAL 控制处理字符串的方式 TEXTFILL 控制打印、渲染以及使用 PSOUT 命令输出时 TrueType 字体的填充方式 TEXTQLTY 控制打印、渲染以及使用 PSOUT 命令输出时 TrueType 字体轮廓的分辨率 TEXTSIZE 设置以当前文字样式绘制出来的新文字对象的缺省高度 TEXTSTYLE 设置当前文字样式的名称 THICKNESS 设置当前三维实体的厚度 TILEMODE 将“模型”或最后一个布局选项卡设置为当前选项卡 TOOLTIPS 控制工具栏提示的显示 TRACEWID 设置宽线的缺省宽度 TRACKPATH 控制显示极轴和对象捕捉追踪的对齐路径 TREEDEPTH 指定最大深度,即树状结构的空间索引可以分出分枝的最大数目 TREEMAX 通过限制空间索引(八叉树)中的节点数目,从而限制重新生成图形时占用的内存 TRIMMODE 控制 AutoCAD 是否修剪倒角和圆角的边缘 TSPACEFAC 控制多行文字的行间距。以文字高度的比例计算 t TSPACETYPE 控制多行文字中使用的行间距类型 TSTACKALIGN 控制堆叠文字的垂直对齐方式 TSTACKSIZE 控制堆叠文字分数的高度相对于选定文字的当前高度的百分比 U UCSAXISANG 存储使用 UCS 命令的 X,Y 或 Z 选项绕轴旋转 UCS 时的缺省角度值 UCSBASE 存储定义正交 UCS 设置的原点和方向的 UCS 名称 UCSFOLLOW 用于从一个 UCS 转换到另一个 UCS 时生成一个平面视图 UCSICON 显示当前视口的 UCS 图标 UCSNAME 存储当前空间中当前视口的当前坐标系名称 UCSORG 存储当前空间中当前视口的当前坐标系原点 UCSORTHO 确定恢复一个正交视图时是否同时自动恢复相关的正交 UCS 设置 [www.BimCad.org]深居浅出 AutoCAD 二次开发 436 UCSVIEW 确定当前 UCS 是否随命名视图一起保存 UCSVP 确定活动视口的 UCS 保持定态还是作相应改变以反映当前活动视口的 UCS 状态 UCSXDIR 存储当前空间中当前视口的当前 UCS 的 X 方向 UCSYDIR 存储当前空间中当前视口的当前 UCS 的 Y 方向 UNDOCTL 存储指示 UNDO 命令的“自动”和“控制”选项的状态的位码 UNDOMARKS 存储“标记”选项放置在 UNDO 控制流中的标记数目 UNITMODE 控制单位的显示格式 USERI1-5 存储和提取整型值 USERR1-5 存储和提取实型值 USERS1-5 存储和提取字符串数据 V VIEWCTR 存储当前视口中视图的中心点 VIEWDIR 存储当前视口中的查看方向 VIEWMODE 使用位码控制当前视口的查看模式 VIEWSIZE 存储当前视口的视图高度 VIEWTWIST 存储当前视口的视图扭转角 VISRETAIN 控制外部参照依赖图层的可见性、颜色、线型、线宽和打印样式(如果 PSTYLEPOLICY 设置为 0),并且指定是 否保存对嵌套外部参照路径的修改 VSMAX 存储当前视口虚屏的右上角坐标 VSMIN 存储当前视口虚屏的左下角坐标 W WHIPARC 控制圆或圆弧是否平滑显示 WMFBKGND 控制 WMFOUT 命令输出的 Windows 图元文件、剪贴板中对象的图元格式以及拖放到其他应用程序的图元的 背景 WORLDUCS 指示 UCS 是否与 WCS 相同 WORLDVIEW 确定响应 3DORBIT、DVIEW 和 VPOINT 命令的输入是相对于 WCS(缺省),还是相对于当前 UCS 或由 UCSBASE 系统变量指定的 UCS WRITESTAT 指出图形文件是只读的还是可写的。开发人员需要通过 AutoLISP 确定文件的读写状态 X XCLIPFRAME 控制外部参照剪裁边界的可见性 XEDIT 控制当前图形被其他图形参照时是否可以在位编辑 XFADECTL 控制在位编辑参照时的褪色度 XLOADCTL 打开或关闭外部参照文件的按需加载功能,控制打开原始图形还是打开一个副本 XLOADPATH 创建一个路径用于存储按需加载的外部参照文件临时副本 XREFCTL 控制 AutoCAD 是否生成外部参照的日志文件(XLG) Z ZOOMFACTOR 控制智能鼠标的每一次前移或后退操作所执行的缩放增量 [www.BimCad.org]深居浅出 AutoCAD 二次开发 437 附录四:AutoCAD 字符对照表 代码 符号 解 释 %%0~32 空号 %%33 ! 感叹号 %%34 “ 双引号 %%35 # 井号 %%36 $ 美元符号 %%37 % 百分号 %%38 & “与”符号 %%39 ‘ 单引号 %%40 ( 左括号 %%41 ) 右括号 %%42 * 乘号 %%43 + 加号 %%44 , 逗号 %%45 - 减号 %%46 。 句号 %%47 / 除号 %%48~57 0~9 字体偏大 %%58 : 冒号 %%59 ; 分号 %%60 < 小于号 %%61 = 等于号 %%62 > 大于号 %%63 ? 问号 %%64 @ At 符号 %%65~90 A~Z 大写 26 个字母 %%91 [ 左中括号 %%92 / 反斜杠 %%93 ] 右中括号 %%94 ^ %%95 _ 下划线 %%96 ‘ 单引号 %%97~122 a~z 小写 26 个字母 %%123 { 左大括号 %%124 | 竖线符号 %%125 } 右大括号 %%126 ~ 波浪符号 %%127 ° 度 %%128 ± 正负号 %%129 φ 直径符号 %%130 一级钢 %%131 二级钢 %%132 三级钢 %%133 四级钢 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 438 %%134~137 空号 %%138 0 上标 0 %%139 1 上标 1 %%140 2 上标 2 %%141 3 上标 3 %%148 9 上标 9 %%149~157 1~9 字体偏小 %%158~162 空号 %%163 △ %%164 ▽ %%165~200 空号 %%c φ 直径符号 %%d ° 度 %%p ± 正负号 %%u _ 下划线 %%o ─ 上划线 [www.BimCad.org]深居浅出 AutoCAD 二次开发 439 附录五:AutoCAD 颜色值表 十六进制 AutoCAD 颜色值 十进制 Red Green Blue Red Green Blue 0 0 0 0 0 0 0 FF 0 0 1 255 0 0 FF FF 0 2 255 255 0 0 FF 0 3 0 255 0 0 FF FF 4 0 255 255 0 0 FF 5 0 0 255 FF 0 FF 6 255 0 255 FF FF FF 7 255 255 255 41 41 41 8 65 65 65 80 80 80 9 128 128 128 FF 0 0 10 255 0 0 FF AA AA 11 255 170 170 BD 0 0 12 189 0 0 BD 7E 7E 13 189 126 126 81 0 0 14 129 0 0 81 56 56 15 129 86 86 68 0 0 16 104 0 0 68 45 45 17 104 69 69 4F 0 0 18 79 0 0 4F 35 35 19 79 53 53 FF 3F 0 20 255 63 0 FF BF AA 21 255 191 170 BD 2E 0 22 189 46 0 BD 8D 7E 23 189 141 126 81 1F 0 24 129 31 0 81 60 56 25 129 96 86 68 19 0 26 104 25 0 68 4E 45 27 104 78 69 4F 13 0 28 79 19 0 4F 3B 35 29 79 59 53 FF 7F 0 30 255 127 0 FF D4 AA 31 255 212 170 BD 5E 0 32 189 94 0 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 440 BD 9D 7E 33 189 157 126 81 40 0 34 129 64 0 81 6B 56 35 129 107 86 68 34 0 36 104 52 0 68 56 45 37 104 86 69 4F 27 0 38 79 39 0 4F 42 35 39 79 66 53 FF BF 0 40 255 191 0 FF EA AA 41 255 234 170 BD 8D 0 42 189 141 0 BD AD 7E 43 189 173 126 81 60 0 44 129 96 0 81 76 56 45 129 118 86 68 4E 0 46 104 78 0 68 5F 45 47 104 95 69 4F 3B 0 48 79 59 0 4F 49 35 49 79 73 53 FF FF 0 50 255 255 0 FF FF AA 51 255 255 170 BD BD 0 52 189 189 0 BD BD 7E 53 189 189 126 81 81 0 54 129 129 0 81 81 56 55 129 129 86 68 68 0 56 104 104 0 68 68 45 57 104 104 69 4F 4F 0 58 79 79 0 4F 4F 35 59 79 79 53 BF FF 0 60 191 255 0 EA FF AA 61 234 255 170 8D BD 0 62 141 189 0 AD BD 7E 63 173 189 126 60 81 0 64 96 129 0 76 81 56 65 118 129 86 4E 68 0 66 78 104 0 5F 68 45 67 95 104 69 3B 4F 0 68 59 79 0 49 4F 35 69 73 79 53 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 441 7F FF 0 70 127 255 0 D4 FF AA 71 212 255 170 5E BD 0 72 94 189 0 9D BD 7E 73 157 189 126 40 81 0 74 64 129 0 6B 81 56 75 107 129 86 34 68 0 76 52 104 0 56 68 45 77 86 104 69 27 4F 0 78 39 79 0 42 4F 35 79 66 79 53 3F FF 0 80 63 255 0 BF FF AA 81 191 255 170 2E BD 0 82 46 189 0 8D BD 7E 83 141 189 126 1F 81 0 84 31 129 0 60 81 56 85 96 129 86 19 68 0 86 25 104 0 4E 68 45 87 78 104 69 13 4F 0 88 19 79 0 3B 4F 35 89 59 79 53 0 FF 0 90 0 255 0 AA FF AA 91 170 255 170 0 BD 0 92 0 189 0 7E BD 7E 93 126 189 126 0 81 0 94 0 129 0 56 81 56 95 86 129 86 0 68 0 96 0 104 0 45 68 45 97 69 104 69 0 4F 0 98 0 79 0 35 4F 35 99 53 79 53 0 FF 3F 100 0 255 63 AA FF BF 101 170 255 191 0 BD 2E 102 0 189 46 7E BD 8D 103 126 189 141 0 81 1F 104 0 129 31 56 81 60 105 86 129 96 0 68 19 106 0 104 25 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 442 45 68 4E 107 69 104 78 0 4F 13 108 0 79 19 35 4F 3B 109 53 79 59 0 FF 7F 110 0 255 127 AA FF D4 111 170 255 212 0 BD 5E 112 0 189 94 7E BD 9D 113 126 189 157 0 81 40 114 0 129 64 56 81 6B 115 86 129 107 0 68 34 116 0 104 52 45 68 56 117 69 104 86 0 4F 27 118 0 79 39 35 4F 42 119 53 79 66 0 FF BF 120 0 255 191 AA FF EA 121 170 255 234 0 BD 8D 122 0 189 141 7E BD AD 123 126 189 173 0 81 60 124 0 129 96 56 81 76 125 86 129 118 0 68 4E 126 0 104 78 45 68 5F 127 69 104 95 0 4F 3B 128 0 79 59 35 4F 49 129 53 79 73 0 FF FF 130 0 255 255 AA FF FF 131 170 255 255 0 BD BD 132 0 189 189 7E BD BD 133 126 189 189 0 81 81 134 0 129 129 56 81 81 135 86 129 129 0 68 68 136 0 104 104 45 68 68 137 69 104 104 0 4F 4F 138 0 79 79 35 4F 4F 139 53 79 79 0 BF FF 140 0 191 255 AA EA FF 141 170 234 255 0 8D BD 142 0 141 189 7E AD BD 143 126 173 189 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 443 0 60 81 144 0 96 129 56 76 81 145 86 118 129 0 4E 68 146 0 78 104 45 5F 68 147 69 95 104 0 3B 4F 148 0 59 79 35 49 4F 149 53 73 79 0 7F FF 150 0 127 255 AA D4 FF 151 170 212 255 0 5E BD 152 0 94 189 7E 9D BD 153 126 157 189 0 40 81 154 0 64 129 56 6B 81 155 86 107 129 0 34 68 156 0 52 104 45 56 68 157 69 86 104 0 27 4F 158 0 39 79 35 42 4F 159 53 66 79 0 3F FF 160 0 63 255 AA BF FF 161 170 191 255 0 2E BD 162 0 46 189 7E 8D BD 163 126 141 189 0 1F 81 164 0 31 129 56 60 81 165 86 96 129 0 19 68 166 0 25 104 45 4E 68 167 69 78 104 0 13 4F 168 0 19 79 35 3B 4F 169 53 59 79 0 0 FF 170 0 0 255 AA AA FF 171 170 170 255 0 0 BD 172 0 0 189 7E 7E BD 173 126 126 189 0 0 81 174 0 0 129 56 56 81 175 86 86 129 0 0 68 176 0 0 104 45 45 68 177 69 69 104 0 0 4F 178 0 0 79 35 35 4F 179 53 53 79 3F 0 FF 180 63 0 255 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 444 BF AA FF 181 191 170 255 2E 0 BD 182 46 0 189 8D 7E BD 183 141 126 189 1F 0 81 184 31 0 129 60 56 81 185 96 86 129 19 0 68 186 25 0 104 4E 45 68 187 78 69 104 13 0 4F 188 19 0 79 3B 35 4F 189 59 53 79 7F 0 FF 190 127 0 255 D4 AA FF 191 212 170 255 5E 0 BD 192 94 0 189 9D 7E BD 193 157 126 189 40 0 81 194 64 0 129 6B 56 81 195 107 86 129 34 0 68 196 52 0 104 56 45 68 197 86 69 104 27 0 4F 198 39 0 79 42 35 4F 199 66 53 79 BF 0 FF 200 191 0 255 EA AA FF 201 234 170 255 8D 0 BD 202 141 0 189 AD 7E BD 203 173 126 189 60 0 81 204 96 0 129 76 56 81 205 118 86 129 4E 0 68 206 78 0 104 5F 45 68 207 95 69 104 3B 0 4F 208 59 0 79 49 35 4F 209 73 53 79 FF 0 FF 210 255 0 255 FF AA FF 211 255 170 255 BD 0 BD 212 189 0 189 BD 7E BD 213 189 126 189 81 0 81 214 129 0 129 81 56 81 215 129 86 129 68 0 68 216 104 0 104 68 45 68 217 104 69 104 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 445 4F 0 4F 218 79 0 79 4F 35 4F 219 79 53 79 FF 0 BF 220 255 0 191 FF AA EA 221 255 170 234 BD 0 8D 222 189 0 141 BD 7E AD 223 189 126 173 81 0 60 224 129 0 96 81 56 76 225 129 86 118 68 0 4E 226 104 0 78 68 45 5F 227 104 69 95 4F 0 3B 228 79 0 59 4F 35 49 229 79 53 73 FF 0 7F 230 255 0 127 FF AA D4 231 255 170 212 BD 0 5E 232 189 0 94 BD 7E 9D 233 189 126 157 81 0 40 234 129 0 64 81 56 6B 235 129 86 107 68 0 34 236 104 0 52 68 45 56 237 104 69 86 4F 0 27 238 79 0 39 4F 35 42 239 79 53 66 FF 0 3F 240 255 0 63 FF AA BF 241 255 170 191 BD 0 2E 242 189 0 46 BD 7E 8D 243 189 126 141 81 0 1F 244 129 0 31 81 56 60 245 129 86 96 68 0 19 246 104 0 25 68 45 4E 247 104 69 78 4F 0 13 248 79 0 19 4F 35 3B 249 79 53 59 33 33 33 250 51 51 51 50 50 50 251 80 80 80 69 69 69 252 105 105 105 82 82 82 253 130 130 130 BE BE BE 254 190 190 190 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 446 FF FF FF 255 255 255 255 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 447 附录六:常用 ARX 函数 ADS 原函数 ARX 后函数 函数功能 ads_agetcfg acedGetCfg ads_agetenv acedGetEnv ads_alert acedAlert 显示一个对话框,对话框中有用户指定的信息 ads_angle acutAngle 求出直线与当前 X 轴的夹角 ads_angtof acdbAngToF 将一个显示为角度值的字符串转化为实数(浮点数) ads_angtos acdbAngToS 把角度值转换为字符串 ads_arxload acedArxLoad 将 ARX 应用程序装载入 CAD 中,供使用 ads_arxloaded acedArxLoaded 以链表的方式返回当前装入的 ARX 应用程序 ads_arxunload acedArxUnload 将一个 ARX 应用程序从 CAD 从卸载出去 ads_asetcfg acedSetCfg ads_asetenv acedSetEnv ads_buildlist acutBuildList 创建结果缓冲区链表 ads_cmd acedCmd 借助一个结果缓冲区链表来执行 CAD 命令(有使用条件) ads_command acedCommand 执行 CAD 命令(有使用条件) ads_cvunit acutCvUnit 在各种单位制内进行转换 ads_defun acedDefun 定义一个外部函数 ads_dictadd acdbDictAdd 向指定字典中添加一个非图形对象 ads_dictnext acdbDictNext 使程序指针指向字典中的下一个实体,并返回这个指向它的指针 ads_dictremove acdbDictRemove 从指定字典中移走一个实体 ads_dictrename acdbDictRename 重命名一个字典条目 ads_dictsearch acdbDictSearch 对一个给定实体条目,寻找一个字典 ads_distance acutDistance 求出两点之间的距离 ads_distof acdbDisToF 将一个显示为实数的字符串转化为实数(浮点数) ads_draggen acedDragGen 提示用户动态拖动一个选择集 ads_entdel acdbEntDel 删除(或者取消删除)图形中的实体 ads_entget acdbEntGet 获得一个实体的定义数据 ads_entgetx acdbEntGetX 获得实体数据,包括应用程序注册的扩展数据 ads_entlast acdbEntLast 查找图形中最后一个实体 ads_entmake acdbEntMake 形成一个新的实体,并把这个实体的定义数据添加到数据库中去 ads_entmakex acdbEntMakeX 同 acedEntMake()一样,但返回新的实体名称 ads_entmod acdbEntMod 修改一个实体的定义数据 ads_entnext acdbEntNext 查找图形中的下一个实体 ads_entsel acedEntSel 提示用户以指定一点的方式来选择一个实体 ads_entupd acdbEntUpd 更新实体的屏幕显示 ads_fail acdbFail 简单的打印错误信息并把控制权返回给调用者 ads_findfile acedFindFile 寻找一个指定的文件 ads_fnsplit acedFNSplit ads_getangle acedGetAngle 提示用户输入一个角度,要考虑 ANGBASE 系统变量的当前值 ads_getappname acedGetAppName 获得当前 ARX 应用程序的文件名称 ads_getargs acedGetArgs 获得在调用外部函数时的命令行参数 ads_getcfg acedGetCfg ads_getcname acedGetCName 获取一个命令的本地名或与语言无关的名称 ads_getcorner acedGetCorner 提示用户输入一个矩形的顶点 ads_getdist acedGetDist 提示用户输入一个距离 ads_getenv acedGetEnv [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 448 ads_getfiled acedGetFileD 用标准的 CAD 对话框提示用户输入要查找的文件名 ads_getfuncode acedGetFunCode 获得外部函数的码值 ads_getinput acedGetInput 提取传送给用户输入函数 acedGetXxx()的关键字(可以是任意字符) ads_getint acedGetInt 提示用户输入一个整数 ads_getkword acedGetKword 提示用户输入一个关键字 ads_getorient acedGetOrient 类似于 acedGetAngle(),但零度方向总是向右 ads_getpoint acedGetPoint 提示用户输入一个点 ads_getreal acedGetReal 提示用户输入一个浮点数 ads_getstring acedGetString 提示用户输入一个字符串 ads_getstringb acedGetStringB ads_getsym acedGetSym 获取一个 LISP 符号的值(有使用条件) ads_getvar acedGetVar 获取一个系统变量的当前值 ads_graphscr acedGraphScr 显示当前图形屏幕 ads_grdraw acedGrDraw 在当前端口画一矢量 ads_grread acedGrRead 读取输入设备 ads_grtext acedGrText 在屏幕的菜单区\模式区或状态区显示文本 ads_grvecs acedGrVecs 在当前图形屏幕上画多个矢量 ads_handent acdbHandEnt 通过实体的句柄查找实体 ads_help acedHelp 调用帮助功能 ads_initget acedInitGet 次定用户响应下一次调用输入函数 acedGetXxx()时那些值是有效的 ads_inters acdbInters 求出两直线的交点 ads_invoke acedInvoke 在 ARX 应用程序中调用外部函数 ads_isalnum acutIsAlNum 验证是否是字母或数字 ads_isalpha acutIsAlpha 验证是否是字母 ads_iscntrl acutIsCntrl 验证是否是一个控制字符 ads_isdigit acutIsDigit 验证是否是数字 ads_isgraph acutIsGraph 验证是否是一个图形字符 ads_islower acutIsLower 验证是否是小写字母 ads_isprint acutIsPrint 验证是否是一个可打印字符 ads_ispunct acutIsPunct 验证是否是一个标点符号 ads_isspace acutIsSpace 验证是否是一个空白字符 ads_isupper acutIsUpper 验证是否是大字字母 ads_isxdigit acutIsXDigit 验证是否是一个十六进制数字 ads_menucmd acedMenuCmd 显示并激活菜单 ads_name_clear acdbNameClear 可将 ads_name 型的数据赋值为空 ads_name_equal acdbNameEqual 可比较两个 ads_name 型的数据是否相同 ads_name_nil acdbNameNil 可以检测这个实体名或选择集名为空 ads_name_set acdbNameSet 可以复制一个实体名或选择集名 ads_namedobjdict acdbNamedObjDict 返回图形字典的实体名 ads_nentsel acedNEntSel 类似 acedNEntSelp(),但使用 4*3(而非 4*4)作为变换矩阵,不能指定点 ads_nentselp acedNEntSelP 类似于 acedEntSel(),但对于嵌套实体返回附加数据,并使程序能指定选择点 ads_newrb acutNewRb 创建一个新的结果缓冲区 ads_osnap acedOsnap 借助指定对象的捕捉方式来捕捉一个点 ads_point_set acdbPointSet 可以将一个点复制给另一个点 ads_polar acutPolar 通过极坐标求一点 ads_printf acutPrintf 在文本屏幕上输出一条信息 ads_prompt acedPrompt 在提示行中显示一条信息 ads_putsym acedPutSym 设置 LISP 符号的值(有使用条件) [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 449 ads_redraw acedRedraw 将当前图形屏幕做重画操作 ads_regapp acdbRegApp 注册应用程序的扩展实体数据 ads_regfunc acedRegFunc 注册一个可以直接调用的外部函数 ads_relrb acutRelRb 释放分配给一个结果缓冲区或一个结果缓冲区链表的内存 ads_retint acedRetInt 返回一个整数 ads_retlist acedRetList 返回一个表 ads_retname acedRetName 返回一个实体的名称或选择集的名称 ads_retnil acedRetNil 返回一个 Nil 值 ads_retpoint acedRetPoint 返回一个点 ads_retreal acedRetReal 返回一个浮点数 ads_retstr acedRetStr 返回一个字符串 ads_rett acedRetT 返回逻辑真 ads_retval acedRetVal 返回一个包含在结果缓冲区的值 ads_retvoid acedRetVoid 返回一个不显示的空值(void) ads_rtos acdbRToS 将一个实数(浮点数)转化为字符串 ads_setcfg acedSetCfg 添加应用程序数据到系统 acad.cfg 文件的应用程序数据部分(?) ads_setenv acedSetEnv ads_setfunhelp acedSetFunHelp 为一个通过命令行“C:外部函数名”方式启动的命令注册帮助信息. ads_setvar acedSetVar 设置 CAD 系统变量的值(有使用条件) ads_setview acedSetView 为指定端口建立一个 3D 视图 ads_snvalid acdbSNValid 检查一个符号表名称的合法性 ads_ssadd acedSSAdd 向选择集里添加新的实体(或创建新的选择集) ads_ssdel acedSSDel 从选择集里删除一个实体 ads_ssfree acedSSFree 释放一个选择集 ads_ssget acedSSGet 获得(生成)一个选择集 ads_ssgetfirst acedSSGetFirst 决定那个对象被选中或夹持(grip) ads_sslength acedSSLength 返回一个选择集中的实体的数量 ads_ssmemb acedSSMemb 检测一个实体是否是选择集里中的一个实体(属于选择集) ads_ssname acedSSName 返回选择集里一个实体的实体名 ads_ssnamex acedSSNameX 描述选择集中的对象是如何选中的 ads_sssetfirst acedSSSetFirst 选择或夹持对象 ads_tablet acedTablet 控制数据化仪的标定(?) ads_tblnext acdbTblNext 扫描指定的符号表,并返回这个表的下一个条目 ads_tblobjname acdbTblObjName 返一个可传送给 acedEntGet()或 acedEntMod()的实体标识符,以定位实际实体 ads_tblsearch acdbTblSearch 扫描指定的符号表,并以结果缓冲区链表方式返回查找到的指定符号 ads_textbox acedTextBox 找出包含文本实的矩形框的对角坐标 ads_textpage acedTextPage 显示当前文本屏幕,在显示前先清屏 ads_textscr acedTextScr 显示当前文本屏幕 ads_tolower acutToLower 将字符转为小写 ads_toupper acutToUpper 将字符转为大写 ads_trans acedTrans 将一个点或一个位移从一个坐标系转换到另一个坐标系 ads_undef acedUndef 取消一个外部函数的定义 ads_update acedUpdate ads_usrbrk acedUsrBrk 检查用户有没有按下 ESC 键 ads_vports acedVports 为当前端口配置,返回一个端口描述器表 ads_wcmatch acutWcMatch 测试一字符串是否与一通配符模式相匹配 ads_xdroom acdbXdRoom 返回一个实体还能容纳的扩展数据的内存空间,一个实体最多只能容纳 16K ads_xdsize acdbXdSize 返回扩展数据链表将占用的内存空间(字节) [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 450 ads_xformss acedXformSS 将一个指定矩阵应用到指定的选择集上 ads_xstrcase acdbXStrCase ads_xstrsave acdbXStrSave ads_ssGetKwordCallbackPtr acedSSGetKwordCallbackPtr 获得并保存指向回调函数的指针 ads_ssGetOtherCallbackPtr acedSSGetOtherCallbackPtr ads_ssSetKwordCallbackPtr acedSSSetKwordCallbackPtr 提供指向一个关键字回调函数的指针 ads_ssSetOtherCallbackPtr acedSSSetOtherCallbackPtr 提供指向一”其它”的当前回调函数的指针 ARX 里定义的数据类型: ads_real ads_point ads_name ads_binary typedef double ads_real typedef ads_real ads_point[3] typedef long ads_name[2] struct ads_binary{ short clen;//块的长度,单位为字节 char *buf;// 字符指针,表二元数据 }; (下面这些宏全包含在头文件 string.h 中) ads_point_set()宏,可以将一个点复制给另一个点 ads_name_set()宏,可以复制一个实体名或选择集名 ads_name_equal()宏,可比较两个 ads_name 型的数据是否相同 ads_name_clear()宏,可将 ads_name 型的数据赋值为空 ads_name_nil()宏,可以检测这个实体名或选择集名为空 用于处理二元扩展数据(xdata),这些数据可组成不同长度的集合块 (chunks). 结果类型码: RTNONE RTREAL RTPOINT RTSHORT RTANG RTSTR RTENAME REPICKS PTORINT 无结果值 实数值 2D 点(X 和 Y; Z=0.0) 短整数(16 位) 角度 字符串 实体名 选择集名 方位 RT3DPOINT RTLONG RTVOID RTLB RTLE RTDOTE RTT RTNIL RTDXF0 3D 点(X,Y 和 Z) 长整数(32 位) 空符号 序列起始(用于嵌套序列) 序列结束(用于嵌套序列) 点(用于点对) LISP 中的 T(代表真) LISP 中的 nil(代表空) 用于 DFX 的组码 0(只与 acutBuildList()一起 函数返回结果类型代码: RTNORM RTERROR RTCAN RTREJ RTFAIL RTKWORD 用户输入一个有效值,表示函数调用成功 表示函数调调用失败 用户取消了当前函数的运行过程,即按下了 ESC 键 AutoCAD 拒绝一无效的要求 AutoLISP 连接失败 用户输入一个关键字或任意文本 (并不是全部 ARX 函数都如此,有特殊的函数返回值不同(会有 RTNONE 或 RTSTR 返回值) 其它代码: #define TURE 1 #define FALSE 0 #define EOS ‘\0’ #define PAUSE “\\” 表示为真 表示为假 表示字符中止的符号 在命令参数中表示暂停 #define GOOD 1 #define BAD 0 表示真 表示假 用户输入控制位代码:由函数 acedInitGet()先发控制 RSG_NONULL RSG_NOZERO RSG_NONEG 不允许空输入 不允许零值 不允许负值 RSG_NOLIM RSG_DASH RSG_2D 不检测绘图界限,即使 LIMCHECK 为 0 当绘图带拖动功能的线或方框时,使用虚线 忽略 3D 点的 Z 坐标(只适用于 acedGetDist()函数) [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 451 RSG_OTHER 允许任意输入 [www.BimCad.org]深居浅出 AutoCAD 二次开发 452 附录七:ARX 类与托管类对应关系 ObjectARX 类前缀和.NET 命名空间 非托管类前缀 托管命名空间 AcDb Autodesk.AutoCAD.DatabaseServices AcRx Autodesk.AutoCAD.Runtime AcEd Autodesk.AutoCAD.ApplicationServices AcUt Autodesk.AutoCAD.DatabaseServices, Autodesk.AutoCAD.ApplicationServices AcCm Autodesk.AutoCAD.Colors AcGe Autodesk.AutoCAD.Geometry AcGi Autodesk.AutoCAD.GraphicsInterface AcLy Autodesk.AutoCAD.LayerManager AcPl Autodesk.AutoCAD.PlottingServices ObjectARX Classes to Managed Wrapper Classes ObjectARX Class Managed Wrapper Class AcApDocManager Autodesk.AutoCAD.ApplicationServices.DocumentCollection AcApDocument Autodesk.AutoCAD.ApplicationServices.Document AcApStatusBar Autodesk.AutoCAD.Windows.StatusBar AcArray > Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferencePropertyCollec tion AcArray Autodesk.AutoCAD.LayerManager.LayerCollection AcArray Autodesk.AutoCAD.LayerManager.LayerFilterCollection AcArray > Autodesk.AutoCAD.PlottingServices.PlotConfigInfoCollection AccessRight Autodesk.AutoCAD.Windows.ToolPalette.AccessRight AcCmColor Autodesk.AutoCAD.Colors.Color AcCmEntityColor Autodesk.AutoCAD.Colors.EntityColor AcCmEntityColor::ColorMethod Autodesk.AutoCAD.Colors.ColorMethod AcCmTransparency Autodesk.AutoCAD.Colors.Transparency AcCmTransparency::transparencyMethod Autodesk.AutoCAD.Colors.TransparencyMethod AcDb::CellEdgeMasks Autodesk.AutoCAD.DatabaseServices.CellEdgeMasks AcDb::DeepCloneType Autodesk.AutoCAD.DatabaseServices.DeepCloneType AcDb::DimArrowFlags Autodesk.AutoCAD.DatabaseServices.DimArrowFlag AcDb::DragStatus Autodesk.AutoCAD.DatabaseServices.DragStatus AcDb::DxfCode Autodesk.AutoCAD.DatabaseServices.DxfCode AcDb::EndCaps Autodesk.AutoCAD.DatabaseServices.EndCap AcDb::GripStatus Autodesk.AutoCAD.DatabaseServices.GripStatus AcDb::Intersect Autodesk.AutoCAD.DatabaseServices.Intersect AcDb::JoinStyle Autodesk.AutoCAD.DatabaseServices.JoinStyle AcDb::LoadReasons Autodesk.AutoCAD.DatabaseServices.ApplicationLoadReasons [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 453 AcDb::MeasurementValue Autodesk.AutoCAD.DatabaseServices.MeasurementValue AcDb::OsnapMode Autodesk.AutoCAD.DatabaseServices.ObjectSnapModes AcDb::Planarity Autodesk.AutoCAD.DatabaseServices.Planarity AcDb::PlotStyleNameType Autodesk.AutoCAD.DatabaseServices.PlotStyleNameType AcDb::Poly2dType Autodesk.AutoCAD.DatabaseServices.Poly2dType AcDb::Poly3dType Autodesk.AutoCAD.DatabaseServices.Poly3dType AcDb::PolyMeshType Autodesk.AutoCAD.DatabaseServices.PolyMeshType AcDb::RotationAngle Autodesk.AutoCAD.DatabaseServices.RotationAngle AcDb::SaveType Autodesk.AutoCAD.DatabaseServices.SaveType AcDb::SelectType Autodesk.AutoCAD.DatabaseServices.SelectType AcDb::TableStyleFlags Autodesk.AutoCAD.DatabaseServices.TableStyleFlags AcDb::TextHorzMode Autodesk.AutoCAD.DatabaseServices.TextHorizontalMode AcDb::TextVertMode Autodesk.AutoCAD.DatabaseServices.TextVerticalMode AcDb::UnitsValue Autodesk.AutoCAD.DatabaseServices.UnitsValue AcDb::Vertex2dType Autodesk.AutoCAD.DatabaseServices.Vertex2dType AcDb2dPolyline Autodesk.AutoCAD.DatabaseServices.Polyline2d AcDb2dVertex Autodesk.AutoCAD.DatabaseServices.Vertex2d AcDb2LineAngularDimension Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2 AcDb3dPolyline Autodesk.AutoCAD.DatabaseServices.Polyline3d AcDb3dPolylineVertex Autodesk.AutoCAD.DatabaseServices.PolylineVertex3d AcDb3dSolid Autodesk.AutoCAD.DatabaseServices.Solid3d AcDb3PointAngularDimension Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension AcDbAbstractViewTable Autodesk.AutoCAD.DatabaseServices.AbstractViewTable AcDbAbstractViewTableRecord Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord AcDbAbstractViewTableRecord::renderMode Autodesk.AutoCAD.DatabaseServices.ViewTableRecordRenderMode AcDbAlignedDimension Autodesk.AutoCAD.DatabaseServices.AlignedDimension AcDbArc Autodesk.AutoCAD.DatabaseServices.Arc AcDbArcDimension Autodesk.AutoCAD.DatabaseServices.ArcDimension AcDbAttribute Autodesk.AutoCAD.DatabaseServices.AttributeReference AcDbAttributeDefinition Autodesk.AutoCAD.DatabaseServices.AttributeDefinition AcDbAuditInfo Autodesk.AutoCAD.DatabaseServices.AuditInfo AcDbAuditInfo::AuditPass Autodesk.AutoCAD.DatabaseServices.AuditPass AcDbBlockBegin Autodesk.AutoCAD.DatabaseServices.BlockBegin AcDbBlockEnd Autodesk.AutoCAD.DatabaseServices.BlockEnd AcDbBlockReference Autodesk.AutoCAD.DatabaseServices.BlockReference AcDbBlockTable Autodesk.AutoCAD.DatabaseServices.BlockTable AcDbBlockTableRecord Autodesk.AutoCAD.DatabaseServices.BlockTableRecord AcDbBlockTableRecord::BlockScaling Autodesk.AutoCAD.DatabaseServices.BlockScaling AcDbBody Autodesk.AutoCAD.DatabaseServices.Body AcDbCircle Autodesk.AutoCAD.DatabaseServices.Circle AcDbCompositeFilteredBlockIterator Autodesk.AutoCAD.DatabaseServices.Filters.CompositeFilteredBlockIterator AcDbCurve Autodesk.AutoCAD.DatabaseServices.Curve AcDbDatabase Autodesk.AutoCAD.DatabaseServices.Database AcDbDatabaseSummaryInfo Autodesk.AutoCAD.DatabaseServices.DatabaseSummaryInfo [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 454 AcDbDataCell Autodesk.AutoCAD.DatabaseServices.DataCell AcDbDataCellArray Autodesk.AutoCAD.DatabaseServices.DataCellCollection AcDbDataColumn Autodesk.AutoCAD.DatabaseServices.DataColumn AcDbDataTable Autodesk.AutoCAD.DatabaseServices.DataTable AcDbDiametricDimension Autodesk.AutoCAD.DatabaseServices.DiametricDimension AcDbDictionary Autodesk.AutoCAD.DatabaseServices.DBDictionary AcDbDictionaryWithDefault Autodesk.AutoCAD.DatabaseServices.DictionaryWithDefaultDictionary AcDbDimData Autodesk.AutoCAD.DatabaseServices.DynamicDimensionData AcDbDimension Autodesk.AutoCAD.DatabaseServices.Dimension AcDbDimStyleTable Autodesk.AutoCAD.DatabaseServices.DimStyleTable AcDbDimStyleTableRecord Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord AcDbDwgFiler Autodesk.AutoCAD.DatabaseServices.DwgFiler AcDbDxfFiler Autodesk.AutoCAD.DatabaseServices.DxfFiler AcDbDynBlockReferenceProperty::UnitsType Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferencePropertyUnits Type AcDbEllipse Autodesk.AutoCAD.DatabaseServices.Ellipse AcDbEntity Autodesk.AutoCAD.DatabaseServices.Entity AcDbExtents Autodesk.AutoCAD.DatabaseServices.Extents3d AcDbFace Autodesk.AutoCAD.DatabaseServices.Face AcDbFaceRecord Autodesk.AutoCAD.DatabaseServices.FaceRecord AcDbFcf Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame AcDbFilter Autodesk.AutoCAD.DatabaseServices.Filters.Filter AcDbFilteredBlockIterator Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator AcDbFullSubentPath Autodesk.AutoCAD.DatabaseServices.FullSubentityPath AcDbGraph Autodesk.AutoCAD.DatabaseServices.Graph AcDbGraphNode Autodesk.AutoCAD.DatabaseServices.GraphNode AcDbGroup Autodesk.AutoCAD.DatabaseServices.Group AcDbHandle Autodesk.AutoCAD.DatabaseServices.Handle AcDbHatch Autodesk.AutoCAD.DatabaseServices.Hatch AcDbHatch::AcDbHatch::HatchStyle Autodesk.AutoCAD.DatabaseServices.HatchStyle AcDbHatch::GradientPatternType Autodesk.AutoCAD.DatabaseServices.GradientPatternType AcDbHatch::HatchEdgeType Autodesk.AutoCAD.DatabaseServices.HatchEdgeType AcDbHatch::HatchLoopType Autodesk.AutoCAD.DatabaseServices.HatchLoopTypes AcDbHatch::HatchObjectType Autodesk.AutoCAD.DatabaseServices.HatchObjectType AcDbHostApplicationServices Autodesk.AutoCAD.DatabaseServices.HostApplicationServices AcDbHostApplicationServices::FindFileHint Autodesk.AutoCAD.DatabaseServices.FindFileHint AcDbHostApplicationServices::ModelerFlavor Autodesk.AutoCAD.DatabaseServices.ModelerFlavor AcDbHyperlink Autodesk.AutoCAD.DatabaseServices.HyperLink AcDbHyperlinkCollection Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection AcDbIdMapping Autodesk.AutoCAD.DatabaseServices.IdMapping AcDbIdPair Autodesk.AutoCAD.DatabaseServices.IdPair AcDbImage Autodesk.AutoCAD.DatabaseServices.Image AcDbIndex Autodesk.AutoCAD.DatabaseServices.Filters.Index AcDbIndexUpdateData Autodesk.AutoCAD.DatabaseServices.Filters.IndexUpdateData [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 455 AcDbLayerFilter Autodesk.AutoCAD.DatabaseServices.Filters.LayerFilter AcDbLayerIndex Autodesk.AutoCAD.DatabaseServices.Filters.LayerIndex AcDbLayerStateManager Autodesk.AutoCAD.DatabaseServices.LayerStateManager AcDbLayerStateManager::LayerStateMask Autodesk.AutoCAD.DatabaseServices.LayerStateMasks AcDbLayerTable Autodesk.AutoCAD.DatabaseServices.LayerTable AcDbLayerTableRecord Autodesk.AutoCAD.DatabaseServices.LayerTableRecord AcDbLayout Autodesk.AutoCAD.DatabaseServices.Layout AcDbLayoutManager Autodesk.AutoCAD.DatabaseServices.LayoutManager AcDbLeader Autodesk.AutoCAD.DatabaseServices.Leader AcDbLeader::AnnoType Autodesk.AutoCAD.DatabaseServices.AnnotationType AcDbLine Autodesk.AutoCAD.DatabaseServices.Line AcDbLinetypeTable Autodesk.AutoCAD.DatabaseServices.LinetypeTable AcDbLinetypeTableRecord Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord AcDbMatchProperties Autodesk.AutoCAD.DatabaseServices.MatchProperties AcDbMaterial Autodesk.AutoCAD.DatabaseServices.Material AcDbMInsertBlock Autodesk.AutoCAD.DatabaseServices.MInsertBlock AcDbMline Autodesk.AutoCAD.DatabaseServices.Mline AcDbMlineStyle Autodesk.AutoCAD.DatabaseServices.MlineStyle AcDbMPolygon Autodesk.AutoCAD.DatabaseServices.MPolygon AcDbMPolygon::loopDir Autodesk.AutoCAD.DatabaseServices.LoopDirection AcDbMPolygonCrossing Autodesk.AutoCAD.DatabaseServices.MPolygonCrossing AcDbMPolygonCrossingArray Autodesk.AutoCAD.DatabaseServices.MPolygonCrossingCollection AcDbMPolygonNode Autodesk.AutoCAD.DatabaseServices.MPolygonNode AcDbMText Autodesk.AutoCAD.DatabaseServices.MText AcDbMTextFragment Autodesk.AutoCAD.DatabaseServices.MTextFragment AcDbObject Autodesk.AutoCAD.DatabaseServices.DBObject AcDbObjectId Autodesk.AutoCAD.DatabaseServices.ObjectId AcDbObjectIdArray Autodesk.AutoCAD.DatabaseServices.ObjectIdCollection AcDbObjectIdGraph Autodesk.AutoCAD.DatabaseServices.ObjectIdGraph AcDbOle2Frame Autodesk.AutoCAD.DatabaseServices.Ole2Frame AcDbOrdinateDimension Autodesk.AutoCAD.DatabaseServices.OrdinateDimension AcDbPlaceHolder Autodesk.AutoCAD.DatabaseServices.PlaceHolder AcDbPlotSettings Autodesk.AutoCAD.DatabaseServices.PlotSettings AcDbPlotSettings::ShadePlotResLevel Autodesk.AutoCAD.DatabaseServices.ShadePlotResLevel AcDbPlotSettings::ShadePlotType Autodesk.AutoCAD.DatabaseServices.PlotSettingsShadePlotType AcDbPlotSettings::stdScaleType Autodesk.AutoCAD.DatabaseServices.StandardScaleType AcDbPlotSettingsValidator Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator AcDbPoint Autodesk.AutoCAD.DatabaseServices.DBPoint AcDbPolyFaceMesh Autodesk.AutoCAD.DatabaseServices.PolyFaceMesh AcDbPolyFaceMeshVertex Autodesk.AutoCAD.DatabaseServices.PolyFaceMeshVertex AcDbPolygonMesh Autodesk.AutoCAD.DatabaseServices.PolygonMesh AcDbPolygonMeshVertex Autodesk.AutoCAD.DatabaseServices.PolygonMeshVertex AcDbPolyline Autodesk.AutoCAD.DatabaseServices.Polyline AcDbPolyline::SegType Autodesk.AutoCAD.DatabaseServices.SegmentType [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 456 AcDbProxyEntity Autodesk.AutoCAD.DatabaseServices.ProxyEntity AcDbProxyEntity::GraphicsMetafileType Autodesk.AutoCAD.DatabaseServices.GraphicsMetafileType AcDbProxyObject Autodesk.AutoCAD.DatabaseServices.ProxyObject AcDbRadialDimension Autodesk.AutoCAD.DatabaseServices.RadialDimension AcDbRadialDimensionLarge Autodesk.AutoCAD.DatabaseServices.RadialDimensionLarge AcDbRasterImage Autodesk.AutoCAD.DatabaseServices.RasterImage AcDbRasterImage::ClipBoundaryType Autodesk.AutoCAD.DatabaseServices.ClipBoundaryType AcDbRasterImage::ImageDisplayOpt Autodesk.AutoCAD.DatabaseServices.ImageDisplayOptions AcDbRasterImageDef Autodesk.AutoCAD.DatabaseServices.RasterImageDef AcDbRasterImageDef::Units Autodesk.AutoCAD.DatabaseServices.Unit AcDbRasterVariables Autodesk.AutoCAD.DatabaseServices.RasterVariables AcDbRasterVariables::FrameSettings Autodesk.AutoCAD.DatabaseServices.FrameSetting AcDbRasterVariables::ImageQuality Autodesk.AutoCAD.DatabaseServices.ImageQuality AcDbRay Autodesk.AutoCAD.DatabaseServices.Ray AcDbRegAppTable Autodesk.AutoCAD.DatabaseServices.RegAppTable AcDbRegAppTableRecord Autodesk.AutoCAD.DatabaseServices.RegAppTableRecord AcDbRegion Autodesk.AutoCAD.DatabaseServices.Region AcDbRotatedDimension Autodesk.AutoCAD.DatabaseServices.RotatedDimension AcDbSequenceEnd Autodesk.AutoCAD.DatabaseServices.SequenceEnd AcDbShape Autodesk.AutoCAD.DatabaseServices.Shape AcDbSolid Autodesk.AutoCAD.DatabaseServices.Solid AcDbSortentsTable Autodesk.AutoCAD.DatabaseServices.DrawOrderTable AcDbSpatialFilter Autodesk.AutoCAD.DatabaseServices.Filters.SpatialFilter AcDbSpatialIndex Autodesk.AutoCAD.DatabaseServices.Filters.SpatialIndex AcDbSpline Autodesk.AutoCAD.DatabaseServices.Spline AcDbSubentId Autodesk.AutoCAD.DatabaseServices.SubentityId AcDbSymbolTable Autodesk.AutoCAD.DatabaseServices.SymbolTable AcDbSymbolTableRecord Autodesk.AutoCAD.DatabaseServices.SymbolTableRecord AcDbSymUtilServices Autodesk.AutoCAD.DatabaseServices.SymbolUtilityServices AcDbTable Autodesk.AutoCAD.DatabaseServices.Table AcDbTable::TableStyleOverrides Autodesk.AutoCAD.DatabaseServices.TableStyleOverride AcDbTableStyle Autodesk.AutoCAD.DatabaseServices.TableStyle AcDbText Autodesk.AutoCAD.DatabaseServices.DBText AcDbTextStyleTable Autodesk.AutoCAD.DatabaseServices.TextStyleTable AcDbTextStyleTableRecord Autodesk.AutoCAD.DatabaseServices.TextStyleTableRecord AcDbTrace Autodesk.AutoCAD.DatabaseServices.Trace AcDbTransaction Autodesk.AutoCAD.DatabaseServices.Transaction AcDbTransactionManager Autodesk.AutoCAD.DatabaseServices.TransactionManager AcDbUCSTable Autodesk.AutoCAD.DatabaseServices.UcsTable AcDbUCSTableRecord Autodesk.AutoCAD.DatabaseServices.UcsTableRecord AcDbVertex Autodesk.AutoCAD.DatabaseServices.Vertex AcDbViewport Autodesk.AutoCAD.DatabaseServices.Viewport AcDbViewport::ShadePlotType Autodesk.AutoCAD.DatabaseServices.ShadePlotType AcDbViewportTable Autodesk.AutoCAD.DatabaseServices.ViewportTable [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 457 AcDbViewportTableRecord Autodesk.AutoCAD.DatabaseServices.ViewportTableRecord AcDbViewTable Autodesk.AutoCAD.DatabaseServices.ViewTable AcDbViewTableRecord Autodesk.AutoCAD.DatabaseServices.ViewTableRecord AcDbVoidPtrArray Autodesk.AutoCAD.DatabaseServices.DBObjectCollection AcDbXline Autodesk.AutoCAD.DatabaseServices.Xline AcDbXrecord Autodesk.AutoCAD.DatabaseServices.Xrecord AcDbXrefGraph Autodesk.AutoCAD.DatabaseServices.XrefGraph AcDbXrefGraphNode Autodesk.AutoCAD.DatabaseServices.XrefGraphNode AcDbXrefObjectId Autodesk.AutoCAD.DatabaseServices.XrefObjectId AcEditor Autodesk.AutoCAD.EditorInput.Editor AcEdJig Autodesk.AutoCAD.EditorInput.Jig AcFileDependencyInfo Autodesk.AutoCAD.DatabaseServices.FileDependencyInfo AcFileDependencyManager Autodesk.AutoCAD.DatabaseServices.FileDependencyManager AcGe::ErrorCondition Autodesk.AutoCAD.Geometry.ErrorCondition AcGe::ssiConfig Autodesk.AutoCAD.Geometry.SurfaceSurfaceIntersectorConfiguration AcGe::ssiType Autodesk.AutoCAD.Geometry.SurfaceSurfaceIntersectorType AcGeAugPolyline3d Autodesk.AutoCAD.Geometry.AugmentedPolylineCurve3d AcGeBoundBlock2d Autodesk.AutoCAD.Geometry.BoundBlock2d AcGeBoundBlock3d Autodesk.AutoCAD.Geometry.BoundBlock3d AcGeBoundedPlane Autodesk.AutoCAD.Geometry.BoundedPlane AcGeCircArc2d Autodesk.AutoCAD.Geometry.CircularArc2d AcGeCircArc3d Autodesk.AutoCAD.Geometry.CircularArc3d AcGeClipBoundary2d Autodesk.AutoCAD.Geometry.ClipBoundary2d AcGeCompositeCurve2d Autodesk.AutoCAD.Geometry.CompositeCurve2d AcGeCompositeCurve3d Autodesk.AutoCAD.Geometry.CompositeCurve3d AcGeCone Autodesk.AutoCAD.Geometry.Cone AcGeCubicSplineCurve2d Autodesk.AutoCAD.Geometry.CubicSplineCurve2d AcGeCubicSplineCurve3d Autodesk.AutoCAD.Geometry.CubicSplineCurve3d AcGeCurve2d Autodesk.AutoCAD.Geometry.Curve2d AcGeCurve3d Autodesk.AutoCAD.Geometry.Curve3d AcGeCurveBoundary Autodesk.AutoCAD.Geometry.CurveBoundary AcGeCurveCurveInt2d Autodesk.AutoCAD.Geometry.CurveCurveIntersector2d AcGeCurveCurveInt3d Autodesk.AutoCAD.Geometry.CurveCurveIntersector3d AcGeCylinder Autodesk.AutoCAD.Geometry.Cylinder AcGeDoubleArray Autodesk.AutoCAD.Geometry.DoubleCollection AcGeEllipArc2d Autodesk.AutoCAD.Geometry.EllipticalArc2d AcGeEllipArc3d Autodesk.AutoCAD.Geometry.EllipticalArc3d AcGeEntity2d Autodesk.AutoCAD.Geometry.Entity2d AcGeEntity3d Autodesk.AutoCAD.Geometry.Entity3d AcGeExternalBoundedSurface Autodesk.AutoCAD.Geometry.ExternalBoundedSurface AcGeExternalCurve2d Autodesk.AutoCAD.Geometry.ExternalCurve2d AcGeExternalCurve3d Autodesk.AutoCAD.Geometry.ExternalCurve3d AcGeExternalSurface Autodesk.AutoCAD.Geometry.ExternalSurface AcGeIntArray Autodesk.AutoCAD.Geometry.IntegerCollection [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 458 AcGeInterval Autodesk.AutoCAD.Geometry.Interval AcGeKnotVector Autodesk.AutoCAD.Geometry.KnotCollection AcGeLine2d Autodesk.AutoCAD.Geometry.Line2d AcGeLine3d Autodesk.AutoCAD.Geometry.Line3d AcGeLinearEnt2d Autodesk.AutoCAD.Geometry.LinearEntity2d AcGeLinearEnt3d Autodesk.AutoCAD.Geometry.LinearEntity3d AcGeLineSeg2d Autodesk.AutoCAD.Geometry.LineSegment2d AcGeLineSeg3d Autodesk.AutoCAD.Geometry.LineSegment3d AcGeMatrix2d Autodesk.AutoCAD.Geometry.Matrix2d AcGeMatrix3d Autodesk.AutoCAD.Geometry.Matrix3d AcGeNurbCurve2d Autodesk.AutoCAD.Geometry.NurbCurve2d AcGeNurbCurve3d Autodesk.AutoCAD.Geometry.NurbCurve3d AcGeNurbSurface Autodesk.AutoCAD.Geometry.NurbSurface AcGeOffsetCurve2d Autodesk.AutoCAD.Geometry.OffsetCurve2d AcGeOffsetCurve3d Autodesk.AutoCAD.Geometry.OffsetCurve3d AcGeOffsetSurface Autodesk.AutoCAD.Geometry.OffsetSurface AcGePlanarEnt Autodesk.AutoCAD.Geometry.PlanarEntity AcGePlane Autodesk.AutoCAD.Geometry.Plane AcGePoint2d Autodesk.AutoCAD.Geometry.Point2d AcGePoint2dArray Autodesk.AutoCAD.Geometry.Point2dCollection AcGePoint3d Autodesk.AutoCAD.Geometry.Point3d AcGePoint3dArray Autodesk.AutoCAD.Geometry.Point3dCollection AcGePointEnt2d Autodesk.AutoCAD.Geometry.PointEntity2d AcGePointEnt3d Autodesk.AutoCAD.Geometry.PointEntity3d AcGePointOnCurve2d Autodesk.AutoCAD.Geometry.PointOnCurve2d AcGePointOnCurve3d Autodesk.AutoCAD.Geometry.PointOnCurve3d AcGePointOnSurface Autodesk.AutoCAD.Geometry.PointOnSurface AcGePolyline2d Autodesk.AutoCAD.Geometry.PolylineCurve2d AcGePolyline3d Autodesk.AutoCAD.Geometry.PolylineCurve3d AcGePosition2d Autodesk.AutoCAD.Geometry.Position2d AcGePosition3d Autodesk.AutoCAD.Geometry.Position3d AcGeRay2d Autodesk.AutoCAD.Geometry.Ray2d AcGeRay3d Autodesk.AutoCAD.Geometry.Ray3d AcGeScale2d Autodesk.AutoCAD.Geometry.Scale2d AcGeScale3d Autodesk.AutoCAD.Geometry.Scale3d AcGeSphere Autodesk.AutoCAD.Geometry.Sphere AcGeSplineEnt2d Autodesk.AutoCAD.Geometry.SplineEntity2d AcGeSplineEnt3d Autodesk.AutoCAD.Geometry.SplineEntity3d AcGeSurface Autodesk.AutoCAD.Geometry.Surface AcGeSurfSurfInt Autodesk.AutoCAD.Geometry.SurfaceSurfaceIntersector AcGeTol Autodesk.AutoCAD.Geometry.Tolerance AcGeTorus Autodesk.AutoCAD.Geometry.Torus AcGeVector2d Autodesk.AutoCAD.Geometry.Vector2d AcGeVector2dArray Autodesk.AutoCAD.Geometry.Vector2dCollection [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 459 AcGeVector3d Autodesk.AutoCAD.Geometry.Vector3d AcGeVector3dArray Autodesk.AutoCAD.Geometry.Vector3dCollection AcGiArcType Autodesk.AutoCAD.GraphicsInterface.ArcType AcGiClipBoundary Autodesk.AutoCAD.GraphicsInterface.ClipBoundary AcGiCommonDraw Autodesk.AutoCAD.GraphicsInterface.CommonDraw AcGiContext Autodesk.AutoCAD.GraphicsInterface.Context AcGiDeviationType Autodesk.AutoCAD.GraphicsInterface.DeviationType AcGiDrawable Autodesk.AutoCAD.GraphicsInterface.Drawable AcGiDrawableTraits Autodesk.AutoCAD.GraphicsInterface.DrawableTraits AcGiEdgeData Autodesk.AutoCAD.GraphicsInterface.EdgeData AcGiFaceData Autodesk.AutoCAD.GraphicsInterface.FaceData AcGiFillType Autodesk.AutoCAD.GraphicsInterface.FillType AcGiGeometry Autodesk.AutoCAD.GraphicsInterface.Geometry AcGiGlyph Autodesk.AutoCAD.GraphicsInterface.Glyph AcGiMapper Autodesk.AutoCAD.GraphicsInterface.Mapper AcGiMapper::AutoTransform Autodesk.AutoCAD.GraphicsInterface.AutoTransform AcGiMapper::Projection Autodesk.AutoCAD.GraphicsInterface.Projection AcGiMapper::Tiling Autodesk.AutoCAD.GraphicsInterface.Tiling AcGiMaterialColor Autodesk.AutoCAD.GraphicsInterface.MaterialColor AcGiMaterialColor::Method Autodesk.AutoCAD.GraphicsInterface.Method AcGiMaterialMap Autodesk.AutoCAD.GraphicsInterface.MaterialMap AcGiMaterialMap::Source Autodesk.AutoCAD.GraphicsInterface.Source AcGiOrientationType Autodesk.AutoCAD.GraphicsInterface.OrientationType AcGiRegenType Autodesk.AutoCAD.GraphicsInterface.RegenType AcGiSubEntityTraits Autodesk.AutoCAD.GraphicsInterface.SubEntityTraits AcGiTextStyle Autodesk.AutoCAD.GraphicsInterface.TextStyle AcGiVertexData Autodesk.AutoCAD.GraphicsInterface.VertexData AcGiViewport Autodesk.AutoCAD.GraphicsInterface.Viewport AcGiViewportDraw Autodesk.AutoCAD.GraphicsInterface.ViewportDraw AcGiViewportGeometry Autodesk.AutoCAD.GraphicsInterface.ViewportGeometry AcGiViewportGeometry::ImageSource Autodesk.AutoCAD.GraphicsInterface.ImageSource AcGiWorldDraw Autodesk.AutoCAD.GraphicsInterface.WorldDraw AcGiWorldGeometry Autodesk.AutoCAD.GraphicsInterface.WorldGeometry AcGsView::RenderMode Autodesk.AutoCAD.DatabaseServices.RenderMode AcLyAndExpr Autodesk.AutoCAD.LayerManager.AndExpression AcLyLayerFilter Autodesk.AutoCAD.LayerManager.LayerFilter AcLyLayerGroup Autodesk.AutoCAD.LayerManager.LayerGroup AcLyRelExpr Autodesk.AutoCAD.LayerManager.RelationalExpression AcPane Autodesk.AutoCAD.Windows.Pane ACPL_PREVIEWENDPLOT Autodesk.AutoCAD.PlottingServices.PreviewEndPlotInfo AcPlDSDData Autodesk.AutoCAD.PlottingServices.DsdData AcPlDSDEntries Autodesk.AutoCAD.PlottingServices.DsdEntryCollection AcPlDSDEntry Autodesk.AutoCAD.PlottingServices.DsdEntry AcPlHostAppServices Autodesk.AutoCAD.PlottingServices.HostAppServices [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 460 AcPlPlotConfig Autodesk.AutoCAD.PlottingServices.PlotConfig AcPlPlotConfigInfo Autodesk.AutoCAD.PlottingServices.PlotConfigInfo AcPlPlotConfigManager Autodesk.AutoCAD.PlottingServices.PlotConfigManager AcPlPlotEngine Autodesk.AutoCAD.PlottingServices.PlotEngine AcPlPlotFactory Autodesk.AutoCAD.PlottingServices.PlotFactory AcPlPlotInfo Autodesk.AutoCAD.PlottingServices.PlotInfo AcPlPlotInfoValidator Autodesk.AutoCAD.PlottingServices.PlotInfoValidator AcPlPlotLogger Autodesk.AutoCAD.PlottingServices.PlotLogger AcPlPlotPageInfo Autodesk.AutoCAD.PlottingServices.PlotPageInfo AcPlPlotProgress Autodesk.AutoCAD.PlottingServices.PlotProgress AcPlPlotProgressDialog Autodesk.AutoCAD.PlottingServices.PlotProgressDialog AcPlPlotReactorMgr Autodesk.AutoCAD.PlottingServices.PlotReactorManager AcRxClass Autodesk.AutoCAD.Runtime.RXClass AcRxDictionary Autodesk.AutoCAD.Runtime.Dictionary AcRxDynamicLinker Autodesk.AutoCAD.Runtime.DynamicLinker AcRxObject Autodesk.AutoCAD.Runtime.RXObject AcStatusBarItem Autodesk.AutoCAD.Windows.StatusBarItem AcTcCatalog Autodesk.AutoCAD.Windows.ToolPalette.Catalog AcTcCatalogItem Autodesk.AutoCAD.Windows.ToolPalette.CatalogItem AcTcCatalogSet Autodesk.AutoCAD.Windows.ToolPalette.CatalogSet AcTcCategory Autodesk.AutoCAD.Windows.ToolPalette.Category AcTcImage Autodesk.AutoCAD.Windows.ToolPalette.Image AcTcImageList Autodesk.AutoCAD.Windows.ToolPalette.ImageList AcTcManager Autodesk.AutoCAD.Windows.ToolPalette.ToolPaletteManager AcTcPackage Autodesk.AutoCAD.Windows.ToolPalette.Package AcTcPalette Autodesk.AutoCAD.Windows.ToolPalette.Palette AcTcScheme Autodesk.AutoCAD.Windows.ToolPalette.Scheme AcTcStockTool Autodesk.AutoCAD.Windows.ToolPalette.StockTool AcTcTool Autodesk.AutoCAD.Windows.ToolPalette.Tool AcTransactionManager Autodesk.AutoCAD.ApplicationServices.TransactionManager AcTrayItem Autodesk.AutoCAD.Windows.TrayItem AcTrayItemBubbleWindowControl Autodesk.AutoCAD.Windows.TrayItemBubbleWindow AdUiPalette Autodesk.AutoCAD.Windows.Palette AdUiPaletteSet Autodesk.AutoCAD.Windows.PaletteSet AttachmentPoint Autodesk.AutoCAD.DatabaseServices.AttachmentPoint CatalogItemType Autodesk.AutoCAD.Windows.ToolPalette.CatalogItemType CellAlignment Autodesk.AutoCAD.DatabaseServices.CellAlignment CellType Autodesk.AutoCAD.DatabaseServices.CellType ClipCondition Autodesk.AutoCAD.Geometry.ClipCondition ClipError Autodesk.AutoCAD.Geometry.ClipError CursorType Autodesk.AutoCAD.EditorInput.CursorType DeviceType Autodesk.AutoCAD.PlottingServices.DeviceType DialogResult Autodesk.AutoCAD.LayerManager.DialogResult DuplicateRecordCloning Autodesk.AutoCAD.DatabaseServices.DuplicateRecordCloning [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 461 ErrorStatus Autodesk.AutoCAD.Runtime.ErrorStatus ExecutionContext Autodesk.AutoCAD.Windows.ToolPalette.ExecutionContext ExternalEntityKind Autodesk.AutoCAD.Geometry.ExternalEntityKind FilerType Autodesk.AutoCAD.DatabaseServices.FilerType FlowDirection Autodesk.AutoCAD.DatabaseServices.FlowDirection GridLineType Autodesk.AutoCAD.DatabaseServices.GridLineType HatchPatternType Autodesk.AutoCAD.DatabaseServices.HatchPatternType IAcadStockTool Autodesk.AutoCAD.Windows.ToolPalette.IAcadStockTool IAcadTool Autodesk.AutoCAD.Windows.ToolPalette.IAcadTool IAcadTool2 Autodesk.AutoCAD.Windows.ToolPalette.IAcadTool2 IAcadToolContextMenu Autodesk.AutoCAD.Windows.ToolPalette.IAcadToolContextMenu IAcadToolDragSource Autodesk.AutoCAD.Windows.ToolPalette.IAcadToolDragSource IAcadToolDropTarget Autodesk.AutoCAD.Windows.ToolPalette.IAcadToolDropTarget IAcadToolFlyoutShape Autodesk.AutoCAD.Windows.ToolPalette.IAcadToolFlyoutShape IAcadToolProperties Autodesk.AutoCAD.Windows.ToolPalette.IAcadToolProperties IAcadToolProperties2 Autodesk.AutoCAD.Windows.ToolPalette.IAcadToolProperties2 IAcPiCategorizeProperties Autodesk.AutoCAD.Windows.ToolPalette.IAcPiCategorizeProperties IAcPiPropertyDisplay Autodesk.AutoCAD.Windows.ToolPalette.IAcPiPropertyDisplay IAcPiPropertyUnspecified Autodesk.AutoCAD.Windows.ToolPalette.IAcPiPropertyUnspecified ImageType Autodesk.AutoCAD.Windows.ToolPalette.ImageType IOPMPropertyDialog Autodesk.AutoCAD.Windows.ToolPalette.IOPMPropertyDialog IOPMPropertyExtension Autodesk.AutoCAD.Windows.ToolPalette.IOPMPropertyExtension LineSpacingStyle Autodesk.AutoCAD.DatabaseServices.LineSpacingStyle LineWeight Autodesk.AutoCAD.DatabaseServices.LineWeight MaintenanceReleaseVersion Autodesk.AutoCAD.DatabaseServices.MaintenanceReleaseVersion MatchingPolicy Autodesk.AutoCAD.PlottingServices.MatchingPolicy MergeStatus Autodesk.AutoCAD.PlottingServices.MergeStatus Mline::Justification Autodesk.AutoCAD.DatabaseServices.MlineJustification OpenMode Autodesk.AutoCAD.DatabaseServices.OpenMode OrthographicView Autodesk.AutoCAD.DatabaseServices.OrthographicView PlotCancelStatus Autodesk.AutoCAD.PlottingServices.PlotCancelStatus PlotRotation Autodesk.AutoCAD.DatabaseServices.PlotRotation PlotToFileCapability Autodesk.AutoCAD.PlottingServices.PlotToFileCapability PlotType Autodesk.AutoCAD.DatabaseServices.PlotType PlotType Autodesk.AutoCAD.PlottingServices.PlotType PreviewEngineFlags Autodesk.AutoCAD.PlottingServices.PreviewEngineFlags ProcessPlotState Autodesk.AutoCAD.PlottingServices.ProcessPlotState PromptStatus Autodesk.AutoCAD.EditorInput.PromptStatus RefreshCode Autodesk.AutoCAD.PlottingServices.RefreshCode resbuf Autodesk.AutoCAD.DatabaseServices.ResultBuffer RowType Autodesk.AutoCAD.DatabaseServices.RowType SecurityParams Autodesk.AutoCAD.DatabaseServices.SecurityParameters SheetCancelStatus Autodesk.AutoCAD.PlottingServices.SheetCancelStatus SheetType Autodesk.AutoCAD.PlottingServices.SheetType [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 462 StdScaleType Autodesk.AutoCAD.DatabaseServices.StdScaleType ToolType Autodesk.AutoCAD.Windows.ToolPalette.ToolType UserInputControls Autodesk.AutoCAD.EditorInput.UserInputControls Vertex3dType Autodesk.AutoCAD.DatabaseServices.Vertex3dType XrefNotificationStatus Autodesk.AutoCAD.DatabaseServices.XrefNotificationStatus XrefStatus Autodesk.AutoCAD.DatabaseServices.XrefStatus [www.BimCad.org]深居浅出 AutoCAD 二次开发 463 附录八:ARX 函数与托管类函数对应关系 ObjectARX Functions to Managed Members ObjectARX Function Managed Member AcApDocument::AfxGetAppModuleState Autodesk.AutoCAD.ApplicationServices.Document.Window AcApDocument::cDoc Autodesk.AutoCAD.ApplicationServices.Document.AcadDocument AcApDocument::database Autodesk.AutoCAD.ApplicationServices.Document.Database AcApDocument::drawingStatusBar Autodesk.AutoCAD.ApplicationServices.Document.StatusBar AcApDocument::fileName Autodesk.AutoCAD.ApplicationServices.Document.Name AcApDocument::isA Autodesk.AutoCAD.ApplicationServices.Document.FromAcadDocument AcApDocument::transactionManager Autodesk.AutoCAD.ApplicationServices.Document.TransactionManager AcApStatusBar::GetDefaultPane Autodesk.AutoCAD.Windows.StatusBar.GetDefaultPane AcApStatusBar::GetTrayItemCount Autodesk.AutoCAD.Windows.StatusBar.CloseBubbleWindows AcApStatusBar::RemoveDefaultPane Autodesk.AutoCAD.Windows.StatusBar.RemoveDefaultPane AcApStatusBar::Update Autodesk.AutoCAD.Windows.StatusBar.Update AcAxDocLock::AcAxDocLock Autodesk.AutoCAD.Windows.ToolPalette.CustomToolBase.Execute AcAxDocLock::lockStatus Autodesk.AutoCAD.Windows.ToolPalette.CustomToolBase.Execute AcAxGetDatabase Autodesk.AutoCAD.DatabaseServices.Database.AcadDatabase AcAxGetIUnknownOfObject Autodesk.AutoCAD.DatabaseServices.DBObject.AcadObject AcCmColor::= Autodesk.AutoCAD.Colors.Color.Clone AcCmColor::= Autodesk.AutoCAD.Windows.ColorDialog.ShowDialog AcCmColor::== Autodesk.AutoCAD.Colors.Color.Equals AcCmColor::audit Autodesk.AutoCAD.Colors.Color.Audit AcCmColor::blue Autodesk.AutoCAD.Colors.Color.Blue AcCmColor::bookName Autodesk.AutoCAD.Colors.Color.BookName AcCmColor::color Autodesk.AutoCAD.Colors.Color.GetHashCode AcCmColor::colorMethod Autodesk.AutoCAD.Colors.Color.ColorMethod AcCmColor::colorMethod Autodesk.AutoCAD.Colors.Color.ColorIndex AcCmColor::colorName Autodesk.AutoCAD.Colors.Color.ColorName AcCmColor::colorNameForDisplay Autodesk.AutoCAD.Colors.Color.ToString AcCmColor::colorNameForDisplay Autodesk.AutoCAD.Colors.Color.ColorNameForDisplay AcCmColor::CompareColor Autodesk.AutoCAD.Colors.Color.CompareTo AcCmColor::dictionaryKeyLength Autodesk.AutoCAD.Colors.Color.DictionaryKeyLength AcCmColor::dictionaryKeyLength Autodesk.AutoCAD.Colors.Color.DictionaryKey AcCmColor::dwgIn Autodesk.AutoCAD.Colors.Color.DwgIn AcCmColor::dwgOut Autodesk.AutoCAD.Colors.Color.DwgOut AcCmColor::dxfIn Autodesk.AutoCAD.Colors.Color.DxfIn AcCmColor::dxfOut Autodesk.AutoCAD.Colors.Color.DxfOut AcCmColor::entityColor Autodesk.AutoCAD.Colors.Color.EntityColor AcCmColor::getColor Autodesk.AutoCAD.Colors.Color.ColorValue AcCmColor::getDescription Autodesk.AutoCAD.Colors.Color.Description AcCmColor::getDictionaryKey Autodesk.AutoCAD.Colors.Color.DictionaryKey [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 464 AcCmColor::getDictionaryKey Autodesk.AutoCAD.Colors.Color.DictionaryKey AcCmColor::getExplanation Autodesk.AutoCAD.Colors.Color.Explanation AcCmColor::green Autodesk.AutoCAD.Colors.Color.Green AcCmColor::isNone Autodesk.AutoCAD.Colors.Color.IsNone AcCmColor::penIndex Autodesk.AutoCAD.Colors.Color.PenIndex AcCmColor::red Autodesk.AutoCAD.Colors.Color.Red AcCmColor::setColor Autodesk.AutoCAD.Colors.Color.FromColor AcCmColor::setColorMethod Autodesk.AutoCAD.Colors.Color.FromColorIndex AcCmColor::setNames Autodesk.AutoCAD.Colors.Color.FromNames AcCmColor::setNamesFromDictionaryKey Autodesk.AutoCAD.Colors.Color.FromDictionaryName AcCmColor::setRGB Autodesk.AutoCAD.Colors.Color.FromRgb AcCmEntityColor::blue Autodesk.AutoCAD.Colors.EntityColor.Blue AcCmEntityColor::colorIndex Autodesk.AutoCAD.Colors.EntityColor.ColorIndex AcCmEntityColor::colorMethod Autodesk.AutoCAD.Colors.EntityColor.ColorMethod AcCmEntityColor::green Autodesk.AutoCAD.Colors.EntityColor.Green AcCmEntityColor::isByACI Autodesk.AutoCAD.Colors.EntityColor.IsByAci AcCmEntityColor::isByBlock Autodesk.AutoCAD.Colors.EntityColor.IsByBlock AcCmEntityColor::isByColor Autodesk.AutoCAD.Colors.EntityColor.IsByColor AcCmEntityColor::isByLayer Autodesk.AutoCAD.Colors.EntityColor.IsByLayer AcCmEntityColor::isByPen Autodesk.AutoCAD.Colors.EntityColor.IsByPen AcCmEntityColor::isForeground Autodesk.AutoCAD.Colors.EntityColor.IsForeground AcCmEntityColor::isLayerFrozen Autodesk.AutoCAD.Colors.EntityColor.IsLayerFrozen AcCmEntityColor::isLayerFrozenOrOff Autodesk.AutoCAD.Colors.EntityColor.IsLayerFrozenOrOff AcCmEntityColor::isLayerOff Autodesk.AutoCAD.Colors.EntityColor.IsLayerOff AcCmEntityColor::isNone Autodesk.AutoCAD.Colors.EntityColor.IsNone AcCmEntityColor::layerIndex Autodesk.AutoCAD.Colors.EntityColor.LayerIndex AcCmEntityColor::lookUpACI Autodesk.AutoCAD.Colors.EntityColor.LookUpAci AcCmEntityColor::lookUpRGB Autodesk.AutoCAD.Colors.EntityColor.LookUpRgb AcCmEntityColor::penIndex Autodesk.AutoCAD.Colors.EntityColor.PenIndex AcCmEntityColor::red Autodesk.AutoCAD.Colors.EntityColor.Red AcCmEntityColor::trueColor Autodesk.AutoCAD.Colors.EntityColor.TrueColor AcCmTransparency::alpha Autodesk.AutoCAD.Colors.Transparency.Alpha AcCmTransparency::isByAlpha Autodesk.AutoCAD.Colors.Transparency.IsByAlpha AcCmTransparency::isByBlock Autodesk.AutoCAD.Colors.Transparency.IsByBlock AcCmTransparency::isByLayer Autodesk.AutoCAD.Colors.Transparency.IsByLayer AcCmTransparency::isClear Autodesk.AutoCAD.Colors.Transparency.IsClear AcCmTransparency::isSolid Autodesk.AutoCAD.Colors.Transparency.IsSolid AcDb2dPolyline::appendVertex Autodesk.AutoCAD.DatabaseServices.Polyline2d.AppendVertex AcDb2dPolyline::convertToPolyType Autodesk.AutoCAD.DatabaseServices.Polyline2d.ConvertToPolyType AcDb2dPolyline::curveFit Autodesk.AutoCAD.DatabaseServices.Polyline2d.CurveFit AcDb2dPolyline::defaultEndWidth Autodesk.AutoCAD.DatabaseServices.Polyline2d.DefaultEndWidth AcDb2dPolyline::defaultStartWidth Autodesk.AutoCAD.DatabaseServices.Polyline2d.DefaultStartWidth AcDb2dPolyline::elevation Autodesk.AutoCAD.DatabaseServices.Polyline2d.Elevation AcDb2dPolyline::insertVertexAt Autodesk.AutoCAD.DatabaseServices.Polyline2d.InsertVertexAt [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 465 AcDb2dPolyline::insertVertexAt Autodesk.AutoCAD.DatabaseServices.Polyline2d.InsertVertexAt AcDb2dPolyline::isLinetypeGenerationOn Autodesk.AutoCAD.DatabaseServices.Polyline2d.LinetypeGenerationOn AcDb2dPolyline::makeClosed Autodesk.AutoCAD.DatabaseServices.Polyline2d.Closed AcDb2dPolyline::makeOpen Autodesk.AutoCAD.DatabaseServices.Polyline2d.Closed AcDb2dPolyline::normal Autodesk.AutoCAD.DatabaseServices.Polyline2d.Normal AcDb2dPolyline::polyType Autodesk.AutoCAD.DatabaseServices.Polyline2d.PolyType AcDb2dPolyline::setDefaultEndWidth Autodesk.AutoCAD.DatabaseServices.Polyline2d.DefaultEndWidth AcDb2dPolyline::setDefaultStartWidth Autodesk.AutoCAD.DatabaseServices.Polyline2d.DefaultStartWidth AcDb2dPolyline::setElevation Autodesk.AutoCAD.DatabaseServices.Polyline2d.Elevation AcDb2dPolyline::setLinetypeGenerationOff Autodesk.AutoCAD.DatabaseServices.Polyline2d.LinetypeGenerationOn AcDb2dPolyline::setLinetypeGenerationOn Autodesk.AutoCAD.DatabaseServices.Polyline2d.LinetypeGenerationOn AcDb2dPolyline::setNormal Autodesk.AutoCAD.DatabaseServices.Polyline2d.Normal AcDb2dPolyline::setPolyType Autodesk.AutoCAD.DatabaseServices.Polyline2d.PolyType AcDb2dPolyline::setThickness Autodesk.AutoCAD.DatabaseServices.Polyline2d.Thickness AcDb2dPolyline::splineFit Autodesk.AutoCAD.DatabaseServices.Polyline2d.SplineFit AcDb2dPolyline::splineFit Autodesk.AutoCAD.DatabaseServices.Polyline2d.SplineFit AcDb2dPolyline::straighten Autodesk.AutoCAD.DatabaseServices.Polyline2d.Straighten AcDb2dPolyline::thickness Autodesk.AutoCAD.DatabaseServices.Polyline2d.Thickness AcDb2dPolyline::vertexIterator Autodesk.AutoCAD.DatabaseServices.Polyline2d.GetEnumerator AcDb2dPolyline::vertexPosition Autodesk.AutoCAD.DatabaseServices.Polyline2d.VertexPosition AcDb2dVertex::bulge Autodesk.AutoCAD.DatabaseServices.Vertex2d.Bulge AcDb2dVertex::endWidth Autodesk.AutoCAD.DatabaseServices.Vertex2d.EndWidth AcDb2dVertex::ignoreTangent Autodesk.AutoCAD.DatabaseServices.Vertex2d.TangentUsed AcDb2dVertex::isTangentUsed Autodesk.AutoCAD.DatabaseServices.Vertex2d.TangentUsed AcDb2dVertex::position Autodesk.AutoCAD.DatabaseServices.Vertex2d.Position AcDb2dVertex::setBulge Autodesk.AutoCAD.DatabaseServices.Vertex2d.Bulge AcDb2dVertex::setEndWidth Autodesk.AutoCAD.DatabaseServices.Vertex2d.EndWidth AcDb2dVertex::setPosition Autodesk.AutoCAD.DatabaseServices.Vertex2d.Position AcDb2dVertex::setStartWidth Autodesk.AutoCAD.DatabaseServices.Vertex2d.StartWidth AcDb2dVertex::setTangent Autodesk.AutoCAD.DatabaseServices.Vertex2d.Tangent AcDb2dVertex::startWidth Autodesk.AutoCAD.DatabaseServices.Vertex2d.StartWidth AcDb2dVertex::tangent Autodesk.AutoCAD.DatabaseServices.Vertex2d.Tangent AcDb2dVertex::useTangent Autodesk.AutoCAD.DatabaseServices.Vertex2d.TangentUsed AcDb2dVertex::vertexType Autodesk.AutoCAD.DatabaseServices.Vertex2d.VertexType AcDb2LineAngularDimension::arcPoint Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.ArcPoint AcDb2LineAngularDimension::setArcPoint Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.ArcPoint AcDb2LineAngularDimension::setXLine1End Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine1End AcDb2LineAngularDimension::setXLine1Start Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine1Start AcDb2LineAngularDimension::setXLine2End Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine2End AcDb2LineAngularDimension::setXLine2Start Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine2Start AcDb2LineAngularDimension::xLine1End Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine1End AcDb2LineAngularDimension::xLine1Start Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine1Start AcDb2LineAngularDimension::xLine2End Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine2End AcDb2LineAngularDimension::xLine2Start Autodesk.AutoCAD.DatabaseServices.LineAngularDimension2.XLine2Start [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 466 AcDb3dPolyline::appendVertex Autodesk.AutoCAD.DatabaseServices.Polyline3d.AppendVertex AcDb3dPolyline::convertToPolyType Autodesk.AutoCAD.DatabaseServices.Polyline3d.ConvertToPolyType AcDb3dPolyline::insertVertexAt Autodesk.AutoCAD.DatabaseServices.Polyline3d.InsertVertexAt AcDb3dPolyline::insertVertexAt Autodesk.AutoCAD.DatabaseServices.Polyline3d.InsertVertexAt AcDb3dPolyline::makeClosed Autodesk.AutoCAD.DatabaseServices.Polyline3d.Closed AcDb3dPolyline::makeOpen Autodesk.AutoCAD.DatabaseServices.Polyline3d.Closed AcDb3dPolyline::polyType Autodesk.AutoCAD.DatabaseServices.Polyline3d.PolyType AcDb3dPolyline::setPolyType Autodesk.AutoCAD.DatabaseServices.Polyline3d.PolyType AcDb3dPolyline::splineFit Autodesk.AutoCAD.DatabaseServices.Polyline3d.SplineFit AcDb3dPolyline::splineFit Autodesk.AutoCAD.DatabaseServices.Polyline3d.SplineFit AcDb3dPolyline::straighten Autodesk.AutoCAD.DatabaseServices.Polyline3d.Straighten AcDb3dPolyline::vertexIterator Autodesk.AutoCAD.DatabaseServices.Polyline3d.GetEnumerator AcDb3dPolylineVertex::position Autodesk.AutoCAD.DatabaseServices.PolylineVertex3d.Position AcDb3dPolylineVertex::setPosition Autodesk.AutoCAD.DatabaseServices.PolylineVertex3d.Position AcDb3dPolylineVertex::vertexType Autodesk.AutoCAD.DatabaseServices.PolylineVertex3d.VertexType AcDb3dSolid::booleanOper Autodesk.AutoCAD.DatabaseServices.Solid3d.BooleanOperation AcDb3dSolid::checkInterference Autodesk.AutoCAD.DatabaseServices.Solid3d.CheckInterference AcDb3dSolid::cleanBody Autodesk.AutoCAD.DatabaseServices.Solid3d.CleanBody AcDb3dSolid::copyEdge Autodesk.AutoCAD.DatabaseServices.Solid3d.CopyEdge AcDb3dSolid::copyFace Autodesk.AutoCAD.DatabaseServices.Solid3d.CopyFace AcDb3dSolid::createBox Autodesk.AutoCAD.DatabaseServices.Solid3d.CreateBox AcDb3dSolid::createFrustum Autodesk.AutoCAD.DatabaseServices.Solid3d.CreateFrustum AcDb3dSolid::createSphere Autodesk.AutoCAD.DatabaseServices.Solid3d.CreateSphere AcDb3dSolid::createTorus Autodesk.AutoCAD.DatabaseServices.Solid3d.CreateTorus AcDb3dSolid::createWedge Autodesk.AutoCAD.DatabaseServices.Solid3d.CreateWedge AcDb3dSolid::extrude Autodesk.AutoCAD.DatabaseServices.Solid3d.Extrude AcDb3dSolid::extrudeAlongPath Autodesk.AutoCAD.DatabaseServices.Solid3d.ExtrudeAlongPath AcDb3dSolid::getArea Autodesk.AutoCAD.DatabaseServices.Solid3d.Area AcDb3dSolid::getMassProp Autodesk.AutoCAD.DatabaseServices.Solid3d.MassProperties AcDb3dSolid::getSection Autodesk.AutoCAD.DatabaseServices.Solid3d.GetSection AcDb3dSolid::getSlice Autodesk.AutoCAD.DatabaseServices.Solid3d.GetSlice AcDb3dSolid::imprintEntity Autodesk.AutoCAD.DatabaseServices.Solid3d.ImprintEntity AcDb3dSolid::isNull Autodesk.AutoCAD.DatabaseServices.Solid3d.IsNull AcDb3dSolid::numChanges Autodesk.AutoCAD.DatabaseServices.Solid3d.NumChanges AcDb3dSolid::offsetBody Autodesk.AutoCAD.DatabaseServices.Solid3d.OffsetBody AcDb3dSolid::revolve Autodesk.AutoCAD.DatabaseServices.Solid3d.Revolve AcDb3dSolid::separateBody Autodesk.AutoCAD.DatabaseServices.Solid3d.SeparateBody AcDb3dSolid::setSubentColor Autodesk.AutoCAD.DatabaseServices.Solid3d.SetSubentityColor AcDb3dSolid::stlOut Autodesk.AutoCAD.DatabaseServices.Solid3d.StlOut AcDb3PointAngularDimension::arcPoint Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.ArcPoint AcDb3PointAngularDimension::centerPoint Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.CenterPoint AcDb3PointAngularDimension::setArcPoint Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.ArcPoint AcDb3PointAngularDimension::setCenterPoint Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.CenterPoint AcDb3PointAngularDimension::setXLine1Point Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.XLine1Point [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 467 AcDb3PointAngularDimension::setXLine2Point Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.XLine2Point AcDb3PointAngularDimension::xLine1Point Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.XLine1Point AcDb3PointAngularDimension::xLine2Point Autodesk.AutoCAD.DatabaseServices.Point3AngularDimension.XLine2Point AcDbAbstractViewTableRecord::backClipDistance Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.BackClipDistance AcDbAbstractViewTableRecord::backClipEnabled Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.BackClipEnabled AcDbAbstractViewTableRecord::centerPoint Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.CenterPoint AcDbAbstractViewTableRecord::elevation Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Elevation AcDbAbstractViewTableRecord::frontClipAtEye Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.FrontClipAtEye AcDbAbstractViewTableRecord::frontClipDistance Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.FrontClipDistance AcDbAbstractViewTableRecord::frontClipEnabled Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.FrontClipEnabled AcDbAbstractViewTableRecord::getUcs Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Ucs AcDbAbstractViewTableRecord::height Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Height AcDbAbstractViewTableRecord::isUcsOrthographic Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.UcsOrthographic AcDbAbstractViewTableRecord::isViewOrthographic Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.ViewOrthographic AcDbAbstractViewTableRecord::lensLength Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.LensLength AcDbAbstractViewTableRecord::perspectiveEnabled Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.PerspectiveEnabled AcDbAbstractViewTableRecord::renderMode Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.RenderMode AcDbAbstractViewTableRecord::setBackClipDistance Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.BackClipDistance AcDbAbstractViewTableRecord::setBackClipEnabled Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.BackClipEnabled AcDbAbstractViewTableRecord::setCenterPoint Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.CenterPoint AcDbAbstractViewTableRecord::setElevation Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Elevation AcDbAbstractViewTableRecord::setFrontClipAtEye Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.FrontClipAtEye AcDbAbstractViewTableRecord::setFrontClipDistance Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.FrontClipDistance AcDbAbstractViewTableRecord::setFrontClipEnabled Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.FrontClipEnabled AcDbAbstractViewTableRecord::setHeight Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Height AcDbAbstractViewTableRecord::setLensLength Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.LensLength AcDbAbstractViewTableRecord::setPerspectiveEnable d Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.PerspectiveEnabled AcDbAbstractViewTableRecord::setRenderMode Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.RenderMode AcDbAbstractViewTableRecord::setTarget Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Target AcDbAbstractViewTableRecord::setUcs Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.SetUcs AcDbAbstractViewTableRecord::setUcs Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.SetUcs AcDbAbstractViewTableRecord::setUcs Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.SetUcs AcDbAbstractViewTableRecord::setUcsToWorld Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.SetUcsToWorld AcDbAbstractViewTableRecord::setViewDirection Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.SetViewDirection AcDbAbstractViewTableRecord::setViewDirection Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.ViewDirection AcDbAbstractViewTableRecord::setViewTwist Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.ViewTwist AcDbAbstractViewTableRecord::setWidth Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Width AcDbAbstractViewTableRecord::target Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Target AcDbAbstractViewTableRecord::ucsName Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.UcsName AcDbAbstractViewTableRecord::viewDirection Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.ViewDirection AcDbAbstractViewTableRecord::viewTwist Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.ViewTwist AcDbAbstractViewTableRecord::width Autodesk.AutoCAD.DatabaseServices.AbstractViewTableRecord.Width AcDbAlignedDimension::dimLinePoint Autodesk.AutoCAD.DatabaseServices.AlignedDimension.DimLinePoint [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 468 AcDbAlignedDimension::oblique Autodesk.AutoCAD.DatabaseServices.AlignedDimension.Oblique AcDbAlignedDimension::setDimLinePoint Autodesk.AutoCAD.DatabaseServices.AlignedDimension.DimLinePoint AcDbAlignedDimension::setOblique Autodesk.AutoCAD.DatabaseServices.AlignedDimension.Oblique AcDbAlignedDimension::setXLine1Point Autodesk.AutoCAD.DatabaseServices.AlignedDimension.XLine1Point AcDbAlignedDimension::setXLine2Point Autodesk.AutoCAD.DatabaseServices.AlignedDimension.XLine2Point AcDbAlignedDimension::xLine1Point Autodesk.AutoCAD.DatabaseServices.AlignedDimension.XLine1Point AcDbAlignedDimension::xLine2Point Autodesk.AutoCAD.DatabaseServices.AlignedDimension.XLine2Point acdbAlloc Autodesk.AutoCAD.Colors.Color.DictionaryKey acdbAngToF Autodesk.AutoCAD.Runtime.Converter.StringToAngle acdbAngToS Autodesk.AutoCAD.Runtime.Converter.AngleToString AcDbArc::center Autodesk.AutoCAD.DatabaseServices.Arc.Center AcDbArc::endAngle Autodesk.AutoCAD.DatabaseServices.Arc.EndAngle AcDbArc::normal Autodesk.AutoCAD.DatabaseServices.Arc.Normal AcDbArc::radius Autodesk.AutoCAD.DatabaseServices.Arc.Radius AcDbArc::setCenter Autodesk.AutoCAD.DatabaseServices.Arc.Center AcDbArc::setEndAngle Autodesk.AutoCAD.DatabaseServices.Arc.EndAngle AcDbArc::setNormal Autodesk.AutoCAD.DatabaseServices.Arc.Normal AcDbArc::setRadius Autodesk.AutoCAD.DatabaseServices.Arc.Radius AcDbArc::setStartAngle Autodesk.AutoCAD.DatabaseServices.Arc.StartAngle AcDbArc::setThickness Autodesk.AutoCAD.DatabaseServices.Arc.Thickness AcDbArc::startAngle Autodesk.AutoCAD.DatabaseServices.Arc.StartAngle AcDbArc::thickness Autodesk.AutoCAD.DatabaseServices.Arc.Thickness AcDbArcDimension::arcEndParam Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcEndParam AcDbArcDimension::arcPoint Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcPoint AcDbArcDimension::arcStartParam Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcStartParam AcDbArcDimension::arcSymbolType Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcSymbolType AcDbArcDimension::centerPoint Autodesk.AutoCAD.DatabaseServices.ArcDimension.CenterPoint AcDbArcDimension::leader1Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.Leader1Point AcDbArcDimension::leader2Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.Leader2Point AcDbArcDimension::setArcEndParam Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcEndParam AcDbArcDimension::setArcPoint Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcPoint AcDbArcDimension::setArcStartParam Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcStartParam AcDbArcDimension::setArcSymbolType Autodesk.AutoCAD.DatabaseServices.ArcDimension.ArcSymbolType AcDbArcDimension::setCenterPoint Autodesk.AutoCAD.DatabaseServices.ArcDimension.CenterPoint AcDbArcDimension::setHasLeader Autodesk.AutoCAD.DatabaseServices.ArcDimension.HasLeader AcDbArcDimension::setIsPartial Autodesk.AutoCAD.DatabaseServices.ArcDimension.IsPartial AcDbArcDimension::setLeader1Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.Leader1Point AcDbArcDimension::setLeader2Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.Leader2Point AcDbArcDimension::setXLine1Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.XLine1Point AcDbArcDimension::setXLine2Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.XLine2Point AcDbArcDimension::xLine1Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.XLine1Point AcDbArcDimension::xLine2Point Autodesk.AutoCAD.DatabaseServices.ArcDimension.XLine2Point acdbAttachXref Autodesk.AutoCAD.DatabaseServices.Database.AttachXref AcDbAttribute::fieldLength Autodesk.AutoCAD.DatabaseServices.AttributeReference.FieldLength [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 469 AcDbAttribute::isConstant Autodesk.AutoCAD.DatabaseServices.AttributeReference.IsConstant AcDbAttribute::isInvisible Autodesk.AutoCAD.DatabaseServices.AttributeReference.Invisible AcDbAttribute::isPreset Autodesk.AutoCAD.DatabaseServices.AttributeReference.IsPreset AcDbAttribute::isVerifiable Autodesk.AutoCAD.DatabaseServices.AttributeReference.IsVerifiable AcDbAttribute::lockPositionInBlock Autodesk.AutoCAD.DatabaseServices.AttributeReference.LockPositionInBlock AcDbAttribute::setAttributeFromBlock Autodesk.AutoCAD.DatabaseServices.AttributeReference.SetAttributeFromBlock AcDbAttribute::setAttributeFromBlock Autodesk.AutoCAD.DatabaseServices.AttributeReference.SetAttributeFromBlock AcDbAttribute::setFieldLength Autodesk.AutoCAD.DatabaseServices.AttributeReference.FieldLength AcDbAttribute::setInvisible Autodesk.AutoCAD.DatabaseServices.AttributeReference.Invisible AcDbAttribute::setTag Autodesk.AutoCAD.DatabaseServices.AttributeReference.Tag AcDbAttribute::tag Autodesk.AutoCAD.DatabaseServices.AttributeReference.Tag AcDbAttributeDefinition::fieldLength Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.FieldLength AcDbAttributeDefinition::isConstant Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Constant AcDbAttributeDefinition::isInvisible Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Invisible AcDbAttributeDefinition::isPreset Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Preset AcDbAttributeDefinition::isVerifiable Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Verifiable AcDbAttributeDefinition::lockPositionInBlock Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.LockPositionInBlock AcDbAttributeDefinition::prompt Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Prompt AcDbAttributeDefinition::setConstant Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Constant AcDbAttributeDefinition::setFieldLength Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.FieldLength AcDbAttributeDefinition::setInvisible Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Invisible AcDbAttributeDefinition::setLockPositionInBlock Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.LockPositionInBlock AcDbAttributeDefinition::setPreset Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Preset AcDbAttributeDefinition::setPrompt Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Prompt AcDbAttributeDefinition::setTag Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Tag AcDbAttributeDefinition::setVerifiable Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Verifiable AcDbAttributeDefinition::tag Autodesk.AutoCAD.DatabaseServices.AttributeDefinition.Tag AcDbAuditInfo::auditPass Autodesk.AutoCAD.DatabaseServices.AuditInfo.AuditPass AcDbAuditInfo::errorsFixed Autodesk.AutoCAD.DatabaseServices.AuditInfo.ErrorsFixed AcDbAuditInfo::errorsFound Autodesk.AutoCAD.DatabaseServices.AuditInfo.ErrorsFound AcDbAuditInfo::fixErrors Autodesk.AutoCAD.DatabaseServices.AuditInfo.FixErrors AcDbAuditInfo::incNumEntities Autodesk.AutoCAD.DatabaseServices.AuditInfo.IncNumEntities AcDbAuditInfo::numEntities Autodesk.AutoCAD.DatabaseServices.AuditInfo.NumEntities AcDbAuditInfo::numErrors Autodesk.AutoCAD.DatabaseServices.AuditInfo.NumErrors AcDbAuditInfo::numFixes Autodesk.AutoCAD.DatabaseServices.AuditInfo.NumFixes AcDbAuditInfo::printError Autodesk.AutoCAD.DatabaseServices.AuditInfo.PrintError AcDbAuditInfo::printError Autodesk.AutoCAD.DatabaseServices.AuditInfo.PrintError AcDbAuditInfo::printNumEntities Autodesk.AutoCAD.DatabaseServices.AuditInfo.PrintNumEntities AcDbAuditInfo::requestRegen Autodesk.AutoCAD.DatabaseServices.AuditInfo.RequestRegen AcDbAuditInfo::resetNumEntities Autodesk.AutoCAD.DatabaseServices.AuditInfo.ResetNumEntities AcDbBlockReference::appendAttribute Autodesk.AutoCAD.DatabaseServices.AttributeCollection.AppendAttribute AcDbBlockReference::attributeIterator Autodesk.AutoCAD.DatabaseServices.AttributeCollection.GetEnumerator AcDbBlockReference::attributeIterator Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Count AcDbBlockReference::attributeIterator Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Item [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 470 AcDbBlockReference::blockTableRecord Autodesk.AutoCAD.DatabaseServices.BlockReference.BlockTableRecord AcDbBlockReference::blockTransform Autodesk.AutoCAD.DatabaseServices.BlockReference.BlockTransform AcDbBlockReference::explodeToOwnerSpace Autodesk.AutoCAD.DatabaseServices.BlockReference.ExplodeToOwnerSpace AcDbBlockReference::geomExtentsBestFit Autodesk.AutoCAD.DatabaseServices.BlockReference.GeometryExtentsBestFit AcDbBlockReference::normal Autodesk.AutoCAD.DatabaseServices.BlockReference.Normal AcDbBlockReference::position Autodesk.AutoCAD.DatabaseServices.BlockReference.Position AcDbBlockReference::rotation Autodesk.AutoCAD.DatabaseServices.BlockReference.Rotation AcDbBlockReference::scaleFactors Autodesk.AutoCAD.DatabaseServices.BlockReference.ScaleFactors AcDbBlockReference::setBlockTableRecord Autodesk.AutoCAD.DatabaseServices.BlockReference.BlockTableRecord AcDbBlockReference::setBlockTransform Autodesk.AutoCAD.DatabaseServices.BlockReference.BlockTransform AcDbBlockReference::setNormal Autodesk.AutoCAD.DatabaseServices.BlockReference.Normal AcDbBlockReference::setPosition Autodesk.AutoCAD.DatabaseServices.BlockReference.Position AcDbBlockReference::setRotation Autodesk.AutoCAD.DatabaseServices.BlockReference.Rotation AcDbBlockReference::setScaleFactors Autodesk.AutoCAD.DatabaseServices.BlockReference.ScaleFactors AcDbBlockReference::treatAsAcDbBlockRefForExplod e Autodesk.AutoCAD.DatabaseServices.BlockReference.TreatAsBlockRefForExplode AcDbBlockTableRecord::appendAcDbEntity Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.AppendEntity AcDbBlockTableRecord::assumeOwnershipOf Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.AssumeOwnershipOf AcDbBlockTableRecord::blockInsertUnits Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Units AcDbBlockTableRecord::blockScaling Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockScaling AcDbBlockTableRecord::comments Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Comments AcDbBlockTableRecord::explodable Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Explodable AcDbBlockTableRecord::getBlockReferenceIds Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.GetBlockReferenceIds AcDbBlockTableRecord::getErasedBlockReferenceIds Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.GetErasedBlockReferenceIds AcDbBlockTableRecord::getLayoutId Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.LayoutId AcDbBlockTableRecord::getSortentsTable Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.DrawOrderTableId AcDbBlockTableRecord::hasAttributeDefinitions Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.HasAttributeDefinitions AcDbBlockTableRecord::hasPreviewIcon Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.HasPreviewIcon AcDbBlockTableRecord::isAnonymous Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsAnonymous AcDbBlockTableRecord::isFromExternalReference Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsFromExternalReference AcDbBlockTableRecord::isFromOverlayReference Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsFromOverlayReference AcDbBlockTableRecord::isLayout Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsLayout AcDbBlockTableRecord::isUnloaded Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsUnloaded AcDbBlockTableRecord::newIterator Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.GetEnumerator AcDbBlockTableRecord::newIterator Autodesk.AutoCAD.Windows.ToolPalette.CustomToolBase.Drop AcDbBlockTableRecord::openBlockBegin Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockBeginId AcDbBlockTableRecord::openBlockEnd Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockEndId AcDbBlockTableRecord::origin Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Origin AcDbBlockTableRecord::pathName Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.PathName AcDbBlockTableRecord::setBlockInsertUnits Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Units AcDbBlockTableRecord::setBlockScaling Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockScaling AcDbBlockTableRecord::setComments Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Comments AcDbBlockTableRecord::setExplodable Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Explodable AcDbBlockTableRecord::setIsUnloaded Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsUnloaded [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 471 AcDbBlockTableRecord::setLayoutId Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.LayoutId AcDbBlockTableRecord::setOrigin Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.Origin AcDbBlockTableRecord::setPathName Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.PathName AcDbBlockTableRecord::xrefDatabase Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.GetXrefDatabase AcDbBlockTableRecord::xrefStatus Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.XrefStatus AcDbBlockTableRecordIterator::done Autodesk.AutoCAD.Windows.ToolPalette.CustomToolBase.Drop AcDbBlockTableRecordIterator::getEntity Autodesk.AutoCAD.Windows.ToolPalette.CustomToolBase.Drop AcDbBody::acisIn Autodesk.AutoCAD.DatabaseServices.Body.AcisIn AcDbBody::acisOut Autodesk.AutoCAD.DatabaseServices.Body.AcisOut AcDbBody::body Autodesk.AutoCAD.DatabaseServices.Body.BodyPtr AcDbBody::isNull Autodesk.AutoCAD.DatabaseServices.Body.IsNull AcDbBody::numChanges Autodesk.AutoCAD.DatabaseServices.Body.NumChanges AcDbBody::setBody Autodesk.AutoCAD.DatabaseServices.Body.BodyPtr AcDbCircle::center Autodesk.AutoCAD.DatabaseServices.Circle.Center AcDbCircle::normal Autodesk.AutoCAD.DatabaseServices.Circle.Normal AcDbCircle::radius Autodesk.AutoCAD.DatabaseServices.Circle.Radius AcDbCircle::setCenter Autodesk.AutoCAD.DatabaseServices.Circle.Center AcDbCircle::setNormal Autodesk.AutoCAD.DatabaseServices.Circle.Normal AcDbCircle::setRadius Autodesk.AutoCAD.DatabaseServices.Circle.Radius AcDbCircle::setThickness Autodesk.AutoCAD.DatabaseServices.Circle.Thickness AcDbCircle::thickness Autodesk.AutoCAD.DatabaseServices.Circle.Thickness acdbCleanUp Autodesk.AutoCAD.Runtime.RuntimeSystem.Terminate AcDbCompositeFilteredBlockIterator::id Autodesk.AutoCAD.DatabaseServices.Filters.CompositeFilteredBlockIterator.Current AcDbCompositeFilteredBlockIterator::newIterator Autodesk.AutoCAD.DatabaseServices.Filters.CompositeFilteredBlockIterator.Create AcDbCompositeFilteredBlockIterator::next Autodesk.AutoCAD.DatabaseServices.Filters.CompositeFilteredBlockIterator.MoveNext AcDbCompositeFilteredBlockIterator::seek Autodesk.AutoCAD.DatabaseServices.Filters.CompositeFilteredBlockIterator.Seek AcDbCompositeFilteredBlockIterator::start Autodesk.AutoCAD.DatabaseServices.Filters.CompositeFilteredBlockIterator.Reset AcDbCurve::extend Autodesk.AutoCAD.DatabaseServices.Curve.Extend AcDbCurve::extend Autodesk.AutoCAD.DatabaseServices.Curve.Extend AcDbCurve::getArea Autodesk.AutoCAD.DatabaseServices.Curve.Area AcDbCurve::getClosestPointTo Autodesk.AutoCAD.DatabaseServices.Curve.GetClosestPointTo AcDbCurve::getClosestPointTo Autodesk.AutoCAD.DatabaseServices.Curve.GetClosestPointTo AcDbCurve::getDistAtParam Autodesk.AutoCAD.DatabaseServices.Curve.GetDistanceAtParameter AcDbCurve::getDistAtPoint Autodesk.AutoCAD.DatabaseServices.Curve.GetDistAtPoint AcDbCurve::getEndParam Autodesk.AutoCAD.DatabaseServices.Curve.EndParam AcDbCurve::getEndPoint Autodesk.AutoCAD.DatabaseServices.Curve.EndPoint AcDbCurve::getFirstDeriv Autodesk.AutoCAD.DatabaseServices.Curve.GetFirstDerivative AcDbCurve::getFirstDeriv Autodesk.AutoCAD.DatabaseServices.Curve.GetFirstDerivative AcDbCurve::getOffsetCurves Autodesk.AutoCAD.DatabaseServices.Curve.GetOffsetCurves AcDbCurve::getOffsetCurvesGivenPlaneNormal Autodesk.AutoCAD.DatabaseServices.Curve.GetOffsetCurvesGivenPlaneNormal AcDbCurve::getOrthoProjectedCurve Autodesk.AutoCAD.DatabaseServices.Curve.GetOrthoProjectedCurve AcDbCurve::getParamAtDist Autodesk.AutoCAD.DatabaseServices.Curve.GetParameterAtDistance AcDbCurve::getParamAtPoint Autodesk.AutoCAD.DatabaseServices.Curve.GetParameterAtPoint AcDbCurve::getPointAtDist Autodesk.AutoCAD.DatabaseServices.Curve.GetPointAtDist [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 472 AcDbCurve::getPointAtParam Autodesk.AutoCAD.DatabaseServices.Curve.GetPointAtParameter AcDbCurve::getProjectedCurve Autodesk.AutoCAD.DatabaseServices.Curve.GetProjectedCurve AcDbCurve::getSecondDeriv Autodesk.AutoCAD.DatabaseServices.Curve.GetSecondDerivative AcDbCurve::getSecondDeriv Autodesk.AutoCAD.DatabaseServices.Curve.GetSecondDerivative AcDbCurve::getSpline Autodesk.AutoCAD.DatabaseServices.Curve.Spline AcDbCurve::getSplitCurves Autodesk.AutoCAD.DatabaseServices.Curve.GetSplitCurves AcDbCurve::getSplitCurves Autodesk.AutoCAD.DatabaseServices.Curve.GetSplitCurves AcDbCurve::getStartParam Autodesk.AutoCAD.DatabaseServices.Curve.StartParam AcDbCurve::getStartPoint Autodesk.AutoCAD.DatabaseServices.Curve.StartPoint AcDbCurve::isClosed Autodesk.AutoCAD.DatabaseServices.Curve.Closed AcDbCurve::isPeriodic Autodesk.AutoCAD.DatabaseServices.Curve.IsPeriodic acdbCustomOsnapManager Autodesk.AutoCAD.DatabaseServices.CustomObjectSnapMode.GlyphSize acdbCustomOsnapManager Autodesk.AutoCAD.DatabaseServices.CustomObjectSnapMode.ApplyToEntityType acdbCustomOsnapManager Autodesk.AutoCAD.DatabaseServices.CustomObjectSnapMode.RemoveFromEntityType acdbCustomOsnapManager Autodesk.AutoCAD.DatabaseServices.CustomObjectSnapMode.Activate acdbCustomOsnapManager Autodesk.AutoCAD.DatabaseServices.CustomObjectSnapMode.Deactivate acdbCustomOsnapManager Autodesk.AutoCAD.DatabaseServices.CustomObjectSnapMode.IsActive AcDbDatabase:: Autodesk.AutoCAD.DatabaseServices.Database.AcadDatabase AcDbDatabase::abortDeepClone Autodesk.AutoCAD.DatabaseServices.Database.AbortDeepClone AcDbDatabase::addAcDbObject Autodesk.AutoCAD.DatabaseServices.Database.AddDBObject AcDbDatabase::angbase Autodesk.AutoCAD.DatabaseServices.Database.Angbase AcDbDatabase::angdir Autodesk.AutoCAD.DatabaseServices.Database.Angdir AcDbDatabase::applyPartialOpenFilters Autodesk.AutoCAD.DatabaseServices.Database.ApplyPartialOpenFilters AcDbDatabase::approxNumObjects Autodesk.AutoCAD.DatabaseServices.Database.ApproxNumObjects AcDbDatabase::attmode Autodesk.AutoCAD.DatabaseServices.Database.Attmode AcDbDatabase::audit Autodesk.AutoCAD.DatabaseServices.Database.Audit AcDbDatabase::auditXData Autodesk.AutoCAD.DatabaseServices.Database.AuditXData AcDbDatabase::aunits Autodesk.AutoCAD.DatabaseServices.Database.Aunits AcDbDatabase::auprec Autodesk.AutoCAD.DatabaseServices.Database.Auprec AcDbDatabase::blockTableId Autodesk.AutoCAD.DatabaseServices.Database.BlockTableId AcDbDatabase::byBlockLinetype Autodesk.AutoCAD.DatabaseServices.Database.ByBlockLinetype AcDbDatabase::byLayerLinetype Autodesk.AutoCAD.DatabaseServices.Database.ByLayerLinetype AcDbDatabase::cecolor Autodesk.AutoCAD.DatabaseServices.Database.Cecolor AcDbDatabase::celtscale Autodesk.AutoCAD.DatabaseServices.Database.Celtscale AcDbDatabase::celtype Autodesk.AutoCAD.DatabaseServices.Database.Celtype AcDbDatabase::celweight Autodesk.AutoCAD.DatabaseServices.Database.Celweight AcDbDatabase::chamfera Autodesk.AutoCAD.DatabaseServices.Database.Chamfera AcDbDatabase::chamferb Autodesk.AutoCAD.DatabaseServices.Database.Chamferb AcDbDatabase::chamferc Autodesk.AutoCAD.DatabaseServices.Database.Chamferc AcDbDatabase::chamferd Autodesk.AutoCAD.DatabaseServices.Database.Chamferd AcDbDatabase::classDxfName Autodesk.AutoCAD.DatabaseServices.Database.ClassDxfName AcDbDatabase::clayer Autodesk.AutoCAD.DatabaseServices.Database.Clayer AcDbDatabase::cloneSecurityParams Autodesk.AutoCAD.DatabaseServices.Database.SecurityParameters AcDbDatabase::closeInput Autodesk.AutoCAD.DatabaseServices.Database.CloseInput [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 473 AcDbDatabase::cmljust Autodesk.AutoCAD.DatabaseServices.Database.Cmljust AcDbDatabase::cmlscale Autodesk.AutoCAD.DatabaseServices.Database.Cmlscale AcDbDatabase::cmlstyleID Autodesk.AutoCAD.DatabaseServices.Database.CmlstyleID AcDbDatabase::colorDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.ColorDictionaryId AcDbDatabase::continuousLinetype Autodesk.AutoCAD.DatabaseServices.Database.ContinuousLinetype AcDbDatabase::countHardReferences Autodesk.AutoCAD.DatabaseServices.Database.CountHardReferences AcDbDatabase::currentSpaceId Autodesk.AutoCAD.DatabaseServices.Database.CurrentSpaceId AcDbDatabase::deepCloneObjects Autodesk.AutoCAD.DatabaseServices.Database.DeepCloneObjects AcDbDatabase::dimadec Autodesk.AutoCAD.DatabaseServices.Database.Dimadec AcDbDatabase::dimaltd Autodesk.AutoCAD.DatabaseServices.Database.Dimaltd AcDbDatabase::dimaltf Autodesk.AutoCAD.DatabaseServices.Database.Dimaltf AcDbDatabase::dimaltrnd Autodesk.AutoCAD.DatabaseServices.Database.Dimaltrnd AcDbDatabase::dimalttd Autodesk.AutoCAD.DatabaseServices.Database.Dimalttd AcDbDatabase::dimalttz Autodesk.AutoCAD.DatabaseServices.Database.Dimalttz AcDbDatabase::dimaltu Autodesk.AutoCAD.DatabaseServices.Database.Dimaltu AcDbDatabase::dimaltz Autodesk.AutoCAD.DatabaseServices.Database.Dimaltz AcDbDatabase::dimapost Autodesk.AutoCAD.DatabaseServices.Database.Dimapost AcDbDatabase::dimaso Autodesk.AutoCAD.DatabaseServices.Database.Dimaso AcDbDatabase::dimAssoc Autodesk.AutoCAD.DatabaseServices.Database.DimAssoc AcDbDatabase::dimasz Autodesk.AutoCAD.DatabaseServices.Database.Dimasz AcDbDatabase::dimatfit Autodesk.AutoCAD.DatabaseServices.Database.Dimatfit AcDbDatabase::dimaunit Autodesk.AutoCAD.DatabaseServices.Database.Dimaunit AcDbDatabase::dimazin Autodesk.AutoCAD.DatabaseServices.Database.Dimazin AcDbDatabase::dimblk Autodesk.AutoCAD.DatabaseServices.Database.Dimblk AcDbDatabase::dimblk1 Autodesk.AutoCAD.DatabaseServices.Database.Dimblk1 AcDbDatabase::dimblk2 Autodesk.AutoCAD.DatabaseServices.Database.Dimblk2 AcDbDatabase::dimcen Autodesk.AutoCAD.DatabaseServices.Database.Dimcen AcDbDatabase::dimclrd Autodesk.AutoCAD.DatabaseServices.Database.Dimclrd AcDbDatabase::dimclre Autodesk.AutoCAD.DatabaseServices.Database.Dimclre AcDbDatabase::dimclrt Autodesk.AutoCAD.DatabaseServices.Database.Dimclrt AcDbDatabase::dimdec Autodesk.AutoCAD.DatabaseServices.Database.Dimdec AcDbDatabase::dimdle Autodesk.AutoCAD.DatabaseServices.Database.Dimdle AcDbDatabase::dimdli Autodesk.AutoCAD.DatabaseServices.Database.Dimdli AcDbDatabase::dimdsep Autodesk.AutoCAD.DatabaseServices.Database.Dimdsep AcDbDatabase::dimexe Autodesk.AutoCAD.DatabaseServices.Database.Dimexe AcDbDatabase::dimexo Autodesk.AutoCAD.DatabaseServices.Database.Dimexo AcDbDatabase::dimfrac Autodesk.AutoCAD.DatabaseServices.Database.Dimfrac AcDbDatabase::dimgap Autodesk.AutoCAD.DatabaseServices.Database.Dimgap AcDbDatabase::dimjust Autodesk.AutoCAD.DatabaseServices.Database.Dimjust AcDbDatabase::dimldrblk Autodesk.AutoCAD.DatabaseServices.Database.Dimldrblk AcDbDatabase::dimlfac Autodesk.AutoCAD.DatabaseServices.Database.Dimlfac AcDbDatabase::dimlunit Autodesk.AutoCAD.DatabaseServices.Database.Dimlunit AcDbDatabase::dimlwd Autodesk.AutoCAD.DatabaseServices.Database.Dimlwd AcDbDatabase::dimlwe Autodesk.AutoCAD.DatabaseServices.Database.Dimlwe [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 474 AcDbDatabase::dimpost Autodesk.AutoCAD.DatabaseServices.Database.Dimpost AcDbDatabase::dimrnd Autodesk.AutoCAD.DatabaseServices.Database.Dimrnd AcDbDatabase::dimscale Autodesk.AutoCAD.DatabaseServices.Database.Dimscale AcDbDatabase::dimsho Autodesk.AutoCAD.DatabaseServices.Database.Dimsho AcDbDatabase::dimstyle Autodesk.AutoCAD.DatabaseServices.Database.Dimstyle AcDbDatabase::dimStyleTableId Autodesk.AutoCAD.DatabaseServices.Database.DimStyleTableId AcDbDatabase::dimtad Autodesk.AutoCAD.DatabaseServices.Database.Dimtad AcDbDatabase::dimtdec Autodesk.AutoCAD.DatabaseServices.Database.Dimtdec AcDbDatabase::dimtfac Autodesk.AutoCAD.DatabaseServices.Database.Dimtfac AcDbDatabase::dimtm Autodesk.AutoCAD.DatabaseServices.Database.Dimtm AcDbDatabase::dimtmove Autodesk.AutoCAD.DatabaseServices.Database.Dimtmove AcDbDatabase::dimtolj Autodesk.AutoCAD.DatabaseServices.Database.Dimtolj AcDbDatabase::dimtp Autodesk.AutoCAD.DatabaseServices.Database.Dimtp AcDbDatabase::dimtsz Autodesk.AutoCAD.DatabaseServices.Database.Dimtsz AcDbDatabase::dimtvp Autodesk.AutoCAD.DatabaseServices.Database.Dimtvp AcDbDatabase::dimtxsty Autodesk.AutoCAD.DatabaseServices.Database.Dimtxsty AcDbDatabase::dimtxt Autodesk.AutoCAD.DatabaseServices.Database.Dimtxt AcDbDatabase::dimtzin Autodesk.AutoCAD.DatabaseServices.Database.Dimtzin AcDbDatabase::dimzin Autodesk.AutoCAD.DatabaseServices.Database.Dimzin AcDbDatabase::disablePartialOpen Autodesk.AutoCAD.DatabaseServices.Database.DisablePartialOpen AcDbDatabase::disableUndoRecording Autodesk.AutoCAD.DatabaseServices.Database.DisableUndoRecording AcDbDatabase::disposeSecurityParams Autodesk.AutoCAD.DatabaseServices.Database.SecurityParameters AcDbDatabase::dispSilh Autodesk.AutoCAD.DatabaseServices.Database.DispSilh AcDbDatabase::drawOrderCtl Autodesk.AutoCAD.DatabaseServices.Database.DrawOrderCtl AcDbDatabase::dwgFileWasSavedByAutodeskSoftwar e Autodesk.AutoCAD.DatabaseServices.Database.DwgFileWasSavedByAutodeskSoftware AcDbDatabase::dxfIn Autodesk.AutoCAD.DatabaseServices.Database.DxfIn AcDbDatabase::dxfOut Autodesk.AutoCAD.DatabaseServices.Database.DxfOut AcDbDatabase::elevation Autodesk.AutoCAD.DatabaseServices.Database.Elevation AcDbDatabase::endCaps Autodesk.AutoCAD.DatabaseServices.Database.EndCaps AcDbDatabase::extmax Autodesk.AutoCAD.DatabaseServices.Database.Extmax AcDbDatabase::extmin Autodesk.AutoCAD.DatabaseServices.Database.Extmin AcDbDatabase::facetres Autodesk.AutoCAD.DatabaseServices.Database.Facetres AcDbDatabase::fileDependencyManager Autodesk.AutoCAD.DatabaseServices.Database.FileDependencyManager AcDbDatabase::filletrad Autodesk.AutoCAD.DatabaseServices.Database.Filletrad AcDbDatabase::fillmode Autodesk.AutoCAD.DatabaseServices.Database.Fillmode AcDbDatabase::forceWblockDatabaseCopy Autodesk.AutoCAD.DatabaseServices.Database.ForceWblockDatabaseCopy AcDbDatabase::getAcDbObjectId Autodesk.AutoCAD.DatabaseServices.Database.GetObjectId AcDbDatabase::getCePlotStyleNameId Autodesk.AutoCAD.DatabaseServices.Database.PlotStyleNameId AcDbDatabase::getDimRecentStyleList Autodesk.AutoCAD.DatabaseServices.Database.GetDimRecentStyleList AcDbDatabase::getDimstyleChildData Autodesk.AutoCAD.DatabaseServices.Database.GetDimensionStyleChildData AcDbDatabase::getDimstyleChildId Autodesk.AutoCAD.DatabaseServices.Database.GetDimensionStyleChildId AcDbDatabase::getDimstyleData Autodesk.AutoCAD.DatabaseServices.Database.DimstyleData AcDbDatabase::getDimstyleParentId Autodesk.AutoCAD.DatabaseServices.Database.GetDimensionStyleParentId [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 475 AcDbDatabase::getFilename Autodesk.AutoCAD.DatabaseServices.Database.Filename AcDbDatabase::getFingerprintGuid Autodesk.AutoCAD.DatabaseServices.Database.FingerprintGuid AcDbDatabase::getHyperlinkBase Autodesk.AutoCAD.DatabaseServices.Database.HyperlinkBase AcDbDatabase::getLayerStateManager Autodesk.AutoCAD.DatabaseServices.Database.LayerStateManager AcDbDatabase::getMenu Autodesk.AutoCAD.DatabaseServices.Database.Menu AcDbDatabase::GetModuleHandleA Autodesk.AutoCAD.DatabaseServices.Database.AcadDatabase AcDbDatabase::getNearestLineWeight Autodesk.AutoCAD.DatabaseServices.Database.GetNearestLineWeight AcDbDatabase::getProjectName Autodesk.AutoCAD.DatabaseServices.Database.ProjectName AcDbDatabase::getStyleSheet Autodesk.AutoCAD.DatabaseServices.Database.StyleSheet AcDbDatabase::getVersionGuid Autodesk.AutoCAD.DatabaseServices.Database.VersionGuid AcDbDatabase::groupDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.GroupDictionaryId AcDbDatabase::haloGap Autodesk.AutoCAD.DatabaseServices.Database.HaloGap AcDbDatabase::handseed Autodesk.AutoCAD.DatabaseServices.Database.Handseed AcDbDatabase::hideText Autodesk.AutoCAD.DatabaseServices.Database.HideText AcDbDatabase::insbase Autodesk.AutoCAD.DatabaseServices.Database.Insbase AcDbDatabase::insert Autodesk.AutoCAD.DatabaseServices.Database.Insert AcDbDatabase::insert Autodesk.AutoCAD.DatabaseServices.Database.Insert AcDbDatabase::insert Autodesk.AutoCAD.DatabaseServices.Database.Insert AcDbDatabase::insunits Autodesk.AutoCAD.DatabaseServices.Database.Insunits AcDbDatabase::intersectColor Autodesk.AutoCAD.DatabaseServices.Database.IntersectColor AcDbDatabase::intersectDisplay Autodesk.AutoCAD.DatabaseServices.Database.IntersectDisplay AcDbDatabase::isEMR Autodesk.AutoCAD.DatabaseServices.Database.IsEmr AcDbDatabase::isolines Autodesk.AutoCAD.DatabaseServices.Database.Isolines AcDbDatabase::isPartiallyOpened Autodesk.AutoCAD.DatabaseServices.Database.IsPartiallyOpened AcDbDatabase::isPucsOrthographic Autodesk.AutoCAD.DatabaseServices.Database.PucsOrthographic AcDbDatabase::isUcsOrthographic Autodesk.AutoCAD.DatabaseServices.Database.UcsOrthographic AcDbDatabase::isValidLineWeight Autodesk.AutoCAD.DatabaseServices.Database.IsValidLineWeight AcDbDatabase::joinStyle Autodesk.AutoCAD.DatabaseServices.Database.JoinStyle AcDbDatabase::lastSavedAsMaintenanceVersion Autodesk.AutoCAD.DatabaseServices.Database.LastSavedAsMaintenanceVersion AcDbDatabase::lastSavedAsVersion Autodesk.AutoCAD.DatabaseServices.Database.LastSavedAsVersion AcDbDatabase::layerTableId Autodesk.AutoCAD.DatabaseServices.Database.LayerTableId AcDbDatabase::layerZero Autodesk.AutoCAD.DatabaseServices.Database.LayerZero AcDbDatabase::layoutDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.LayoutDictionaryId AcDbDatabase::limcheck Autodesk.AutoCAD.DatabaseServices.Database.Limcheck AcDbDatabase::limmax Autodesk.AutoCAD.DatabaseServices.Database.Limmax AcDbDatabase::limmin Autodesk.AutoCAD.DatabaseServices.Database.Limmin AcDbDatabase::linetypeTableId Autodesk.AutoCAD.DatabaseServices.Database.LinetypeTableId AcDbDatabase::lineWeightDisplay Autodesk.AutoCAD.DatabaseServices.Database.LineWeightDisplay AcDbDatabase::loadLineTypeFile Autodesk.AutoCAD.DatabaseServices.Database.LoadLineTypeFile AcDbDatabase::ltscale Autodesk.AutoCAD.DatabaseServices.Database.Ltscale AcDbDatabase::lunits Autodesk.AutoCAD.DatabaseServices.Database.Lunits AcDbDatabase::luprec Autodesk.AutoCAD.DatabaseServices.Database.Luprec AcDbDatabase::maintenanceReleaseVersion Autodesk.AutoCAD.DatabaseServices.Database.MaintenanceReleaseVersion AcDbDatabase::materialDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.MaterialDictionaryId [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 476 AcDbDatabase::maxactvp Autodesk.AutoCAD.DatabaseServices.Database.Maxactvp AcDbDatabase::measurement Autodesk.AutoCAD.DatabaseServices.Database.Measurement AcDbDatabase::mirrtext Autodesk.AutoCAD.DatabaseServices.Database.Mirrtext AcDbDatabase::mLStyleDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.MLStyleDictionaryId AcDbDatabase::namedObjectsDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.NamedObjectsDictionaryId AcDbDatabase::numberOfSaves Autodesk.AutoCAD.DatabaseServices.Database.NumberOfSaves AcDbDatabase::obscuredColor Autodesk.AutoCAD.DatabaseServices.Database.ObscuredColor AcDbDatabase::obscuredLineType Autodesk.AutoCAD.DatabaseServices.Database.ObscuredLineType AcDbDatabase::oleStartUp Autodesk.AutoCAD.DatabaseServices.Database.OleStartUp AcDbDatabase::originalFileMaintenanceVersion Autodesk.AutoCAD.DatabaseServices.Database.OriginalFileMaintenanceVersion AcDbDatabase::originalFileName Autodesk.AutoCAD.DatabaseServices.Database.OriginalFileName AcDbDatabase::originalFileSavedByMaintenanceVersi on Autodesk.AutoCAD.DatabaseServices.Database.OriginalFileSavedByMaintenanceVersion AcDbDatabase::originalFileSavedByVersion Autodesk.AutoCAD.DatabaseServices.Database.OriginalFileSavedByVersion AcDbDatabase::originalFileVersion Autodesk.AutoCAD.DatabaseServices.Database.OriginalFileVersion AcDbDatabase::orthomode Autodesk.AutoCAD.DatabaseServices.Database.Orthomode AcDbDatabase::paperSpaceVportId Autodesk.AutoCAD.DatabaseServices.Database.PaperSpaceVportId AcDbDatabase::pdmode Autodesk.AutoCAD.DatabaseServices.Database.Pdmode AcDbDatabase::pdsize Autodesk.AutoCAD.DatabaseServices.Database.Pdsize AcDbDatabase::pelevation Autodesk.AutoCAD.DatabaseServices.Database.Pelevation AcDbDatabase::pextmax Autodesk.AutoCAD.DatabaseServices.Database.Pextmax AcDbDatabase::pextmin Autodesk.AutoCAD.DatabaseServices.Database.Pextmin AcDbDatabase::pinsbase Autodesk.AutoCAD.DatabaseServices.Database.Pinsbase AcDbDatabase::plimcheck Autodesk.AutoCAD.DatabaseServices.Database.Plimcheck AcDbDatabase::plimmax Autodesk.AutoCAD.DatabaseServices.Database.Plimmax AcDbDatabase::plimmin Autodesk.AutoCAD.DatabaseServices.Database.Plimmin AcDbDatabase::plineEllipse Autodesk.AutoCAD.DatabaseServices.Database.PlineEllipse AcDbDatabase::plinegen Autodesk.AutoCAD.DatabaseServices.Database.Plinegen AcDbDatabase::plinewid Autodesk.AutoCAD.DatabaseServices.Database.Plinewid AcDbDatabase::plotSettingsDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.PlotSettingsDictionaryId AcDbDatabase::plotStyleMode Autodesk.AutoCAD.DatabaseServices.Database.PlotStyleMode AcDbDatabase::plotStyleNameDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.PlotStyleNameDictionaryId AcDbDatabase::psltscale Autodesk.AutoCAD.DatabaseServices.Database.Psltscale AcDbDatabase::pucsBase Autodesk.AutoCAD.DatabaseServices.Database.PucsBase AcDbDatabase::pucsname Autodesk.AutoCAD.DatabaseServices.Database.Pucsname AcDbDatabase::pucsorg Autodesk.AutoCAD.DatabaseServices.Database.Pucsorg AcDbDatabase::pucsxdir Autodesk.AutoCAD.DatabaseServices.Database.Pucsxdir AcDbDatabase::pucsydir Autodesk.AutoCAD.DatabaseServices.Database.Pucsydir AcDbDatabase::purge Autodesk.AutoCAD.DatabaseServices.Database.Purge AcDbDatabase::purge Autodesk.AutoCAD.DatabaseServices.Database.Purge AcDbDatabase::qtextmode Autodesk.AutoCAD.DatabaseServices.Database.Qtextmode AcDbDatabase::readDwgFile Autodesk.AutoCAD.DatabaseServices.Database.ReadDwgFile AcDbDatabase::readDwgFile Autodesk.AutoCAD.DatabaseServices.Database.ReadDwgFile AcDbDatabase::readDwgFile Autodesk.AutoCAD.Windows.ToolPalette.CustomToolBase.Drop [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 477 AcDbDatabase::regAppTableId Autodesk.AutoCAD.DatabaseServices.Database.RegAppTableId AcDbDatabase::regenmode Autodesk.AutoCAD.DatabaseServices.Database.Regenmode AcDbDatabase::restoreForwardingXrefSymbols Autodesk.AutoCAD.DatabaseServices.Database.RestoreForwardingXrefSymbols AcDbDatabase::restoreOriginalXrefSymbols Autodesk.AutoCAD.DatabaseServices.Database.RestoreOriginalXrefSymbols AcDbDatabase::retainOriginalThumbnailBitmap Autodesk.AutoCAD.DatabaseServices.Database.RetainOriginalThumbnailBitmap AcDbDatabase::save Autodesk.AutoCAD.DatabaseServices.Database.Save AcDbDatabase::saveAs Autodesk.AutoCAD.DatabaseServices.Database.SaveAs AcDbDatabase::saveAs Autodesk.AutoCAD.DatabaseServices.Database.SaveAs AcDbDatabase::saveproxygraphics Autodesk.AutoCAD.DatabaseServices.Database.Saveproxygraphics AcDbDatabase::setAngbase Autodesk.AutoCAD.DatabaseServices.Database.Angbase AcDbDatabase::setAngdir Autodesk.AutoCAD.DatabaseServices.Database.Angdir AcDbDatabase::setAttmode Autodesk.AutoCAD.DatabaseServices.Database.Attmode AcDbDatabase::setAunits Autodesk.AutoCAD.DatabaseServices.Database.Aunits AcDbDatabase::setAuprec Autodesk.AutoCAD.DatabaseServices.Database.Auprec AcDbDatabase::setCecolor Autodesk.AutoCAD.DatabaseServices.Database.Cecolor AcDbDatabase::setCeltscale Autodesk.AutoCAD.DatabaseServices.Database.Celtscale AcDbDatabase::setCeltype Autodesk.AutoCAD.DatabaseServices.Database.Celtype AcDbDatabase::setCelweight Autodesk.AutoCAD.DatabaseServices.Database.Celweight AcDbDatabase::setCePlotStyleName Autodesk.AutoCAD.DatabaseServices.Database.PlotStyleNameId AcDbDatabase::setChamfera Autodesk.AutoCAD.DatabaseServices.Database.Chamfera AcDbDatabase::setChamferb Autodesk.AutoCAD.DatabaseServices.Database.Chamferb AcDbDatabase::setChamferc Autodesk.AutoCAD.DatabaseServices.Database.Chamferc AcDbDatabase::setChamferd Autodesk.AutoCAD.DatabaseServices.Database.Chamferd AcDbDatabase::setClayer Autodesk.AutoCAD.DatabaseServices.Database.Clayer AcDbDatabase::setCmljust Autodesk.AutoCAD.DatabaseServices.Database.Cmljust AcDbDatabase::setCmlscale Autodesk.AutoCAD.DatabaseServices.Database.Cmlscale AcDbDatabase::setCmlstyleID Autodesk.AutoCAD.DatabaseServices.Database.CmlstyleID AcDbDatabase::setDimadec Autodesk.AutoCAD.DatabaseServices.Database.Dimadec AcDbDatabase::setDimalt Autodesk.AutoCAD.DatabaseServices.Database.Dimalt AcDbDatabase::setDimaltd Autodesk.AutoCAD.DatabaseServices.Database.Dimaltd AcDbDatabase::setDimaltf Autodesk.AutoCAD.DatabaseServices.Database.Dimaltf AcDbDatabase::setDimaltrnd Autodesk.AutoCAD.DatabaseServices.Database.Dimaltrnd AcDbDatabase::setDimalttd Autodesk.AutoCAD.DatabaseServices.Database.Dimalttd AcDbDatabase::setDimalttz Autodesk.AutoCAD.DatabaseServices.Database.Dimalttz AcDbDatabase::setDimaltu Autodesk.AutoCAD.DatabaseServices.Database.Dimaltu AcDbDatabase::setDimaltz Autodesk.AutoCAD.DatabaseServices.Database.Dimaltz AcDbDatabase::setDimapost Autodesk.AutoCAD.DatabaseServices.Database.Dimapost AcDbDatabase::setDimaso Autodesk.AutoCAD.DatabaseServices.Database.Dimaso AcDbDatabase::setDimAssoc Autodesk.AutoCAD.DatabaseServices.Database.DimAssoc AcDbDatabase::setDimasz Autodesk.AutoCAD.DatabaseServices.Database.Dimasz AcDbDatabase::setDimatfit Autodesk.AutoCAD.DatabaseServices.Database.Dimatfit AcDbDatabase::setDimaunit Autodesk.AutoCAD.DatabaseServices.Database.Dimaunit AcDbDatabase::setDimazin Autodesk.AutoCAD.DatabaseServices.Database.Dimazin AcDbDatabase::setDimblk Autodesk.AutoCAD.DatabaseServices.Database.Dimblk [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 478 AcDbDatabase::setDimblk1 Autodesk.AutoCAD.DatabaseServices.Database.Dimblk1 AcDbDatabase::setDimblk2 Autodesk.AutoCAD.DatabaseServices.Database.Dimblk2 AcDbDatabase::setDimcen Autodesk.AutoCAD.DatabaseServices.Database.Dimcen AcDbDatabase::setDimclrd Autodesk.AutoCAD.DatabaseServices.Database.Dimclrd AcDbDatabase::setDimclre Autodesk.AutoCAD.DatabaseServices.Database.Dimclre AcDbDatabase::setDimclrt Autodesk.AutoCAD.DatabaseServices.Database.Dimclrt AcDbDatabase::setDimdec Autodesk.AutoCAD.DatabaseServices.Database.Dimdec AcDbDatabase::setDimdle Autodesk.AutoCAD.DatabaseServices.Database.Dimdle AcDbDatabase::setDimdli Autodesk.AutoCAD.DatabaseServices.Database.Dimdli AcDbDatabase::setDimdsep Autodesk.AutoCAD.DatabaseServices.Database.Dimdsep AcDbDatabase::setDimexe Autodesk.AutoCAD.DatabaseServices.Database.Dimexe AcDbDatabase::setDimexo Autodesk.AutoCAD.DatabaseServices.Database.Dimexo AcDbDatabase::setDimfrac Autodesk.AutoCAD.DatabaseServices.Database.Dimfrac AcDbDatabase::setDimgap Autodesk.AutoCAD.DatabaseServices.Database.Dimgap AcDbDatabase::setDimjust Autodesk.AutoCAD.DatabaseServices.Database.Dimjust AcDbDatabase::setDimldrblk Autodesk.AutoCAD.DatabaseServices.Database.Dimldrblk AcDbDatabase::setDimlfac Autodesk.AutoCAD.DatabaseServices.Database.Dimlfac AcDbDatabase::setDimlim Autodesk.AutoCAD.DatabaseServices.Database.Dimlim AcDbDatabase::setDimlunit Autodesk.AutoCAD.DatabaseServices.Database.Dimlunit AcDbDatabase::setDimlwd Autodesk.AutoCAD.DatabaseServices.Database.Dimlwd AcDbDatabase::setDimlwe Autodesk.AutoCAD.DatabaseServices.Database.Dimlwe AcDbDatabase::setDimpost Autodesk.AutoCAD.DatabaseServices.Database.Dimpost AcDbDatabase::setDimrnd Autodesk.AutoCAD.DatabaseServices.Database.Dimrnd AcDbDatabase::setDimsah Autodesk.AutoCAD.DatabaseServices.Database.Dimsah AcDbDatabase::setDimscale Autodesk.AutoCAD.DatabaseServices.Database.Dimscale AcDbDatabase::setDimsd1 Autodesk.AutoCAD.DatabaseServices.Database.Dimsd1 AcDbDatabase::setDimsd2 Autodesk.AutoCAD.DatabaseServices.Database.Dimsd2 AcDbDatabase::setDimse1 Autodesk.AutoCAD.DatabaseServices.Database.Dimse1 AcDbDatabase::setDimse2 Autodesk.AutoCAD.DatabaseServices.Database.Dimse2 AcDbDatabase::setDimsho Autodesk.AutoCAD.DatabaseServices.Database.Dimsho AcDbDatabase::setDimsoxd Autodesk.AutoCAD.DatabaseServices.Database.Dimsoxd AcDbDatabase::setDimstyle Autodesk.AutoCAD.DatabaseServices.Database.Dimstyle AcDbDatabase::setDimstyleData Autodesk.AutoCAD.DatabaseServices.Database.DimstyleData AcDbDatabase::setDimtad Autodesk.AutoCAD.DatabaseServices.Database.Dimtad AcDbDatabase::setDimtdec Autodesk.AutoCAD.DatabaseServices.Database.Dimtdec AcDbDatabase::setDimtfac Autodesk.AutoCAD.DatabaseServices.Database.Dimtfac AcDbDatabase::setDimtih Autodesk.AutoCAD.DatabaseServices.Database.Dimtih AcDbDatabase::setDimtix Autodesk.AutoCAD.DatabaseServices.Database.Dimtix AcDbDatabase::setDimtm Autodesk.AutoCAD.DatabaseServices.Database.Dimtm AcDbDatabase::setDimtmove Autodesk.AutoCAD.DatabaseServices.Database.Dimtmove AcDbDatabase::setDimtofl Autodesk.AutoCAD.DatabaseServices.Database.Dimtofl AcDbDatabase::setDimtoh Autodesk.AutoCAD.DatabaseServices.Database.Dimtoh AcDbDatabase::setDimtol Autodesk.AutoCAD.DatabaseServices.Database.Dimtol AcDbDatabase::setDimtolj Autodesk.AutoCAD.DatabaseServices.Database.Dimtolj [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 479 AcDbDatabase::setDimtp Autodesk.AutoCAD.DatabaseServices.Database.Dimtp AcDbDatabase::setDimtsz Autodesk.AutoCAD.DatabaseServices.Database.Dimtsz AcDbDatabase::setDimtvp Autodesk.AutoCAD.DatabaseServices.Database.Dimtvp AcDbDatabase::setDimtxsty Autodesk.AutoCAD.DatabaseServices.Database.Dimtxsty AcDbDatabase::setDimtxt Autodesk.AutoCAD.DatabaseServices.Database.Dimtxt AcDbDatabase::setDimtzin Autodesk.AutoCAD.DatabaseServices.Database.Dimtzin AcDbDatabase::setDimupt Autodesk.AutoCAD.DatabaseServices.Database.Dimupt AcDbDatabase::setDimzin Autodesk.AutoCAD.DatabaseServices.Database.Dimzin AcDbDatabase::setDispSilh Autodesk.AutoCAD.DatabaseServices.Database.DispSilh AcDbDatabase::setDrawOrderCtl Autodesk.AutoCAD.DatabaseServices.Database.DrawOrderCtl AcDbDatabase::setElevation Autodesk.AutoCAD.DatabaseServices.Database.Elevation AcDbDatabase::setEndCaps Autodesk.AutoCAD.DatabaseServices.Database.EndCaps AcDbDatabase::setExtmax Autodesk.AutoCAD.DatabaseServices.Database.Extmax AcDbDatabase::setExtmin Autodesk.AutoCAD.DatabaseServices.Database.Extmin AcDbDatabase::setFacetres Autodesk.AutoCAD.DatabaseServices.Database.Facetres AcDbDatabase::setFilletrad Autodesk.AutoCAD.DatabaseServices.Database.Filletrad AcDbDatabase::setFillmode Autodesk.AutoCAD.DatabaseServices.Database.Fillmode AcDbDatabase::setFingerprintGuid Autodesk.AutoCAD.DatabaseServices.Database.FingerprintGuid AcDbDatabase::setHaloGap Autodesk.AutoCAD.DatabaseServices.Database.HaloGap AcDbDatabase::setHandseed Autodesk.AutoCAD.DatabaseServices.Database.Handseed AcDbDatabase::setHideText Autodesk.AutoCAD.DatabaseServices.Database.HideText AcDbDatabase::setHyperlinkBase Autodesk.AutoCAD.DatabaseServices.Database.HyperlinkBase AcDbDatabase::setInsbase Autodesk.AutoCAD.DatabaseServices.Database.Insbase AcDbDatabase::setInsunits Autodesk.AutoCAD.DatabaseServices.Database.Insunits AcDbDatabase::setIntersectColor Autodesk.AutoCAD.DatabaseServices.Database.IntersectColor AcDbDatabase::setIntersectDisplay Autodesk.AutoCAD.DatabaseServices.Database.IntersectDisplay AcDbDatabase::setIsolines Autodesk.AutoCAD.DatabaseServices.Database.Isolines AcDbDatabase::setJoinStyle Autodesk.AutoCAD.DatabaseServices.Database.JoinStyle AcDbDatabase::setLimcheck Autodesk.AutoCAD.DatabaseServices.Database.Limcheck AcDbDatabase::setLimmax Autodesk.AutoCAD.DatabaseServices.Database.Limmax AcDbDatabase::setLimmin Autodesk.AutoCAD.DatabaseServices.Database.Limmin AcDbDatabase::setLineWeightDisplay Autodesk.AutoCAD.DatabaseServices.Database.LineWeightDisplay AcDbDatabase::setLtscale Autodesk.AutoCAD.DatabaseServices.Database.Ltscale AcDbDatabase::setLunits Autodesk.AutoCAD.DatabaseServices.Database.Lunits AcDbDatabase::setLuprec Autodesk.AutoCAD.DatabaseServices.Database.Luprec AcDbDatabase::setMaxactvp Autodesk.AutoCAD.DatabaseServices.Database.Maxactvp AcDbDatabase::setMeasurement Autodesk.AutoCAD.DatabaseServices.Database.Measurement AcDbDatabase::setMirrtext Autodesk.AutoCAD.DatabaseServices.Database.Mirrtext AcDbDatabase::setObscuredColor Autodesk.AutoCAD.DatabaseServices.Database.ObscuredColor AcDbDatabase::setObscuredLineType Autodesk.AutoCAD.DatabaseServices.Database.ObscuredLineType AcDbDatabase::setOleStartUp Autodesk.AutoCAD.DatabaseServices.Database.OleStartUp AcDbDatabase::setOrthomode Autodesk.AutoCAD.DatabaseServices.Database.Orthomode AcDbDatabase::setPdmode Autodesk.AutoCAD.DatabaseServices.Database.Pdmode AcDbDatabase::setPdsize Autodesk.AutoCAD.DatabaseServices.Database.Pdsize [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 480 AcDbDatabase::setPelevation Autodesk.AutoCAD.DatabaseServices.Database.Pelevation AcDbDatabase::setPextmax Autodesk.AutoCAD.DatabaseServices.Database.Pextmax AcDbDatabase::setPextmin Autodesk.AutoCAD.DatabaseServices.Database.Pextmin AcDbDatabase::setPinsbase Autodesk.AutoCAD.DatabaseServices.Database.Pinsbase AcDbDatabase::setPlimcheck Autodesk.AutoCAD.DatabaseServices.Database.Plimcheck AcDbDatabase::setPlimmax Autodesk.AutoCAD.DatabaseServices.Database.Plimmax AcDbDatabase::setPlimmin Autodesk.AutoCAD.DatabaseServices.Database.Plimmin AcDbDatabase::setPlineEllipse Autodesk.AutoCAD.DatabaseServices.Database.PlineEllipse AcDbDatabase::setPlinegen Autodesk.AutoCAD.DatabaseServices.Database.Plinegen AcDbDatabase::setPlinewid Autodesk.AutoCAD.DatabaseServices.Database.Plinewid AcDbDatabase::setProjectName Autodesk.AutoCAD.DatabaseServices.Database.ProjectName AcDbDatabase::setPsltscale Autodesk.AutoCAD.DatabaseServices.Database.Psltscale AcDbDatabase::setPucsBase Autodesk.AutoCAD.DatabaseServices.Database.PucsBase AcDbDatabase::setQtextmode Autodesk.AutoCAD.DatabaseServices.Database.Qtextmode AcDbDatabase::setRegenmode Autodesk.AutoCAD.DatabaseServices.Database.Regenmode AcDbDatabase::setRetainOriginalThumbnailBitmap Autodesk.AutoCAD.DatabaseServices.Database.RetainOriginalThumbnailBitmap AcDbDatabase::setSaveproxygraphics Autodesk.AutoCAD.DatabaseServices.Database.Saveproxygraphics AcDbDatabase::setSecurityParams Autodesk.AutoCAD.DatabaseServices.Database.SecurityParameters AcDbDatabase::setShadedge Autodesk.AutoCAD.DatabaseServices.Database.Shadedge AcDbDatabase::setShadedif Autodesk.AutoCAD.DatabaseServices.Database.Shadedif AcDbDatabase::setSketchinc Autodesk.AutoCAD.DatabaseServices.Database.Sketchinc AcDbDatabase::setSkpoly Autodesk.AutoCAD.DatabaseServices.Database.Skpoly AcDbDatabase::setSortEnts Autodesk.AutoCAD.DatabaseServices.Database.SortEnts AcDbDatabase::setSplframe Autodesk.AutoCAD.DatabaseServices.Database.Splframe AcDbDatabase::setSplinesegs Autodesk.AutoCAD.DatabaseServices.Database.Splinesegs AcDbDatabase::setSplinetype Autodesk.AutoCAD.DatabaseServices.Database.Splinetype AcDbDatabase::setStyleSheet Autodesk.AutoCAD.DatabaseServices.Database.StyleSheet AcDbDatabase::setSurftab1 Autodesk.AutoCAD.DatabaseServices.Database.Surftab1 AcDbDatabase::setSurftab2 Autodesk.AutoCAD.DatabaseServices.Database.Surftab2 AcDbDatabase::setSurftype Autodesk.AutoCAD.DatabaseServices.Database.Surftype AcDbDatabase::setSurfu Autodesk.AutoCAD.DatabaseServices.Database.Surfu AcDbDatabase::setSurfv Autodesk.AutoCAD.DatabaseServices.Database.Surfv AcDbDatabase::setTablestyle Autodesk.AutoCAD.DatabaseServices.Database.Tablestyle AcDbDatabase::setTextsize Autodesk.AutoCAD.DatabaseServices.Database.Textsize AcDbDatabase::setTextstyle Autodesk.AutoCAD.DatabaseServices.Database.Textstyle AcDbDatabase::setThickness Autodesk.AutoCAD.DatabaseServices.Database.Thickness AcDbDatabase::setTilemode Autodesk.AutoCAD.DatabaseServices.Database.TileMode AcDbDatabase::setTracewid Autodesk.AutoCAD.DatabaseServices.Database.Tracewid AcDbDatabase::setTreedepth Autodesk.AutoCAD.DatabaseServices.Database.Treedepth AcDbDatabase::setTStackAlign Autodesk.AutoCAD.DatabaseServices.Database.TStackAlign AcDbDatabase::setTStackSize Autodesk.AutoCAD.DatabaseServices.Database.TstackSize AcDbDatabase::setUcsBase Autodesk.AutoCAD.DatabaseServices.Database.UcsBase AcDbDatabase::setUnitmode Autodesk.AutoCAD.DatabaseServices.Database.Unitmode AcDbDatabase::setUseri1 Autodesk.AutoCAD.DatabaseServices.Database.Useri1 [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 481 AcDbDatabase::setUseri2 Autodesk.AutoCAD.DatabaseServices.Database.Useri2 AcDbDatabase::setUseri3 Autodesk.AutoCAD.DatabaseServices.Database.Useri3 AcDbDatabase::setUseri4 Autodesk.AutoCAD.DatabaseServices.Database.Useri4 AcDbDatabase::setUseri5 Autodesk.AutoCAD.DatabaseServices.Database.Useri5 AcDbDatabase::setUserr1 Autodesk.AutoCAD.DatabaseServices.Database.Userr1 AcDbDatabase::setUserr2 Autodesk.AutoCAD.DatabaseServices.Database.Userr2 AcDbDatabase::setUserr3 Autodesk.AutoCAD.DatabaseServices.Database.Userr3 AcDbDatabase::setUserr4 Autodesk.AutoCAD.DatabaseServices.Database.Userr4 AcDbDatabase::setUserr5 Autodesk.AutoCAD.DatabaseServices.Database.Userr5 AcDbDatabase::setUsrtimer Autodesk.AutoCAD.DatabaseServices.Database.Usrtimer AcDbDatabase::setVersionGuid Autodesk.AutoCAD.DatabaseServices.Database.VersionGuid AcDbDatabase::setViewportScaleDefault Autodesk.AutoCAD.DatabaseServices.Database.ViewportScaleDefault AcDbDatabase::setVisretain Autodesk.AutoCAD.DatabaseServices.Database.Visretain AcDbDatabase::setWorldPucsBaseOrigin Autodesk.AutoCAD.DatabaseServices.Database.SetWorldPaperspaceUcsBaseOrigin AcDbDatabase::setWorldUcsBaseOrigin Autodesk.AutoCAD.DatabaseServices.Database.SetWorldUcsBaseOrigin AcDbDatabase::setWorldview Autodesk.AutoCAD.DatabaseServices.Database.Worldview AcDbDatabase::setXrefEditEnabled Autodesk.AutoCAD.DatabaseServices.Database.XrefEditEnabled AcDbDatabase::shadedge Autodesk.AutoCAD.DatabaseServices.Database.Shadedge AcDbDatabase::shadedif Autodesk.AutoCAD.DatabaseServices.Database.Shadedif AcDbDatabase::sketchinc Autodesk.AutoCAD.DatabaseServices.Database.Sketchinc AcDbDatabase::skpoly Autodesk.AutoCAD.DatabaseServices.Database.Skpoly AcDbDatabase::sortEnts Autodesk.AutoCAD.DatabaseServices.Database.SortEnts AcDbDatabase::splframe Autodesk.AutoCAD.DatabaseServices.Database.Splframe AcDbDatabase::splinesegs Autodesk.AutoCAD.DatabaseServices.Database.Splinesegs AcDbDatabase::splinetype Autodesk.AutoCAD.DatabaseServices.Database.Splinetype AcDbDatabase::surftab1 Autodesk.AutoCAD.DatabaseServices.Database.Surftab1 AcDbDatabase::surftab2 Autodesk.AutoCAD.DatabaseServices.Database.Surftab2 AcDbDatabase::surftype Autodesk.AutoCAD.DatabaseServices.Database.Surftype AcDbDatabase::surfu Autodesk.AutoCAD.DatabaseServices.Database.Surfu AcDbDatabase::surfv Autodesk.AutoCAD.DatabaseServices.Database.Surfv AcDbDatabase::tablestyle Autodesk.AutoCAD.DatabaseServices.Database.Tablestyle AcDbDatabase::tableStyleDictionaryId Autodesk.AutoCAD.DatabaseServices.Database.TableStyleDictionaryId AcDbDatabase::tdcreate Autodesk.AutoCAD.DatabaseServices.Database.Tdcreate AcDbDatabase::tdindwg Autodesk.AutoCAD.DatabaseServices.Database.Tdindwg AcDbDatabase::tducreate Autodesk.AutoCAD.DatabaseServices.Database.Tducreate AcDbDatabase::tdupdate Autodesk.AutoCAD.DatabaseServices.Database.Tdupdate AcDbDatabase::tdusrtimer Autodesk.AutoCAD.DatabaseServices.Database.Tdusrtimer AcDbDatabase::tduupdate Autodesk.AutoCAD.DatabaseServices.Database.Tduupdate AcDbDatabase::textsize Autodesk.AutoCAD.DatabaseServices.Database.Textsize AcDbDatabase::textstyle Autodesk.AutoCAD.DatabaseServices.Database.Textstyle AcDbDatabase::textStyleTableId Autodesk.AutoCAD.DatabaseServices.Database.TextStyleTableId AcDbDatabase::thickness Autodesk.AutoCAD.DatabaseServices.Database.Thickness AcDbDatabase::thumbnailBitmap Autodesk.AutoCAD.DatabaseServices.Database.ThumbnailBitmap AcDbDatabase::tilemode Autodesk.AutoCAD.DatabaseServices.Database.TileMode [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 482 AcDbDatabase::tracewid Autodesk.AutoCAD.DatabaseServices.Database.Tracewid AcDbDatabase::transactionManager Autodesk.AutoCAD.DatabaseServices.Database.TransactionManager AcDbDatabase::treedepth Autodesk.AutoCAD.DatabaseServices.Database.Treedepth AcDbDatabase::tstackalign Autodesk.AutoCAD.DatabaseServices.Database.TStackAlign AcDbDatabase::tstacksize Autodesk.AutoCAD.DatabaseServices.Database.TstackSize AcDbDatabase::ucsBase Autodesk.AutoCAD.DatabaseServices.Database.UcsBase AcDbDatabase::ucsname Autodesk.AutoCAD.DatabaseServices.Database.Ucsname AcDbDatabase::ucsorg Autodesk.AutoCAD.DatabaseServices.Database.Ucsorg AcDbDatabase::UCSTableId Autodesk.AutoCAD.DatabaseServices.Database.UcsTableId AcDbDatabase::ucsxdir Autodesk.AutoCAD.DatabaseServices.Database.Ucsxdir AcDbDatabase::ucsydir Autodesk.AutoCAD.DatabaseServices.Database.Ucsydir AcDbDatabase::undoRecording Autodesk.AutoCAD.DatabaseServices.Database.UndoRecording AcDbDatabase::unitmode Autodesk.AutoCAD.DatabaseServices.Database.Unitmode AcDbDatabase::updateExt Autodesk.AutoCAD.DatabaseServices.Database.UpdateExt AcDbDatabase::useri1 Autodesk.AutoCAD.DatabaseServices.Database.Useri1 AcDbDatabase::useri2 Autodesk.AutoCAD.DatabaseServices.Database.Useri2 AcDbDatabase::useri3 Autodesk.AutoCAD.DatabaseServices.Database.Useri3 AcDbDatabase::useri4 Autodesk.AutoCAD.DatabaseServices.Database.Useri4 AcDbDatabase::useri5 Autodesk.AutoCAD.DatabaseServices.Database.Useri5 AcDbDatabase::userr1 Autodesk.AutoCAD.DatabaseServices.Database.Userr1 AcDbDatabase::userr2 Autodesk.AutoCAD.DatabaseServices.Database.Userr2 AcDbDatabase::userr3 Autodesk.AutoCAD.DatabaseServices.Database.Userr3 AcDbDatabase::userr4 Autodesk.AutoCAD.DatabaseServices.Database.Userr4 AcDbDatabase::userr5 Autodesk.AutoCAD.DatabaseServices.Database.Userr5 AcDbDatabase::usrtimer Autodesk.AutoCAD.DatabaseServices.Database.Usrtimer AcDbDatabase::viewportScaleDefault Autodesk.AutoCAD.DatabaseServices.Database.ViewportScaleDefault AcDbDatabase::viewportTableId Autodesk.AutoCAD.DatabaseServices.Database.ViewportTableId AcDbDatabase::viewTableId Autodesk.AutoCAD.DatabaseServices.Database.ViewTableId AcDbDatabase::visretain Autodesk.AutoCAD.DatabaseServices.Database.Visretain AcDbDatabase::wblock Autodesk.AutoCAD.DatabaseServices.Database.Wblock AcDbDatabase::wblock Autodesk.AutoCAD.DatabaseServices.Database.Wblock AcDbDatabase::wblock Autodesk.AutoCAD.DatabaseServices.Database.Wblock AcDbDatabase::wblock Autodesk.AutoCAD.DatabaseServices.Database.Wblock AcDbDatabase::wblockCloneObjects Autodesk.AutoCAD.DatabaseServices.Database.WblockCloneObjects AcDbDatabase::worldPucsBaseOrigin Autodesk.AutoCAD.DatabaseServices.Database.WorldPaperspaceUcsBaseOrigin AcDbDatabase::worldUcsBaseOrigin Autodesk.AutoCAD.DatabaseServices.Database.WorldUcsBaseOrigin AcDbDatabase::worldview Autodesk.AutoCAD.DatabaseServices.Database.Worldview AcDbDatabase::xrefBlockId Autodesk.AutoCAD.DatabaseServices.Database.XrefBlockId AcDbDatabase::xrefBlockId Autodesk.AutoCAD.DatabaseServices.Database.Filename AcDbDatabase::xrefEditEnabled Autodesk.AutoCAD.DatabaseServices.Database.XrefEditEnabled AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetHardPointerId AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetSoftPointerId AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetDouble AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetBool [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 483 AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetString AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetInteger AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetVector AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetPoint AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetObjectId AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetHardOwnershipId AcDbDataCell:: operator = Autodesk.AutoCAD.DatabaseServices.DataCell.SetSoftOwnershipId AcDbDataCell::init Autodesk.AutoCAD.DatabaseServices.DataCell.Init AcDbDataCell::type Autodesk.AutoCAD.DatabaseServices.DataCell.Value AcDbDataCell::type Autodesk.AutoCAD.DatabaseServices.DataCell.CellType AcDbDataColumn:: operator = Autodesk.AutoCAD.DatabaseServices.DataColumn.Assign AcDbDataColumn::appendCell Autodesk.AutoCAD.DatabaseServices.DataColumn.AppendCell AcDbDataColumn::columnName Autodesk.AutoCAD.DatabaseServices.DataColumn.ColumnName AcDbDataColumn::columnType Autodesk.AutoCAD.DatabaseServices.DataColumn.ColumnType AcDbDataColumn::getCellAt Autodesk.AutoCAD.DatabaseServices.DataColumn.GetCellAt AcDbDataColumn::getIndexAtCell Autodesk.AutoCAD.DatabaseServices.DataColumn.GetIndexAtCell AcDbDataColumn::growLength Autodesk.AutoCAD.DatabaseServices.DataColumn.GrowLength AcDbDataColumn::insertCellAt Autodesk.AutoCAD.DatabaseServices.DataColumn.InsertCellAt AcDbDataColumn::numCells Autodesk.AutoCAD.DatabaseServices.DataColumn.NumCells AcDbDataColumn::physicalLength Autodesk.AutoCAD.DatabaseServices.DataColumn.PhysicalLength AcDbDataColumn::removeCellAt Autodesk.AutoCAD.DatabaseServices.DataColumn.RemoveCellAt AcDbDataColumn::setCellAt Autodesk.AutoCAD.DatabaseServices.DataColumn.SetCellAt AcDbDataColumn::setColumnName Autodesk.AutoCAD.DatabaseServices.DataColumn.ColumnName AcDbDataColumn::setColumnType Autodesk.AutoCAD.DatabaseServices.DataColumn.ColumnType AcDbDataColumn::setGrowLength Autodesk.AutoCAD.DatabaseServices.DataColumn.GrowLength AcDbDataColumn::setPhysicalLength Autodesk.AutoCAD.DatabaseServices.DataColumn.PhysicalLength AcDbDataTable:: operator = Autodesk.AutoCAD.DatabaseServices.DataTable.Assign AcDbDataTable::appendColumn Autodesk.AutoCAD.DatabaseServices.DataTable.AppendColumn AcDbDataTable::appendRow Autodesk.AutoCAD.DatabaseServices.DataTable.AppendRow AcDbDataTable::getCellAt Autodesk.AutoCAD.DatabaseServices.DataTable.GetCellAt AcDbDataTable::getColumnAt Autodesk.AutoCAD.DatabaseServices.DataTable.GetColumnAt AcDbDataTable::getColumnIndexAtName Autodesk.AutoCAD.DatabaseServices.DataTable.GetColumnIndexAtName AcDbDataTable::getColumnNameAt Autodesk.AutoCAD.DatabaseServices.DataTable.GetColumnNameAt AcDbDataTable::getColumnTypeAt Autodesk.AutoCAD.DatabaseServices.DataTable.GetColumnTypeAt AcDbDataTable::getRowAt Autodesk.AutoCAD.DatabaseServices.DataTable.GetRowAt AcDbDataTable::insertColumnAt Autodesk.AutoCAD.DatabaseServices.DataTable.InsertColumnAt AcDbDataTable::insertRowAt Autodesk.AutoCAD.DatabaseServices.DataTable.InsertRowAt AcDbDataTable::numColsGrowSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumColsGrowSize AcDbDataTable::numColsPhysicalSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumColsPhysicalSize AcDbDataTable::numColumns Autodesk.AutoCAD.DatabaseServices.DataTable.NumColumns AcDbDataTable::numRows Autodesk.AutoCAD.DatabaseServices.DataTable.NumRows AcDbDataTable::numRowsGrowSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumRowsGrowSize AcDbDataTable::numRowsPhysicalSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumRowsPhysicalSize AcDbDataTable::removeColumnAt Autodesk.AutoCAD.DatabaseServices.DataTable.RemoveColumnAt [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 484 AcDbDataTable::removeRowAt Autodesk.AutoCAD.DatabaseServices.DataTable.RemoveRowAt AcDbDataTable::setCellAt Autodesk.AutoCAD.DatabaseServices.DataTable.SetCellAt AcDbDataTable::setNumColsGrowSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumColsGrowSize AcDbDataTable::setNumColsPhysicalSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumColsPhysicalSize AcDbDataTable::setNumRowsGrowSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumRowsGrowSize AcDbDataTable::setNumRowsPhysicalSize Autodesk.AutoCAD.DatabaseServices.DataTable.NumRowsPhysicalSize AcDbDataTable::setRowAt Autodesk.AutoCAD.DatabaseServices.DataTable.SetRowAt AcDbDataTable::setTableName Autodesk.AutoCAD.DatabaseServices.DataTable.TableName AcDbDataTable::tableName Autodesk.AutoCAD.DatabaseServices.DataTable.TableName acdbDetachXref Autodesk.AutoCAD.DatabaseServices.Database.DetachXref AcDbDiametricDimension::chordPoint Autodesk.AutoCAD.DatabaseServices.DiametricDimension.ChordPoint AcDbDiametricDimension::farChordPoint Autodesk.AutoCAD.DatabaseServices.DiametricDimension.FarChordPoint AcDbDiametricDimension::leaderLength Autodesk.AutoCAD.DatabaseServices.DiametricDimension.LeaderLength AcDbDiametricDimension::setChordPoint Autodesk.AutoCAD.DatabaseServices.DiametricDimension.ChordPoint AcDbDiametricDimension::setFarChordPoint Autodesk.AutoCAD.DatabaseServices.DiametricDimension.FarChordPoint AcDbDiametricDimension::setLeaderLength Autodesk.AutoCAD.DatabaseServices.DiametricDimension.LeaderLength AcDbDictionary::getAt Autodesk.AutoCAD.DatabaseServices.DBDictionary.GetAt AcDbDictionary::has Autodesk.AutoCAD.DatabaseServices.DBDictionary.Contains AcDbDictionary::has Autodesk.AutoCAD.DatabaseServices.DBDictionary.Contains AcDbDictionary::isTreatElementsAsHard Autodesk.AutoCAD.DatabaseServices.DBDictionary.TreatElementsAsHard AcDbDictionary::nameAt Autodesk.AutoCAD.DatabaseServices.DBDictionary.NameAt AcDbDictionary::newIterator Autodesk.AutoCAD.DatabaseServices.DBDictionary.IDictionary.GetEnumerator AcDbDictionary::numEntries Autodesk.AutoCAD.DatabaseServices.DBDictionary.Count AcDbDictionary::remove Autodesk.AutoCAD.DatabaseServices.DBDictionary.Remove AcDbDictionary::remove Autodesk.AutoCAD.DatabaseServices.DBDictionary.Remove AcDbDictionary::setAt Autodesk.AutoCAD.DatabaseServices.DBDictionary.SetAt AcDbDictionary::setMergeStyle Autodesk.AutoCAD.DatabaseServices.DBDictionary.MergeStyle AcDbDictionary::setName Autodesk.AutoCAD.DatabaseServices.DBDictionary.SetName AcDbDictionary::setTreatElementsAsHard Autodesk.AutoCAD.DatabaseServices.DBDictionary.TreatElementsAsHard AcDbDictionaryWithDefault::defaultId Autodesk.AutoCAD.DatabaseServices.DictionaryWithDefaultDictionary.DefaultId AcDbDictionaryWithDefault::getObjectBirthVersion Autodesk.AutoCAD.DatabaseServices.DictionaryWithDefaultDictionary.ObjectBirthVersio n AcDbDictionaryWithDefault::setDefaultId Autodesk.AutoCAD.DatabaseServices.DictionaryWithDefaultDictionary.DefaultId AcDbDimData::dimension Autodesk.AutoCAD.DatabaseServices.DynamicDimensionData.Dimension AcDbDimension::dimadec Autodesk.AutoCAD.DatabaseServices.Dimension.Dimadec AcDbDimension::dimaltd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltd AcDbDimension::dimaltf Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltf AcDbDimension::dimaltrnd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltrnd AcDbDimension::dimalttd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimalttd AcDbDimension::dimalttz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimalttz AcDbDimension::dimaltu Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltu AcDbDimension::dimaltz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltz AcDbDimension::dimapost Autodesk.AutoCAD.DatabaseServices.Dimension.Dimapost AcDbDimension::dimasz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimasz [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 485 AcDbDimension::dimatfit Autodesk.AutoCAD.DatabaseServices.Dimension.Dimatfit AcDbDimension::dimaunit Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaunit AcDbDimension::dimazin Autodesk.AutoCAD.DatabaseServices.Dimension.Dimazin AcDbDimension::dimblk Autodesk.AutoCAD.DatabaseServices.Dimension.Dimblk AcDbDimension::dimblk1 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimblk1 AcDbDimension::dimblk2 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimblk2 AcDbDimension::dimBlockId Autodesk.AutoCAD.DatabaseServices.Dimension.DimBlockId AcDbDimension::dimBlockPosition Autodesk.AutoCAD.DatabaseServices.Dimension.DimBlockPosition AcDbDimension::dimcen Autodesk.AutoCAD.DatabaseServices.Dimension.Dimcen AcDbDimension::dimclrd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimclrd AcDbDimension::dimclre Autodesk.AutoCAD.DatabaseServices.Dimension.Dimclre AcDbDimension::dimclrt Autodesk.AutoCAD.DatabaseServices.Dimension.Dimclrt AcDbDimension::dimdec Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdec AcDbDimension::dimdle Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdle AcDbDimension::dimdli Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdli AcDbDimension::dimdsep Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdsep AcDbDimension::dimensionStyle Autodesk.AutoCAD.DatabaseServices.Dimension.DimensionStyle AcDbDimension::dimensionText Autodesk.AutoCAD.DatabaseServices.Dimension.DimensionText AcDbDimension::dimexe Autodesk.AutoCAD.DatabaseServices.Dimension.Dimexe AcDbDimension::dimexo Autodesk.AutoCAD.DatabaseServices.Dimension.Dimexo AcDbDimension::dimfrac Autodesk.AutoCAD.DatabaseServices.Dimension.Dimfrac AcDbDimension::dimgap Autodesk.AutoCAD.DatabaseServices.Dimension.Dimgap AcDbDimension::dimjust Autodesk.AutoCAD.DatabaseServices.Dimension.Dimjust AcDbDimension::dimldrblk Autodesk.AutoCAD.DatabaseServices.Dimension.Dimldrblk AcDbDimension::dimlfac Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlfac AcDbDimension::dimlunit Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlunit AcDbDimension::dimlwd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlwd AcDbDimension::dimlwe Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlwe AcDbDimension::dimpost Autodesk.AutoCAD.DatabaseServices.Dimension.Dimpost AcDbDimension::dimrnd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimrnd AcDbDimension::dimscale Autodesk.AutoCAD.DatabaseServices.Dimension.Dimscale AcDbDimension::dimtad Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtad AcDbDimension::dimtdec Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtdec AcDbDimension::dimtfac Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtfac AcDbDimension::dimtm Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtm AcDbDimension::dimtmove Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtmove AcDbDimension::dimtolj Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtolj AcDbDimension::dimtp Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtp AcDbDimension::dimtsz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtsz AcDbDimension::dimtvp Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtvp AcDbDimension::dimtxsty Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtxsty AcDbDimension::dimtxt Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtxt AcDbDimension::dimtzin Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtzin AcDbDimension::dimzin Autodesk.AutoCAD.DatabaseServices.Dimension.Dimzin [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 486 AcDbDimension::elevation Autodesk.AutoCAD.DatabaseServices.Dimension.Elevation AcDbDimension::fieldFromMText Autodesk.AutoCAD.DatabaseServices.Dimension.FieldFromMText AcDbDimension::fieldToMText Autodesk.AutoCAD.DatabaseServices.Dimension.FieldToMText AcDbDimension::formatMeasurement Autodesk.AutoCAD.DatabaseServices.Dimension.FormatMeasurement AcDbDimension::generateLayout Autodesk.AutoCAD.DatabaseServices.Dimension.GenerateLayout AcDbDimension::getDimstyleData Autodesk.AutoCAD.DatabaseServices.Dimension.DimstyleData AcDbDimension::horizontalRotation Autodesk.AutoCAD.DatabaseServices.Dimension.HorizontalRotation AcDbDimension::isUsingDefaultTextPosition Autodesk.AutoCAD.DatabaseServices.Dimension.UsingDefaultTextPosition AcDbDimension::measurement Autodesk.AutoCAD.DatabaseServices.Dimension.Measurement AcDbDimension::normal Autodesk.AutoCAD.DatabaseServices.Dimension.Normal AcDbDimension::recomputeDimBlock Autodesk.AutoCAD.DatabaseServices.Dimension.RecomputeDimensionBlock AcDbDimension::removeTextField Autodesk.AutoCAD.DatabaseServices.Dimension.RemoveTextField AcDbDimension::setDimadec Autodesk.AutoCAD.DatabaseServices.Dimension.Dimadec AcDbDimension::setDimalt Autodesk.AutoCAD.DatabaseServices.Dimension.Dimalt AcDbDimension::setDimaltd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltd AcDbDimension::setDimaltf Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltf AcDbDimension::setDimaltrnd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltrnd AcDbDimension::setDimalttd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimalttd AcDbDimension::setDimalttz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimalttz AcDbDimension::setDimaltu Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltu AcDbDimension::setDimaltz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaltz AcDbDimension::setDimapost Autodesk.AutoCAD.DatabaseServices.Dimension.Dimapost AcDbDimension::setDimasz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimasz AcDbDimension::setDimatfit Autodesk.AutoCAD.DatabaseServices.Dimension.Dimatfit AcDbDimension::setDimaunit Autodesk.AutoCAD.DatabaseServices.Dimension.Dimaunit AcDbDimension::setDimazin Autodesk.AutoCAD.DatabaseServices.Dimension.Dimazin AcDbDimension::setDimblk Autodesk.AutoCAD.DatabaseServices.Dimension.Dimblk AcDbDimension::setDimblk1 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimblk1 AcDbDimension::setDimblk2 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimblk2 AcDbDimension::setDimBlockId Autodesk.AutoCAD.DatabaseServices.Dimension.DimBlockId AcDbDimension::setDimcen Autodesk.AutoCAD.DatabaseServices.Dimension.Dimcen AcDbDimension::setDimclrd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimclrd AcDbDimension::setDimclre Autodesk.AutoCAD.DatabaseServices.Dimension.Dimclre AcDbDimension::setDimclrt Autodesk.AutoCAD.DatabaseServices.Dimension.Dimclrt AcDbDimension::setDimdec Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdec AcDbDimension::setDimdle Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdle AcDbDimension::setDimdli Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdli AcDbDimension::setDimdsep Autodesk.AutoCAD.DatabaseServices.Dimension.Dimdsep AcDbDimension::setDimensionStyle Autodesk.AutoCAD.DatabaseServices.Dimension.DimensionStyle AcDbDimension::setDimensionText Autodesk.AutoCAD.DatabaseServices.Dimension.DimensionText AcDbDimension::setDimexe Autodesk.AutoCAD.DatabaseServices.Dimension.Dimexe AcDbDimension::setDimexo Autodesk.AutoCAD.DatabaseServices.Dimension.Dimexo AcDbDimension::setDimfrac Autodesk.AutoCAD.DatabaseServices.Dimension.Dimfrac AcDbDimension::setDimgap Autodesk.AutoCAD.DatabaseServices.Dimension.Dimgap [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 487 AcDbDimension::setDimjust Autodesk.AutoCAD.DatabaseServices.Dimension.Dimjust AcDbDimension::setDimldrblk Autodesk.AutoCAD.DatabaseServices.Dimension.Dimldrblk AcDbDimension::setDimlfac Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlfac AcDbDimension::setDimlim Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlim AcDbDimension::setDimlunit Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlunit AcDbDimension::setDimlwd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlwd AcDbDimension::setDimlwe Autodesk.AutoCAD.DatabaseServices.Dimension.Dimlwe AcDbDimension::setDimpost Autodesk.AutoCAD.DatabaseServices.Dimension.Dimpost AcDbDimension::setDimrnd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimrnd AcDbDimension::setDimsah Autodesk.AutoCAD.DatabaseServices.Dimension.Dimsah AcDbDimension::setDimscale Autodesk.AutoCAD.DatabaseServices.Dimension.Dimscale AcDbDimension::setDimsd1 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimsd1 AcDbDimension::setDimsd2 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimsd2 AcDbDimension::setDimse1 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimse1 AcDbDimension::setDimse2 Autodesk.AutoCAD.DatabaseServices.Dimension.Dimse2 AcDbDimension::setDimsoxd Autodesk.AutoCAD.DatabaseServices.Dimension.Dimsoxd AcDbDimension::setDimstyleData Autodesk.AutoCAD.DatabaseServices.Dimension.DimstyleData AcDbDimension::setDimtad Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtad AcDbDimension::setDimtdec Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtdec AcDbDimension::setDimtfac Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtfac AcDbDimension::setDimtih Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtih AcDbDimension::setDimtix Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtix AcDbDimension::setDimtm Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtm AcDbDimension::setDimtmove Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtmove AcDbDimension::setDimtofl Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtofl AcDbDimension::setDimtoh Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtoh AcDbDimension::setDimtol Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtol AcDbDimension::setDimtolj Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtolj AcDbDimension::setDimtp Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtp AcDbDimension::setDimtsz Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtsz AcDbDimension::setDimtvp Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtvp AcDbDimension::setDimtxsty Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtxsty AcDbDimension::setDimtxt Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtxt AcDbDimension::setDimtzin Autodesk.AutoCAD.DatabaseServices.Dimension.Dimtzin AcDbDimension::setDimupt Autodesk.AutoCAD.DatabaseServices.Dimension.Dimupt AcDbDimension::setDimzin Autodesk.AutoCAD.DatabaseServices.Dimension.Dimzin AcDbDimension::setElevation Autodesk.AutoCAD.DatabaseServices.Dimension.Elevation AcDbDimension::setHorizontalRotation Autodesk.AutoCAD.DatabaseServices.Dimension.HorizontalRotation AcDbDimension::setNormal Autodesk.AutoCAD.DatabaseServices.Dimension.Normal AcDbDimension::setTextAttachment Autodesk.AutoCAD.DatabaseServices.Dimension.TextAttachment AcDbDimension::setTextLineSpacingFactor Autodesk.AutoCAD.DatabaseServices.Dimension.TextLineSpacingFactor AcDbDimension::setTextLineSpacingStyle Autodesk.AutoCAD.DatabaseServices.Dimension.TextLineSpacingStyle AcDbDimension::setTextPosition Autodesk.AutoCAD.DatabaseServices.Dimension.TextPosition AcDbDimension::setTextRotation Autodesk.AutoCAD.DatabaseServices.Dimension.TextRotation [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 488 AcDbDimension::textAttachment Autodesk.AutoCAD.DatabaseServices.Dimension.TextAttachment AcDbDimension::textLineSpacingFactor Autodesk.AutoCAD.DatabaseServices.Dimension.TextLineSpacingFactor AcDbDimension::textLineSpacingStyle Autodesk.AutoCAD.DatabaseServices.Dimension.TextLineSpacingStyle AcDbDimension::textPosition Autodesk.AutoCAD.DatabaseServices.Dimension.TextPosition AcDbDimension::textRotation Autodesk.AutoCAD.DatabaseServices.Dimension.TextRotation AcDbDimension::useDefaultTextPosition Autodesk.AutoCAD.DatabaseServices.Dimension.UsingDefaultTextPosition AcDbDimension::useSetTextPosition Autodesk.AutoCAD.DatabaseServices.Dimension.UsingDefaultTextPosition AcDbDimStyleTableRecord::arrowId Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.GetArrowId AcDbDimStyleTableRecord::dimadec Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimadec AcDbDimStyleTableRecord::dimaltd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltd AcDbDimStyleTableRecord::dimaltf Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltf AcDbDimStyleTableRecord::dimaltrnd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltrnd AcDbDimStyleTableRecord::dimalttd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimalttd AcDbDimStyleTableRecord::dimalttz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimalttz AcDbDimStyleTableRecord::dimaltu Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltu AcDbDimStyleTableRecord::dimaltz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltz AcDbDimStyleTableRecord::dimapost Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimapost AcDbDimStyleTableRecord::dimasz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimasz AcDbDimStyleTableRecord::dimatfit Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimatfit AcDbDimStyleTableRecord::dimaunit Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaunit AcDbDimStyleTableRecord::dimazin Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimazin AcDbDimStyleTableRecord::dimblk Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimblk AcDbDimStyleTableRecord::dimblk1 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimblk1 AcDbDimStyleTableRecord::dimblk2 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimblk2 AcDbDimStyleTableRecord::dimcen Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimcen AcDbDimStyleTableRecord::dimclrd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimclrd AcDbDimStyleTableRecord::dimclre Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimclre AcDbDimStyleTableRecord::dimclrt Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimclrt AcDbDimStyleTableRecord::dimdec Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdec AcDbDimStyleTableRecord::dimdle Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdle AcDbDimStyleTableRecord::dimdli Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdli AcDbDimStyleTableRecord::dimdsep Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdsep AcDbDimStyleTableRecord::dimexe Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimexe AcDbDimStyleTableRecord::dimexo Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimexo AcDbDimStyleTableRecord::dimfrac Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimfrac AcDbDimStyleTableRecord::dimgap Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimgap AcDbDimStyleTableRecord::dimjust Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimjust AcDbDimStyleTableRecord::dimldrblk Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimldrblk AcDbDimStyleTableRecord::dimlfac Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlfac AcDbDimStyleTableRecord::dimlunit Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlunit AcDbDimStyleTableRecord::dimlwd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlwd AcDbDimStyleTableRecord::dimlwe Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlwe AcDbDimStyleTableRecord::dimpost Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimpost AcDbDimStyleTableRecord::dimrnd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimrnd [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 489 AcDbDimStyleTableRecord::dimscale Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimscale AcDbDimStyleTableRecord::dimtad Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtad AcDbDimStyleTableRecord::dimtdec Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtdec AcDbDimStyleTableRecord::dimtfac Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtfac AcDbDimStyleTableRecord::dimtm Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtm AcDbDimStyleTableRecord::dimtmove Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtmove AcDbDimStyleTableRecord::dimtolj Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtolj AcDbDimStyleTableRecord::dimtp Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtp AcDbDimStyleTableRecord::dimtsz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtsz AcDbDimStyleTableRecord::dimtvp Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtvp AcDbDimStyleTableRecord::dimtxsty Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtxsty AcDbDimStyleTableRecord::dimtxt Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtxt AcDbDimStyleTableRecord::dimtzin Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtzin AcDbDimStyleTableRecord::dimzin Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimzin AcDbDimStyleTableRecord::isModifiedForRecompute Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.IsModifiedForRecompute AcDbDimStyleTableRecord::setDimadec Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimadec AcDbDimStyleTableRecord::setDimalt Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimalt AcDbDimStyleTableRecord::setDimaltd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltd AcDbDimStyleTableRecord::setDimaltf Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltf AcDbDimStyleTableRecord::setDimaltrnd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltrnd AcDbDimStyleTableRecord::setDimalttd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimalttd AcDbDimStyleTableRecord::setDimalttz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimalttz AcDbDimStyleTableRecord::setDimaltu Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltu AcDbDimStyleTableRecord::setDimaltz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaltz AcDbDimStyleTableRecord::setDimapost Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimapost AcDbDimStyleTableRecord::setDimasz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimasz AcDbDimStyleTableRecord::setDimatfit Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimatfit AcDbDimStyleTableRecord::setDimaunit Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimaunit AcDbDimStyleTableRecord::setDimazin Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimazin AcDbDimStyleTableRecord::setDimblk Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimblk AcDbDimStyleTableRecord::setDimblk1 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimblk1 AcDbDimStyleTableRecord::setDimblk2 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimblk2 AcDbDimStyleTableRecord::setDimcen Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimcen AcDbDimStyleTableRecord::setDimclrd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimclrd AcDbDimStyleTableRecord::setDimclre Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimclre AcDbDimStyleTableRecord::setDimclrt Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimclrt AcDbDimStyleTableRecord::setDimdec Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdec AcDbDimStyleTableRecord::setDimdle Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdle AcDbDimStyleTableRecord::setDimdli Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdli AcDbDimStyleTableRecord::setDimdsep Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimdsep AcDbDimStyleTableRecord::setDimexe Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimexe AcDbDimStyleTableRecord::setDimexo Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimexo AcDbDimStyleTableRecord::setDimfrac Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimfrac AcDbDimStyleTableRecord::setDimgap Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimgap [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 490 AcDbDimStyleTableRecord::setDimjust Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimjust AcDbDimStyleTableRecord::setDimldrblk Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimldrblk AcDbDimStyleTableRecord::setDimlfac Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlfac AcDbDimStyleTableRecord::setDimlim Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlim AcDbDimStyleTableRecord::setDimlunit Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlunit AcDbDimStyleTableRecord::setDimlwd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlwd AcDbDimStyleTableRecord::setDimlwe Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimlwe AcDbDimStyleTableRecord::setDimpost Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimpost AcDbDimStyleTableRecord::setDimrnd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimrnd AcDbDimStyleTableRecord::setDimsah Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimsah AcDbDimStyleTableRecord::setDimscale Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimscale AcDbDimStyleTableRecord::setDimsd1 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimsd1 AcDbDimStyleTableRecord::setDimsd2 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimsd2 AcDbDimStyleTableRecord::setDimse1 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimse1 AcDbDimStyleTableRecord::setDimse2 Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimse2 AcDbDimStyleTableRecord::setDimsoxd Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimsoxd AcDbDimStyleTableRecord::setDimtad Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtad AcDbDimStyleTableRecord::setDimtdec Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtdec AcDbDimStyleTableRecord::setDimtfac Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtfac AcDbDimStyleTableRecord::setDimtih Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtih AcDbDimStyleTableRecord::setDimtix Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtix AcDbDimStyleTableRecord::setDimtm Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtm AcDbDimStyleTableRecord::setDimtmove Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtmove AcDbDimStyleTableRecord::setDimtofl Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtofl AcDbDimStyleTableRecord::setDimtoh Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtoh AcDbDimStyleTableRecord::setDimtol Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtol AcDbDimStyleTableRecord::setDimtolj Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtolj AcDbDimStyleTableRecord::setDimtp Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtp AcDbDimStyleTableRecord::setDimtsz Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtsz AcDbDimStyleTableRecord::setDimtvp Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtvp AcDbDimStyleTableRecord::setDimtxsty Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtxsty AcDbDimStyleTableRecord::setDimtxt Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtxt AcDbDimStyleTableRecord::setDimtzin Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimtzin AcDbDimStyleTableRecord::setDimupt Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimupt AcDbDimStyleTableRecord::setDimzin Autodesk.AutoCAD.DatabaseServices.DimStyleTableRecord.Dimzin acdbDisToF Autodesk.AutoCAD.Runtime.Converter.StringToDistance AcDbDwgFiler::dwgVersion Autodesk.AutoCAD.DatabaseServices.DwgFiler.DwgVersion AcDbDwgFiler::filerStatus Autodesk.AutoCAD.DatabaseServices.DwgFiler.FilerStatus AcDbDwgFiler::filerType Autodesk.AutoCAD.DatabaseServices.DwgFiler.FilerType AcDbDxfFiler::database Autodesk.AutoCAD.DatabaseServices.DxfFiler.Database AcDbDxfFiler::dwgVersion Autodesk.AutoCAD.DatabaseServices.DxfFiler.DwgVersion AcDbDxfFiler::elevation Autodesk.AutoCAD.DatabaseServices.DxfFiler.Elevation AcDbDxfFiler::errorMessage Autodesk.AutoCAD.DatabaseServices.DxfFiler.ErrorMessage AcDbDxfFiler::filerStatus Autodesk.AutoCAD.DatabaseServices.DxfFiler.FilerStatus [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 491 AcDbDxfFiler::filerType Autodesk.AutoCAD.DatabaseServices.DxfFiler.FilerType AcDbDxfFiler::haltAtClassBoundries Autodesk.AutoCAD.DatabaseServices.DxfFiler.HaltAtClassBoundaries AcDbDxfFiler::native_printError Autodesk.AutoCAD.DatabaseServices.DxfFiler.SetError AcDbDxfFiler::precision Autodesk.AutoCAD.DatabaseServices.DxfFiler.Precision AcDbDxfFiler::pushBackItem Autodesk.AutoCAD.DatabaseServices.DxfFiler.PushBackItem AcDbDxfFiler::readResBuf Autodesk.AutoCAD.DatabaseServices.DxfFiler.ReadResultBuffer AcDbDxfFiler::resetFilerStatus Autodesk.AutoCAD.DatabaseServices.DxfFiler.ResetFilerStatus AcDbDxfFiler::rewindFiler Autodesk.AutoCAD.DatabaseServices.DxfFiler.RewindFiler AcDbDxfFiler::setPrecision Autodesk.AutoCAD.DatabaseServices.DxfFiler.Precision AcDbDxfFiler::thickness Autodesk.AutoCAD.DatabaseServices.DxfFiler.Thickness AcDbDxfFiler::writeAcDbHandle Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteHandle AcDbDxfFiler::writeBChunk Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteBytes AcDbDxfFiler::writeBool Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteBool AcDbDxfFiler::writeBoolean Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteBoolean AcDbDxfFiler::writeDouble Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteDouble AcDbDxfFiler::writeEmbeddedObjectStart Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteEmbeddedObjectStart AcDbDxfFiler::writeInt16 Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteInt16 AcDbDxfFiler::writeInt32 Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteInt32 AcDbDxfFiler::writeObjectId Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteObjectId AcDbDxfFiler::writePoint2d Autodesk.AutoCAD.DatabaseServices.DxfFiler.WritePoint2d AcDbDxfFiler::writePoint3d Autodesk.AutoCAD.DatabaseServices.DxfFiler.WritePoint3d AcDbDxfFiler::writeResBuf Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteResultBuffer AcDbDxfFiler::writeScale3d Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteScale3d AcDbDxfFiler::writeString Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteString AcDbDxfFiler::writeUInt16 Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteUInt16 AcDbDxfFiler::writeUInt32 Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteUInt32 AcDbDxfFiler::writeUInt8 Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteByte AcDbDxfFiler::writeVector2d Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteVector2d AcDbDxfFiler::writeVector3d Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteVector3d AcDbDxfFiler::writeXDataStart Autodesk.AutoCAD.DatabaseServices.DxfFiler.WriteXDataStart AcDbDynBlockReference::anonymousBlockTableRecor d Autodesk.AutoCAD.DatabaseServices.BlockReference.AnonymousBlockTableRecord AcDbDynBlockReference::convertToStaticBlock Autodesk.AutoCAD.DatabaseServices.BlockReference.ConvertToStaticBlock AcDbDynBlockReference::convertToStaticBlock Autodesk.AutoCAD.DatabaseServices.BlockReference.ConvertToStaticBlock AcDbDynBlockReference::dynamicBlockTableRecord Autodesk.AutoCAD.DatabaseServices.BlockReference.DynamicBlockTableRecord AcDbDynBlockReference::getBlockProperties Autodesk.AutoCAD.DatabaseServices.BlockReference.DynamicBlockReferencePropertyCo llection AcDbDynBlockReference::isDynamicBlock Autodesk.AutoCAD.DatabaseServices.BlockReference.IsDynamicBlock AcDbDynBlockReference::resetBlock Autodesk.AutoCAD.DatabaseServices.BlockReference.ResetBlock AcDbDynBlockReferenceProperty::blockId Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.BlockId AcDbDynBlockReferenceProperty::description Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.Description AcDbDynBlockReferenceProperty::getAllowedValues Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.GetAllowedValues AcDbDynBlockReferenceProperty::propertyName Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.PropertyName AcDbDynBlockReferenceProperty::propertyType Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.PropertyTypeCod e [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 492 AcDbDynBlockReferenceProperty::readOnly Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.ReadOnly AcDbDynBlockReferenceProperty::setValue Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.Value AcDbDynBlockReferenceProperty::show Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.Show AcDbDynBlockReferenceProperty::unitsType Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.UnitsType AcDbDynBlockReferenceProperty::value Autodesk.AutoCAD.DatabaseServices.DynamicBlockReferenceProperty.Value AcDbEllipse::angleAtParam Autodesk.AutoCAD.DatabaseServices.Ellipse.GetAngleAtParameter AcDbEllipse::center Autodesk.AutoCAD.DatabaseServices.Ellipse.Center AcDbEllipse::endAngle Autodesk.AutoCAD.DatabaseServices.Ellipse.EndAngle AcDbEllipse::getEndParam Autodesk.AutoCAD.DatabaseServices.Ellipse.EndParam AcDbEllipse::getStartParam Autodesk.AutoCAD.DatabaseServices.Ellipse.StartParam AcDbEllipse::isNull Autodesk.AutoCAD.DatabaseServices.Ellipse.IsNull AcDbEllipse::majorAxis Autodesk.AutoCAD.DatabaseServices.Ellipse.MajorAxis AcDbEllipse::minorAxis Autodesk.AutoCAD.DatabaseServices.Ellipse.MinorAxis AcDbEllipse::normal Autodesk.AutoCAD.DatabaseServices.Ellipse.Normal AcDbEllipse::paramAtAngle Autodesk.AutoCAD.DatabaseServices.Ellipse.GetParameterAtAngle AcDbEllipse::radiusRatio Autodesk.AutoCAD.DatabaseServices.Ellipse.RadiusRatio AcDbEllipse::set Autodesk.AutoCAD.DatabaseServices.Ellipse.Set AcDbEllipse::setCenter Autodesk.AutoCAD.DatabaseServices.Ellipse.Center AcDbEllipse::setEndAngle Autodesk.AutoCAD.DatabaseServices.Ellipse.EndAngle AcDbEllipse::setEndParam Autodesk.AutoCAD.DatabaseServices.Ellipse.EndParam AcDbEllipse::setRadiusRatio Autodesk.AutoCAD.DatabaseServices.Ellipse.RadiusRatio AcDbEllipse::setStartAngle Autodesk.AutoCAD.DatabaseServices.Ellipse.StartAngle AcDbEllipse::setStartParam Autodesk.AutoCAD.DatabaseServices.Ellipse.StartParam AcDbEllipse::startAngle Autodesk.AutoCAD.DatabaseServices.Ellipse.StartAngle AcDbEntity::blockId Autodesk.AutoCAD.DatabaseServices.Entity.BlockId AcDbEntity::boundingBoxIntersectWith Autodesk.AutoCAD.DatabaseServices.Entity.BoundingBoxIntersectWith AcDbEntity::boundingBoxIntersectWith Autodesk.AutoCAD.DatabaseServices.Entity.BoundingBoxIntersectWith AcDbEntity::cloneMeForDragging Autodesk.AutoCAD.DatabaseServices.Entity.CloneMeForDragging AcDbEntity::color Autodesk.AutoCAD.DatabaseServices.Entity.Color AcDbEntity::colorIndex Autodesk.AutoCAD.DatabaseServices.Entity.ColorIndex AcDbEntity::dragStatus Autodesk.AutoCAD.DatabaseServices.Entity.SetDragStatus AcDbEntity::draw Autodesk.AutoCAD.DatabaseServices.Entity.Draw AcDbEntity::entityColor Autodesk.AutoCAD.DatabaseServices.Entity.EntityColor AcDbEntity::explode Autodesk.AutoCAD.DatabaseServices.Entity.Explode AcDbEntity::getCompoundObjectTransform Autodesk.AutoCAD.DatabaseServices.Entity.CompoundObjectTransform AcDbEntity::getEcs Autodesk.AutoCAD.DatabaseServices.Entity.Ecs AcDbEntity::getGeomExtents Autodesk.AutoCAD.DatabaseServices.Entity.GeomExtents AcDbEntity::getGsMarkersAtSubentPath Autodesk.AutoCAD.DatabaseServices.Entity.GetGraphicsMarkersAtSubentityPath AcDbEntity::getOsnapPoints Autodesk.AutoCAD.DatabaseServices.Entity.GetObjectSnapPoints AcDbEntity::getOsnapPoints Autodesk.AutoCAD.DatabaseServices.Entity.GetObjectSnapPoints AcDbEntity::getPlane Autodesk.AutoCAD.DatabaseServices.Entity.GetPlane AcDbEntity::getPlotStyleNameId Autodesk.AutoCAD.DatabaseServices.Entity.PlotStyleNameId AcDbEntity::getStretchPoints Autodesk.AutoCAD.DatabaseServices.Entity.GetStretchPoints AcDbEntity::getTransformedCopy Autodesk.AutoCAD.DatabaseServices.Entity.GetTransformedCopy [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 493 AcDbEntity::gripStatus Autodesk.AutoCAD.DatabaseServices.Entity.SetGripStatus AcDbEntity::highlight Autodesk.AutoCAD.DatabaseServices.Entity.Highlight AcDbEntity::intersectWith Autodesk.AutoCAD.DatabaseServices.Entity.IntersectWith AcDbEntity::intersectWith Autodesk.AutoCAD.DatabaseServices.Entity.IntersectWith AcDbEntity::isPlanar Autodesk.AutoCAD.DatabaseServices.Entity.IsPlanar AcDbEntity::layer Autodesk.AutoCAD.DatabaseServices.Entity.Layer AcDbEntity::layerId Autodesk.AutoCAD.DatabaseServices.Entity.LayerId AcDbEntity::linetype Autodesk.AutoCAD.DatabaseServices.Entity.Linetype AcDbEntity::linetypeId Autodesk.AutoCAD.DatabaseServices.Entity.LinetypeId AcDbEntity::linetypeScale Autodesk.AutoCAD.DatabaseServices.Entity.LinetypeScale AcDbEntity::lineWeight Autodesk.AutoCAD.DatabaseServices.Entity.LineWeight AcDbEntity::list Autodesk.AutoCAD.DatabaseServices.Entity.List AcDbEntity::moveGripPointsAt Autodesk.AutoCAD.DatabaseServices.Entity.GetGripPoints AcDbEntity::moveGripPointsAt Autodesk.AutoCAD.DatabaseServices.Entity.MoveGripPointsAt AcDbEntity::moveStretchPointsAt Autodesk.AutoCAD.DatabaseServices.Entity.MoveStretchPointsAt AcDbEntity::plotStyleName Autodesk.AutoCAD.DatabaseServices.Entity.PlotStyleName AcDbEntity::recordGraphicsModified Autodesk.AutoCAD.DatabaseServices.Entity.RecordGraphicsModified AcDbEntity::saveAs Autodesk.AutoCAD.DatabaseServices.Entity.SaveAs AcDbEntity::setColor Autodesk.AutoCAD.DatabaseServices.Entity.Color AcDbEntity::setColorIndex Autodesk.AutoCAD.DatabaseServices.Entity.ColorIndex AcDbEntity::setDatabaseDefaults Autodesk.AutoCAD.DatabaseServices.Entity.SetDatabaseDefaults AcDbEntity::setDatabaseDefaults Autodesk.AutoCAD.DatabaseServices.Entity.SetDatabaseDefaults AcDbEntity::setLayer Autodesk.AutoCAD.DatabaseServices.Entity.Layer AcDbEntity::setLayer Autodesk.AutoCAD.DatabaseServices.Entity.LayerId AcDbEntity::setLinetype Autodesk.AutoCAD.DatabaseServices.Entity.Linetype AcDbEntity::setLinetype Autodesk.AutoCAD.DatabaseServices.Entity.LinetypeId AcDbEntity::setLinetypeScale Autodesk.AutoCAD.DatabaseServices.Entity.LinetypeScale AcDbEntity::setLineWeight Autodesk.AutoCAD.DatabaseServices.Entity.LineWeight AcDbEntity::setPlotStyleName Autodesk.AutoCAD.DatabaseServices.Entity.PlotStyleName AcDbEntity::setPlotStyleName Autodesk.AutoCAD.DatabaseServices.Entity.PlotStyleNameId AcDbEntity::setPropertiesFrom Autodesk.AutoCAD.DatabaseServices.Entity.SetPropertiesFrom AcDbEntity::setTransparency Autodesk.AutoCAD.DatabaseServices.Entity.Transparency AcDbEntity::setVisibility Autodesk.AutoCAD.DatabaseServices.Entity.Visible AcDbEntity::subentPtr Autodesk.AutoCAD.DatabaseServices.Entity.GetSubentity AcDbEntity::transformBy Autodesk.AutoCAD.DatabaseServices.Entity.TransformBy AcDbEntity::transparency Autodesk.AutoCAD.DatabaseServices.Entity.Transparency AcDbEntity::unhighlight Autodesk.AutoCAD.DatabaseServices.Entity.Unhighlight AcDbEntity::visibility Autodesk.AutoCAD.DatabaseServices.Entity.Visible AcDbEntityHyperlinkPE::desc Autodesk.AutoCAD.DatabaseServices.Entity.Hyperlinks AcDbEvalGraph::getGraph Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsDynamicBlock AcDbExtents::addBlockExt Autodesk.AutoCAD.DatabaseServices.Extents3d.AddBlockExtents AcDbExtents::addExt Autodesk.AutoCAD.DatabaseServices.Extents3d.AddExtents AcDbExtents::addPoint Autodesk.AutoCAD.DatabaseServices.Extents3d.AddPoint AcDbExtents::expandBy Autodesk.AutoCAD.DatabaseServices.Extents3d.ExpandBy [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 494 AcDbExtents::set Autodesk.AutoCAD.DatabaseServices.Extents3d.Set AcDbExtents::transformBy Autodesk.AutoCAD.DatabaseServices.Extents3d.TransformBy AcDbFace::getVertexAt Autodesk.AutoCAD.DatabaseServices.Face.GetVertexAt AcDbFace::isEdgeVisibleAt Autodesk.AutoCAD.DatabaseServices.Face.IsEdgeVisibleAt AcDbFace::makeEdgeInvisibleAt Autodesk.AutoCAD.DatabaseServices.Face.MakeEdgeInvisibleAt AcDbFace::makeEdgeVisibleAt Autodesk.AutoCAD.DatabaseServices.Face.MakeEdgeVisibleAt AcDbFace::setVertexAt Autodesk.AutoCAD.DatabaseServices.Face.SetVertexAt AcDbFaceRecord::getVertexAt Autodesk.AutoCAD.DatabaseServices.FaceRecord.GetVertexAt AcDbFaceRecord::isEdgeVisibleAt Autodesk.AutoCAD.DatabaseServices.FaceRecord.IsEdgeVisibleAt AcDbFaceRecord::makeEdgeInvisibleAt Autodesk.AutoCAD.DatabaseServices.FaceRecord.MakeEdgeInvisibleAt AcDbFaceRecord::makeEdgeVisibleAt Autodesk.AutoCAD.DatabaseServices.FaceRecord.MakeEdgeVisibleAt AcDbFaceRecord::setVertexAt Autodesk.AutoCAD.DatabaseServices.FaceRecord.SetVertexAt AcDbFcf::dimclrd Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimclrd AcDbFcf::dimclrt Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimclrt AcDbFcf::dimensionStyle Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.DimensionStyle AcDbFcf::dimgap Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimgap AcDbFcf::dimscale Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimscale AcDbFcf::dimtxsty Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimtxsty AcDbFcf::dimtxt Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimtxt AcDbFcf::direction Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Direction AcDbFcf::getBoundingPline Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.GetBoundingPolyline AcDbFcf::getBoundingPoints Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.GetBoundingPoints AcDbFcf::getDimstyleData Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.DimstyleData AcDbFcf::location Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Location AcDbFcf::normal Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Normal AcDbFcf::setDimclrd Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimclrd AcDbFcf::setDimclrt Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimclrt AcDbFcf::setDimensionStyle Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.DimensionStyle AcDbFcf::setDimgap Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimgap AcDbFcf::setDimscale Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimscale AcDbFcf::setDimstyleData Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.DimstyleData AcDbFcf::setDimtxsty Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimtxsty AcDbFcf::setDimtxt Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Dimtxt AcDbFcf::setLocation Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Location AcDbFcf::setOrientation Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.SetOrientation AcDbFcf::setText Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Text AcDbFcf::text Autodesk.AutoCAD.DatabaseServices.FeatureControlFrame.Text AcDbFilter::indexClass Autodesk.AutoCAD.DatabaseServices.Filters.Filter.IndexClass AcDbFilteredBlockIterator::accepts Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.Accepts AcDbFilteredBlockIterator::addToBuffer Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.AddToBuffer AcDbFilteredBlockIterator::buffersForComposition Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.BuffersForComposition AcDbFilteredBlockIterator::estimatedHitFraction Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.EstimatedHitFraction AcDbFilteredBlockIterator::id Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.Id AcDbFilteredBlockIterator::next Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.Next [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 495 AcDbFilteredBlockIterator::seek Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.Seek AcDbFilteredBlockIterator::start Autodesk.AutoCAD.DatabaseServices.Filters.FilteredBlockIterator.Start acdbFree Autodesk.AutoCAD.Colors.Color.DictionaryKey AcDbFullSubentPath::subentId Autodesk.AutoCAD.DatabaseServices.FullSubentityPath.SubentId acdbGetExtnames Autodesk.AutoCAD.DatabaseServices.Database.AllowExtendedNames acdbGetHostDwgXrefGraph Autodesk.AutoCAD.DatabaseServices.Database.GetHostDwgXrefGraph acdbGetReservedString Autodesk.AutoCAD.DatabaseServices.LineWeightConverter.ConvertTo acdbGetReservedString Autodesk.AutoCAD.DatabaseServices.LineWeightConverter.ConvertTo acdbGetReservedString Autodesk.AutoCAD.DatabaseServices.LineWeightConverter.ConvertTo acdbGetSummaryInfo Autodesk.AutoCAD.DatabaseServices.Database.SummaryInfo acdbGetSummaryInfo Autodesk.AutoCAD.DatabaseServices.Database.SummaryInfo AcDbGraph::addEdge Autodesk.AutoCAD.DatabaseServices.Graph.AddEdge AcDbGraph::addNode Autodesk.AutoCAD.DatabaseServices.Graph.AddNode AcDbGraph::breakCycleEdge Autodesk.AutoCAD.DatabaseServices.Graph.BreakCycleEdge AcDbGraph::clearAll Autodesk.AutoCAD.DatabaseServices.Graph.ClearAll AcDbGraph::delNode Autodesk.AutoCAD.DatabaseServices.Graph.DelNode AcDbGraph::findCycles Autodesk.AutoCAD.DatabaseServices.Graph.FindCycles AcDbGraph::getOutgoing Autodesk.AutoCAD.DatabaseServices.Graph.GetOutgoing AcDbGraph::isEmpty Autodesk.AutoCAD.DatabaseServices.Graph.IsEmpty AcDbGraph::numNodes Autodesk.AutoCAD.DatabaseServices.Graph.NumNodes AcDbGraph::reset Autodesk.AutoCAD.DatabaseServices.Graph.Reset AcDbGraph::rootNode Autodesk.AutoCAD.DatabaseServices.Graph.RootNode AcDbGraph::setNodeGrowthRate Autodesk.AutoCAD.DatabaseServices.Graph.SetNodeGrowthRate AcDbGraphNode::addRefTo Autodesk.AutoCAD.DatabaseServices.GraphNode.AddRefTo AcDbGraphNode::clear Autodesk.AutoCAD.DatabaseServices.GraphNode.Clear AcDbGraphNode::data Autodesk.AutoCAD.DatabaseServices.GraphNode.Data AcDbGraphNode::disconnectAll Autodesk.AutoCAD.DatabaseServices.GraphNode.DisconnectAll AcDbGraphNode::isCycleNode Autodesk.AutoCAD.DatabaseServices.GraphNode.IsCycleNode AcDbGraphNode::markAs Autodesk.AutoCAD.DatabaseServices.GraphNode.MarkAs AcDbGraphNode::markTree Autodesk.AutoCAD.DatabaseServices.GraphNode.MarkTree AcDbGraphNode::nextCycleNode Autodesk.AutoCAD.DatabaseServices.GraphNode.NextCycleNode AcDbGraphNode::numCycleIn Autodesk.AutoCAD.DatabaseServices.GraphNode.NumCycleIn AcDbGraphNode::numCycleOut Autodesk.AutoCAD.DatabaseServices.GraphNode.NumCycleOut AcDbGraphNode::numIn Autodesk.AutoCAD.DatabaseServices.GraphNode.NumIn AcDbGraphNode::numOut Autodesk.AutoCAD.DatabaseServices.GraphNode.NumOut AcDbGraphNode::owner Autodesk.AutoCAD.DatabaseServices.GraphNode.Owner AcDbGraphNode::removeRefTo Autodesk.AutoCAD.DatabaseServices.GraphNode.RemoveRefTo AcDbGraphNode::setEdgeGrowthRate Autodesk.AutoCAD.DatabaseServices.GraphNode.SetEdgeGrowthRate AcDbGroup::allEntityIds Autodesk.AutoCAD.DatabaseServices.Group.GetAllEntityIds AcDbGroup::append Autodesk.AutoCAD.DatabaseServices.Group.Append AcDbGroup::append Autodesk.AutoCAD.DatabaseServices.Group.Append AcDbGroup::clear Autodesk.AutoCAD.DatabaseServices.Group.Clear AcDbGroup::description Autodesk.AutoCAD.DatabaseServices.Group.Description AcDbGroup::getIndex Autodesk.AutoCAD.DatabaseServices.Group.GetIndex [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 496 AcDbGroup::getName Autodesk.AutoCAD.DatabaseServices.Group.Name AcDbGroup::has Autodesk.AutoCAD.DatabaseServices.Group.Has AcDbGroup::insertAt Autodesk.AutoCAD.DatabaseServices.Group.InsertAt AcDbGroup::insertAt Autodesk.AutoCAD.DatabaseServices.Group.InsertAt AcDbGroup::isAnonymous Autodesk.AutoCAD.DatabaseServices.Group.IsAnonymous AcDbGroup::isNotAccessible Autodesk.AutoCAD.DatabaseServices.Group.IsNotAccessible AcDbGroup::isSelectable Autodesk.AutoCAD.DatabaseServices.Group.Selectable AcDbGroup::numEntities Autodesk.AutoCAD.DatabaseServices.Group.NumEntities AcDbGroup::prepend Autodesk.AutoCAD.DatabaseServices.Group.Prepend AcDbGroup::prepend Autodesk.AutoCAD.DatabaseServices.Group.Prepend AcDbGroup::remove Autodesk.AutoCAD.DatabaseServices.Group.Remove AcDbGroup::remove Autodesk.AutoCAD.DatabaseServices.Group.Remove AcDbGroup::removeAt Autodesk.AutoCAD.DatabaseServices.Group.RemoveAt AcDbGroup::removeAt Autodesk.AutoCAD.DatabaseServices.Group.RemoveAt AcDbGroup::replace Autodesk.AutoCAD.DatabaseServices.Group.Replace AcDbGroup::reverse Autodesk.AutoCAD.DatabaseServices.Group.Reverse AcDbGroup::setAnonymous Autodesk.AutoCAD.DatabaseServices.Group.SetAnonymous AcDbGroup::setColor Autodesk.AutoCAD.DatabaseServices.Group.SetColor AcDbGroup::setColorIndex Autodesk.AutoCAD.DatabaseServices.Group.SetColorIndex AcDbGroup::setDescription Autodesk.AutoCAD.DatabaseServices.Group.Description AcDbGroup::setHighlight Autodesk.AutoCAD.DatabaseServices.Group.SetHighlight AcDbGroup::setLayer Autodesk.AutoCAD.DatabaseServices.Group.SetLayer AcDbGroup::setLayer Autodesk.AutoCAD.DatabaseServices.Group.SetLayer AcDbGroup::setLinetype Autodesk.AutoCAD.DatabaseServices.Group.SetLinetype AcDbGroup::setLinetype Autodesk.AutoCAD.DatabaseServices.Group.SetLinetype AcDbGroup::setLinetypeScale Autodesk.AutoCAD.DatabaseServices.Group.SetLinetypeScale AcDbGroup::setName Autodesk.AutoCAD.DatabaseServices.Group.Name AcDbGroup::setSelectable Autodesk.AutoCAD.DatabaseServices.Group.Selectable AcDbGroup::setVisibility Autodesk.AutoCAD.DatabaseServices.Group.SetVisibility AcDbGroup::transfer Autodesk.AutoCAD.DatabaseServices.Group.Transfer AcDbHandle::getIntoAsciiBuffer Autodesk.AutoCAD.DatabaseServices.Handle.ToString AcDbHandle::isOne Autodesk.AutoCAD.DatabaseServices.Handle.IsOne AcDbHatch::appendLoop Autodesk.AutoCAD.DatabaseServices.Hatch.AppendLoop AcDbHatch::appendLoop Autodesk.AutoCAD.DatabaseServices.Hatch.AppendLoop AcDbHatch::associative Autodesk.AutoCAD.DatabaseServices.Hatch.Associative AcDbHatch::elevation Autodesk.AutoCAD.DatabaseServices.Hatch.Elevation AcDbHatch::evaluateGradientColorAt Autodesk.AutoCAD.DatabaseServices.Hatch.EvaluateGradientColorAt AcDbHatch::evaluateHatch Autodesk.AutoCAD.DatabaseServices.Hatch.EvaluateHatch AcDbHatch::getAssocObjIds Autodesk.AutoCAD.DatabaseServices.Hatch.GetAssociatedObjectIds AcDbHatch::getAssocObjIdsAt Autodesk.AutoCAD.DatabaseServices.Hatch.GetAssociatedObjectIdsAt AcDbHatch::getGradientOneColorMode Autodesk.AutoCAD.DatabaseServices.Hatch.GradientOneColorMode AcDbHatch::getHatchLineDataAt Autodesk.AutoCAD.DatabaseServices.Hatch.GetHatchLineDataAt AcDbHatch::getHatchLinesData Autodesk.AutoCAD.DatabaseServices.Hatch.GetHatchLinesData AcDbHatch::getLoopAt Autodesk.AutoCAD.DatabaseServices.Hatch.GetLoopAt [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 497 AcDbHatch::getPatternDefinitionAt Autodesk.AutoCAD.DatabaseServices.Hatch.GetPatternDefinitionAt AcDbHatch::getShadeTintValue Autodesk.AutoCAD.DatabaseServices.Hatch.ShadeTintValue AcDbHatch::gradientAngle Autodesk.AutoCAD.DatabaseServices.Hatch.GradientAngle AcDbHatch::gradientName Autodesk.AutoCAD.DatabaseServices.Hatch.GradientName AcDbHatch::gradientShift Autodesk.AutoCAD.DatabaseServices.Hatch.GradientShift AcDbHatch::gradientType Autodesk.AutoCAD.DatabaseServices.Hatch.GradientType AcDbHatch::hatchObjectType Autodesk.AutoCAD.DatabaseServices.Hatch.HatchObjectType AcDbHatch::hatchStyle Autodesk.AutoCAD.DatabaseServices.Hatch.HatchStyle AcDbHatch::insertLoopAt Autodesk.AutoCAD.DatabaseServices.Hatch.InsertLoopAt AcDbHatch::insertLoopAt Autodesk.AutoCAD.DatabaseServices.Hatch.InsertLoopAt AcDbHatch::isGradient Autodesk.AutoCAD.DatabaseServices.Hatch.IsGradient AcDbHatch::isHatch Autodesk.AutoCAD.DatabaseServices.Hatch.IsHatch AcDbHatch::isSolidFill Autodesk.AutoCAD.DatabaseServices.Hatch.IsSolidFill AcDbHatch::loopTypeAt Autodesk.AutoCAD.DatabaseServices.Hatch.LoopTypeAt AcDbHatch::normal Autodesk.AutoCAD.DatabaseServices.Hatch.Normal AcDbHatch::numHatchLines Autodesk.AutoCAD.DatabaseServices.Hatch.NumberOfHatchLines AcDbHatch::numLoops Autodesk.AutoCAD.DatabaseServices.Hatch.NumberOfLoops AcDbHatch::numPatternDefinitions Autodesk.AutoCAD.DatabaseServices.Hatch.NumberOfPatternDefinitions AcDbHatch::patternAngle Autodesk.AutoCAD.DatabaseServices.Hatch.PatternAngle AcDbHatch::patternDouble Autodesk.AutoCAD.DatabaseServices.Hatch.PatternDouble AcDbHatch::patternName Autodesk.AutoCAD.DatabaseServices.Hatch.PatternName AcDbHatch::patternScale Autodesk.AutoCAD.DatabaseServices.Hatch.PatternScale AcDbHatch::patternSpace Autodesk.AutoCAD.DatabaseServices.Hatch.PatternSpace AcDbHatch::patternType Autodesk.AutoCAD.DatabaseServices.Hatch.PatternType AcDbHatch::removeAssocObjIds Autodesk.AutoCAD.DatabaseServices.Hatch.RemoveAssociatedObjectIds AcDbHatch::removeLoopAt Autodesk.AutoCAD.DatabaseServices.Hatch.RemoveLoopAt AcDbHatch::setAssociative Autodesk.AutoCAD.DatabaseServices.Hatch.Associative AcDbHatch::setElevation Autodesk.AutoCAD.DatabaseServices.Hatch.Elevation AcDbHatch::setGradient Autodesk.AutoCAD.DatabaseServices.Hatch.SetGradient AcDbHatch::setGradientAngle Autodesk.AutoCAD.DatabaseServices.Hatch.GradientAngle AcDbHatch::setGradientOneColorMode Autodesk.AutoCAD.DatabaseServices.Hatch.GradientOneColorMode AcDbHatch::setGradientShift Autodesk.AutoCAD.DatabaseServices.Hatch.GradientShift AcDbHatch::setHatchObjectType Autodesk.AutoCAD.DatabaseServices.Hatch.HatchObjectType AcDbHatch::setHatchStyle Autodesk.AutoCAD.DatabaseServices.Hatch.HatchStyle AcDbHatch::setNormal Autodesk.AutoCAD.DatabaseServices.Hatch.Normal AcDbHatch::setPattern Autodesk.AutoCAD.DatabaseServices.Hatch.SetHatchPattern AcDbHatch::setPatternAngle Autodesk.AutoCAD.DatabaseServices.Hatch.PatternAngle AcDbHatch::setPatternDouble Autodesk.AutoCAD.DatabaseServices.Hatch.PatternDouble AcDbHatch::setPatternScale Autodesk.AutoCAD.DatabaseServices.Hatch.PatternScale AcDbHatch::setPatternSpace Autodesk.AutoCAD.DatabaseServices.Hatch.PatternSpace AcDbHatch::setShadeTintValue Autodesk.AutoCAD.DatabaseServices.Hatch.ShadeTintValue AcDbHostApplicationServices::companyName Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.CompanyName AcDbHostApplicationServices::getAlternateFontName Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.AlternateFontName AcDbHostApplicationServices::getFontMapFileName Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.FontMapFileName [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 498 AcDbHostApplicationServices::getLocalRootFolder Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.LocalRootFolder AcDbHostApplicationServices::getModelerFlavor Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.ModelerFlavor AcDbHostApplicationServices::getRegistryProductRoo tKey Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.RegistryProductRootKey AcDbHostApplicationServices::getRemoteFile Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.GetRemoteFile AcDbHostApplicationServices::getRoamableRootFolde r Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.RoamableRootFolder AcDbHostApplicationServices::isRemoteFile Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.GetUrl AcDbHostApplicationServices::isURL Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.IsUrl AcDbHostApplicationServices::product Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.Product AcDbHostApplicationServices::program Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.Program AcDbHostApplicationServices::putRemoteFile Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.PutRemoteFile AcDbHostApplicationServices::setWorkingDatabase Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase AcDbHostApplicationServices::workingDatabase Autodesk.AutoCAD.DatabaseServices.HostApplicationServices.WorkingDatabase AcDbHyperlink::description Autodesk.AutoCAD.DatabaseServices.HyperLink.Description AcDbHyperlink::getDisplayString Autodesk.AutoCAD.DatabaseServices.HyperLink.DisplayString AcDbHyperlink::getNestedLevel Autodesk.AutoCAD.DatabaseServices.HyperLink.NestedLevel AcDbHyperlink::HyperLink_Equals Autodesk.AutoCAD.DatabaseServices.HyperLink.Equals AcDbHyperlink::name Autodesk.AutoCAD.DatabaseServices.HyperLink.Name AcDbHyperlink::setDescription Autodesk.AutoCAD.DatabaseServices.HyperLink.Description AcDbHyperlink::setName Autodesk.AutoCAD.DatabaseServices.HyperLink.Name AcDbHyperlink::setSubLocation Autodesk.AutoCAD.DatabaseServices.HyperLink.SubLocation AcDbHyperlink::subLocation Autodesk.AutoCAD.DatabaseServices.HyperLink.SubLocation AcDbHyperlinkCollection::count Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.Count AcDbHyperlinkCollection::HyperLinkCollection_Clear Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.Clear AcDbHyperlinkCollection::HyperLinkCollection_Index Of Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.IndexOf AcDbHyperlinkCollection::item Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.Item AcDbHyperlinkCollection::removeAt Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.RemoveAt AcDbIdMapping::assign Autodesk.AutoCAD.DatabaseServices.IdMapping.Assign AcDbIdMapping::deepCloneContext Autodesk.AutoCAD.DatabaseServices.IdMapping.DeepCloneContext AcDbIdMapping::destDb Autodesk.AutoCAD.DatabaseServices.IdMapping.DestinationDatabase AcDbIdMapping::duplicateRecordCloning Autodesk.AutoCAD.DatabaseServices.IdMapping.DuplicateRecordCloning AcDbIdMapping::origDb Autodesk.AutoCAD.DatabaseServices.IdMapping.OriginalDatabase AcDbIdMapping::setDestDb Autodesk.AutoCAD.DatabaseServices.IdMapping.DestinationDatabase AcDbIdPair::isCloned Autodesk.AutoCAD.DatabaseServices.IdPair.IsCloned AcDbIdPair::isPrimary Autodesk.AutoCAD.DatabaseServices.IdPair.IsPrimary AcDbIdPair::key Autodesk.AutoCAD.DatabaseServices.IdPair.Key AcDbIdPair::value Autodesk.AutoCAD.DatabaseServices.IdPair.Value AcDbImpTransaction::transactionManager Autodesk.AutoCAD.DatabaseServices.Transaction.TransactionManager AcDbImpTransaction::transactionManager Autodesk.AutoCAD.DatabaseServices.Transaction.Abort AcDbImpTransaction::transactionManager Autodesk.AutoCAD.DatabaseServices.Transaction.Commit AcDbImpTransaction::transactionManager Autodesk.AutoCAD.DatabaseServices.Transaction.GetObject AcDbImpTransaction::transactionManager Autodesk.AutoCAD.DatabaseServices.Transaction.GetObject AcDbImpTransaction::transactionManager Autodesk.AutoCAD.DatabaseServices.Transaction.GetObject [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 499 AcDbIndex::isUptoDate Autodesk.AutoCAD.DatabaseServices.Filters.Index.IsUptoDate AcDbIndex::lastUpdatedAt Autodesk.AutoCAD.DatabaseServices.Filters.Index.LastUpdatedAt AcDbIndex::lastUpdatedAtU Autodesk.AutoCAD.DatabaseServices.Filters.Index.LastUpdatedAtU AcDbIndex::newIterator Autodesk.AutoCAD.DatabaseServices.Filters.Index.GetIterator AcDbIndex::objectBeingIndexedId Autodesk.AutoCAD.DatabaseServices.Filters.Index.ObjectBeingIndexedId AcDbIndex::rebuildFull Autodesk.AutoCAD.DatabaseServices.Filters.Index.RebuildFull AcDbIndex::setLastUpdatedAt Autodesk.AutoCAD.DatabaseServices.Filters.Index.LastUpdatedAt AcDbIndex::setLastUpdatedAtU Autodesk.AutoCAD.DatabaseServices.Filters.Index.LastUpdatedAtU AcDbIndexUpdateData::addId Autodesk.AutoCAD.DatabaseServices.Filters.IndexUpdateData.AddId AcDbIndexUpdateData::getIdData Autodesk.AutoCAD.DatabaseServices.Filters.IndexUpdateData.GetIdData AcDbIndexUpdateData::getIdFlags Autodesk.AutoCAD.DatabaseServices.Filters.IndexUpdateData.GetIdFlags AcDbIndexUpdateData::setIdData Autodesk.AutoCAD.DatabaseServices.Filters.IndexUpdateData.SetIdData AcDbIndexUpdateData::setIdFlags Autodesk.AutoCAD.DatabaseServices.Filters.IndexUpdateData.SetIdFlags acdbIsCustomObject Autodesk.AutoCAD.DatabaseServices.DBObject.IsCustomObject acdbIsModelerStarted Autodesk.AutoCAD.Runtime.RuntimeSystem.Terminate AcDbLayerFilter::add Autodesk.AutoCAD.DatabaseServices.Filters.LayerFilter.Add AcDbLayerFilter::getAt Autodesk.AutoCAD.DatabaseServices.Filters.LayerFilter.GetAt AcDbLayerFilter::isValid Autodesk.AutoCAD.DatabaseServices.Filters.LayerFilter.IsValid AcDbLayerFilter::layerCount Autodesk.AutoCAD.DatabaseServices.Filters.LayerFilter.LayerCount AcDbLayerFilter::remove Autodesk.AutoCAD.DatabaseServices.Filters.LayerFilter.Remove AcDbLayerIndex::compute Autodesk.AutoCAD.DatabaseServices.Filters.LayerIndex.Compute AcDbLayerStateManager::deleteLayerState Autodesk.AutoCAD.DatabaseServices.LayerStateManager.DeleteLayerState AcDbLayerStateManager::exportLayerState Autodesk.AutoCAD.DatabaseServices.LayerStateManager.ExportLayerState AcDbLayerStateManager::getLayerStateDescription Autodesk.AutoCAD.DatabaseServices.LayerStateManager.GetLayerStateDescription AcDbLayerStateManager::getLayerStateMask Autodesk.AutoCAD.DatabaseServices.LayerStateManager.GetLayerStateMask AcDbLayerStateManager::hasLayerState Autodesk.AutoCAD.DatabaseServices.LayerStateManager.HasLayerState AcDbLayerStateManager::importLayerState Autodesk.AutoCAD.DatabaseServices.LayerStateManager.ImportLayerState AcDbLayerStateManager::layerStateHasViewportData Autodesk.AutoCAD.DatabaseServices.LayerStateManager.LayerStateHasViewportData AcDbLayerStateManager::layerStatesDictionaryId Autodesk.AutoCAD.DatabaseServices.LayerStateManager.LayerStatesDictionaryId AcDbLayerStateManager::renameLayerState Autodesk.AutoCAD.DatabaseServices.LayerStateManager.RenameLayerState AcDbLayerStateManager::restoreLayerState Autodesk.AutoCAD.DatabaseServices.LayerStateManager.RestoreLayerState AcDbLayerStateManager::saveLayerState Autodesk.AutoCAD.DatabaseServices.LayerStateManager.SaveLayerState AcDbLayerStateManager::setLayerStateDescription Autodesk.AutoCAD.DatabaseServices.LayerStateManager.SetLayerStateDescription AcDbLayerStateManager::setLayerStateMask Autodesk.AutoCAD.DatabaseServices.LayerStateManager.SetLayerStateMask AcDbLayerTable::generateUsageData Autodesk.AutoCAD.DatabaseServices.LayerTable.GenerateUsageData AcDbLayerTableRecord::color Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.Color AcDbLayerTableRecord::description Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.Description AcDbLayerTableRecord::entityColor Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.EntityColor AcDbLayerTableRecord::isFrozen Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsFrozen AcDbLayerTableRecord::isInUse Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsUsed AcDbLayerTableRecord::isLocked Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsLocked AcDbLayerTableRecord::isOff Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsOff AcDbLayerTableRecord::isPlottable Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsPlottable AcDbLayerTableRecord::linetypeObjectId Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.LinetypeObjectId [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 500 AcDbLayerTableRecord::lineWeight Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.LineWeight AcDbLayerTableRecord::plotStyleName Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.PlotStyleName AcDbLayerTableRecord::plotStyleNameId Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.PlotStyleNameId AcDbLayerTableRecord::setColor Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.Color AcDbLayerTableRecord::setDescription Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.Description AcDbLayerTableRecord::setIsFrozen Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsFrozen AcDbLayerTableRecord::setIsLocked Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsLocked AcDbLayerTableRecord::setIsOff Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsOff AcDbLayerTableRecord::setIsPlottable Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.IsPlottable AcDbLayerTableRecord::setLinetypeObjectId Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.LinetypeObjectId AcDbLayerTableRecord::setLineWeight Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.LineWeight AcDbLayerTableRecord::setPlotStyleName Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.PlotStyleNameId AcDbLayerTableRecord::setPlotStyleName Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.PlotStyleName AcDbLayerTableRecord::setTransparency Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.Transparency AcDbLayerTableRecord::setVPDFLT Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.ViewportVisibilityDefault AcDbLayerTableRecord::transparency Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.Transparency AcDbLayerTableRecord::VPDFLT Autodesk.AutoCAD.DatabaseServices.LayerTableRecord.ViewportVisibilityDefault AcDbLayout::addToLayoutDict Autodesk.AutoCAD.DatabaseServices.Layout.AddToLayoutDictionary AcDbLayout::getBlockTableRecordId Autodesk.AutoCAD.DatabaseServices.Layout.BlockTableRecordId AcDbLayout::getLayoutName Autodesk.AutoCAD.DatabaseServices.Layout.LayoutName AcDbLayout::getTabOrder Autodesk.AutoCAD.DatabaseServices.Layout.TabOrder AcDbLayout::getTabSelected Autodesk.AutoCAD.DatabaseServices.Layout.TabSelected AcDbLayout::getViewportArray Autodesk.AutoCAD.DatabaseServices.Layout.GetViewports AcDbLayout::setBlockTableRecordId Autodesk.AutoCAD.DatabaseServices.Layout.BlockTableRecordId AcDbLayout::setLayoutName Autodesk.AutoCAD.DatabaseServices.Layout.LayoutName AcDbLayout::setTabOrder Autodesk.AutoCAD.DatabaseServices.Layout.TabOrder AcDbLayout::setTabSelected Autodesk.AutoCAD.DatabaseServices.Layout.TabSelected AcDbLayoutManager::copyLayout Autodesk.AutoCAD.DatabaseServices.LayoutManager.CopyLayout AcDbLayoutManager::countLayouts Autodesk.AutoCAD.DatabaseServices.LayoutManager.LayoutCount AcDbLayoutManager::createLayout Autodesk.AutoCAD.DatabaseServices.LayoutManager.CreateLayout AcDbLayoutManager::deleteLayout Autodesk.AutoCAD.DatabaseServices.LayoutManager.DeleteLayout AcDbLayoutManager::findActiveLayout Autodesk.AutoCAD.DatabaseServices.LayoutManager.CurrentLayout AcDbLayoutManager::findLayoutNamed Autodesk.AutoCAD.DatabaseServices.LayoutManager.GetLayoutId AcDbLayoutManager::findLayoutNamed Autodesk.AutoCAD.DatabaseServices.LayoutManager.CloneLayout AcDbLayoutManager::getNonRectVPIdFromClipId Autodesk.AutoCAD.DatabaseServices.LayoutManager.GetNonRectangularViewportIdFro mClipId AcDbLayoutManager::renameLayout Autodesk.AutoCAD.DatabaseServices.LayoutManager.RenameLayout AcDbLayoutManager::setCurrentLayout Autodesk.AutoCAD.DatabaseServices.LayoutManager.CurrentLayout AcDbLeader::annoHeight Autodesk.AutoCAD.DatabaseServices.Leader.AnnoHeight AcDbLeader::annotationObjId Autodesk.AutoCAD.DatabaseServices.Leader.Annotation AcDbLeader::annotationOffset Autodesk.AutoCAD.DatabaseServices.Leader.AnnotationOffset AcDbLeader::annoType Autodesk.AutoCAD.DatabaseServices.Leader.AnnoType AcDbLeader::annoWidth Autodesk.AutoCAD.DatabaseServices.Leader.AnnoWidth AcDbLeader::appendVertex Autodesk.AutoCAD.DatabaseServices.Leader.AppendVertex [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 501 AcDbLeader::detachAnnotation Autodesk.AutoCAD.DatabaseServices.Leader.Annotation AcDbLeader::dimasz Autodesk.AutoCAD.DatabaseServices.Leader.Dimasz AcDbLeader::dimclrd Autodesk.AutoCAD.DatabaseServices.Leader.Dimclrd AcDbLeader::dimensionStyle Autodesk.AutoCAD.DatabaseServices.Leader.DimensionStyle AcDbLeader::dimgap Autodesk.AutoCAD.DatabaseServices.Leader.Dimgap AcDbLeader::dimldrblk Autodesk.AutoCAD.DatabaseServices.Leader.Dimldrblk AcDbLeader::dimlwd Autodesk.AutoCAD.DatabaseServices.Leader.Dimlwd AcDbLeader::dimscale Autodesk.AutoCAD.DatabaseServices.Leader.Dimscale AcDbLeader::dimtad Autodesk.AutoCAD.DatabaseServices.Leader.Dimtad AcDbLeader::dimtxsty Autodesk.AutoCAD.DatabaseServices.Leader.Dimtxsty AcDbLeader::dimtxt Autodesk.AutoCAD.DatabaseServices.Leader.Dimtxt AcDbLeader::enableArrowHead Autodesk.AutoCAD.DatabaseServices.Leader.HasArrowHead AcDbLeader::evaluateLeader Autodesk.AutoCAD.DatabaseServices.Leader.EvaluateLeader AcDbLeader::firstVertex Autodesk.AutoCAD.DatabaseServices.Leader.FirstVertex AcDbLeader::getDimstyleData Autodesk.AutoCAD.DatabaseServices.Leader.DimstyleData AcDbLeader::hasArrowHead Autodesk.AutoCAD.DatabaseServices.Leader.HasArrowHead AcDbLeader::hasHookLine Autodesk.AutoCAD.DatabaseServices.Leader.HasHookLine AcDbLeader::isSplined Autodesk.AutoCAD.DatabaseServices.Leader.IsSplined AcDbLeader::lastVertex Autodesk.AutoCAD.DatabaseServices.Leader.LastVertex AcDbLeader::normal Autodesk.AutoCAD.DatabaseServices.Leader.Normal AcDbLeader::numVertices Autodesk.AutoCAD.DatabaseServices.Leader.NumVertices AcDbLeader::removeLastVertex Autodesk.AutoCAD.DatabaseServices.Leader.RemoveLastVertex AcDbLeader::setAnnotationOffset Autodesk.AutoCAD.DatabaseServices.Leader.AnnotationOffset AcDbLeader::setDimasz Autodesk.AutoCAD.DatabaseServices.Leader.Dimasz AcDbLeader::setDimclrd Autodesk.AutoCAD.DatabaseServices.Leader.Dimclrd AcDbLeader::setDimensionStyle Autodesk.AutoCAD.DatabaseServices.Leader.DimensionStyle AcDbLeader::setDimgap Autodesk.AutoCAD.DatabaseServices.Leader.Dimgap AcDbLeader::setDimldrblk Autodesk.AutoCAD.DatabaseServices.Leader.Dimldrblk AcDbLeader::setDimlwd Autodesk.AutoCAD.DatabaseServices.Leader.Dimlwd AcDbLeader::setDimsah Autodesk.AutoCAD.DatabaseServices.Leader.Dimsah AcDbLeader::setDimscale Autodesk.AutoCAD.DatabaseServices.Leader.Dimscale AcDbLeader::setDimstyleData Autodesk.AutoCAD.DatabaseServices.Leader.DimstyleData AcDbLeader::setDimtad Autodesk.AutoCAD.DatabaseServices.Leader.Dimtad AcDbLeader::setDimtxsty Autodesk.AutoCAD.DatabaseServices.Leader.Dimtxsty AcDbLeader::setDimtxt Autodesk.AutoCAD.DatabaseServices.Leader.Dimtxt AcDbLeader::setPlane Autodesk.AutoCAD.DatabaseServices.Leader.SetPlane AcDbLeader::setToSplineLeader Autodesk.AutoCAD.DatabaseServices.Leader.IsSplined AcDbLeader::setVertexAt Autodesk.AutoCAD.DatabaseServices.Leader.SetVertexAt AcDbLeader::vertexAt Autodesk.AutoCAD.DatabaseServices.Leader.VertexAt AcDbLine::endPoint Autodesk.AutoCAD.DatabaseServices.Line.EndPoint AcDbLine::normal Autodesk.AutoCAD.DatabaseServices.Line.Normal AcDbLine::setEndPoint Autodesk.AutoCAD.DatabaseServices.Line.EndPoint AcDbLine::setNormal Autodesk.AutoCAD.DatabaseServices.Line.Normal AcDbLine::setStartPoint Autodesk.AutoCAD.DatabaseServices.Line.StartPoint [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 502 AcDbLine::setThickness Autodesk.AutoCAD.DatabaseServices.Line.Thickness AcDbLine::startPoint Autodesk.AutoCAD.DatabaseServices.Line.StartPoint AcDbLine::thickness Autodesk.AutoCAD.DatabaseServices.Line.Thickness AcDbLinetypeTableRecord::comments Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.Comments AcDbLinetypeTableRecord::comments Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.AsciiDescription AcDbLinetypeTableRecord::dashLengthAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.DashLengthAt AcDbLinetypeTableRecord::isScaledToFit Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.IsScaledToFit AcDbLinetypeTableRecord::numDashes Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.NumDashes AcDbLinetypeTableRecord::patternLength Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.PatternLength AcDbLinetypeTableRecord::setComments Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.Comments AcDbLinetypeTableRecord::setComments Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.AsciiDescription AcDbLinetypeTableRecord::setDashLengthAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetDashLengthAt AcDbLinetypeTableRecord::setIsScaledToFit Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.IsScaledToFit AcDbLinetypeTableRecord::setNumDashes Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.NumDashes AcDbLinetypeTableRecord::setPatternLength Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.PatternLength AcDbLinetypeTableRecord::setShapeIsUcsOrientedAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetShapeIsUcsOrientedAt AcDbLinetypeTableRecord::setShapeNumberAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetShapeNumberAt AcDbLinetypeTableRecord::setShapeOffsetAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetShapeOffsetAt AcDbLinetypeTableRecord::setShapeRotationAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetShapeRotationAt AcDbLinetypeTableRecord::setShapeScaleAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetShapeScaleAt AcDbLinetypeTableRecord::setShapeStyleAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetShapeStyleAt AcDbLinetypeTableRecord::setTextAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.SetTextAt AcDbLinetypeTableRecord::shapeIsUcsOrientedAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.ShapeIsUcsOrientedAt AcDbLinetypeTableRecord::shapeNumberAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.ShapeNumberAt AcDbLinetypeTableRecord::shapeOffsetAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.ShapeOffsetAt AcDbLinetypeTableRecord::shapeRotationAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.ShapeRotationAt AcDbLinetypeTableRecord::shapeScaleAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.ShapeScaleAt AcDbLinetypeTableRecord::shapeStyleAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.ShapeStyleAt AcDbLinetypeTableRecord::textAt Autodesk.AutoCAD.DatabaseServices.LinetypeTableRecord.TextAt acdbLineWeightUnits Autodesk.AutoCAD.DatabaseServices.LineWeightConverter.ConvertTo acdbLoadMlineStyleFile Autodesk.AutoCAD.DatabaseServices.Database.LoadMlineStyleFile AcDbMatchProperties::copyProperties Autodesk.AutoCAD.DatabaseServices.MatchProperties.CopyProperties AcDbMaterial::description Autodesk.AutoCAD.DatabaseServices.Material.Description AcDbMaterial::diffuse Autodesk.AutoCAD.DatabaseServices.Material.Diffuse AcDbMaterial::name Autodesk.AutoCAD.DatabaseServices.Material.Name AcDbMaterial::opacity Autodesk.AutoCAD.DatabaseServices.Material.Opacity AcDbMaterial::refraction Autodesk.AutoCAD.DatabaseServices.Material.Refraction AcDbMaterial::setAmbient Autodesk.AutoCAD.DatabaseServices.Material.Ambient AcDbMaterial::setBump Autodesk.AutoCAD.DatabaseServices.Material.Bump AcDbMaterial::setDescription Autodesk.AutoCAD.DatabaseServices.Material.Description AcDbMaterial::setDiffuse Autodesk.AutoCAD.DatabaseServices.Material.Diffuse AcDbMaterial::setName Autodesk.AutoCAD.DatabaseServices.Material.Name AcDbMaterial::setOpacity Autodesk.AutoCAD.DatabaseServices.Material.Opacity AcDbMaterial::setReflection Autodesk.AutoCAD.DatabaseServices.Material.Reflection [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 503 AcDbMaterial::setRefraction Autodesk.AutoCAD.DatabaseServices.Material.Refraction AcDbMaterial::setSpecular Autodesk.AutoCAD.DatabaseServices.Material.Specular AcDbMaterial::specular Autodesk.AutoCAD.DatabaseServices.Material.Specular AcDbMInsertBlock::columns Autodesk.AutoCAD.DatabaseServices.MInsertBlock.Columns AcDbMInsertBlock::columnSpacing Autodesk.AutoCAD.DatabaseServices.MInsertBlock.ColumnSpacing AcDbMInsertBlock::rows Autodesk.AutoCAD.DatabaseServices.MInsertBlock.Rows AcDbMInsertBlock::rowSpacing Autodesk.AutoCAD.DatabaseServices.MInsertBlock.RowSpacing AcDbMInsertBlock::setColumns Autodesk.AutoCAD.DatabaseServices.MInsertBlock.Columns AcDbMInsertBlock::setColumnSpacing Autodesk.AutoCAD.DatabaseServices.MInsertBlock.ColumnSpacing AcDbMInsertBlock::setRows Autodesk.AutoCAD.DatabaseServices.MInsertBlock.Rows AcDbMInsertBlock::setRowSpacing Autodesk.AutoCAD.DatabaseServices.MInsertBlock.RowSpacing AcDbMline::appendSeg Autodesk.AutoCAD.DatabaseServices.Mline.AppendSegment AcDbMline::closedMline Autodesk.AutoCAD.DatabaseServices.Mline.IsClosed AcDbMline::element Autodesk.AutoCAD.DatabaseServices.Mline.Element AcDbMline::getClosestPointTo Autodesk.AutoCAD.DatabaseServices.Mline.GetClosestPointTo AcDbMline::getClosestPointTo Autodesk.AutoCAD.DatabaseServices.Mline.GetClosestPointTo AcDbMline::justification Autodesk.AutoCAD.DatabaseServices.Mline.Justification AcDbMline::moveVertexAt Autodesk.AutoCAD.DatabaseServices.Mline.MoveVertexAt AcDbMline::normal Autodesk.AutoCAD.DatabaseServices.Mline.Normal AcDbMline::numVertices Autodesk.AutoCAD.DatabaseServices.Mline.NumberOfVertices AcDbMline::removeLastSeg Autodesk.AutoCAD.DatabaseServices.Mline.RemoveLastSegment AcDbMline::scale Autodesk.AutoCAD.DatabaseServices.Mline.Scale AcDbMline::setClosedMline Autodesk.AutoCAD.DatabaseServices.Mline.IsClosed AcDbMline::setJustification Autodesk.AutoCAD.DatabaseServices.Mline.Justification AcDbMline::setNormal Autodesk.AutoCAD.DatabaseServices.Mline.Normal AcDbMline::setScale Autodesk.AutoCAD.DatabaseServices.Mline.Scale AcDbMline::setStyle Autodesk.AutoCAD.DatabaseServices.Mline.Style AcDbMline::setSupressEndCaps Autodesk.AutoCAD.DatabaseServices.Mline.SupressEndCaps AcDbMline::setSupressStartCaps Autodesk.AutoCAD.DatabaseServices.Mline.SupressStartCaps AcDbMline::style Autodesk.AutoCAD.DatabaseServices.Mline.Style AcDbMline::supressEndCaps Autodesk.AutoCAD.DatabaseServices.Mline.SupressEndCaps AcDbMline::supressStartCaps Autodesk.AutoCAD.DatabaseServices.Mline.SupressStartCaps AcDbMline::vertexAt Autodesk.AutoCAD.DatabaseServices.Mline.VertexAt AcDbMlineStyle::addElement Autodesk.AutoCAD.DatabaseServices.MlineStyleElementCollection.Add AcDbMlineStyle::description Autodesk.AutoCAD.DatabaseServices.MlineStyle.Description AcDbMlineStyle::endAngle Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndAngle AcDbMlineStyle::endInnerArcs Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndInnerArcs AcDbMlineStyle::endRoundCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndRoundCap AcDbMlineStyle::endSquareCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndSquareCap AcDbMlineStyle::fillColor Autodesk.AutoCAD.DatabaseServices.MlineStyle.FillColor AcDbMlineStyle::filled Autodesk.AutoCAD.DatabaseServices.MlineStyle.Filled AcDbMlineStyle::getElementAt Autodesk.AutoCAD.DatabaseServices.MlineStyleElementCollection.Item AcDbMlineStyle::initMlineStyle Autodesk.AutoCAD.DatabaseServices.MlineStyle.Reset AcDbMlineStyle::name Autodesk.AutoCAD.DatabaseServices.MlineStyle.Name [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 504 AcDbMlineStyle::numElements Autodesk.AutoCAD.DatabaseServices.MlineStyleElementCollection.Count AcDbMlineStyle::removeElementAt Autodesk.AutoCAD.DatabaseServices.MlineStyleElementCollection.RemoveAt AcDbMlineStyle::set Autodesk.AutoCAD.DatabaseServices.MlineStyle.Set AcDbMlineStyle::setDescription Autodesk.AutoCAD.DatabaseServices.MlineStyle.Description AcDbMlineStyle::setElement Autodesk.AutoCAD.DatabaseServices.MlineStyleElementCollection.Item AcDbMlineStyle::setEndAngle Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndAngle AcDbMlineStyle::setEndInnerArcs Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndInnerArcs AcDbMlineStyle::setEndRoundCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndRoundCap AcDbMlineStyle::setEndSquareCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.EndSquareCap AcDbMlineStyle::setFillColor Autodesk.AutoCAD.DatabaseServices.MlineStyle.FillColor AcDbMlineStyle::setFilled Autodesk.AutoCAD.DatabaseServices.MlineStyle.Filled AcDbMlineStyle::setName Autodesk.AutoCAD.DatabaseServices.MlineStyle.Name AcDbMlineStyle::setShowMiters Autodesk.AutoCAD.DatabaseServices.MlineStyle.ShowMiters AcDbMlineStyle::setStartAngle Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartAngle AcDbMlineStyle::setStartInnerArcs Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartInnerArcs AcDbMlineStyle::setStartRoundCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartRoundCap AcDbMlineStyle::setStartSquareCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartSquareCap AcDbMlineStyle::showMiters Autodesk.AutoCAD.DatabaseServices.MlineStyle.ShowMiters AcDbMlineStyle::startAngle Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartAngle AcDbMlineStyle::startInnerArcs Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartInnerArcs AcDbMlineStyle::startRoundCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartRoundCap AcDbMlineStyle::startSquareCap Autodesk.AutoCAD.DatabaseServices.MlineStyle.StartSquareCap acdbModelerEnd Autodesk.AutoCAD.Runtime.RuntimeSystem.Terminate AcDbMPolygon::appendLoopFromBoundary Autodesk.AutoCAD.DatabaseServices.MPolygon.AppendLoopFromBoundary AcDbMPolygon::appendLoopFromBoundary Autodesk.AutoCAD.DatabaseServices.MPolygon.AppendLoopFromBoundary AcDbMPolygon::appendLoopFromBoundary Autodesk.AutoCAD.DatabaseServices.MPolygon.AppendLoopFromBoundary AcDbMPolygon::appendMPolygonLoop Autodesk.AutoCAD.DatabaseServices.MPolygon.AppendMPolygonLoop AcDbMPolygon::balanceDisplay Autodesk.AutoCAD.DatabaseServices.MPolygon.BalanceDisplay AcDbMPolygon::balanceTree Autodesk.AutoCAD.DatabaseServices.MPolygon.BalanceTree AcDbMPolygon::deleteMPolygonTree Autodesk.AutoCAD.DatabaseServices.MPolygon.DeleteMPolygonTree AcDbMPolygon::elevation Autodesk.AutoCAD.DatabaseServices.MPolygon.Elevation AcDbMPolygon::evaluateHatch Autodesk.AutoCAD.DatabaseServices.MPolygon.EvaluateHatch AcDbMPolygon::getArea Autodesk.AutoCAD.DatabaseServices.MPolygon.Area AcDbMPolygon::getChildLoops Autodesk.AutoCAD.DatabaseServices.MPolygon.GetChildLoops AcDbMPolygon::getClosestLoopTo Autodesk.AutoCAD.DatabaseServices.MPolygon.GetClosestLoopTo AcDbMPolygon::getLoopAtGsMarker Autodesk.AutoCAD.DatabaseServices.MPolygon.GetLoopAtGraphicsMarker AcDbMPolygon::getLoopDirection Autodesk.AutoCAD.DatabaseServices.MPolygon.GetLoopDirection AcDbMPolygon::getMPolygonLoopAt Autodesk.AutoCAD.DatabaseServices.MPolygon.GetMPolygonLoopAt AcDbMPolygon::getMPolygonTree Autodesk.AutoCAD.DatabaseServices.MPolygon.MPolygonTree AcDbMPolygon::getOffsetVector Autodesk.AutoCAD.DatabaseServices.MPolygon.OffsetVector AcDbMPolygon::getParentLoop Autodesk.AutoCAD.DatabaseServices.MPolygon.GetParentLoop AcDbMPolygon::getPatternDefinitionAt Autodesk.AutoCAD.DatabaseServices.MPolygon.GetPatternDefinitionAt AcDbMPolygon::getPerimeter Autodesk.AutoCAD.DatabaseServices.MPolygon.Perimeter AcDbMPolygon::hatch Autodesk.AutoCAD.DatabaseServices.MPolygon.Hatch [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 505 AcDbMPolygon::insertMPolygonLoopAt Autodesk.AutoCAD.DatabaseServices.MPolygon.InsertMPolygonLoopAt AcDbMPolygon::isPointInsideMPolygon Autodesk.AutoCAD.DatabaseServices.MPolygon.IsPointInsideMPolygon AcDbMPolygon::loopCrossesMPolygon Autodesk.AutoCAD.DatabaseServices.MPolygon.LoopCrossesMPolygon AcDbMPolygon::normal Autodesk.AutoCAD.DatabaseServices.MPolygon.Normal AcDbMPolygon::numMPolygonLoops Autodesk.AutoCAD.DatabaseServices.MPolygon.NumMPolygonLoops AcDbMPolygon::numPatternDefinitions Autodesk.AutoCAD.DatabaseServices.MPolygon.NumPatternDefinitions AcDbMPolygon::patternAngle Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternAngle AcDbMPolygon::patternColor Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternColor AcDbMPolygon::patternName Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternName AcDbMPolygon::patternScale Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternScale AcDbMPolygon::patternSpace Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternSpace AcDbMPolygon::patternType Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternType AcDbMPolygon::removeMPolygonLoopAt Autodesk.AutoCAD.DatabaseServices.MPolygon.RemoveMPolygonLoopAt AcDbMPolygon::setElevation Autodesk.AutoCAD.DatabaseServices.MPolygon.Elevation AcDbMPolygon::setLoopDirection Autodesk.AutoCAD.DatabaseServices.MPolygon.SetLoopDirection AcDbMPolygon::setNormal Autodesk.AutoCAD.DatabaseServices.MPolygon.Normal AcDbMPolygon::setPattern Autodesk.AutoCAD.DatabaseServices.MPolygon.SetPattern AcDbMPolygon::setPatternAngle Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternAngle AcDbMPolygon::setPatternColor Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternColor AcDbMPolygon::setPatternDouble Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternDouble AcDbMPolygon::setPatternScale Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternScale AcDbMPolygon::setPatternSpace Autodesk.AutoCAD.DatabaseServices.MPolygon.PatternSpace AcDbMPolygonCrossing::getCrossingPoint Autodesk.AutoCAD.DatabaseServices.MPolygonCrossing.CrossingPoint AcDbMPolygonCrossing::getEdgeIndex Autodesk.AutoCAD.DatabaseServices.MPolygonCrossing.EdgeIndex AcDbMPolygonCrossing::getLoopIndex Autodesk.AutoCAD.DatabaseServices.MPolygonCrossing.LoopIndex AcDbMPolygonCrossing::setCrossingPoint Autodesk.AutoCAD.DatabaseServices.MPolygonCrossing.CrossingPoint AcDbMPolygonCrossing::setEdgeIndex Autodesk.AutoCAD.DatabaseServices.MPolygonCrossing.EdgeIndex AcDbMPolygonCrossing::setLoopIndex Autodesk.AutoCAD.DatabaseServices.MPolygonCrossing.LoopIndex AcDbMText::actualHeight Autodesk.AutoCAD.DatabaseServices.MText.ActualHeight AcDbMText::actualWidth Autodesk.AutoCAD.DatabaseServices.MText.ActualWidth AcDbMText::alignChange Autodesk.AutoCAD.DatabaseServices.MText.AlignChange AcDbMText::ascent Autodesk.AutoCAD.DatabaseServices.MText.Ascent AcDbMText::attachment Autodesk.AutoCAD.DatabaseServices.MText.Attachment AcDbMText::backgroundFillOn Autodesk.AutoCAD.DatabaseServices.MText.BackgroundFill AcDbMText::blockBegin Autodesk.AutoCAD.DatabaseServices.MText.BlockBegin AcDbMText::blockEnd Autodesk.AutoCAD.DatabaseServices.MText.BlockEnd AcDbMText::colorChange Autodesk.AutoCAD.DatabaseServices.MText.ColorChange AcDbMText::contents Autodesk.AutoCAD.DatabaseServices.MText.Contents AcDbMText::correctSpelling Autodesk.AutoCAD.DatabaseServices.MText.CorrectSpelling AcDbMText::descent Autodesk.AutoCAD.DatabaseServices.MText.Descent AcDbMText::direction Autodesk.AutoCAD.DatabaseServices.MText.Direction AcDbMText::flowDirection Autodesk.AutoCAD.DatabaseServices.MText.FlowDirection AcDbMText::fontChange Autodesk.AutoCAD.DatabaseServices.MText.FontChange AcDbMText::getBackgroundFillColor Autodesk.AutoCAD.DatabaseServices.MText.BackgroundFillColor [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 506 AcDbMText::getBackgroundScaleFactor Autodesk.AutoCAD.DatabaseServices.MText.BackgroundScaleFactor AcDbMText::getBackgroundTransparency Autodesk.AutoCAD.DatabaseServices.MText.BackgroundTransparency AcDbMText::getBoundingPoints Autodesk.AutoCAD.DatabaseServices.MText.GetBoundingPoints AcDbMText::heightChange Autodesk.AutoCAD.DatabaseServices.MText.HeightChange AcDbMText::lineBreak Autodesk.AutoCAD.DatabaseServices.MText.LineBreak AcDbMText::lineSpacingFactor Autodesk.AutoCAD.DatabaseServices.MText.LineSpacingFactor AcDbMText::lineSpacingStyle Autodesk.AutoCAD.DatabaseServices.MText.LineSpacingStyle AcDbMText::location Autodesk.AutoCAD.DatabaseServices.MText.Location AcDbMText::nonBreakSpace Autodesk.AutoCAD.DatabaseServices.MText.NonBreakSpace AcDbMText::normal Autodesk.AutoCAD.DatabaseServices.MText.Normal AcDbMText::obliqueChange Autodesk.AutoCAD.DatabaseServices.MText.ObliqueChange AcDbMText::overlineOff Autodesk.AutoCAD.DatabaseServices.MText.OverlineOff AcDbMText::overlineOn Autodesk.AutoCAD.DatabaseServices.MText.OverlineOn AcDbMText::paragraphBreak Autodesk.AutoCAD.DatabaseServices.MText.ParagraphBreak AcDbMText::rotation Autodesk.AutoCAD.DatabaseServices.MText.Rotation AcDbMText::setAttachment Autodesk.AutoCAD.DatabaseServices.MText.Attachment AcDbMText::setAttachmentMovingLocation Autodesk.AutoCAD.DatabaseServices.MText.SetAttachmentMovingLocation AcDbMText::setBackgroundFill Autodesk.AutoCAD.DatabaseServices.MText.BackgroundFill AcDbMText::setBackgroundFillColor Autodesk.AutoCAD.DatabaseServices.MText.BackgroundFillColor AcDbMText::setBackgroundScaleFactor Autodesk.AutoCAD.DatabaseServices.MText.BackgroundScaleFactor AcDbMText::setBackgroundTransparency Autodesk.AutoCAD.DatabaseServices.MText.BackgroundTransparency AcDbMText::setContents Autodesk.AutoCAD.DatabaseServices.MText.Contents AcDbMText::setContentsRTF Autodesk.AutoCAD.DatabaseServices.MText.SetContentsRtf AcDbMText::setDirection Autodesk.AutoCAD.DatabaseServices.MText.Direction AcDbMText::setFlowDirection Autodesk.AutoCAD.DatabaseServices.MText.FlowDirection AcDbMText::setLineSpacingFactor Autodesk.AutoCAD.DatabaseServices.MText.LineSpacingFactor AcDbMText::setLineSpacingStyle Autodesk.AutoCAD.DatabaseServices.MText.LineSpacingStyle AcDbMText::setLocation Autodesk.AutoCAD.DatabaseServices.MText.Location AcDbMText::setNormal Autodesk.AutoCAD.DatabaseServices.MText.Normal AcDbMText::setRotation Autodesk.AutoCAD.DatabaseServices.MText.Rotation AcDbMText::setTextHeight Autodesk.AutoCAD.DatabaseServices.MText.TextHeight AcDbMText::setTextStyle Autodesk.AutoCAD.DatabaseServices.MText.TextStyle AcDbMText::setUseBackgroundColor Autodesk.AutoCAD.DatabaseServices.MText.UseBackgroundColor AcDbMText::setWidth Autodesk.AutoCAD.DatabaseServices.MText.Width AcDbMText::stackStart Autodesk.AutoCAD.DatabaseServices.MText.StackStart AcDbMText::textHeight Autodesk.AutoCAD.DatabaseServices.MText.TextHeight AcDbMText::textStyle Autodesk.AutoCAD.DatabaseServices.MText.TextStyle AcDbMText::trackChange Autodesk.AutoCAD.DatabaseServices.MText.TrackChange AcDbMText::underlineOff Autodesk.AutoCAD.DatabaseServices.MText.UnderlineOff AcDbMText::underlineOn Autodesk.AutoCAD.DatabaseServices.MText.UnderlineOn AcDbMText::useBackgroundColorOn Autodesk.AutoCAD.DatabaseServices.MText.UseBackgroundColor AcDbMText::width Autodesk.AutoCAD.DatabaseServices.MText.Width AcDbMText::widthChange Autodesk.AutoCAD.DatabaseServices.MText.WidthChange AcDbObject:: Autodesk.AutoCAD.DatabaseServices.DBObject.AcadObject [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 507 AcDbObject::applyPartialUndo Autodesk.AutoCAD.DatabaseServices.DBObject.ApplyPartialUndo AcDbObject::audit Autodesk.AutoCAD.DatabaseServices.DBObject.Audit AcDbObject::cancel Autodesk.AutoCAD.DatabaseServices.DBObject.Cancel AcDbObject::close Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockBeginId AcDbObject::close Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockEndId AcDbObject::close Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.DrawOrderTableId AcDbObject::close Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.IsDynamicBlock AcDbObject::close Autodesk.AutoCAD.DatabaseServices.LayoutManager.GetLayoutId AcDbObject::close Autodesk.AutoCAD.DatabaseServices.LayoutManager.CloneLayout AcDbObject::close Autodesk.AutoCAD.Windows.ToolPalette.CustomToolBase.Drop AcDbObject::closeAndPage Autodesk.AutoCAD.DatabaseServices.DBObject.CloseAndPage AcDbObject::createExtensionDictionary Autodesk.AutoCAD.DatabaseServices.DBObject.CreateExtensionDictionary AcDbObject::database Autodesk.AutoCAD.DatabaseServices.DBObject.Database AcDbObject::database Autodesk.AutoCAD.DatabaseServices.Xrecord.Data AcDbObject::database Autodesk.AutoCAD.DatabaseServices.Xrecord.Data AcDbObject::decomposeForSave Autodesk.AutoCAD.DatabaseServices.DBObject.DecomposeForSave AcDbObject::deepClone Autodesk.AutoCAD.DatabaseServices.DBObject.DeepClone AcDbObject::disableUndoRecording Autodesk.AutoCAD.DatabaseServices.DBObject.DisableUndoRecording AcDbObject::downgradeOpen Autodesk.AutoCAD.DatabaseServices.DBObject.DowngradeOpen AcDbObject::downgradeToNotify Autodesk.AutoCAD.DatabaseServices.DBObject.DowngradeToNotify AcDbObject::drawable Autodesk.AutoCAD.DatabaseServices.DBObject.Drawable AcDbObject::dwgIn Autodesk.AutoCAD.DatabaseServices.DBObject.DwgIn AcDbObject::dwgOut Autodesk.AutoCAD.DatabaseServices.DBObject.DwgOut AcDbObject::dxfIn Autodesk.AutoCAD.DatabaseServices.DBObject.DxfIn AcDbObject::dxfOut Autodesk.AutoCAD.DatabaseServices.DBObject.DxfOut AcDbObject::erase Autodesk.AutoCAD.DatabaseServices.DBObject.Erase AcDbObject::extensionDictionary Autodesk.AutoCAD.DatabaseServices.DBObject.ExtensionDictionary AcDbObject::getAcDbHandle Autodesk.AutoCAD.DatabaseServices.DBObject.Handle AcDbObject::getClassID Autodesk.AutoCAD.DatabaseServices.DBObject.ClassID AcDbObject::GetModuleHandleA Autodesk.AutoCAD.DatabaseServices.DBObject.AcadObject AcDbObject::getObjectBirthVersion Autodesk.AutoCAD.DatabaseServices.DBObject.ObjectBirthVersion AcDbObject::getObjectSaveVersion Autodesk.AutoCAD.DatabaseServices.DBObject.GetObjectSaveVersion AcDbObject::getObjectSaveVersion Autodesk.AutoCAD.DatabaseServices.DBObject.GetObjectSaveVersion AcDbObject::handOverTo Autodesk.AutoCAD.DatabaseServices.DBObject.HandOverTo AcDbObject::hasPersistentReactor Autodesk.AutoCAD.DatabaseServices.DBObject.HasPersistentReactor AcDbObject::hasSaveVersionOverride Autodesk.AutoCAD.DatabaseServices.DBObject.HasSaveVersionOverride AcDbObject::id Autodesk.AutoCAD.DatabaseServices.DBObject.Id AcDbObject::isAcDbObjectIdsInFlux Autodesk.AutoCAD.DatabaseServices.DBObject.IsObjectIdsInFlux AcDbObject::isAProxy Autodesk.AutoCAD.DatabaseServices.DBObject.IsAProxy AcDbObject::isCancelling Autodesk.AutoCAD.DatabaseServices.DBObject.IsCancelling AcDbObject::isErased Autodesk.AutoCAD.DatabaseServices.DBObject.IsErased AcDbObject::isEraseStatusToggled Autodesk.AutoCAD.DatabaseServices.DBObject.IsEraseStatusToggled AcDbObject::isModified Autodesk.AutoCAD.DatabaseServices.DBObject.IsModified AcDbObject::isModifiedGraphics Autodesk.AutoCAD.DatabaseServices.DBObject.IsModifiedGraphics [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 508 AcDbObject::isModifiedXData Autodesk.AutoCAD.DatabaseServices.DBObject.IsModifiedXData AcDbObject::isNewObject Autodesk.AutoCAD.DatabaseServices.DBObject.IsNewObject AcDbObject::isNotifyEnabled Autodesk.AutoCAD.DatabaseServices.DBObject.IsNotifyEnabled AcDbObject::isNotifying Autodesk.AutoCAD.DatabaseServices.DBObject.IsNotifying AcDbObject::isPersistent Autodesk.AutoCAD.DatabaseServices.DBObject.IsPersistent AcDbObject::isReadEnabled Autodesk.AutoCAD.DatabaseServices.DBObject.IsReadEnabled AcDbObject::isReallyClosing Autodesk.AutoCAD.DatabaseServices.DBObject.IsReallyClosing AcDbObject::isTransactionResident Autodesk.AutoCAD.DatabaseServices.DBObject.IsTransactionResident AcDbObject::isUndoing Autodesk.AutoCAD.DatabaseServices.DBObject.IsUndoing AcDbObject::isWriteEnabled Autodesk.AutoCAD.DatabaseServices.DBObject.IsWriteEnabled AcDbObject::isWriteEnabled Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.Clear AcDbObject::isWriteEnabled Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.Add AcDbObject::isWriteEnabled Autodesk.AutoCAD.DatabaseServices.HyperLinkCollection.Insert AcDbObject::mergeStyle Autodesk.AutoCAD.DatabaseServices.DBObject.MergeStyle AcDbObject::objectId Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockBeginId AcDbObject::objectId Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.BlockEndId AcDbObject::objectId Autodesk.AutoCAD.DatabaseServices.BlockTableRecord.DrawOrderTableId AcDbObject::objectId Autodesk.AutoCAD.DatabaseServices.DBObject.ObjectId AcDbObject::objectId Autodesk.AutoCAD.DatabaseServices.DBObjectCollection.RemoveAt AcDbObject::objectId Autodesk.AutoCAD.DatabaseServices.DBObjectCollection.Item AcDbObject::objectId Autodesk.AutoCAD.DatabaseServices.LayoutManager.GetLayoutId AcDbObject::ownerId Autodesk.AutoCAD.DatabaseServices.DBObject.OwnerId AcDbObject::reactors Autodesk.AutoCAD.DatabaseServices.DBObject.GetReactors AcDbObject::releaseExtensionDictionary Autodesk.AutoCAD.DatabaseServices.DBObject.ReleaseExtensionDictionary AcDbObject::setAcDbObjectIdsInFlux Autodesk.AutoCAD.DatabaseServices.DBObject.SetObjectIdsInFlux AcDbObject::setAttributes Autodesk.AutoCAD.DatabaseServices.DBObject.SetAttributes AcDbObject::setHasSaveVersionOverride Autodesk.AutoCAD.DatabaseServices.DBObject.HasSaveVersionOverride AcDbObject::setOwnerId Autodesk.AutoCAD.DatabaseServices.DBObject.OwnerId AcDbObject::setXData Autodesk.AutoCAD.DatabaseServices.DBObject.XData AcDbObject::swapIdWith Autodesk.AutoCAD.DatabaseServices.DBObject.SwapIdWith AcDbObject::swapReferences Autodesk.AutoCAD.DatabaseServices.DBObject.SwapReferences AcDbObject::undoFiler Autodesk.AutoCAD.DatabaseServices.DBObject.UndoFiler AcDbObject::upgradeFromNotify Autodesk.AutoCAD.DatabaseServices.DBObject.UpgradeFromNotify AcDbObject::upgradeOpen Autodesk.AutoCAD.DatabaseServices.DBObject.UpgradeOpen AcDbObject::viewportDraw Autodesk.AutoCAD.DatabaseServices.DBObject.ViewportDraw AcDbObject::viewportDrawLogicalFlags Autodesk.AutoCAD.DatabaseServices.DBObject.ViewportDrawLogicalFlags AcDbObject::wblockClone Autodesk.AutoCAD.DatabaseServices.DBObject.WblockClone AcDbObject::worldDraw Autodesk.AutoCAD.DatabaseServices.DBObject.WorldDraw AcDbObject::xData Autodesk.AutoCAD.DatabaseServices.DBObject.XData AcDbObject::xData Autodesk.AutoCAD.DatabaseServices.DBObject.GetXDataForApplication AcDbObject::xDataTransformBy Autodesk.AutoCAD.DatabaseServices.DBObject.XDataTransformBy AcDbObjectId::acdbForceOpenObjectOnLockedLayer Autodesk.AutoCAD.DatabaseServices.ObjectId.Open AcDbObjectId::convertToRedirectedId Autodesk.AutoCAD.DatabaseServices.ObjectId.ConvertToRedirectedId AcDbObjectId::database Autodesk.AutoCAD.DatabaseServices.ObjectId.Database [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 509 AcDbObjectId::handle Autodesk.AutoCAD.DatabaseServices.ObjectId.Handle AcDbObjectId::isEffectivelyErased Autodesk.AutoCAD.DatabaseServices.ObjectId.IsEffectivelyErased AcDbObjectId::isErased Autodesk.AutoCAD.DatabaseServices.ObjectId.IsErased AcDbObjectId::isNull Autodesk.AutoCAD.DatabaseServices.ObjectId.IsNull AcDbObjectId::isValid Autodesk.AutoCAD.DatabaseServices.ObjectId.IsValid AcDbObjectId::nonForwardedHandle Autodesk.AutoCAD.DatabaseServices.ObjectId.NonForwardedHandle AcDbObjectId::objectLeftOnDisk Autodesk.AutoCAD.DatabaseServices.ObjectId.ObjectLeftOnDisk AcDbObjectId::originalDatabase Autodesk.AutoCAD.DatabaseServices.ObjectId.OriginalDatabase AcDbObjectIterator::done Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Count AcDbObjectIterator::done Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Count AcDbObjectIterator::done Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Item AcDbObjectIterator::done Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Item AcDbObjectIterator::objectId Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Item AcDbObjectIterator::start Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Count AcDbObjectIterator::start Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Item AcDbObjectIterator::step Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Count AcDbObjectIterator::step Autodesk.AutoCAD.DatabaseServices.AttributeCollection.Item AcDbOle2Frame::autoOutputQuality Autodesk.AutoCAD.DatabaseServices.Ole2Frame.AutoOutputQuality AcDbOle2Frame::getLinkName Autodesk.AutoCAD.DatabaseServices.Ole2Frame.LinkName AcDbOle2Frame::getLinkName Autodesk.AutoCAD.DatabaseServices.Ole2Frame.IsLinked AcDbOle2Frame::getLinkPath Autodesk.AutoCAD.DatabaseServices.Ole2Frame.LinkPath AcDbOle2Frame::getLocation Autodesk.AutoCAD.DatabaseServices.Ole2Frame.Location AcDbOle2Frame::getOleObject Autodesk.AutoCAD.DatabaseServices.Ole2Frame.OleObject AcDbOle2Frame::getType Autodesk.AutoCAD.DatabaseServices.Ole2Frame.Type AcDbOle2Frame::getUserType Autodesk.AutoCAD.DatabaseServices.Ole2Frame.UserType AcDbOle2Frame::lockAspect Autodesk.AutoCAD.DatabaseServices.Ole2Frame.LockAspect AcDbOle2Frame::OleRun Autodesk.AutoCAD.DatabaseServices.Ole2Frame.OleObject AcDbOle2Frame::outputQuality Autodesk.AutoCAD.DatabaseServices.Ole2Frame.OutputQuality AcDbOle2Frame::position Autodesk.AutoCAD.DatabaseServices.Ole2Frame.Position2d AcDbOle2Frame::position Autodesk.AutoCAD.DatabaseServices.Ole2Frame.Position2d AcDbOle2Frame::rotation Autodesk.AutoCAD.DatabaseServices.Ole2Frame.Rotation AcDbOle2Frame::scaleHeight Autodesk.AutoCAD.DatabaseServices.Ole2Frame.ScaleHeight AcDbOle2Frame::scaleWidth Autodesk.AutoCAD.DatabaseServices.Ole2Frame.ScaleWidth AcDbOle2Frame::setAutoOutputQuality Autodesk.AutoCAD.DatabaseServices.Ole2Frame.AutoOutputQuality AcDbOle2Frame::setLockAspect Autodesk.AutoCAD.DatabaseServices.Ole2Frame.LockAspect AcDbOle2Frame::setOutputQuality Autodesk.AutoCAD.DatabaseServices.Ole2Frame.OutputQuality AcDbOle2Frame::setRotation Autodesk.AutoCAD.DatabaseServices.Ole2Frame.Rotation AcDbOle2Frame::setScaleHeight Autodesk.AutoCAD.DatabaseServices.Ole2Frame.ScaleHeight AcDbOle2Frame::setScaleWidth Autodesk.AutoCAD.DatabaseServices.Ole2Frame.ScaleWidth AcDbOle2Frame::setWcsHeight Autodesk.AutoCAD.DatabaseServices.Ole2Frame.WcsHeight AcDbOle2Frame::setWcsWidth Autodesk.AutoCAD.DatabaseServices.Ole2Frame.WcsWidth AcDbOle2Frame::wcsHeight Autodesk.AutoCAD.DatabaseServices.Ole2Frame.WcsHeight AcDbOle2Frame::wcsWidth Autodesk.AutoCAD.DatabaseServices.Ole2Frame.WcsWidth acdbOpenAcDbObject Autodesk.AutoCAD.DatabaseServices.ObjectId.Open [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 510 AcDbOrdinateDimension::definingPoint Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.DefiningPoint AcDbOrdinateDimension::isUsingXAxis Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.UsingXAxis AcDbOrdinateDimension::isUsingYAxis Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.UsingYAxis AcDbOrdinateDimension::leaderEndPoint Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.LeaderEndPoint AcDbOrdinateDimension::origin Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.Origin AcDbOrdinateDimension::setDefiningPoint Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.DefiningPoint AcDbOrdinateDimension::setLeaderEndPoint Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.LeaderEndPoint AcDbOrdinateDimension::setOrigin Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.Origin AcDbOrdinateDimension::useXAxis Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.UsingXAxis AcDbOrdinateDimension::useYAxis Autodesk.AutoCAD.DatabaseServices.OrdinateDimension.UsingXAxis acdbOriginalXrefFullPathFor Autodesk.AutoCAD.DatabaseServices.Database.Filename acdbOverlayXref Autodesk.AutoCAD.DatabaseServices.Database.OverlayXref AcDbPlotSettings::addToPlotSettingsDict Autodesk.AutoCAD.DatabaseServices.PlotSettings.AddToPlotSettingsDictionary AcDbPlotSettings::drawViewportsFirst Autodesk.AutoCAD.DatabaseServices.PlotSettings.DrawViewportsFirst AcDbPlotSettings::getCanonicalMediaName Autodesk.AutoCAD.DatabaseServices.PlotSettings.CanonicalMediaName AcDbPlotSettings::getCurrentStyleSheet Autodesk.AutoCAD.DatabaseServices.PlotSettings.CurrentStyleSheet AcDbPlotSettings::getCustomPrintScale Autodesk.AutoCAD.DatabaseServices.PlotSettings.CustomPrintScale AcDbPlotSettings::getPlotCfgName Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotConfigurationName AcDbPlotSettings::getPlotOrigin Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotOrigin AcDbPlotSettings::getPlotPaperMargins Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotPaperMargins AcDbPlotSettings::getPlotPaperSize Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotPaperSize AcDbPlotSettings::getPlotSettingsName Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotSettingsName AcDbPlotSettings::getPlotViewName Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotViewName AcDbPlotSettings::getPlotWindowArea Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotWindowArea AcDbPlotSettings::getStdScale Autodesk.AutoCAD.DatabaseServices.PlotSettings.StdScale AcDbPlotSettings::modelType Autodesk.AutoCAD.DatabaseServices.PlotSettings.ModelType AcDbPlotSettings::plotCentered Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotCentered AcDbPlotSettings::plotHidden Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotHidden AcDbPlotSettings::plotPaperUnits Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotPaperUnits AcDbPlotSettings::plotPlotStyles Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotPlotStyles AcDbPlotSettings::plotRotation Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotRotation AcDbPlotSettings::plotType Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotType AcDbPlotSettings::plotViewportBorders Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotViewportBorders AcDbPlotSettings::printLineweights Autodesk.AutoCAD.DatabaseServices.PlotSettings.PrintLineweights AcDbPlotSettings::scaleLineweights Autodesk.AutoCAD.DatabaseServices.PlotSettings.ScaleLineweights AcDbPlotSettings::setDrawViewportsFirst Autodesk.AutoCAD.DatabaseServices.PlotSettings.DrawViewportsFirst AcDbPlotSettings::setPlotHidden Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotHidden AcDbPlotSettings::setPlotPlotStyles Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotPlotStyles AcDbPlotSettings::setPlotSettingsName Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotSettingsName AcDbPlotSettings::setPlotViewportBorders Autodesk.AutoCAD.DatabaseServices.PlotSettings.PlotViewportBorders AcDbPlotSettings::setPrintLineweights Autodesk.AutoCAD.DatabaseServices.PlotSettings.PrintLineweights AcDbPlotSettings::setScaleLineweights Autodesk.AutoCAD.DatabaseServices.PlotSettings.ScaleLineweights AcDbPlotSettings::setShadePlot Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShadePlot AcDbPlotSettings::setShadePlotCustomDPI Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShadePlotCustomDpi [www.BimCad.org]深居浅出 AutoCAD.NET 二次开发 511 AcDbPlotSettings::setShadePlotResLevel Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShadePlotResLevel AcDbPlotSettings::setShowPlotStyles Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShowPlotStyles AcDbPlotSettings::shadePlot Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShadePlot AcDbPlotSettings::shadePlotCustomDPI Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShadePlotCustomDpi AcDbPlotSettings::shadePlotResLevel Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShadePlotResLevel AcDbPlotSettings::showPlotStyles Autodesk.AutoCAD.DatabaseServices.PlotSettings.ShowPlotStyles AcDbPlotSettings::stdScaleType Autodesk.AutoCAD.DatabaseServices.PlotSettings.StdScaleType AcDbPlotSettings::useStandardScale Autodesk.AutoCAD.DatabaseServices.PlotSettings.UseStandardScale AcDbPlotSettingsValidator::canonicalMediaNameList Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.GetCanonicalMediaNameList AcDbPlotSettingsValidator::getLocaleMediaName Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.GetLocaleMediaName AcDbPlotSettingsValidator::getLocaleMediaName Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.GetLocaleMediaName AcDbPlotSettingsValidator::plotDeviceList Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.GetPlotDeviceList AcDbPlotSettingsValidator::plotStyleSheetList Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.GetPlotStyleSheetList AcDbPlotSettingsValidator::refreshLists Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.RefreshLists AcDbPlotSettingsValidator::setCanonicalMediaName Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.SetCanonicalMediaName AcDbPlotSettingsValidator::setClosestMediaName Autodesk.AutoCAD.DatabaseServices.PlotSettingsValidator.SetClosestMediaN