Jump to content

One lay different color objects so how can i change same color object to another lay


121madhu

Recommended Posts

Dimensions, invert levels both are deferent color but one layer in my dwg. I trying to change deferent layers (layer-DIM and layer-IL ) both are deferent color so can I change selective color to modify

Link to comment
Share on other sites

Three colors having this dwg. But single layer so I want change three layers as same color objects I done this job select objects manually its taking so much time. Any another way is there change layer selective color objects current layer to user defined layer

 

 

 

 

 

Thanks for your support

Link to comment
Share on other sites

What are the colors of objects that you want to change or move to another Layer ?

What's the name of the Layer which the objects should be moved to ?

Link to comment
Share on other sites

Check attached pic. Three colors (yellow, green, pink) unfortunately single layer

Yellow- invert levels

Green – coordinates

Pink- dimensions

How Can I Change by color current layer to user defined

(example:- Yellow- invert levels destination layer INVERT LEVELS

Green – coordinates destination layer COCRDINATES

Pink- dimensions destination layer DIMENSIONS).

Link to comment
Share on other sites

This ?

 

(defun c:Test (/ lst l ss i e)
 (foreach x (setq lst '((2 . "INVERT LEVELS")
                        (3 . "COORDINATES")
                        (6 . "DIMENSIONS")
                       )
            )
   (if (not (tblsearch "LAYER" (cdr x)))
     (setq l (cons (cdr x) l))
   )
 )
 (if l
   (alert
     (strcat "Layers not found in the drawing < "
             (apply 'strcat
                    (mapcar '(lambda (x) (strcat " <" x "> ")) l)
             )
             " >"
     )
   )
   (if (setq ss
              (ssget "_:L"
                     '((-4 . "<OR") (62 . 2) (62 . 3) (62 . 6) (-4 . "OR>"))
              )
       )
     (repeat (setq i (sslength ss))
       (setq e (entget (ssname ss (setq i (1- i)))))
       (foreach u lst
         (if (eq (car u) (cdr (assoc 62 e)))
           (progn
             (setq e (subst (cons 62 256) (assoc 62 e) e)
                   e (subst (cons 8 (cdr u)) (assoc 8 e) e)
             )
             (entmod e)
           )
         )
       )
     )
   )
 )
 (princ)
)

Link to comment
Share on other sites

Tharwat,

 

What about creating a selection set filtering colour, and wrapping entmod in a while statement (it's how I would go about this)? Or is using a list, repeat, and foreach generally considered preferred/proper formatting?

 

I am newer to LISP and wondering if there are "proper" and "frowned-upon" methods of addressing problems.

Link to comment
Share on other sites

Tharwat,

 

What about creating a selection set filtering colour, and wrapping entmod in a while statement (it's how I would go about this)? Or is using a list, repeat, and foreach generally considered preferred/proper formatting?

 

I am newer to LISP and wondering if there are "proper" and "frowned-upon" methods of addressing problems.

 

All the fore said functions would bring the same result since all of them iterate through selection set , and there is nothing wrong to use while function instead of repeat or foreach or even vlax-for if you have the intention to go with Visual Lisp functions .

Link to comment
Share on other sites

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