在给定位置创建具有指定属性的属性定义。 支持的平台:仅窗口 签名工 务 局: RetVal = object.AddAttribute(Height, Mode, Prompt, InsertionPoint, Tag, Value)
言论属性定义与为其创建的块相关联。在模型空间或图纸空间中创建的属性定义不被视为附加到任何给定块。 AutoCAD AFLAGS 系统变量存储模式设置。可以使用方法查询此值,也可以使用方法设置此值。GetVariableSetVariable ExamplesVBA: Sub Example_AddAttribute() ' This example creates an attribute definition in model space. 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 End Sub Visual LISP: (vl-load-com) (defun c:Example_AddAttribute() ;; This example creates an attribute definition in model space. (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) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-1-8 19:49
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.