lisp help - setvar?

Discussion in 'AutoCAD' started by ~Jeff~, Sep 29, 2004.

  1. ~Jeff~

    ~Jeff~ Guest

    I have a lisp routine that I am working on. Is there a way to read what the
    "standard scale" of the viewport the user is currently in?


    Right now, my routine trims back a line from an intersection by a factor
    (.25 x dimscale). This is great when the drawing is in modelspace, but not
    when a drawing is drawn in Paperspace (dimscale is set to 0 (scale
    dimensions to layout option)).
     
    ~Jeff~, Sep 29, 2004
    #1
  2. ~Jeff~

    SpeedCAD Guest

    Hi...

    Yes, test (vla-get-standardscale objeto-viewport) or (vla-get-customscale objeto-viewport)

    Un saludo de SpeedCAD... :D
    CHILE
    FORO: http://www.hispacad.com/foro
     
    SpeedCAD, Sep 29, 2004
    #2
  3. ~Jeff~

    ~Jeff~ Guest

    I am a beginner with a capatol B with lisps. any help to fix this to use
    what u suggested?

    (defun C:BK (/ omode a b c pt1)
    (defun *error* ()
    (setvar "orthomode" omode)
    (setvar "osmode" osmod)
    (princ "\nError detected...aborting")
    (terpri)
    )
    (if (= SCL nil) (setq SCL (getvar "LTSCALE")))
    (setq omode (getvar "orthomode"))
    (setq osmod (getvar "osmode"))
    (setvar "orthomode" 1)
    (setvar "osmode" 32)
    (setq a (getpoint "\nSelect INTERSECTION :"))
    (setvar "osmode" 512)
    (INITGET "X")
    (setq pt1 (getpoint a (strcat "\nSCL=" (RTOS SCL 2 2) "-Show Direction of
    break or eXit: Nea

    ")))
    (if (= PT1 "X")
    (progn
    (*error*)
    (exit)
    )
    )
    (setvar "osmode" 0)
    (setq b (angle a pt1))
    (setq c (* SCL 0.125))
    (COMMAND "BREAK" PT1 "F" (POLAR A B (- C)) (POLAR A B C))
    (setvar "orthomode" omode)
    (setvar "osmode" osmod)
    (setvar "autosnap" 63)
    )
     
    ~Jeff~, Sep 29, 2004
    #3
  4. ~Jeff~

    Jeff Mishler Guest

    Try revising the first part of the routine to this:
    Code:
    (defun C:BK (/ omode a b c pt1 scl vpobj)
    (vl-load-com)
    (defun *error* ()
    (setvar "orthomode" omode)
    (setvar "osmode" osmod)
    (princ "\nError detected...aborting")
    (terpri)
    )
    (or (and (= (getvar "tilemode") 1)
    (setq SCL (getvar "LTSCALE"))
    )
    (and (= :vlax-true (vla-get-mspace
    (vla-get-activedocument
    (vlax-get-acad-object))))
    (setq vpObj (vla-get-activepviewport
    (vla-get-activedocument
    (vlax-get-acad-object))))
    (setq SCL (/ 1 (vla-get-customscale vpObj)))
    )
    )
    ;(if (= SCL nil) (setq SCL (getvar "LTSCALE")))
    ;;the remainder of the routine is unchanged.
    

    --
    Jeff
    check out www.cadvault.com
     
    Jeff Mishler, Sep 29, 2004
    #4
  5. ~Jeff~

    ~Jeff~ Guest

    THANKS

    --
    ~Jeff~
    [Microsoft Windows XP Pro, AutoCAD 2004, 2.6 Ghz]
     
    ~Jeff~, Sep 30, 2004
    #5
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.