×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

AutoCAD to MS Access and Back

AutoCAD to MS Access and Back

AutoCAD to MS Access and Back

(OP)
Does anyone know of any good books on using VBA routines to take data from MS Access to control attributes and entities in AutoCAD?  All the books I've seen have 10-15 pages on the subject but none go into depth on it.

Thanks for your help.

RE: AutoCAD to MS Access and Back

I only know how to do this 1 way so far.  I can insert a block with defined attributes into an Autocad file and I can also pull out those defined attributes into access but I don't currently know how to change from access the attributes already in an autocad file.  Would this information be of help?

tim

RE: AutoCAD to MS Access and Back

(OP)
Sure it would be helpful.  How did you learn to do that?  It seems there is not a lot of documentation on hte interface between AutoCAD and MS Access.

Thanks.

RE: AutoCAD to MS Access and Back

I learned this mostly between this web site and the tek-tips site. (plus reading different help files once I heard of the commands)   

(I am using Autocad lt 2000 and access 97)
(Do not use spaces or you may need to find other ways of doing this)

1st) how to make a "block" that includes useable text
  under Draw/Block/Define attributes

Make Tag and prompt the same thing because its hard to find out what tag is later.
 Specify piont, text height, etc
 do this for as many tags as you intend to use (start with only 2 as you try to figure everything out)

2nd) Save the file (ex block.dwg) in an easy to reach location
    (ex c:\Autocad\Blocks)

3rd) Close autocad and start Autocad again (just to have a clean slate

type -insert at the autocad prompt
It will ask you "Enter block name or [?]:" enter in your filename with path (c:\Autocad\Blocks\block.dwg)
now it will ask you about where to place it, what scale and angle
0,0,0  (location)
1       (x scale)
1       (y scale)
0       (angle)
then it gives you the prompt for your different text inputs
once your text inputs are in it will display everything on the screen.

4th) save the file under its new name

Now that the text is in there you can figure how to automate it by running a batch/script routine with the drawing

write a .scr file with the same text you just put in. (a .scr file is just a text file with the extension.scr)

-insert
c:\Autocad\Blocks\block.dwg
0,0,0
1
1
0
first_text_here
Second_text_here

you can run a script file from Autocad under tools/run script
you will also be able to do it by starting autocad with some extra text after it. (/b c:\autocad\blocks\script.scr)


now to extract(attribute extraction) the information you need to make a template file for Autocad.  I'm running late so I'll explain this later.  Let me know if you get through the first part .

Tim


RE: AutoCAD to MS Access and Back

(OP)
I'm with you, thanks.

RE: AutoCAD to MS Access and Back

The following is the format for at template file that you might just save as template.txt

First_tag_here c 040 000
Second_tag_here c 040 000


The trick about this is no extra spaces or [enters]

now the scrit file(access.scr) to extract the data is:

-attext
c
"c:\Autocad\Blocks\template.txt"
"c:\Autocad\Blocks\Access_Acad.txt"

you now have a file that contains all the tag information and you can import it into access

Let me know how it goes.

Tim

RE: AutoCAD to MS Access and Back

about the template file

First_tag_here c 040 000
Second_tag_here c 040 000

the c stands for text or string or someting like that
the 040 sets the limit of upto 40 characters and it can be changed.  The 000 refers to decimal places when importing a number.

Tim

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources