jamami Posted Tuesday at 07:45 PM Author Posted Tuesday at 07:45 PM I have just read through all the link on the core console and indeed this could be a powerful ally. Quote
BIGAL Posted Wednesday at 02:25 AM Posted Wednesday at 02:25 AM (edited) Have a look at this a good explanation of how to use Accoreconsole. https://forums.autodesk.com/t5/forums/replypage/board-id/130/message-id/444989 It was done by Paullimapa at Forums/autodeks but link appears broken will try to find again for you its a step by step procedure example. Autodesk have been playing with their forum and this may be the problem. You could try googling given authors name. Also an example. bat file echo off :: Path to AutoCAD core console set accoreexe="C:\Program Files\Autodesk\AutoCAD 2014\accoreconsole.exe" :: Path to the script to run set script="C:\Users\[USERNAME]\Desktop\IPAD\TESTER\tester2.scr" %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST1.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST2.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST3.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST4.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST5.dwg /s %script% pause Another link this one works. https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html Edited Wednesday at 02:33 AM by BIGAL Quote
SLW210 Posted Wednesday at 10:42 AM Posted Wednesday at 10:42 AM I already showed an example for accoreconsole. I worked a little while on some batch LISP with no luck. If I have time I'll try again. I made headway on a DCL, but it's slow going for me on side projects right now. .bat files run on Windows, you shouldn't need anything from IT. Somewhere I have a VBA that took an Excel list of filepaths and made a script to run on those files, I populated the file list in Excel by going to the folder selecting the files and Shift+Right-Click>Copy as Path "C:\Drawings\CADTutor\Layer_Report\BC1000-3D-LWT.dwg" "C:\Drawings\CADTutor\Layer_Report\Drawing1.dwg" "C:\Drawings\CADTutor\Layer_Report\V03210-3D-LWT.dwg" "C:\Drawings\CADTutor\Layer_Report\AA0002-3D-LWT.dwg" "C:\Drawings\CADTutor\Layer_Report\AA0003-3D-LWT.dwg" "C:\Drawings\CADTutor\Layer_Report\AA0005-3D-LWT.dwg" "C:\Drawings\CADTutor\Layer_Report\AA0006-3D-LWT.dwg" "C:\Drawings\CADTutor\Layer_Report\AF0001-3D-LWT.dwg" Here are some old threads on LISP methods AutoLISP run on group of drawings? - AutoLISP, Visual LISP & DCL - AutoCAD Forums How to create a routine to batch process files or a directory Quote
jamami Posted Wednesday at 10:51 AM Author Posted Wednesday at 10:51 AM I have been using excel to make the scripts, mainly string functions. using first DOS command dir *.dwg /b >list.txt to get the file list (frustrating that windows doesn't offer anyway of getting a file list from file explore) I have recently processed another folder (only 2 to go now) but have noticed when i open a few files one by one for checking that sometimes the blocks are not exploded, groups are not ungrouped and also all linetypes are continuous. I have looked at the make layer function and is defining layer name, colour, weight and transparency. I changed the m2a function to add a prefix rather than a suffix as this makes it a lot easier to sort the list in windows explorer when the files are in the same folder. Quote
SLW210 Posted Wednesday at 11:00 AM Posted Wednesday at 11:00 AM Maybe this more recent thread... Activate Lisp Code On Multiple DWG's - AutoLISP, Visual LISP & DCL - AutoCAD Forums Quote
SLW210 Posted Wednesday at 11:05 AM Posted Wednesday at 11:05 AM 8 minutes ago, jamami said: I have been using excel to make the scripts, mainly string functions. using first DOS command dir *.dwg /b >list.txt to get the file list (frustrating that windows doesn't offer anyway of getting a file list from file explore) I have recently processed another folder (only 2 to go now) but have noticed when i open a few files one by one for checking that sometimes the blocks are not exploded, groups are not ungrouped and also all linetypes are continuous. I have looked at the make layer function and is defining layer name, colour, weight and transparency. I changed the m2a function to add a prefix rather than a suffix as this makes it a lot easier to sort the list in windows explorer when the files are in the same folder. 1. In file explorer just follow my above instructions and you get the full path to paste. 2. Could they be nested blocks, locked layers or something? Maybe run explode 2-3 times, or if it's just a few run them again. 3. That's fine, by default -EXPORTTOAUTOCAD puts ACAD at the front of the new drawing. I still haven't had time to start cleaning my own folders. Thanks for being the tester! Quote
SLW210 Posted Wednesday at 11:28 AM Posted Wednesday at 11:28 AM VBA Scripting Extreme Class_Presentation_TR322385_Michael_Best Quote
jamami Posted Wednesday at 11:35 AM Author Posted Wednesday at 11:35 AM Current file is below, including my heathen hacks. -explode all loop added -Overkill added -additional layer set ups added to catch pre existing layers ;;////////////////////////////////////////////////// ;; checkcolor (defun CheckEntColor (ent / entData color layer layerData layerColor) (setq entData (entget ent)) (setq color (cdr (assoc 62 entData))) (cond ((and color (/= color 256) (>= color 5)) T) ((or (not color) (= color 256)) (setq layer (cdr (assoc 8 entData))) (setq layerData (tblsearch "LAYER" layer)) (setq layerColor (cdr (assoc 62 layerData))) (if (and layerColor (>= layerColor 5)) T nil)) (T nil) ) ) (defun c:dpsr (/ doc ms result layers-ok ltypes-ok ents-ok props-ok layer-errors ltype-errors enttype-errors prop-errors csv-line ename clr lt lyr ) (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq ms (vla-get-modelspace doc)) (setq *audit-csv-path* (strcat (getvar "DWGPREFIX") "DWG_Audit_Report.csv")) ;; CSV functions (defun append2csv (line / file) (setq file (open *audit-csv-path* "a")) (if file (progn (write-line line file) (close file)) (prompt "\nERROR: Cannot write to audit CSV.") ) ) (defun writecsvheader () (if (not (findfile *audit-csv-path*)) (append2csv "DWGNAME,LAYERSTATES,LINETYPES,ENTITYTYPES,ENTITYDEF,LAYER-ERRS,LT-ERRS,TYPE-ERRS,PROP-ERRS" ) ) ) ;;//////////////////////////////////////////////////////// ;; Create or set a layer (defun makelayer (name color lw tran ltype) (if (not (tblsearch "layer" name)) (vla-add (vla-get-layers doc) name) ) (vla-put-color (vla-item (vla-get-layers doc) name) color) (vla-put-lineweight (vla-item (vla-get-layers doc) name) lw) (command "-layer" "tr" (rtos tran 2 0) name "") (command "-layer" "l" ltype name "") ) ;; Explode blocks ;;(vlax-for ent ms ;; (if (and (= "AcDbBlockReference" (vla-get-objectname ent)) ;; (vlax-method-applicable-p ent 'explode) ;;) ;;(vla-explode ent) ;;) ;;) (defun explodeall ( / explode layouts ) (setq layouts (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) explode t ) (while explode (setq explode nil) (vlax-for layout layouts (vlax-for obj (vla-get-block layout) (and (= "AcDbBlockReference" (vla-get-objectname obj)) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-explode (list obj)))) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-delete (list obj)))) (setq explode t) ) ) ) ) ;(princ) ) (explodeall) ;; Create layers (makelayer "D-3D-SOL" 7 30 0 "Continuous") (makelayer "D-3D-CLG" 1 18 0 "Center") (makelayer "D-3D-CLM" 5 18 0 "Center") (makelayer "0" 7 -1 0 "Continuous") ;; catch all to make sure everything is set ok if not created by makelayer fuction ;; Set current layer to sol (command "_.layer" "_set" "D-3D-SOL" "") (command "_.layer" "_c" "7" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.3" "" "") (command "_.layer" "_l" "Continuous" "" "") ;; Set current layer to clm (command "_.layer" "_set" "D-3D-CLM" "") (command "_.layer" "_c" "5" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.18" "" "") (command "_.layer" "_l" "Center" "" "") ;; Set current layer to clg (command "_.layer" "_set" "D-3D-CLG" "") (command "_.layer" "_c" "1" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.18" "" "") (command "_.layer" "_l" "Center" "" "") ;; Set current layer to 0 (command "_.layer" "_set" "0" "") (command "_.layer" "_c" "7" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.25" "" "") (command "_.layer" "_l" "Continuous" "" "") ;; Error counters (setq layer-errors 0 ltype-errors 0 enttype-errors 0 prop-errors 0 ) ;; Process objects (vlax-for ent ms (setq ename (vla-get-objectname ent) clr (vla-get-color ent) lt (vla-get-linetype ent) lyr (vla-get-layer ent) ) ;; Classification and move to appropriate layer (cond ((wcmatch ename "AcDb3dSolid,AcDbSurface") (vla-put-layer ent "D-3D-SOL") ) ((and (member ename '("AcDbLine" "AcDbPolyline" "AcDbCircle" "AcDbArc")) (not (CheckEntColor (vlax-vla-object->ename ent))) ;; Was (not (CheckEntColor ent)) ) (vla-put-layer ent "D-3D-CLG") ) ((and (member ename '("AcDbLine" "AcDbPolyline" "AcDbCircle" "AcDbArc")) (CheckEntColor (vlax-vla-object->ename ent)) ) (vla-put-layer ent "D-3D-CLM") ) ) ;; Set ByLayer color and linetype (if (/= clr 256) (progn (vla-put-color ent 256) (setq prop-errors (1+ prop-errors)) ) ) (if (/= (strcase lt) "BYLAYER") (progn (vla-put-linetype ent "BYLAYER") (setq prop-errors (1+ prop-errors)) ) ) ;; Track invalid types and linetypes (if (not (member ename '("AcDbLine" "AcDbPolyline" "AcDbCircle" "AcDb3dSolid" "AcDbSurface" "AcDbArc" ) ) ) (setq enttype-errors (1+ enttype-errors)) ) (if (not (member (strcase lt) '("BYLAYER" "CONTINUOUS" "CENTER")) ) (setq ltype-errors (1+ ltype-errors)) ) ) ;; Delete entities on layer "0" (vlax-for ent ms (if (= (strcase (vla-get-layer ent)) "0") (vla-delete ent) ) ) ;; Set layer 0 current (vla-put-activelayer doc (vla-item (vla-get-layers doc) "0") ) ;;Remove duplicates (command "-OVERKILL" "ALL" "" "") ;; Purge all (repeat 3 (command "_.PURGE" "ALL" "*" "N")) (repeat 2 (command "_.PURGE" "Regapps" "*" "N")) ;; Set UCS/view (command "_.UCS" "_W") (command "_.-VISUALSTYLES" "C" "_CONCEPTUAL") ;; Fixed (command "_.VIEW" "_SWISO") (command "_.ZOOM" "_E") ;; Final checks (setq layers-ok (and (tblsearch "layer" "0") (tblsearch "layer" "D-3D-SOL") (tblsearch "layer" "D-3D-CLG") (tblsearch "layer" "D-3D-CLM") ) ) ;; Build CSV output (setq result (strcat (getvar "DWGNAME") "," (if layers-ok "PASS" "FAIL" ) "," (if (= ltype-errors 0) "PASS" "FAIL" ) "," (if (= enttype-errors 0) "PASS" "FAIL" ) "," (if (= prop-errors 0) "PASS" "FAIL" ) "," (itoa layer-errors) "," (itoa ltype-errors) "," (itoa enttype-errors) "," (itoa prop-errors) ) ) (writecsvheader) (append2csv result) (prompt (strcat "\nDWGProcessor Complete. Audit: " result)) (princ) ) Quote
jamami Posted Wednesday at 11:47 AM Author Posted Wednesday at 11:47 AM 16 minutes ago, SLW210 said: VBA Scripting Extreme Class_Presentation_TR322385_Michael_Best lots of reference to vba, i do not have this installed at present for ACAD but I do use it a great deal in Excel. I had the impression it was phased out? Quote
jamami Posted Wednesday at 11:54 AM Author Posted Wednesday at 11:54 AM 9 hours ago, BIGAL said: Have a look at this a good explanation of how to use Accoreconsole. https://forums.autodesk.com/t5/forums/replypage/board-id/130/message-id/444989 It was done by Paullimapa at Forums/autodeks but link appears broken will try to find again for you its a step by step procedure example. Autodesk have been playing with their forum and this may be the problem. You could try googling given authors name. Also an example. bat file echo off :: Path to AutoCAD core console set accoreexe="C:\Program Files\Autodesk\AutoCAD 2014\accoreconsole.exe" :: Path to the script to run set script="C:\Users\[USERNAME]\Desktop\IPAD\TESTER\tester2.scr" %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST1.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST2.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST3.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST4.dwg /s %script% %accoreexe% /i C:\Users\[USERNAME]\Desktop\IPAD\TESTER\TEST5.dwg /s %script% pause Another link this one works. https://through-the-interface.typepad.com/through_the_interface/2012/02/the-autocad-2013-core-console.html Thank you Quote
jamami Posted Wednesday at 11:56 AM Author Posted Wednesday at 11:56 AM 19 minutes ago, jamami said: Current file is below, including my heathen hacks. -explode all loop added -Overkill added -additional layer set ups added to catch pre existing layers ;;////////////////////////////////////////////////// ;; checkcolor (defun CheckEntColor (ent / entData color layer layerData layerColor) (setq entData (entget ent)) (setq color (cdr (assoc 62 entData))) (cond ((and color (/= color 256) (>= color 5)) T) ((or (not color) (= color 256)) (setq layer (cdr (assoc 8 entData))) (setq layerData (tblsearch "LAYER" layer)) (setq layerColor (cdr (assoc 62 layerData))) (if (and layerColor (>= layerColor 5)) T nil)) (T nil) ) ) (defun c:dpsr (/ doc ms result layers-ok ltypes-ok ents-ok props-ok layer-errors ltype-errors enttype-errors prop-errors csv-line ename clr lt lyr ) (vl-load-com) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq ms (vla-get-modelspace doc)) (setq *audit-csv-path* (strcat (getvar "DWGPREFIX") "DWG_Audit_Report.csv")) ;; CSV functions (defun append2csv (line / file) (setq file (open *audit-csv-path* "a")) (if file (progn (write-line line file) (close file)) (prompt "\nERROR: Cannot write to audit CSV.") ) ) (defun writecsvheader () (if (not (findfile *audit-csv-path*)) (append2csv "DWGNAME,LAYERSTATES,LINETYPES,ENTITYTYPES,ENTITYDEF,LAYER-ERRS,LT-ERRS,TYPE-ERRS,PROP-ERRS" ) ) ) ;;//////////////////////////////////////////////////////// ;; Create or set a layer (defun makelayer (name color lw tran ltype) (if (not (tblsearch "layer" name)) (vla-add (vla-get-layers doc) name) ) (vla-put-color (vla-item (vla-get-layers doc) name) color) (vla-put-lineweight (vla-item (vla-get-layers doc) name) lw) (command "-layer" "tr" (rtos tran 2 0) name "") (command "-layer" "l" ltype name "") ) ;; Explode blocks ;;(vlax-for ent ms ;; (if (and (= "AcDbBlockReference" (vla-get-objectname ent)) ;; (vlax-method-applicable-p ent 'explode) ;;) ;;(vla-explode ent) ;;) ;;) (defun explodeall ( / explode layouts ) (setq layouts (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) explode t ) (while explode (setq explode nil) (vlax-for layout layouts (vlax-for obj (vla-get-block layout) (and (= "AcDbBlockReference" (vla-get-objectname obj)) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-explode (list obj)))) (not (vl-catch-all-error-p (vl-catch-all-apply 'vla-delete (list obj)))) (setq explode t) ) ) ) ) ;(princ) ) (explodeall) ;; Create layers (makelayer "D-3D-SOL" 7 30 0 "Continuous") (makelayer "D-3D-CLG" 1 18 0 "Center") (makelayer "D-3D-CLM" 5 18 0 "Center") (makelayer "0" 7 -1 0 "Continuous") ;; catch all to make sure everything is set ok if not created by makelayer fuction ;; Set current layer to sol (command "_.layer" "_set" "D-3D-SOL" "") (command "_.layer" "_c" "7" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.3" "" "") (command "_.layer" "_l" "Continuous" "" "") ;; Set current layer to clm (command "_.layer" "_set" "D-3D-CLM" "") (command "_.layer" "_c" "5" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.18" "" "") (command "_.layer" "_l" "Center" "" "") ;; Set current layer to clg (command "_.layer" "_set" "D-3D-CLG" "") (command "_.layer" "_c" "1" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.18" "" "") (command "_.layer" "_l" "Center" "" "") ;; Set current layer to 0 (command "_.layer" "_set" "0" "") (command "_.layer" "_c" "7" "" "") (command "_.layer" "_tr" "0" "" "") (command "_.layer" "_lw" "0.25" "" "") (command "_.layer" "_l" "Continuous" "" "") ;; Error counters (setq layer-errors 0 ltype-errors 0 enttype-errors 0 prop-errors 0 ) ;; Process objects (vlax-for ent ms (setq ename (vla-get-objectname ent) clr (vla-get-color ent) lt (vla-get-linetype ent) lyr (vla-get-layer ent) ) ;; Classification and move to appropriate layer (cond ((wcmatch ename "AcDb3dSolid,AcDbSurface") (vla-put-layer ent "D-3D-SOL") ) ((and (member ename '("AcDbLine" "AcDbPolyline" "AcDbCircle" "AcDbArc")) (not (CheckEntColor (vlax-vla-object->ename ent))) ;; Was (not (CheckEntColor ent)) ) (vla-put-layer ent "D-3D-CLG") ) ((and (member ename '("AcDbLine" "AcDbPolyline" "AcDbCircle" "AcDbArc")) (CheckEntColor (vlax-vla-object->ename ent)) ) (vla-put-layer ent "D-3D-CLM") ) ) ;; Set ByLayer color and linetype (if (/= clr 256) (progn (vla-put-color ent 256) (setq prop-errors (1+ prop-errors)) ) ) (if (/= (strcase lt) "BYLAYER") (progn (vla-put-linetype ent "BYLAYER") (setq prop-errors (1+ prop-errors)) ) ) ;; Track invalid types and linetypes (if (not (member ename '("AcDbLine" "AcDbPolyline" "AcDbCircle" "AcDb3dSolid" "AcDbSurface" "AcDbArc" ) ) ) (setq enttype-errors (1+ enttype-errors)) ) (if (not (member (strcase lt) '("BYLAYER" "CONTINUOUS" "CENTER")) ) (setq ltype-errors (1+ ltype-errors)) ) ) ;; Delete entities on layer "0" (vlax-for ent ms (if (= (strcase (vla-get-layer ent)) "0") (vla-delete ent) ) ) ;; Set layer 0 current (vla-put-activelayer doc (vla-item (vla-get-layers doc) "0") ) ;;Remove duplicates (command "-OVERKILL" "ALL" "" "") ;; Purge all (repeat 3 (command "_.PURGE" "ALL" "*" "N")) (repeat 2 (command "_.PURGE" "Regapps" "*" "N")) ;; Set UCS/view (command "_.UCS" "_W") (command "_.-VISUALSTYLES" "C" "_CONCEPTUAL") ;; Fixed (command "_.VIEW" "_SWISO") (command "_.ZOOM" "_E") ;; Final checks (setq layers-ok (and (tblsearch "layer" "0") (tblsearch "layer" "D-3D-SOL") (tblsearch "layer" "D-3D-CLG") (tblsearch "layer" "D-3D-CLM") ) ) ;; Build CSV output (setq result (strcat (getvar "DWGNAME") "," (if layers-ok "PASS" "FAIL" ) "," (if (= ltype-errors 0) "PASS" "FAIL" ) "," (if (= enttype-errors 0) "PASS" "FAIL" ) "," (if (= prop-errors 0) "PASS" "FAIL" ) "," (itoa layer-errors) "," (itoa ltype-errors) "," (itoa enttype-errors) "," (itoa prop-errors) ) ) (writecsvheader) (append2csv result) (prompt (strcat "\nDWGProcessor Complete. Audit: " result)) (princ) ) I suspect this would be better if the make layer routine recognised the layer already existed and then ensured the standards where applied to that layer. Quote
BIGAL Posted Thursday at 12:28 AM Posted Thursday at 12:28 AM This will write direct to excel dwg names, just pick a dwg in correct directory. Do not have Excel open as it will be opened. Big thanks to Lee Mac for the get dwg names. ; https://www.cadtutor.net/forum/topic/98263-extracting-block-data-to-a-report/page/6/ (defun c:dwgs2excel ( / direc filen files) ;; Directory Files - Lee Mac ;; Retrieves all files of a specified filetype residing in a directory (and subdirectories) ;; dir - [str] Root directory for which to return filenames ;; typ - [str] Optional filetype filter (DOS pattern) *.dwg ;; sub - [bol] If T, subdirectories of the root directory are included ;; Returns: [lst] List of files matching the filetype criteria, else nil if none are found (defun LM:directoryfiles ( dir typ sub ) (setq dir (vl-string-right-trim "\\" (vl-string-translate "/" "\\" dir))) (append (mapcar '(lambda ( x ) (strcat dir "\\" x)) (vl-directory-files dir typ 1)) (if sub (apply 'append (mapcar '(lambda ( x ) (if (not (wcmatch x "`.,`.`.")) (LM:directoryfiles (strcat dir "\\" x) typ sub) ) ) (vl-directory-files dir nil -1) ) ) ) ) ) ;; Thanks to fixo ;; ;; = Set Excel cell text = ;; ;; ;; (defun xlsetcelltext ( row column text) (setq cells (vlax-get-property (vlax-get-property myxl "ActiveSheet") "Cells")) (vl-catch-all-apply 'vlax-put-property (list cells 'Item row column (vlax-make-variant (vl-princ-to-string text) vlax-vbstring)) ) ) (setq myxl (vl-catch-all-apply 'vlax-get-or-create-object '("Excel.Application"))) (vlax-invoke-method (vlax-get-property myXL 'WorkBooks) 'Add) (vla-put-visible myXL :vlax-true) (vlax-put-property myxl 'ScreenUpdating :vlax-true) (vlax-put-property myXL 'DisplayAlerts :vlax-true) (setq direc (VL-FILENAME-DIRECTORY (getfiled "Select dwg File for top directory " "" "dwg" 16))) (initget 1 "Yes No") (setq Yesno (getkword "\nDo you want subdirectories [Yes No] ")) (if (= yesno "Yes") (setq files (LM:directoryfiles direc "*.dwg" T)) (setq files (LM:directoryfiles direc "*.dwg" nil)) ) (setq row 0) (foreach filen Files (xlsetcelltext (setq row (1+ row)) 1 filen) ) (princ) ) 1 Quote
jamami Posted Thursday at 02:53 PM Author Posted Thursday at 02:53 PM I have tried the dwgstoexcel routine. Works great but you need to have excel open for it run or a bad argument is returned. dwgstoexcel ask user to select a dwg in the top level folder (would be nice to simply select the top level folder?) Quote
jamami Posted Thursday at 02:55 PM Author Posted Thursday at 02:55 PM no more DOS required for now, but looks like dos is still required if using the core console. should core console be shipped with acad2026, i cannot find it in program files? Quote
SLW210 Posted Thursday at 05:34 PM Posted Thursday at 05:34 PM You should find it here... C:\Program Files\Autodesk\AutoCAD 2026\accoreconsole.exe Up and Running with the 2013 Core Console | AutoCAD Tips Core Console is to put it simply the AutoCAD commandline If you make the .bat file as I and BIGAL showed, just save as a .bat file, double click that and it will run. @echo off setlocal :: Set the AutoCAD Core Console executable path set AutoCADCoreConsole="C:\Program Files\Autodesk\AutoCAD 2023\acadcore.exe" :: Set the path to the folder containing your DWG files set folderPath=C:\Path\To\Your\Drawings :: Set the path to your LISP file set lispFile=C:\Path\To\Your\LISP\M2A.LSP :: Loop through all DWG files in the folder for %%f in (%folderPath%\*.dwg) do ( echo Processing: %%f %AutoCADCoreConsole% /i "%%f" /s "%lispFile%" -r M2A ) :: End of batch script endlocal Quote
jamami Posted Thursday at 07:04 PM Author Posted Thursday at 07:04 PM wow!! i cut paste that into the search bar and it immediately fired up using my last template ! brilliant i will have a play thank you. 1 Quote
SLW210 Posted Friday at 12:53 PM Posted Friday at 12:53 PM You can also create a file list with Powershell. Get-ChildItem -Path "C:\YourFolderPath" -File | Select-Object FullName | Export-Csv -Path "C:\YourOutputPath\filepaths.csv" -NoTypeInformation Quote
SLW210 Posted 23 hours ago Posted 23 hours ago https://learn.microsoft.com/en-us/powershell/scripting/learn/ps101/01-getting-started?view=powershell-7.5 https://www.digitalcitizen.life/simple-questions-what-powershell-what-can-you-do-it/ To quote https://en.wikipedia.org/wiki/PowerShell Quote PowerShell is a shell program developed by Microsoft for task automation and configuration management. As is typical for a shell, it provides a command-line interpreter for interactive use and a script interpreter for automation via a language defined for it. Originally only for Windows, known as Windows PowerShell, it was made open-source and cross-platform on August 18, 2016, with the introduction of PowerShell Core.[6] The former is built on the .NET Framework; the latter on .NET (previously .NET Core). 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.