std-pix->units, std-units->pix


Synopsis

(std-pix->units <pix>) ; convert pixel to drawing units

(std-units->pix <num>) ; convert drawing units to pixel

Description

Those two functions convert between AutoCAD drawing units (which are just "unitless" numbers) and pixel on the monitor, dependent on the graphics resolution and the size of the window and the view.

Pixel are used in object picks and selections.

For example you often need to select a element on a point relative 3 pixel to the right.

Example

;;; find the next element to the right, not foolproof!

;;; it might not terminate.

(defun rightmost-element (pt / picksize new-pt pick)
  (setq picksize (std-pix->units (getvar "PICKBOX")))
  (while (not (setq pick (ssget
         (setq new-pt (polar pt 0 picksize)))))
    (setq pt new-pt)
  )
  pick
)

Arguments

pix: a positive integer number.

num: any number.

Return Value

Any number.

Side Effects

None.

Module

(std-require 'STDTBL)

Defined in STDTBL