Jump to content

Create New Layout Tab Without Default Viewport


Bill Tillman

Recommended Posts

I have a small LISP program and it creates a new Layout Tab and gives it a name.

(command "._LAYOUT" "_N" "8.5x11")

Trouble is it comes with it's own default viewport which I really don't need. In fact, this default viewport gets smack dab in the way of a new viewport I create on this new layout tab. Is there a method to not have the default viewport created in the first place or if not, how could I delete it once the new layout tab is established?

Link to comment
Share on other sites

Okay, ask and ye shall receive. The searches I did were coming up with zilch until I changed the phrase "delete viewport" to "remove viewport" and that yielded this:

(vlax-for Obj (vla-get-PaperSpace (vla-get-ActiveDocument (vlax-get-Acad-Object)))
   (if (= (vla-get-ObjectName Obj) "AcDbViewport")
     (vla-Delete Obj)
     )
   )

which did the trick. It doesn't actually create a new layout tab without a viewport but it does remove the default one that came with it. And that's all I was really after.

Link to comment
Share on other sites

First thing, you can preclude the creation of a new 'default' Viewport in Options, Display tab, Layout Elements area, un-check "Create viewport in new layouts."

 

Second, be mindful that the first Viewport in Viewports Collection Object is the Paperspace Viewport itself... I do forget if that is also iterated over in the method you posted, or not. Just wanted to mention just in case.

 

Cheers

Link to comment
Share on other sites

Thanks, and I didn't think about that setting in the options until you mentioned it. This is a down and dirty task that's going to be run on about 600 drawing files. So we can make the change only while this work is being done.

Link to comment
Share on other sites

Thanks, and I didn't think about that setting in the options until you mentioned it. This is a down and dirty task that's going to be run on about 600 drawing files. So we can make the change only while this work is being done.

 

If you find you need the option with/without down the road, you can simply create a duplicate production Profile, with the setting turned off for future, similar automations. Just launch application with the appropriate startup switch. :thumbsup:

 

Cheers

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