Jump to content

copy objects and paste to all open drawings...


Recommended Posts

Posted

hello people:

this is very repetitive...

 

I would like to know if there is a routine that does that job

 

does anyone know?

 

Posted

For open drawings it is trickier, if the drawings were closed you could use a script routine (see Lee Macs website or Scriptpro) to do something or the core console (I think Big Al is pretty good with that) - how important is it that the pasting is to open drawings?

 

How many drawings are you talking about by the way? 

Posted

if i have seen the routine Lee Macs, I would like to copy without leaving a dialog box.

a command like that would be great

Posted (edited)

Be careful coping blocks that are named the same but are diffrent between drawings. found out text styles named the same but use difrent fonts between drawing also change without notice.

or

 

 

Edited by mhupp
  • Like 1
Posted

In essence a script file is just a list of commands saved into a file saved with a scr suffix (*.scr)

 

You might have something like this then saved as "scriptfile.scr"

 

PASTECLIP
0,0

 

to run this as a script you might then use this command - this should paste from the clipboard to point 0,0 using the above example (I am writing this from the top of my head, no checking)

 

(command "_.SCRIPT" "c:\\User\\scriptfile.scr")

 

 

To make use of a script file then you also want to add in something to open a file like

 

_.OPEN "C:\Users\MyFirstDrawing.dwg"

 

and to close a drawing:

 

(vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "MyFirstDrawing.dwg") :vlax-false)

 

this line just closes the drawing no saving so add that in as well. A quirk I found is that to make it work  - for me - I had to open the next file before closing the previous one. Putting it all together you might have a script file like this:

 

_.OPEN "C:\Users\Drawing 1".dwg"
PASTECLIP
0,0
qsave

_.OPEN "C:\Users\Drawing 2.dwg"
(vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 1.dwg") :vlax-false)
PASTECLIP
0,0
qsave

_.OPEN "C:\Users\Drawing 3.dwg"
(vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 2.dwg") :vlax-false)
PASTECLIP
0,0
qsave

_.OPEN "C:\Users\Drawing 4.dwg"
(vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 3.dwg") :vlax-false)
PASTECLIP
0,0
qsave

(vla-close (vla-item (vla-get-documents (vlax-get-acad-object)) "Drawing 3.dwg") :vlax-false)

 

 

Something like this should run through a range of closed drawings, open them in turn and paste something at 0,0 when you use the (command ....) line from above. It is easier to use a dialogue box to build up the list of files to work on.

 

 

 

As for a script to run on only opened files, I have found this to be very limited - happy to be corrected and shown a better way - and the examples out there only show for example switching tabs or similar - certainly not a full range of commands like this example would let you do. The core console is very fast but also limited with some LISP commands like it doesn't like VLA- commands

 

 

 

 

If you can I would consider closing all the files and running the script on them like that - the examples are out there to use

 

 

 

 

Of course, happy to see if someone can answer you with a better solution.

 

 

 

  • Like 1
Posted

....or just select all the objects, 'copybase' command, and then ctrl+ V , insert point where ever you want, then just go from one drawing to the next pasting them

Posted (edited)

This was the post were I learned autocad doesn't play nice with multiple drawings. but they seemed to get it working.

https://www.cadtutor.net/forum/topic/73181-ltscale-10-to-allopeneddwgs/?do=findComment&comment=581936

(defun C:C2ALL (/ ss x)
  (vl-load-com)
  (setq ss (ssget))
  (vl-cmdf "_.Copybase" "_non" "0,0" SS "")
  (vlax-for x (vla-get-documents (vlax-get-acad-object))
    (vla-SendCommand x (strcat "_.pasteclip pause")) 
  )
  (princ)
)

;;----------------------------------------------------------------------------;;
;; Zoom Area Across Multiple Drawings
(defun C:ZAD (/ a)  ;Zoom Across Drawings
  (initget "Yes No")
  (setq a
    (cond
      ((getkword "\nRedefine Zoom Area? [Yes/No]: ")) ( "No")
    )
  )
  (if (= "Yes" a)
    (progn
      (vl-cmdf "_.Zoom" "W" Pause Pause)
      (setq vc (getvar 'viewctr))
      (setq SZ (getvar 'viewsize))
      (vl-propagate 'vc)
      (vl-propagate 'sz)
    )
    (if (or (= vc nil) (= sz nil))
      (prompt "\nPlease Define Zoom Area")
      (vl-cmdf "_.Zoom" "C" VC SZ)
    )
  )
  (princ)
)

 

Edited by mhupp
Posted (edited)
12 hours ago, mhupp said:

This was the post were I learned autocad doesn't play nice with multiple drawings. but they seemed to get it working.

 

 

 

Thanks, I am going to try this this morning,

 

 

 

 

... no, this isn't working for me today

Edited by Steven P

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...