Flyingdancing 发表于 2012-7-24 12:24:03

Add3DFace 变量类型问题

本帖最后由 Flyingdancing 于 2012-7-24 12:27 编辑

直接借用帮助里面的例子
Sub Example_Add3DFace()
    ' This example creates a 3D face in model space.

    Dim faceObj As Acad3DFace
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim point3(0 To 2) As Double
    Dim point4(0 To 2) As Double
   
    ' Define the four coordinates of the face
    point1(0) = 0#: point1(1) = 0#: point1(2) = 0#
    point2(0) = 5#: point2(1) = 0#: point2(2) = 1#
    point3(0) = 1#: point3(1) = 10#: point3(2) = 0#
    point4(0) = 5#: point4(1) = 5#: point4(2) = 1#
   
    ' Create the 3DFace object in model space
    Set faceObj = ThisDrawing.ModelSpace.Add3DFace(point1, point2, point3, point4)
    ZoomAll
End Sub这里point定义为Double型数组

我的问题如下:
在我把Double改为variant后,就会出错”无效的过程调用或参数“
显然就是因为变量类型不符合
帮助中对point 的说明是:
Variant (three-element array of doubles); input-only
The 3D WCS coordinates specifying a point on the 3DFace object

同样,做如下定义:
dim point as variant
point=array(1,2,3)
也出现同样的错误,显然,跟上面的错误是一样的

我想知道的是,这种改变为什么不行?VB/VBA/CAD对于这种定义的区别是什么


雪山飞狐_lzh 发表于 2012-7-24 15:30:40

array(1,2,3)
=>变体的数组
页: [1]
查看完整版本: Add3DFace 变量类型问题