EaBIM一直以来积极响应国家“十二五”推进建筑业信息化的号召,对建筑领域的信息技术开展深入技术交流和探讨!致力于打造“BIM-建筑师-生态技术”三位一体综合资源交流共享平台,希望为BIM与可持续设计理念及技术的普及做出微小的贡献!!!

EaBIM

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 608|回复: 0
打印 上一主题 下一主题

[资料] 控制AutoCAD环境(五) 设置AutoCAD选项

[复制链接]

1514

主题

7465

帖子

1万

积分

admin

Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10Rank: 10

积分
12404

社区QQ达人

跳转到指定楼层
楼主
发表于 2014-1-8 16:05:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Set AutoCAD Preferences设置AutoCAD选项
The .NET API does not contain any classes or methods to access the options in which are accessed through the AutoCAD Options dialog box. Access to these options is done through the ActiveX® Automation library. You use the COM object returned from the Preferences property of the Application object.
AutoCAD .NET API没有提供那些通过AutoCAD选项对话框访问选项的类和方法。要访问这些选项,必须使用ActiveX® Automation库。我们使用从Application对象的Preferences属性返回的COM对象(来访问这些选项)。
Once you have the Preferences COM object, you can then access the nine objects pertaining to the options, each representing a tab in the Options dialog box. These objects provide access to all of the registry-stored options in the Options dialog box. You can customize many of the AutoCAD settings by using properties found on these objects. These objects are:
一旦拥有COM对象Preferences,我们就可以访问附属于选项的九个对象,每个对象代表选项对话框的一个选项页。这些对象提供来了访问选项对话框中全部注册表存储选项的功能。通过使用这些对象的属性,我们可以自定义AutoCAD的许多设置。这些对象是:
(这九个对象统称为Perferences对象译者注)
·         PreferencesDisplay
·         PreferencesDrafting
·         PreferencesFiles
·         PreferencesOpenSave
·         PreferencesOutput
·         PreferencesProfiles
·         PreferencesSelection
·         PreferencesSystem
·         PreferencesUser
Access the Preferences object 访问Perferences对象

The following example shows how to access the Preferences object through COM interop.
下面示例演示怎样通过COM交互操作访问Perferences对象。
VB.NET
Dim acPrefComObj As AcadPreferences = Application.Preferences
C#
AcadPreferences acPrefComObj = (AcadPreferences)Application.Preferences;
VBA/ActiveX Code Reference
Dim acadPref as AcadPreferences
Set acadPref = ThisDrawing.Application.Preferences
After you reference the Preferences object, you can then access any of the specific Preferences objects using the Display, Drafting, Files, OpenSave, Output, Profile, Selection, System, and User properties.
完成对Perferences对象的引用,我们就可以使用Display属性、 Drafting属性、 Files属性、 OpenSave属性、 Output属性、 Profile属性、 Selection属性、 System属性及User属性来访问指定的Perferences对象。
Set the crosshairs to full screen 设置十字光标为全屏幕

VB.NET
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Interop
<CommandMethod("PrefsSetCursor")> _
Public Sub PrefsSetCursor()
  '' This example sets the crosshairs of the AutoCAD drawing cursor
  '' to full screen.
  '' Access the Preferences object
  Dim acPrefComObj As AcadPreferences = Application.Preferences
   '' Use the CursorSize property to set the size of the crosshairs
  acPrefComObj.Display.CursorSize = 100
End Sub
C#
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Interop;
[CommandMethod("PrefsSetCursor")]
public static void PrefsSetCursor()
{
  // This example sets the crosshairs for the drawing window
  // to full screen.
   // Access the Preferences object
  AcadPreferences acPrefComObj = (AcadPreferences)Application.Preferences;
   // Use the CursorSize property to set the size of the crosshairs
  acPrefComObj.Display.CursorSize = 100;
}
VBA/ActiveX Code Reference
Sub PrefsSetCursor()
    ' This example sets the crosshairs of the AutoCAD drawing cursor
    ' to full screen
     ' Access the Preferences object
    Dim acadPref As AcadPreferences
    Set acadPref = ThisDrawing.Application.Preferences
     ' Use the CursorSize property to set the size of the crosshairs
    acadPref.Display.CursorSize = 100
End Sub

Hide the scroll bars 隐藏滚动条

VB.NET
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD.Interop
<CommandMethod("PrefsSetDisplay")> _
Public Sub PrefsSetDisplay()
  '' This example disables the scroll bars
   '' Access the Preferences object
  Dim acPrefComObj As AcadPreferences = Application.Preferences
   '' Disable the scroll bars
  acPrefComObj.Display.DisplayScrollBars = False
End Sub
C#
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Interop;
[CommandMethod("PrefsSetDisplay")]
public static void PrefsSetDisplay()
{
  // This example disables the scroll bars
   // Access the Preferences object
  AcadPreferences acPrefComObj = (AcadPreferences)Application.Preferences;
   // Disable the scroll bars
  acPrefComObj.Display.DisplayScrollBars = false;
}
VBA/ActiveX Code Reference
Sub PrefsSetDisplay()
    ' This example disables the scroll bars
     ' Access the Preferences object
    Dim acadPref As AcadPreferences
    Set acadPref = ThisDrawing.Application.Preferences
     ' Disable the scroll bars
    acadPref.Display.DisplayScrollBars = False
End Sub

Topics in this section本节主题
·  Database Preferences 数据库选项
1、Database Preferences数据库选项
Along with application level preferences, there are drawing based preferences that are accessed with the Options dialog box that are stored in a drawing file. To access these stored settings, use the appropriate property on the Database object or use the GetSystemVariable and SetSystemVariable methods of the Application object.
除了应用程序级的选项设置外,还有基于图形的选项设置,这些选项设置使用选项对话框访问并存储在图形文件里。要访问这些存储设置,使用Database对象的相应属性,或使用Application对象的GetSystemVariable方法和SetSystemVariable方法。
VBA/ActiveX Cross Reference
VBA/ActiveX交叉参考
VBA/ActiveX Class
.NET API Class
DatabasePreferences
Database and drawing based system variables

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 转播转播 分享分享 分享淘帖 支持支持 反对反对
工作时间:工作日的9:00-12:00/13:30-18:00,节假日不在线,请勿留言
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|EaBIM网 ( 苏ICP备2020058923号-1  苏公网安备32011502011255号

GMT+8, 2024-11-16 11:15

Powered by Discuz! X3.2 Licensed

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表