스크린 좌표 구하기
I need a lisp for getting current display corner coordinate
i want a lisp or lisp code for getting display coordinate. sample screenshot attached.
forums.autodesk.com
(defun KM:SCR ( / viewCtr viewSize screenSize viewLength )
(setq viewCtr '() screensize '() p0 '(0 0) p1 '(0 0))
(setq viewsize 0.0 viewLength 0.0)
(setq viewCtr (getvar "VIEWCTR"))
(setq viewSize (getvar "VIEWSIZE"))
(setq screenSize (getvar "SCREENSIZE"))
(setq viewLength (* viewSize (/ (car screenSize) (cadr screenSize))))
;;
(setq p0 (list (- (car viewCtr) (/ viewLength 2)) (- (cadr viewCtr) (/ viewSize 2))))
(setq p1 (list (+ (car viewCtr) (/ viewLength 2)) (+ (cadr viewCtr) (/ viewSize 2))))
(princ)
)
there 3 system variables that can help you get what you want:
1) VIEWCTR - stores the coordinates of center of your screen (system)
2) VIEWSIZE - stores the height (in drawing units ) of your screen (system)
3) SCREENSIZE - stores the X,Y in pixels of the screen (system)
4) viewLength - calculated the width (in drawing units ) of your screen
없는게 없군요!!
반응형
'autocad' 카테고리의 다른 글
| location acad.cui (0) | 2025.03.11 |
|---|---|
| 임의의 시트를 출력하기 위한 도각 선택 모듈 (0) | 2025.01.23 |
| print dxf (0) | 2025.01.21 |
| get a string from the text (0) | 2025.01.21 |
| Copy Block Definition (0) | 2025.01.13 |