Little help in this lisp

Little help in this lisp

CAD-Geek
Advocate Advocate
819 Views
1 Reply
Message 1 of 2

Little help in this lisp

CAD-Geek
Advocate
Advocate

I use the below lisp to saveas and bind dwg in (Document\Bind\) folder.
I need a little help when the lisp trying to saveas dwg replace it if found.

 

(defun c:Bind (/ Path UserProfile cObj cName)
(setq Path (strcat (if (vl-string-search "Settings" (setq UserProfile (getenv "UserProfile")))
(strcat UserProfile "\\My Documents\\Bind") ; Win XP
(strcat UserProfile "\\Documents\\Bind") ; > Win 7
)
)
)
(if (not (vl-file-directory-p Path))
(vl-mkdir Path)
)
(command "_.saveas" "" (strcat Path "\\" (getvar 'DwgName)))
(setq cObj(tblnext "BLOCK" T))
(while cObj
(setq cName(cdr(assoc 2 cObj)))
(if
(and
(=(logand(cdr(assoc 70 cObj))32)32)
(=(logand(cdr(assoc 70 cObj))4)4)
)
(progn
(vl-cmdf "bindtype" "1")
(vl-cmdf "_.xref" "_unload" cName)
(vl-cmdf "_.xref" "_reload" cName)
(vl-cmdf "_.xref" "_bind" cName)
)
)
(setq cObj(tblnext "BLOCK"))
)
(princ)
(command "_.qsave")
(command "_.close")
)
0 Likes
Accepted solutions (1)
820 Views
1 Reply
Reply (1)
Message 2 of 2

john.uhden
Mentor
Mentor
Accepted solution

I don't really know, but see if a little modification helps...

 

(setq Fullname (strcat Path "\\" (getvar 'DwgName)))
(if (findfile Fullname)
  (command "_.saveas" "" Fullname "_Y")
  (command "_.saveas" "" Fullname)
)

John F. Uhden