CAD开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

ActiveX 开发指南

关于将数组转换为变体 (VBA/ActiveX)

2023-1-5 03:05| 发布者: admin| 查看: 567| 评论: 0|来自: AutoCAD

摘要: AutoCAD ActiveX Automation 提供了一种实用工具方法,用于将数据数组转换为变体。

AutoCAD ActiveX Automation 提供了一种实用工具方法,用于将数据数组转换为变体。

此方法是方法,它创建一个包含整数、浮点数、双精度数等数组的变体。可以将生成的变体传递到接受数字数组作为变体的任何 AutoCAD 方法或属性中。CreateTypedArray

该方法将数组中的值类型和要转换的数据数组作为输入。它以变体的形式返回值数组。CreateTypedArray

使用 CreateTypedArray 方法创建样条

以下代码使用以下方法转换三个数组:样条拟合点的坐标以及样条的起点和终点切线。然后,它将变体传递到方法中以创建样条曲线。CreateTypedArrayAddSpline

Sub Ch2_CreateSplineUsingTypedArray()
    ' This example creates a spline object in model space
    ' using the CreateTypedArray method.
    Dim splineObj As AcadSpline
    Dim startTan As Variant
    Dim endTan As Variant
    Dim fitPoints As Variant

    Dim utilObj As Object   ' late bind the Utility object
    Set utilObj = ThisDrawing.Utility

    ' Define the Spline Object
    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

    Set splineObj = ThisDrawing.ModelSpace.AddSpline _
 (fitPoints, startTan, endTan)

    ' Zoom in on the newly created spline
    ZoomAll

End Sub

路过

雷人

握手

鲜花

鸡蛋

最新评论

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

GMT+8, 2024-5-11 18:00

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

返回顶部