Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why is this lisp switching off my dynamic input???

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
484 Views, 3 Replies

Why is this lisp switching off my dynamic input???

Hi,

Could anybody tell me why this LISP is switching off the dynamic input?

We are using the AutoCAD 2009 platform.

;;;=== START OF CODE===

(defun C:LAYSON( / acadDocument theLayers)
(command "layer" "_u" "*")
(command "ON" "*")
(command)
)

;;;===END OF CODE===

I could of coarse rewrite the LISP to say the following:

;;;=== START OF CODE===

(defun C:LAYSON( / acadDocument theLayers)
(command "layer" "_u" "*")
(command "ON" "*")
(command)
(command “DYNMODE” “3”)
)

;;;===END OF CODE===

But this would be a walk around (which I'm trying to avoid, in order to keep my LISPS clean and structured).

Thanks-
3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: Anonymous

nothing in your code has any effect for turning off your dynmode
maybe there is another program that you are running that is doing it?



wrote in message news:6276008@discussion.autodesk.com...
Hi,

Could anybody tell me why this LISP is switching off the dynamic input?

We are using the AutoCAD 2009 platform.

;;;=== START OF CODE===

(defun C:LAYSON( / acadDocument theLayers)
(command "layer" "_u" "*")
(command "ON" "*")
(command)
)

;;;===END OF CODE===

I could of coarse rewrite the LISP to say the following:

;;;=== START OF CODE===

(defun C:LAYSON( / acadDocument theLayers)
(command "layer" "_u" "*")
(command "ON" "*")
(command)
(command "DYNMODE" "3")
)

;;;===END OF CODE===

But this would be a walk around (which I'm trying to avoid, in order to keep
my LISPS clean and structured).

Thanks-
Message 3 of 4
Kent1Cooper
in reply to: Anonymous

I don't have a new-enough version to have DYNMODE, but:

Could it be that your Layer command is redefined somehow [it is in ADT2004], and that something in the redefinition is doing it? If so, you can force it to use the "native" non-redefined original form of the command, with a preceding period/decimal. [And you can combine all of that into one layer command in one (command) function.]

(defun C:LAYSON ()
(command "_.layer" "_u" "*" "_on" "*" "")
)

--
Kent Cooper
Kent Cooper, AIA
Message 4 of 4
Anonymous
in reply to: Anonymous

Simple answer: it isn't. There's nothing in the three lines that would do it. I checked in C3D2009 and DYNMODE was still 3.

I noticed you have two local variables that aren't used in the code - does that mean that you trimmed the code down before posting it? If so then the problem could lie there.

Try tidying your code to (command "_layer" "_u" "*" "_on" "*" "") rather than having all those (command) commands. ["clean and structured"]

If the problem persists try:

(defun C:LAYSON( / DYNMODE_old)
(setq DYNMODE_old (getvar "DYNMODE"))
(command "_layer" "_u" "*" "_on" "*" "")
(setvar "DYNMODE" DYNMODE_old)
(princ)
)

This code takes the existing DYNMODE value (which may not be 3) and returns it at the end, rather than forcing it to be 3. You could adopt this method for FILEDIA, OSMODE, etc., and to keep it C&S you could place this in a routine of it's own so you just call (SB_start) and (SB_end) for each of your other routines.

S

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report