• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

autocad automation with excel/access

  • Thread starter Thread starter alessio.membola
  • Start date Start date

alessio.membola

Guest
Good morning to all,
I am a new member and I am pleased because I could appreciate the degree of competence of all members of this forum.

I deal with industrial automation and the myriad of documentation that I have to produce for the customer are also loop diagrams. These schematics (electrics) sum up for each group of instruments belonging to the same loop all the electrical connections necessary for their proper functioning.

to realize these schemes obviously use autocad 2008, and in recent years I have extrapolated a number of typical that for type of instrument they are always used for every job.

the configuration of the instruments is carried out on excel or on access specifying all the electrical detail of the same.

Recently I have been puzzled the idea of standardizing the db access or excel sheet, standardizing the typical autocads and looking for a way to generate the loop diagrams by correcting all the information with the typical associated cad.

It is clear that you should "put in communication" excel/access with autocad 2008 and generate routines of update of the typical and save the sheet cad repeating them for the number of configured tools.

I was wondering if you think this was a feasible thing and if you could give me a tip on how to achieve it.

Thank you in advance.

greetings

alessio m.
 
Good morning to all,
I am a new member and I am pleased because I could appreciate the degree of competence of all members of this forum.

I deal with industrial automation and the myriad of documentation that I have to produce for the customer are also loop diagrams. These schematics (electrics) sum up for each group of instruments belonging to the same loop all the electrical connections necessary for their proper functioning.

to realize these schemes obviously use autocad 2008, and in recent years I have extrapolated a number of typical that for type of instrument they are always used for every job.

the configuration of the instruments is carried out on excel or on access specifying all the electrical detail of the same.

Recently I have been puzzled the idea of standardizing the db access or excel sheet, standardizing the typical autocads and looking for a way to generate the loop diagrams by correcting all the information with the typical associated cad.

It is clear that you should "put in communication" excel/access with autocad 2008 and generate routines of update of the typical and save the sheet cad repeating them for the number of configured tools.

I was wondering if you think this was a feasible thing and if you could give me a tip on how to achieve it.

Thank you in advance.

greetings

alessio m.
We say that this is a little generic, but I think it's feasible.

i.e. to communicate via vba (for example) autocad and office is possible, to obtain information from excel (e.g. blocks names etc) and then to insert them/generate them in autocad is feasible.

now it is only to understand which is the easiest way to achieve, that is, excel/autocad or autocad/excel (I prefer the second).

I ask you this because obviously things change if you go from a to b or b to a.
 
good morning shape,
basically the way you need to go, according to me, is that from excel (better access) you read the data and update the fields in autocad. this because the instrumental colleagues in their engineering studies compile a data base with a set of data:
- loop name
- instrument name
- clamps
- cabinet
- etc.
data these that must be used in the typical autocads.
Anyway, I was thinking about creating a visual basic program that on the one hand opens and manages the db, on the other it manages the typical autocads in dxf format (published as txt) considering sensitive fields as attributes.

greetings

alessio membola
 
good morning shape,
basically the way you need to go, according to me, is that from excel (better access) you read the data and update the fields in autocad. this because the instrumental colleagues in their engineering studies compile a data base with a set of data:
- loop name
- instrument name
- clamps
- cabinet
- etc.
data these that must be used in the typical autocads.
Anyway, I was thinking about creating a visual basic program that on the one hand opens and manages the db, on the other it manages the typical autocads in dxf format (published as txt) considering sensitive fields as attributes.

greetings

alessio membola
bhè the idea of using the dxf (with the text editor) is not bad at all... this would completely eliminate the excel/access interface with autocad.

what is not clear to me is whether these changes between what one chooses in the db and what happens in autocad are only the modification of text strings or attributes or changes of geometry too ...
 
good morning shape,

the information that must be modified only relates to texts within the dxf file.
I'll give you an example:
in the typical dxf I have a text that to make it generic I named it "tag_name" and represents the name of the instrument.
from the database access after a set of individual controls the value associated with the column "tag_name", for example, tt-501 and replace it in the dxf. the file of the typical dxf then is saved with another name.

I stacked a part of vb.net code that does this and works perfectly.

greetings

alessio membola
 
Good morning alessio,

I'm doing exactly the same thing :-)

So, I'm doing everything from a db access. I created a main table in which I inserted the signal tags, a second in which I created the loops and so on for the remaining table of support.
on the cad side instead I thought of a solution based on a set of typical "prepacked" containing a set of blocks (and related attributes) that are "filled" times by db access through a macro vba.
My problem now is the vba code because... I have no idea what the instructions are to copy the access record to pour it into the autocad file. (but very little is missing).
Consider that such a structured solution could allow you to achieve any type of autocad document based on blocks.
 
Good morning alessio,

I'm doing exactly the same thing :-)

So, I'm doing everything from a db access. I created a main table in which I inserted the signal tags, a second in which I created the loops and so on for the remaining table of support.
on the cad side instead I thought of a solution based on a set of typical "prepacked" containing a set of blocks (and related attributes) that are "filled" times by db access through a macro vba.
My problem now is the vba code because... I have no idea what the instructions are to copy the access record to pour it into the autocad file. (but very little is missing).
Consider that such a structured solution could allow you to achieve any type of autocad document based on blocks.
Bye.
I do not use autocad but a similar program, with a very similar vba.
a) you need to refer to the Dao library.
Then you can do whatever you want, you have the database in your hand.
If you know, here's some lime, cement and sand, good work.
Sergio
Code:
public db_combo as dao.database
public wrkcurrent as dao.workspace


private sub open_db()
 
    if default_path = "" then call getpath
    default_db = default_path + "mio.mdb"
    if dir(default_db) = "" then
        msgbox "fatal : non trovo il database nel percorso " & default_db
        exit sub
    end if
    set wrkcurrent = dbengine.workspaces(0)
    set db_combo = wrkcurrent.opendatabase(default_db)
end sub

'***********************************
dim qdfnew as dao.querydef
    
            set qdfnew = db_combo.querydefs("rec_1a")
            with qdfnew.parameters
                !trans_id = miopezzo
                !scala = scala
            end with
        
'***************************************    
         mysql = " select specifica_linea.* from specifica_linea " & _
                    "inner join new_transcod on specifica_linea.dwgnome = new_transcod.dwg " & _
                    "where new_transcod.trans_id =" & miopezzo & " and specifica_linea.attri0 ='" & scala & "';"
        
    
   'dim rslinea as dao.recordset
    set rs_combo = db_combo.openrecordset(mysql, dbopensnapshot)




 '*********************************************
wrkcurrent.begintrans
         dim mytable as dao.tabledef
        db_combo.tabledefs.refresh
        for each mytable in db_combo.tabledefs
            if mytable.name = "myid" then
                db_combo.tabledefs.delete "myid"
                db_combo.tabledefs.refresh
                exit for
            end if
        next
        set mytable = nothing
        mysql = " insert into new_linea (nrlin,tav_id,cod_id) values ('" & linea & "'," & my_tav_id & "," & cdbl(my_pipe_id) & ");"
        db_combo.execute mysql
        mysql = "select @@identity into myid;"
        db_combo.execute mysql
        set rslinea = db_combo.openrecordset("myid", dbopentable)
        my_lin_id = rslinea!expr1000
        rslinea.close
        wrkcurrent.committrans
        set rslinea = nothing
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top