copy vports command

Andreas Vasiliou

Usenet Archive
Joined
Dec 18, 2003
Messages
7
Reaction score
0
Anyone know how to copy a vieport from one layout in the same dwg to another and yet retain all layer settings etc... for that viewport?
 
Have you tried cut and paste? After the cut and paste, turn the viewport on with mview on.

Works for me on 2004.
 
This method doesn't save the layer status of the viewport. There is a topic in the AUTOCAD2004 group on the very same thing. The only layer which it does save is Layer 0. May have to try entmake/entmod.

Dean
 
This works for circles, lines etc. but not on vports? (assuming orig ents not on Layout2)

(defun c:xx (/sset ent new_list entdata)
(setq sset (ssget))
(setq ent (ssname sset 0))
(while ent
(setq entdata (entget ent))
(terpri)
(princ(setq new_list (subst (cons 410 "Layout2") (assoc 410 entdata) entdata))) (terpri) (entmake new_list) (ssdel ent sset)
(setq ent (ssname sset 0))

)
)
 
I have been using that method as well - even as far back as R14 - I would literally make a wblock out of the vport and insert it into another dwg, then explode it (the block) and turn the vport on. Saved layer vis status as far as vplayer type items.
Jeff
 
Thanks guys. The Mview on thing goes some way in helping. It doesn't save the -vplayer settings though. It is to be used in LT so there is no lisp any how.

I tried it in LT 2004 as well and same thing.

If anyone knows a way of saving the layer states in lisp then this will be handy for when in full acad.

Thanks again

Andreas
 
Andreas,

Guess I must have been wrong. I tried it before I posted and it appeared to work. Oh well. It is relatively easy to create a block containing the viewport and then to insert the viewport back into any other layout, explode it, and turn it back on. That will retain the layer settings. I have tested this and it does work in 2004.

Regards,
Doug
 
I just tried it in R2004 LT and doesn't work. Have you been using full Acad?

I also have inserted the vport block back into the SAME dwg. Have you done this as well?

Let me know.

Andreas
 
This doesn't work. Its that same as copy/clip. The viewport is copied, but the layer states are not.
 
This doesn't work. Its that same as copy/clip. The viewport is copied, but the layer states are not.
 
Adreas,
I am using AutoCAD 2004 with Architectural Desktop, Service Pack 2 and the toolpalette extension. I have no way of knowing whether this has any effect because I don't have LT.

I attach a command log to exlain: (Parenthetical comments)

(create the block in layout IIIL)
Command: -block

Enter block name or [?]: junk
Specify insertion base point: 0,0

Select objects: 1 found (a viewport)

Select objects:
Command: *Cancel*

Command: *Cancel*

(switch layouts)
Command: <Switching to: IIIP>
Regenerating layout.

Command: -insert
Enter block name or [?]: junk
Specify insertion point or [Scale/X/Y/Z/Rotate/PScale/PX/PY/PZ/PRotate]: 0,0

Enter X scale factor, specify opposite corner, or [Corner/XYZ] <1>:
Enter Y scale factor <use X scale factor>:
Specify rotation angle <0>:

Command: explode

Select objects: 1 found (the junk block)

Select objects:
Command: mview

Specify corner of viewport or
[ON/OFF/Fit/Shadeplot/Lock/Object/Polygonal/Restore/2/3/4] <Fit>: on

Select objects: all
111 found
108 were not a viewport.
1 was not in current space.
1 was the paper space viewport.

Select objects:
Regenerating model.

(obtain the xdata for the new viewport)
Command: (cdr(assoc -3 (entget(entlast) '("*"))))
(("ACAD" (1000 . "MVIEW") (1002 . "{") (1070 . 16) (1010 0.0 0.0 0.0) (1010 0.0
0.0 1.0) (1040 . 0.0) (1040 . 185.419) (1040 . 68.8675) (1040 . -4.69425) (1040 .. 50.0) (1040 . 0.0) (1040 . 0.0) (1070 . 0) (1070 . 10000) (1070 . 1) (1070 .
3) (1070 . 0) (1070 . 0) (1070 . 0) (1070 . 0) (1040 . 0.0) (1040 . 0.0) (1040 .. 0.0) (1040 . 0.5) (1040 . 0.5) (1040 . 0.5) (1040 . 0.5) (1070 . 0) (1002 . "{") (1003 . "dim") (1002 . "}") (1002 . "}")))

(go back to the previous layout)
Command: <Switching to: IIIL> (here I switch layouts back to original)
Regenerating layout.

(unerase the old viewport)
Command: oops
Regenerating model.

(obtain the xdata for the old viewport)
Command: (cdr(assoc -3 (entget(entlast) '("*"))))
(("ACAD" (1000 . "MVIEW") (1002 . "{") (1070 . 16) (1010 0.0 0.0 0.0) (1010 0.0
0.0 1.0) (1040 . 0.0) (1040 . 185.419) (1040 . 68.8675) (1040 . -4.69425) (1040 .. 50.0) (1040 . 0.0) (1040 . 0.0) (1070 . 0) (1070 . 10000) (1070 . 1) (1070 .
3) (1070 . 0) (1070 . 0) (1070 . 0) (1070 . 0) (1040 . 0.0) (1040 . 0.0) (1040 .. 0.0) (1040 . 0.5) (1040 . 0.5) (1040 . 0.5) (1040 . 0.5) (1070 . 0) (1002 . "{") (1003 . "dim") (1002 . "}") (1002 . "}")))

The results indicate that the new viewport, created in another layout has the same Xdata (layer settings) as the original. I don't know how else to demonstrate this. I also have a program that does this and it works fine. I used -block and -insert because they report on the command line but block and insert also work fine.

It is quite possible that LT and ACAD are somehow fundamentally different but this is something I can't test.

Sorry it didn't work for you Andreas. Perhaps someone more familiar with LT can help.

Regards,
Doug

Andreas Vasiliou said:
I just tried it in R2004 LT and doesn't work. Have you been using full Acad?

I also have inserted the vport block back into the SAME dwg. Have you done this as well?

Let me know.

Andreas
<snip>
 

Member Recommended

Latest threads

Back
Top