Can someone please help me fix my Copyclip.lsp file. It was originally made for much older version of AutoCad. We are now running AutoCad 2013 for Mac. For some reason only this lisp doesn't work.
Thanks,
|
Can someone please help me fix my Copyclip.lsp file. It was originally made for much older version of AutoCad. We are now running AutoCad 2013 for Mac. For some reason only this lisp doesn't work.
Thanks,
Not familiar with Mac, but for AutoCAD on a PC I use this macro added to my CUI:
Command Name: Copy with 0,0 as Base Point
Macro: $M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,8),GRIP),_copybase,^C^C_copybase) 0,0
Simply uses the CopyBase command adding 0,0 for the basepoint. Don't know if DIESEL works on Mac versions though.
Last edited by rkmcswain; 2013-07-29 at 05:31 PM. Reason: turn off smilies so code renders correctly
Here's a couple of mine:
Code:;;;--------------------------------------------------------------------; (defun c:CB () (_CopyBase pause "\rCOPYBASE: User specified ")) ;;;--------------------------------------------------------------------; (defun c:CC () (_CopyBase '(0 0 0) "\rCOPYBASE: (0.0,0.0,0.0) ")) ;;;--------------------------------------------------------------------; (defun _CopyBase (basePoint msg / *error* ss cmdecho) (princ msg) (defun *error* (msg) (and cmdecho (setvar 'cmdecho cmdecho)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (and (or (setq ss (ssget "_I")) (setq ss (ssget "_:L"))) (setq cmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0) ) (command "._copybase" basePoint) ) (*error* nil) ) ;;;--------------------------------------------------------------------; (princ)
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
It doesn't seem to work. What I'm trying to do is copy a drawing from one .dwg file with its specific coordinates to another placing the drawing on to the new file with its original coordinates. This project requires me to overlay several GIS maps. Maybe i just need to switch back to a PC.
Thanks,
BlackBox, thank you! It kind of works, but there's some problems.
1.) When I paste the drawing from to another it ask for "_pasteclip Specify insertion point:" i want it to paste it to "0,0,0" automatically.
2.) When I want to paste a completely new drawing to the one on working on it keeps pasting the someone as before.
Any help is greatly appreciated.
Thanks,
I generally work in World (WCS)... From one open drawing I'll copy my selection using CC command (posted above), and then switch to another drawing, and use VV (posted below):
If you normally do not work in World (WCS), then some minor changes will be needed to properly TRANSlate the coordinates.Code:;;;--------------------------------------------------------------------; (defun c:VV () (c:PasteBase)) (defun c:PasteBase (/ *error* cmdecho) (princ "\rPASTEBASE: (0.0,0.0,0.0) ") (defun *error* (msg) (and cmdecho (setvar 'cmdecho cmdecho)) (cond ((not msg)) ; Normal exit ((member msg '("Function cancelled" "quit / exit abort"))) ; <esc> or (quit) ((princ (strcat "\n** Error: " msg " ** "))) ; Fatal error, display it ) (princ) ) (if (and (setq cmdecho (getvar 'cmdecho)) (setvar 'cmdecho 0) ) (command "._pasteclip" '(0 0 0)) ) (*error* nil) ) ;;;--------------------------------------------------------------------; (princ)
I'm not sure that I fully understand your comment; if the above code does not help, please clarify.
HTH
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
This might help.
"CC" command works great. it take whatever y copyclip and make into a wblock and place it a a drawing called copyclip.dwg with base 0,0,0.
"PC" command doesn't work at all, i keep getting this error. I verified search paths, file name, everything and still doesn't work.
Code:Command: pc "copyclip.dwg": Can't find file in search path: /Users/BossMan/Documents/ (current directory) /Users/BossMan/Desktop/ /Users/BossMan/Library/Application Support/Autodesk/roaming/AutoCAD 2013/R19.0/enu/support/ /Applications/Autodesk/AutoCAD 2013/AutoCAD 2013.app/Contents/Resources/Support/ /Applications/Autodesk/AutoCAD 2013/AutoCAD 2013.app/Contents/Resources/Support/color/ /Applications/Autodesk/AutoCAD 2013/AutoCAD 2013.app/Contents/Library/ /Applications/Autodesk/AutoCAD 2013/AutoCAD 2013.app/Contents/drv/ /Applications/Autodesk/AutoCAD 2013/ /Applications/Autodesk/AutoCAD 2013/AutoCAD 2013.app/ *Invalid* ; error: Function cancelledCode:Original Lisp Code: (defun c:cc (/ ) (defun ac:erron ( varlst / ) (setvar "CMDECHO" cmdecho) (setvar "highlight" highlight) (setq acerr *error*) (setq ac=mods nil) (if varlst (foreach n varlst (setq ac=mods (append ac=mods (list (list n (getvar n))))) ) ) (defun *error* (msg) (if ac_errprg (ac_errprg)) (if ac=mods (foreach n ac=mods (setvar (car n) (cadr n))) ) (setq *error* acerr) (princ (strcat "Error: " msg )) (if (and ac_errmsg (/= ac_errmsg "")) (princ (strcat "\n >> " ac_errmsg " <<")) ) (setq ac_errmsg nil) (princ) ) (defun ac:erroff () (if ac=mods (foreach n ac=mods (setvar (car n) (cadr n))) ) (setq ac_errprg nil) (setq *error* acerr) (princ) ) ) (setq highlight (getvar "highlight") cmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (setq ss1 (ssget)) (setvar "highlight" 0) (if (ssget "p" '((2 . "copyclip*"))) (progn (alert "Copyclip objects must be expoded\nto be copied to the \"Clipboard\"") (exit))) (if (findfile "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg") (command "_wblock" "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg" "y" "" "0,0" ss1"") (command "_wblock" "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg" "" "0,0" ss1"") ) (command "_oops") (setvar "CMDECHO" cmdecho) (setvar "highlight" highlight) ) (defun c:pc () (defun ac:erron ( varlst / ) (setvar "CMDECHO" cmdecho) (setq acerr *error*) (setq ac=mods nil) (if varlst (foreach n varlst (setq ac=mods (append ac=mods (list (list n (getvar n))))) ) ) (defun *error* (msg) (if ac_errprg (ac_errprg)) (if ac=mods (foreach n ac=mods (setvar (car n) (cadr n))) ) (setq *error* acerr) (princ (strcat "Error: " msg )) (if (and ac_errmsg (/= ac_errmsg "")) (princ (strcat "\n >> " ac_errmsg " <<")) ) (setq ac_errmsg nil) (princ) ) (defun ac:erroff () (if ac=mods (foreach n ac=mods (setvar (car n) (cadr n))) ) (setq ac_errprg nil) (setq *error* acerr) (princ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq cmdecho (getvar "cmdecho")) (setvar "cmdecho" 0) (setq count 0) (while (tblsearch "block" (strcat "copyclip" (itoa count))) (setq count (+ 1 count))) (setq blkname (strcat "copyclip" (itoa count) "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg")) (if (findfile "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg") (command "_insert" blkname "0,0" "1" "1" "0") (alert "\"Clipboard\" Empty (//copyclip does not exist)") ) (setvar "CMDECHO" cmdecho) )
Last edited by BlackBox; 2013-08-02 at 10:59 PM. Reason: Please use [CODE] Tags
"How we think determines what we do, and what we do determines what we get."
Sincpac C3D ~ Autodesk Exchange Apps
Computer Specs:
Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000
"PC" command it takes the "copyclip" _wblock from a a drawing called copyclip.dwg and paste into any drawing. At the same command it erases the _wblock from the copyclip.dwg. Hopefully this helps.
Thanks,
One thing that stands out for me is that you are incrementing the path you are trying to insert your block from...
So, for instance, if there were no blocks named "copyclip" currently in your destination drawing, c:PC would try to insertCode:(setq blkname (strcat "copyclip" (itoa count) "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg"))
"copyclip0/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg".
Meanwhile, your routine is only verifying that "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg" exists.