Acad14 lisp not on 2005?

Discussion in 'AutoCAD' started by v.valentijn, Aug 19, 2004.

  1. v.valentijn

    v.valentijn Guest

    I've got a lisp routine that runs on Acad14, but it fails to run on 2005...
    I don't know what's wrong since it's been ages since I last wrote some lisp
    routines, I have some sort of suspicion that there used to be a standard
    function called (begin) which has been cancelled in a later version? Does
    anyone have any ideas or a way to find out?
    thanx
     
    v.valentijn, Aug 19, 2004
    #1
  2. Hi,

    All lisp functions can be typed at the keyboard.

    Hence you can type (begin) and see what it does.

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Aug 19, 2004
    #2
  3. v.valentijn

    v.valentijn Guest

    Yes.. I know, it gives the same error; 'function undescribed'
    This while the function IS in the lisp, I don't see any wrongs in the
    functiondescription and.. it DOES work on Acad14. So is there a change in
    SYNTAX between lisp for 14 and later versions? Something like that?
     
    v.valentijn, Aug 19, 2004
    #3
  4. v.valentijn

    zeha Guest

    Hi,

    What return !begin on the command line?

    It must something like #<SUBR @04186190 BEGIN>

    If not look at the acaddoc.lsp or if the lisp file is in the searchpath

    with (findfile "yourLispFile.lsp") you can see if the file is in the searchpath

    where "yourLispFile.lsp" is the file containing the function (begin)

    Hope this helps

    Cheers

    Harrie
     
    zeha, Aug 19, 2004
    #4
  5. v.valentijn

    Tom Smith Guest

    Lisp didn't change in any serious way, and begin was never a built-in function. Your previous setup must have defined begin elsewhere in the startup sequence. Search your R14 setup for an lsp file containing that text string to find out what it was.
     
    Tom Smith, Aug 19, 2004
    #5
  6. v.valentijn

    v.valentijn Guest

    The function (begin) IS in the lisp itself.. seems to be defined just fine..
    it just won't work for 2005.. it does for r14..

    I'm in the dark

    thanx for your suggestions guys but I'm afraid it doesn't really help me.
    Guess I'll get down to studying the lisp and rewrite the (begin) function?
     
    v.valentijn, Aug 19, 2004
    #6
  7. v.valentijn

    R.K. McSwain Guest


    Post the code and let's have a look

    and/or

    use the debugging tools in the visual lisp editor to find why it will not run.
     
    R.K. McSwain, Aug 19, 2004
    #7
  8. v.valentijn

    Tom Smith Guest

    Why not post the begin function? I haven't seen the error message 'function
    undescribed' -- I get "no function definition" if the function hasn't been
    previously defined.

    When lisps stop working between versions, it's often because they call an
    Acad command, and the sequence of command prompts has changed between
    versions. Or it may be calling a command which has been renamed or replaced.

    You could simply comment out the call to (begin) if it isn't doing anything
    essential, and see if the remainder of the lisp works.
     
    Tom Smith, Aug 19, 2004
    #8
  9. v.valentijn

    v.valentijn Guest

    Yes I did that.. the remainder of the list -does- work..oh, and you're right
    it says 'no function described' to be exact.. not 'undescribed' sorry for
    the confusion.
    this is the (begin) function that doesn't work:

    (defun begin ()
    (setvar "cmdecho" 0)
    (setq klok 0)
    (while (not scale)
    (setq scale (getreal "\nDe tekening is getekend schaal 1:..")) ; invoeren
    van de schaal
    (setq s scale)
    (setq sc scale)
    );while
    (command "layer" "make" "TEXT" "color" "red" "" "")
    (command "layer" "make" "LEIDING" "color" "blue" "" "")
    (setq naam (getstring "\nGeef de naam van de tekening: "))
    (setq b (strlen naam ))
    (while (> b 8)
    (alert "\nDe naam is te lang
    Max. 8 tekens ! \n\n")
    (setq naam (getstring "\nGeef de naam van de tekening: "))
    (setq b (strlen naam))
    );while
    (setq file3 (open "c:\\excel\\acad3.xls" "w"))
    (setq filen3 (strcat "c:\\excel\\" naam ".xl3"))
    (setq file6 (open filen3 "w"))
    (while (not hght)
    (setq hght (getreal "\nGeef de hoogte van het leidingnet in meters:..")) ;
    invoeren van de schaal
    );while
    (reset)
    (initget "Ja Nee")
    (setq toev (getkword "\nWilt U een afzuigmond aan een machine toevoegen ?
    "))
    (while (not (= toev "Nee"))
    (progn
    (setq slpt (getpoint "\nWaar komt de aansluiting voor de hoofdleiding? "))
    (setq duit (getint "\nGeef de diameter van de afzuigmond: "))
    (setq ding (getint "\nGeef de diameter voor aansluiting op het leidingnet:
    "))
    (initget "Vast Slang")
    (setq vofs (getkword "Is het een Vaste aansluiting of met een Slang (V/S) ?
    "))
    (setq expt (list (+ (car slpt) (+ (/ (/ ding scale) 2) (/ 50 scale))) (cadr
    slpt)))
    (command "circle" slpt "d" (/ ding scale)
    "text" expt (/ 100 scale) "0" (strcat "%%c" (rtos ding 2
    )
    (if (= vofs "Vast")
    (extra1)
    );if
    (if (= vofs "Slang")
    (extra2)
    );if
    (initget "Ja Nee")
    (setq toev (getkword "\nWilt U nog een afzuigmond aan een machine toevoegen
    ? "))
    );progn
    );while
    (setq tel 0)
    (setq boa nil)
    (setq bep nil)
    (setq aft1 nil)
    (setq aft2 nil)
    (setq aft3 nil)
    (setq ag2 nil)
    (begin2)
    );defun
     
    v.valentijn, Aug 19, 2004
    #9
  10. v.valentijn

    Tom Smith Guest

    I will look at it in detail later, if someone else hasn't already suggested
    a solution.

    But at a quick glance, there are several issues. In the code you posted, the
    parentheses are mismatched by two, so the function won't load or run.
    Perhaps you didn't copy all of the begin function, because this would have
    prevented it from working in any version of Acad.

    Also, none of the variables are declared local to the function. This won't
    necessarily prevent the function from running (if the parentheses were
    fixed), but it's a poor practice which can make a program difficult to
    debug.

    Finally, there are calls to (reset), (extra1), and (extra2), which are not
    built-in lisp functions. If these functions aren't also defined in this
    lisp, they may have been defined elsewhere in your R14 setup. Perhaps this
    is the cause of the missing function error.
     
    Tom Smith, Aug 19, 2004
    #10
  11. v.valentijn

    v.valentijn Guest

    Yes.. I know it's not such clean programming, it's from 96 allready
    the parentheses are mismatched? I didn't notice.. guess the're made up for
    in the rest of the lisp since as you say, if that's mismatched it wouldn't
    be able to run on r14. The calls for (reset) (extra1) and (extra2) are
    viable since they are in the same lisp [it's a rather large lisp in fact]...
    Thanx a lot for looking at this, it's very kind ;)
     
    v.valentijn, Aug 19, 2004
    #11
  12. v.valentijn

    mark Guest

    just a wild suggestion, if u are not running an english version use the
    underscore ex:

    (command "._-layer" "_make" "TEXT" "_color" "_red" "" "")

    the hyphen not necessary in front of the "LAYER", but makes things clearer

    mark



     
    mark, Aug 19, 2004
    #12
  13. I suggest you use the VLIDE to debug where the error occurs.

    Command: VLIDE

    Open the lisp file in the editor.
    Tools->Load Text in Editor
    Check Debug->Break On Error

    At the console, run your routine [example assumes a (defun C:Test)]:
    _$ (C:Test)

    When the error occurs, the console will look like this (note the _1$
    prompt):
    ; error: no function definition: BEGIN
    _1$

    Use <Ctrl><F9> to highlight the line where the error occurred in your code.

    --
    R. Robert Bell


    I've got a lisp routine that runs on Acad14, but it fails to run on 2005...
    I don't know what's wrong since it's been ages since I last wrote some lisp
    routines, I have some sort of suspicion that there used to be a standard
    function called (begin) which has been cancelled in a later version? Does
    anyone have any ideas or a way to find out?
    thanx
     
    R. Robert Bell, Aug 19, 2004
    #13
  14. v.valentijn

    dth Guest

    I may not have caught someone already suggesting this, but AutoDesk has a
    "AutoLISP Compatibility Analyzer" that you can download from their support
    tools. That might be a quick way to look for a fatal flaw.
     
    dth, Aug 19, 2004
    #14
  15. v.valentijn

    ECCAD Guest

    You might have to port the functions:
    (reset), (extra1), (extra2), and (begin2) .. which are not posted here. Also use international Underscore for commands such as (command "_layer" ......

    Bob
     
    ECCAD, Aug 20, 2004
    #15
  16. v.valentijn

    zeha Guest

    V.Valentijn,

    I see the languages is dutch.
    Ik zie dat de routine in het nederlands is, dus probeer ik het maar in het nederlands, Het is misschien niet netjes.

    Allereerst zoals de routine er nu staat mist hij een aantal haken in de volgende regels
    (command "circle" slpt "d" (/ ding scale)
    "text" expt (/ 100 scale) "0" (strcat "%%c" (rtos ding 2
    )

    Achter ding 2 moeten 2 haken worden toegevoegd (vergelijk hieronder en boven)
    (command "circle" slpt "d" (/ ding scale)
    "text" expt (/ 100 scale) "0" (strcat "%%c" (rtos ding 2))
    )

    Een verandering in de nieuwe versie (ook in ADT2004) is het commando layer
    Door een ._ (punt underscore) ervoor te zetten is dit op te lossen.
    De punt is voor het ongedefinieerde commando. De underscore voor een vreemde taal.
    Ik neem echter aan dat je de engelse versie hebt.
    Hopelijk is dit de oplossing.

    Ik ben zo vrij geweest om de routine aan te passen en staat hieronder.

    Uiteraard heb ik geen zicht op de andere routines/functies (reset)(begin2) etc..
    Een aantal andere zaken zou ik gebruiksvriendelijk gemaakt hebben.

    (defun begin ()
    (setvar "cmdecho" 0)
    (setq klok 0)
    (while (not scale)
    (setq scale (getreal "\nDe tekening is getekend schaal 1:..")) ; invoeren
    van de schaal
    (setq s scale)
    (setq sc scale)
    );while
    (command "._layer" "make" "TEXT" "color" "red" "" "")
    (command "._layer" "make" "LEIDING" "color" "blue" "" "")
    (setq naam (getstring "\nGeef de naam van de tekening: "))
    (setq b (strlen naam ))
    (while (> b 8)
    (alert "\nDe naam is te lang
    Max. 8 tekens ! \n\n")
    (setq naam (getstring "\nGeef de naam van de tekening: "))
    (setq b (strlen naam))
    );while
    (setq file3 (open "c:\\excel\\acad3.xls" "w"))
    (setq filen3 (strcat "c:\\excel\\" naam ".xl3"))
    (setq file6 (open filen3 "w"))
    (while (not hght)
    (setq hght (getreal "\nGeef de hoogte van het leidingnet in meters:..")) ;invoeren van de schaal
    );while
    (reset)
    (initget "Ja Nee")
    (setq toev (getkword "\nWilt U een afzuigmond aan een machine toevoegen ?"))
    (while (not (= toev "Nee"))
    (progn
    (setq slpt (getpoint "\nWaar komt de aansluiting voor de hoofdleiding? "))
    (setq duit (getint "\nGeef de diameter van de afzuigmond: "))
    (setq ding (getint "\nGeef de diameter voor aansluiting op het leidingnet:"))
    (initget "Vast Slang")
    (setq vofs (getkword "Is het een Vaste aansluiting of met een Slang (V/S) ?"))
    (setq expt (list (+ (car slpt) (+ (/ (/ ding scale) 2) (/ 50 scale))) (cadr
    slpt)))
    (command "._circle" slpt "d" (/ ding scale)
    "._text" expt (/ 100 scale) "0" (strcat "%%c" (rtos ding 2)))
    (if (= vofs "Vast")
    (extra1)
    );if
    (if (= vofs "Slang")
    (extra2)
    );if
    (initget "Ja Nee")
    (setq toev (getkword "\nWilt U nog een afzuigmond aan een machine toevoegen? "))
    );progn
    );while
    (setq tel 0)
    (setq boa nil)
    (setq bep nil)
    (setq aft1 nil)
    (setq aft2 nil)
    (setq aft3 nil)
    (setq ag2 nil)
    (begin2)
    );defun

    Zijn er nog vragen, vraag gerust.

    Met vriendelijke groet

    Harrie
     
    zeha, Aug 20, 2004
    #16
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.