CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

验证属性 (ActiveX)

2023-1-3 01:47| 发布者: admin| 查看: 206| 评论: 0|来自: AutoCAD

摘要: 指定是否为验证设置属性。

指定是否为验证设置属性。

支持的平台:仅窗口

签名

工 务 局:

object.Verify
对象

类型:属性

此属性适用的对象。

属性值

只读:

类型:布尔

  • True:属性设置为验证。
  • False:未设置该属性进行验证。

言论

用于验证的属性集会在插入块时提示用户验证属性值是否正确。

属性只能作为四种可选模式之一存在:常量、预设、不可见或验证。AFLAGS 系统变量存储当前模式设置。可以使用 Mode 属性查询当前模式。

例子

工 务 局:

Sub Example_Verify()
    ' This example creates an attribute definition in model space.
    ' It then sets the definition to be verify, and queries the mode.
    
    Dim attributeObj As AcadAttribute
    Dim height As Double
    Dim mode As Long
    Dim prompt As String
    Dim insertionPoint(0 To 2) As Double
    Dim tag As String
    Dim value As String
    
    ' Define the attribute definition
    height = 1#
    mode = acAttributeModeVerify
    prompt = "New Prompt"
    insertionPoint(0) = 5#: insertionPoint(1) = 5#: insertionPoint(2) = 0
    tag = "New_Tag"
    value = "New Value"
    
    ' Create the attribute definition object in model space
    Set attributeObj = ThisDrawing.ModelSpace.AddAttribute(height, mode, prompt, insertionPoint, tag, value)
    ZoomAll
    
    ' Change the mode to be verify
    attributeObj.mode = acAttributeModeVerify
    attributeObj.Update
    
    ' Check to see if the attribute is set to verify
    MsgBox (IIf(attributeObj.Verify, "The attribute is set to verify", "The attribute is not set to verify"))
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_Verify()
    ;; This example creates an attribute definition in model space.
    ;; It then sets the definition to be verify, and queries the mode.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
    
    ;; Define the attribute definition
    (setq insertionPoint (vlax-3d-point 5 5 0)
          attHeight 1
          attMode acAttributeModeVerify
          attPrompt "New Prompt"
          attTag "New_Tag"
          attValue "New Value")
    
    ;; Create the attribute definition object in model space
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq attributeObj (vla-AddAttribute modelSpace attHeight attMode attPrompt insertionPoint attTag attValue))
    (vla-ZoomAll acadObj)
    
    ;; Change the mode to be verify
    (vla-put-Mode attributeObj acAttributeModeVerify)
    (vla-Update attributeObj)
    
    ;; Check to see if the attribute is set to verify
    (alert (if (= (vla-get-Verify attributeObj) :vlax-true) "The attribute is set to verify" "The attribute is not set to verify"))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 09:27

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部