CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

普通属性 (ActiveX)

2023-1-3 10:20| 发布者: admin| 查看: 402| 评论: 0|来自: AutoCAD

摘要: 指定对象的三维法线单位向量。

指定对象的三维法线单位向量。

支持的平台:仅窗口

签名

工 务 局:

object.Normal
对象

类型:弧,属性,属性引用,块引用圆形比较参考Dim3点角度Dim对齐,DimAngular,DimArc长度,Dim直径,尺寸,DimOrdinate,DimRadialDimRadial大DimRotate椭圆外部参考阴影线,线,线,LWPoly线最小块MText折线区域截面形状实体文本公差跟踪

此属性适用的对象。

属性值

只读:

类型:变体(双精度的三元素数组)

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)))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 )

GMT+8, 2024-5-19 15:00

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部