(repeat (/ (1+ index) 2); (index + 1) gedeeld door 2 voor nodige aantal loops
(setq x (vlax-safearray-get-element (vlax-variant-value coordinates) (- n 1))) ;We get the values of x,y,z from safearray, we stuff these in pointarray
(setq y (vlax-safearray-get-element (vlax-variant-value coordinates) (- n 0))) ;pointarray contains the same points, but in the reversed order
(vlax-safearray-put-element pointarray (+ m 0) x)
(vlax-safearray-put-element pointarray (+ m 1) y)
(setq n (- n 2))
(setq m (+ m 2))
)