关于将数组转换为变体 (VBA/ActiveX)
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
相关概念 |
|Archiver|CAD开发者社区
( 苏ICP备2022047690号-1 苏公网安备32011402011833)
GMT+8, 2025-10-29 09:55
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.