BreakObjects22.lsp File - Command Line Error Code Attached - Startup Error

A fledgling LISP programmer asks: See the attached error taken from the subject routine loaded with an autoload statement in the "on_start.lsp" file in BricsCAD v19.1 Platinum version.
Can you see and provide a hint on resolving this error?

Comments

  • The error message is quite informative.

    ; ----- Error around expression -----
    ; (STRLEN ACADFN)
    ; in file :
    ; C:\Users\chill\Documents\BCAD\LISP\Breakobjects22.lsp
    ;
    Error: bad argument type <NIL> ; expected <STRING> at [strlen]

    So:
    ACADFN is nil.
    Why?:
    Because "ACAD.PAT" cannot be found in the search path.
    Why?:
    Because the default hatch pattern files for BricsCAD are "default.pat" and "iso.pat".
    Note:
    Apart from changing the filename you will also have to update this code:
    (substr acadfn 1 (- (strlen acadfn) 8)
    "ACAD.PAT" has 8 characters.

  • Interesting! I appreciate your comments and time, sir.

  • Will do, Charles! BTW, I am glad I switched to this our current CAD software. Fine folks like you and Mr. Gebbinck are but two reasons for my elation.

    C.

  • I cannot locate what is most likely a LISP "101" level error: Debugging practice time with BLADE is needed.
    The syntax with the double quotes appears to be correct as I checked it with a FINDFILE statement.

    The LOAD statement gives an error (replacing FINDFILE with LOAD).
    Hmmmmm???

    Here is the message at the command line:
    (findfile "breakobjects23.lsp")
    "C:\Users\chill\Documents\BCAD\LISP\breakobjects23.lsp"
    (load "breakobjects23.lsp")

    ; ----- Error around expression -----
    ; (LOAD "breakobjects23.lsp")
    ;
    ; error : malformed list on input at [read] : File <C:/Users/chill/Documents/BCAD/LISP/breakobjects23.lsp>

  • I am confused.

    If so, is the modified line of code needed?
    (substr acadfn 1 (- (strlen acadfn) 8)
    "ACAD.PAT" has 8 characters.

    Considering the changes reflected in the latest version , BreakObjects23.lsp, should I change the number to 11 characters as in "default.pat" instead of 8 characters in "acad.pat"?

    I have much learning to do!

  • OK, before you leave, I found the mismatched parentheses. How do I resolve the final impediment to a successful run? Here is the latest error string:

    (load "breakobjects23.lsp")
    Break routines loaded, Enter Mybreak to run.
    MYBREAK

    ; ----- LISP : Call Stack -----
    ; [0]...C:MYBREAK
    ; [1].....CREATE_BREAKDCL <<-- ; ; ----- Error around expression ----- ; (STRLEN ACADFN) ; in file : ; C:\Users\chill\Documents\BCAD\LISP\breakobjects23.lsp ; ; error : bad argument type <NIL> ; expected at [strlen]

  • The somewhat modified code is attached...

  • Sorry I'm in the middle of something & can't break away. :)

  • Hi CAB. That code has certainly weathered the ravages of time.

  • Kerry Brown
    edited June 2019

    @chillme1 said:
    The somewhat modified code is attached...

    Chillme,
    It would be nice if you changed the name of code you modify and post back on the forums. Simply adding a suffix with your name would be good.
    The reason: 'someone' in the future may download the code and try it without being aware of it's imperfections ; which will lead to more demands on the authors resources.

  • Perhaps your changes need looking at

    original:
    fn (strcat (substr acadfn 1 (- (strlen acadfn) 8))fname)
    yours:
    fn (substr acadfn 1 (- (strlen acadfn) 11))

    Regards,

  • Kerry Brown
    edited June 2019

    found some time between naps ...

    try this perhaps around line 870

      (if (dcl-rev-check fname)
        ;; create dcl file in same directory as ACAD.PAT  
        (progn
          (setq patfn (if Brics "default.pat" "ACAD.PAT")
                acadfn (findfile patfn)
                ;; kdub revised ;; fn (strcat (substr acadfn 1 (- (strlen acadfn) 8))fname)
                fn (strcat (vl-filename-directory acadfn) "\\" fname)
                fn (open fn "w")
          )
          (foreach x (list    >>>>>
    

    Regards

  • Kerry and others of this kind audience,

    Your comments and Kerry's suggestions on how to improve posts with disciplined attachment naming are all welcome.

    Wrap up of this issue follows:

    ERROR MESSAGE
    See the attached "Error....txt"
    This file includes command line error statements when attempting to start the program.

    ON_START.LSP
    See the "on_start.lsp" file:
    I cannot determine but will assume the error occurs in my customized version of the "on_start.lsp" file
    It contains a statement loading the latest version of

    BREAKOBJECTS23.LSP (Modified)
    See the "BreakObjects23.lsp" and is attached as "Modified_per_CEH_w_Kerry_Code_6Jun2019_BreakObjects23.lsp"
    (Strip all but the original filename of "BreakObjects23.lsp" to test )

    ERROR DETAILS
    The error appears to be a simple parenthesis mismatch. I cannot find this mismatch.
    Please review and confirm where this error occurs both in the line and in which actual program file?

    I have much more LISP learning to do!

    Thanks,
    C.

  • @chillme1
    What you have done is a bit strange. The code Kerry provided should be used to overwrite a portion of the file. Not inserted randomly. Go back to the original file and try again. And you should not paste this part: '>>>>>', this simply indicated that the original code continues here.

  • chillme1
    edited June 2019

    I agree: You do strange things when floundering: I am rightfully feeling the embarrassment of ignorance. I think it is finally enough to start focusing on a single programming language since switching to this application and BLADE!

  • Attached is the code with Kerry's correction/improvement