Electrical drawing labeling method based on AUTOLISP development, storage medium and equipment
The electrical drawing annotation method developed by AUTOLISP uses AutoCAD and Autolisp programs to automate the annotation process, solving the problem of low annotation efficiency in electrical conduit drawings and achieving fast and accurate annotation results. It is suitable for complex conduit paths and diverse electrical equipment.
Patent Information
- Application Number
- CN202510892464.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-09-26
AI Technical Summary
Existing electrical conduit drawing annotations rely on manual operations, which are inefficient, error-prone, and non-standard. General software lacks specificity and flexibility and cannot meet the annotation needs of complex conduit routes and diverse electrical equipment.
The electrical drawing annotation method developed by AUTOLISP is adopted, the human-computer interaction interface is defined using AutoCAD's DCL language, and an Autolisp program is written to automate the annotation process. Through orthogonal mode adaptive annotation, the arrangement and insertion position of the piping information can be automatically determined.
It shortens marking time by more than 70% and reduces operation steps by about 90%, achieving accurate and fast marking results. It is suitable for complex pipe laying paths and various electrical equipment, eliminating marking ambiguities and ensuring construction accuracy.
Smart Images

Figure CN120705935A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer automatic drawing, and in particular to a marking method, storage medium and device for electrical drawings developed based on AUTOLISP. Background Art
[0002] Currently, the annotation of electrical conduit drawings primarily relies on manual operation or some general electrical design software. Manual annotation presents numerous problems, including low efficiency, prone to errors, and non-standard annotation. Designers need to spend a considerable amount of time and energy on operations such as text annotation, dimension annotation, and symbol annotation on drawings. According to statistics, manual annotation work for a medium-sized electrical engineering project can take designers dozens or even hundreds of hours to complete. Furthermore, due to the varying annotation habits and styles of different designers, the annotation results may vary, causing inconvenience to construction and maintenance. For example, when marking the installation location of electrical equipment, some designers may use coordinate annotation, while others use relative position annotation. This can easily lead to misunderstandings among construction personnel, thus affecting construction progress and quality.
[0003] While general-purpose electrical design software offers some basic annotation capabilities, they often lack specificity and flexibility, failing to adequately address the specialized needs of electrical conduit annotation. For example, accurate and rapid annotation may be impossible for complex conduit routings and diverse electrical equipment. Furthermore, general-purpose software's annotation styles and formats are relatively fixed, preventing flexible adjustments based on specific project requirements. This further limits its effectiveness in electrical conduit annotation. Summary of the Invention
[0004] The technical problem to be solved by the present invention is to overcome the existing defects and provide an electrical drawing annotation method, storage medium and equipment developed based on AUTOLISP. The annotation process is automatically processed by the Autolisp program, which can shorten the annotation time by more than 70%; through orthogonal mode adaptive annotation, the operation steps can be reduced by about 90%. It is suitable for complex pipe laying paths and various electrical equipment annotation, can achieve accurate and fast annotation effects, and can effectively solve the problems in the background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: a method for marking electrical drawings based on AUTOLISP, comprising the following steps: (1) Using AutoCAD development technology, the DCL language is used to define the human-computer interaction interface for electrical piping annotation; (2) Use Autolisp to write a pipe laying information annotation program and call the data parameters of the human-computer interaction interface; (3) loading and running the pipe laying annotation program in AutoCAD, and editing the pipe laying information on the human-computer interaction interface; (4) On the human-computer interaction interface, extract electrical data parameters through the interactive interface; (5) Select the starting point and end point of the annotation information lead in AutoCAD, and use the Autolisp program to determine the arrangement of the pipe laying information according to the orthogonal or non-orthogonal mode of the current system; (6) Extract the current mouse cursor position information in AutoCAD, call the Autolisp pipe laying information annotation program, and arrange the pipe laying information according to the position of the mouse cursor.
[0006] As a preferred technical solution of the present invention, the DCL language is used in step (1) to create the human-machine dialog interface, and the main controls included in the interface include: pipe laying information list, data movement, data deletion, list reset, data addition and other controls.
[0007] As a preferred technical solution of the present invention, in step (2), the human-computer interaction interface is directly started in AutoCAD, and the pipe laying information is modified, stored and sorted through various operation controls on the human-computer interface. The data parameters include at least the number of pipes laid, pipeline material, pipeline specification and pipe laying elevation.
[0008] As a preferred technical solution of the present invention, in step (3), the pipe laying information is edited in real time on the human-machine interface. The Autolisp program calls the get_tile function to obtain the input data, and uses the cons function to form a data list and store it in the global variable bzgh_pipe_list, and marks the type of each data.
[0009] As a preferred technical solution of the present invention, in step (4), the pipe laying information is read from AutoCAD, or the designer calls the entsel function through the human-computer interaction interface to select text and add it to the pipe laying information list, and at the same time edits the number, material, elevation, and sorting of the pipes on the interface.
[0010] As a preferred technical solution of the present invention, in step (5), the system variable ORTHOMODE is queried, and according to the current drawing mode (orthogonal or non-orthogonal), the insertion mode (horizontal or vertical) of the lead line of the pipe laying information is determined, the starting point and end point coordinates of the lead line are obtained by the getpoint function, and the arrangement mode of the pipe laying information is determined according to the relationship between the starting and end point coordinates.
[0011] As a preferred technical solution of the present invention, in step (6), the current position of the mouse cursor is extracted. Before inserting the pipe laying information, it is necessary to set the values of multiple system variables. In the Autolisp program, it is necessary to set the values of the following system variables: "OSMODE", "ORTHOMODE", "CMDECHO", "CECOLOR", "TEXTSIZE". By setting multiple system variables, the accuracy of the insertion position of the pipe laying information is guaranteed. Finally, the vla-AddText and vla-AddLine functions are called to insert the pipe laying quantity, material, elevation, and sorting data contained in the global variable bzgh_pipe_list into the drawing.
[0012] As a preferred technical solution of the present invention, the step (6) also includes coordinate avoidance processing: calculating the minimum spacing between adjacent annotation leaders, the minimum spacing is ≥ 2 times the current text height, and automatically offsetting the cursor position when coordinate overlap is detected.
[0013] The present invention further provides a computer device comprising a memory and a processor, wherein the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program to perform the following steps: (1) Using AutoCAD development technology, the DCL language is used to define the human-computer interaction interface for electrical piping annotation; (2) Use Autolisp to write a pipe laying information annotation program and call the data parameters of the human-computer interaction interface; (3) loading and running the pipe laying annotation program in AutoCAD, and editing the pipe laying information on the human-computer interaction interface; (4) On the human-computer interaction interface, extract electrical data parameters through the interactive interface; (5) Select the starting point and end point of the annotation information lead in AutoCAD, and use the Autolisp program to determine the arrangement of the pipe laying information according to the orthogonal or non-orthogonal mode of the current system; (6) Extract the current mouse cursor position information in AutoCAD, call the Autolisp pipe laying information annotation program, and arrange the pipe laying information according to the position of the mouse cursor.
[0014] The present invention also provides a computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the above-mentioned electrical drawing annotation method developed based on AUTOLISP.
[0015] Compared with the prior art, the present invention has the following advantages: the labeling process can be automated through the Autolisp program, which can shorten the labeling time by more than 70%. In step (5), the orthogonal mode adaptive labeling can reduce the number of operation steps by about 90%, automatically switching the horizontal / vertical labeling direction, and avoiding manual adjustment of the labeling style. The present invention is particularly suitable for labeling complex pipe laying paths and various electrical equipment, and can achieve accurate and fast labeling results.
[0016] Use global variable structured storage (bzgh_pipe_list) to enforce unified data types and standardize the marking of pipe quantity, material, elevation and other information; collaborative control of multiple system variables (synchronous setting of TEXTSIZE, CECOLOR, etc.) ensures that text style and color are completely consistent throughout the drawing; it can eliminate annotation ambiguity and ensure construction accuracy.
[0017] Customized solutions are provided based on AutoCAD's native development architecture: The DCL interface's extensible controls support the addition of project-specific fields (such as fire rating and seismic requirements) to meet the needs of diverse engineering scenarios. Autolisp's underlying controls directly call AutoCAD system variables, eliminating the need for third-party plug-ins and providing compatibility with all AutoCAD versions from 2006 to 2024. This breaks through the flexibility limitations of standard software and achieves deep compatibility. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 is a flow chart of the present invention; Figure 2 It is a schematic diagram of the use process of the present invention; Figure 3 Schematic diagram of the human-computer interaction interface of the present invention; Figure 4 It is a schematic diagram of the pipe laying of the present invention. DETAILED DESCRIPTION
[0019] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0020] See also Figure 1-4 The present invention provides a technical solution: a method for marking electrical drawings based on AUTOLISP, a method for marking electrical drawings based on AUTOLISP, comprising the following steps: (1) Using AutoCAD development technology, the DCL language is used to define the human-computer interaction interface for electrical conduit annotation: the DCL language is used to create the human-computer dialog interface, which mainly includes the following controls: conduit information list, data movement, data deletion, list reset, data addition, etc.
[0021] (2) Use Autolisp to write a pipe laying information annotation program and call the data parameters of the human-computer interaction interface: directly start the human-computer interaction interface in AutoCAD, and use the various operation controls on the human-computer interface to modify, store and sort the pipe laying information. The data parameters include at least the number of pipes laid, pipeline material, pipeline specification and pipe laying elevation.
[0022] (3) Load and run the pipe marking program in AutoCAD, and edit the pipe information on the human-computer interface: The pipe information is edited in real time on the human-computer interface. The Autolisp program calls the get_tile function to obtain the input data, and uses the cons function to form a data list and store it in the global variable bzgh_pipe_list. The type of each data is marked, and the data type marks include numeric type, text type and coordinate type.
[0023] (4) On the human-computer interaction interface, electrical data parameters are extracted through the interactive interface: the pipe laying information is read from AutoCAD, or the designer calls the entsel function through the human-computer interaction interface to select text and add it to the pipe laying information list, and edit the quantity, material, elevation, and sorting of the pipe laying on the interface.
[0024] (5) Select the starting point and end point of the annotation information lead in AutoCAD, and determine the arrangement of the pipe laying information through the Autolisp program according to the orthogonal or non-orthogonal mode of the current system: by querying the system variable ORTHOMODE, according to the current drawing mode (orthogonal or non-orthogonal), determine the insertion mode (horizontal or vertical) of the pipe laying information lead, obtain the starting point and end point coordinates of the lead through the getpoint function, and determine the arrangement of the pipe laying information according to the relationship between the starting and end point coordinates.
[0025] Specifically, the arrangement direction of the pipe laying annotation lead is determined according to the numerical state of the system variable ORTHOMODE (0 for non-orthogonal mode, 1 for orthogonal mode): When ORTHOMODE=1, the horizontal or vertical dimension direction is automatically selected according to the coordinate difference between the starting point and the end point of the leader line; When ORTHOMODE=0, the dimension direction is dynamically calculated based on the leader angle.
[0026] The line direction determination logic includes: If ORTHOMODE=1 and the absolute value of the X-axis coordinate difference is greater than the absolute value of the Y-axis coordinate difference, horizontal arrangement is adopted; If ORTHOMODE=1 and the absolute value of the Y-axis coordinate difference is greater than or equal to the absolute value of the X-axis coordinate difference, vertical arrangement is used; If ORTHOMODE=0 and the lead angle is less than π / 4 or greater than 3π / 4, horizontal arrangement is used, otherwise vertical arrangement is used.
[0027] (6) Extract the current mouse cursor position information in AutoCAD and call the Autolisp pipe laying information annotation program to arrange the pipe laying information according to the position of the mouse cursor. Extract the current position of the mouse cursor. Before inserting the pipe laying information, it is necessary to set the values of multiple system variables. In the Autolisp program, it is necessary to set the values of the following system variables "OSMODE", "ORTHOMODE", "CMDECHO", "CECOLOR", "TEXTSIZE". By setting multiple system variables, the accuracy of the pipe laying information insertion position is guaranteed. Finally, the vla-AddText and vla-AddLine functions are called to insert the pipe laying quantity, material, elevation, and sorting data contained in the global variable bzgh_pipe_list into the drawing.
[0028] System variable settings include: Set OSMODE to 0 to turn off object snapping to avoid coordinate interference; Set CMDECHO to 0 to suppress command line echo and improve execution efficiency.
[0029] This patent achieves breakthrough optimization by automating the annotation process through the Autolisp program: The real-time editing interface (DCL) replaces manual input. Designers can edit data such as pipe quantity, material, and elevation directly in the interactive interface without switching tools repeatedly. Cursor-driven dynamic positioning (getpoint function) replaces traditional coordinate measurement, and the marking position can be determined by clicking the mouse; Orthogonal mode adaptive technology automatically determines the horizontal / vertical annotation direction, avoiding the redundant operation of manual direction adjustment.
[0030] Actual results: In a substation project involving 1,200 pipe laying locations, marking time was shortened from 86 hours to 21 hours, an efficiency improvement of over 70%.
[0031] Furthermore, this application can generate chain benefits, extending from the design end to the construction and operation and maintenance end: Design stage: shorten the drawing cycle by more than 50% and accelerate project delivery; Construction phase: Reduce rework due to marking errors by 90%, reducing quality risks; Operation and maintenance stage: Structured stored annotation data (such as material and elevation) can be directly imported into the operation and maintenance system to improve maintenance efficiency.
[0032] Comprehensive benefits: Medium-sized projects save an average of RMB 120,000 in labor costs per project, the number of drawing revisions is reduced by 60%, and paper drawing consumption is reduced by 30%.
[0033] In a preferred technical solution, step (6) further includes coordinate avoidance processing: calculating the minimum spacing between adjacent annotation leaders, wherein the minimum spacing is ≥ 2 times the current text height, and automatically shifting the cursor position when coordinate overlap is detected. Automatically calculating the minimum spacing between leaders (≥ 2 times the character height), prioritizing annotation of the main path, and resolving the information overlap problem of turning points / intersections.
[0034] This marking method can greatly reduce the marking time of designers and improve work efficiency.
[0035] The present invention further provides a computer device comprising a memory and a processor, wherein the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program to perform the following steps: (1) Using AutoCAD development technology, the DCL language is used to define the human-computer interaction interface for electrical piping annotation; (2) Use Autolisp to write a pipe laying information annotation program and call the data parameters of the human-computer interaction interface; (3) loading and running the pipe laying annotation program in AutoCAD, and editing the pipe laying information on the human-computer interaction interface; (4) On the human-computer interaction interface, extract electrical data parameters through the interactive interface; (5) Select the starting point and end point of the annotation information lead in AutoCAD, and use the Autolisp program to determine the arrangement of the pipe laying information according to the orthogonal or non-orthogonal mode of the current system; (6) Extract the current mouse cursor position information in AutoCAD, call the Autolisp pipe laying information annotation program, and arrange the pipe laying information according to the position of the mouse cursor.
[0036] The present invention also provides a computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the above-mentioned electrical drawing annotation method developed based on AUTOLISP.
[0037] Any undisclosed portions of the present invention are prior art, and their specific structures, materials, and operating principles will not be described in detail. Although the embodiments of the present invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A marking method for electrical drawings developed based on AUTOLISP, characterized in that: The following steps are involved: (1) Using AutoCAD development technology, the DCL language is used to define the human-computer interaction interface for electrical piping annotation; (2) Use Autolisp to write a pipe laying information annotation program and call the data parameters of the human-computer interaction interface; (3) loading and running the pipe laying annotation program in AutoCAD, and editing the pipe laying information on the human-computer interaction interface; (4) On the human-computer interaction interface, extract electrical data parameters through the interactive interface; (5) Select the starting point and end point of the annotation information lead in AutoCAD, and use the Autolisp program to determine the arrangement of the pipe laying information according to the orthogonal or non-orthogonal mode of the current system; (6) Extract the current mouse cursor position information in AutoCAD, call the Autolisp pipe laying information annotation program, and arrange the pipe laying information according to the position of the mouse cursor.
2. The electrical drawing marking method developed based on AUTOLISP according to claim 1, characterized in that: In the step (1), the DCL language is used to create the human-machine dialog interface, and the main controls included in the interface include: pipe laying information list, data movement, data deletion, list reset, data addition and other controls.
3. The electrical drawing marking method developed based on AUTOLISP according to claim 1, characterized in that: In the step (2), the human-computer interaction interface is directly started in AutoCAD, and the pipe laying information is modified, stored and sorted through various operation controls on the human-computer interface. The data parameters include at least the number of pipes laid, pipeline material, pipeline specification and pipe laying elevation.
4. The electrical drawing marking method developed based on AUTOLISP according to claim 1, characterized in that: In step (3), the pipe laying information is edited in real time on the human-machine interface. The Autolisp program calls the get_tile function to obtain the input data, and uses the cons function to form a data list and store it in the global variable bzgh_pipe_list, and marks the type of each data.
5. The electrical drawing marking method developed based on AUTOLISP according to claim 1, characterized in that: In the step (4), the pipe laying information is read from AutoCAD, or the designer calls the entsel function through the human-computer interaction interface to select text and add it to the pipe laying information list, and edits the number, material, elevation, and sorting of the pipes on the interface.
6. The electrical drawing marking method developed based on AUTOLISP according to claim 1, characterized in that: In step (5), the system variable ORTHOMODE is queried, and according to the current drawing mode (orthogonal or non-orthogonal), the insertion mode (horizontal or vertical) of the lead line of the pipe laying information is determined, the starting point and end point coordinates of the lead line are obtained by the getpoint function, and the arrangement mode of the pipe laying information is determined according to the relationship between the starting and end point coordinates.
7. The electrical drawing marking method developed based on AUTOLISP according to claim 1, characterized in that: In step (6), the current position of the mouse cursor is extracted. Before inserting the pipe laying information, the values of multiple system variables need to be set. In the Autolisp program, the values of the following system variables need to be set: "OSMODE", "ORTHOMODE", "CMDECHO", "CECOLOR", "TEXTSIZE". By setting multiple system variables, the accuracy of the insertion position of the pipe laying information is guaranteed. Finally, the vla-AddText and vla-AddLine functions are called to insert the pipe laying quantity, material, elevation, and sorting data contained in the global variable bzgh_pipe_list into the drawing.
8. The electrical drawing marking method developed based on AUTOLISP according to claim 7, characterized in that: Said step (6) also includes coordinate avoidance processing: calculating the minimum spacing between adjacent annotation leaders, said minimum spacing being ≥ 2 times the current text height, and automatically shifting the cursor position when coordinate overlap is detected.
9. A computer device, characterized in that: The computer device comprises a memory and a processor; the memory is connected to the processor, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 8.