AutoCAD2006VBA程序参考
本帖最后由 作者 于 2007-12-7 12:05:45 编辑 <br /><br /> <p>要学好AutoCAD VBA程序,AutoCAD 2006 VBA A Programmer’s Reference是一本相当好的参考书。可惜这本书是英文,为了让大家能更好的学好这本书,本人抛砖引玉,摘要部分学习心得与网友共享。</p><p>This book provides a concise guide to the kind of customization programmers can achieve with AutoCAD 2006. It demonstrates how to use AutoCAD through short code examples written in Visual Basic for Applications (VBA). It also includes a complete quick reference that lists all the events, methods, and properties available with AutoCAD. Finally, it describes all the constants and system variables.</p><p>本书通过提供简明扼要AutoCAD程序,采用短程序教学法介绍VBA编程。而且用表的形式,快速介绍所有的事件、方法和有用的AutoCAD特性。</p><p>What Is This Book About? 有关这本这本书<br/>By interfacing with AutoCAD, you can exploit all of AutoCAD’s functionality that would have taken you a long time to write yourself. This book will first help you learn how to use this functionality.</p><p>如何用AutoCAD接口技术开发AutoCAD功能。</p><p>TABLE OF CONTENT:目录<br/>Chapter 01 - The VBA Integrated Development Environment (VBAIDE)----VBA整合开发环境<br/>Chapter 02 - Introduction to Visual Basic Programming----介绍VBA<br/>Chapter 03 - Application Elements ----- 应用原理<br/>Chapter 04 - AutoCAD Events----AutoCAD事件<br/>Chapter 05 - User Preferences----用户参数<br/>Chapter 06 - Controlling Layers and Linetypes----图层和线的控制<br/>Chapter 07 - User Interaction and the Utility Object<br/>Chapter 08 - Drawing Objects<br/>Chapter 09 - Creating 3-D Objects<br/>Chapter 10 - Editing Objects<br/>Chapter 11 - Dimensions and Annotations<br/>Chapter 12 - Selection Sets and Groups<br/>Chapter 13 - Blocks,Attributes,and External References<br/>Chapter 14 - Views and Viewports<br/>Chapter 15 - Layout and Plot Configurations<br/>Chapter 16 - Controlling Menus and Toolbars<br/>Chapter 17 - Drawing Security<br/>Chapter 18 - Using the Windows API<br/>Chapter 19 - Connecting to External Applications<br/>Chapter 20 - Creating Tables<br/>Chapter 21 - The SummaryInfo Object<br/>Chapter 22 - An Illustrative VBA Application<br/>Appendix A - AutoCAD Object Summary<br/>Appendix B - AutoCAD Constants Reference<br/>Appendix C - System Variables<br/></p><p>附本书的PDF文件。</p><p> <a href="http://www.ccebook.cn/books/16.html">http://www.ccebook.cn/books/16.html</a></p><p></p><p></p><p></p> <p>P68页要点</p><p>以下程序为声明类模块示例。</p><p>Option Explicit<br/>Public objApp As New clsApplicationEvents<br/>Public Sub InitializeEvents()<br/> Set objApp.objApp = ThisDrawing.Application<br/>End Sub<br/>As soon as the InitializeEvents subroutine is called, in this case by running the<br/>App_StartMacro macro shown next, the application-level events are enabled.</p><p>运行初始子程序,<br/>Public Sub App_StartMacro()<br/> InitializeEvents<br/>End Sub</p> <p>P89</p><p>Checking for Existing Layers检查已经存的图层。<br/>Public Sub CheckForLayerByIteration()<br/> Dim objLayer As AcadLayer<br/> Dim strLayerName As String<br/> strLayername = InputBox("Enter a Layer name to search for: ")<br/> If "" = strLayername Then Exit Sub ' exit if no name entered<br/> For Each objLayer In ThisDrawing.Layers ' iterate layers<br/> If 0 = StrComp(objLayer.name, strLayername, vbTextCompare) Then<br/> MsgBox "Layer '" & strLayername & "' exists"<br/> Exit Sub ' exit after finding layer<br/> End If<br/> Next objLayer<br/> MsgBox "Layer '" & strLayername & "' does not exist"<br/>End Sub<br/></p> <p>P93页</p><p>The ActiveLayer property is a member of the Document object. To make a specific layer<br/>active, assign the Layer object to the ActiveLayer.</p><p>激活图层示例<br/>Public Sub ChangeEntityLayer()<br/> On Error Resume Next ' handle exceptions inline<br/> Dim objEntity As AcadEntity<br/> Dim varPick As Variant<br/> Dim strLayerName As String<br/> Dim objLayer As AcadLayer<br/> ThisDrawing.Utility.GetEntity objEntity, varPick, "Select an entity"<br/> If objEntity Is Nothing Then<br/> MsgBox "No entity was selected"<br/> Exit Sub ' exit if no entity picked<br/> End If<br/> strLayerName = InputBox("Enter a new Layer name: ")<br/> If "" = strLayerName Then Exit Sub ' exit if no name entered<br/> Set objLayer = ThisDrawing.Layers(strLayerName)<br/> If objLayer Is Nothing Then<br/> MsgBox "Layer was not recognized"<br/> Exit Sub ' exit if layer not found<br/> End If<br/> objEntity.Layer = strLayerName ' else change entity layer<br/>End Sub</p> 先下个看看,看标题应该是个不错的东东 <p>应该是好东西,不知是不是中文的</p> <p>书在那里?可不可以下载</p><p></p> 谢谢兰州的兄弟!!! 谢谢兰州的兄弟!!! 谢谢版主,下载保存,好东西,值得珍藏!
页:
[1]
2