create a storage system from storing variables using ldata

Discussion in 'AutoCAD' started by GaryDF, Jan 14, 2005.

  1. GaryDF

    GaryDF Guest

    I recommend looking at Peter's routine...its a good one. You can get the code at:
    www.waun.org

    I have started using it on a trial bases in some of my routines, works great. I
    am using
    autocad 2005 windows 2000

    Gary


    The following is from Peter Jamtgaard email:

    I was pondering the storing of variable inside drawings.
    I decided to try and create a storage system from storing variables using ldata.
    I wouldn't recommend storing objects using objects, safearrays or variants in the
    storage system.

    It will cause errors during saving.

    The syntax is
    (savevariable 'testvariable)
    (restorevariable 'testvariable)
    (restorevariables)

    if testvariable is a valid variable (not nil) it will store itself into the
    drawing.
    The restorevariable can be used during a later drawing session to get that value.
    Peter Jamtgaard

    ;**************************************************************************
    ; Written By: Peter Jamtgaard copr January 2005
    ;**************************************************************************
    ;
    ; Save a variable into drawing for later use with its string name and value
    ;**************************************************************************
     
    GaryDF, Jan 14, 2005
    #1
  2. I agree. I think this is one of the best things Autodesk ever did for programmers. This facility makes my life sooooo much easier!
     
    Nick_Merchant, Jan 14, 2005
    #2
  3. LData stinks. I hope you enjoy programming in Visual LISP forever, because
    the data is not retrievable in VB(A) to the average programmer.

    --
    R. Robert Bell


    I agree. I think this is one of the best things Autodesk ever did for
    programmers. This facility makes my life sooooo much easier!
     
    R. Robert Bell, Jan 14, 2005
    #3
  4. Robert, since you're so good at insulting people, why don't you just go do it in the VBA forum with the "average" programmers?

    I didn't solicit your negative attitude, so why did you volunteer it?

    With a negative outlook like that, I can only image what kind of person you must be to work with.
     
    Nick_Merchant, Jan 15, 2005
    #4
  5. I'm not insulting you. LData has issues that most people are unaware of. I
    have had to help other firms migrate their data out of LData into
    traditional dictionaries so that they could continue their development in
    VBA. If you search this ng over the past few years you will see that I've
    warned of this issue several times.

    My initial post was brief and blunt because I didn't have time at the point
    to write a more detailed response, one that might not have ruffled your
    feathers.

    --
    R. Robert Bell


    Robert, since you're so good at insulting people, why don't you just go do
    it in the VBA forum with the "average" programmers?

    I didn't solicit your negative attitude, so why did you volunteer it?

    With a negative outlook like that, I can only image what kind of person you
    must be to work with.
     
    R. Robert Bell, Jan 15, 2005
    #5
  6. OK. If I misunderstood your post, please accept my apology, Robert. Maybe look closer at what you're talking about and see if there's some potential problem that I'm not aware or.

    Why couldn't I just write a translator function that's called from my (ldata) functions. Since I have one function for reading data, one for writing data and one for deleting keys, it soesn't seem like it would be that big of a deal.

    Am I missing something?

    Thanks for the advice.
     
    Nick_Merchant, Jan 15, 2005
    #6
  7. You shouldn't be apologizing for anything. You didn't
    misunderstand anything. Mr. Bell is the only one here
    that owes the rest of the group an apology.
    There's no reason whatsoever why you can't do that.
    Since it is possible to migrate LDATA to other storage
    mediums, the only risk you run is that Autodesk will
    do what it did in the past, again (LDATA written using
    R14 Vital/Visual LISP was completely inaccessable in
    AutoCAD 2000, and Autodesk did nothing to mitigate
    that).
     
    Tony Tanzillo, Jan 15, 2005
    #7
  8. GaryDF

    Joe Burke Guest

    Tony,

    I don't see much difference between what Robert said, and this advice from you dated
    9/9/2004.

    -----------------------------------------------
    You are making a big mistake by using 'LDATA' to begin with.

    I would strongly advise you to use your own xrecord and dictionary code, and avoid
    LDATA like the plague.
    -----------------------------------------------

    I'm not trying to make a point. I'm simply wondering if you've changed your mind on
    this issue? I, for one, would like to know. I've avoided ldata given this type of
    advice from people like you and Robert. Folks who know more about this stuff than I
    ever will.

    Joe Burke
     
    Joe Burke, Jan 15, 2005
    #8
  9. My opinion on the use of LDATA hasn't changed, but I don't
    see that as the main issue, which is:

    "I hope you enjoy programming in Visual LISP forever"

    Which I interpret as meaning that if you do use LDATA, you
    are sentencing yourself to LISP Purgatory for eternity, with
    no recourse.

    Do you agree or disagree with that?
     
    Tony Tanzillo, Jan 15, 2005
    #9
  10. My point is that, if you write a VBA function, and you need to look at your
    legacy data stored in LData, you are stuck with the requirement of needing
    some code in Visual LISP to get to the data. If you thought you could get to
    the data from VBA _only_ you are stuck. You would need to run some VLISP
    code to migrate the data into "friendly" formats. So why not just start with
    the non-LData formats?

    --
    R. Robert Bell


    OK. If I misunderstood your post, please accept my apology, Robert. Maybe
    look closer at what you're talking about and see if there's some potential
    problem that I'm not aware or.

    Why couldn't I just write a translator function that's called from my
    (ldata) functions. Since I have one function for reading data, one for
    writing data and one for deleting keys, it soesn't seem like it would be
    that big of a deal.

    Am I missing something?

    Thanks for the advice.
     
    R. Robert Bell, Jan 15, 2005
    #10
  11. GaryDF

    GaryDF Guest

    Ok, I'm a beginner in Vlisp, so can someone point me in the right direction, if
    Ldata is not the answer. I am looking for help in developing code to store a
    varable,
    I quess on layer zero (so it can't be deleted). Then retrieve that data when the
    drawing is reopened. I would like the routine to be similar to Peter's with the
    same type of functions: save restore and restoreall.

    All this other talk about converting into VBA is not really important to me. I am
    concerned about what Autodesk may do with Ldata in the future.

    Any help (blunt or otherwise..I have thick skin) would be welcomed.

    I use the following code but it's not Vlisp:
    Code:
    ;;I use this program to hide my company's name, person
    ;;& telephone number inside the undeleted  Layer "0"
    ;;for Copyright purpose.
    (defun C:XD-GDF  (/ APPNAME CN DATA ELIST ENT ITEM LYR N PC TABLE TP)
    (setq APPNAME "DWG_OWNED_BY")
    (regapp APPNAME)
    (setq ITEM NIL
    DATA NIL)
    ;;(setq CN (strcat "Employer = " (getstring "\nCompany Name: ")))
    (setq CN "Company = GARY DAVIDSON FOWLER ARCHITECT")
    ;;(setq PC(strcat "Employee = " (getstring t "\nPerson to Contact: ")))
    (setq PC (strcat "Drawn By = " (getvar "loginname")))
    ;;(setq TP (strcat "Phone = " (getstring "\nTelephone: ")))
    (setq TP "Phone = 972.404.0182   Email = ")
    (setq ITEM (cons CN (cons PC (list TP))))
    (setq N 1)
    (foreach
    S  ITEM
    (setq ELIST (set (read (strcat "X" (itoa N))) (cons 1000 S)))
    (setq DATA (cons ELIST DATA))
    (setq N (1+ N)))
    (setq TABLE (list (list -3 (cons APPNAME DATA))))
    (setq LYR (tblobjname "layer" "0"))
    (setq ENT (entget LYR))
    (entmod (append ENT TABLE))
    (princ (setq TABLE (cdadr (assoc -3 TABLE))))
    (princ))
    
    Gary
     
    GaryDF, Jan 15, 2005
    #11
  12. GaryDF

    Joe Burke Guest

    Tony,

    I'm not qualified to agree or disagree since my knowledge ends at VLSIP.

    Regardless, thank you for the clarification.

    Joe Burke
     
    Joe Burke, Jan 16, 2005
    #12
  13. Migrating LDATA can only be done using Visual LISP,
    it has nothing to do with other APIs or languages.
     
    Tony Tanzillo, Jan 16, 2005
    #13
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.