Author Topic: copy and paste viewports not working  (Read 9155 times)

0 Members and 1 Guest are viewing this topic.

ELOQUINTET

  • Guest
copy and paste viewports not working
« on: June 16, 2004, 09:52:02 AM »
someone asked me a question that i didn't have the answer to so i'll ask you guys. i showed him how to copy and paste viewports from one layout to another then turn mv on. when he tries to copy another he gets the original. how can he do another?

SMadsen

  • Guest
copy and paste viewports not working
« Reply #1 on: June 16, 2004, 10:53:23 AM »
You mean by copy and paste? It is possible that he did a cut'n'paste instead?

ELOQUINTET

  • Guest
copy and paste viewports not working
« Reply #2 on: June 16, 2004, 11:33:42 AM »
i try it and it works fine on my machine. this is exactly what he did. he hit control c then went to another layout and control v. it pastes the viewport fine then he turns it on. he goes to another layout and performs the same operation but when he pastes it it is the original copy not his most recent one. also is there a setting to retain layers that are frozen within a viewport? i know there must be but don't have time to research right now. :evil:

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
copy and paste viewports not working
« Reply #3 on: June 16, 2004, 12:21:35 PM »
Quote
he hit control c then went to another layout and control v. it pastes the viewport fine then he turns it on. he goes to another layout and performs the same operation but when he pastes it it is the original copy not his most recent one.

Hmmm, original or copy of the original....they will be the same so how does he know which one is used in the last paste? Something is missing in the description me thinks.....

Quote
also is there a setting to retain layers that are frozen within a viewport?

No there isn't. However I've written a pair of small lisp routines that will save the vp layers state and then restore them to selected viewports. I will post them if desired.

Jeff

ELOQUINTET

  • Guest
copy and paste viewports not working
« Reply #4 on: June 16, 2004, 12:44:22 PM »
he does a second control c but when he goes to paste that one he gets the first one instead of the second, does that clarify what i mean? never thought it would be that hard to explain sheesh. if you could post your lisps that would be most excellent thanks  :wink:

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
copy and paste viewports not working
« Reply #5 on: June 16, 2004, 12:54:26 PM »
Quote from: Jeff Mishler
I've written a pair of small lisp routines that will save the vp layers state and then restore them to selected viewports. I will post them if desired.


I could use something like that.
One of the folks here asked me to cook one up, I say why re-invent the wheel.
I'll take one Jeff.
I drink beer and I know things....

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
copy and paste viewports not working
« Reply #6 on: June 16, 2004, 01:57:32 PM »
Jeff,
I would like to see the lisp as well.

Here is one by John Uhden

It is limited to staying within the layout tab. I have the commented version if anyone is interested.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
copy and paste viewports not working
« Reply #7 on: June 16, 2004, 02:19:29 PM »
Hera ya all go! It WILL work from one layout tab to another.

Enjoy!  8)

Code: [Select]
;| Functions to copy, and later place, the vpfrozen layers from one
   paperspace viewport to another. Works with both standard and
   polygonal viewports.
   This was created for use in one drawing at a time! The layers
   obtained with the copy vplayers function are not saved for use
   in another drawing or even another editing session.

   Command: copyvplayers - creates the variable "laylist", if you
   think that the routine isn't working, check the value of this
   variable at the command line like this: Command: !laylist
   If this returns nil then the list hasn't been saved.

   Command: putvplayers - freezes the layers obtained with
   copyvplayers in the selected viewport. If you want the 2 viewports
   to match exactly, make sure to reset the layers in the target
   viewport first.

   (c) Jeff Mishler, June 2003 - Updated Jan. 2004 to work with Acad2004.
 |;

(defun c:copyvplayers (/ obj)
  (if (setq obj
    (entsel "\nSelect viewport to save layer data for: "))
    (progn
      (setq obj (entget (car obj))
   laylist nil)
      (if (and
   (= (cdr (assoc 0 obj)) "LWPOLYLINE")
   (setq vptest (member '(102 . "{ACAD_REACTORS") obj))
   (setq vptest (member '(102 . "}") (reverse vptest)))
   (assoc 330 vptest)
   )
(setq obj (entget (cdr (assoc 330 vptest))))
)      
      (if (and
   (= (cdr (assoc 0 obj)) "VIEWPORT")
   (setq objlist
  (cdr (car (cdr (assoc -3
 (entget
   (cdr
     (assoc -1 obj))(list "acad")))))))
   (assoc 1003 objlist)
   )
(progn
 (foreach x objlist
   (if (= (car x) 1003)
     (setq laylist (cons (cdr x) laylist))
     )
   )
 (setq laylist (reverse laylist))
 )
(princ
 (strcat "\nInvalid Viewport entity {"
 (cdr (assoc 0 obj))
        "} selected, or VP has no frozen layers, try again..."))
)
      )    
    )
  (princ)
  )

(defun c:putvplayers (/ tempstr int smallstr vpent)
  (if laylist
    (progn
      (setq tempstr "")
      (foreach x laylist
(setq tempstr (strcat tempstr x ","))
)
      (setq tempstr (substr tempstr 1 (- (strlen tempstr) 1)))
      (setq oldecho (getvar "cmdecho"))
      (setvar "cmdecho" 0)
      (command "_undo" "_be")
      (while (not vpent)
(setq vpent (entsel "\nSelect Viewport object: "))
)
      (setq vpent (car vpent))
      (while (> (strlen tempstr) 256)
(setq smallstr (substr tempstr 1 256))
(setq int (vl-string-position (ascii ",") smallstr 0 t))
(setq smallstr (substr smallstr 1 int)
     tempstr (substr tempstr (+ int 1))
     )
(command "vplayer" "f" smallstr "s" vpent "" "")
)
      (command "vplayer" "f" tempstr "s" vpent "" "")
      (command "_undo" "_end")
      (setvar "cmdecho" oldecho)
      );progn
    );if
  (princ)
  )

ELOQUINTET

  • Guest
copy and paste viewports not working
« Reply #8 on: June 16, 2004, 02:58:00 PM »
forgive my ignorance but what do i type in. i tried copy_vplayer but it's not doing anything?

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
copy and paste viewports not working
« Reply #9 on: June 16, 2004, 03:02:38 PM »
If you think it didn't do anything, it probably did. From the header for the lisp, try typing "!laylist" at the command line. If anything other than nil is displayed, it worked. Then you need to run the "putvplayers" command to change another viewport to match the first one.

Jeff

ELOQUINTET

  • Guest
copy and paste viewports not working
« Reply #10 on: June 16, 2004, 03:07:17 PM »
ah i figured it out but i changed copy_vplayers to cvpl and putvplayers to pvpl  :wink:

ELOQUINTET

  • Guest
copy and paste viewports not working
« Reply #11 on: June 16, 2004, 03:12:39 PM »
i just noticed that if i freeze the layer with the freeze layer icon from express i need i need this but if i do it through the layer pulldown it seems to remember when i copy ans paste. on my machine at least hmmm

Slim©

  • Needs a day job
  • Posts: 6566
  • The Dude Abides...
copy and paste viewports not working
« Reply #12 on: June 16, 2004, 03:41:01 PM »
Thanks, Jeff

It works for me.
I drink beer and I know things....

Jeff_M

  • King Gator
  • Posts: 4087
  • C3D user & customizer
copy and paste viewports not working
« Reply #13 on: June 16, 2004, 03:54:57 PM »
Quote from: eloquintet
i just noticed that if i freeze the layer with the freeze layer icon from express i need i need this but if i do it through the layer pulldown it seems to remember when i copy ans paste. on my machine at least hmmm

In the layer pulldown are you freezing the layer or freezing the layer in this viewport? Theey are two different things. The ET layfreeze defaults to freezing in the current vp when used in a viewport.

Jeff

ELOQUINTET

  • Guest
copy and paste viewports not working
« Reply #14 on: June 16, 2004, 04:03:09 PM »
yeah i usually do it in the pulldown it was just an observation. now back to my original question if i may. why wouldn't he be able to copy and paste multiple viewports?