CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AutoCAD 2021 开发者帮助

IsCloned 属性 (ActiveX)

2024-5-18 18:33| 发布者: admin| 查看: 54| 评论: 0|原作者: admin|来自: AutoCAD

IsCloned 属性 (ActiveX)

确定是否已克隆 CopyObjects 操作中的源对象。

支持的平台:仅限 Windows

签名

VBA:

object.IsCloned
对象

类型: IDPair

此属性应用于的对象。

属性值

只读:是的

类型:布尔

  • True:源对象已克隆。
  • False:源对象尚未克隆。

言论

没有其他评论。

例子

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))
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

QQ|Archiver|CAD开发者社区 ( 苏ICP备2022047690号-1   苏公网安备32011402011833)

GMT+8, 2024-12-16 00:04

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部