Jump to content

Recommended Posts

Posted

Hi Guys ....

 

Have a Good day

 

i need to find the selected object is on locked Layer or not

 

what is the DXF code for Locked layer ...

 

Please Help

 

:?

Posted

The lock state of the layer is stored on DXF code 70 as bit 2 (value = 4).

Posted

o need a program that find to layer is locked or not can do it for me please

 

:roll:

Posted

When you select the said object the lock/un-lock status of his layer is visible in layers pop-up list; not sure what a dedicated routine will do better than this built-in feature.

Posted
When you select the said object the lock/un-lock status of his layer is visible in layers pop-up list; not sure what a dedicated routine will do better than this built-in feature.

 

I Created a small Lisp that Works for change selected object color .......

if i select a locked objects my lisp is not working its showing error .....

so i want to filter only unlocked layer objects

 

dxf code 72 is showing 0 valuse (72. 0) .......please help

Posted
I Created a small Lisp that Works for change selected object color .......

if i select a locked objects my lisp is not working its showing error .....

so i want to filter only unlocked layer objects

 

dxf code 72 is showing 0 valuse (72. 0) .......please help

 

Please post your code.

Posted

maybe you can use this:

 

(setq L (tblnext "layer" T))
(while L
 (if (/= 4 (logand 4 (cdr (assoc 70 L))))
   (progn
     ;;; your stuff here ;;;
   )
 )
 (setq L (tblnext "layer"))
)

Posted
maybe you can use this:

 

(setq L (tblnext "layer" T))
(while L
 (if (/= 4 (logand 4 (cdr (assoc 70 L))))
   (progn
     ;;; your stuff here ;;;
   )
 )
 (setq L (tblnext "layer"))
)

 

 

Look, we're trying to help you... The code you posted does not do any this:

 

I Created a small Lisp that Works for change selected object color .......

if i select a locked objects my lisp is not working its showing error .....

so i want to filter only unlocked layer objects

 

dxf code 72 is showing 0 valuse (72. 0) .......please help

 

... So, maybe you can post the code you're having trouble with instead? :)

Posted
Look, we're trying to help you... The code you posted does not do any this:

 

 

 

... So, maybe you can post the code you're having trouble with instead? :)

 

eeh, I'm trying to help the OP??

Posted


(defun c:ccl ()
 (prompt "\nSelect Object(s) To Change Color")
 (if (setq sset (ssget))
   (progn
     (if (setq nwcol (getint "\nEnter New Color:"))
(progn
  (setq cntr 0)
  (repeat (setq len (sslength sset))
    (setq ssnm (ssname sset cntr))
    (setq ent (entget ssnm))
    (if	(= (cdr (assoc 62 ent)) nil)
      (command "chprop" sset "" "c" nwcol "")
      (progn
	(entmod (subst (cons 62 nwcol) (assoc 62 ent) ent))
	(princ)
	(setq cntr (1+ cntr))(princ)

      )
    )
  )
)
     )
   )
 )(princ)
)

Posted
eeh, I'm trying to help the OP??

 

:rofl:

 

My mistake... I posted too quickly. Sorry for MY confusion. :oops:

Posted

Command: ccl

Select Object(s) To Change Color

Select objects: Specify opposite corner: 1 found

Select objects:

Enter New Color:2

Unknown command "C". Press F1 for help.

2

Unknown command "CCL". Press F1 for help.

Posted

This will do the trick:

 

(defun c:ccl ()
 (prompt "\nSelect Object(s) To Change Color")
 (if (setq sset (ssget))
   (progn
     (if (setq nwcol (getint "\nEnter New Color:"))
(progn
  (setq cntr 0)
  (repeat (setq len (sslength sset))
    (setq ssnm (ssname sset cntr))
    (setq ent (entget ssnm))
    (and
      (/= 4 (logand 4 (cdr (assoc 70 (tblsearch "LAYER" (cdr (assoc 8 ent)))))))
      (= (cdr (assoc 62 ent)) nil)
      (progn
	(command "chprop" sset "" "c" nwcol "")
	(entmod (subst (cons 62 nwcol) (assoc 62 ent) ent))
	(princ)
	(setq cntr (1+ cntr))(princ)
      )
    )
  )
)
     )
   )
 ) (princ)
)

Posted
(defun c:CCL () (c:ChangeColor))
(defun c:ChangeColor  (/ *error*)
 (vl-load-com)
 (princ "\rCHANGECOLOR ")

 (defun *error*  (msg)
   (and oldNomutt (setvar 'nomutt oldNomutt))
   (if acDoc (vla-endundomark acDoc))
   (cond ((not msg))                                                   ; Normal exit
         ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
         ((princ (strcat "\n** Error: " msg " ** "))))                 ; Fatal error, display it
   (princ))

 ((lambda (acDoc oldNomutt / ss color)
    (vla-startundomark acDoc)
    (if (and (princ "\nSelect Object(s) To Change Color: ")
             (setvar 'nomutt 1)
             (setq ss (ssget [color=red]"_:L"[/color]))
             (princ "\nSpecify a new object color: ")
             (setq color
                    (acad_colordlg
                      (cond
                        ((= "BYLAYER" (setq color (getvar 'cecolor)))
                         1)
                        ((atoi color)))
                      nil)))
      (progn
        (vlax-for x (setq ss (vla-get-activeselectionset acDoc))
          (vla-put-color x color))
        (vla-delete ss)
        (*error* nil))
      (cond (ss (*error* "No color selected"))
            ((*error* "Nothing selected")))))
   (vla-get-activedocument (vlax-get-acad-object))
   (getvar 'nomutt)))

Posted

wow !!! its working perfectly ...than you and hugs hemuni

is there any option to show which layer is locked ...hmmmm

Posted
(defun c:CCL () (c:ChangeColor))
(defun c:ChangeColor  (/ *error*)
 (vl-load-com)
 (princ "\rCHANGECOLOR ")

 (defun *error*  (msg)
   (and oldNomutt (setvar 'nomutt oldNomutt))
   (if acDoc (vla-endundomark acDoc))
   (cond ((not msg))                                                   ; Normal exit
         ((member msg '("Function cancelled" "quit / exit abort")))    ; <esc> or (quit)
         ((princ (strcat "\n** Error: " msg " ** "))))                 ; Fatal error, display it
   (princ))

 ((lambda (acDoc oldNomutt / ss color)
    (vla-startundomark acDoc)
    (if (and (princ "\nSelect Object(s) To Change Color: ")
             (setvar 'nomutt 1)
             (setq ss (ssget "_:L"))
             (princ "\nSpecify a new object color: ")
             (setq color
                    (acad_colordlg
                      (cond
                        ((= "BYLAYER" (setq color (getvar 'cecolor)))
                         1)
                        ((atoi color)))
                      nil)))
      (progn
        (vlax-for x (setq ss (vla-get-activeselectionset acDoc))
          (vla-put-color x color))
        (vla-delete ss)
        (*error* nil))
      (cond (ss (*error* "No color selected"))
            ((*error* "Nothing selected")))))
   (vla-get-activedocument (vlax-get-acad-object))
   (getvar 'nomutt)))

 

Renderman that was awesome code editing by you .........

 

now i got what i exactly need ...its filtering only unlocked layer objects

 

:D:D:D:D

Posted
Renderman that was awesome code editing by you .........

 

now i got what i exactly need ...its filtering only unlocked layer objects

 

:D:D:D:D

 

That is kind of you to say; happy to help. :)

Posted

So, finally you were looking for a way to filter out items in locked layers from your selection - may be useful for you to check this post for more information on SSGET filters.

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