Results 1 to 6 of 6

Thread: 2015 copybase not working inside lisp routine

  1. #1
    Member
    Join Date
    2006-12
    Posts
    5
    Login to Give a bone
    0

    Default 2015 copybase not working inside lisp routine

    I have a lisp routine I have been using for 3 or 4 years now that basically uses the copybase command, but automates setting the ucs to world and the basepoint to 0,0. For some reason 2015 does not like it. If I step through the routine in the command line it works fine, but falls over once put together in one sequence, comes up with a "Copy to clipboard failed." error.

    The main command looks like this (command "COPYBASE" "0,0" SLSET "") where SLSET is just a selection set created using SSGET.

    If I enter (command "COPYBASE" "0,0" SLSET) on the command line and manually add the final return it works fine.

    Any help would be much appreciated.

  2. #2
    All AUGI, all the time
    Join Date
    2010-06
    Posts
    962
    Login to Give a bone
    0

    Default Re: 2015 copybase not working inside lisp routine

    Hi ,

    I have AutoCAD 2015 installed on my system and I just tried that and it did work just fine .
    Just a guess here , try to add Underscore with a dot before the command name if you are working with none English version like this "_.copybase"

    Good luck .

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

    Default Re: 2015 copybase not working inside lisp routine

    Without being able to see the lisp it's going to be hard to answer how to fix it.
    If (command "COPYBASE" "0,0" SLSET) works same as on the command line maybe add (command) after to close it.

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

    Default Re: 2015 copybase not working inside lisp routine

    Likewise, I've been using these for years, however they have continued to work in 2015 without issue:

    Code:
    ;;;--------------------------------------------------------------------;
    (defun c:CB (/ basePoint)
      (if (setq basePoint (getpoint "\nSpecify base point: "))
        (_CopyBase basePoint "\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)
    )
    ;;;--------------------------------------------------------------------;
    (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)
    )

    ... The only difference really, is that you're supplying the selection set to the COPYBASE Command, when it works with implied selection already.

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

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

    Default Re: 2015 copybase not working inside lisp routine

    I have Drop-downs in the Ribbon for both Copy and Paste that include the additional macros:

    Command Name: Copy with 0,0 as Base Point
    Description: Duplicates objects with 0,0 as the base point
    Macro:
    Code:
    $M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,8),GRIP),_copybase,^C^C_copybase) 0,0
    Using the image RCDATA_16_ID

    Command Name: Paste as Group
    Description: Pastes objects from the Clipboard into the current drawing as a group
    Macro:
    Code:
    ^C^C_pasteblock;\(setq LstBlk(vla-get-Name (vlax-ename->vla-object (entlast))));_explode;_last;_-group;_create;*;;_previous;;(command "-purge" "B" LstBlk "N") (setq LstBlk nil)
    (you must add a space after lisp in a macro)
    Using the new group image RCDATA_16_NEWGROUP

    I like being able to select everything I just inserted with one click. I've got 2012 thru 2015 installed and it works the same on all of them.

  6. #6
    Member
    Join Date
    2006-12
    Posts
    5
    Login to Give a bone
    0

    Default Re: 2015 copybase not working inside lisp routine

    Thanks for the responses to this. I still have not been able to make this work. The code is below, just basically checks the ucs, if not world sets it to world, then does a copy base of the users selection and sets usc to previous if necessary. I have tried all combinations of ._copybase, _.copybase etc and still no luck. Any advise would be appreciated.

    Code:
    (DEFUN CB(/ UCSTST SLSET)
    (SETQ UCSTST nil)
    (setq ucstst (car (getvar "ucsxdir")))
    (PROMPT "\nSelect Objects To CopyClip : ")
    (SETQ SLSET (SSGET))
    (if (/= ucstst 1)
    (PROGN
    (command "ucs" "w")
    (command "._copybase" "0,0" SLSET "")
    (command "ucs" "P")
    )
    (command "._copybase" "0,0" SLSET "")
    )
    )
    (CB)
    Last edited by rkmcswain; 2015-04-02 at 04:57 PM. Reason: added [CODE] tags

Similar Threads

  1. Looking for lisp routine to select objects inside polyline
    By vlad_tzok133583 in forum AutoLISP
    Replies: 22
    Last Post: 2022-04-29, 05:44 AM
  2. Getting my lisp routine to work in C3D 2015
    By dmackey.143011 in forum AutoLISP
    Replies: 5
    Last Post: 2015-04-06, 07:22 AM
  3. Lisp routine not working anymore in ACAD2010 Mech
    By jim.dozorec in forum AutoLISP
    Replies: 2
    Last Post: 2012-07-20, 01:14 PM
  4. Replies: 11
    Last Post: 2007-01-30, 07:18 AM
  5. Run a LISP routine from inside another
    By mpemberton in forum AutoLISP
    Replies: 5
    Last Post: 2006-06-26, 07:12 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
  •