CreateTypedArray Method (ActiveX)

Creates a variant that contains an array of typed arguments.

Supported platforms: Windows only

Signature

VBA:

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

Type: Utility

The object this method applies to.

VarArr

Access: Output-only

Type: Variant

The array of values as a variant.

Type

Access: Input-only

Type: VbVarType enum

The type of values you are supplying.

vbBoolean, vbInteger, vbLong, vbSingle, or vbDouble.

Value1 [Value2, ...ValueN]

Access: Input-only

Type: Of the type specified in the Type parameter above.

The value(s) to be included in the variant.

Return Value (RetVal)

No return value.

Remarks

The resulting variant can be passed into any AutoCAD method or property that accepts an array of numbers as a variant.

This method can only be accessed using late-binding programming techniques. To use this method, define the Utility object as Object (Dim myObj As Object), not as AcadUtility.

Examples

VBA:

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