FAO: Mr Fleming (ADO-AttDB)

Discussion in 'AutoCAD' started by Andy, Jul 15, 2003.

  1. Andy

    Andy Guest

    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"
     
    Andy, Jul 15, 2003
    #1
  2. Andy

    Andy Guest

    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.



     
    Andy, Jul 15, 2003
    #2
  3. Andy

    Andy Guest

    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.)




     
    Andy, Jul 17, 2003
    #3
  4. Andy

    Andy Guest

    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.



     
    Andy, Jul 22, 2003
    #4
  5. Andy

    Andy Guest

    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.



     
    Andy, Aug 5, 2003
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.