View Full Version : Obtain the VIEW coordinates via LISP
Clinton.Hill
2007-06-13, 04:51 PM
How can the VIEW coordinates be obtained?
I currently define my layout-based plotting by VIEW.
As I had to experiment several times to get the hardcopy centered on a particular printer (definitely not WYSIWYG), I did not record them and was wondering how to obtain these programmatically.
abdulhuck
2007-06-14, 09:07 AM
Have a look at the system variables: VIEWCTR, VIEWSIZE, VSMAX, VSMIN
I would prefer to utilize the title block.
Regards
AH
Tom Beauford
2007-06-14, 01:33 PM
This dialog box routine displays a list of saved views from whichever space you're in. Pick a view, then the 'OK' button and it draws the view rectangle on the current layer. Helped me do the macros I showed you on the WAUN site. ;| Draw border of saved View
by: Tom Beauford
Tombu@LeonCountyFL.gov
Leon County Public Works Engineering Section
^P(or C:ViewBox (load "ViewBox.lsp"));ViewBox
(load "ViewBox.lsp") ViewBox
=========================================================|;
(defun C:ViewBox ( / TblLst x Idx# txt id ENT EL vtw ctr tgt pt pt1 pt2)
(setq TblLst ()
x (tblnext "VIEW" T)
)
(if(or(/= (getvar "CVPORT") 1)(= (getvar "CTAB") "Model")) ;MS
(while (and x (/= (logand 1 (cdr (assoc 70 x))) 0))(setq x (tblnext "VIEW")))
(while (and x (= (logand 1 (cdr (assoc 70 x))) 0))(setq x (tblnext "VIEW")))
)
(while x ; Build table
(if(or(/= (getvar "CVPORT") 1)(= (getvar "CTAB") "Model")) ;MS is current
(if (= (logand 1 (cdr (assoc 70 x))) 0) ;if view is MS
(setq TblLst (cons (cdr (assoc 2 x)) TblLst)) ;add it to list.
);if
(if (= (logand 1 (cdr (assoc 70 x))) 1) ;if view is PS
(setq TblLst (cons (cdr (assoc 2 x)) TblLst)) ;add it to list.
);if
)
(setq x (tblnext "VIEW"))
);while
(if (> (length TblLst) (getvar "MAXSORT"))
(setvar "MAXSORT" (+ 200 (length TblLst)))
); if
(setq TblLst (acad_strlsort TblLst)
; Idx# (- (length TblLst)(length(member TblEnt TblLst)))
Idx# 1
)
(if (= (getvar "cmddia") 0)
(progn
(foreach N TblLst (print N))
(setq txt "\nEnter VIEW Name: ")
(while (not (member (setq TblNam (strcase (getstring txt)))TblLst))
(princ "\nThat is not a valid style: ")
); while
); progn
(progn
(setq id (load_dialog "chs.dcl"))
(new_dialog "chs" id)
(start_list "styles")
(mapcar 'add_list TblLst)
(end_list)
(set_tile "styles" (itoa Idx#))
(action_tile "styles" "(if $value(setq Idx# (atoi $value)))")
(mode_tile "styles" 0)
(mode_tile "styles" 2)
(start_dialog)
(done_dialog)
; (setq TblNam (nth Idx# TblLst))
(setq ENT (tblobjname "VIEW" (nth Idx# TblLst))
EL (entget ENT)
vtw (cdr (assoc 50 EL))
ctr (cdr (assoc 10 EL))
tgt (cdr (assoc 12 EL))
ctr (mapcar '+ tgt ctr)
pt (list (cdr (assoc 41 EL))(cdr (assoc 40 EL)))
pt (mapcar '(lambda (x) (/ x 2)) pt)
pt1 (mapcar '- ctr pt)
pt2 (mapcar '+ ctr pt)
)
(command "rectang" pt1 pt2)
(princ)
); progn
); if
); defun
This dcl file courtisy of Peter Jamtgaard. I use it for about a dozen routines.
chs : dialog {
// label="**Available Styles**";
:list_box { key="styles";
height=10; //from 5
width=50; //from 38
allow_accept = true;
}
ok_only;
}
Clinton.Hill
2007-06-14, 01:33 PM
I would prefer to utilize the title block.I am sorry but I miss the point about your preference. Please enlighten me here.
Thanks for the valuable variables.
Say that fast ten times!;)
Clinton.Hill
2007-06-14, 01:45 PM
Hey Tom,
Yes sir! You got me. Well, I know at least two WAUN members here.
You must have posted here as I was replying to an earlier response.
Thanks a bunch for your code as I was hoping for more to munch on!
With AutoCAD, I have pursued a method to produce consistent plots.
I think your benevolence will reap big rewards in finally achieving this goal.
I will keep you posted.
abdulhuck
2007-06-16, 08:05 PM
Hey Tom,
Yes sir! You got me...Clinton,
Really sorry to mis-read your requirement. That's why I wrote about the title block.
Regards,
AH
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.