设定AutoCAD的基本设定(.NET)

AutoCAD.NET API不包含用于访问从AutoCAD的[选项]对话框中可访问的选项的类别和方法。这些选项包括ActiveX® 使用自动库访问。

使用从Application对象的Preferences属性返回的COM对象。获得Preferences COM对象后,可访问选项相关的9个对象。

这些对象分别表示“选项”对话框的选项卡。这些对象可以访问注册表中保存的[选项]对话框中的所有选项。

您可以使用这些对象的属性来自定义AutoCAD的各种设置。对象如下。

  • PreferencesDisplay
  • PreferencesDrafting
  • PreferencesFiles
  • PreferencesOpenSave
  • PreferencesOutput
  • PreferencesProfiles
  • PreferencesSelection
  • PreferencesSystem
  • PreferencesUser

访问Preferences对象

在以下示例中,示出了使用COM相互运用功能访问Preferences对象的方法。

Dim acPrefComObj As AcadPreferences = Application.Preferences

在引用Preferences对象后,可以使用Display、Drafting、Files、OpenSave、Output、Profile、Selection、System、User属性来访问各自的Preferences对象。

将交叉发夹光标设置为全屏

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
原文地址:https://www.cnblogs.com/rf8862/p/15253555.html