Converting Exported DWG Layers to Layers Preset in Master Template

Converting Exported DWG Layers to Layers Preset in Master Template

Anonymous
Not applicable
631 Views
3 Replies
Message 1 of 4

Converting Exported DWG Layers to Layers Preset in Master Template

Anonymous
Not applicable

Hello Everyone,

 

First time Visitor / First Time Poster ... Thank you in advance for assistance ...

 

My Situation ...

 

I have a master template completely setup w specific Layers (and Layer Properties)

 

I use a range of design software that creates / exports out .dwg files, and those .dwg files have preset layer names from the design software. 

 

I want to copy the design software's export elements and paste them into my master template, and when I do so I want to run a LISP to automatically change the export's layers (and Layer Properties) to certain Layers in my master template. 

 

Currently, I am doing it the old school way of Match Properties, which is long and tedious.

 

I would also like to run a LISP when i am done that will purge the preset layers from the design software.

 

Can anyone assist me?

 

Thanks everyone ...

0 Likes
632 Views
3 Replies
Replies (3)
Message 2 of 4

Sea-Haven
Mentor
Mentor

You should be able to just do a change layer properties, I would use a text file a little easier to develop and add rather than a big list inside code.

 

This is an example opposite to your request it has coded program layer variable names but end user desired layer name plus color and LT.

 

1234567890123456789012345678901234567890
Newname         old name     Col Line Type
ceiling--2      ceiling--2      6   continuous
ceiling--3      ceiling--3      6   continuous
ceiling--5      ceiling--5      6   continuous
centreline--2   centreline--2   4   center    
centreline--3   centreline--3   5   center    
centreline--5   centreline--5   6   center    
const--1        const--1        1   continuous
const--3        const--3        1   continuous
dim2            dim--2          2   continuous
dim3            dim--3          2   continuous

 A bit of test code

(setq  doc (vla-get-activedocument (vlax-get-acad-object)))
(setq alllay (vla-get-layers doc))
(command "layer" "M" "red" "c" 1 "" "lt" "Dashed" "" "")
(vlax-for lay alllay
(setq layname (vla-get-name lay))
(if (= layname "red") ; do a read file here
(progn
(vla-put-name lay "GREEN")
(vla-put-color lay 6)
(vla-put-linetype lay "Continuous")
)
)
)
0 Likes
Message 3 of 4

timothy_crouse
Collaborator
Collaborator

You could use the Layer Translate Tool under CAD STANDARDS to make quick work of it.

 

After you set it up it will work as quick as any lisp, and it will be quicker to manage should you encounter new layers.

 

Look under the TOOLS menu

 

Best Regards

-Tim C.

0 Likes
Message 4 of 4

pbejse
Mentor
Mentor

@Anonymous wrote:

I want to copy the design software's export elements and paste them into my master template, and when I do so I want to run a LISP to automatically change the export's layers (and Layer Properties) to certain Layers in my master template. 

 


Are you saying the master template will change [ not ideal ] ? or a file created from the master template? or create a master tempalte after the LISP automatically change the export's layers (and Layer Properties) to certain Layers?

 

Assistance will come as long as all the information is understood, and more importantly, please post sample drawing of a "before" and "after" scenario.

 

 

0 Likes