Xclip

Discussion in 'AutoCAD' started by George Gerardo, Jr., Dec 14, 2004.

  1. I have a small command to bypass a few options in the xclip command. Most
    of the clips I do are rectangular so I wanted to cut to the chase.
    Basically, you initiate the command, select the xref and pick your corners.
    But I have 2 problems. 1. How do I turn the osnaps of after the command is
    finished? 2. The command works fine when you start a new drawing and have
    never initiated the xclip command, but if you try a second time there is an
    error. I know it is happening because it wants an answer on whether or not
    to delete the old boundary, I just have no clue how to correct it. I know a
    little about lisp from school, maybe just enough to get me in trouble, but
    any help would be appreciated. Here is the code; please bare with its'
    simplicity.


    ;;Xref Clip with rectangle
    (defun c:xcc ()
    ;(setvar "CMDECHO" 0)
    (setvar "osmode" 33)
    (setq xc1 (entsel "\nSelect xref to clip: "))
    (command "xclip" xc1 "" "n" "r")
    (prin1)
    )
     
    George Gerardo, Jr., Dec 14, 2004
    #1
  2. George Gerardo, Jr.

    BillZ Guest

    I don't know anything about xclip but if you want to set the osnaps back to what they were:

    (defun c:xcc ()
    ;(setvar "CMDECHO" 0)
    (setq oosmd (getvar "osmode"))
    (setvar "osmode" 33)
    (setq xc1 (entsel "\nSelect xref to clip: "))
    (command "xclip" xc1 "" "n" "r")
    (setvar "osmode" oosmd)
    (prin1)
    )

    Bill
     
    BillZ, Dec 14, 2004
    #2
  3. George Gerardo, Jr.

    Fred Wilson Guest

    Here's my version that we've been using to do the same thing :

    (defun c:xcliprec ( / SS_XREFS BFLAG ENAM CNT NUM )
    (setq BFLAG nil) ;T if exist boundary
    (princ "\nPick blocks to Xclip...")
    (setq SS_XREFS (ssget '((0 . "INSERT"))))
    ;;;if a 102 entry then it has a boundary already
    (if SS_XREFS
    (progn
    (setq CNT 0 NUM (sslength SS_XREFS))
    (while (< CNT NUM)
    (setq ENAM (ssname SS_XREFS CNT) ;get first Xref in SelSet
    ELIST (entget ENAM)
    BFLAG (assoc 102 ELIST)
    CNT (1+ CNT)
    )
    (if BFLAG (setq CNT NUM));if an exist bound then end while loop
    );while
    (if BFLAG ;if there is an existing boundary
    (progn ;BFLAG is true
    (command ".Xclip" SS_XREFS "" "" "" "" ) )
    (progn ;BFLAG is false
    (command ".Xclip" SS_XREFS "" "" "" ))
    );if
    );progn
    (princ "\n\tNo blocks or xrefs were selected.")
    );if SS_XREFS
    (princ)
    );defun
     
    Fred Wilson, Dec 14, 2004
    #3
  4. Thanks BillZ!

    Thanks Fred! Don't think I would have been able to figure that out.
     
    George Gerardo, Jr., Dec 14, 2004
    #4
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.