Im new to LISP routines and Visual Basic

Discussion in 'AutoCAD' started by gatordea, Feb 23, 2005.

  1. gatordea

    gatordea Guest

    Im new to programming and work with ACAD all the time. I would like to improve my work by making it faster and better by using LISP routines or Visual Basic. Which is better? How can I learn more about both? What books do you suggest? I would like to understand better what is written in the discussion groups.
    Thank you for all your help
     
    gatordea, Feb 23, 2005
    #1
  2. gatordea

    Tom Smith Guest

    Im new to programming and work with ACAD all the time. I would like to
    improve my work by making it faster and better by using LISP routines or
    Visual Basic. Which is better? How can I learn more about both? What
    books do you suggest? I would like to understand better what is written in
    the discussion groups.

    Old question, search this NG for extensive past discussions on exactly the
    same question.
    They are different, as a pocketknife is different from a chainsaw. Neither
    one eliminates the need for the other. They aren't interchangeable. Some
    might claim that the (VB) chainsaw is more powerful, but it's a lot easier
    and more reasonable to do an everyday chore like sharpening a pencil or
    opening a box with the (lisp) pocketknife. Personally, I have a lot more
    frequent and varied uses for a pocketknife than for a chainsaw. But when you
    actually need a chainsaw, there's no substitute.

    Which is better depends on what you need. Sooner or later you may need both.
    Anyone who tells you that only one is in all cases superior in all ways is a
    "true believer" (fanatic) who ought to be taken with at least a grain of
    salt.
     
    Tom Smith, Feb 23, 2005
    #2
  3. gatordea

    Anne Brown Guest

    gatordea -

    Welcome to the discussion groups. As Tom suggested, a search of
    the past topics will bring up a lot of material to review.

    The discussion group search engine provides flexibility for
    searching through existing message content. To search:

    1. Go to http://discussion.autodesk.com/

    2. Select a product (Example: AutoCAD and then to Customization).

    3. Type your keywords into the search box and click Search. I
    used "tutorial" without the "" and got 126 past discussions on
    that subject. You might want to read through those while waiting
    to see if one of your peers answers directly.

    Note: You can further refine your query by selecting a specific
    discussion group from the dropdown provided. Your group choices
    will vary in the drop down, based on where you have navigated on
    the discussion group site.

    Search results are sorted by relevance (a complex query of all
    relevant content based on your keywords and group choices).
    Clicking on the message result will display the entire thread
    (the series of messages and replies). Clicking on the Post date
    will sort the results by date with most recent first.
     
    Anne Brown, Feb 23, 2005
    #3
  4. gatordea

    GTASteve Guest

    Re: AutoLISP vs. VBA
    "They are different, as a pocketknife is different from a chainsaw. Neither one eliminates the need for the other. They aren't interchangeable. Some might claim that the (VB) chainsaw is more powerful, but it's a lot easier and more reasonable to do an everyday chore like sharpening a pencil or opening a box with the (lisp) pocketknife. Personally, I have a lot more frequent and varied uses for a pocketknife than for a chainsaw. But when you actually need a chainsaw, there's no substitute."

    Poetry! pure Poetry!

    I'm so glad you wrote this, this is exactly how I feel on the matter, and it is a perfect analagy (sp?)

    Now I know the perfect reply, for when someone asks me, which is better.

    Thank you.
     
    GTASteve, Feb 23, 2005
    #4
  5. gatordea

    James Buzbee Guest

    They are different, as a pocketknife is different from a chainsaw.

    That's why I NEVER play with chainsaws . . ..

    ;-)

    jb
     
    James Buzbee, Feb 23, 2005
    #5
  6. Hi,

    And why I only use the pocketknife to clean the teeth of the chainsaw. :)

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Feb 23, 2005
    #6
  7. gatordea

    Tom Smith Guest

    You must make a big mess when you open an envelope.
     
    Tom Smith, Feb 23, 2005
    #7
  8. Hi Luis,

    Not hard.
    The hardest item for lisp programmers will probably be that, in general, you
    should define variable before using them and assign a data type to the
    variable, and that you can't set a variable to be one data type and then
    later in the code change it to something else.

    ie You can't do:
    x = 3
    x = "Fred"
    whereas in lisp
    (setq x 3) (setq x "Fred") is perfectly viable (whether it is sensible is
    another argument).
    Both Lisp and VBA are programming languages with variable assignment,
    function calls, decision code and looping code.

    An approach I have used is to clipboard the lisp code to VBA.

    First work through the code for "(setq variable Something)" and replace
    with
    variable = Something, being careful that "Something" is a value and not a
    call to a function such as:
    "(setq variable (Something Parameter))"
    in which case you would end up with
    variable = Something (Parameter)

    Arithmetic like things
    (+ 1 2) become 1 + 2


    (if (test)
    (progn
    ( something1)
    ( something2)
    )
    (elsesomething)
    )

    becomes
    If test
    something1
    something2
    else
    somethingelse
    End if

    The equivalent of Lists are Collections, but in many cases arrays will be
    used as they are a much earlier implementation and users will be far more
    familiar with them.
    etc.
    As the editor highlights code with incorrect syntax, it is easy to identify
    the bits you haven't fixed.

    As I have no experience of VLAX, I have no idea what it's code does and
    can't add principles for transforming VLAX code.

    Having said all that, it is often easier to create the program from a flow
    chart of what you expect the program to do.
    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Feb 24, 2005
    #8
  9. you know, I sure miss the cond statement of lisp when in VB. Select case only deals with values, not different tests to
    perform in order.
    I also have problems with and statements in VB, if I say:
    if var1 = 2 and oAlignment is nothing then....

    it does not behave how expected.
    I might have rephrased the pocketknife/chainsaw comment by saying...
    "two women are better than one"... <g>

    "Laurie Comerford" <>
    |>Hi Luis,
    |>
    |>Not hard.
    |>The hardest item for lisp programmers will probably be that, in general, you
    |>should define variable before using them and assign a data type to the
    |>variable, and that you can't set a variable to be one data type and then
    |>later in the code change it to something else.
    |>
    |>ie You can't do:
    |> x = 3
    |> x = "Fred"
    |>whereas in lisp
    |>(setq x 3) (setq x "Fred") is perfectly viable (whether it is sensible is
    |>another argument).
    |>Both Lisp and VBA are programming languages with variable assignment,
    |>function calls, decision code and looping code.
    |>
    |>An approach I have used is to clipboard the lisp code to VBA.
    |>
    |>First work through the code for "(setq variable Something)" and replace
    |>with
    |>variable = Something, being careful that "Something" is a value and not a
    |>call to a function such as:
    |>"(setq variable (Something Parameter))"
    |>in which case you would end up with
    |> variable = Something (Parameter)
    |>
    |>Arithmetic like things
    |>(+ 1 2) become 1 + 2
    |>
    |>
    |>(if (test)
    |>(progn
    |> ( something1)
    |> ( something2)
    |>)
    |> (elsesomething)
    |>)
    |>
    |>becomes
    |>If test
    |> something1
    |> something2
    |> else
    |>somethingelse
    |>End if
    |>
    |>The equivalent of Lists are Collections, but in many cases arrays will be
    |>used as they are a much earlier implementation and users will be far more
    |>familiar with them.
    |>etc.
    |>As the editor highlights code with incorrect syntax, it is easy to identify
    |>the bits you haven't fixed.
    |>
    |>As I have no experience of VLAX, I have no idea what it's code does and
    |>can't add principles for transforming VLAX code.
    |>
    |>Having said all that, it is often easier to create the program from a flow
    |>chart of what you expect the program to do.

    James Maeding
    jmaeding at hunsaker dot com
    Civil Engineer/Programmer
     
    James Maeding, Feb 25, 2005
    #9
  10. t does not behave how expected.
    I might have rephrased the pocketknife/chainsaw comment by saying...
    "two women are better than one"... <g>

    Rock and roll....
     
    Luis Esquivel, Feb 25, 2005
    #10
  11. gatordea

    gatordea Guest

    i could not agree more
    thanks everyone for all the help
    I ordered two books from amazon about LISP and VB
    I hope they help
    THANKS!
     
    gatordea, Feb 25, 2005
    #11
  12. gatordea

    Tom Smith Guest

    Not hard.
    Your first generalization could lead to an interesting programming challenge/shootout, which probably deserves a thread of its own. The languages are so different. I run a few lisps on startup that do things which I believe would be practically impossible to "translate" to BASIC on anything like a line by line basis.

    Your second observation would come into play -- you'd have to look at the program's objective, and find a completely different way of achieving an equivalent result, and I'd bet that, if indeed it could be done, there wouldn't be the slightest resemblance in code/methodology/algorithm between the different language versions. And it might be arguable whether the basic version accomplished the same goal, or turned it into a different problem.

    I've translated basic algorithms into lisp, before VB support existed, to get their functionality into Acad. But I think the reverse process could be more difficult -- I think it wouldn't be very hard at all to write a lisp that would be quite difficult to replicate in basic.

    I'll post a "challenge" when I get a chance, it could lead to an interesting comparison.
     
    Tom Smith, Feb 25, 2005
    #12
  13. gatordea

    James Allen Guest

    Hi James,

    I've had similar difficulties. I suspect you already know this, but just in
    case, and for other's reference; you can wrap vb code in parentheses to make
    it cooperate. For complex conditions, it helps you tell the program
    whether, for example, you mean:
    ((var1 = 2) and oAlignment) is nothing... or
    (var1 = 2) and (oAlignment is nothing)
    I suspect the latter, but vb may not unless you make it explicit.
    <myrant>Also seems that there would be a general member function...
    Built-in I mean... That returns false, not an error if the member does not
    exist.</myrant> ;)
    --
    James Allen, EIT
    Malicoat-Winslow Engineers, P.C.
    Columbia, MO


    only deals with values, not different tests to
     
    James Allen, Feb 25, 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.