Program for automatically modifying graphics files in AutoCAD

Procedures for automatically batch modifying graphics files in AutoCAD 1. Overview In engineering CAD drawings, the following thorny problems are often encountered:
In the late stage of construction drawings, most of the graphics files have been completed, but due to changes in certain conditions, some drawings need to be added (or decreased) in a certain volume of drawings, which will cause the content of many related graphics files to be modified accordingly : Such as high-level code, drawing number, etc.
In the actual engineering design, in order to improve efficiency, 60% of the graphics are formed by modifying existing designs to form new graphics. At this time, some repetitive work is often carried out, such as the replacement of the frame, the change of equipment components, etc. Sometimes, a few pictures, or even dozens of pictures to make the same modification.
For the above situation, the general practice in the past was to transfer out each graphic file and modify it one by one. When the picture size is large, you can only use the ZOOM command repeatedly. When there are many graphic files involved (sometimes there will be hundreds), manual operation is adopted, and the workload is very large, and most of the operations are repetitive tasks. , Prolonged operation is easy to cause confusion and omission, not only is the efficiency low, but the quality of the drawings cannot be guaranteed.
Can these repetitive tasks be done by the computer?
AutoCAD is a general software for graphic design. It provides as many graphic editing functions as possible for various professional CAD, but it is difficult to realize the function of automatic drawing.
In practice, we have written the CHSCR application program in C language. Using this program, the designer only needs to write a simple command file CH.SCR and the file table FILE.TAB to be processed. After conversion by the CHSCR? EXE application program, a The CHGE? SCR command file that processes all files listed in FILE? TAB. Then using AutoCAD's SCRIPT command, you can make the computer automatically modify the graphics according to the command and save the disk or generate a PLT drawing file. Because it adopts the SCR file method that is easy for non-professional programmers to write the command CH? SCR, it is very convenient to use.
Second, how to use CHSCR
1. Create CH? SCR command file The content of CH.SCR file is an ASCâ…¡ file composed of AutoCAD command and response sequences, and it is a text file that can be executed in AotuCAD editing state.
CH.SCR contains a sequence of commands that can be automatically repeated in the specified graphics.
Example: Change the drawing number 2066DD3 in the graphics files C800-01 to C800-98 to 2087DD2. The high-level code C13 is changed to D24, and the device model DZ20 is changed to C45AD.
Create a CH.SCR file with text editing software in DOS state:
CHTEXT_all _ _2066DD3
2087DD2
CHTEXT_all _ _C13
D24 〈Enter〉
CHTEXT _all _ _DZ20
C45AD 〈Enter〉
PLOT 〈Enter〉
<Enter>
<Enter>
among them:
_ Represents a space <Enter> Represents the CHTEXT LISP program to modify the text in the drawing Can change a string does not apply to programmatic operations.
Therefore, when writing the SCR command file, we used the LISP program CHTEXT.LSP (the list of which is attached) to modify the text in the figure. After loading it into ACAD.LSP, as long as you type CHTEXT, you can use it as prompted by Chinese characters. It can modify multiple character strings at once.
• When writing a command file, all responses and prompts in each AutoCAD command must be considered. Each space in the command file is meaningful, because AotuCAD sees it as a carriage return, so it cannot be increased or decreased at will.
• If you do not need to output a PLT drawing file, the four lines after PLOT can be omitted.
• CHSCR has two functions:
â‘ If there are fewer graphic files to be modified, you can directly call CH.SCR in SCCAD through the SCRLPT command.
â‘¡You can use SCRIPT command to try once in ACAD to see if there is any error.
In the ACAD command state, type the following command to complete the required modifications to the current graphic as required by the CH.SCR file.
Command: script
Script file: ch
When there are many graphic files involved (more than a dozen), manual operation is used to transfer out each graphic file and modify it one by one, the efficiency is too low. Therefore, it is recommended to use the following steps to make the computer automatically modify graphics files in batches according to the commands.
2. Create a graphic file table FILE.TAB
After creating the CH.SCR, the next step should be to save the graphic file name (.DWG) to FILE.TAB:
E.g:
C800-01
C800-02
C800-03
.
.
.
C800-98
3. Compile and generate the CHGE.SCR file. When you have the CH.SCR (after normal operation) and FILE.TAB files, you can start the compilation work. Type CHSCR <Enter> under DOS to start compiling. The system will give a corresponding prompt. After the compilation is complete, you will find an additional CHGE.SCR file (a text file that automatically modifies graphics) in the directory.
• CHSCR.EXE: Its function is to prepare the command string in the SCR file format and call in the relevant drawing parameters (the source program is written in C language, the list is attached).
• When ACAD outputs a PLT file, if a PLT file with a corresponding graphic is found, it will prompt whether to overwrite it, which will cause the SCRIPT command to interrupt the operation. For this reason, in CHSCR.EXE, we handle it this way: when the program finds a PLT file with the corresponding graphic, it will automatically delete it and display the corresponding information on the screen.
The CHGE.SCR file generated by CHSCR.EXE:
open y C800-01
CHTEXT all 2066DD3
2087DD2
CHTEXT all C13
D24
CHTEXT all DZ20
C45AD
PLOT



save
.
.
.
open y C900-98
CHTEXT all 2066DD3
2087DD2
CHTEXT all C13
D24
CHTEXT all DZ20
C45AD
PLOT



save
quit y
4. Execute the SCRIPT command â‘  Directly call CHGE.SCR through the SCRIPT command in ACAD:
Command: script chge
â‘¡Enter the following text from the operating system prompt when starting AutoCAD:
C: acad script chge
3. Installation of the program 1. Load CHTEXT.LSP into ACAD.LSP.
2. Use a general-purpose C ++ compiler to compile CHSCR.C into an executable program CHSCR.EXE, and copy it to a directory that CAD can find.
The program CHSCR.EXE is applicable to AutoCAD R11.0 and R12.0.
4. Conclusion The above example is just a simple example of the application of the program. In practice, it can also be used to redefine blocks, update frame, establish drawing standard preparation, continuously display slides, and continuously draw pictures, limited to varying lengths. Enumerate.
Since we applied this program to modify graphics files in batches, not only have designers been freed from complicated manual modification of drawings, but also greatly improved design efficiency and drawing quality.

Aluminum Electrolytic Capacitors/ Ceramic Capacitors

Aluminum Electrolytic Capacitors/ Ceramic Capacitors

Aluminum Electrolytic Capacitors,Electrolytic capacitor,Ceramic Capacitor

YANGZHOU POSITIONING TECH CO., LTD , https://www.yzpstcc.com

This entry was posted in on