I was having issue with my lisp not finishing when I used my script generator.
Below is the lisp code that I got to work when used in script generator. It was odd cause I had no issues in a single drawing when ran as just lisp
Below that are 2 lines that are generated from my script generator.
Has to do with the line return as mentioned about by CADffm, i solved this by just adding a blank "(command)" after attsync. Hope this helps.
;===========================================================
; 9/Jun/2021 10:24 AM[Wednesday] AUTHOR: Brandon Gum
;--
;----WORKING---
;DESCRIPTION: Replace a block definition over a list of drawings. Designed to be used with ScriptPro.
;We will use the CoreConsole within Script Pro.
;--
;The insert portion needs a = after the block name to let it know that you are trying to redeclare from external source.
;--
;Had issues with this in script format with it not continuing on.
;SOLVED! ---> Attysnc was cause. See details below. Logged in onenote.
;--
;Thought it has to do with attsync and or active viewport.
;Ended up being because of attsync.
;Saw a post online that said you needed a line-return after specifing the block name to confirm it. Just added a "(command)" afterwards.
;------------
;HELPFUL LINK =;https://www.cad-notes.com/how-to-update-autocad-block-in-multiple-files-using-script/
;https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/best-practice-modifying-block-definitions/td-p/8902280
;===========================================================
;-INSERT
;"O:\Veolia Technical Solutions\13004.330 Gum Springs\Dwgs\_Plant 3D\Constructs\Veolia E-size PID Border Text"
(defun C:BlockRedefine ( / )
(command "attreq" "0") ;added as precaution
(if (= (getvar 'tilemode) 0) ;if already in paperspace
(progn
(command "._PSPACE") ;disable active viewport as a precaution
);_end of progn
);_end of if
(if (tblsearch "block" "Veolia E-size P3D Border Text")
(progn
(command "-rename" "b" "Veolia E-size P3D Border Text" "Veolia E-size PID Border Text")
(command "insert" "Veolia E-size PID Border Text=O:\\Veolia Technical Solutions\\13004.330 Gum Springs\\Dwgs\\_Plant 3D\\Constructs\\Veolia E-size PID Border Text" nil)
(command "_.attsync" "n" "Veolia E-size PID Border Text")
(command) ;needed to get the lisp to work when ran with bg_scr_generator. It would stop and not save then close. However it would continue to work if I typed resume.
(while (= 1 (getvar 'cmdactive)) ;wait for cmd to finish as a precaution. Was having issues with script not continuing.
(command pause) ;added as precaution
) ;end of while
) ;_end of progn
) ;_end of if
(command "attreq" "1") ;added as precaution
(princ) ;quiet close
) ;end of function
_.open "O:\Veolia Technical Solutions\13004.330 Gum Springs\Dwgs\_Plant 3D\Dwgs_Gum Springs\PID DWG\VGS-PRO-0100-PID-8770.dwg" (setvar "filedia" 0) (load "blockredefine" nil) (C:blockredefine) _.qsave
_.close
_.open "O:\Veolia Technical Solutions\13004.330 Gum Springs\Dwgs\_Plant 3D\Dwgs_Gum Springs\PID DWG\VGS-PRO-0100-PID-8771.dwg" (setvar "filedia" 0) (load "blockredefine" nil) (C:blockredefine) _.qsave
_.close