Help getting xall.lsp to work
I've an acad lisp routine that I'd like to use with Bricscad. It doesn't work. Anyone have any suggestions:
(defun c:xall (/ lyr elist ename p1 p2 p3 p4 ang1 ang2)
(COMMAND "UNDO" "MARK")
(setq exd (getdist "What is extension distance: "))
(setq lyr (cdr (assoc 8 (entget (car
(entsel "Pick item from layer to process: ")))))
ename (entnext))
(while (boundp 'ename)
(setq elist (entget ename))
(if (and (= (cdr (assoc 0 elist)) "LINE")
(= (cdr (assoc 8 elist)) lyr))
(progn
(setq p1 (cdr (assoc 10 elist)) p2 (cdr (assoc 11 elist))
ang2 (angle p1 p2) ang1 (angle p2 p1)
p3 (polar p1 ang1 exd) p4 (polar p2 ang2 exd)
elist (subst (cons 10 p3) (cons 10 p1) elist)
elist (subst (cons 11 p4) (cons 11 p2) elist))
(entmod elist)
)
)
(setq ename (entnext ename))
)
)
Thanks.
Comments
-
Hi Paul, it looks to me like boundp is failing on locals. I removed ename from the local list and it works. I will send it in as a support request and let you know the result here.
Or you can try to use a selection set. Does this do what you want:
(defun c:xall2 (/ lyr elist ename ss1 sslen i p1 p2 p3 p4 ang1 ang2)
(COMMAND "UNDO" "MARK")
(setq exd (getdist "What is extension distance: "))
(setq lyr (cdr (assoc 8 (entget
(car (entsel "Pick item from layer to process: "))))))
;;; get a selection set of all LINE entites on layer "lyr"
(if (setq ss1 (ssget "X" (list '(0 . "LINE")(cons 8 lyr))))
(setq sslen (sslength ss1))
(setq sslen 0)
)
;;; process the selection set
(setq i 0)
(repeat sslen
(setq ename (ssname ss1 i)
i (1+ i)
elist (entget ename)
p1 (cdr (assoc 10 elist)) p2 (cdr (assoc 11 elist))
ang2 (angle p1 p2) ang1 (angle p2 p1)
p3 (polar p1 ang1 exd) p4 (polar p2 ang2 exd)
elist (subst (cons 10 p3) (cons 10 p1) elist)
elist (subst (cons 11 p4) (cons 11 p2) elist))
(entmod elist)
)
)0 -
Hi Greg,
I tried your lisp ..xall2.lsp. It works great!. Just what I was looking for.
Thanks so much.
Being a newbie testing out Bricscad...very impressed thus far.
Only ran into a few minor things like this I need to get a handle on. Still trying to figure out how
to import ACAD hatch patterns. (Will start another thread).
0 -
Dear Paul, Dear Greg,
there was indeed a problem with (boundp) on local variables ... has been fixed right now;
the fix will be included in one of the coming Bricscad versions.Many thanks and many greetings
0 -
Hi Torsten,
I'm impressed with Bricsys's response. Thanks.
0