I launched the batch file by simply right clicking on it and "run as administrator"
If you are directing that statement at me, ...
I launched the batch file by simply right clicking on it and "run as administrator
Because if that's the case, Lisp is enough.I tried again to do what I said with Lisp.
In fact, you can do a lot more with Lisp!
If you do not need: commands, ssget, ssname, ssdel... getvar, setvar... entmod, entupd... you can use ObjectDBX and open in Background...
ObjectDBX saves in the current version format.If you do not need: commands, ssget, ssname, ssdel... getvar, setvar... entmod, entupd... you can use ObjectDBX and open in Background...
Unfortunately, ObjectDBX saves *.DWG files only in the latest file format - R2018... And OP wanted to save as R2000...
Opening an AutoCAD 2018 format file.
Regenerating model.
AutoCAD menu utilities loaded.
KDUBToolsRibbon.mnl loaded . [Build 243:2023.05.25]
Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application or Autodesk licensed application.
Command:
Wouldn't ObjectDBX be far more complicated then you need?!
I don't understand everyone's issue or aversion to using a simple batch script and a lisp file to do this. Two files.
It's the same as what you've already seen in this thread: https://www.theswamp.org/index.php?topic=56891.msg605601#msg605601Wouldn't ObjectDBX be far more complicated then you need?!
I don't understand everyone's issue or aversion to using a simple batch script and a lisp file to do this. Two files.
This is a nice solution John. I'm going to copy it.
Unfortunately, I did not test it out back then. :idiot2:It's the same as what you've already seen in this thread: https://www.theswamp.org/index.php?topic=56891.msg605601#msg605601 (https://www.theswamp.org/index.php?topic=56891.msg605601#msg605601)Wouldn't ObjectDBX be far more complicated then you need?!
I don't understand everyone's issue or aversion to using a simple batch script and a lisp file to do this. Two files.
This is a nice solution John. I'm going to copy it.
I've already linked to that batch script in this thread--and others--and people seem to ignore it and try to write a complicated thing using a combination of lisp, willpower, and duct tape; is it because they don't know what a batch script is?
You can use Lisp inside of SCR files.everything ?
You can use Lisp inside of SCR files.everything ?
I think they mean "all lisp functions"?You can use Lisp inside of SCR files.everything ?
I don't understand your question. If you don't want my help, then just please say so.
I don't understand your question.
If you don't want my help,
then just please say so.
The only limitation I can think of is that you don't want to use dialogs or anything that requires user interaction. Also, your lisp solution is what ScriptPro does. It's a nice GUI for batch processing. The only problem is that you have to restart AutoCAD for each dwg processed, but it does it automatically. AcCoreConsole is much faster though. If you just want an easy solution, ScriptPro (https://github.com/ADN-DevTech/ScriptPro-installer#start-of-content) is user friendly. But if you have tasks that take a lot of processing time, AcCoreConsole is a better choice.I don't understand your question.
If you don't want my help,
then just please say so.
I don't understand your last answer...
I just asked if it is possible to use LISP
to write ANYTHING in SCR files...
or if there are LIMITATIONS...
I never used ACCORECONSOLE
and SCR files ...
...
So i am simply trying
to understand something
...
that's all !
The only limitation I can think of is that you don't want to use dialogs or anything that requires user interaction. Also, your lisp solution is what ScriptPro does. It's a nice GUI for batch processing. The only problem is that you have to restart AutoCAD for each dwg processed, but it does it automatically. AcCoreConsole is much faster though. If you just want an easy solution, ScriptPro (https://github.com/ADN-DevTech/ScriptPro-installer#start-of-content) is user friendly. But if you have tasks that take a lot of processing time, AcCoreConsole is a better choice.
I don't know what you have in startup, but I doubt you would need it when using console. It's like using ObjectDbx, there's no interface. When using console, you can't do anything with the coordinate system, like Zoom extents. You may be able to just change the extension on your lisp file to scr and run it. Give it a try. That's the best way to find out what you can do.The only limitation I can think of is that you don't want to use dialogs or anything that requires user interaction. Also, your lisp solution is what ScriptPro does. It's a nice GUI for batch processing. The only problem is that you have to restart AutoCAD for each dwg processed, but it does it automatically. AcCoreConsole is much faster though. If you just want an easy solution, ScriptPro (https://github.com/ADN-DevTech/ScriptPro-installer#start-of-content) is user friendly. But if you have tasks that take a lot of processing time, AcCoreConsole is a better choice.
and if I only want the content (excluding dialogues and interactions)
of the ACADDOC.LSP file (and the inside defun S::STARTUP) ...
to be executed ...
do you think that ACCORECONSOLE does it?
...
And if I only want this,
what is the command I have to put in the SCR file?
You may be able to just change the extension on your lisp file to scr and run it. Give it a try. That's the best way to find out what you can do.I tried... but nothing happens!
Renaming doesn't work. I can't use 7z on my work pc.
if [%script%]==[] (
set script="%~dp0\BatchDrawings_Script.scr"
In the line below, change it to the path of your acad.exe.:: UPDATE as necessary.
if [%accoreconsole%]==[] set accoreconsole="C:\Program Files\Autodesk\AutoCAD 2024\accoreconsole.exe"
There's no need to create a bat that names all the dwg files. In Windows, if you drag a file onto a bat file, the bat file will run with the file passed as an argument. So just drag a bunch of dwg files onto the bat file and it will take care of running core console.I don't think you are doing it right.
There's no need to create a bat that names all the dwg files. In Windows, if you drag a file onto a bat file, the bat file will run with the file passed as an argument. So just drag a bunch of dwg files onto the bat file and it will take care of running core console.
you suggested me to try renaming the LISP file extension to SCRThen troubleshoot the scr using the method I told you. Also, I don't know how you are trying to run the script. If you want to code your own method for running AcCoreConsole, then you will have to send each file to the console by loading the script along with it. The syntax is:
And I tried
And it doesn't seem to work
Then troubleshoot the scr using the method I told you. Also, I don't know how you are trying to run the script. If you want to code your own method for running AcCoreConsole, then you will have to send each file to the console by loading the script along with it. The syntax is:
"C:\Program Files\Autodesk\AutoCAD 2024\accoreconsole.exe" /i "path\Drawing1.dwg" /s "path\BatchDrawings_Script.scr"
Your code needs to build a bat that has a line like that for each file you want to process.
but I'm pretty sure you don't need that much code to do what you want (seems to be a saveas would be just fine).what I need to do is more complex
5. My script to load a file into accoreconsole is not using a FOR loop. Using a "FOR %%DWG IN ... DO ..." in a bat file would case the DO part to start over and over again (much like how scriptpro starts a new instance of AutoCAD for each iteration). ...my stuff is good, theirs is garbage.ok
7. If you don't know where drawings are located then how can you possibly know what you need to do to them? Yes, you could recurssivly dig into a folder structure to find files with a BATCH script, but this is sounding more like a job for eTransmit then a batch script.I can find all the files in all the subfolders and create a list of all the file names including the entire path
Then troubleshoot the scr using the method I told you. Also, I don't know how you are trying to run the script. If you want to code your own method for running AcCoreConsole, then you will have to send each file to the console by loading the script along with it. The syntax is:
"C:\Program Files\Autodesk\AutoCAD 2024\accoreconsole.exe" /i "path\Drawing1.dwg" /s "path\BatchDrawings_Script.scr"
Your code needs to build a bat that has a line like that for each file you want to process.
so this code (by MrSmith) that creates the file Bat is not good ?
(foreach it outList (setq txt (strcat "\"" it "\"," txt)))
(setq txt (vl-string-right-trim "," txt))
(setq txt (strcat "FOR %%G IN (" txt ") DO \"" (findfile "accoreconsole.exe") "\" /i %%G /s \"" scriptFile "\""))
but I'm pretty sure you don't need that much code to do what you want (seems to be a saveas would be just fine).what I need to do is more complex
the Lisp contained in the SCR file is just a piece of the real Lisp
because I made a (partial) copy and paste (and all very quickly)
For this reason you will have found pieces of code that seemed superfluous
...>%
_.OPEN
"C:/Temp/A001.dwg"
(load "_SCR_BatchExe") ; here you can do anything you want as long as it doesn't break the script
(if(=(getvar "DBMOD")0)(command "_.CLOSE")(command "_.CLOSE" "_Y"))
_.OPEN
"C:/Temp/A002.dwg"
(load "_SCR_BatchExe") ; here you can do anything you want as long as it doesn't break the script
(if(=(getvar "DBMOD")0)(command "_.CLOSE")(command "_.CLOSE" "_Y"))
... etc.
_.NEW
"C:/Temp/End.dwt"
(load "_SCR_BatchEnd"); reset variables etc.
(_SCR_BatchEnd nil); reset variables etc.
(alert "Elaborazione conclusa correttamente.")
(princ "\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-")
what is "_SCR_BatchExe" ?a lisp File, can be .LSP . FAS/(.DES for BricsCAD)
I have been using a script file (SCR) like this for many years:Code: [Select]_.OPEN
"C:/Temp/A001.dwg"
(load "_SCR_BatchExe") ; here you can do anything you want as long as it doesn't break the script
(if(=(getvar "DBMOD")0)(command "_.CLOSE")(command "_.CLOSE" "_Y"))
_.OPEN
"C:/Temp/A002.dwg"
(load "_SCR_BatchExe") ; here you can do anything you want as long as it doesn't break the script
(if(=(getvar "DBMOD")0)(command "_.CLOSE")(command "_.CLOSE" "_Y"))
... etc.
_.NEW
"C:/Temp/End.dwt"
(load "_SCR_BatchEnd"); reset variables etc.
(_SCR_BatchEnd nil); reset variables etc.
(alert "Elaborazione conclusa correttamente.")
(princ "\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-")
(command "_.SCRIPT" "yourFile.scr") you can also Drag&Drop...
I have been using a script file (SCR) like this for many years:Code: [Select]_.OPEN
"C:/Temp/A001.dwg"
(load "_SCR_BatchExe") ; here you can do anything you want as long as it doesn't break the script
(if(=(getvar "DBMOD")0)(command "_.CLOSE")(command "_.CLOSE" "_Y"))
_.OPEN
"C:/Temp/A002.dwg"
(load "_SCR_BatchExe") ; here you can do anything you want as long as it doesn't break the script
(if(=(getvar "DBMOD")0)(command "_.CLOSE")(command "_.CLOSE" "_Y"))
... etc.
_.NEW
"C:/Temp/End.dwt"
(load "_SCR_BatchEnd"); reset variables etc.
(_SCR_BatchEnd nil); reset variables etc.
(alert "Elaborazione conclusa correttamente.")
(princ "\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-")
and what do I have to do to run this script?
drag it into acad ?
however a few minutes ago I managed to use ACCORECONSOLEDo you know about ActiveX functions and accoreconsole?
with a simple BAT file and with an SCR file which is a simple LSP file
...
and I have for the moment understood that
no ARXLOAD
no (command "opendcl")
no comments
Do you know about ActiveX functions and accoreconsole?this is the code to make the BAT file i need :
@Domenico: have you never tried the vlax-... functions in Core Console?sorry... it doesn't work... as expected...
F.W.I.W.Odbx save in same version of CAD used
(getenv "DefaultFormatForSave")
Returns "64" which represents AutoCAD 2018 DWG format
in ac2023, 2024, 2025(beta)
Opening a drawing I save fron 2023 yesterday :Code: [Select]Opening an AutoCAD 2018 format file.
Regenerating model.
AutoCAD menu utilities loaded.
KDUBToolsRibbon.mnl loaded . [Build 243:2023.05.25]
Autodesk DWG. This file is a TrustedDWG last saved by an Autodesk application or Autodesk licensed application.
Command:
. . . just saying . .
I really wish you would state what you are trying to do using complete thoughts. It looks like you are trying to replace some text AND save a COPY of the drawing. In the thread I linked to I gave an updated text find and replace that I've used many times. A save as is easy to do. Using packages like dos_lib to parse a path string is unnecessary and probably not going to work in accoreconsole. You keep typing your hands with these odd snippets and then blame the tool.I don't blame ACCORECONSOLE ...
`everything` you NEED or WANT? `Everything` is not a fair question because the answer invariably has to be NO because you cannot show dialog boxes, or draw AEC things, or use third party libraries like Python or probably dos_lib, or etc., etc..
If all you need to do is to save a copy of a file, make a PDF, find and replace text, etc. than you can most certinaly use accoreconsole. These are all things that do not NEED to use the VL* libraries.
I've used entmod.
https://www.theswamp.org/index.php?topic=4591.msg605179#msg605179
So, what does batch drawing conversion mean to YOU? Saving a copy, doing text replacement, and what? What VLX functions do you NEED?
Code - Auto/Visual Lisp: [Select]Why doesn't this code work?
)
To my mind you have failed the first and third elements of the procedure.
What are the chances that opening a random drawing and executing (entlast) will return an entity that has a dxf key of 1 ??
and that the entity is the one you wanted to modify.
What are the chances that opening a random drawing and executing (entlast) will return an entity that has a dxf key of 1 ??
and that the entity is the one you wanted to modify.
----------------------------------------x- 2024/02/18 -x------
Batch command: "D:\BatchingScriptFiles\BatchDrawings_accoreconsole.bat" D:\BatchingScriptFiles\Drawing101.dwg
Started at 2024/02/18 22:26:54.43
"C:\Program Files\Autodesk\AutoCAD 2023\accoreconsole.exe" /i "D:\BatchingScriptFiles\Drawing101.dwg" /s "D:\BatchingScriptFiles\BatchDrawings_accoreconsole.scr" /l en-US
Ended at 2024/02/18 22:26:55.34
Without looking at the code (I didn't get past the part where you use ENTLAST to--hopefully--get a text item. My guess is that you have the drawing open in AutoCAD when you try to modify the drawing in accoreconsole (thus open the file with accoreconsole in readonly).NOT hopefully--get a text item
@I don't blame you for not telling me!
I shouldn't HAVE to tell you anything
. . particularly that you SHOULD save the drawing after you make changes to it if you want the changes to be sustained.
just stop and think before you blame me for not telling you.
Does my find and replace routine work?
Guess:
kdub seemed to use my batch script; maybe it’s your batch scrip that’s not loading the right script?
maybe it’s your batch scrip that’s not loading the right script?I understand that you are not addressing me... but to remove any doubt...
Does my find and replace routine work?
I've noticed Dan is back from the jungle and playing with this too :)
Code - Auto/Visual Lisp: [Select]
el))) "\nThe current text is: " ) ) ) )
>>>
For example
i want to save every DWG into the Acad 2000 version
preserving the original DWG in the original version
so after doing some things (zoom extents, purge ... and what I want)
I save it with the same name in the same version
and after
I save it in the acad 2000 verison
modifing the name adding to the original name,
the suffix "---[acad 2000]"
<<<<
however the code strictly necessary for the script is only that below :Code - Auto/Visual Lisp: [Select]
)