PDA

View Full Version : Issue with replacing backslash (\) characters



Phil Gravel
2012-04-18, 03:05 PM
Good day all,

I've been running ashore trying to get this lisp running. Here's what I'm trying to do:
1) Get user input on file name and insertion point
2) Locate the actual file
3) Insert it in the dwg as a block

All works fine until the insertion of the block
Using: (PATHFLAG is already define earlier)

(defun FILEFIND()
(setq FILETOFIND (strcat TYPQUINC NUMQUINC ".dwg"))
(setq STARTDIR (strcat "H:/Banque/AutoCAD/Quincaillerie/" PATHFLAG "/"))
(setq PATHQUINC (acet-file-dir FILETOFIND STARTDIR))
)

Would return (in a specific instance) if using (princ PATHQUINC):
(H:\Banque\AutoCAD\Quincaillerie\A-Attache\Titus\A000.dwg)
Which is bang on the money.

Problem happens when I: (INSRTPT is also predefined earlier)
(command "_.insert" PATHQUINC INSRTPT "" "" "")
Autocad requires the name of the block to be inserted.....

What am I not seeing?????

I've tried (vl-string-translate "\\\"" "/" pathquinc) to get it to look at the right place, but that doesn't work either....
Thanks

GHarvey
2012-04-18, 04:01 PM
I believe that acet-file-dir returns a list, rather than a string. I suggest changing


(setq PATHQUINC (acet-file-dir FILETOFIND STARTDIR))

to


(setq PATHQUINC (car (acet-file-dir FILETOFIND STARTDIR)))

Phil Gravel
2012-04-18, 04:46 PM
Ha! - That was so obvious and yet I couldn't figure it out....

Thanks a lot! Fixed my issue.