leonucadomi Posted November 17, 2022 Posted November 17, 2022 hello people: this is very repetitive... I would like to know if there is a routine that does that job does anyone know? Quote
Steven P Posted November 17, 2022 Posted November 17, 2022 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? Quote
leonucadomi Posted November 17, 2022 Author Posted November 17, 2022 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 Quote
mhupp Posted November 17, 2022 Posted November 17, 2022 (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 November 17, 2022 by mhupp 1 Quote
Steven P Posted November 17, 2022 Posted November 17, 2022 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. 1 Quote
Steven P Posted November 17, 2022 Posted November 17, 2022 ....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 Quote
mhupp Posted November 17, 2022 Posted November 17, 2022 (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 November 18, 2022 by mhupp Quote
Steven P Posted November 18, 2022 Posted November 18, 2022 (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 November 18, 2022 by Steven P Quote
Recommended Posts
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.