図面の 3D 表示の視線方向、または表の方向ベクトルを示します。
サポートされているプラットフォーム: Windows のみ
VBA:
object.Direction
タイプ: ExtrudedSurface、PViewport、Table、View、Viewport
このプロパティが適用されるオブジェクト。
読み込み専用: いいえ
タイプ: バリアント型
Table オブジェクト: ベクトル(WCS 座標での X 軸)は、表を含む水平面を定義します。
他のすべてのオブジェクト: ベクトルは、図面を見ることができる方向を定義する 3 要素の倍精度浮動小数点数型配列です。
このプロパティは、空間の指定された点から原点(0,0,0)を見るように、図面を見る位置にビューを設置します。このプロパティは、AutoCAD の VPOINT[3D 視点]コマンドに似ています。
VBA:
Sub Example_Direction()
' This example creates a circle in model space
' and changes the thickness of the circle. Once
' the thickness has been changed, the direction
' of the active viewport is changed so that the
' new thickness setting is visible.
Dim circleObj As AcadCircle
Dim centerPoint(0 To 2) As Double
Dim radius As Double
' Define the circle
centerPoint(0) = 0#: centerPoint(1) = 0#: centerPoint(2) = 0#
radius = 5#
' Create the Circle object in model space
Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius)
' Change the thickness of the circle
circleObj.Thickness = 3
' Change the direction of the viewport so that you can
' view the change made to the thickness. Once you change
' the direction, you must reset the active viewport.
Dim NewDirection(0 To 2) As Double
NewDirection(0) = -1: NewDirection(1) = -1: NewDirection(2) = 1
ThisDrawing.ActiveViewport.direction = NewDirection
ThisDrawing.ActiveViewport = ThisDrawing.ActiveViewport
End Sub
Sub example_tableDirection()
Dim oMS As AcadModelSpace
Set oMS = ThisDrawing.ModelSpace
Dim oT As AcadTable
Dim pt(2) As Double
Set oT = oMS.AddTable(pt, 4, 5, 5, 20)
ZoomExtents
Dim vDirection As Variant
vDirection = oT.Direction
MsgBox "Table Direction vector is " & vbCrLf & vDirection(0) & "," & vDirection(1) & "," & vDirection(2)
Dim vNewDirection(2) As Double
vNewDirection(0) = 0
vNewDirection(1) = 1
vNewDirection(2) = 0
oT.Direction = vNewDirection
Dim vRetDirection As Variant
vRetDirection = oT.Direction
MsgBox "New Table Direction vector is " & vbCrLf & vRetDirection(0) & "," & vRetDirection(1) & "," & vRetDirection(2)
End Sub
Visual LISP:
(vl-load-com)
(defun c:Example_Direction()
;; This example creates a circle in model space
;; and changes the thickness of the circle. Once
;; the thickness has been changed, the direction
;; of the active viewport is changed so that the
;; new thickness setting is visible.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define the circle
(setq centerPoint (vlax-3d-point 0 0 0)
radius 5)
;; Create the Circle object in model space
(setq modelSpace (vla-get-ModelSpace doc))
(setq circleObj (vla-AddCircle modelSpace centerPoint radius))
;; Change the thickness of the circle
(vla-put-Thickness circleObj 3)
;; Change the direction of the viewport so that you can
;; view the change made to the thickness. Once you change
;; the direction, you must reset the active viewport.
(setq NewDirection (vlax-3d-point -1 -1 1))
(setq activeViewport (vla-get-ActiveViewport doc))
(vla-put-Direction activeViewport NewDirection)
(vla-put-ActiveViewport doc activeViewport)
)
(defun c:Example_TableDirection()
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq modelSpace (vla-get-ModelSpace doc))
(setq pt (vlax-3d-point 0 0 0)
oT (vla-AddTable modelSpace pt 4 5 5 20))
(vla-ZoomExtents acadObj)
(setq vDirection (vlax-safearray->list (vlax-variant-value (vla-get-Direction oT))))
(alert (strcat "Table Direction vector is "
"\n" (rtos (nth 0 vDirection) 2) "," (rtos (nth 1 vDirection) 2) "," (rtos (nth 2 vDirection) 2)))
(setq vNewDirection (vlax-3d-point 0 1 0))
(vla-put-Direction oT vNewDirection)
(setq vRetDirection (vlax-safearray->list (vlax-variant-value (vla-get-Direction oT))))
(alert (strcat "New Table Direction vector is "
"\n" (rtos (nth 0 vRetDirection) 2) "," (rtos (nth 1 vRetDirection) 2) "," (rtos (nth 2 vRetDirection) 2)))
)