Lisp to change 2004 Wblock to R2000. Please help

MikeNowson

Usenet Archive
Joined
Jan 26, 2004
Messages
2
Reaction score
0
Hello,
I am trying to wblock out part of a drawing and have a routine which automatically resaves the file as V2000. Surely this can not be hard but as I have limited lisp skills I am stuck. Any help would be great.

(if (findfile dwgnm)
(command "wblock" dwgnm "y" "" '(0 0 0) ss "" "oops") (command "wblock" dwgnm "" '(0 0 0) ss "" "oops") (command "filedia" "0") (if (findfile dwgnm) (progn (command "qsave")(command "open" dwgnm))
)

(COMMAND "saveas" "2000" dwgnm "y")
(command "filedia" "1")
)

This obiously does not work as the drawing will not open as I can not work out the syntax...

Thanks
Mike Nowson

PS I would rather not have to close the current drawing that I am wblocking from is that possible. Ie to open another file without closing the active file?
 
have you try the command SDI
this is single drawing interface is set to 1
then the command open is available
 
Try this one:

(setvar "SDI" 0)
;;
(if (findfile dwgnm)
(command "wblock" dwgnm "y" "" '(0 0 0) ss "" "oops")
(command "wblock" dwgnm "" '(0 0 0) ss "" "oops")
);eif
(command "filedia" "0")
(if (findfile dwgnm)
(progn
(command "_qsave")
(command ".open" dwgnm)
(command ".saveas" "2000" dwgnm "y")
);epr
);eif
;;
(command "filedia" "1")

Bob
 
two issues here

1 - if the user didn't specify DWG (which most users won't do) as part of dwgnm, then findfile WON'T find the file--even if it DOES exist. 2 - it could be simplified by putting the if statement inside the command call

Try changing from:

(if (findfile dwgnm)
(command "wblock" dwgnm "y" "" '(0 0 0) ss "" "oops")
(command "wblock" dwgnm "" '(0 0 0) ss "" "oops")
);eif

To this:

;if the user did NOT specify dwg as part of dwgnm then add it (if (wcmatch (strcase dwgnm) (strcase "*.dwg"))(setq dwgnm (strcat dwgnm "*.dwg"))

;if dwgnm is found then you need to pass a "Yes" to over-write the file other wise just tell acad to continue. (command "wblock" dwgnm (if (findfile dwgnm) "y" "") "" '(0 0 0) ss "" "oops")
 
Hello,
I am still having trouble with the open command...I am in Multiple drawing mode I try:

(command (open dwgnm "w"))

or When I try the actual file path:

(command (open "Z:/exchange/!miken.dwg" "w"))

The open command is processed but the path fails as unrecognised which is strange as Saveas executes with no problem:
;;(command "SaveAs" "2000" dwgnm "y")

I am confused and can not work out this command...any helpwould be great

Regards
Mike Nowson
 

Latest threads

Back
Top