;REVERSE.lsp 06/18/97 Jeff Foster ; ;OBJECTIVE*** ;The purpose of this routine is to allow the user to reverse the direction ;of a selected polyline ; ;TO RUN*** ;At the command line, type (load "c:/lispdir/reverse") ;where c:/ is the drive where REVERSE.lsp is contained ;where lispdir/ is the directory where REVERSE.lsp is contained ; ; ;If you find this routine to be helpful, please give consideration ;to making a cash contribution of $10.00 to: ; Jeff Foster ; 590 Penny Rd. ; Angier, NC 27501 ; (defun C:REVERSE () (prompt "\nCommand to reverse the direction of a polyline") (SAVE_VAR) (SET_VAR) (PROCESS) (RESTORE_VAR) ) (Defun SAVE_VAR () (setq c_col (getvar "CECOLOR") c_lay (getvar "CLAYER") c_cmd (getvar "CMDECHO") ) ) (Defun SET_VAR () (setvar "CECOLOR" "bylayer") (setvar "CMDECHO" 0) ) (Defun PROCESS () (setq en (car (entsel "\nSelect the Polyline to reverse: ")) etype (cdr (assoc 0 (entget en))) e_clt (cdr (assoc 6 (entget en))) e_lay (cdr (assoc 8 (entget en))) e_col (cdr (assoc 62 (entget en))) ) (if (= etype "POLYLINE") ;is entity a Pline? (progn (setq en1 (entnext en) ;first vertex en1_inf (entget en1) pt1 (cdr (assoc 10 en1_inf)) en2 (entnext en1) ;second vertex en2_inf (entget en2) pt2 (cdr (assoc 10 en2_inf)) ) (command "layer" "s" e_lay "") (command "break" en pt1 pt2) (setq lst_ply (ssget "l")) (if (/= e_clt nil) (setvar "celtype" e_clt) ) (if (/= e_col nil) (command "cecolor" e_col) ) (command "pline" pt2 pt1 "") (command "pedit" "l" "j" lst_ply "" "") ) (progn (T (prompt "\nEntity is not a Polyline.")) (PROCESS) ) ) ) (Defun RESTORE_VAR () (setvar "CECOLOR" c_col) (setvar "CLAYER" c_lay) (setvar "CMDECHO" c_cmd) ) (prompt "\nCommand Name is Reverse\n") (C:REVERSE)