mhupp Posted August 30, 2021 Posted August 30, 2021 This is a weird one. Trying to fig out how to make 8 view ports in model space. I would like the cvports to be # like this 2 6 3 7 4 8 5 9 Trying to do this so i can see tables in the drawing that are spaced apart with out having to pan/zoom around to each one. Attached is an example drawing. as you can see the cvports are mixed up. vports si to change it to a single viewport. Drawing1.dxf Quote
mhupp Posted September 7, 2021 Author Posted September 7, 2021 This is what i have come up with. the only problem is the first zoom to object doesn't seem to be working. might be a BricsCAD error or something. have to come back and zoom object again after the repeat is over for everything to work correctly. (defun C:foo (/ i ss9 vlst c) (if (= tlst nil) (progn (setq SS9 (ssget "_X" '((0 . "ACAD_TABLE") (8 . "TEXT") '(410 . "Model")))) (setq tlst (vl-remove-if 'listp (mapcar 'cadr (ssnamex SS9)))) (setq tlst (vl-sort tlst '(lambda (a b) (if (equal (car (cdr (assoc 10 (entget a)))) (car (cdr (assoc 10 (entget b)))) 1e-6) (> (cadr (cdr (assoc 10 (entget a)))) (cadr (cdr (assoc 10 (entget b))))) (< (car (cdr (assoc 10 (entget a)))) (car (cdr (assoc 10 (entget b))))) ) ) ) ) ) ) (if (= (length (vports)) 1) (progn (vl-cmdf "_.vports" "4") (vl-cmdf "_.vports" "2" "H") (setvar 'cvport 3) (vl-cmdf "_.vports" "2" "H") (setvar 'cvport 4) (vl-cmdf "_.vports" "2" "H") (setvar 'cvport 5) (vl-cmdf "_.vports" "2" "H") ) (progn (vl-cmdf "_.vports" "SI") (vl-cmdf "_.Zoom" "E") (vl-cmdf "_.vports" "4") (vl-cmdf "_.vports" "2" "H") (setvar 'cvport 3) (vl-cmdf "_.vports" "2" "H") (setvar 'cvport 4) (vl-cmdf "_.vports" "2" "H") (setvar 'cvport 5) (vl-cmdf "_.vports" "2" "H") ) ) (setq vlst '(8 4 6 2 9 5 7 3) i 0 ) (if (> (length tlst) 8) (setq c 8) (setq c (length tlst)) ) (repeat c (setvar 'cvport (nth i vlst)) (vl-cmdf "_.Zoom" "OB" (nth i tlst) "") (setq i (1+ i)) ) (setvar 'cvport 8) (vl-cmdf "_.Zoom" "OB" (nth 0 tlst) "") (setq tlst (LM:RemoveItems '(0 1 2 3 4 5 6 7) tlst)) (princ) ) ;;--------------------=={ Remove Items }==--------------------;; ;; ;; ;; Removes the items at specified indexes from a list ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; ;; Arguments: ;; ;; items - list of zero-based indexes to remove ;; ;; lst - list from which items are to be removed ;; ;;------------------------------------------------------------;; ;; Returns: List with items removed ;; ;;------------------------------------------------------------;; (defun LM:RemoveItems (items lst / i) (setq i -1) (vl-remove-if '(lambda (x) (member (setq i (1+ i)) items)) lst) ) 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.