Code Red > AutoLISP (Vanilla / Visual)
VLisp Question
Craig:
Thanks Mark, but something is going wrong. I get the follwing error
--- Quote ---Error: cannot create file: h:\03033\03033MP1.dwg; error: An error has occurred
inside the *error* functionAutoCAD variable setting rejected: "orthomode" nil
--- End quote ---
Mark:
--- Code: ---;;; path = string
;;; c:\\temp\\ <-- needs ending '\\'
(defun cpCurdwg (path / doc fn dn nn)
(vl-load-com)
(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
(setq fn (vlax-get-property doc 'FullName)
dn (vlax-get-property doc 'Name)
nn (strcat path dn)
)
(if (findfile nn)
(alert "File exists.....")
(if (vl-file-copy fn nn)
(progn (princ "\nFile copied...")
(princ "\nNo file copied...")
)
)
)
(princ)
)
--- End code ---
Craig:
Line by line, here's whats going on.
--- Code: ---(setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))
#<VLA-OBJECT IAcadDocument 0108c8bc>
(setq fn (vlax-get-property doc 'FullName))
"C:\\DWG\\03033\\03033MP1.dwg"
(setq dn (vlax-get-property doc 'Name))
"03033MP1.dwg"
(setq nn (strcat "h:\\" (substr dn 1 5)"\\" dn))
"h:\\03033\\03033MP1.dwg"
(vl-file-copy fn nn)
Error: cannot create file: h:\03033\03033MP1.dwg; error: An error has occurred
inside the *error* functionAutoCAD variable setting rejected: "orthomode" nil
--- End code ---
Alright, tell me what the hell I am doing wrong.
Mark:
What happens when you run the program like this.
(cpCurdwg "h:/03033/")
does the \03033\ already exist?
Craig:
When it does the findfile, it finds NIL but the file is there. I tried changing the path from h:\ to h:\\. I even did an strcase just to change them to all UPPERCASE since it extracts it that way, but to no avail.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version