Copybase command

Discussion in 'AutoCAD' started by swragan, Jun 11, 2004.

  1. swragan

    swragan Guest

    I had a vlisp program that worked in ADT3.3 and it copied and pasted an object (although it also gave an error message). The same program won't work in building systems 2005. I get an invalid point message.

    Does anyone know what I need to do to fix this thing? I've already spent an hour playing with it. Here is the program:

    (defun C:basesnap ( )
    (setvar "OSMODE" 15359)
    (command "copybase")
    (command "_pasteclip")
    )
     
    swragan, Jun 11, 2004
    #1
  2. swragan

    ECCAD Guest

    Replace line:
    (command "copybase")
    With:
    (command "copybase" pause pause pause "")

    Bob
     
    ECCAD, Jun 12, 2004
    #2
  3. swragan

    ECCAD Guest

    Swragan,
    Or you could use a function like:

    (defun c:cp (); Copy-Paste objects
    ;; Error Trapping
    (defun myerror (sxx)
    (if (= sxx nil)
    (setq sxx "console break")
    ); end if
    (setvar "CMDECHO" 0)
    (if (not (member sxx '("console break" "Function cancelled")))
    (princ (strcat "\nError: " sxx))
    ); end if
    (if (= (member sxx '("console break" "Function cancelled")))
    (progn
    (prompt "\nError: Break...")
    (setvar "MENUECHO" 0)
    (setvar "HIGHLIGHT" 1)
    (setvar "SORTENTS" 1)
    (setvar "ATTDIA" 0); No Attribute Dialog Boxes, please
    (setvar "ATTREQ" 1); Attributes Required on inserts
    (setvar "OSMODE" 0); No OSNAP modes
    (setvar "CMDDIA" 1); Plot command dialog on
    ); end progn
    ); end if
    (setvar "CMDECHO" 0)
    (setq sxx nil)
    (princ)
    ); end function myerror
    (setq olderr *error* *error* myerror)
    ;;
    (setq old_osmode (getvar "OSMODE")); save OSNAP settings
    (setvar "osmode" 15359); reset OSNAP to needed value
    (setq bpt (getpoint "\nPick Base Point:"))
    (setq ss nil)
    (prompt "\nPick Objects to Copy to Copy-Clip:")
    (setq ss (ssget))
    (if ss
    (progn
    (command "_copybase" bpt ss "")
    (command "_pasteclip")
    ); end progn
    ); end if
    (setvar "OSMODE" old_osmode); reset OSNAP settings
    (princ)
    ); end function cp
    (prompt "\nType in CP to Copy-Paste:")
    (princ); silent load

    Cheers:
    Bob Shaw
    www.bobscadshop.com
     
    ECCAD, Jun 12, 2004
    #3
  4. swragan

    swragan Guest

    Thanks for both the responses. I now know what the pause command does (it seems like an odd name for a "get user input" command). I wound up with this as my final "copy with base point" script:

    (defun C:basesnap ( )
    (setvar "OSMODE" 15359)
    (setq ss1 (ssget))
    (setq ent1 (ssname ss1 0))
    (command "copybase" pause ss1 "")
    (command "_pasteclip")
    (setq ss1 nil))

    I probably should reset the snap mode at the end of this program, but I frequently leave all the snaps on anyway.

    Steve
     
    swragan, Jun 14, 2004
    #4
  5. swragan

    ECCAD Guest

    You are welcome.

    Bob
     
    ECCAD, Jun 14, 2004
    #5
  6. swragan

    CAB2k Guest

    May I make an observation & suggestions?

    Code:
    (defun C:basesnap ( )
    (setvar "OSMODE" 15359); <--  all on except QUIck
    (setq ss1 (ssget))     ; <--  get selection set
    (setq ent1 (ssname ss1 0)); <--  ??  don't know what this is for
    (command "copybase" pause ss1 "")
    (command "_pasteclip")
    (setq ss1 nil);  <--  free up variable
    ) 

    My favorite osmode is 175
    I would do it this way.

    Code:
    (defun C:basesnap ( / ss1 pt) ; <-- clear ss1 & pt when done
    (setvar "OSMODE" 175)
    (prompt "\nSelect objects to copy.")
    (if (setq ss1 (ssget)) ; exit if nothing selected
    (if (setq pt (getpoint "\nSelect Base Point."))
    ;; do this only if a point was selected
    (command ".copybase" pt ss1 "" ".pasteclip")
    )
    )
    (princ); exit quietly, does not display nil when done
    ) 
    You could put in a button in this form:

    Code:
    ^C^C(command ".copybase" pause (ssget) "" ".pasteclip")
    CAB
     
    CAB2k, Jun 15, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.