PDA

View Full Version : xref in pspace


artur.u-s
2009-03-10, 12:04 PM
Hi,

I need a lisp to attach xref only in pscape... Will not work in modelspace...

I cant get it right ...

Here is my code ... Can someone check it...
Thanx fellers ..

(Defun checkxref ()
(if (tblsearch "layer" "P-------XREF")
(command "_layer" "s" "P-------XREF" "")
(command "_layer" "m" "P-------XREF"
"c" "7" "" "lo"
"P-------XREF" ""
)
)
)

(defun c:pscpace (/ dfil oldlay)
(setq oldlay (getvar "clayer"))
(IF (= (getvar "tilemode") 1)
(setvar "tilemode" 0)
)
(checkxref)
(setq dfil (dos_getfiled "choose file:" "" "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||"))
(if (= dfil 6)
(progn
(command "_xref" "o" dfil "0,0" "1" "1" "0" "")
(setvar "clayer" oldlay)
))(alert "Only possible in PSPACE")
)

irneb
2009-03-10, 02:25 PM
You need to save and set FILEDIA to 0, before the command call to XREF. Otherwise the dialog to browse for the file will open. Just remember to reset the FILEDIA to its old value (same as you're doing with CLAYER).

artur.u-s
2009-03-10, 02:55 PM
ok thanx


It works but I get this at the command line after executing:


Command: pscpace
Unknown command "PSCPACE". Press F1 for help.
1

here is the code:

(Defun checkxref ()
(if (tblsearch "layer" "P-------XREF")
(command "_layer" "s" "P-------XREF" "")
(command "_layer" "m" "P-------XREF"
"c" "7" "" "lo"
"P-------XREF" ""
)
)
)

(defun c:pscpace (/ dfil oldlay)
(setq oldlay (getvar "clayer"))
(setvar "cmdecho" 0)
(IF (= (getvar "tilemode") 0)

(progn
(checkxref)
(setq dfil (dos_getfiled "choose file:" "" "Drawing files (*.dwg)|*.dwg|All files (*.*)|*.*||"))
(if (= dfil 6)

(setvar "filedia" 0)
(command "_xref" "o" dfil "0,0" "1" "1" "0" "")



)
)
(alert "Only possible in PSPACE"))(setvar "clayer" oldlay)(setvar "filedia" 1)
)

Opie
2009-03-10, 03:23 PM
Remove the double quotes from the end of your _XREF line.