Jump to content

Recommended Posts

Posted

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

  • 2 weeks later...
Posted

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)
)

 

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...