Jump to content

test for Layout - VB.Net


dbroada

Recommended Posts

I have a "batch plot" routine that creates a script to plot a large number of files which works perfectly well. I am now considering moving this to a VB.Net routine so that it can trap a few more errors than are possible with a script.

 

I'm currently thinking aloud and this may just be a blind alley but one thing has occured to me. At this office, we NEVER use paperspace. However we do occassionaly get drawings from elsewhere that do use paperspace. What I would like is my routine to plot the Modelspace and (maybe optionally) plot the layouts if there is anything worth plotting.

 

My question is how do I decide. I know I can check my block collection for ModelSpace so I assume all layouts will be there too. Would you look for a Lauout with a viewport or a layout with an object?

 

And how would I do that?

Link to comment
Share on other sites

That is taking an age to open but what I saw was how to print from paperspace. While I will need to know that in the future what I need to know now is how to determine IF it is worth printing from paperspace. While waiting for it to opem, do the following pages answer that?

Link to comment
Share on other sites

The first part of the section deals in detail with plotting from Model Space with example code for doing it and the last part is a short section on plotting from Paper Space.

Link to comment
Share on other sites

Thanks tyke. Looks like I should check that a viewport exists within a layout then. I think there is enough info there but its not imediately as straight forward as I had hoped. Never mind, its not pressing just yet. :)

Link to comment
Share on other sites

Thanks tyke. Looks like I should check that a viewport exists within a layout then. I think there is enough info there but its not imediately as straight forward as I had hoped. Never mind, its not pressing just yet. :)

 

Straight forward is it not, but possible.

 

When you say you only plot from model space do you have empty layouts or no layout tabs at all (I'm not even sure if you can delete all layout tabs! - I just tried it and you must have at least one layout tab). So loop through all the layouts present and check for viewports.

Link to comment
Share on other sites

I don't have any layout tabs present but that's not to say they're not there.

 

I assume viewports have to be put there, that they don't spontaneously arrive without assistance. Therefore if I can find a viewport I should plot the layout.

Link to comment
Share on other sites

You can have a layout without a viewport (although its meaningless), but to plot a drawing in model space from a layout you must have a viewport in that paper space layout. You can also have viewports in model space, so the presence of viewports is no guarantee that there is something plotable on a layout. It is often the case when a drawing is created from a template, that the template has several layout tabs with different size sheets for plotting, but it doesn't mean all or any of the layouts have been configured for this drawing.

 

Sorry for throwing so many problems into the ring, but I really think that you have an enormous task ahead of you. IMHO if these drawings crop up as seldom as you said, I would create a log file and every time you find a file with a layout in paper space, do not plot it but write it's details to the log file and deal with it afterwards manually. Or for these special cases develop a separate module for investigating them and dealing with them. I use log files a lot for controlling events and making it possible for me to keep an eye on what is going on without the user noticing it or even needing to bother about it.

Link to comment
Share on other sites

I'm more inclined to look at it the other way. I'll check for a viewport in paperspace and plot that. If we start getting too many blank sheets of paper I will have to review the process. However, this is still some time in the future as I have more pressing problems. My retirement could well arrive before I get down to this one seriously.

Link to comment
Share on other sites

My retirement could well arrive before I get down to this one seriously.

 

Well document it well because that's a long way in the future and you are a long way behind me in the queue for retirement ;)

Link to comment
Share on other sites

Couple things to keep in mind and more detail if needed later but ModelSpace & Paperspace are just BlockTableRecords(Blocks) with a Layout associated with it.

All BlockTableRecords with Paperspace layouts will contain a viewport and which you can think of it as what lets you view the paper, printing edges, etc...

 

So if you have a "Floating viewport" - one that gives a view into model that BlockTableRecord will contain 2 viewports.

 

You can check the BlocktableRecord that is associated with Paperspace layout to see what it contains and if empty that means it has never initialized, contains 1 viewport then it has been initialized but nothing in it, 2 or more viewports then has a viewport that has view of ModelSpace.

 

Not sure what requirements are but you could check if the BlocktableRecords contain any entities so it might contain Titleblock, etc...

 

Would be tough to cover all bases but especially from many different clients.

 

 

Link to info about default viewport and reason why you do a erase all in model and will not let you erase 1 object from paperspace that is empty.

 

http://www.theswamp.org/index.php?topic=44184.0

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