Results 1 to 6 of 6

Thread: Obtain the VIEW coordinates via LISP

  1. #1
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Post Obtain the VIEW coordinates via LISP

    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.

    Yours,

    Clint
    Hill

    ------------------
    CAD Systems Operation and Management
    Chemical Plant Process + Mechanical Design Focus Areas

  2. #2
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Default Re: Obtain the VIEW coordinates via LISP

    Have a look at the system variables: VIEWCTR, VIEWSIZE, VSMAX, VSMIN

    I would prefer to utilize the title block.

    Regards
    AH

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,681
    Login to Give a bone
    0

    Default Re: Obtain the VIEW coordinates via LISP

    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.
    Code:
     ;| 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.
    Code:
     chs : dialog {
    //  label="**Available Styles**";
      :list_box { key="styles"; 
    			  height=10;  //from 5
    			  width=50;  //from 38
    			  allow_accept = true;
    			}
      ok_only;
    }

  4. #4
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Default Re: Obtain the VIEW coordinates via LISP

    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!
    Last edited by Clinton.Hill; 2007-06-14 at 11:35 AM. Reason: Clarify
    Yours,

    Clint
    Hill

    ------------------
    CAD Systems Operation and Management
    Chemical Plant Process + Mechanical Design Focus Areas

  5. #5
    I could stop if I wanted to CEHill's Avatar
    Join Date
    2006-05
    Location
    TN
    Posts
    327
    Login to Give a bone
    0

    Default Re: Obtain the VIEW coordinates via LISP

    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.
    Yours,

    Clint
    Hill

    ------------------
    CAD Systems Operation and Management
    Chemical Plant Process + Mechanical Design Focus Areas

  6. #6
    I could stop if I wanted to
    Join Date
    2015-08
    Posts
    263
    Login to Give a bone
    0

    Default Re: Obtain the VIEW coordinates via LISP

    Quote Originally Posted by Clinton.Hill
    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

Similar Threads

  1. Replies: 14
    Last Post: 2011-07-13, 05:54 PM
  2. Replies: 5
    Last Post: 2010-09-24, 05:55 PM
  3. Obtain Cursor Screen Coordinates
    By Ken H in forum AutoLISP
    Replies: 16
    Last Post: 2010-09-03, 03:43 PM
  4. Obtain Section View Band Information from Point Codes
    By civil3d.wishlist1941 in forum Civil 3D Wish List
    Replies: 0
    Last Post: 2008-05-22, 10:05 PM
  5. Tracing polyline coordinates using map/lisp
    By bprabhakar001 in forum AutoLISP
    Replies: 1
    Last Post: 2006-06-21, 11:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •