LISP behaviour in BricsCAD vs AutoCAD

Can anyone tell what is the difference between LISP behaviour in AutoCAD and BricsCAD?

I found one lisp file about creating line on Autodesk-V22 forum (https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/draw-a-line-lisp/td-p/9562764) I tried to check and debug that on AutoCAD and it worked.
In Similar way I tried that in BricsCAD-V22 with BLADE for debugging and it gives me Lisp error.
I am new to lisp so can anyone tell me what is the problem here.
I am attaching LISP Code and images for reference.

Comments

  • Anthony Apostolaros
    edited January 2023
    The code you posted works for me. It accepts two pick points, with no prompts or rubber-banding, and then draws a line of length 100 from the first point in the direction of the second.

    The link in your post doesn't work for me -- "Invalid Parameters Specified"
  • Judging from the Blade error message you are clicking a keyboard key instead of picking a point. I would be surprised if the same inputs work in AutoCAD.
  • Roy: Yes, I think Pranav is entering "0" instead of picking the first point. That works for me in Bricscad, to my great surprise.
  • Based on the given information "1" is being entered for the 2nd point.
  • Anthony Apostolaros
    edited January 2023
    "1" works too. It's interpreted as a length specification in the direction of the cursor, as usual. Since the second point is only for orientation, any number would work, except 0.

    "0" (shown in 1.png), when used in lieu of the first pick point, starts the new line at the endpoint of the last line drawn. When used in lieu of the second pick point, it draws a line to the right.
  • @Anthony Thanks!!
    your Code works for me.
    Will try to figure it out for old one.
  • @Roy Actually I picked point and trying to debug. but still getting the error for the old lsp file that I shared.
    and the file which Anthony shared is worked for me.
  • Anthony Apostolaros
    edited January 2023
    Pranav, I don't know why the code you posted works for me but not for you. If you're using a newer version of Bricscad that might explain it. I use a very old version. There've been changes to Autolisp over the years, and sometimes a function that worked before fails in a new version. In my experience that's only been true of lisp functions from the distant past.

    In general, lisp functions work the same in Bricscad as in Autocad, only faster. I know there are lisp functions that work in AC but not BC, but I think they're very rare. I've never encountered one.
  • Some functions are very slightly different Polygon is one of them, no Reverse command in V20 but Pedit supports reverse.
  • iPranavKulkarni
    edited February 2023
    @Anthony seems like need to restructure my old code. because it works when I change some APIs it works and in some of cases it doesn't.
    May be my old code is one of the rare case :)
  • @ALANH YES. creation of selection set with some list also behaving different
  • Wblock is another in CIV3D have a extra question "Save Map data" not in Bricscad, there is though a check for which CAD are you using. Trying to remember product something.
  • Anthony Apostolaros
    edited February 2023

    .... seems like need to restructure my old code ....

    Pranav, I was surprised that your line.lsp function worked in my v17. I didn't think a lisp symbol could have the same name as a system variable, but your function uses a symbol called OSMODE to store the value of the OSMODE system variable. Could that be the reason why it doesn't work in newer versions?

    If so, the attached revised version of your function should work. It's the same as the original except that the command is renamed as REVISED and the symbol originally called OSMODE is renamed as VAR1.