表示要与当前图形进行比较的图形的外部参照。 支持的平台:仅窗口 班级信息
成员这些成员是此对象的一部分:
RemarksThe object inherits its members from the object. You can use ActiveX to query and edit entities in an AutoCAD drawing. However, you cannot create a object with ActiveX. ComparedReferenceExternalReferenceComparedReferenceComparedReference There is no member property that allows you to identify an object as being of the type; however, you can cast-type an or to the object type and use error handling to determine if the cast was successful. ExternalReferenceComparedReferenceAcadEntityAcadExternalReferenceAcadComparedReference The following code samples show how you can use cast-typing to determine if an entity is of type . 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 Visual 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-1-8 19:50
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.