none
How to build a script file? RRS feed

  • Question

  • I have some problem finding out how to buld a script file. I would like to open Autocad with a script to batch multiple files. For this i need to build a large script (temp.scr) file and copy some content to it.

    I have a listbox where i can choose different files. The content of this file i would like to copy and paste it to the temporary temp.scr file. Lets say i choosen one file and it have a content like below

    ;Command:
    FILEDIA
    ;Enter new value for FILEDIA <1>:
    0
    ;------RITA LINJE
    ._LINE
    0,0
    2000,2000
    _QSAVE

    I have 3 .dwg files.

    • drawing1.dwg
    • drawing2.dwg
    • drawing3.dwg

    I want to make a temporary .scr file and run it with autocad.

    My goal is to make the file look like this. The first three rows is repeating before the contets of the script is pasted. This three rows would be nice to have inside my program so its easy to paste and change .dwg file name within a loop because the amount of dwg files always changes.

    Last row is always the same in the end.

    (if (findfile (strcat "C:/Users/andre/AppData/Local/Temp/_stopScript.now"))(command ".END"))
    (setq wf1 "C:/Temp/")
    (if (or (= (getvar "dbmod") 0) (= (getvar "dbmod") 32)) (command "_fileopen" (strcat wf1 "drawing1.dwg"))(command "_fileopen" "_yes" (strcat wf1 "drawing1.dwg")))
    ;Command:
    FILEDIA
    ;Enter new value for FILEDIA <1>:
    0
    ;------RITA LINJE
    ._LINE
    0,0
    2000,2000
    _QSAVE
    (if (findfile (strcat "C:/Users/andre/AppData/Local/Temp/_stopScript.now"))(command ".END"))
    (setq wf1 "C:/Temp/")
    (if (or (= (getvar "dbmod") 0) (= (getvar "dbmod") 32)) (command "_fileopen" (strcat wf1 "drawing2.dwg"))(command "_fileopen" "_yes" (strcat wf1 "drawing2.dwg")))
    ;Command:
    FILEDIA
    ;Enter new value for FILEDIA <1>:
    0
    ;------RITA LINJE
    ._LINE
    0,0
    2000,2000
    _QSAVE
    (if (findfile (strcat "C:/Users/andre/AppData/Local/Temp/_stopScript.now"))(command ".END"))
    (setq wf1 "C:/Temp/")
    (if (or (= (getvar "dbmod") 0) (= (getvar "dbmod") 32)) (command "_fileopen" (strcat wf1 "drawing3.dwg"))(command "_fileopen" "_yes" (strcat wf1 "drawing3.dwg")))
    ;Command:
    FILEDIA
    ;Enter new value for FILEDIA <1>:
    0
    ;------RITA LINJE
    ._LINE
    0,0
    2000,2000
    _QSAVE
    _quit _yes
    Thanks for your guidance in advance.

    Saturday, July 27, 2019 3:22 PM

Answers

All replies