TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jtoverka on September 16, 2019, 07:27:23 AM
-
Is it possible to retrieve a drawing from an access database that is storing drawings as an attachment? I am using AutoCAD Electrical and these drawings are whole circuits. AutoCAD Electrical has circuit builder and insert circuit tools, however, they are limited in functionality and does not scale with automation. I wrote my own circuit builder program, however, I would like a centralized location for all of my data. I would like to store these drawings in a database that AutoCAD can access. Is this possible? Additionally, I would prefer that speed be somewhat comparable or close to pulling a drawing out of the file system.
-
I've worked with Access db's in AutoCAD, just not attachments. However, the object model does include them, so you should be able to access them. Keep in mind that the api is in VBA, not lisp.
-
I've worked with Access db's in AutoCAD, just not attachments. However, the object model does include them, so you should be able to access them. Keep in mind that the api is in VBA, not lisp.
Not quite. Using lisp you can access to any database (create connection string, then ADO.Connection, ADO.Recordset and execute your query - it's simple). As an example: https://adndevblog.typepad.com/autocad/2013/04/using-autolisp-to-read-an-access-database-via-ado.html
-
I've worked with Access db's in AutoCAD, just not attachments. However, the object model does include them, so you should be able to access them. Keep in mind that the api is in VBA, not lisp.
Not quite. Using lisp you can access to any database (create connection string, then ADO.Connection, ADO.Recordset and execute your query - it's simple). As an example: https://adndevblog.typepad.com/autocad/2013/04/using-autolisp-to-read-an-access-database-via-ado.html (https://adndevblog.typepad.com/autocad/2013/04/using-autolisp-to-read-an-access-database-via-ado.html)
I wasn't saying that you Can't use lisp, just that the api is intended for VBA. It's just a little more difficult in lisp, since you don't have the advantages offered by the IDE, e.g. Intellisense. Besides, I'm not sure if ADO can access an attachment contents. That may be only available via the ActiveX api.
-
Not quite. Using lisp you can access to any database (create connection string, then ADO.Connection, ADO.Recordset and execute your query - it's simple). As an example: https://adndevblog.typepad.com/autocad/2013/04/using-autolisp-to-read-an-access-database-via-ado.html
It is quite simple to connect to a database, I just don't know how to insert attachments from the database into AutoCAD, and to do it efficiently.
I would like to have a normalized database of data and electrical circuits. Right now I have half of that, the circuit is outside the database in a dwg file. This is okay, however, it means that I have to have a bunch of files to manage with no guarantee that my program will work since I could be missing a file somewhere. A database makes it much easier to find these anomalies.
-
Just to be clear, because I'm having a hard time following: you cannot put a DWG file in an Access database. You can store data structured to reconstruct a drawing or part of one, but not the drawing itself.
-
Just to be clear, because I'm having a hard time following: you cannot put a DWG file in an Access database. You can store data structured to reconstruct a drawing or part of one, but not the drawing itself.
You can if the data type of the column is "Attachment". You can then store multiple files per record as attachments.
-
Just to be clear, because I'm having a hard time following: you cannot put a DWG file in an Access database. You can store data structured to reconstruct a drawing or part of one, but not the drawing itself.
You can if the data type of the column is "Attachment". You can then store multiple files per record as attachments.
You can also store them in a field whose data type is set to OLE Object.
-
one can also store the drawing as dxf sequence in a 'text' field
or even as an assoc list which you can entmake
but what is the point in all that?
why not just use a dwg file as a database?
keep all your data in that file and use odbx to import the stuff into current drawing
i personally do it this way
-
That is the next best option, quite a simple solution too. The reason I am hesitant is that I am looking for data integrity, hence the database design.