I recently started working at a small control system business and I'm looking to replace AutoCAD with something a little more tailored to our needs. 16 years down the line, AutoCAD LT 2000 doesn't quite cut it. Newer versions of AutoCAD can handle some of the tasks I have planned, but if I can do these myself with a bit of programming, the purchase of full-blown AutoCAD (not LT*) is not justified. I've spent the last week learning ECMAscript and going through the QCAD tutorials.
My plan is to automate time consuming parts of drawing creation.
Automation plans include the following topics.
- Title Block + Page Numbering
- Part Library
- Bill of Materials
- Network Overview production
- PDF export on all drawings in a folder into a single PDF
- Integration with Microsoft Access database
Integration with the Access database is the key to the automation process.
All of the data required for Title Blocks + BOMs has already been entered into an Access database, so it is currently a massive waste of time to retype the data in AutoCAD.
Here's more detail on each of the points.
1. Title Block + Page Numbering
I currently have a Title Block with attributes (ex. JobName, JobNumber, JobAddress, Architect, Contractor, etc.).
All of this information is previously entered into an Access database when the job is booked.
I need to query a table in my Access database to find the information, and fill the block attributes of the TitleBlock.
Page numbering is done in this format "[n] of [nTotal]." I can have a script count the number of drawings in the working directory to find nTotal, and require user input for individual page number [n].
2. Part Library
Our part library right now consists of a massive AutoCAD drawing with frequently used parts in it. No one knew exactly how blocks in AutoCAD worked and it just never became a priority. The QCAD part browser opens the door to MASSIVE improvement. I plan on having a script that users can run on blocks to add a relation between PartNames in the database and the blocks in the Part Library. This will facilitate easy production of Bills of Materials.
3. Bill of Materials
Part information stored in Access will make BOM production much easier. The database stores Part Names/Descriptions that need to end up on the Bill of Materials. By linking parts in the Part Library to the database entries, I can pull the text into QCAD. I'm not sure what the best method of storing the BOM info is. I was thinking of using a block for each entry with the following attributes: [BlockRefID] [Abbreviation] [Quantity] [PartName] [PartDescription], but I need an overarching block to maintain headers/formatting. Is there a such thing as a dynamic block that I can use/create? I'm open to suggestions here.
4. Network Overview Production
I'm not too concerned about this - it's pretty low on the priority list. I want to build a widget that takes user input to determine a quantity of blocks to insert onto a drawing. These blocks will be placed in a grid. I'll have to figure out how to store the input used for the generation of each network overview. This is similar to a persistent widget, but I need the data specific to the drawing in question to remain persistent.
5. PDF export on all drawings in a folder into a single PDF
This seems like it can be done with a simple script, but I may have to use a tool such as ghostscript to compile all of the output into a single PDF.
6. Integration with Microsoft Access database
This looks like it will be the biggest challenge. To be honest, I have not spent enough time looking into this yet to come up with a solid plan. Previous posts on the QCAD forum mentioned that writing a driver would be necessary, but I see that QT already has an ODBC driver. Is it possible to tap into that? I'll be researching this heavily soon.
I know this is a boatload of info to digest, but let me know if anyone has any suggestions!