ComparedReference 对象 (ActiveX)
表示要与当前图形进行比较的图形的外部参照。 支持的平台:仅限 Windows 班级信息
言论该对象从该对象继承其成员。可以使用 ActiveX 查询和编辑 AutoCAD 图形中的图元。但是,您不能使用 ActiveX 创建对象。ComparedReferenceExternalReferenceComparedReferenceComparedReference 没有允许您将对象标识为该类型的成员属性;但是,您可以将 OR 强制转换为对象类型,并使用错误处理来确定强制转换是否成功。ExternalReferenceComparedReferenceAcadEntityAcadExternalReferenceAcadComparedReference 以下代码示例演示如何使用强制转换类型来确定实体是否为 类型。ComparedReference VBA: ' Checks to see if an object is of the ComparedReference type Sub CheckForComparedReference() Dim ent As AcadEntity Dim comRef As AcadComparedReference On Error Resume Next ' Step through all the objects in model space For Each ent In ThisDrawing.ModelSpace ' Check to see if the object is a Block Reference If ent.ObjectName = "AcDbBlockReference" Then ' Try to cast the entity (Block Reference) to a ComparedReference Set comRef = ent ' If an occurs, then the entity is not a ComparedReference If Err <> 0 Then MsgBox "Not a Compared Reference" Else MsgBox "Xref Name: " + comRef.Name + vbLf + "Compared Reference" End If ' Clear the Error object Err.Clear End If Next ent End Sub 可视化 LISP: (vl-load-com) (defun c:CheckForComparedReference() ;; Checks to see if an object is of the ComparedReference type (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Step through all the objects in model space (vlax-for obj (vla-get-ModelSpace doc) ;; Check to see if the object is a Block Reference (if (= (vla-get-objectname obj) "AcDbBlockReference") (progn ;; Transform the VLA-OBJECT to an ENAME (setq entName (vlax-vla-object->ename obj)) ;; Check to see what the value of the IsComparedReference property is of the entity (if (vl-catch-all-error-p (vl-catch-all-apply 'getpropertyvalue (list entName "IsComparedReference"))) ;; If an error occurs, then the entity is not a ComparedReference (alert "Not a Compared Reference") (alert (strcat "Xref Name: " (vla-get-name obj) "\nCompared Reference")) ) ) ) ) ) |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-3-14 07:54
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.