CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2020 开发者帮助

VisibilityEdge2 属性 (ActiveX)

2024-5-18 18:22| 发布者: admin| 查看: 87| 评论: 0|原作者: admin|来自: AutoCAD

VisibilityEdge2 属性 (ActiveX)

指定 3DFace Edge 2 的可见性。

支持的平台:仅限 Windows

签名

VBA:

object.VisibilityEdge2
对象

类型: 3DFace

此属性应用于的对象。

属性值

只读:

类型:布尔

  • True:边缘可见。
  • False:边缘不可见。

言论

您还可以使用 和 方法查询或设置边的可见性。由于这些方法使用索引来指定边,因此在循环访问面的所有边时非常有用。GetInvisibleEdgeSetInvisibleEdge

例子

VBA:

Sub Example_VisibilityEdge2()
    ' This example creates a 3D Face in model space and allows the user to
    ' control the visibility of the edges
    
    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double, point2(0 To 2) As Double, _
        point3(0 To 2) As Double, point4(0 To 2) As Double
    Dim Edge1Msg As String, Edge2Msg As String, _
        Edge3Msg As String, Edge4Msg As String
    
    ' Define the four coordinates of the face
    point1(0) = 0: point1(1) = 0: point1(2) = 0
    point2(0) = 5: point2(1) = 0: point2(2) = 1
    point3(0) = 1: point3(1) = 10: point3(2) = 0
    point4(0) = 5: point4(1) = 5: point4(2) = 1
    
    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ThisDrawing.Application.ZoomAll
    
    ' Display information about the visibility of the edges for this object
DisplayEdgeInformation:
    Edge1Msg = IIf(faceObj.VisibilityEdge1, "Edge1 of the new 3DFace is visible", "Edge1 of the new 3DFace is not visible")
    Edge2Msg = IIf(faceObj.VisibilityEdge2, "Edge2 of the new 3DFace is visible", "Edge2 of the new 3DFace is not visible")
    Edge3Msg = IIf(faceObj.VisibilityEdge3, "Edge3 of the new 3DFace is visible", "Edge3 of the new 3DFace is not visible")
    Edge4Msg = IIf(faceObj.VisibilityEdge4, "Edge4 of the new 3DFace is visible", "Edge4 of the new 3DFace is not visible")
    
    MsgBox Edge1Msg & vbCrLf & _
           Edge2Msg & vbCrLf & _
           Edge3Msg & vbCrLf & _
           Edge4Msg
            
    ' Allow user to toggle the visibility of one of the edges
    Select Case InputBox("Which edge of the 3DFace would you like to toggle the visibility of?", "Toggle Edge Visibility", 1)
        Case "1": faceObj.VisibilityEdge1 = Not (faceObj.VisibilityEdge1)
        Case "2": faceObj.VisibilityEdge2 = Not (faceObj.VisibilityEdge2)
        Case "3": faceObj.VisibilityEdge3 = Not (faceObj.VisibilityEdge3)
        Case "4": faceObj.VisibilityEdge4 = Not (faceObj.VisibilityEdge4)
        Case "":  Exit Sub
        Case Else: MsgBox "You must enter the number of an edge (1-4)", vbInformation
    End Select
            
    ' Refresh view
    ThisDrawing.Regen acAllViewports
    
    ' Return to display information about the edges
    GoTo DisplayEdgeInformation

End Sub

可视化 LISP:

(vl-load-com)
(defun c:Example_VisibilityEdge2()
    ;; This example creates a 3D Face in model space and allows the user to
    ;; control the visibility of the edges
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the four coordinates of the face
    (setq point1 (vlax-3d-point 0 0 0)
          point2 (vlax-3d-point 5 0 1)
          point3 (vlax-3d-point 5 5 1)
          point4 (vlax-3d-point 1 10 0))
    
    ;; Create the 3DFace object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq faceObj (vla-Add3DFace modelSpace point1 point2 point3 point4))
    (vla-ZoomAll acadObj)
    
    ;; Display information about the visibility of the edges for this object
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is visible" "Edge1 of the new 3DFace is not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is visible" "Edge2 of the new 3DFace is not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is visible" "Edge3 of the new 3DFace is not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is visible" "Edge4 of the new 3DFace is not visible"))
    
    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))
            
    ;; Allow user to toggle the visibility of one of the edges
    (setq faceNum (vla-GetInteger (vla-get-Utility doc) "\nWhich edge of the 3DFace would you like to toggle the visibility of? (1 to 4)\n"))

    (cond
        ((= faceNum 1)(vla-put-VisibilityEdge1 faceObj (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 2)(vla-put-VisibilityEdge2 faceObj (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 3)(vla-put-VisibilityEdge3 faceObj (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) :vlax-false :vlax-true)))
        ((= faceNum 4)(vla-put-VisibilityEdge4 faceObj (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) :vlax-false :vlax-true)))
        (alert "You must enter the number of an edge (1-4)")
    )
            
    ;; Refresh view
    (vla-Regen doc acAllViewports)
    
    ;; Return to display information about the edges
    (setq edge1Msg (if (= (vla-get-VisibilityEdge1 faceObj) :vlax-true) "Edge1 of the new 3DFace is now visible" "Edge1 of the new 3DFace is now not visible"))
    (setq edge2Msg (if (= (vla-get-VisibilityEdge2 faceObj) :vlax-true) "Edge2 of the new 3DFace is now visible" "Edge2 of the new 3DFace is now not visible"))
    (setq edge3Msg (if (= (vla-get-VisibilityEdge3 faceObj) :vlax-true) "Edge3 of the new 3DFace is now visible" "Edge3 of the new 3DFace is now not visible"))
    (setq edge4Msg (if (= (vla-get-VisibilityEdge4 faceObj) :vlax-true) "Edge4 of the new 3DFace is now visible" "Edge4 of the new 3DFace is now not visible"))
    
    (alert (strcat Edge1Msg
                   "\n" Edge2Msg
                   "\n" Edge3Msg
                   "\n" Edge4Msg))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-12-15 12:38

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部