rcb007 Posted July 11, 2024 Posted July 11, 2024 I have two horizontal viewports in model. If I have the bottom zoom scale to whatever it is. How could I apply it to the top view? Within Paperspace Viewports, using the match properties would work. Just not sure how I to apply it. Thanks for your help. Quote
CyberAngel Posted July 12, 2024 Posted July 12, 2024 See this page. CADTutor: The gift that keeps on giving. I don't know if you can duplicate the exact same zoom factor from one window to another. If you're looking at the same location in both windows, you might be able to use the same view, but I don't know how you would verify that they're the same size. There doesn't seem to be a way to read the zoom factor from a given window, and there are too many variables to get an accurate answer. Another suggestion was to use Zoom Center on the same point with the same magnification. Which doesn't help with your situation because you have to change both windows. So there's a couple of ideas that don't work. Maybe someone else can jump off to one that does. Quote
marko_ribar Posted July 16, 2024 Posted July 16, 2024 (edited) For me this bigger code works well... Tell us your opinions... ; Copia la scala di una finestra dello spazio carta ; ; alle altre finestre selezionate. ; ; 07/11/2014 - Gian Paolo Cattaneo ; ; 25/11/2014 - vers.2 (utilizzo finestre poligonali) ; ; 15/07/2024 - Transalte English (defun c:copyviewportscale ( / *error* LM:listbox fs ce sc n k fd finestre ) (or (not (vl-catch-all-error-p (vl-catch-all-apply (function vlax-get-acad-object) nil))) (vl-load-com)) (defun *error* ( m ) (if (= 8 (logand 8 (getvar (quote undoctl)))) (if command-s (command-s "_.undo" "_e") (vl-cmdf "_.undo" "_e") ) ) (if m (prompt m) ) (princ) ) ;; List Box - Lee Mac ;; Displays a DCL list box allowing the user to make a selection from the supplied data. ;; msg - [str] Dialog label ;; lst - [lst] List of strings to display ;; bit - [int] 1=allow multiple; 2=return indexes; ;; sel - [lst] Preselect indice ;; Returns: [lst] List of selected items/indexes, else nil (defun LM:listbox (msg lst bit sel / dch des tmp rtn) (cond ((not (and (setq tmp (vl-filename-mktemp nil nil ".dcl")) (setq des (open tmp "w")) (write-line (strcat "listbox:dialog{label=\"" msg "\";spacer;:list_box{key=\"list\";multiple_select=" (if (= 1 (logand 1 bit)) "true" "false" ) ";width=50;height=15;}spacer;ok_cancel;}" ) des ) (not (close des)) (< 0 (setq dch (load_dialog tmp))) (new_dialog "listbox" dch) ) ) (prompt "\nError Loading List Box Dialog.") ) (t (start_list "list") (foreach itm lst (add_list itm)) (end_list) (setq rtn (set_tile "list" (cond ((= (type sel) 'int) (itoa sel)) ((listp sel) (apply 'strcat (mapcar '(lambda (x) (strcat (itoa x) " ")) sel) ) ) (t "0") ) ) ) (action_tile "list" "(setq rtn $value)") (setq rtn (if (= 1 (start_dialog)) (if (= 2 (logand 2 bit)) (read (strcat "(" rtn ")")) (mapcar '(lambda (x) (nth x lst)) (read (strcat "(" rtn ")")) ) ) ) ) ) ) (if (< 0 dch) (unload_dialog dch) ) (if (and tmp (setq tmp (findfile tmp))) (vl-file-delete tmp) ) rtn ) (vl-cmdf "_.undo" "_be") (if (= (getvar (quote tilemode)) 1) (setvar (quote ctab) (car (LM:listbox "Choose Layout..." (vl-remove "Model" (layoutlist)) 0 ""))) ) (setq fs (car (entsel "\nPick Source window (LWPOLYLINE or VIEWPORT)..."))) (cond ( (eq (cdr (assoc 0 (entget fs))) "VIEWPORT") (setq sc (vla-get-CustomScale (vlax-ename->vla-object fs))) (vl-cmdf "_.MSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) (setq ce (getvar (quote viewctr))) (vl-cmdf "_.PSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) ) ( (eq (cdr (assoc 0 (entget fs))) "LWPOLYLINE") (setq fs (vla-get-ActivePViewport (vla-get-ActiveDocument (vlax-get-acad-object)))) (setq sc (vla-get-CustomScale fs)) (vl-cmdf "_.MSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) (setq ce (getvar (quote viewctr))) (vl-cmdf "_.PSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) ) ) (princ "\nSelect Target window(s) (LWPOLYLINE(s) or VIEWPORT(s))...") (setvar (quote ctab) (car (LM:listbox "Choose Layout..." (vl-remove "Model" (layoutlist)) 0 ""))) (vl-cmdf "_.PSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) (if (setq finestre (ssget (list (cons 0 "VIEWPORT,LWPOLYLINE")))) (repeat (setq n (sslength finestre)) (setq fd (ssname finestre (setq n (1- n)))) (setq k (1- (cdr (assoc 69 (entget (vlax-vla-object->ename (vla-get-ActivePViewport (vla-get-ActiveDocument (vlax-get-acad-object))))))))) (cond ( (eq (cdr (assoc 0 (entget fd))) "VIEWPORT") (vl-cmdf "_.MSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) (setvar (quote cvport) (cdr (assoc 69 (entget fd)))) (vla-put-CustomScale (vlax-ename->vla-object fd) sc) (vl-cmdf "_.ZOOM" "_C" "_non" ce) (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) (vl-cmdf "_.PSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) ) ( t (vl-cmdf "_.MSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) (vl-catch-all-apply (function setvar) (list (quote cvport) (setq k (1+ k)))) (vla-put-CustomScale (vla-get-ActivePViewport (vla-get-ActiveDocument (vlax-get-acad-object))) sc) (vl-cmdf "_.ZOOM" "_C" "_non" ce) (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) (vl-cmdf "_.PSPACE") (while (< 0 (getvar (quote cmdactive))) (vl-cmdf "") ) ) ) ) ) (*error* nil) ) Edited July 18, 2024 by marko_ribar Quote
rcb007 Posted July 18, 2024 Author Posted July 18, 2024 Thank you everyone for your ideas. Within Layout Tab / Paperspaces I think your routines work. When the active view is the top view (model tab), and whatever that zoomscale seems to be. Then click the bottom view and make it the same zoomscale (model tab). Quote
marko_ribar Posted July 18, 2024 Posted July 18, 2024 And when you change zoom scale in bottom viewport, it reflects in top one... So you want to see zooming at both viewports in the same time you are zooming in either one viewport... But why are you working with 2 viewports in model space in the first place? Isn't that somewhat cumbersome? Quote
rcb007 Posted July 18, 2024 Author Posted July 18, 2024 its for civil3d. usually have a profile view in the top view and an alignment in the bottom. If I were to click on the alignment station, it zooms to the place in profile view. Quote
marko_ribar Posted July 18, 2024 Posted July 18, 2024 (edited) Only thing I can help you is to tell you that you get used to work with single viewport in Model space and when you want to change view, you use "ViewsNoZoom.lsp" posted here in attachment... It was long time ago since I coded it, so maybe you find better approaches to make it function with real NAVCUBE and not created 3DSOLID cube like coded in *.lsp... But it's all up to you... You'll get an idea why it was coded and perhaps the way it was written... HTH. M.R. ViewsNoZoom.lsp Edited July 20, 2024 by marko_ribar Quote
marko_ribar Posted July 19, 2024 Posted July 19, 2024 @rcb007 I've changed some small lacks in my uploaded *.lsp... I don't know if it helped you, so I am just wanting to see your feedback... Regards, take care... M.R. Quote
marko_ribar Posted July 20, 2024 Posted July 20, 2024 On 7/18/2024 at 3:15 PM, rcb007 said: its for civil3d. usually have a profile view in the top view and an alignment in the bottom. If I were to click on the alignment station, it zooms to the place in profile view. If it was me that have civil3d, I'd try to find out all features of that product... When you say alignment station, I suppose it's built-in object (or I am wrong - it was drawn from LINES/POLYLINES...)... If it's built-in object, why not select it and just change into profile view and do "ZOOM" "OBJECT" option, or try double click-ing it, or something else within ZOOM Toolbar... Still you haven't comment if posted "ViewsNoZoom.lsp" is of some help... I don't want to pull out your thoughts from your head if you think that that's strictly confidential... (How do you plan to get some help, if you don't say what is torturing you...) Quote
BIGAL Posted July 20, 2024 Posted July 20, 2024 In Civil Site design an add on for CIV3D or Bricscad you can have a plan view, a design long section and cross section view all open at same time. In the long section picking a point shows that point in the plan view, as you move across the long section the pointer moves, modifying the vertical design updates the cross section. So all 3 views interactive. This request was asked over at Autodesk/Forums sorry don't know link. Need to google maybe 2 months ago. Quote
rcb007 Posted July 22, 2024 Author Posted July 22, 2024 So sorry for not getting back to you. Marko, I did get a chance to test your routine. I ran it and it prompted me with a 3d cube to pick. Then it changed the current view to match. Here is the routine. Maybe this might help clear up some of the confusion on my part. Again, thanks for your time and help;) (command "_.ZOOM" "_C" (list x y) 100);; Need to find out how to have the same zoom scale as the originalview in model. (defun c:ZAP (/ ent entname align profview startstation endstation midstation pnt x y sta elev pickpt originalViewport) ;;https://forums.autodesk.com/t5/civil-3d-customization/lisp-routine-select-alignment-then-zoom-to-profile/td-p/9349483 (command "_.undo" "begin") (vl-load-com) (command "_AeccStationTrackerAll") (setq originalViewport (getvar "CVPORT")) (setq ent (entsel "\nSelect Alignment or Profile View: ")) (if ent (progn (setq entname (cdr (assoc 0 (entget (car ent))))) (setq pickpt (cadr ent)) ;; Get the point coordinates of the selection (cond ((= entname "AECC_ALIGNMENT") (setq align (vlax-ename->vla-object (car ent))) (setvar "CVPORT" 3) (setq profview (vlax-get align 'profileviews)) (if (vlax-get-property profview 'Count) (progn (setq profview (vlax-invoke profview 'item 0)) (setq profview_max (vlax-get-property profview 'ElevationMax)) (setq profview_min (vlax-get-property profview 'ElevationMin)) (setq elev (+ (/ (- profview_max profview_min) 2.0) profview_min)) (vlax-invoke-method align 'StationOffset (car pickpt) (cadr pickpt) 'sta 'off) (vlax-invoke-method profview 'FindXYAtStationAndElevation sta elev 'x 'y) (command "_.ZOOM" "_C" (list x y) 100);; Need to find out how to have the same zoom scale as the originalview in model. (setvar "CVPORT" originalViewport) ) ) ) ((= entname "AECC_PROFILE_VIEW") (setq profview (vlax-ename->vla-object (car ent))) (vlax-invoke-method profview 'findstationandelevationatxy (car pickpt) (cadr pickpt) 'sta 'elev) (setq startstation (vlax-get profview 'stationstart) endstation (vlax-get profview 'stationend) midstation (/ (+ startstation endstation) 2) ) (setq align (vlax-get profview 'parent)) (vla-highlight align :vlax-true) (if (and (> sta startstation) (< sta endstation)) (setq midstation sta) ) (vlax-invoke-method align 'pointlocation midstation 0 'x 'y) (setq pnt (list x y)) (prompt (strcat "\nMidstation: " (rtos midstation 2 2))) (prompt (strcat "\nAlignment point: " (rtos x 2 2) ", " (rtos y 2 2))) (setvar "CVPORT" 2) (command "_.ZOOM" "_C" (list x y) 100);; Need to find out how to have the same zoom scale as the originalview in model. (setvar "CVPORT" originalViewport) ) (t ) ) ) ) (command "_.undo" "end") (princ) ) Thank you for sharing that BIGAL. I prob, need to look into that;) 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.