LM: Incremental Array

LM: Incremental Array

nathanwheeler27
Advocate Advocate
1,094 Views
3 Replies
Message 1 of 4

LM: Incremental Array

nathanwheeler27
Advocate
Advocate

Code: http://www.lee-mac.com/incrementalarray.html

 

Hi Everyone,

 

It seems like it should be simple to do this, but maybe not. Does anyone know how to modify the Dynamic Incremental Array to end with allowing the user to place one final object freely?

 

For example: select objects to array -> incarrayd -> input offset value -> pick basepoint - > array objects -> then you can place one more using the original basepoint.

 

Most of the time I use this command the final object to be placed isn't evenly spaced with everything else. 

 

Thank you

0 Likes
Accepted solutions (1)
1,095 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant

Perhaps you can just move the last object (command "move" "l" "" bpt pause)

 

Message 3 of 4

nathanwheeler27
Advocate
Advocate

Hmm, not quite. If a group of objects are being arrayed, it only moves the last object, not the whole group. It also uses the originally selected basepoint, but I need it to be relative to the last placed object/group. 

 

I was definitely over thinking it before, so if I can figure out how to get a few variables, the "move" command is probably what I want to use. I will post what I come up with later today if I get it.

0 Likes
Message 4 of 4

nathanwheeler27
Advocate
Advocate
Accepted solution

SOLUTION:

 

This snippet of code goes before the last (princ) in defun LM:incarray

 

; Move the last object(s) in the array
    (setq ii 0 movelist (list))
    (while (< ii (length lst))
      
      (setq movelist (cons (vlax-vla-object->ename (nth ii obl)) movelist)) ; List of objects to move
      
      (setq ii (+ 1 ii))
    )
    
    (setq movess (ssadd))
    (foreach item movelist
      (ssadd item movess) ; Convert list of objects to selection set
    )
  
    (command "move" movess "" (polar bpt (angle bpt (car (cdr ept))) (* (fix qty) (distance '(0 0 0) vxu))) pause) ; Move objects
  

 

 

There might be a more efficient way to do this, but it works.