Results 1 to 6 of 6

Thread: vdiv.lsp not working like it used to

  1. #1
    100 Club tomcarver's Avatar
    Join Date
    2015-11
    Location
    Tucker, GA
    Posts
    106
    Login to Give a bone
    0

    Default vdiv.lsp not working like it used to

    Hello,
    The lisp routine vdiv.lsp divides an area into equally spaced lines the width of which is specified when you invoke the lisp. It asks for a lower left and upper right corner using the end point obj snap. Previously, if you had running obj snaps on it would save those settings and re set them when the lisp ended. Now it does not re set the running obj snaps.
    I am using autocad 2017 with win10 pro.

    Thanks,
    Tom
    Attached Files Attached Files

  2. #2
    Past Vice President / AUGI Volunteer peter's Avatar
    Join Date
    2000-09
    Location
    Honolulu HI
    Posts
    1,109
    Login to Give a bone
    0

    Default Re: vdiv.lsp not working like it used to

    Hi Tom,

    in the posted routine it appears the function savvar has been commented out (second line)

    ;(savvar)

    try removing the semicolon before the (savvar) expression and try it then.

    P=
    AutomateCAD

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

    Default Re: vdiv.lsp not working like it used to

    Hi Tom,

    I just added the error handling function to reset the system variable OSMODE back as it was set to before invoking the program and rearranged the codes in a bit better way to avoid nil values and to exit safely if any of the inputs is not entered as required.

    So please test the codes and let me know how you get on with the codes?
    Code:
    (defun c:vdiv (/ *error* os line disp divs l p1 p1x p1y p2 p2x p2y thik w)
      ;; moodified by Tharwat - 04.Jul.2017	;;
      (defun *error* (msg)
        (and os (setvar 'OSMODE os))
        (and msg (not (wcmatch (strcase msg) "*BREAK*,*EXIT*,*CANCEL*"))
             (princ (strcat "\nError => " msg))
             )
        (princ)
        )
      ;;				;;
      (setq os (getvar 'OSMODE))
      (setvar "osmode" 32)
      (defun line (a b)
        (entmake (list '(0 . "LINE") (cons 10 a) (cons 11 b)))
        )
      ;;				;;
      (and (setq p1   (getpoint "\nPick lower left corner: "))
           (setq p2   (getpoint "\nPick upper right corner: "))
           (setq divs (getint "\nNumber of dividers [2]: "))
           (setq thik (getreal "\nDivision Thickness [3/4]: "))
           (setq p1x (car p1) p1y (cadr p1) p2x (car p2) p2y (cadr p2))
           (setq l (- p2y p1y))
           (setq w (- p2x p1x))
           (setq disp (/ (- l (* divs thik)) (+ divs 1)))
           (repeat divs
             (setq p1y (+ p1y disp))         
             (line (list p1x p1y) (list (+ p1x w) p1y))
             (if (/= thik 0)
               (line (list p1x (+ thik p1y)) (list (+ p1x w) (+ thik p1y)))
               )
             (setq p1y (+ p1y thik))
             )
           )
      (*error* nil)
      (princ)
      )

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

    Default Re: vdiv.lsp not working like it used to

    Quote Originally Posted by Tharwat View Post
    Hi Tom,

    I just added the error handling function to reset the system variable OSMODE back as it was set to before invoking the program and rearranged the codes in a bit better way to avoid nil values and to exit safely if any of the inputs is not entered as required.

    So please test the codes and let me know how you get on with the codes?
    Like the ways you use the AND function, it and OR are two of my favorites.

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

    Default Re: vdiv.lsp not working like it used to

    Quote Originally Posted by Tom Beauford View Post
    Like the ways you use the AND function, it and OR are two of my favorites.
    Thank you Tom, I am glad to hear that.

  6. #6
    100 Club tomcarver's Avatar
    Join Date
    2015-11
    Location
    Tucker, GA
    Posts
    106
    Login to Give a bone
    0

    Default Re: vdiv.lsp not working like it used to

    Hello Tharwat,
    Thanks very much for the solution. It works great! I have another routine similar to vdiv.lsp it is hdiv.lsp. How would I go about fixing that one?
    Attached Files Attached Files

Similar Threads

  1. 2013 Alt+x not working
    By vanderloo5 in forum 3ds Max - General
    Replies: 0
    Last Post: 2013-04-27, 01:36 PM
  2. Replies: 1
    Last Post: 2012-02-16, 06:57 PM
  3. Working with 3D
    By rhayes.99001 in forum ACA General
    Replies: 1
    Last Post: 2007-08-25, 08:58 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
  •