Using "Insert" in Menu/Lisp with Strcat

I have a menu that I use in AutoCAD for a client that uses lisp to call for blocks.
It uses a variable g_path which is set to C:/Users/cnelson/BCADStuff/ACADWIN/" then when the blocks are picked it does a strcat g_path "FORMAT/INSERT/STICKERS/506"
It does a -insert with that strcat but Bricscad errors and says block name invalid, see attached screen shot. Does Bricscad allow insert to use a variable for the block name?
Thanks!

Comments

  • It might depend on TEXTEVAL, but better to just strcat everything:
    (command (strcat "_-INSERT " g_path "FORMAT/INSERT/STICKERS/506" "\n"))

  • Another Example: I am able at the command line set AA to the concatenation of g_path and the string, but in the menu it doesn't work... grrr

    (SETQ AA (strcat g_path "FORMAT/INSERT/STICKERS/506"))
    "C:/Users/cnelson/BCADStuff/ACADWIN/FORMAT/INSERT/STICKERS/506"
    :

    (la_test "NOTES" "3" "")
    -insert
    ? to list blocks in drawing/~ to open the file dialog/: (strcat g_path "FORMAT/INSERT/STICKERS/506")Block name is invalid. Please use =.
  • 2 potential reasons :
    a) does the path "g_path" ends with "\" or "/" ?
    b) you might append ".dwg" to the filename ... maybe this fixes the "-insert" behaviour ?

    many greetings !

  • It ends in a "/" "C:/Users/cnelson/BCADStuff/ACADWIN/"

    Tried the .dwg but no dice...

    Thanks!

    Carl

    @Torsten Moses said:
    2 potential reasons :
    a) does the path "g_path" ends with "\" or "/" ?

    b) you might append ".dwg" to the filename ... maybe this fixes the "-insert" behaviour ?

    many greetings !

  • Roy Klein Gebbinck
    edited January 2018

    @carlnelson:
    If you are using not using (command ...) then looking at the TEXTEVAL setting (as suggested by Owen) may make sense. If you are using (command ...) post your code.

    FWIW: This work fine (irrespective of the TEXTEVAL setting):
    (command "_.-insert" (strcat "te" "st"))

  • It's menu driven, so what is running is:
    ***POP11
    [SETUP]
    [->Borders]
    [&D-Size]^C^C(la_test "BORDER" "7" "") -insert;(strcat g_path "FORMAT/BORDER/B_D");0,0;(getvar "dimscale");;;
    It's a rather large Insert block menu so I'd rather not have to re-write as it works fine in ACAD.... but I I guess a find and replace would make short work of it....
    I'm just surprised that if I type -insert at the command line and at the prompt type (strcat g_path "FORMAT/BORDER/B_D") it says block name is invalid....

    Carl

    @Roy Klein Gebbinck said:
    @carlnelson:
    If you are using not using (command ...) then looking at the TEXTEVAL setting (as suggested by Owen) may make sense. If you are using (command ...) post your code.

    FWIW: This work fine (irrespective of the TEXTEVAL setting):
    (command "_.-insert" (strcat "te" "st"))

  • Thanks Owen!
    I set TEXTEVAL to 1 and it works great! Whew!
    Doh!

    Thank you everyone for helping out!!!

    Carl

    @Owen Wengerd said:
    It might depend on TEXTEVAL, but better to just strcat everything:
    (command (strcat "_-INSERT " g_path "FORMAT/INSERT/STICKERS/506" "\n"))

  • Additional, if you check texteval in AutoCAD you will probably notice it is set there to 1 too (default is 0), behaviour of both programs is quite similar when doing basic things like -insert. Owen and Roy suggested a more structural solution for the future ;-)

  • carlnelson
    edited January 2018

    @Wiebe van der Worp said:
    Additional, if you check texteval in AutoCAD you will probably notice it is set there to 1 too (default is 0), behaviour of both programs is quite similar when doing basic things like -insert. Owen and Roy suggested a more structural solution for the future ;-)

    Thanks!
    TEXTEVAL when I checked in AutoCAD was set to zero, which is why I never thought to check that... lol
    This client 3rd party menu that I have to use was created in the 1990 and earlier, the last update was for AutoCAD 2011 on 4/4/2013, it's really creaky and I am thrilled that less than a week after downloading BricsCAD it now works flawlessly! :-) happy dance!
    Carl

This discussion has been closed.