現在の図面と比較する図面を表す外部参照。
サポートされているプラットフォーム: Windows のみ
AcadComparedReference
Object AcadObject AcadEntity AcadBlockReference AcadExternalReference AcadComparedReference
VBA
Not applicable
VBA
ModelSpace.Item
次のメンバーはこのオブジェクトの一部です。
メソッド |
プロパティ |
イベント |
---|---|---|
ComparedReference オブジェクトは、ExternalReference オブジェクトからメンバーを継承します。ActiveX を使用して、AutoCAD 図面内の ComparedReference 図形を調べたり、編集することができます。ただし、ActiveX を使用して ComparedReference オブジェクトを作成することはできません。
ExternalReference オブジェクトを ComparedReference タイプであると識別することができるメンバー プロパティはありませんが、AcadEntity または AcadExternalReference を AcadComparedReference オブジェクト タイプにキャストし、エラー処理を使用してキャストが成功したかどうかを判断することができます。
次のコード例に、タイプのキャストを使用して、図形が 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")) ) ) ) ) )