Jump to content

Modification in lisp. Toggling Layers visibility state (On one layer and Off remaining layers)


Recommended Posts

Posted

I have a lisp code that can turn on one layer at once and remaining will be in off state.

(defun c:NL()

                (if (= lay nil) (setq num 0))

                (setq entlay (tblnext "layer" num))

                (setq lay (cdr (assoc 2 entlay)))

                (command "layer" "s" lay "off" "*" "" "")

                (setq num nil))

 

But I need modification as below that

The lisp should ask which layers to be on continuously on visible state and which layers to be toggles their visibility.

Suppose we have cad layers as below:

Archi-wall

Archi-window

Archi-Floor

Elect-Lights

Elect-Cables

Elect-Equipments.

The lisp should ask 2 queries for user input as follows:

1.Please give string which layers not to be toggled:

2.Please give string which layers to be toggled:

If I give user input as “Arch” as string for first query then all Archi-* layers to be continuously shown and if I give “Elect” as a string for second query then all Elect-* layers to be toggled their visiblity

Thanks,

T.Brahmanandam

Posted

Hi there.

There are some things that I don't quite understand.

Why would you want to be asked to provide a string for layers not to be toggled to start with, if it is to than ask for a string for layers to be toggled? (ie: if you want to toggle Elect*, toggling *Elect doesn't implicitly also indicate to not toggle ARCH*? It feels like asking someone where they don't want to go before asking them for their destination...). It also could behave annoyingly; Let's say you have 1 layer on, "elect-cable", and everything else is off. Toggling "Elect*" would make you end up with elect-light/elect-equip on, but would also turn off "elect-cable".

Do you know the native command Laywalk? it seems it would be way more practical than the requested lisp. You start with a dialog with the current on/off state for each layer, and can toggle them independently using control+selecting them. It can also be used with keywords, ie you type Elect*, then enter, all Elect will be turned on. By then unchecking the filter checbox, all elect* will remain on (selected), and the other layers will appear in the list (unselected, so still in an off state).  Using control+mouse selection you can toggle them independently. I use laywalk/layiso/layon a lot, and never felt the need to make any lisp to control on/off state. Give it a try, if it doesn'T suit your need, let me know why, i'll see what I can do. If it does suit your needs, please mark this answer accordingly.

Cheers

Posted

You can run layer from the command line 

 

-la off ARCH* on Elect* F asdf-1* etc 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...