Jump to content

Recommended Posts

Posted

dear all,

i need advance layer off on freez thaw lock unlock

 

i'm using this one

please help me advance layer off & on freez

(defun c:LTT () (command "layer" "th" "*" ""))

(defun c:LFF () (command "layer" "f" "*" ""))

(defun c:Lon () (command "layer" "on" "*" ""))

(defun c:LoF () (command "layer" "off" "*" "" ""))

Posted

Here it goes,

 

(defun c:LTT () 
(command "_.-layer" "_thaw" "[color="Red"]Name of Layer[/color]" "")
(princ)
)

 

So the rest shall be as well ..... Try them.

 

Tharwat

Posted

What 'advancements' are you wanting to make?

Posted
Here it goes,

 

(defun c:LTT () 
(command "_.-layer" "_thaw" "[color=red]Name of Layer[/color]" "")
(princ)
)

 

So the rest shall be as well ..... Try them.

 

Tharwat

 

What 'advancements' are you wanting to make?

dear sir

thx for reply

yes making new lsp

Posted

(defun c:lOF ()

(setq ss (entsel "\n Select Entity Layer To Off :"))

(setq el (entget (car ss)))

(setq la (cdr (assoc 8 el)))

(command "layer" "off" la "")

(PRINC)

)

Posted

A few considerations:

 

1.

(entget nil)

will error, so better to check that the user has selected something using an IF statement perhaps.

 

2. Use

 

(command "_.-layer"...

 

To allow for language variations and to force non-dialog menu.

 

3. Localise your variables.

Posted

Another way to approach it, just as an academic exercise:

 

(defun c:lOff ( / ent def )
 ;; © Lee Mac 2010

 (if (setq ent (car (entsel)))
   (progn
     (setq def
       (entget
         (tblobjname "LAYER"
           (cdr
             (assoc 8
               (entget ent)
             )
           )
         )
       )
     )
     (entmod
       (subst
         (cons 62
           (-
             (cdr
               (assoc 62 def)
             )
           )
         )
         (assoc 62 def) def
       )
     )
   )
 )
 (princ)
)

Posted

There are some corrections to avoid the Layer dlg to appear which will break down your action ....

(defun c:lOF ()
(setq ss (entsel "\n Select Entity Layer To Off :"))
(setq el (entget (car ss)))
(setq la (cdr (assoc 8 el)))
(command "[color=Red]_.-[/color]layer" "[color=Red]_[/color]off" la "")
(PRINC)
)

 

Regards.

Tharwat

Posted

Tharwat-

(command "-layer"...
(command "layer"...

makes no difference

Posted
Tharwat-

(command "-layer"...
(command "layer"...

makes no difference

 

I believe it's just good practice to do

(command "-layer"...

try this

 

(defun c:test (/) (initdia)(command "layer" "off" "0" nil))

vs

(defun c:test (/) (initdia)(command "-layer" "off" "0" nil))

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...