Jump to content

Delete viewport in a layout containing only one viewport (and nothing else)


w64bit
 Share

Recommended Posts

I am trying to delete the viewport on a layout containing only one viewport (and nothing else).

Can anyone please help?

Edited by w64bit
Link to comment
Share on other sites

  • w64bit changed the title to Delete viewport in a layout containing only one viewport (and nothing else)

Try this .. does not check for locked layers:

(defun c:foo (/ s)
  (foreach l (layoutlist)
    (and (setq s (ssget "_X" (list (cons 410 l))))
	 (= 2 (sslength s))
	 (setq s (mapcar 'cadr (ssnamex s)))
	 (= "VIEWPORT" (cdr (assoc 0 (entget (car s)))) (cdr (assoc 0 (entget (cadr s)))))
	 (mapcar 'vla-delete (mapcar 'vlax-ename->vla-object s))
    )
  )
  (princ)
)

 

  • Like 1
Link to comment
Share on other sites

39 minutes ago, w64bit said:

It's working very well.

Thank you very much.

Glad to help 🍻

Link to comment
Share on other sites

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

 Share

×
×
  • Create New...