Here's a suggested revision of your code to clear it up a bit. You've declared variables that seem not to have any use but a temporary one. Also it's difficult to work out what is 'local' or 'global', so I suggest tagging variables that are with '_'. For instance '_brush' or you could go with the classic lowercase 'G' before (gBrush). Also add comments to everything so you know what it does. Helps when looking back at your code.
type brushType
id as integer
bs as integer
posX as integer
posY as integer
posZ as integer
angX as integer
angY as integer
angZ as integer
scaleX as integer
scaleY as integer
scaleZ as integer
model as string
texture as string
material as string
endtype
dim _brush() as brushType
// add comment so you and others know what this does...
if button clicked( brushOkBrush3 )
// add an element to the bottom of the array by
// increasing it by one. Also this command sets the
// current array index to the new element, so you
// can leave the array index empty after using this command.
array insert at bottom _brush()
// setup brush
_brush().id = BrushNum
_brush().bs = BS
_brush().posX = object position x(brush3)
_brush().posY = object position y(brush3)
_brush().posZ = object position z(brush3)
_brush().angX = object angle x(brush3)
_brush().angY = object angle y(brush3)
_brush().angZ = object angle z(brush3)
_brush().scaleX = object scale x(brush3)
_brush().scaleY = object scale y(brush3)
_brush().scaleZ = object scale z(brush3)
_brush().model = "models/editor/3_sided_brush.x"
_brush().texture = ""
_brush().material = ""
delete window BrushWinBrush3
endif