IsCloned 属性 (ActiveX)
确定是否已克隆 CopyObjects 操作中的源对象。 支持的平台:仅限 Windows 属性值只读:是的 类型:布尔
言论没有其他评论。 例子VBA: Sub Example_IsCloned() ' This example creates a Circle object and uses the CopyObjects ' method to copy the Circle. It then displays some information ' about the source objects used in the CopyObjects operation. Dim circleObj As AcadCircle, circleObjCopy As AcadCircle Dim centerPoint(0 To 2) As Double Dim radius1 As Double, radius1Copy As Double Dim objCollection(0 To 0) As Object Dim retObjects As Variant Dim IDPairs As Variant Dim IsClonedState As String, IsPrimary As String, IsXLated As String ' Define the Circle object centerPoint(0) = 0: centerPoint(1) = 0: centerPoint(2) = 0 radius1 = 5#: radius1Copy = 1# ' Add two circles to the drawing Set circleObj = ThisDrawing.ModelSpace.AddCircle(centerPoint, radius1) ThisDrawing.Application.ZoomAll ' Copy objects ' ' First put the objects to be copied into a form compatible with CopyObjects Set objCollection(0) = circleObj ' Copy object and get back a collection of the new objects retObjects = ThisDrawing.CopyObjects(objCollection, , IDPairs) ' Get newly created object and apply new properties to the copies Set circleObjCopy = retObjects(0) circleObjCopy.radius = radius1Copy ThisDrawing.Application.ZoomAll ThisDrawing.Regen acAllViewports ' Display whether the first source object has a clone IsClonedState = IIf(IDPairs(0).IsCloned, "is cloned.", "is not cloned.") IsPrimary = IIf(IDPairs(0).IsPrimary, "is a primary member of the objects being copied.", "is owned by a primary member of the objects being copied.") IsXLated = IIf(IDPairs(0).IsOwnerXlated, "has been translated.", "has not been translated.") MsgBox "The new Circle source object: " & IsClonedState & vbCrLf & _ "The new Circle source object: " & IsPrimary & vbCrLf & _ "The source of the new Circle object: " & IsXLated & vbCrLf, vbInformation End Sub 可视化 LISP: (vl-load-com) (defun c:Example_IsCloned() ;; This example creates a Circle object and uses the CopyObjects ;; method to make a copy of the Circle. It then displays some information ;; about the source objects used in the CopyObjects operation. (setq acadObj (vlax-get-acad-object)) (setq doc (vla-get-ActiveDocument acadObj)) ;; Define the Circle object (setq centerPoint (vlax-3d-point 0 0 0) radius1 5 radius1Copy 1) ;; Add two circles to the drawing (setq modelSpace (vla-get-ModelSpace doc)) (setq circleObj (vla-AddCircle modelSpace centerPoint radius1)) (vla-ZoomAll acadObj) ;; Copy objects ;; ;; First put the objects to be copied into a form compatible with CopyObjects (setq objCollection (vlax-make-safearray vlax-vbObject '(0 . 0))) (vlax-safearray-put-element objCollection 0 circleObj) ;; Copy object and get back a collection of the new objects (copies) (setq retObjects (vla-CopyObjects doc objCollection nil 'IDPairs)) ;; Get newly created object and apply new properties to the copies (setq circleObjCopy (vlax-safearray-get-element (vlax-variant-value retObjects) 0)) (vla-put-radius circleObjCopy radius1Copy) (vla-ZoomAll acadObj) (vla-Regen doc acAllViewports) ;; Display whether the first source object has a clone (setq IsClonedState (if (= (vla-get-IsCloned (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is cloned." "is not cloned.")) (setq IsPrimary (if (= (vla-get-IsPrimary (vlax-safearray-get-element IDPairs 0)) :vlax-true) "is a primary member of the objects being copied." "is owned by a primary member of the objects being copied.")) (setq IsXLated (if (= (vla-get-IsOwnerXlated (vlax-safearray-get-element IDPairs 0)) :vlax-true) "has been translated." "has not been translated.")) (alert (strcat "The new Circle source object: " IsClonedState "\nThe new Circle source object: " IsPrimary "\nThe source of the new Circle object: " IsXLated)) ) |
|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2024-12-16 00:04
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.