乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 151|回复: 9

AutoCAD2006VBA程序参考

[复制链接]

120

主题

326

帖子

7

银币

中流砥柱

Rank: 25

铜币
806
发表于 2007-12-6 20:05:00 | 显示全部楼层 |阅读模式
要学好 VBA程序,AutoCAD 2006 VBA A Programmer’s Reference是一本相当好的参考书。可惜这本书是英文,为了让大家能更好的学好这本书,本人抛砖引玉,摘要部分学习心得与网友共享。
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.
本书通过提供简明扼要AutoCAD程序,采用短程序教学法介绍VBA编程。而且用表的形式,快速介绍所有的事件、方法和有用的AutoCAD特性。
What Is This Book About? 有关这本这本书
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.
如何用AutoCAD接口技术开发AutoCAD功能。
TABLE OF CONTENT:目录
Chapter 01 - The VBA Integrated Development Environment (VBAIDE)----VBA整合开发环境
Chapter 02 - Introduction to Visual Basic Programming----介绍VBA
Chapter 03 - Application Elements ----- 应用原理
Chapter 04 - AutoCAD Events----AutoCAD事件
Chapter 05 - User Preferences----用户参数
Chapter 06 - Controlling Layers and Linetypes----图层和线的控制
Chapter 07 - User Interaction and the Utility Object
Chapter 08 - Drawing Objects
Chapter 09 - Creating 3-D Objects
Chapter 10 - Editing Objects
Chapter 11 - Dimensions and Annotations
Chapter 12 - Selection Sets and Groups
Chapter 13 - Blocks,Attributes,and External References
Chapter 14 - Views and Viewports
Chapter 15 - Layout and Plot Configurations
Chapter 16 - Controlling Menus and Toolbars
Chapter 17 - Drawing Security
Chapter 18 - Using the Windows API
Chapter 19 - Connecting to External Applications
Chapter 20 - Creating Tables
Chapter 21 - The SummaryInfo Object
Chapter 22 - An Illustrative VBA Application
Appendix A - AutoCAD Object Summary
Appendix B - AutoCAD Constants Reference
Appendix C - System Variables
附本书的PDF文件。




本帖以下内容被隐藏保护;需要你回复后,才能看到!

游客,如果您要查看本帖隐藏内容请回复
回复

使用道具 举报

120

主题

326

帖子

7

银币

中流砥柱

Rank: 25

铜币
806
发表于 2007-12-6 21:18:00 | 显示全部楼层
P68页要点
以下程序为声明类模块示例。
Option Explicit
Public objApp As New clsApplicationEvents
Public Sub InitializeEvents()
  Set objApp.objApp = ThisDrawing.Application
End Sub
As soon as the InitializeEvents subroutine is called, in this case by running the
App_StartMacro macro shown next, the application-level events are enabled.
运行初始子程序,
Public Sub App_StartMacro()
  InitializeEvents
End Sub
回复

使用道具 举报

120

主题

326

帖子

7

银币

中流砥柱

Rank: 25

铜币
806
发表于 2007-12-6 21:38:00 | 显示全部楼层
P89
Checking for Existing Layers检查已经存的图层。
Public Sub CheckForLayerByIteration()
  Dim objLayer As AcadLayer
  Dim strLayerName As String
  strLayername = InputBox("Enter a Layer name to search for: ")
  If "" = strLayername Then Exit Sub ' exit if no name entered
  For Each objLayer In ThisDrawing.Layers ' iterate layers
    If 0 = StrComp(objLayer.name, strLayername, vbTextCompare) Then
      MsgBox "Layer '" & strLayername & "' exists"
      Exit Sub ' exit after finding layer
    End If
  Next objLayer
  MsgBox "Layer '" & strLayername & "' does not exist"
End Sub
回复

使用道具 举报

120

主题

326

帖子

7

银币

中流砥柱

Rank: 25

铜币
806
发表于 2007-12-6 21:47:00 | 显示全部楼层
P93页
The ActiveLayer property is a member of the Document object. To make a specific layer
active, assign the Layer object to the ActiveLayer.
激活图层示例
Public Sub ChangeEntityLayer()
  On Error Resume Next ' handle exceptions inline
  Dim objEntity As AcadEntity
  Dim varPick As Variant
  Dim strLayerName As String
  Dim objLayer As AcadLayer
  ThisDrawing.Utility.GetEntity objEntity, varPick, "Select an entity"
  If objEntity Is Nothing Then
     MsgBox "No entity was selected"
     Exit Sub ' exit if no entity picked
  End If
  strLayerName = InputBox("Enter a new Layer name: ")
  If "" = strLayerName Then Exit Sub ' exit if no name entered
  Set objLayer = ThisDrawing.Layers(strLayerName)
  If objLayer Is Nothing Then
    MsgBox "Layer was not recognized"
    Exit Sub ' exit if layer not found
  End If
  objEntity.Layer = strLayerName ' else change entity layer
End Sub
回复

使用道具 举报

3

主题

21

帖子

3

银币

初来乍到

Rank: 1

铜币
33
发表于 2007-12-9 16:41:00 | 显示全部楼层
先下个看看,看标题应该是个不错的东东
回复

使用道具 举报

1

主题

27

帖子

4

银币

初来乍到

Rank: 1

铜币
31
发表于 2007-12-15 22:59:00 | 显示全部楼层
应该是好东西,不知是不是中文的
回复

使用道具 举报

0

主题

2

帖子

2

银币

初来乍到

Rank: 1

铜币
2
发表于 2007-12-23 22:33:00 | 显示全部楼层
书在那里?可不可以下载
回复

使用道具 举报

0

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
3
发表于 2008-6-11 18:07:00 | 显示全部楼层
谢谢兰州的兄弟!!!
回复

使用道具 举报

0

主题

3

帖子

2

银币

初来乍到

Rank: 1

铜币
3
发表于 2008-6-11 18:07:00 | 显示全部楼层
谢谢兰州的兄弟!!!
回复

使用道具 举报

4

主题

20

帖子

5

银币

初来乍到

Rank: 1

铜币
36
发表于 2008-6-11 18:44:00 | 显示全部楼层
谢谢版主,下载保存,好东西,值得珍藏!
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-4 12:09 , Processed in 0.645936 second(s), 72 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表