Results 1 to 10 of 10

Thread: Fixing Copyclip.lsp with base point 0,0

  1. #1
    Login to Give a bone
    0

    Default Fixing Copyclip.lsp with base point 0,0

    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,
    Attached Files Attached Files

  2. #2
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    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

  3. #3
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    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

  4. #4
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    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,

  5. #5
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    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,

  6. #6
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    Quote Originally Posted by joeblack187536404946 View Post
    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.
    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):

    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)
    If you normally do not work in World (WCS), then some minor changes will be needed to properly TRANSlate the coordinates.


    Quote Originally Posted by joeblack187536404946 View Post
    2.) When I want to paste a completely new drawing to the one on working on it keeps pasting the someone as before.
    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

  7. #7
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    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 cancelled
    Code:
    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

  8. #8
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    Quote Originally Posted by joeblack187536404946 View Post
    "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.
    I'm not sure what the "PC" Command is.
    "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

  9. #9
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    "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,

  10. #10
    100 Club
    Join Date
    2000-11
    Location
    Ontario, Canada
    Posts
    116
    Login to Give a bone
    0

    Default Re: Fixing Copyclip.lsp with base point 0,0

    One thing that stands out for me is that you are incrementing the path you are trying to insert your block from...

    Code:
    (setq blkname (strcat  "copyclip" (itoa count) "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg"))
    So, for instance, if there were no blocks named "copyclip" currently in your destination drawing, c:PC would try to insert

    "copyclip0/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg".

    Meanwhile, your routine is only verifying that "/Users/BossMan/Documents/AutoLisp/LSP/copyclip.dwg" exists.

Similar Threads

  1. 2014: Rotate a XYZ Point Around Base Point
    By sam.zielke437771 in forum Revit - API
    Replies: 0
    Last Post: 2014-08-11, 03:42 AM
  2. Survey Point and Project Base Point Visible in new views
    By amjones in forum Revit Architecture - General
    Replies: 2
    Last Post: 2013-03-12, 10:23 PM
  3. Replies: 3
    Last Post: 2012-05-07, 04:26 PM
  4. Replies: 0
    Last Post: 2011-12-03, 09:13 AM
  5. Base Point
    By mbreeden in forum Dynamic Blocks - Technical
    Replies: 3
    Last Post: 2008-01-10, 04:56 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •