Returns something funny

Discussion in 'AutoCAD' started by cadman_meg, Aug 6, 2003.

  1. cadman_meg

    cadman_meg Guest

    This routine returns this:

    _FSV ; error: bad argument type: lselsetp nil

    Not sure why and don't know how to fix. Can someone please help? Here it is:

    ;| FINAL_SAVE.LSP by Paul Kirill 9/19/2002 c2002 KDCAD, inc.

    This routine is given freely and may be freely distributed with the condition
    that all KDCAD copyright and contact information be included.

    If you have any questions or would like to contract for additional
    customization, please drop me a note at !



    Type FSV to execute.

    How it works: FINAL_SAVE first looks for your title block. If found
    in Model Space, the routine Zooms to the limits of the drawing,
    verifies the drawing has been previously saved and if so runs
    QSAVE. If the title block is found in Paper Space, the routine
    cycles through each tab, locks the viewports and Zooms to Extents.
    Once the cycle is comlete, the routine "parks" on the 1st layout
    tab, checks for a previous and if so runs QSAVE.

    Notes: You must change the default titleblock name. See the second line
    of code below.

    If the drawing has not been previously saved (ex. Drawing1.dwg),
    an alert message is triggered and the routine quits.



    |;

    ;; BEGIN FINAL_SAVE**************************************************

    (defun C:FSV (/ LST FLEN FNUM MODE FILENAME)

    (setq SRCH_BLOCK "1717sheetinfo")
                       ;;***Replace "1717sheetinfo" with your titleblock name

    (defun CHECK_FILE_NAME ()
        (setq FILENAME (getvar "dwgname")
    FLEN (strlen FILENAME)
    FNUM (substr FILENAME 1 (- FLEN 5))
        )
        (if (= FNUM "Drawing")
          (progn
    (alert
    "Drawing not saved in standard format! \n\n Save drawing in standard format
    \n before running Final Save."
    )
    (princ)
          )
          (progn
    (command "QSAVE")
    (if (= MODE 1)
    (princ
    (strcat
    "All layouts have been Zoomed to Extents \nand drawing "
    FILENAME
    " has been saved."
    )
    )
    (princ
    (strcat
    "Model Space has been Zoomed to Limits \nand drawing "
    FILENAME
    " has been saved"
    )
    )
    )
          )
        )
        (princ)
      )

    (defun CHECK_SPACE (/ SPCCHK)
        (setq SPCCHK (ssget "x"
    (list (cons 0 "INSERT") (cons 2 SRCH_BLOCK))
    )
    SPCCHK (entget (ssname SPCCHK 0))
        )
        (setq MODE (cdr (assoc 67 SPCCHK)))
        (if (= MODE 1)
          (PSFSV)
          (MSFSV)
        )
      )

    (defun MSFSV ()
        (C:ZL)
        (CHECK_FILE_NAME)
        (PRINC)
      )

    (defun PSFSV (/ layouts c)
        ;;---------------Putting Layout Tabs in Order - Coutesy of Frank Oquendo - ACADX.com
        (vl-load-com)
        (setq layouts (vla-get-layouts
    (vla-get-activedocument (vlax-get-acad-object))
    )
    c -1
        )
        (repeat (vla-get-count layouts)
          (setq lst (cons (setq c (1+ c)) lst))
        )
        (vlax-for lay layouts
          (setq lst
    (subst
    (vla-get-name lay)
    (vla-get-taborder lay)
    lst
    )
          )
        )
        (setq LTLIST (reverse lst))

    ;;^^^^^^^^^^^^^Putting Layout Tabs in Order - Coutesy of Frank Oquendo - ACADX.com

    (setq ZOOMLIST LST)
        (while ZOOMLIST
          (setvar "CTAB" (car ZOOMLIST))
          (if (/= (getvar "CTAB") "Model")
    (C:VL)
          )
          (command "ZOOM" "E")
          (setq ZOOMLIST (cdr ZOOMLIST))
        )
        (setvar "CTAB" (car (cdr LTLIST)))
        (CHECK_FILE_NAME)
      )

    (CHECK_SPACE)
    )

    ;; END FINAL_SAVE**************************************************





    ;;MVIEW LOCK
    (defun C:VL (/ VPLST)
      (setq VPLST (ssget "x" (list (cons 0 "viewport"))))
      (if (= (getvar "ctab") "Model")
        (princ "\n** Command not allowed in Model Tab **")
        (command "MVIEW" "lock" "on" VPLST "")
      )
      (princ)
    )



    ;;Zoom Limits
    (defun C:ZL (/ PT1 PT2)
      (setq PT1 (getvar "LIMMIN"))
      (setq PT2 (getvar "LIMMAX"))
      (command "ZOOM" "W" PT1 PT2)
      (princ)
    )
     
    cadman_meg, Aug 6, 2003
    #1
  2. cadman_meg

    cadman_meg Guest

    But this routine has nothing to do with getting any length. It zooms all layouts to extens and saves them, then it is supposed to go to the first layout. But as said, nothing happens but that error which seems ackward.
     
    cadman_meg, Aug 6, 2003
    #2
  3. cadman_meg

    Dean McCarns Guest

    In your selection set routine make sure the selection set is not nill before attempting to perform an action upon it.  Try something like this:



     



    (setq ss (ssget "_X" '((8 . "Layer_Name"))))



    (if (sslength ss)



        (repeat (sslength xx).......



     



     



    It should work fine.




    --
    Dean McCarns
    ESP,Inc.
    804.675.2377



    "Dean McCarns" <> wrote in message news:...



    lselsetp = Length Selection Set P or the selection set is empty and your attempting to get the length of a nil selection set.




    --
    Dean McCarns
    ESP,Inc.
    804.675.2377



    "cadman_meg" <> wrote in message news:...

    This routine returns this:

    _FSV ; error: bad argument type: lselsetp nil

    Not sure why and don't know how to fix. Can someone please help? Here it is:

    ;| FINAL_SAVE.LSP by Paul Kirill 9/19/2002 c2002 KDCAD, inc.

    This routine is given freely and may be freely distributed with the condition
    that all KDCAD copyright and contact information be included.

    If you have any questions or would like to contract for additional
    customization, please drop me a note at !



    Type FSV to execute.

    How it works: FINAL_SAVE first looks for your title block. If found
    in Model Space, the routine Zooms to the limits of the drawing,
    verifies the drawing has been previously saved and if so runs
    QSAVE. If the title block is found in Paper Space, the routine
    cycles through each tab, locks the viewports and Zooms to Extents.
    Once the cycle is comlete, the routine "parks" on the 1st layout
    tab, checks for a previous and if so runs QSAVE.

    Notes: You must change the default titleblock name. See the second line
    of code below.

    If the drawing has not been previously saved (ex. Drawing1.dwg),
    an alert message is triggered and the routine quits.



    |;

    ;; BEGIN FINAL_SAVE**************************************************

    (defun C:FSV (/ LST FLEN FNUM MODE FILENAME)

    (setq SRCH_BLOCK "1717sheetinfo")
                       ;;***Replace "1717sheetinfo" with your titleblock name

    (defun CHECK_FILE_NAME ()
        (setq FILENAME (getvar "dwgname")
    FLEN (strlen FILENAME)
    FNUM (substr FILENAME 1 (- FLEN 5))
        )
        (if (= FNUM "Drawing")
          (progn
    (alert
    "Drawing not saved in standard format! \n\n Save drawing in standard format
    \n before running Final Save."
    )
    (princ)
          )
          (progn
    (command "QSAVE")
    (if (= MODE 1)
    (princ
    (strcat
    "All layouts have been Zoomed to Extents \nand drawing "
    FILENAME
    " has been saved."
    )
    )
    (princ
    (strcat
    "Model Space has been Zoomed to Limits \nand drawing "
    FILENAME
    " has been saved"
    )
    )
    )
          )
        )
        (princ)
      )

    (defun CHECK_SPACE (/ SPCCHK)
        (setq SPCCHK (ssget "x"
    (list (cons 0 "INSERT") (cons 2 SRCH_BLOCK))
    )
    SPCCHK (entget (ssname SPCCHK 0))
        )
        (setq MODE (cdr (assoc 67 SPCCHK)))
        (if (= MODE 1)
          (PSFSV)
          (MSFSV)
        )
      )

    (defun MSFSV ()
        (C:ZL)
        (CHECK_FILE_NAME)
        (PRINC)
      )

    (defun PSFSV (/ layouts c)
        ;;---------------Putting Layout Tabs in Order - Coutesy of Frank Oquendo - ACADX.com
        (vl-load-com)
        (setq layouts (vla-get-layouts
    (vla-get-activedocument (vlax-get-acad-object))
    )
    c -1
        )
        (repeat (vla-get-count layouts)
          (setq lst (cons (setq c (1+ c)) lst))
        )
        (vlax-for lay layouts
          (setq lst
    (subst
    (vla-get-name lay)
    (vla-get-taborder lay)
    lst
    )
          )
        )
        (setq LTLIST (reverse lst))

    ;;^^^^^^^^^^^^^Putting Layout Tabs in Order - Coutesy of Frank Oquendo - ACADX.com

    (setq ZOOMLIST LST)
        (while ZOOMLIST
          (setvar "CTAB" (car ZOOMLIST))
          (if (/= (getvar "CTAB") "Model")
    (C:VL)
          )
          (command "ZOOM" "E")
          (setq ZOOMLIST (cdr ZOOMLIST))
        )
        (setvar "CTAB" (car (cdr LTLIST)))
        (CHECK_FILE_NAME)
      )

    (CHECK_SPACE)
    )

    ;; END FINAL_SAVE**************************************************





    ;;MVIEW LOCK
    (defun C:VL (/ VPLST)
      (setq VPLST (ssget "x" (list (cons 0 "viewport"))))
      (if (= (getvar "ctab") "Model")
        (princ "\n** Command not allowed in Model Tab **")
        (command "MVIEW" "lock" "on" VPLST "")
      )
      (princ)
    )



    ;;Zoom Limits
    (defun C:ZL (/ PT1 PT2)
      (setq PT1 (getvar "LIMMIN"))
      (setq PT2 (getvar "LIMMAX"))
      (command "ZOOM" "W" PT1 PT2)
      (princ)
    )
     
    Dean McCarns, Aug 6, 2003
    #3
  4. cadman_meg

    cadman_meg Guest

    Don't understand what you are saying as I am not the most proficient in lisp. Didn't think this had a selection set as it does not ask me to select anything.
     
    cadman_meg, Aug 6, 2003
    #4
  5. This routine is looking for an insert with a specific name.
    Apparently your drawing doesn't contain the insert you have specified.
    (entget (ssname..... is puking.

    --
    Ken Alexander
    Acad2000
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    all layouts to extens and saves them, then it is supposed to go to the
    first layout. But as said, nothing happens but that error which seems
    ackward.
     
    Ken Alexander, Aug 6, 2003
    #5
  6. cadman_meg

    cadman_meg Guest

    Sorry, but now I am really confused. Are you saying to replace something with?:

    (setq ss (ssget "_X" '((8 . "Layer_Name"))))
    (if (sslength ss)
        (repeat (sslength xx

    Why is it trying to insert something? Like I said, all it is supposed to do is zoom extents in all layouts while saving them and then move back to the first layout. I didn't write this routine as I don't write many.
     
    cadman_meg, Aug 6, 2003
    #6
  7. Try reading the instructions that came with the routine. This routine
    is looking for a specific title block (block insert). Depending on
    where this title block is located (model or paper space) it performs
    differently. If all you want to do is zoom extents in all layouts and
    save, then try writing one. All the information you need is in this
    routine.

    --
    Ken Alexander
    Acad2000
    Windows2000 Prof.

    "We can't solve problems by using the same kind
    of thinking we used when we created them."
    --Albert Einstein

    supposed to do is zoom extents in all layouts while saving them and
    then move back to the first layout. I didn't write this routine as I
    don't write many.
     
    Ken Alexander, Aug 6, 2003
    #7
  8. cadman_meg

    Murph Guest

    Did you read this part of the file? And replace 1717sheetinfo with your titleblock name (name of the block you use as a title block)



     



    ;;***Replace "1717sheetinfo" with your titleblock name



     



    Murph



     



    "cadman_meg" <> wrote in message news:...

    Sorry, but now I am really confused. Are you saying to replace something with?:

    (setq ss (ssget "_X" '((8 . "Layer_Name"))))
    (if (sslength ss)
        (repeat (sslength xx

    Why is it trying to insert something? Like I said, all it is supposed to do is zoom extents in all layouts while saving them and then move back to the first layout. I didn't write this routine as I don't write many.
     
    Murph, Aug 6, 2003
    #8
  9. cadman_meg

    cadman_meg Guest

    Actually, I did change that. Sorry, was messing with several thinghs at once and didn't look at it very clearly I guess. Works fone now, but still may be nice to have one that doesn't worry about the titleblock. Just zooming to extents withoutit. Thanks.
     
    cadman_meg, Aug 6, 2003
    #9
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.