Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-Generating Drawings From MS Access

Status
Not open for further replies.

tommcmaster

Technical User
Feb 7, 2005
16
GB
Hi,
At work we have an MS Access 2000 database which holds various information on drawings that we would like to produce in AutoCAD (2002 or 2005 Light.) Basically, is it possible to generate drawings in AutoCAD automatically, based on the information in the Access DB? I know that we can link to MS Access from AutoCAD but can we do it the other way around.
I'll add that I know nothing about AutoCAD and have only been asked to research the possibility of this topic. So ANY help at all, no matter how full of code or general it is, would be greatly appreciated.
 
Hi tommcmaster,

Short answer - yes, but not with AutoCAD LT - you'll need to have the full blown version so your AutoCAD 2002 should do what you need it to do.

HTH
Todd
 
Hi TCARPENTER,
First of all, thanks very much for replying. Secondly, is it a relatively simple process? I'm aware of ODBC and things like that but not in an Autocad 2002 sense. If it is (or even if it isn't) a simple process, would you be able to tell me where I could get advice on how to do it, if not from yourself?
Thanks again,
Tom McMaster.
 
That depends on what you want to create. Once you have the AutoCAD document object. You can go to either its paperspace or modelspace layout object. From there you add your AutoCAD drawing objects (line, arc, circles, etc...). The more complex of an object you need, the more complex it gets. I assume you would gather all the info you need for AutoCAD (line coordinates, what not) from Access and then pump that info to define your AutoCAD objects.
 
Hi Tom,

It's not a terribly difficult process, it's involved, but not too painful.

I use Access quite a bit with AutoCAD and must admit, I prefer using AutoCAD as the driver and just use Access to populate and modify the database.

I personally prefer ADO and occasionally use DAO (I haven't used DAO since Microsoft says its eventually going to go away) and did on a couple of occassions use ODBC but was dissappointed by its slow performance.

If you have some more specific questions, post back, I can probably help out quite a bit.

HTH
Todd
 
Hey borgunit,
Thanks for your reply. So it is possible to have plot points, etc in an Access 200 DB, run AutoCAD and then use such information to auto-generate a drawing based on it?
And AutoCAD will just pull the information it needs from the DB?
I'll apologize if I sound like a dumb-truck here. I've never even touched the box that AutoCAD comes in, let alone worked with it. I'm just being asked to research it by my boss.
Thanks again,
Tom.
 
Hey Todd,
Thanks again.
I'm going to speak to my boss after lunch a bit more about this. (I say lunch seeing as I'm in Scotland and it's mid-day here). I'm not entirely, 100% sure what is happening with this project or what he needs but I'm sure he'll give me a more specific idea and I can get back to you.
Thanks for your help.
Tom.
 
Hi Guys,
I spoke to my boss after lunch and this is the description he has given me of our problem. Again, any help would be great.

"We have a list of standard instrumentation drawings which are repeated several hundred times but with different labels attached to different devices shown on the drawing. These device labels are held in fields in an access table and we would like to auto-generate these drawings by tokenising them."

Tom.
 
Hi Tom,

This should be pretty easy, but I have a few questions:

[ol]
[li]Are these "standard instrumentation drawings" used as blocks within a package, or are these drawings on their own with their own drawing number, title block etc.[/li]

[li]Are these devices attributed blocks?[/li]

[li]How do the "devices" differ from your "standard instrumentation drawings"?[/li]

[li]How do you handle duplicate devices, in other words, if I find 2 (or more) identical blocks (devices) how do I differentiate between them so they are labeled properly?[/li]

[li]Will you need to correct and or process drawings which are already existing, or will you just need to create drawings based on what's in the database?[/li]
[/ol]

You'll need to know exactly how a drawing/block correspond to records in your database.

Finally, will AutoCAD just "talk" to the database, or do you want Access to drive the whole process?

For what it's worth:

I would have AutoCAD just talk to the database, AutoCAD will be much better behaved if this is run "in-process."

The drawing can either be created, or edited (depending on how your drawings and data are set-up).

If you can answer some these, I can probably help you design your program/process.

HTH
Todd
 
Hi Todd,
I checked with my boss and here are the answers that he gave to your questions.

1. Drawings on their own, hopefully generated from a single template.

2.No.

3.The devices are instrumentation devices and not AutoCAD devices and are just part of the drawing.

4.Not applicable.

5. As per answer 1. ie: We are creating drawings from a single template based on what's in the database.

As for whether or not Access will drive the whole process, I have been told we will take which ever route is most reliable, not necessarily the easiest one though.

Again, thanks very much for all this help. I have to leave the office in 5 minutes but I'll be back in tommorrow. Don't know what timezone you're in but I'll be back in 15 hours :)
Thanks,
Tom.
 
Hi Tom,

Since 15 hours for me here in Detroit will put me around 3 am, here's how I would approach your problem keeping in mind I don't know what your drawings look like... but here goes:

I would definitely convert your devices to attributed blocks, 2 reasons: simplicity and efficiency. You can create all of your line work on the fly, but it's very time consuming.

Since you are creating a drawing based on what's inside the database, there must be some methodology for "synchronizing" the drawing with the database. So for the sake of demonstration, I'm imagining your data structure to be similar to this:

DeviceTable
[ul]
[li]DeviceRecnum - PK[/li]
[li]DeviceName - Name of device[/li]
[li]DeviceFName - File name and location of device block.[/li]
[li]DeviceLabelTitle1 - Tag string value of attribute within AutoCAD drawing.[/li]
[li]DeviceLabelValue1 - Text to appear on device.[/li]
[li]DeviceLabelTitle2 - Tag string value of attribute within AutoCAD drawing.[/li]
[li]DeviceLabelValue2 - Text to appear on device.[/li]
[li]DrawingNumber - Drawing where device should appear.[/li]
[/ul]
A typical record may look like this:
[ul]
[li]1[/li]
[li]Pressure Guage[/li]
[li]D:\Standard Blocks\PressureGauge.dwg[/li]
[li]Main Label[/li]
[li]Current Operating PSI[/li]
[li]1005[/li]
[/ul]
The basic program flow would go something like this:

[ol]
[li] Collect drawing/filename.[/li]
[li] Connect to database.[/li]
[li] Query database for recordset based on drawing name (1005).[/li]
[li] Locate and insert the block D:\Standard Blocks\PressureGauge.dwg.[/li]
[li] Populate the attribute with the tag string "Main Label" with "Current Operating PSI".[/li]
[li] Save the drawing.[/li]
[li] Close recordsets, connections etc.[/li]
[/ol]

Now if you're dead set against creating attributed blocks out of your standard drawings, instead of inserting the block, you would query your database for the needed drawing creation information. If you have created blocks, but not the attributes, you then create text (instead of populating attributes) somewhere near your inserted block. But I think you'll have a much easier time automating your process using blocks and attributes.

Hopefully this will get you going in the right direction, if not, let me know! I'll be back 6:30am my time.

HTH
Todd
 
Hi Todd,
As far as I'm aware we'll be starting on this project today, maybe in the afternoon. I'll pass the information along and see how it goes.
Thanks,
Tom.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top