Application 对象是 AutoCAD ActiveX Automation 对象模型的根对象。通过 Application 对象,用户可以访问任何其他的对象或任何对象指定的特性或方法。
例如,Application 对象具有 Preferences 特性,该特性可以返回 Preferences 对象,通过此对象可以访问“选项”对话框中存储在注册表中的设置。( DatabasePreferences 对象包含存储在图形中的设置,稍后将会讨论有关内容。)通过 Application 对象的其他特性,用户可以访问与应用程序相关的数据,例如应用程序的名称和版本,以及 AutoCAD 大小、位置和可见性。Application 对象的方法可以执行与应用程序相关的操作,例如列表显示、加载和卸载 ADS 与 ARX 应用程序,以及退出 AutoCAD。
Application 对象还提供指向 AutoCAD 图形(通过 Documents 集合)、AutoCAD 菜单和工具栏(通过 MenuBarMenuGroups 集合)以及 VBA IDE(通过 VBE 特性)的链接。
Application 对象还是 ActiveX 接口的全局对象,这表示 Application 对象的所有方法和特性都可以用于全局名称空间。
An instance of the AutoCAD application.
VBA class name:
AcadApplication 
Create using:
For VB:
GetObject("AutoCAD.Application.16")
CreateObject("AutoCAD.Application.16")
For AutoCAD VBA:
Not applicable. The application is always available. 
Access via:
Application property 
The properties that are associated with the Application object reflect the properties of the main application window. The methods control the loading or listing of the currently loaded external applications and interface objects.
The active document (AutoCAD drawing) can be accessed with the ActiveDocument property.
To access the Application object from VBA, use Thisdrawing.Application. To access the Application object from VB, use the Visual Basic functions GetObject or CreateObject.
If AutoCAD is running, the GetObject function will retrieve the current AutoCAD Application object. When running multiple sessions of AutoCAD, the GetObject function will return the first instance of AutoCAD in the Windows Running Object Table. See the Microsoft Visual Basic documentation for the Running Object Table (ROT) and the GetObject function (for more information about verifying the session returned by GetObject).
Use version-dependent ProgIDs. If a CreateObject or GetObject function uses a version-in
dependent ProgID, change the function to use a version-dependent ProgID. For example, you would change CreateObject ("AutoCAD.Application") to CreateObject ("AutoCAD.Application.16").
The application object is also the Global object for the ActiveX interface. This means that all the methods and properties for the Application object are available in the global name space.
Use the Quit method to end the AutoCAD session.
Methods
Eval
GetAcadState
GetInterfaceObject
ListARX
LoadARX
LoadDVB
Quit
RunMacro
StatusID
UnloadARX
UnloadDVB
Update
ZoomAll
ZoomCenter
ZoomExtents
ZoomPickWindow
ZoomPrevious
ZoomScaled
ZoomWindow 
Properties
ActiveDocument
Application
Caption
Documents
FullName
Height
HWND
LocaleID
MenuBar
MenuGroups
Name
Path
Preferences
StatusID
VBE
Version
Visible
Width
WindowLeft
WindowState
WindowTop 
Events
AppActivate
AppDeactivate
ARXLoaded
ARXUnloaded
BeginCommand resized
BeginFileDrop
BeginLISP
BeginModal
BeginOpen
BeginPlot
BeginQuit
BeginSave
EndCommand
EndLISP
EndModal
EndOpen
EndPlot
EndSave
LISPCancelled
NewDrawing
SysVarChanged
WindowChanged
WindowMovedOrResized 
——来自于AutoCAD开发者文档

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。