Jarod1990 Posted November 5, 2021 Posted November 5, 2021 Good morning everyone, I have an issue with a *.scr which run with AccoreConsole.exe. This *.scr run a lisp to ATTSYNC a specific block and zoom. Then, *.scr "_QSAVE" the file. I'm using Accoreconsole.exe to execute the script However, it's like the lisp 's not running... Could you help me ? the *.lisp (no space at the end - it's french autocad) (defun c:lisp_attsync nil (command "attsync" "_name" "CO_XX_XX_EL_BLOCK") (command "zoom" "ETendu") ) the *.scr FILEDIA 0 (LOAD "C:\\Temp\\lisp_attsync.lsp") (lisp_attsync) _QSAVE FILEDIA 1 and the commande to accoreconsole.exe C:\Temp>"C:\Program Files\Autodesk\AutoCAD 2015\accoreconsole.exe" /i "C:\Temp\CH_SP_04_BT_CR_304_F016.dwg" /s attsyn.scr /l fr-FR however it's like there is nothing... and of course, only "_Qsave" command works.. Commande: C:\Temp>"C:\Program Files\Autodesk\AutoCAD 2015\accoreconsole.exe" /i "C:\Temp\CH_SP_04_BT_CR_304_F016.dwg" /s attsyn.scr /l fr-FR AutoCAD Core Engine Console - Copyright Autodesk, Inc 2009-2013. Remplacement de [romans8] par [simplex.shx]. Régénération du modèle. Appuyez sur ENTREE pour continuer: Commande: Commande: Commande: Commande: FILEDIA Entrez une nouvelle valeur pour FILEDIA <0>: 0 Commande: (LOAD "C:\\Temp\\lisp_attsync.lsp") Commande: (lisp_attsync) Commande: _QSAVE Commande: FILEDIA Entrez une nouvelle valeur pour FILEDIA <0>: 1 Commande: _quit Commande: C:\Temp> If I change the commande to run the lisp with an undefined command ("nothing_real for example), there isn't warning : Entrez une nouvelle valeur pour FILEDIA <0>: 0 Commande: (LOAD "C:\\Temp\\lisp_attsync.lsp") Commande: (nothing_real) Commande: _QSAVE Commande: FILEDIA Entrez une nouvelle valeur pour FILEDIA <0>: 1 Commande: _quit So what's wrong ? Thank for your help Quote
mhupp Posted November 5, 2021 Posted November 5, 2021 (edited) Update your .scr file. (defun c:lisp_attsync nil ;nil is fine but i always use Try to use all the commands in the lisp. (defun c:lisp_attsync () (command "attsync" "_name" "CO_XX_XX_EL_BLOCK") (command "zoom" "ETendu") (command "_.Qsave") ;I might have a variable set but this stays in the command prompt even with filedia =1 set (command "_.Close") ;autosaves if alreay a file. asks for a file path if not saved already. ) Your issue When Calling lisps have what the defun is named. (lisp_attsync) doesn't work (c:lisp_attsync) works Edited November 5, 2021 by mhupp Quote
Jarod1990 Posted November 5, 2021 Author Posted November 5, 2021 Thanks for your answer, but there still an issue... I saved the folder c:\Temp as safe folder for autocad, and now the lisp is running. => Good ! But... Accoreconsole doesn't know "ATTSYNC"... Commande: (c:lisp_attsync) ATTSYNC Commande inconnue "ATTSYNC". Appuyez sur F1 pour obtenir de l'aide. Commande: name Commande inconnue "NAME". Appuyez sur F1 pour obtenir de l'aide. Commande: CO_XX_XX_EL_ Any Idea ? thanks a lot. Quote
mhupp Posted November 5, 2021 Posted November 5, 2021 (edited) Try "_.attsync" to force the English command. either the _ or the . does that. or it might be an Express tool command idk. --EDIT-- Source Adding the "dot" before a command name ensures that the generic AutoCAD command will be used instead of one that might be substituted (or missing) by virtue of the command having been undefined. You might also see/use (command "_.LIST" ...) wherein the underscore ensures that the command will be recognized by its English language despite the actual language being used. --EDIT 2-- Read These https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/attsync-in-accoreconsole/td-p/8440291 https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/can-t-run-my-selfmade-lsp-in-accoreconsole/td-p/7437946 Edited November 5, 2021 by mhupp Quote
Jarod1990 Posted November 5, 2021 Author Posted November 5, 2021 thanks, but no... (defun c:lisp_attsync () (command "_.attsync" "_NAME" "CO_XX_XX_EL_BLOCK") (command "_.zoom" "ETendu") (command "_.Qsave") (command "_.Close") ) (defun c:lisp_attsync () (command "_.attsync" "_NAME" "CO_XX_XX_EL_BLOCK") (command "_.zoom" "ETendu") (command "_.Qsave") (command "_.Close") ) I'm going to look Express tool... Quote
mhupp Posted November 5, 2021 Posted November 5, 2021 (edited) You could always just run the script inside AutoCAD with the script command. This is what I use to build script files from a single folder. had one that would read off a txt file outputted from cmd of all the file paths but cant find it. but first see if attsync is a command in your AutoCAD first. ;;----------------------------------------------------------------------------;; ;; Make script file for ATTSYN drawings in a folder. (defun C:FOO (/ Path F1 FileName) (setq Path (vl-filename-directory (getfiled "Choose a Folder to Process" (getvar 'DWGPREFIX) "*" 16)) ;click on a file to set folder location. fname (vl-directory-files Path "*.dwg" 1) ;list all file types of this type. fname (vl-remove (getvar 'DWGNAME) fname) fname (vl-sort fname '<) F (open (strcat (getenv "userprofile") "\\Documents\\Script.scr") "w") ;saves script file to your mydocuments folder. ) (if (= nil fname) (prompt "\nNo Drawings Found in Folder") (progn (foreach FileName fname (princ (strcat "_.Open \"" Path "\\" FileName "\"\n") F) ;change " to \" (princ "(LOAD \"C:\\Temp\\lisp_attsync.lsp\")\n" F) (princ "(c:lisp_attsync)\n" F) ) (princ "(prompt \"ATTSYN COMPLETE\")\n" F) ) ) (close F) ;(vl-cmdf "_.Script" (strcat (getenv "userprofile") "\\Documents\\Script.scr")) ;uncomment to run automatically (princ) ) Edited November 5, 2021 by mhupp typo Quote
Jarod1990 Posted November 5, 2021 Author Posted November 5, 2021 Thanks a lot, Amazing ! I just change the lisp like this : (defun c:lisp_attsync () (command "_.attsync" "_NAME" "CO_XX_XX_EL_Cartouche SPSE ELEC A3") (command "_.zoom" "ETendu") (command "_.Qsave") ;(command "_.Close") <=comment this one ) and add the command "_.close" to your script ;;----------------------------------------------------------------------------;; ;; Make script file for ATTSYN drawings in a folder. (defun C:FOO (/ Path F1 FileName) (setq Path (vl-filename-directory (getfiled "Choose a Folder to Process" (getvar 'DWGPREFIX) "*" 16)) ;click on a file to set folder location. fname (vl-directory-files Path "*.dwg" 1) ;list all file types of this type. fname (vl-remove (getvar 'DWGNAME) fname) fname (vl-sort fname '<) F (open (strcat (getenv "userprofile") "\\Documents\\Script.scr") "w") ;saves script file to your mydocuments folder. ) (if (= nil fname) (prompt "\nNo Drawings Found in Folder") (progn (foreach FileName fname (princ (strcat "_.Open \"" Path "\\" FileName "\"\n") F) ;change " to \" (princ "(LOAD \"C:\\Temp\\lisp_attsync.lsp\")\n" F) (princ "(c:lisp_attsync)\n" F) (princ "_.Close\n" F) ) (princ "(prompt \"ATTSYN COMPLETE\")\n" F) ) ) (close F) ;(vl-cmdf "_.Script" (strcat (getenv "userprofile") "\\Documents\\Script.scr")) ;uncomment to run automatically (princ) ) I aslo add double \ to the location of lisp_attsync.lsp because Script.scr has only one. (I did this with NotePade+). _.Open "C:\Temp\CH_SP_04_EL_EL_EL_SP_04_0001_F14.dwg" (LOAD "C:\\Temp\\lisp_attsync.lsp") (c:lisp_attsync) _.Close _.Open "C:\Temp\CH_SP_04_EL_EL_EL_SP_04_0001_F16.dwg" (LOAD "C:\\Temp\\lisp_attsync.lsp") (c:lisp_attsync) _.Close (prompt "ATTSYN COMPLETE") Thanks a lot again, this script will run on 16590 electric dwg.... Quote
mhupp Posted November 5, 2021 Posted November 5, 2021 1 hour ago, Jarod1990 said: Thanks a lot again, this script will run on 16590 electric dwg.... it will take along time to run though all those. might want to split it up into 8th's or something with notepad++. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.