create a lisp

Is there an easy to build software tool to create LISP routines?

Or do I have to learn how to program?
Are there good online courses?

Regards Werner

Comments

  • Join, www.theswamp.org it’s where all the cool cad programmers hang out.

  • Read afralisp.com.
    You are the tool that writes Lisp :)

  • Anthony Apostolaros
    edited February 2020

    There's a complete list of built-in lisp functions in the online Developers Reference. To program in Lisp, you define a new function using the DEFUN function and one or more other built-in functions and the arguments they accept.

    You can type any lisp function on the Bricscad command line to see how it works. It's a good way to learn, and a good way to test any part of a function you're creating.

    And you can use that command line option to immediately run a combination of one or more lisp functions and their arguments, instead of defining a new function for later use. Or you can put that type of combination in a menu or toolbar item.

    Often, the function you want to create has already been created by someone else, and usually they're willing to share the function with you. The aforementioned Swamp is a good place to start your search for those.

  • @Abbeel
    Like Anthony said, you can start using just the command line.
    Or put code in a text file with .lsp extension.
    Theswamp.org and the autodesk customization discussion groups are the two places lispers hang out.
    Feel free to ask here too, just start with small items like:
    (defun c:CIRC1 () (command "circle" (getpoint "\nPick Center:") 1.0))

    Type that on command line, or copy and paste.
    Then type CIRC1 to run. Now you are a programmer!

  • Anthony Apostolaros
    edited February 2020

    @James Maeding said:
    (defun c:CIRC1 () (command "circle" (getpoint "\nPick Center:") 1.0))

    Great example, James.
    Werner, note that the C: in front of the name of the function being defined makes it a command rather than a simple lisp function.
    And the GETPOINT function is executed first, because it's inside the innermost parentheses. The point it "gets" is then used by the next function, COMMAND, whose first argument is the CIRCLE command.
    The rest of the COMMAND function has to be whatever response(s) the specified command expects (in the order that it expects them) -- in this case, first a point, then a radius.

  • To clarify further, always read from the start of the line to the first ) you encounter
    At this point, lisp starts "backing out" to the next higher nest level.
    If you are using the BLADE editor, you can see where the next ( starts by highlighting the closing paren ).
    The first ) in the example is for the getpoint nest, and the last is for the command nest.

  • maybe I want to much already :sweat_smile:
    Will look into it with my brother, he can program, but doesn't know ACAD/BricsCAD
    He can read the LISP, where I fail.

    What I want is a job-specific routine.

    I'm a solar-plant designer for about 10 years, (CAD-designer for about 15 years) and lose a lot of time for drawing the electrical strings, not the single wire, but the actual place on the roof.
    mounting structures doesn't take a lot of time, block in block in block, and more blocks in blocks...

    I used to draw in ACAD lt and just made the switch to BricsCAD. So a whole new world is opening up for me.

    If I could Write a LISP that could draw a line in selected solar-panel blocks, through middle points, place a + at the start, and a - at the end, gave it a unique name and change the selected blocks from color/layer, that would make my day/week/year :smiley:

    If then afterwards I would be able to export the XY of each unique pline, pfjieuw,... that would be a dream.

    I found a lot of pleasant LISP-routines already, but hungry for more.

    Regards Werner

  • Anthony Apostolaros
    edited February 2020

    Werner,

    Can you post images of a typical operation, maybe screen shots taken before and after the operation? Or a video. And tell us what parts of the operation would have to be done manually at runtime and what parts you'd like the lisp function to do automatically.

  • @Abbeel
    Yes, post lots of detail. What seems complex to you is likely simple to long time lisperers, but you must be very specific.
    Don't worry about wasting our time, we need the details and also pictures too.
    thx

  • Hello,

    For this week I have a lot of work that needs to be done,
    But I will look into that next week and create a pdf of it with screenshots.

    regards Werner