lisp to automatically set a predefined layer current
lisp to automatically set a predefined layer current
(OP)
i have created a XREF layer in our template and here's my plan:
instead of asking people to remember to set the XREF layer current before xref-ing drawings in, i would like to automate this with a lisp, so that, every time someone types xr or xref in the command line, the lisp would trigger and automatically set the XREF layer in the drawing current. this is in reason that i have seen a lot of situations where the xref drawing was brought in with the viewport or defpoints layer active and people go crazy trying to figure out why the xref does not plot or show up in plot preview. i would really appreciate if someone has a lisp handy to do this trick can pass it on. also, a little direction to how/where to put it so that it loads automatically would be of great help as well.also, along the same lines, is there a setting i can change in civil 3D so that the xref is not fixed path by default? i would like to make the xref operation as relative path by default.
regards...
instead of asking people to remember to set the XREF layer current before xref-ing drawings in, i would like to automate this with a lisp, so that, every time someone types xr or xref in the command line, the lisp would trigger and automatically set the XREF layer in the drawing current. this is in reason that i have seen a lot of situations where the xref drawing was brought in with the viewport or defpoints layer active and people go crazy trying to figure out why the xref does not plot or show up in plot preview. i would really appreciate if someone has a lisp handy to do this trick can pass it on. also, a little direction to how/where to put it so that it loads automatically would be of great help as well.also, along the same lines, is there a setting i can change in civil 3D so that the xref is not fixed path by default? i would like to make the xref operation as relative path by default.
regards...





RE: lisp to automatically set a predefined layer current
Make sure Acad.lsp is loaded into every drawing (set ACADLSPASDOC=1)
The lisp you are looking for will be similar to:
( DEFUN C:XR ()
(SETQ CURRENTLAYER (GETVAR "CLAYER"))
(SETVAR "CLAYER" "XREF")
(COMMAND "XATTACH" "XREFNAME" "" "")
(SETVAR "CLAYER" CURRENTLAYER)
)
You will probably want to add code to check for the existence of the XREF layer etc.
RE: lisp to automatically set a predefined layer current
http://dis
RE: lisp to automatically set a predefined layer current
RE: lisp to automatically set a predefined layer current
For example:
DEFUN C:XR DEfines a new Function that is permenant by virtue of the "C:" and is called XR.
The SETQ defines a local varibvle I called "CURRENTLAYER" and sets it's value to the current layer name, to be used later.
The SETVAR line changes an AUTOCAD variable CLAYER (Current Layer) to "XREF", which works only if it exists, that is.
The COMMAND line executes an AUTOCAD command just as if you typed it on the command line, in this case "XATTACH" which is the same as attaching an xref from a fancy dialog box...
The final SETVAR sets the CLAYER (current layer) back to what it was before we started this program.
The more you know, the better able you are to propel yourself forward!!
Good luck (never give up / never surrender!!!)
RE: lisp to automatically set a predefined layer current
RE: lisp to automatically set a predefined layer current
ht
http://www.afralisp.net/lispa/lisp46.htm