How to insert text in AutoCAD file without opening AutoCAD file?

How to insert text in AutoCAD file without opening AutoCAD file?

Anonymous
Not applicable
2,009 Views
4 Replies
Message 1 of 5

How to insert text in AutoCAD file without opening AutoCAD file?

Anonymous
Not applicable

Hi,

 

I want to insert text in AutoCAD file (.dwg) at specified location but without opening AutoCAD files because I lot of files to modify.

 

Request you to please suggest solution for this.

 

Regards,

Pradeep 

0 Likes
Accepted solutions (1)
2,010 Views
4 Replies
Replies (4)
Message 2 of 5

dbhunia
Advisor
Advisor

Check This site.....

 

For more give details with examples....

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 3 of 5

_gile
Consultant
Consultant
Accepted solution

Hi,

 

You should have a look at the AcCoreConsole which is an AutoCAD without user interface (see this topic and this video).

 

You can run a script on all the DWG files contained in a directory using a .scr and a .bat files.

Here's a simple example.

 

A script file (test.scr) to create a text entity.

_.text
10,5
2.5
0
this is a test



_.qsave

a batch file (test.bat)

echo off

:: Path to AutoCAD core console
set accoreexe="C:\Program Files\Autodesk\AutoCAD 2017\accoreconsole.exe"

:: Path the directory to process
set "source=F:\AcCoreConsole\test_files"

:: Path to the script to run
set script="F:\AcCoreConsole\test.scr"

FOR /f "delims=" %%f IN ('dir /b "%source%\*.dwg"') DO %accoreexe% /i "%source%\%%f" /s %script%

:: comment the following to automatically close the console when batch ends
pause


Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 4 of 5

Anonymous
Not applicable

Hi,

 

Thanks for the solution. It works fine.

Actually I don't much about SCRIPT AND BATCH commands.

 

First I tried with your SCRIPT file and then I tried with my sample files.

It takes time to me understand and resolve some errors.

 

Now I have successfully inserted text without opening AutoCAD file with your help.

 

Thanks a lot for your valuable help. It saves my lot of time.

 

I have some queries

1) Can you please inform me how to add 'font style' in SCRIPT file.

2) Is it possible to user to select folder instead of fixing it in BATCH file?

 

Thanks.

 

Regards,

Pradeep S. Walse

0 Likes
Message 5 of 5

dbhunia
Advisor
Advisor

@Anonymous 
..........

I have some queries

1) Can you please inform me how to add 'font style' in SCRIPT file.

2) Is it possible to user to select folder instead of fixing it in BATCH file?

............


for your 1st queries try like this...... (Here "bold" is the text style name)

 

_.text
_s
bold
10,5
2.5
0
this is a test



_.qsave

For your 2nd queries....... try the attached LISP .......

 

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes