PDA

View Full Version : Automatic page numbering


VERYCIVILDRAFTER
17-11-2004, 05:24 PM
How would I go about linking a text value to another text in a different layout? I want to have my adjoining sheet references update when I change the sheet numbers. Do I do this with rtext?

Example; The large plan view on Page 2 has adjecent page 1 on the left and Page 3 on the right and page 4 below it.

And then something like spred sheet for sheet numbering:
Layout1 page number = n
Layout2 page number = Layout1 number + 1
Layout3 page number = Layout2 number + 1
Layout4 page number = Layout3 number + 1

or

Layout1 page number = n
Layout2 page number = n + 1
Layout3 page number = n + 2
Layout4 page number = n + 3

Even if the sheet names and reference numbers just matched a specific layout name that would work, too.

TCARPENTER
18-11-2004, 11:42 AM
If I'm understanding you correctly, this is really a document management function - regardless of whether your layouts refer to a single drawing file with multiple layouts or multiple drawing files. I think you're on the right track with the spreadsheet as I've done a lot of document management work and this is really the way to go. Even though I think you're talking about just one drawing file, eventually, it'll start to grow.

So, to answer your question, you will need something, somewhere to keep track of the existing layouts either; a spreadsheet, a database, a text file, or even an ini-file. The trick is write your code to go both ways - the database compares the layouts with its last known collection, and AutoCAD reports its layouts back to the database and either one can update the other. You'll need to decide who is driving whom: will the database drive the drawings, or will the drawings drive the database? Initially, it's probably easier to have the drawings drive the database, until you figure out you might be able to automate a lot of your mundane tasks, that's the advantage and why I recommend bi-directional communication. Obviously, one or the other will need to either ask the user what to do, when data doesn't "line-up", or you'll need to decide (and then hardcode it in) how the routine will handle discrepancies.

In the past when I've done this, I've stuck with just attributes over rtext just for simplicity sake, and used an external database to manage everything. Since you're talking about a spreadsheet, I'd use VB/VBA as they communicate more readily with other programs outside of AutoCAD than does AutoLISP/VisualLISP but it really doesn't matter - pick your poison. You'll also need a way to make sure the drawing file is talking to the right set of data - if you opt for individual spreadsheets for your drawing files - you'll need to open or check to be sure the correct file is already open - especially when later on you need to process hundreds of files. If you use one spreadsheet for all of your files you should construct a "primary key" to uniquely identify your rows. You might make column one: Project, Column two: File Name Column three: Extension and then either in your spreadsheet - ensure the combination of Project, Filename, and Extension are never duplicated. Conversely, you’ll need a way to make sure the data you are manipulating, is talking to the correct file. In either case, your code will either need to query for the right data set, or open the correct drawing file, or set the correct layout tab current.

Once you implement your idea, you'll see it start to take on a life of its own, this is why I recommend an external data source of some sort, as I think you'll start to see how you might lighten some of your workload through a higher level of automation.

Hope I wasn’t too long winded or scared you off – it’s involved but not terribly difficult.

HTH
Todd

Eddie
19-11-2004, 01:31 AM
8) VCD...not sure this will be of any help, but I came across it in whilst doing my research.

http://www.cadvault.com/forums/showthread.php?t=5537&highlight=block+attributte

Hope it helps

VERYCIVILDRAFTER
19-11-2004, 06:35 PM
If my layout name is an integer, and I wanted to extract that value, and add or subtract to it, and then display it in my drawing?
Could I use rtext to display that or would I have to use a lisp or VBA?
If I have to use lisp or vba would 'that routine' have to be linked to a block attribute?

I yes to any of the above I don't know how to extract a variable so that i can (+ <number> <number>) and I don't know how to link a attribute to a routine file, so a online lesson book would be cool.

Finally can rtext load the LSP or vba file (instead using of a block) with the file option.
Enter an option [Style/Height/Rotation/FileDiesel]/ <Diesel>:

If you didn't know?
$(getvar, "CTAB") = dispalys current tab name in rtext

TCARPENTER
19-11-2004, 11:05 PM
VCD,

The easiest way is VBA:


Sub NamedLayouts()
Dim objLayout As AcadLayout

For Each objLayout In ThisDrawing.Layouts
Debug.Print objLayout.Name
Next objLayout

End Sub


I'm sure you can do it in AutoLISP as well, it's just been so long I don't remember how. Is that contained in the "Tables" maybe?

HTH
Todd