Paul H Posted April 20, 2011 Posted April 20, 2011 Hi Does anyone know of a LISP routine that would create a space between objects? Array would be fine for one object repeated, what if the objects were all different? I spend a lot of time manually spacing objects... Thanks Quote
ReMark Posted April 20, 2011 Posted April 20, 2011 Is the spacing random? I know of a VLX lisp program called Scatter: "move selected objects randomly in 2D or 3D - orchard, parking, crowd..." Quote
pBe Posted April 20, 2011 Posted April 20, 2011 Hi Does anyone know of a LISP routine that would create a space between objects? Array would be fine for one object repeated, what if the objects were all different? I spend a lot of time manually spacing objects... Thanks Whats the reason for the spacing? just moving the entities away from the next entitiy for clarity? Quote
Tharwat Posted April 20, 2011 Posted April 20, 2011 Whats the reason for the spacing? just moving the entities away from the next entitiy for clarity? Hi pBe. Suppose that he has tens of Circles and Texts and wanted to separate them from each other with a specific length of distance ! So Array command won't allow him to select more than one entity at the same time . And to go with Move command , that's a matter of long time to do the trick . Thanks Quote
pBe Posted April 20, 2011 Posted April 20, 2011 Hi pBe. Suppose that he has tens of Circles and Texts and wanted to separate them from each other with a specific length of distance ! Thanks You think so tharwat? Anyway lets be patient. Its best that we wait for the OP to clarify that for us. Cheers Quote
Tharwat Posted April 20, 2011 Posted April 20, 2011 I guess so , because he mentioned objects which gave me the inspiration to say it might be different sorts of entities . Cheers. Quote
BIGAL Posted April 21, 2011 Posted April 21, 2011 It does not matter what it is, what counts is how you work out box size that contains the object, if you took 100 blocks and did a 10x10 grid chances are some blocks would be to big and overlap. You could do this in a number of ways read file/excell that sets size of box, create a new layout tab place block or objects and work out its extents min max this gives box size then erase all jump back and add object keep a record of x max and y max if multi rows required but do able. This is definately do able you get a different answer for extmin extmax for every layout tab. Quote
alanjt Posted April 21, 2011 Posted April 21, 2011 Quickie. I'll clean it up and post some code tomorrow. EDIT: ahh, screw it, here (be forewarned, it's sloppy as hell): (defun _bboxAndMid (obj / a b l) (vla-getboundingbox obj 'a 'b) (list (car (setq l (mapcar 'vlax-safearray->list (list a b)))) (apply '(lambda (a b) (mapcar '(lambda (a b) (/ (+ a b) 2.)) a b)) l) (cadr l) ) ) (defun ss->lst (ss / i l) (if (eq (type ss) 'PICKSET) (repeat (setq i (sslength ss)) (setq l (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) l)) ) ) ) (defun c:Test (/ lst p1 g p2 a d) (if (and (setq lst (ss->lst (ssget "_:L"))) (setq p1 (getpoint "\nSpecify first point: ")) ) (while (eq 5 (car (setq g (grread T 15 0)))) (redraw) (grdraw p1 (polar (setq p2 (cadr g)) (angle p1 p2) 10000000.) 1 -1) (setq p1 (trans p1 1 0) p2 (trans p2 1 0) a (angle p1 p2) d (/ (distance p1 p2) (float (length lst))) ) (vla-move (car lst) (vlax-3d-point (cadr (_bboxAndMid (car lst)))) (vlax-3d-point p1)) (mapcar '(lambda (o1 o2 / l) (vla-move o2 (vlax-3d-point (cadr (_bboxAndMid o2))) (vlax-3d-point (polar (cadr (setq l (_bboxAndMid o1))) a (+ d (distance (car l) (caddr l))) ) ) ) ) lst (cdr lst) ) ) ) (redraw) (princ) ) Quote
Paul H Posted April 21, 2011 Author Posted April 21, 2011 Thanks for all the quick responses guys! Thanks reMark, I do need ordered spacing though... Yeah pBe, it's basically laying out structures in order to dim up and annotate... Looks like alnajt's routine should do the trick, thanks mate... Love this site! Quote
alanjt Posted April 21, 2011 Posted April 21, 2011 Thanks guys, but like I said, it's sloppy. I was waiting on my wife to finish American Idol so I could watch Spaceballs. I wrote this in about five minutes, using the fist bad idea that popped in my head. Quote
Paul H Posted April 21, 2011 Author Posted April 21, 2011 Thanks guys, but like I said, it's sloppy. I was waiting on my wife to finish American Idol so I could watch Spaceballs. I wrote this in about five minutes, using the fist bad idea that popped in my head. Heh! One last thing alanjt, I'm just being dumb...what is the command to launch the routine? I'm fairly new to LISP, is it _bboxandmid? Ta Paul Quote
alanjt Posted April 21, 2011 Posted April 21, 2011 Heh! One last thing alanjt, I'm just being dumb...what is the command to launch the routine? I'm fairly new to LISP, is it _bboxandmid? Ta Paul Sorry, I needed two subroutines and I wrote them on the forefront - like I said, this is sloppy as hell. The actual routine is at the bottom, and I just called it test - rename it what you like. Quote
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.