EDIT LISP

Moderator: Carlson Support

EDIT LISP

Postby jbaldeo » Mon Feb 04, 2019 4:29 pm

Hello all, I have to edit the following lisp program and need some help please - So this lisp adds 1.46 to the selected text and puts it on a layer El88, but I need it to put the resulting text in Parentisis at the same time, can anyone help

;CONV.LSP Change Brooklyn ELS TO NAVD 1988(c)1997, ROBERT CASTILLO 4/18/97ss

(defun txterr (s)
(if (/= s "Function cancelled")
(princ (strcat "\nError: " s)))
(if olderr (setq *error* olderr))
(princ)
)

(defun C:CONV ( / SSET SSL NSSET SSLEN SSNUM OLDERR TXT NEWPOS EDATA NEW OLD ENAME )
(setvar "cmdecho" 0)
(setq OLDERR *error*
*error* txterr)

(prompt "\nBeginning CONV.LSP")
(prompt "\nSelect text entity(s) to change...")

(setq SSET (ssget))

(verify)

; * * * * * MAIN LOOP * * * * *
(if SSET
(progn
(setq SSLEN (sslength SSET))
(setq SSNUM 0)
(while (/= SSNUM sslen)
(setq EDATA (entget (setq ENAME (ssname SSET ssnum))))
; TEXT VALUE CONVERSION FROM BROOKLYN TO NAVD 88 DATUMS
(setq OLD (assoc 1 EDATA ))
(setq TXT(cdr (assoc 1 EDATA ) ) )
(setq TXT(rtos (+ 1.46(atof TXT ) ) ) )
;(setq TXT(strcat "(" TXT ")" ) )
(setq NEW (cons 1 TXT))
(setq EDATA (subst NEW OLD EDATA ))
; PUT ON LAYER USMH
(setq OLD (assoc 8 EDATA ))
(setq NEW (cons 8 "El88"))
(setq EDATA (subst NEW OLD EDATA ))
; MOVE ITS INSERTION POINT
(setq OLD (assoc 10 EDATA ))
(setq NEWPOS (+ 1 (caddr OLD ) ) )
(setq NEW (subst NEWPOS (caddr OLD )OLD ) )
(setq EDATA (subst NEW OLD EDATA ))

(setq SSNUM (1+ SSNUM)); increment counter
(entmake EDATA ); make the NEW entity
);end while
);end progn
(prompt "\nNo text selected...")
); end if
(princ)
);end defun CONV

(defun verify ()
(setq SSL (sslength SSET)
NSSET (ssadd))
(if (> SSL 25)
(princ "\nVerifying the selected entities -- please wait. ")
)
(while (> SSL 0)
(setq temp (ssname SSET (setq SSL (1- SSL))))
(if (= (cdr(assoc 0 (entget temp))) "TEXT")
(ssadd temp NSSET)
)
)
(setq SSL (sslength NSSET)
SSET NSSET
)
(print SSL)
(princ "text entities found. ")
)
(princ "Loaded...")
(princ);end conv.lsp
JB1
jbaldeo
 
Posts: 49
Joined: Wed Jul 25, 2012 1:45 pm

Re: EDIT LISP

Postby gskelhorn » Mon Feb 04, 2019 10:40 pm

Try uncommenting the line:
;(setq TXT (strcat "(" TXT ")"))

by deleting the semicolon ; from the beginning.
(setq TXT (strcat "(" TXT ")"))
gskelhorn
 
Posts: 119
Joined: Tue Nov 03, 2009 12:56 am

Re: EDIT LISP

Postby jbaldeo » Tue Feb 05, 2019 4:32 pm

Great that works, Thanks a lot
JB1
jbaldeo
 
Posts: 49
Joined: Wed Jul 25, 2012 1:45 pm


Return to Survey

Who is online

Users browsing this forum: No registered users