BrianTFC Posted February 17, 2012 Share Posted February 17, 2012 Good Morning, I was wondering if there is a lisp routine out there that when multiple objects are selected they could be put into a straight line along the X at a predetermined space. I have attached an AutoCAD 2000 dwg to show what i'm looking for. I would appreciate any help. Thanks, Brian MOVE .dwg Quote Link to comment Share on other sites More sharing options...
pBe Posted February 17, 2012 Share Posted February 17, 2012 (edited) Not that hard, only you may need to select the objects in order for the program to know which goes where Select Objects Enter Distance Pick Point Bounding Box Move (lower left as basepoint) Compute width (LL - > UR) point for distance for next object Not thoroughly tested (defun c:test (/ ss pt e mn mx) (setq ss (ssget ":L")) (setq pt (getpoint "\nPick Point for new location: ")) (if (not dist) (setq dist 1.00)) (setq dist (cond ((getreal (strcat "\nEnter Distance <" (rtos dist 2 2) ">: "))) (dist))) (repeat (sslength ss) (vla-getboundingbox (setq e (vlax-ename->vla-object (ssname ss 0))) 'mn 'mx) (vla-move e mn (vlax-3d-point pt)) (setq pt (list (+ (car pt) dist (- (car (vlax-safearray->list mx)) (car (vlax-safearray->list mn)))) (cadr pt) 0.0) ) (ssdel (ssname ss 0) ss) )) Edited February 17, 2012 by pBe Quote Link to comment Share on other sites More sharing options...
Saqib_theleo Posted February 18, 2012 Share Posted February 18, 2012 Not that hard, only you may need to select the objects in order for the program to know which goes where Select Objects Enter Distance Pick Point Bounding Box Move (lower left as basepoint) Compute width (LL - > UR) point for distance for next object Not thoroughly tested (defun c:test (/ ss pt e mn mx) (setq ss (ssget ":L")) (setq pt (getpoint "\nPick Point for new location: ")) (if (not dist) (setq dist 1.00)) (setq dist (cond ((getreal (strcat "\nEnter Distance <" (rtos dist 2 2) ">: "))) (dist))) (repeat (sslength ss) (vla-getboundingbox (setq e (vlax-ename->vla-object (ssname ss 0))) 'mn 'mx) (vla-move e mn (vlax-3d-point pt)) (setq pt (list (+ (car pt) dist (- (car (vlax-safearray->list mx)) (car (vlax-safearray->list mn)))) (cadr pt) 0.0) ) (ssdel (ssname ss 0) ss) )) It works as he wanted. Quote Link to comment Share on other sites More sharing options...
BrianTFC Posted February 20, 2012 Author Share Posted February 20, 2012 It worked great thank you..... Quote Link to comment Share on other sites More sharing options...
pBe Posted February 22, 2012 Share Posted February 22, 2012 It worked great thank you..... You are welcome BrianTFC Glad I could help Cheers Quote Link to comment Share on other sites More sharing options...
poojaul1 Posted February 22, 2012 Share Posted February 22, 2012 this site provide me the knowledge of Auto Cad 2000 & it really worked. Quote Link to comment Share on other sites More sharing options...
pBe Posted February 22, 2012 Share Posted February 22, 2012 this site provide me the knowledge of Auto Cad 2000 & it really worked. Is that comment had anything to do with to this thread? BTW: Welcome to the forum poojaul1. Quote Link to comment Share on other sites More sharing options...
RenManZ Posted May 6, 2012 Share Posted May 6, 2012 how would you modify this to align and space vertically or horizontally? Quote Link to comment Share on other sites More sharing options...
pBe Posted May 7, 2012 Share Posted May 7, 2012 (edited) Will that be vertical or horizontal and not vertical AND horizontal? (defun c:test (/ ss pt e mn mx _d _d2 d dist mode) (setq ss (ssget ":L")) (setq pt (getpoint "\nPick Point for new location: ")) (if (not dist) (setq dist 1.00)) (setq dist (cond ((getdist (strcat "\nEnter Distance <" (rtos dist 2 2) ">: "))) (dist))) (initget 1 "V H") (setq mode (getkword "\nSelect [Vertical/Horizontal]:")) (if (eq mode "H") (setq _D car _D2 cadr)(setq _D cadr _D2 car)) (repeat (sslength ss) (vla-getboundingbox (setq e (vlax-ename->vla-object (ssname ss 0))) 'mn 'mx) (vla-move e mn (vlax-3d-point pt)) (setq d (+ (- (_d (vlax-safearray->list mx)) (_d (vlax-safearray->list mn))) dist)) (setq pt (if (eq mode "H") (list (+ (_d pt) d) (_d2 pt) 0.0) (list (_d2 pt) (+ (_d pt) d) 0.0)) ) (ssdel (ssname ss 0) ss) )) Edited May 7, 2012 by pBe Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.