Anuncios

The Autodesk Community Forums has a new look. Read more about what's changed on the Community Announcements board.

krishravi2000
317 Vistas, 1 Respuesta

Assign a layer for a command lisp

Hi guys,

I am in requirement of a lisp "When I enter a command that command result has to be shown in that layer"

For example "if I gave the command XLINE and I have a layer named XLN the Xline should automatically be assignedto the XLN layer"

Kent1Cooper
en respuesta a: krishravi2000

For some things, that is already available [read about the DIMLAYER and HPLAYER System Variables].

 

For others, you can undefine and redefine the command name:

 

(command "_.undefine" "XLINE")

(defun C:XLINE ()

  (setvar 'clayer "YourPreferredXlineLayer")

  (command "_.XLINE")

)

 

You could also have it return the current Layer to what it was before, after you finish the XLINE command:

 

(command "_.undefine" "XLINE")

(defun C:XLINE (/ lay)

  (setq lay (getvar 'clayer))

  (setvar 'clayer "YourPreferredXlineLayer")

  (command-s "_.XLINE")

  (setvar 'clayer lay)

)

 

If you sometimes have reason to draw XLINEs not on that Layer, type in the command with a period prefix:

.XLINE

to force use of the native command, not your redefinition.

Kent Cooper, AIA