Community
AutoCAD Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AutoCAD - Copying VP from one drawing to another retaining layer state properties

17 REPLIES 17
Reply
Message 1 of 18
jwagner
5448 Views, 17 Replies

AutoCAD - Copying VP from one drawing to another retaining layer state properties

I am working with ACAD 2016. 

 

I am trying to copy a viewport with frozen VP layer states (about 100 of 500 layers have frozen VP attributes) from one drawing layout to another layout in a different drawing. When I copy the viewport and paste it into the new layout it does not retain the layer state properties. I tried using the MATCHPROP command but that did not work. 

 

 

Any suggestions? There has got to be an easy way to do this... 

 

[ The subject line of this post has been edited for clarity by @handjonathan Original: Copying VP from one drawing to another retaining layer state properties ]

17 REPLIES 17
Message 2 of 18
mikeevans6697
in reply to: jwagner

One way to do this: double click inside your viewport in the source drawing.

 

type in LAYERSTATE, NEW and give it a name, then export the layer state to a .LAS file.

 

Copy and paste the viewport in the new drawing, type in LAYERSTATE and import the LAS file you saved.

 

Mike

Message 3 of 18
jwagner
in reply to: mikeevans6697

Mike,

 

Thanks for the quick reply... I tried what you suggested and it is not working correctly. It does not restore the states of the VP frozen layers.

 

 

More info:

 

I have a dwg from an architect that has phasing plans and a final plan all on one dwg. Each layout has a viewport with certain layers frozen depending on the phase on that sheet. I only need the final phase in my drawing so I have XREFed the architect's drawing into my drawing file. Then copied the viewport from the final phase layout into my drawing layout. I saved the layerstate from the viewport in the arch's drawing and restored it to the viewport in the new drawing. but i cannot get it to VP freeze the same layers from the viewport in each drawing. 

 

Any other suggestions?

Message 4 of 18
Neil47
in reply to: jwagner

Just confirming that the layer state is set to frozen for both the VP Freeze and New VP Freeze. Copying a view port does not carry over the VP Feeze but does carry over the New VP Freeze settings.  To make it easy you can sort the layers based on the VP Freeze settings then set to frozen the layers for New VP Freeze before copying the viewport

Message 5 of 18
ВeekeeCZ
in reply to: jwagner

Try this modified routine, originally made by Jeff Mishler. 

Instructions inside.

 

Edit 22-03-05: The code updated.

Message 6 of 18
jggerth
in reply to: jwagner

I have not tried this, but IIRC if you make a BLOCK out of the viewport, and copy that to a new layout, it will copy with the same layer settings.

 

I would presume that all layers/xref layers would have to exist in the target drawing _first_.

Message 7 of 18
Anonymous
in reply to: jggerth


@jggerth wrote:

I have not tried this, but IIRC if you make a BLOCK out of the viewport, and copy that to a new layout, it will copy with the same layer settings.

 

I would presume that all layers/xref layers would have to exist in the target drawing _first_.


Yea this works. It's the best solution I've found so far.

Message 8 of 18
J_Spurgeon
in reply to: ВeekeeCZ


@ВeekeeCZ wrote:

Try this modified routine, originally made by Jeff Mishler. 

Instructions inside.



I know this is really outdated, but I have tried getting this to work with no luck.

Is there something that could cause issues in newer versions of AutoCAD? (I am on 2022)

 

It would be super useful if I can get it to work since I have to make title sheets that I VPfreeze a ton of layers on in existing dwgs.

 

Message 9 of 18
pendean
in reply to: J_Spurgeon

@J_Spurgeon what part of the LISP does not work exactly? Explain, elaborate.

Message #6 always works, even in R2022.1.2 here.
Message 10 of 18
J_Spurgeon
in reply to: pendean

When I go to do the VPV (view port paste) portion of the routine it errors out with "; error: too few arguments". I added an alert to make sure the "vpc" command was running all the way through and checked it was storing its variables, but the variables are coming back nil
Message 11 of 18
cadffm
in reply to: J_Spurgeon

Not your fail, there is a bug in VPV, but simple to fix for you:

 

Open the .lsp, go the the second line of c:VPV and change this:

from

(setq laylist (vl-bb-set 'vpc_laylist))

to

(setq laylist (vl-bb-ref 'vpc_laylist))

Sebastian

EESignature

Message 12 of 18
ВeekeeCZ
in reply to: cadffm


@cadffm wrote:

Not your fail, there is a bug in VPV, but simple to fix for you:

 

Open the .lsp, go the the second line of c:VPV and change this:

from

(setq laylist (vl-bb-set 'vpc_laylist))

to

(setq laylist (vl-bb-ref 'vpc_laylist))


Thanks. Fixed and updated the original reply.

Message 13 of 18
J_Spurgeon
in reply to: cadffm

That fix worked perfectly! Thank you

Message 14 of 18
michaelZCXYL
in reply to: cadffm

Hello, it is very useful. But I tried it, it did not work. I loaded lisp at source file,  run command VPC. And then, loaded it in the target file, run vpv. It did not work. Please see the image below. Could you please provide your advice to me? Thank you very much in advance,

 

michaelZCXYL_0-1668564355022.png

 

Message 15 of 18
cadffm
in reply to: michaelZCXYL

I guess in your target file are not all source-file layers available,

right?

 

This Lisp is just a simple sample of how a program extension can do the job,

use it for free without claim to support and flawless (BTN = BetterThanNothing).

 

The Code above is

- not ready for international versions (but you are using english version)

- working if ALL source-layers are also present in the target file (i guess that is the problem in your case?)

- ....

 

I won't to rewrite the whole tool, but I tried to fix these both issues, try this Version 2022/11 <attached>

 

Still a problem? Share your source&target DWG (and a second Screenshot with more commandlines visible [F2])

 
 

 

 

Sebastian

EESignature

Message 16 of 18
michaelZCXYL
in reply to: cadffm

Thank you so much for your quick response.  I am tied up right now, I will try it later and let you know the result, thanks again. 🙂

Message 17 of 18
michaelZCXYL
in reply to: michaelZCXYL

Hello, I tested it, it work well. Great job!  🙂

Message 18 of 18
michaelZCXYL
in reply to: cadffm

Hello, I tested it, it work well. Great job! Thank you so much! I have another situation. If some layers freeze in viewport, is it possible to turn them off or freeze them as well, thanks again. 

michaelZCXYL_0-1669005717692.png

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


AutoCAD Beta