- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good day!
Take a look at my code below:
---
(defun c:eqspace ( / adoc space basePoint counter ssPnt ssObjects)
(vl-load-com)
(setq adoc (vla-get-activedocument (vlax-get-acad-object)))
(vla-startundomark adoc)
(setvar "cmdecho" 0)
(setq counter 1)
(setq space -0.55)
;(setq space (getreal "\n\033\n <#> Spacing distance: "))
(if (setq basePoint (getpoint "\n\033\n <.> Select base point"))
(progn
(while (setq ssPnt (getpoint "\n\033\n <.> Select objects reference point"))
(setq ssObjects (ssget))
(command "move" ssObjects "" ssPnt (list (car basePoint) (+ (cadr basePoint) (* counter space)) 0))
(setq counter (1+ counter))
(princ)
) ;while
) ;progn
(progn
(princ "\n\033\n <!> No initial base point selected <!> \n")
(princ "\n * Aborting routine * \n")
(exit)
) ;progn
) ;if
(setvar "cmdecho" 1)
(vla-endundomark adoc)
(princ (strcat "\n\033\n\033\n * Routine modified " (itoa (1- counter)) " selection sets * "))
(princ)
) ;eqspace
---
If you look at my test3.dwg, this routine will equally space subsequential selection sets to a defined spacing. From left to right in text3.dwg, the 2nd and 3rd columns are the before and after. However, executing this routine on the 1st column has unpredictable results. If select the base point from the left side, the routine spaces them as intended, but if I choose base points that are located on the vertical line, the results can be that the lines are stacked on top and/or not with consistent spacing.
Why does selecting a base point that is located on an entity that isn't a member of the selection set and also vertical cause this?
Any help?
Solved! Go to Solution.