Jump to content

Recommended Posts

Posted

Dear all;

 

 

How to write a Macro for Merge Layers..............

 

 

^C^C_laymrg;n; next

 

 

thanks

Romano

Posted

This will merge 2 layers called "different" and "merged", the command will delete layer "different"

^C^C^C-laymrg;n;different;;n;merged;y;

Posted (edited)

Thanks steven for your response

 

i don't want this way, i can't type the layer names their

I would like to know is there any way for this

 

 

Regards

Romano

tutor.jpg

Tutor 1.jpg

Edited by Gentile Romano
space
Posted (edited)

sorry, the last image should come first.........

 

 

 

I need some can fast merge layers (this happens, when more people works with same cad file)

Ex; Layer names

1. Asphalt Edge

2. ASPHALTEDGE

3. ROAD ASPHALT EDGE

4. ROAD EDGE

5. ROAD_EDGE

6. ASPHALT-ROAD.................all these are one item

 

thanks

Romano

Edited by Gentile Romano
clearing
Posted

You cannot get a macro to work with dialogue boxes, thats one of the limitations of using a macro. So you either need to supply the names in the macro, or run the command from a toolbar/command line.

Posted

Do you work for surveyors? It looks like they need to fix their coding and layering.

 

I might not understand exactly what you want, but if you know all the possible asphalt layer names, you can write a macro that will combine them all into 1. The hyphen "-" before the command "-LAYMRG" will stop any dialog box from appearing. To me that is the best way to the macro to help you save time.

 

This one puts the first 5 from your list all into layer 6:

 

^C^C-LAYMRG;Name;"Asphalt Edge";Name;ASPHALTEDGE;Name;"ROAD ASPHALT EDGE";Name;"ROAD EDGE";Name;ROAD_EDGE;;Name;ASPHALT-ROAD;Yes;

 

To be safer you might need to create the destination layer at the beginning of the macro. Something like:

-LAYER;NEW;ASPHALT-ROAD;;

Posted

Why do you insist on using a macro when you are running full AutoCAD and could use a custom lisp routine instead? Seems counter-intuitive.

Posted (edited)

thanks yz & Remark replied to my Thread

 

before designing the road the surveyors will create existing condition cad file,

many surveyors will put there input and create it (number of surveys is depend on the area, if short time period)

many surveyors cad files will merge into one cad file, merge means copy and paste to original coordinates

(There is no standard Layer Name system)

so each project survey data (cad file) with large Nos. of layers

This survey file we use to attach as a xref to multipule dwgs as a reference

we need to change the color as per dwg wise

 

thanks you

Romano

Edited by Gentile Romano
spelling
Posted (edited)

Like Remark use a Lisp, Pick object destination layer, then pick object lay1, object lay2 etc all done. Search for a lisp that changes all objects on a layer to a new layer using ssget and layer filter is pretty easy.

(defun c:chlays ( / deslay ss sslen newlay)
(vl-load-com)
(setq deslay (cdr (assoc 8 (entget (car (entsel "\npick object destination layer")))))) 
;returns destination layer just use two lines again 
(while (setq newlay (cdr (assoc 8 (entget (car (entsel "\npick object next layer nothing to exit"))))))
(setq ss (ssget "X" (list (cons 8 newlay))))
(setq sslen (sslength ss))
(setq x 0) 
(repeat sslen
(setq obj (ssname ss x))
(setq vlobj (setq vlobj (vlax-ename->vla-object obj)))
(vla-put-layer vlobj deslay)
(setq x (+ x 1))
) ; repeat
(setq ss nil
)
) ; while
) ; defun
(c:chlays)

Edited by BIGAL

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