指定对象的三维法线单位向量。 支持的平台:仅窗口 签名工 务 局: object.Normal 属性值只读:不 类型:变体(双精度的三元素数组) WCS 中的 3D 法线单位向量。 言论此法线向量定义给定对象的Z轴。尽管法线在 WCS 中返回,但它可用于确定对象的 OCS。将坐标与 OCS 之间的坐标转换时,使用此属性作为方法中的 OCSNormal。TranslateCoordinates ![]() 请注意,此属性指定向量,而不是点。向量定义法线的方向,而不是空间中的位置。您可以将此法线向量添加到一个点以获得另一个点。 公差:法向量必须垂直于对象的方向。不垂直于“容差”对象的法线将生成错误。Tolerance 例子工 务 局: Sub Example_Normal()
' This example creates a circle in model space.
' It then finds the current normal to that circle
' and changes the normal.
' Define a circle
Dim circleObj As AcadCircle
Dim center(0 To 2) As Double
Dim radius As Double
center(0) = 4: center(1) = 4: center(2) = 0
radius = 1
' Add the circle to model space
Set circleObj = ThisDrawing.ModelSpace.AddCircle(center, radius)
ZoomAll
' Find the normal for the circle
Dim currNormal As Variant
currNormal = circleObj.Normal
MsgBox "The current normal for the circle is " & circleObj.Normal(0) & ", " & circleObj.Normal(1) & ", " & circleObj.Normal(2), , "Normal Example"
' Change the normal for the circle
Dim newNormal(0 To 2) As Double
newNormal(0) = 1: newNormal(1) = 1: newNormal(2) = -1
circleObj.Normal = newNormal
circleObj.Update
MsgBox "The current normal for the circle is " & circleObj.Normal(0) & ", " & circleObj.Normal(1) & ", " & circleObj.Normal(2), , "Normal Example"
End Sub
Visual LISP: (vl-load-com)
(defun c:Example_Normal()
;; This example creates a circle in model space.
;; It then finds the current normal to that circle
;; and changes the normal.
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
;; Define a circle
(setq center (vlax-3d-point 4 4 0)
radius 1)
;; Add the circle to model space
(setq modelSpace (vla-get-ModelSpace doc))
(setq circleObj (vla-AddCircle modelSpace center radius))
(vla-ZoomAll acadObj)
;; Find the normal for the circle
(setq currNormal (vlax-variant-value (vla-get-Normal circleObj)))
(alert (strcat "The current normal for the circle is " (rtos (vlax-safearray-get-element currNormal 0) 2) ", "
(rtos (vlax-safearray-get-element currNormal 1) 2) ", "
(rtos (vlax-safearray-get-element currNormal 2) 2)))
;; Change the normal for the circle
(setq newNormal (vlax-3d-point 1 1 -1))
(vla-put-Normal circleObj newNormal)
(vla-Update circleObj)
(setq newNormal (vlax-variant-value newNormal))
(alert (strcat "The current normal for the circle is " (rtos (vlax-safearray-get-element newNormal 0) 2) ", "
(rtos (vlax-safearray-get-element newNormal 1) 2) ", "
(rtos (vlax-safearray-get-element newNormal 2) 2)))
)
|
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-11-30 11:14
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.