Jump to content

Recommended Posts

Posted

Any idea have to change one layer to another layer any one color objects

 

 

color_change.jpg

Posted

What is the name of the source layer you want to select its objects on different colors and whats the name of the target layer name ?

Posted

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

Posted (edited)

I can't get what you want to do with your poor explanation

Edited by Tharwat
Posted

I would use quick select (qselect).

Posted

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

Posted

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 ?

Posted

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

Posted

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

Posted
Tharwat

 

i want learn lisp

please help me

 

Did the code work for you as you have asked for ?

Posted

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.

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

Posted

Thank you, Tharwat. Much appreciated.

Posted
Thank you, Tharwat. Much appreciated.

 

You're welcome anytime . :thumbsup:

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