Lisp working in certain drawing only

Hallo.
I am using a compiled lisp code to draw concrete reinforcement but 2 things happen I can't understand:
1 - When I launch a specific lisp, let's call it "A", it shows an error message "Can't open file ABC.dwg". The file ABC exists and it is in the program directory. If I open ABC.dwg and I launch A lisp inside that drawing, then the lisp routine works and draws the block it is supposed to be drawn. If I copy/paste that block in a new drawing, then the lisp routine A works even in that new drawing. Summing up: to have the lisp working or I invoke it inside the ABC drawing or I invoke it inside a drawing where there is the block created by the lisp. Have you any clue how to fix it (I can't read lisp content)?
2 - In a field related to a line, created by the lisp, there should be the line length. Instead of the length, it is written the command that should give the length (eg. %<\AcObjProp.16.2 Object(%<\_ObjId 1622008192>%).Length \f "%lu2%pr0%ct8[0.1]">%). If i cut this line from the field and paste it afterwards in the same place, it shows the length instead of showing the string, having changed nothing. Have you any idea?

Thank you for your support.
Regards.

Comments

  • Hello.

    1.
    To have the file ABC.dwg found every time, it should be placed in one of the support folders.
    Alternatively, the path to ABC.dwg could be added to the support folders.
    I tested with (findfile) and it worked fine.

    2.
    I can't be sure of it but there might be an issue with the string passed to the (vla-put-textstring) function.
    Specifically, the backslashes should be doubled so that they are interpreted as backslashes and not as escaping characters.

    However, the double quotes should be escaped.

    For instance, this is what I tested in a particular drawing:
    (vla-put-textstring "%<\\AcObjProp.16.2 Object(%<\\_ObjId 2899227920>%).Length \\f \"%lu2%pr0%ct8[0.1]\">%")

    This worked fine.