アクティブな寸法スタイルを指定します。
サポートされているプラットフォーム: Windows のみ
このスタイルは、新規作成した寸法すべてに適用されます。既存の寸法のスタイルを変更するには、StyleName プロパティを使用します。
現在のドキュメント優先の設定をコントロールするには、寸法記入システム変数を使用します。寸法記入システム変数の一覧については、AutoCAD ドキュメントの「システム変数」を参照してください。
寸法記入システム変数を変更する場合、ドキュメント優先をアクティブな寸法スタイルに実際に設定します。アクティブな寸法スタイル自体は変更しません。寸法スタイルの設定を変更するには、CopyFrom メソッドを使用します。このメソッドは、寸法スタイルの設定(優先を含む)をドキュメント、寸法、またはその他の寸法スタイルからコピーします。
AutoCAD ユーザ インタフェースを介して作成される寸法は、アクティブな寸法スタイルと、すべてのドキュメント優先で作成されます。ActiveX を介して作成される寸法は、アクティブな寸法スタイルのみで作成されます。ActiveX を介して作成される寸法にドキュメント優先を反映させるには、CopyFrom メソッドを使用して、寸法スタイルをドキュメントからアクティブな寸法スタイルにコピーします。これにより、既存のすべての優先がアクティブな寸法スタイルにコピーされます。
VBA:
Sub Example_ActiveDimStyle()
' This example returns the current dimension style
' and then sets a new style.
' Finally, it returns the style to the previous setting.
Dim newDimStyle As AcadDimStyle
Dim currDimStyle As AcadDimStyle
' Return current dimension style of active document
Set currDimStyle = ThisDrawing.ActiveDimStyle
MsgBox "The current dimension style is " & currDimStyle.name, vbInformation, "ActiveDimStyle Example"
' Create a dimension style and makes it current
Set newDimStyle = ThisDrawing.DimStyles.Add("TestDimStyle")
ThisDrawing.ActiveDimStyle = newDimStyle ' set current dimension style to newDimStyle
MsgBox "The new dimension style is " & newDimStyle.name, vbInformation, "ActiveDimStyle Example"
' Reset the dimension style to its previous setting
ThisDrawing.ActiveDimStyle = currDimStyle
MsgBox "The dimension style is reset to " & currDimStyle.name, vbInformation, "ActiveDimStyle Example"
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_ActiveDimStyle()
;; This example returns the current dimension style
;; and then sets a new style.
;; Finally, it returns the style to the previous setting.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Get the current dimension style of the active document
(setq currDimStyle (vla-get-ActiveDimStyle doc))
(alert (strcat "The current dimension style is " (vla-get-Name currDimStyle)))
;; Create a dimension style and make it current
(setq dimStyles (vla-get-DimStyles doc))
(setq newDimStyle (vla-Add dimStyles "TestDimStyle"))
(vla-put-ActiveDimStyle doc newDimStyle) ;; set current dimension style to newDimStyle
(alert (strcat "The new dimension style is " (vla-get-Name newDimStyle)))
;; Restore the previously active dimension style
(vla-put-ActiveDimStyle doc currDimStyle)
(alert (strcat "The dimension style is restored to " (vla-get-Name currDimStyle)))
)