Jump to content

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


Recommended Posts

Posted (edited)

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

Can anyone please help?

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

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
Posted

It's working very well.

Thank you very much.

Posted
39 minutes ago, w64bit said:

It's working very well.

Thank you very much.

Glad to help 🍻

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