LISP: If, Not
LISP: If, Not
(OP)
Greetings all,
I've created a lisp routine to automatically repath an image that had already been inserted but where the path/filename was incorrect. It works fine but the problem is the image type isn't always the same, i.e. sometimes they are a .TIF and others they are a .CAL.
I included an IF NOT command where if it didn't find filename.CAL then go find filename.TIF. Seems to me I have the syntax correct but apparently not because if it doesn't find the .CAL it just quits. Likewise if I swap the CAL and TIF it will only find the TIF but not the CAL.
Any suggestions?
Thanks,
Keith
I've created a lisp routine to automatically repath an image that had already been inserted but where the path/filename was incorrect. It works fine but the problem is the image type isn't always the same, i.e. sometimes they are a .TIF and others they are a .CAL.
I included an IF NOT command where if it didn't find filename.CAL then go find filename.TIF. Seems to me I have the syntax correct but apparently not because if it doesn't find the .CAL it just quits. Likewise if I swap the CAL and TIF it will only find the TIF but not the CAL.
Any suggestions?
Thanks,
Keith
CODE
(setq imagename (getvar "dwgname"))
(setq imagename (substr imagename 1 (- (strlen imageName) 4)))
(setq filename (strcat (getvar "dwgprefix") imagename ".cal"))
(if (not filename)
(setq filename (strcat (getvar "dwgprefix") filename ".tif"))
)
(command "image" "p" imagename filename)
(setq imagename (substr imagename 1 (- (strlen imageName) 4)))
(setq filename (strcat (getvar "dwgprefix") imagename ".cal"))
(if (not filename)
(setq filename (strcat (getvar "dwgprefix") filename ".tif"))
)
(command "image" "p" imagename filename)
RE: LISP: If, Not
Maybe changing one line to the following will do it;
(if (not (findfile filename))
RE: LISP: If, Not
Unknown command "C:\DOCUMENTS AND SETTINGS\me\DESKTOP\filename.cal". Press F1 for help.
nil
CODE
(setq imagename (substr imagename 1 (- (strlen imageName) 4)))
(setq filename (strcat (getvar "dwgprefix") imagename ".cal"))
(if (not (findfile filename))
(setq imagename (substr imagename 1 (- (strlen imageName) 4)))
(setq filename (strcat (getvar "dwgprefix") filename ".tif"))
)
(command "image" "p" imagename filename)
RE: LISP: If, Not
CODE
(setq imagename (substr imagename 1 (- (strlen imageName) 4)))
(setq filename (strcat (getvar "dwgprefix") imagename ".cal"))
(if (not (findfile filename))
(setq filename (strcat (getvar "dwgprefix") imagename ".tif"))
)
(command "image" "p" imagename filename)
RE: LISP: If, Not
Thanks much!!.