指定绘图的三维可视化的查看方向或表格的方向矢量。 支持的平台:仅窗口 属性值只读:不 类型:变体 表对象:矢量(X轴,以 WCS 坐标为单位)定义包含表的水平面。 所有其他对象:矢量是一个三元素的双精度数组,用于定义可以从中查看绘图的方向。 言论此属性使查看者能够查看图形,就像从空间中的指定点回望原点 (0, 0, 0) 一样。此属性类似于 AutoCAD 中的 VPOINT 命令。 例子工 务 局: 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)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 08:44
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.