Lt Dan's legs Posted December 14, 2010 Posted December 14, 2010 how can put the selection set of blocks in an order. I may be wrong but it seems like goes by insertion point. If I window these two blocks it will select the corner first. If the corner block was mirrored on the 4 block the corner block would still be selected first. Quote
David Bethel Posted December 14, 2010 Posted December 14, 2010 I think it goes by the SORTENTS value. But the question begs "Why?" -David Quote
Lt Dan's legs Posted December 14, 2010 Author Posted December 14, 2010 top is what I have and the bottom is what I'm trying to accomplish. I'm already able to select the panel blocks and my lisp will number them. What I want to do is be able to select the corner and panel blocks and number them. Quote
David Bethel Posted December 14, 2010 Posted December 14, 2010 Looks like a walkin refrigeration box. If the panel insert points form a true rectangle, then you could create an algorithm that would calculate the clockwise position of each panels insertion point. It would be very project specific as to the location of inserts points versus balloon number location. -David Quote
Lt Dan's legs Posted December 14, 2010 Author Posted December 14, 2010 It is a walk-in I have a program that inserts the panels, corners, door and dimensions. The circle and numbers are for production. Problem is we do many revisions before a walk-in is built. Like I said, I got it to where you select the panels and it's inserted into the correct place and with the correct #. My problem is the corners... Seems like I need to find a better way to number these blocks Quote
David Bethel Posted December 14, 2010 Posted December 14, 2010 I lean towards something like this: ;;;ARG 2D Point List (defun cwnumber (lst / minx maxx miny maxy ll lr ur ul minxl maxxl minyl maxyl i tp fl) (defun AtoR (a) (* pi (/ a 180.0))) (setq minx (apply 'min (mapcar 'car lst)) maxx (apply 'max (mapcar 'car lst)) miny (apply 'min (mapcar 'cadr lst)) maxy (apply 'max (mapcar 'cadr lst))) (setq ll (list minx miny) lr (list maxx miny) ul (list minx maxy) ur (list maxx maxy)) (grvecs (list 1 ul ur 2 ur lr 3 lr ll 4 ll ul)) (foreach p lst (and (not (member p (list ul ur lr ll))) (= minx (car p)) (setq minxl (cons (cadr p) minxl))) (and (not (member p (list ul ur lr ll))) (= maxx (car p)) (setq maxxl (cons (cadr p) maxxl))) (and (not (member p (list ul ur lr ll))) (= miny (cadr p)) (setq minyl (cons (car p) minyl))) (and (not (member p (list ul ur lr ll))) (= maxy (cadr p)) (setq maxyl (cons (car p) maxyl)))) (setq minxl (qsort minxl '<) maxxl (qsort maxxl '<) minyl (qsort minyl '<) maxyl (qsort maxyl '<)) (setq fl (list (cons 135 ul))) (foreach p (reverse minxl) (setq fl (cons (list 180 minx p) fl))) (setq fl (cons (cons 225 ll) fl)) (foreach p minyl (setq fl (cons (list 270 p miny) fl))) (setq fl (cons (cons 315 lr) fl)) (foreach p maxxl (setq fl (cons (list 0 maxx p) fl))) (setq fl (cons (cons 45 ur) fl)) (foreach p (reverse maxyl) (setq fl (cons (list 90 p maxy) fl))) (setq i 1) (foreach p fl (setq tp (polar (cdr p) (ator (car p)) (* (if (zerop (rem (car p) 90)) 1 (sqrt 2)) 4))) (entmake (list (cons 0 "TEXT")(cons 10 tp)(cons 11 tp) (cons 1 (itoa i)) (cons 40 4) (cons 72 4))) (setq i (1+ i))) (prin1)) ;; -------------------------------------------------------------------------- ;; Function: QSORT ;; Method : Quicksort. ;; Params : See (selsort). ;; Examples: As per (selsort). ;; -------------------------------------------------------------------------- (defun qsort (LST FUN / sort subnth) ;; -------------------------------------------------------------------------- ;; Function: SORT ;; Purpose : Recursive part of quicksort routine. ;; Params : L, R: index numbers indicating left and right ends of sublist ;; of LST to sort using FUN. ;; Locals : i, j: index numbers of "end" elements to sort ;; x: index number of "middle" element ;; loop: boolean - T while sorting still required ;; -------------------------------------------------------------------------- (defun sort (L R / i j x loop) (setq i L j R x (nth (/ (+ L R) 2) LST) loop T ) (while loop (while (apply FUN (list (nth i LST) x)) (setq i (1+ i)) ) (while (apply FUN (list x (nth j LST))) (setq j (1- j)) ) (if (<= i j) (setq LST (subnth (nth i LST) j (subnth (nth j LST) i LST)) i (1+ i) j (1- j) ) ) (setq loop (<= i j)) ) (if (< L j) (sort L j)) (if (< i R) (sort i R)) ) ; End qsort.sort ;; -------------------------------------------------------------------------- ;; Function: SUBNTH ;; Purpose : Returns a list with the item at the Nth position substituted ;; with a new item. ;; Params : ITEM: item to insert ;; N: index number of item position (0 is first item in list) ;; LST: list to act on ;; Local : #: item counter ;; tlst: temporary list ;; Examples: (subnth 999 9 '(1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6)) ;; returns => (1 2 3 4 5 6 7 8 9 999 1 2 3 4 5 6) ;; (subnth 999 9 '(1 2 3 4)) => (1 2 3 4 999) ;; (subnth 999 9 nil) => (999) ;; -------------------------------------------------------------------------- (defun subnth (ITEM N LST / # tlst) (setq # 0) (while (and LST (/= # N)) (setq tlst (cons (car LST) tlst) LST (cdr LST) # (1+ #) ) ) (append (reverse tlst) (list ITEM) (cdr LST)) ) ; End qsort.subnth ;; Start qsort ------------------------ (sort 0 (1- (length LST))) LST ) ; End qsort ;;; Copyright: (c) Water Authority of Western Australia 1990, 1994. ;;; ;;; Disclaimer: This software is provided "as is" without express or ;;; implied warranty. All implied warranties of fitness for any particular ;;; purpose and of merchantability are hereby disclaimed. If it eats your ;;; drawings, tough luck. ;;; ;;; Permission notice: Permission to use, copy, modify and distribute this ;;; software for any purpose and without fee is hereby granted, provided ;;; that it is distributed with the above copyright notice, disclaimer and ;;; this permission notice. ;;; Good Luck -David 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.