CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

IsCloned Property (ActiveX)

2023-1-3 13:40| 发布者: admin| 查看: 418| 评论: 0|来自: AutoCAD

摘要: 确定是否已克隆复制对象操作中的源对象。

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

支持的平台:仅窗口

签名

工 务 局:

object.IsCloned
对象

类型:IDPair

此属性适用的对象。

属性值

只读:是的

类型:布尔

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

言论

没有额外的评论。

例子

工 务 局:

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

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

GMT+8, 2024-5-12 03:03

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部