FAO: Mr Fleming (ADO-AttDB)

Andy

Usenet Archive
Joined
Mar 15, 2000
Messages
32
Reaction score
0
Hi,

After reading through some post I've came upon your excellent script for extracting block attributes into Access database. In one of the posts you gave an example of how a message box (warning of over-writing existing entries) could be implemented by replacing some code.

I tried doing this but whilst it still works I get no pop-up message box. Being a complete beginner I don't really know what to look out for / troubleshoot.

If possible could glance over the code I've pasted and perhaps highlight where I've gone wrong.

Many Thanks in advance,

Andy.

<<<<Code Start>>>>

;;; A routine (and supporting functions) to extract
;;; attribute values from a block insert entity
;;; and insert the values into (or update the values
;;; in) a database. See the comments following the
;;; boilerplate for limitations and usage. NOTE that
;;; this routine is largely "data-driven" by the data
;;; immediately following the introductory comments.
;;; Few (if any) revisions should be required to change ;;; what the routine does.

;;; Copyright (C) 2002 by The Fleming Group

;;; Permission to use, copy, modify, and distribute this ;;; software for any purpose and without fee is hereby ;;; granted, provided that the above copyright notice ;;; appears in all copies and that both that copyright ;;; notice and the limited warranty and restricted ;;; rights notice below appear in all supporting ;;; documentation.

;;; THE FLEMING GROUP PROVIDES THIS PROGRAM "AS IS" AND WITH ;;; ALL FAULTS. THE FLEMING GROUP SPECIFICALLY DISCLAIMS ANY ;;; IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A ;;; PARTICULAR USE. THE FLEMING GROUP DOES NOT WARRANT THAT ;;; THE OPERATION OF THE PROGRAM WILL BE UNINTERRUPTED OR ;;; ERROR FREE.

;;; Revision history:

;;; Revision 1.0
;;; Jon Fleming
;;; February 21, 2002

;;; **************************************************************

;;; Revision 1.1 March 9, 2002 by JRF: Removed the need to ;;; set a global variable for which engine is being used to ;;; connect to the database. Note that this version now ;;; requires ADOLISP version 2.1 or later.

;;; Revision 1.2 May 19, 2002 by JRF: fixed using the wrong ;;; syntax for the vla-startundomark and vla-endundomark ;;; functions.

;;; Revision 1.3 May 24 2002 by JRF: Fixed a bug that caused ;;; the alert box to appear even when ADILISP_Library.lsp ;;; was loaded succesfully.

;;; Revision 1.4 April 13, 2003 by JRF: Fixed a bug with ;;; retrieving attribute values when teh attribute tag ;;; was listed in the global list with lower case ;;; characters.

;;; Limitations:

;;; REQUIRES AutoCAD 2000 or higher.

;;; REQUIRES ADOLISP_Library.LSP version 2.1 or
;;; higher, available from
;;; http://www.fleming-group.com on the download page.

;;; ONLY TEXT DATA FIELDS IN THE DATABASE ARE SUPPORTED! ;;; There may be non-text data fields in the database ;;; that are not linked with attributes,but this routine ;;; cannot update or insert non-text fields.

;;; ************************************************************

;;; Usage:

;;; At the AutoCAD "command" prompt, or from a menu macro:
;;; ado-attdb
;;; From AutoLISP:
;;; (c:ado-attdb)

;;; Return value:
;;; none.

;;; ***********************************************************************

;;; Set up a global list that determines much of how this ;;; routine works

(setq #ADO-AttDBData
'(
;; A string that tells us how to connect to
;; the database.
;; Either an OLEDB Connection String or the
;; name of a UDL file (including the ".udl").
;; UDL files may be created with the DBCONNECT
;; command in AutoCAD. See the documentation
;; of ADOLISP_Library for some examples of
;; connect strings.
;; NEVER put an un-required space in a connection
;; string!
;; The following shows how to
;; use the Jet engine for Microsoft Access.
("ConnectionSpec"
 
Thank you, I appreciate your assistance.

One other thing that I'd best interest to know. would it be easy to add another block to it.

for example I have two title blocks, one called A1-2000 and one called A3-2000, both have exactly the same attributes its just the size and of course the name that is different, would this script be able to handle this ??

Would it be simply adding another entry to this bit :

;; The name of the block from which we are
;; going to extract the attributes.
("BlockName" . "Title Block")

so it looked like this:

;; The name of the block from which we are
;; going to extract the attributes.
("BlockName" . "A3-2000; A1-2000")

Thanks again,

Andy.

Jon Fleming said:
Well, you need to up the DCL code in its own AskUserAboutOverwrite.dcl file (and put that file in a directory on AutocAD's search path), and you need to put the code for the AskUserAboutOverwrite function outside the code for
C:ADO-AttDB.

Like the attached.

It's best if you create a directory that is dedicated to your customization stuff and add it to AutoCAD's search path. If you put the files in one of AUtoCAD's directories it can cause problems (like forgetting them when you upgrade AutoCAD).
 
Thanks Jon,

I quickly gave that a try but it produced the following error:

Error 0: bad argument type: stringp nil

(To test it quickly I used the rename command to rename the block, whether this would have impact of the success of it I don't know.)

Jon Fleming said:
Actually, on reflection, I think it might work if you tried:

("BlockName" . "A3-2000,A1-2000")

Thank you, I appreciate your assistance.

One other thing that I'd best interest to know. would it be easy to add another block to it.

for example I have two title blocks, one called A1-2000 and one called A3-2000, both have exactly the same attributes its just the size and of course the name that is different, would this script be able to handle this ??

Would it be simply adding another entry to this bit :

;; The name of the block from which we are
;; going to extract the attributes.
("BlockName" . "Title Block")

so it looked like this:

;; The name of the block from which we are
;; going to extract the attributes.
("BlockName" . "A3-2000; A1-2000")

Thanks again,

Andy.

Jon Fleming said:
Well, you need to up the DCL code in its own AskUserAboutOverwrite.dcl file (and put that file in a directory on AutocAD's search path), and you
need
to
put the code for the AskUserAboutOverwrite function outside the code for
C:ADO-AttDB.

Like the attached.

It's best if you create a directory that is dedicated to your customization stuff and add it to AutoCAD's search path. If you put the files in one of AUtoCAD's directories it can cause problems (like forgetting them when you upgrade AutoCAD).
 
Yes I'm pretty sure I have the latest version.

Here is the FieldNameList that exists in the Lisp File:

("FieldNameList"
;; Field Name . Attribute Tag
("Number" . "DWG-NO")
("Title 1" . "TITLE-1")
("Title 2" . "TITLE-2")
("Revision" . "REV")
("Status" . "DWG-STATUS")
)
;; A list of the key field or fields of the
;; database table. The field or fields contained
;; in this list should be sufficient to extract
;; one record from the database (given the value or
;; values of the corresponding attribute or
;; attributes). All fields listed here must have
;; corresponding attributes (not null strings)
;; listed in the Field List above.
("KeyFieldList" ("Number"))
)
)

Thanks,

Andy.

Jon Fleming said:
Are you using the latest version of ADO-Attdb?

Are there any lower-case characters in your attribute tags listed in the FieldNameList data structure?

Thanks Jon,

I quickly gave that a try but it produced the following error:

Error 0: bad argument type: stringp nil

(To test it quickly I used the rename command to rename the block, whether this would have impact of the success of it I don't know.)

Jon Fleming said:
Actually, on reflection, I think it might work if you tried:

("BlockName" . "A3-2000,A1-2000")
 
Hi Jon,

Since working on this I've had a problem with my PC and lost an amount of work, including the samples I was using for this.

I'll try to create the files again and post them to the customer-files newsgroup.

In the meantime could you possibly post the files in which you got it working ??

Many Thanks

Regards,

Andy.

Jon Fleming said:
I can't duplicate the problem with what I have here. The technique of ("BlockName" . "A3-2000,A1-2000") works for me with blocks of either name.

Can you ZIP up a sample drawing, database, and your copy of ADO-AttDB.lsp and post it in the customer-files newsgroup?

Yes I'm pretty sure I have the latest version.

Here is the FieldNameList that exists in the Lisp File:

("FieldNameList"
;; Field Name . Attribute Tag
("Number" . "DWG-NO")
("Title 1" . "TITLE-1")
("Title 2" . "TITLE-2")
("Revision" . "REV")
("Status" . "DWG-STATUS")
)
;; A list of the key field or fields of the
;; database table. The field or fields contained
;; in this list should be sufficient to extract
;; one record from the database (given the value or
;; values of the corresponding attribute or
;; attributes). All fields listed here must have
;; corresponding attributes (not null strings)
;; listed in the Field List above.
("KeyFieldList" ("Number"))
)
)

Thanks,

Andy.

Jon Fleming said:
Are you using the latest version of ADO-Attdb?

Are there any lower-case characters in your attribute tags listed in the FieldNameList data structure?
 
Back
Top