CivilTechSource Posted 20 hours ago Posted 20 hours ago I have a Key Plan Viewport showing the wider site plan and I have multiple viewports showing specific areas of the wider site plan (Insets). Has it been done or attempted to create a lisp that will prompt the user to select the Key Plan Viewport, and then select the other Insets and show the Inset extents on the Key Plan Viewport as Rectangles?+ Quote
CyberAngel Posted 17 hours ago Posted 17 hours ago The Architecture system has a mechanism for creating Views, which you can then assign to viewports. I assume (but don't know) that you can show those Views in other viewports, such as the key plan you describe, and label them. All of that would be really handy in my job, but Civil doesn't include that mechanism for some reason. I guess you'd have to create a new object type, View. It would include the name, the bounds, and the UCS for one sheet. You'd have the ability to create a viewport, capture the bounds, and annotate it with the name and the scale. You could also apply one view to another, as with the insets on the key map. To be even more helpful, there'd be a new category in the Prospector so you could manage all those views. And maybe a layer state for the viewports. Quote
dan20047 Posted 17 hours ago Posted 17 hours ago Here is my code which draws mspace rectangles for viewport extents. It's missing subroutines prefixed with XYZ, but the main code for the coordinates can be used. ;;; Draw rectangle inside viewport limits (defun c:RTV (/ pt1 pt2 dy dx vcx vcy pt3x pt3y pt4x pt4y) (XYZ-ERROR-INIT (list (list "clayer" (getvar "clayer") "cmdecho" 0) T)) ;do list of variables to be set/reset (if (not XYZ_LAY_VPORT) (setq XYZ_LAY_VPORT (getvar "clayer"))) (if (not (tblsearch "LAYER" XYZ_LAY_VPORT)) (command "-layer" "make" XYZ_LAY_VPORT "color" "7" "" "plot" "no" "") ;make layer if it doesn't exist ) (command "-layer" "thaw" XYZ_LAY_VPORT "on" XYZ_LAY_VPORT "set" XYZ_LAY_VPORT "") ;thaw layer whether it exists or not (if (or (= 1 (caar (Vports))) ;determine if in mspace vport (= 1 (getvar "tilemode"))) (progn (XYZ_rectangle nil (getvar "vsmin") (getvar "vsmax")) (command "scale" (entlast) "" (getvar "viewctr") (/ (getvar "viewsize") (- (cadr (getvar "vsmax")) (cadr (getvar "vsmin")))) ) ) (progn ;if in mspace vport (setq pt1 (cadr (car (vports))) ;vport corners pt2 (caddr (car (vports))) dy (distance pt1 (list (car pt1) (cadr pt2))) ;height of vport dx (distance pt2 (list (car pt1) (cadr pt2))) ;width of vport vcx (car (getvar "viewctr")) ;x pt of vport center vcy (cadr (getvar "viewctr")) ;y pt sclf (/ (getvar "viewsize") dy) ;vport scale factor pt3x (- vcx (* 0.5 dx sclf)) ;points of vport extent pt3y (- vcy (* 0.5 dy sclf)) pt4x (+ vcx (* 0.5 dx sclf)) pt4y (+ vcy (* 0.5 dy sclf)) ) (XYZ_rectangle nil (list pt3x pt3y) (list pt4x pt4y)) ;if not in mspace use virtual viewport limits ) ) (princ "\nPline rectangle drawn to viewport limits") (XYZ-ERROR-RESTORE) ) Quote
BIGAL Posted 15 hours ago Posted 15 hours ago Like @dan20047 I make rectangs and then make a layout matching that rectang. Where I worked our title block was fixed, so the viewport in a layout was based on the matching rectang at a scale. The rectangs can be rotated and the viewport will be Twisted to match. You can pick a Viewport and get its info then draw a rectang that matches in paperspace then do a simple CHSPACE, all done. Look at these 3 values. Just take 1/2 the 40 and 41 can work out the corners. (defun c:vp2model ( / vp cp d1 d2 p1 p2 lay) (command "pspace") (setq vp (entget (car (entsel "\nPick the viewport ")))) (setq cp (assoc 10 vp)) (setq cp (list (cadr cp)(caddr cp))) (setq lay (cdr (assoc 8 vp))) (setq d1 (/ (cdr (assoc 40 vp)) 2.0)) (setq d2 (/ (cdr (assoc 41 vp)) 2.0)) (setq p1 (mapcar '+ cp (list (- d1) (- d2) 0.0))) (setq p2 (mapcar '+ cp (list d1 d2 0.0))) (setvar 'clayer lay) (command "Rectang" p1 p2) (command "chspace" (entlast) "" ) (command "pspace") (princ) ) A question will the layouts have more than one viewport as you need to identify which viewport has been selected. Quote
CivilTechSource Posted 2 hours ago Author Posted 2 hours ago @BIGAL So in principal I agree with your approach draw rectangles along the selected viewports, send to model space and then select the key plan to bring them back to paperspace. The problem I faced I stumbled across is that you can not define which viewport to CHspace without the user selecting the viewports. So my idea of the optimal workflow/lisp would look something like this: 1. Select Key Plan Viewport 2. Select Insert Viewports 3. Draw Rectangle on all Inset viewports 4. Send Rectangles to ModelSpace of each Inset viewport (So they are at the right scale). 5. Bring all rectangles to PaperSpace through the Key Plan Viewport. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.