Aplly copy setting to all drawing in browse folder ?

Aplly copy setting to all drawing in browse folder ?

Anonymous
Not applicable
711 Views
1 Reply
Message 1 of 2

Aplly copy setting to all drawing in browse folder ?

Anonymous
Not applicable

Hi,

 

I search code

 

(vl-load-com)
(defun c:CPS (/ Adoc Layts clyt)
(setq aDoc (vla-get-activedocument (vlax-get-acad-object))
Layts (vla-get-layouts aDoc)
clyt (vla-get-activelayout aDoc)
)
(foreach
itm
(vl-remove (vla-get-name clyt) (layoutlist))
(vla-copyfrom (vla-item Layts itm) clyt)
)
(princ)
)

 

How can i aplly to multi drawing. Can someone show me code.?

Thanks.

0 Likes
712 Views
1 Reply
Reply (1)
Message 2 of 2

JustoAg
Contributor
Contributor

Hi,

I couldn't run your code because it fails at the vla-CopyFrom function with an "Automation Error. Invalid object type" msg supposedly because you're passing in a Layout Object instead of a PlotConfiguration Object as the source object according to the Reference guide.

Any way, the quick & easy method to apply a routine to all dwg in a folder is to use a Script in the form of

.OPEN C:\folder\AG01E_60.dwg (DoSomeJob) .CLOSE Y
Or similar.

You can make a list from all the dwg in a folder using the DIR *.dwg /b >list.txt, this will create a file which you can modify to want you want and save as .SCR file.

 

Hope this helps.

 

Justo Aguiar.

0 Likes