Jump to content

Too many layers!!! Need to merge them!


Recommended Posts

Posted
:) Glad you got what you needed.

Not that it's the best method, but you could even put everything into a .scr file and load it.

 

I am not familiar with the .scr file type. Does that load differently than the LISP files?

I guess what I am wondering is, is one way better than the other? LISP / .scr

Posted
I am not familiar with the .scr file type. Does that load differently than the LISP files?

I guess what I am wondering is, is one way better than the other? LISP / .scr

The original file you posted was a .scr file.

Posted

Haha... Opps... Oversight sorry.... So let me better phrase my question... Your saying I can load the whole code:

(defun MergeLayers (#OldLayers #NewLayers / #Layers)
 (setq #Layers (vla-get-layers (vla-get-activedocument (vlax-get-acad-object))))
 (mapcar
   '(lambda (o n)
      (and (tblsearch "layer" o)
           (or (tblsearch "layer" n) (vla-add #Layers n))
           (vl-cmdf "_.-laymrg" "_n" o "" "_n" n "_y")
      ) ;_ and
    ) ;_ lambda
   #OldLayers
   #NewLayers
 ) ;_ mapcar
)
(MergeLayers '("A" "B" "C" "D") '("1" "2" "3" "4"))

into one .scr file and it will work the same way as loading the LISP and just calling out the line:

(MergeLayers '("A" "B" "C" "D") '("1" "2" "3" "4")) 

... Is there any benefit one way or the other? Is one quicker than the other?

  • 2 weeks later...
Posted

can you explain it to me how to work the "purgeall.scr with associated with the merge layer lisp. I was a liitle bit confused about this.

Posted
What are you trying to achieve? The same thing or just a purge?

 

Thanks for your immediate response. Praise God, for helping me, really you such a blessing for me.

Its working now, the mrglayr lisp but this is good for only one drawings, we are looking to working in the batch drawing since we are working in more than 200+ drawings.

 

What made me confused is the purge.scr how to execute the scr,

Posted

You're welcome :)

 

You could call the LISP using a script, something like:

 

open "C:\\Users\\Lee Mac\\Documents\\Drawing1.dwg" (MergeLayers) save close
open ... etc etc

 

To run the script, just go to 'Tools' > 'Run Script'. Alternatively, type 'script' at the command line.

 

Lee

Posted
Thanks for your immediate response. Praise God, for helping me, really you such a blessing for me.

Its working now, the mrglayr lisp but this is good for only one drawings, we are looking to working in the batch drawing since we are working in more than 200+ drawings.

 

What made me confused is the purge.scr how to execute the scr,

LoL

That's one hell of a praise/thank you. :)

Posted
LoL

That's one hell of a praise/thank you. :)

 

Must be the effect I have on people... o:)

Posted
Must be the effect I have on people... o:)

Must be.

 

 

 

.......

  • 9 months later...
Posted

does the bindtype variable solve this problem?

  • 13 years later...
Posted

hi Lee,

can we use wild characters for the common part of the layers : Ex. '("*-Road-*" "*-Trees-*") '("Transport" "Landscape"). So all the layers with Roads can be merged into one etc.....

Posted

You might need to write a little function to do a wildcard search on the layer names and use the results found to run the above

Posted

Using ssget filters will do what you want. Just wrap the example below with a list of layer names using (foreach la layers

 

(setq ss (ssget '((8 . "*ROADS*))))
(command "chprop" ss "" "LA" "Mynewroads" "")

 

  • Like 1

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