AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Last week I showed you how you can draw on your screen using the (grdraw) function. Well, I've had a couple of e-mails from people asking what possible use this could be?
Well here's one :

;CODING STARTS HERE

;Show limits on screen
;This routine draws a rectangle corresponding to the current settings of LIMMIN and LIMMAX.
;The rectangle is erased by a redraw/regen or by running the routine again.

(defun C:LR (/ pt1 pt2 r1 r2)
(setq pt1 (getvar "LIMMIN")
pt2 (getvar "LIMMAX")
)
(grvecs (list 256 (list (car pt1)(cadr pt2)) pt2
256 (list (car pt2)(cadr pt1)) pt1
256 pt1 (list (car pt1)(cadr pt2))
256 pt2 (list (car pt2)(cadr pt1))
)
)
(grdraw pt1 pt2 -1)
(grdraw (list (car pt1) (cadr pt2))
(list (car pt2) (cadr pt1))
-1
)
(princ "Limit rect info:")
(setq r1 (rtos (car (getvar "limmin")))
r2 (rtos (cadr (getvar "limmin")))
)
(prompt (strcat "\nLower left: " r1 "," r2))
(setq r1 (rtos (car (getvar "limmax")))
r2 (rtos (cadr (getvar "limmax")))
)
(prompt (strcat "\nUpper right: " r1 "," r2))
(if (= (getvar "LIMCHECK") 0)
(setq linf "off")
(setq linf "on")
)
(prompt (strcat "\nLimits are " linf))
(princ)
)

;CODING ENDS HERE

I "stole" this from Stig Madsen.

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website