CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

相关分类

CreateTypedArray Method (ActiveX)

2023-1-4 11:05| 发布者: admin| 查看: 514| 评论: 0|来自: AutoCAD

摘要: 创建包含类型化参数数组的变体。

创建包含类型化参数数组的变体。

支持的平台:仅窗口

签名

工 务 局:

object.CreateTypedArray VarArr, Type, Value1, [value2, value3, ...valueN]
对象

类型:实用工具

此方法适用的对象。

瓦拉尔

访问:仅输出

类型:变体

作为变体的值数组。

类型

访问:仅输入

类型:枚举VbVarType

您提供的值的类型。

vbBoolean或。vbIntegervbLongvbSinglevbDouble

值 1 [值 2, ...值 N]

访问:仅输入

类型:在上面的类型参数中指定的类型

要包含在多属性中的值。

返回值(RetVal)

无返回值。

言论

生成的变体可以传递到接受数字数组作为变体的任何 AutoCAD 方法或属性中。

此方法只能使用后期绑定编程技术访问。若要使用此方法,请将对象定义为,而不是为。UtilityObject (Dim myObj As Object)AcadUtility

例子

工 务 局:

Sub Example_CreateTypedArray()
    ' This example creates a spline from variant arrays created
    ' from doubles using the CreateTypedArray method.
    ' Note that this method must be late bound. This is done
    ' by declaring the utility object (utilObj) as Object,
    ' not as AcadUtility.
        
    Dim splineObj As AcadSpline
    
    ' Even though these are arrays, they are declared as variants
    Dim startTan As Variant
    Dim endTan As Variant
    Dim fitPoints As Variant
    
    Dim utilObj As Object   ' Late bound object
    Set utilObj = ThisDrawing.Utility
    
    ' Define the spline.
    utilObj.CreateTypedArray startTan, vbDouble, 0.5, 0.5, 0
    utilObj.CreateTypedArray endTan, vbDouble, 0.5, 0.5, 0
    utilObj.CreateTypedArray fitPoints, vbDouble, 0, 0, 0, 5, 5, 0, 10, 0, 0
    
    ' Create the spline
    Set splineObj = ThisDrawing.ModelSpace.AddSpline(fitPoints, startTan, endTan)
    ZoomAll
    
End Sub

Visual LISP:

(vl-load-com)
(defun c:Example_CreateTypedArray()
    ;; This example creates a spline from variant arrays created
    ;; from doubles using the CreateTypedArray method.
    ;; Note that this method must be late bound. This is done
    ;; by declaring the utility object (utilObj) as Object,
    ;; not as AcadUtility.
    (setq acadObj (vlax-get-acad-object))
    (setq doc (vla-get-ActiveDocument acadObj))
   
    (setq utilObj (vla-get-Utility doc))
    
    ;; Define the spline.
    (vla-CreateTypedArray utilObj 'startTan vlax-vbDouble 0.5 0.5 0)
    (vla-CreateTypedArray utilObj 'endTan vlax-vbDouble 0.5 0.5 0)
    (vla-CreateTypedArray utilObj 'fitPoints vlax-vbDouble 0 0 0 5 5 0 10 0 0)
    
    ;; Create the spline
    (setq modelSpace (vla-get-ModelSpace doc))
    (setq splineObj (vla-AddSpline modelSpace fitPoints startTan endTan))
    (vla-ZoomAll acadObj)
)

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-12 04:23

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部