Scripting Array command creates error with EnableRedraw

When I script the Array command (Rhino.Command “-Array”) it defaults to EnableRedraw=True - is there a way to keep EnableRedraw=False ?

thx
-Keith

Looks like that may be some sort of bug… In any case I usually avoid scripting an array of objects using “Array” and use a double (2D) or triple (3D) For loop and copy the objects…

–Mitch

Thanks Mitch, can you demo the double(2d) - I am a bit lost there.

@dale can you add this to myjetbrains - thanks,

Keith

Something like:

Option Explicit

Call TwoDArrayExample()
Sub TwoDArrayExample()

    Dim arrObjs,intXNum,intYNum,dblXDist,dblYDist
    arrObjs = Rhino.GetObjects("Select objects to array",,, True)
    If Not IsArray(arrObjs) Then Exit Sub

    intXNum = Rhino.GetInteger("Number of objects in X?",, 2)
    If Not IsNumeric(intXNum) Then Exit Sub

    intYNum = Rhino.GetInteger("Number of objects in Y?",, 2)
    If Not IsNumeric(intYNum) Then Exit Sub

    dblXDist = Rhino.GetReal("X spacing?",, 0)
    If Not IsNumeric(dblXDist) Then Exit Sub

    dblYDist = Rhino.GetReal("Y spacing?",, 0)
    If Not IsNumeric(dblYDist) Then Exit Sub

    Dim i,j
    Call Rhino.EnableRedraw(False)
    For j=0 To intYNum - 1
        For i=0 To intXNum - 1
            'don't copy the original object
            If Not (i = 0 And j = 0) Then
                Call Rhino.CopyObjects(arrObjs, Array(0, 0, 0), Array(i * dblXDist, j * dblYDist, 0))    
            End If
        Next
    Next
    Call Rhino.EnableRedraw(True)    
End Sub

Thanks Mitch, lots there for me to learn from.

Cheers,
Keith

This should be fixed in the next Rhino WIP release.