Passive beacon and Block section drawing method for urban rail transit signal plane graph
By integrating VBA with CAD, the automated drawing of passive beacons and block sections in urban rail transit signal plan diagrams was realized. This solved the problems of low efficiency and error-proneness in traditional manual drawing, improved design efficiency and accuracy, and ensured the consistency of drawings.
Patent Information
- Application Number
- CN202511124269.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-12
- Publication Date
- 2025-11-18
AI Technical Summary
In existing technologies, the drawing of passive beacons and block sections in urban rail transit signal plan relies on manual operation, which is labor-intensive, time-consuming, and prone to errors, making it difficult to meet the design efficiency requirements of modern rail transit construction.
An automated approach integrating VBA and CAD is adopted, which interacts with CAD drawings through Excel spreadsheets to automatically extract key line segment data and automatically draw passive beacons and block segments. This includes equipment configuration, system initialization, equipment identification and sorting, track object acquisition and classification, and automatic drawing of beacons and block segments.
It significantly improved design efficiency, reducing the design cycle of a single line from several weeks to several hours, eliminating errors from manual transcription, and ensuring the accuracy of equipment location and mileage, as well as the standardization and consistency of drawings.
Smart Images

Figure CN120974750A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of automatic drawing technology for urban rail transit signal plan equipment, and more specifically to a method for automatically drawing passive beacons and block sections based on VBA and CAD integration. Background Technology
[0002] As the core deliverable of signal system design, the urban rail transit signal plan is a key technical document guiding engineering construction and operation and maintenance. This plan needs to accurately represent the positional relationships and mileage information of basic equipment such as signals, axle counters, and turnouts, while also including the layout scheme of key elements such as passive beacons and block sections.
[0003] In traditional design processes, signal plan drawing primarily relies on manual operation. Designers first need to complete the layout design of basic signal equipment. After the equipment positions are stable, they then proceed with the drawing of passive beacons and block sections. Passive beacons, as a core component of the train positioning system, must be arranged strictly according to the relative positions of basic equipment such as signals and switches to ensure the accuracy of train operation control. Block sections, on the other hand, divide the track line into several safety isolation units based on certain rules. Designers need to mark the block section data generated by the system onto the drawings one by one according to the mileage information.
[0004] Existing technologies suffer from significant efficiency bottlenecks. Taking a typical line with 28 stations as an example, approximately 4712 passive beacon elements and 1716 block elements need to be deployed. Designers must manually draw these thousands of graphic elements one by one onto the corresponding positions on the plan, which is not only labor-intensive and time-consuming (usually taking several weeks), but also prone to errors during data transcription and location labeling. This manual drafting method cannot guarantee the accuracy of the drawings and fails to meet the urgent needs of modern rail transit construction for design efficiency. As the scale of urban rail transit networks continues to expand, the limitations of traditional drafting methods become increasingly apparent. Summary of the Invention
[0005] In order to overcome the defects in the existing technology, the present invention discloses a method for drawing passive beacons and block sections of urban rail transit signal plan. The purpose of the present invention is to solve the problems that the existing methods for drawing a large number of passive beacons and block sections still rely on manual labor, which is labor-intensive, time-consuming and prone to errors.
[0006] To achieve the above objectives, the technical solution adopted by the present invention is as follows: The method for drawing passive beacons and block sections in urban rail transit signal plan includes the following steps: I. Configuration of Automated Kilometer Equipment S1. The passive beacon table or block table in the Excel spreadsheet interacts with CAD through a VBA program to automatically extract the key line segment data of the range of the kilometer marker / equipment name column in the signal plan from the CAD drawing and fill it into the Excel spreadsheet; Preferably, in step S1, the passive beacon table includes: Up / down kilometer marker configuration area, including: up / down kilometer marker identification input field, up / down kilometer marker / equipment field Y-axis range; The track configuration area includes: TrackID, which is used to enter the track number for which a passive beacon needs to be configured; The track information area includes: Track ID and Track name; The passive beacon information area includes: the track number (Track_ID) matched with the passive beacon, the beacon name (Beacon_Name), and the kilometer marker information (KP) of the passive beacon.
[0007] Preferably, in step S1, the Block table includes: Up / down kilometer marker configuration area, including: up / down kilometer marker identification input field, up / down kilometer marker / equipment field Y-axis range; The track configuration area includes: TrackID, used to enter the track number for configuring the Block; The track information area includes: Track ID and Track name; The Block section information area includes: the track number (Track_ID) matched to the Block section, the name (Block_Name), the midpoint kilometer marker (KP), the starting kilometer marker (Kp_Begin), and the ending kilometer marker (Kp_End).
[0008] Preferably, step S1 includes the following steps: S101. Call the AcadSelectionSet interface to create a selection set, and select CAD entities that meet the preset conditions to add to the selection set; S102. Traverse the entities in the selection set, parse and obtain the starting coordinates, ending coordinates, length, and angle information of the entities, and store them in a dynamic array; S103. Sort the line segments in the dynamic array in ascending order of Y-axis coordinate; S104. Adjust the boundary of the equipment / km column by adding a fixed offset to the sorting results, and fill it into the corresponding cell of the Excel table.
[0009] Step S104 includes: Y-axis range of the downhill kilometer marker: C1 = line segment 0.Y+2, D1 = line segment 1.Y–2; Downlink device name field Y-axis range: C2 = line segment 1.Y-2, D2 = line segment 2.Y; The Y-axis range of the kilometer markers for the uphill section: C3 = line segment 3.Y+2, D3 = line segment 4.Y–2; The Y-axis range for the upstream device name field is: C4 = line segment 4.Y-2, D4 = line segment 5.Y.
[0010] II. System Initialization S2. Display a confirmation dialog box using VBA's MsgBox, obtain user authorization, and then initialize the system with preset coordinate ranges and identifiers based on an Excel spreadsheet. Preferably, the system initialization in step S2 includes the following steps: S201. Obtain the Y-axis range of the downlink kilometer marker / equipment column and the Y-axis range of the uplink kilometer marker / equipment column from the corresponding positions in the Excel spreadsheet; S202. Obtain the up / down kilometer marker identifier from the corresponding position in the Excel spreadsheet; S203. Determine whether to draw a passive beacon or a block segment; If drawing a passive beacon, obtain the path to the passive beacon library; If drawing a Block segment, the midpoint kilometer marker Kp of the Block will be automatically calculated and filled into the Kp column based on the starting kilometer marker Kp_Begin and the ending kilometer marker Kp_End columns in the Block drawing form. In step S203, the calculation formula is as follows:
[0011] Where Kp is the kilometer marker, Kp_Begin is the starting kilometer marker, and Kp_End is the ending kilometer marker.
[0012] S204, VBA creates layers "Beacon Layer - Passive" or "Block Layer" by calling the AcadLayer interface.
[0013] III. Classification, Identification, and Sorting of Kilometer Markers Using Existing Equipment S3. Extract text information from CAD drawing elements, identify up / down equipment kilometer markers according to preset coordinate range and identifiers, and then generate an ordered equipment location sequence array by coordinate sorting; Preferably, step S3 includes the following steps: S301. Call the AcadSelectionSet interface to create a selection set that allows selection of all entities in the current CAD file; S302. Iterate through the entities in the selection set, filter text objects, including multi-line text and single-line text; parse and obtain the X-coordinate, Y-coordinate, and text content characteristics of all text objects, and store the text objects in a dynamic array; S303. Traverse all text objects, filter out the equipment kilometer markers that meet the conditions for being downlink and the equipment kilometer markers that are uplink, and store them in the downlink equipment kilometer marker array and the uplink equipment kilometer marker array, respectively. Preferably, the screening conditions in step S303 include: Determine whether the Y coordinate of the text object is within the range of the Y coordinate of the downlink kilometer marker column, and whether the text content contains the user-defined downlink identifier DnSign. If so, add it to the downlink device kilometer marker array. Determine if the Y coordinate of the text object is within the range of the Y coordinate of the uplink kilometer marker column, and if the text content contains the user-defined uplink identifier UpSign; if so, add it to the uplink device kilometer marker array. If both of the above judgments are negative, then iterate through the next text object and perform the above two condition judgments again.
[0014] S304. Sort the text objects in the uplink and downlink equipment kilometer marker arrays in ascending order of the X coordinate to obtain the sequentially arranged uplink and downlink equipment kilometer marker arrays, which together form the equipment position sequence array. Prompt the user "KP value sorting complete. Please select the track to which beacon / block needs to be added".
[0015] IV. Track Object Acquisition and Classification S4. In the CAD interface, select the track segments where the equipment needs to be arranged, and identify and classify the track types in the track segments. Preferably, step S4 includes the following steps: S401. Users select the track segments to which passive beacons or block sections need to be added in order from left to right according to the track number order in the "TrackID to be configured" row of the passive beacon table or block table through the CAD interface. S402. Obtain the selected track entity through the AcadSelectionSet interface and parse its geometric attributes; if the user clicks the track in the CAD interface in the order of n, the Track_ID of the track will be marked by the system as the value of the cell in the row and column (n+1) of "TrackID to be configured" in the worksheet, which is used to match the track to which the equipment needs to be added; S403. Classify track segments according to track type, including: Polyline track: The geometric property of the entity is a polyline, classified as a horizontal polyline track, applicable to main line tracks, side line storage tracks, and access tracks; Straight track: The geometric property of the entity is a straight track, and the slope is judged to be close to horizontal, classified as a straight track, applicable to main line tracks, side line storage tracks, and access tracks; Turnout track: The geometric property of the entity is a straight track, and the slope is judged to be an inclined line segment, classified as a turnout, applicable to "捺" type, "丿" single crossover, and double crossover turnout tracks.
[0016] V. Automatic Drawing of Passive Beacons and Block Sections S5. Based on the device position sequence array and track type, draw passive beacons and Block sections on the signal plan; among which, the passive beacon completes the drawing of the passive beacon kilometer post, device name, track side beacon module, and beacon name, and the Block section completes the drawing of the track side device name; Preferably, step S5 includes the following steps: S501. Traverse the passive beacons in the passive beacon table or the Block sections in the Block table; S502. If the name and kilometer post KP of the passive beacon or Block section are not empty and the track number Track_ID is equal to the required TrackID, then continue to execute step S503; otherwise, traverse the next passive beacon or Block section; S503. According to different track types, judge whether the beacon or Block belongs to an up-line device or a down-line device; Preferably, step S503 includes: Method 1: If the track type is a polyline track, it includes: Traverse the Coordinates attribute of the polyline object to extract the vertex coordinate sequence, and calculate the minimum vertex coordinate Min_Track_Y of the polyline; Judge the attribution of the beacon or Block by judging the relative distance between the minimum vertex of the polyline and the up / down kilometer bar, including: If , then it is a down-line device; If , then it is an up-line device; Among them, dn_dc_btm_line is the coordinate of the down kilometer bar, and up_kp_top_line is the coordinate of the up kilometer bar; Method 2: If the track type is a straight track, it includes: Judge the attribution of the beacon or Block by the relative distance between the Y coordinate Track_Y of the straight line and the up / down kilometer bar, including: If , it is a downlink device; If , it is an uplink device; Method 3: If the track type is a turnout track, including: Obtain the starting coordinates (sx, sy) and ending coordinates (ex, ey) of the straight section of the turnout, and calculate the slope Track_a and intercept Track_b of the turnout track. The formula is:
[0017]
[0018] If 90° ≤ Track_a ≤ 180° or 270° ≤ Track_a ≤ 360°, it is a "捺" - shaped turnout, and it is judged as a downlink device; If 0° < Track_a < 90° or 180° < Track_a < 270°, it is a "丿" - shaped turnout, and it is judged as an uplink device.
[0019] S504. Determine the kilometer post range according to the judgment result; Preferably, step S504 includes: According to the judgment result of step S503, if the beacon or Block is a downlink device, select the sorted kilometer post array of the downlink device; if the beacon or Block is an uplink device, select the sorted kilometer post array of the uplink device; and convert the selected kilometer post array from string format to digital format; Traverse the sorted and digital - formatted kilometer post array, and compare the kilometer post KP value corresponding to the passive beacon or Block section with each element in the array one by one; for each pair of adjacent elements kpStart and kpFinal in the array, judge whether KP satisfies kpStart ≤ KP < kpFinal; continuously execute this comparison process until the kpStart and kpFinal that meet the above conditions are found, and determine the position interval [kpStart, kpFinal] of KP in the kilometer post array.
[0020] S505. Use the linear interpolation method to calculate the insertion point X - coordinate Pt_X of the device according to the kilometer post range and the corresponding insertion point range; Preferably, step S505 includes: Calculate the length of the kilometer post range: , where kpStart and kpFinal are the previous KP and the next KP of the position of the beacon KP in the kilometer post array respectively; Calculate the length of the insertion point range: , where ptStart and ptFinal are the X coordinates of the text objects kpStart and kpFinal, respectively; Calculate the X coordinate Pt_X of the beacon / block insertion point using linear interpolation: .
[0021] S506. Calculate the Y coordinate Base_Y of the reference point for inserting the device module according to different track types. After the calculation is completed, if the inserted device is a beacon, continue to execute step S507; if the inserted device is a block, execute step S509. Preferably, step S506, calculating the Y-coordinate Base_Y of the reference point inserted by the device module, includes: If it is a polyline track, it iterates through the coordinates of the polyline vertices and determines which segment of the polyline the X coordinate Pt_X of the device insertion point falls within. If a matching segment is found, the Y coordinate of the starting vertex of that segment is returned as the Y coordinate Base_Y of the device module insertion reference point. If no matching segment is found, it returns and continues to traverse the coordinates of the polyline vertices. If it is a straight track, then obtain the Y coordinate of the straight line, Track_Y=Base_Y; If it is a turnout track, the turnout insertion reference point Base_Y is calculated based on the X coordinate Pt_X of the equipment insertion point. The calculation formula is as follows: Where Track_a and Track_b are the slope and intercept of the turnout track.
[0022] S507, Insert beacon, kilometer marker and equipment name in CAD, then execute step S508; Preferably, step S507 includes: The formula for converting the beacon's KP from numeric format to string format KpResult is as follows:
[0023]
[0024]
[0025] Where kpNormal is the kp of the beacon, and UpSign / DnSign are the beacon uplink / downlink kilometer marker identifiers; Call the AutoCAD API interface acadDoc.ModelSpace.AddText to write the beacon kilometer marker KpResult and the beacon device name Beacon_Name string into the "Beacon Layer - Passive" layer, aligning their positions with other device kilometer markers and device names. The insertion coordinates for the beacon kilometer marker are (Pt_X, kpStart.Y), the downlink beacon device name is (Pt_X, dn_dc_btm_line + 4), and the uplink beacon device name is (Pt_X, up_dc_btm_line + 4). The text insertion angle is set to 90 degrees, the color is set to display with the layer, and the height is set to 2.
[0026] S508, Insert the trackside beacon module and beacon name into CAD, then execute step S510; Preferably, step S508 includes: The AutoCAD API interfaces acadDoc.ModelSpace.InsertBlock and acadDoc.ModelSpace.AddText are called. Based on Pt_X and Base_Y calculated in steps S505 and S506, the "Passive Beacon-RB" block from the library layer and the beacon name Beacon_Name from Excel are inserted into the "Beacon Layer - Passive" layer. If it is a polyline track or a straight track, then: The downlink beacon is inserted at the upper edge of the track, with the insertion coordinates being (Pt_X, Base_Y + 2). The uplink beacon is inserted at the lower edge of the track, with the insertion coordinates being (Pt_X, Base_Y - 2). The downlink beacon name is centered and inserted at the top edge of the beacon module, with insertion coordinates of (Pt_X - len(Beacon_Name) / 2, Base_Y + 4). The uplink beacon name is centered and inserted at the bottom edge of the beacon module, with insertion coordinates of Pt_X - len(Beacon_Name) / 2, Base_Y + 4). If it is a turnout track, then: The beacon insertion coordinates are (Pt_X, Base_Y + 2), and the rotation angle is the turnout track slope Track_a; The beacon name is inserted at coordinates (Pt_X, Base_Y + 6), and the rotation angle is the turnout track slope Track_a.
[0027] S509, Insert the name of the Block section on the track side in CAD, and then execute step S510; Preferably, step S509 includes: If it is a polyline track or a straight track, then: The downlink block name is inserted at the upper edge of the track, with the insertion coordinates being (Pt_X, Base_Y + 2). The uplink block segment name beacon is inserted at the lower edge of the track, with the insertion coordinates being (Pt_X, Base_Y - 2). If it is a turnout track, then: The Block segment name is inserted at coordinates (Pt_X, Base_Y + 2) and rotated at a angle of Track_a.
[0028] S510, Update device insertion status.
[0029] The S510 steps include: after successful insertion, updating the status of the corresponding device in the Excel spreadsheet and marking it as green.
[0030] VI. Saving and Tips S6. Save the signal plan diagram and Excel spreadsheet. A completion message will pop up.
[0031] The beneficial effects of this invention are: Compared to traditional manual drawing methods, this invention proposes the following significant advantages through technological innovation: 1. Improved efficiency and enhanced reliability: Automated processes replace manual, item-by-item drawing, reducing the design cycle for a single line from weeks to hours. Real-time data interaction between VBA and CAD interfaces eliminates errors from manual transcription; linear interpolation algorithms and dynamic coordinate matching technology ensure the accuracy of equipment position and mileage.
[0032] 2. Intelligent classification and adaptation: Automatic classification of track types (polyline, straight line, turnout) and beacon attribution judgment logic (such as turnout slope classification) significantly improve the design adaptability in complex scenarios.
[0033] 3. Standardization and consistency assurance: A predefined library and a unified layer management mechanism ensure that the drawing formats and annotation rules output by different designers are completely consistent, reducing communication costs for later construction and maintenance. Attached Figure Description
[0034] Figure 1 This is a flowchart of the passive beacon and block segment drawing method of the present invention; Figure 2 This is a schematic representation of the passive beacon of the present invention; Figure 3 This is an intentional representation of the Block in this invention; Figure 4 This is the image library layer of the present invention - a passive beacon image; Figure 5 Flowchart for configuring automated kilometer equipment in this invention; Figure 6 This is a flowchart of the kilometer marker classification, identification, and sorting process of the existing equipment of this invention; Figure 7 This is a flowchart illustrating the automatic drawing process of passive beacons and block segments in this invention. Figure 8 This is a flowchart illustrating step S503 of the present invention; Figure 9 This is a flowchart illustrating step S505 of the present invention; Figure 10 This is a flowchart illustrating step S506 of the present invention. Detailed Implementation
[0035] The following will provide a clear and complete description of the concept, specific structure, and technical effects of the present invention in conjunction with the embodiments and accompanying drawings, so as to fully understand the purpose, features, and effects of the present invention.
[0036] A method for automating the drawing of passive beacons and block sections based on VBA and CAD integration is proposed. Through a modular layered architecture (Excel data layer, library layer, VBA and CAD interface layer), the method achieves fully automated drawing of passive beacons and block sections.
[0037] The Excel data layer includes drawing passive beacon tables and drawing block tables: 1. Draw a table of passive beacons. This form is in tabular format. Users fill in the corresponding information for the floor plan and the passive beacon information to be drawn in the corresponding areas. Details are as follows: Figure 2 As shown, the passive beacon form is divided into 4 areas.
[0038] Area 1 is the configuration area for up / down kilometer markers, including: up / down kilometer marker identification input field (user input), and up / down kilometer marker / equipment field Y-axis range (automatic configuration in step S1).
[0039] Area 2 is the track configuration area, which includes: TrackID (user input) for entering the track number for which a passive beacon needs to be configured.
[0040] Area 3 is the track information area, which includes: TrackID (user input) and Trackname (user input).
[0041] Area 4 is the passive beacon information area, which includes: the track number (Track_ID) matched by the passive beacon, the beacon name (Beacon_Name), and the KP (user input) of the passive beacon.
[0042] 2. Draw the Block table This form is in tabular format. Users fill in the corresponding information for the floor plan and the blocks to be drawn in the designated areas. Details are as follows: Figure 3 As shown, the Block form is divided into 4 areas.
[0043] Area 1 is the configuration area for up / down kilometer markers, including: up / down kilometer marker identification input field (user input), and up / down kilometer marker / equipment field Y-axis range (automatic configuration in step S1).
[0044] Area 2 is the track configuration area, which includes: TrackID (user input) for entering the track number of the block to be configured.
[0045] Area 3 is the track information area, which includes: TrackID (user input) and Trackname (user input).
[0046] Area 4 is the Block segment information area, including: the track number (Track_ID) matched to the Block segment (user input), the name (Block_Name) (user input), the KP (automatically calculated), the start KP, and the end KP (user input).
[0047] like Figure 1 As shown, the specific implementation of automatic drawing includes the following steps: I. Configuration of Automated Kilometer Equipment S1. The user clicks the "Auto Configure Equipment Kilometer Column" control in the passive beacon table or the Block table to invoke the Auto Configure Equipment Kilometer Column module. The module interacts with CAD through a VBA program to automatically extract the key line segment data of the kilometer marker / equipment name column range from the CAD drawing and fill it into an Excel spreadsheet.
[0048] like Figure 5 As shown, step S1 includes: S101. Call the AcadSelectionSet interface to create a selection set, allowing users to manually select CAD entities (AcadEntities) that meet preset conditions. Here, it mainly refers to 6 straight lines used to confirm the equipment and the equipment kilometer marker range. S102. Traverse the entities in the selection set, parse and obtain the starting coordinates, ending coordinates, length, and angle information of the entities, and store them in a dynamic array. S103. Sort the line segments in the dynamic array in ascending order of Y-axis coordinate; S104. Adjust the boundaries of the equipment / km column by adding a fixed offset (e.g., ±2 units) to the sorting results, and fill the corresponding cells in the Excel spreadsheet. The specific calculation rules are as follows: Downward kilometer marker Y-axis range (upper / lower): C1 = line segment 0.Y + 2, D1 = line segment 1.Y – 2; Downlink device name field Y-axis range (upper / lower): C2 = segment 1.Y - 2, D2 = segment 2.Y; The Y-axis range (upper / lower) of the kilometer marker column for the upward direction: C3 = line segment 3.Y + 2, D3 = line segment 4.Y – 2; Upward device name field Y-axis range (upward / downward): C4 = line segment 4.Y - 2, D4 = line segment 5.Y.
[0049] II. System Initialization S2. Display a confirmation dialog box via MsgBox, obtain user authorization, and then perform system initialization.
[0050] The system initialization in step S2 specifically includes: S201. Retrieve from the corresponding location in the Excel sheet: Downlink kilometer marker / equipment Y-axis range (up / down): dn_kp_top_line / dn_kp_btm_line / dn_dc_top_line / dn_dc_btm_line Upward kilometer marker / equipment Y-axis range (up / down): up_kp_top_line / up_kp_btm_line / up_dc_top_line / up_dc_btm_line; S202. Obtain the up / down kilometer marker identifiers (UpSign / DnSign) from the corresponding positions in the Excel sheet. S203. If drawing a passive beacon, obtain the path to the "passive beacon" library; If drawing a Block, the Block's Kp value will be automatically calculated based on the Kp_Begin and Kp_End columns in the "Draw Block" form and entered into the Kp column. The calculation formula is:
[0051] S204, VBA creates a dedicated layer, "Beacon Layer - Passive" or "Block Layer", by calling the AcadLayer interface.
[0052] III. Classification, Identification, and Sorting of Kilometer Markers Using Existing Equipment S3. Extract text information from CAD drawing elements, then automatically identify the upstream / downstream equipment kilometer markers according to the preset coordinate range and identifiers, and finally generate an ordered equipment location sequence array by sorting the coordinates; like Figure 6 As shown, step S3 specifically includes: S301. Call the AcadSelectionSet interface to create a selection set that allows selection of all entities in the current CAD file; S302. Iterate through the entities in the selection set, filter text objects, including multi-line text and single-line text. Parse and obtain the X-coordinate, Y-coordinate, text content, and other characteristics of all text objects, and store the text objects in a dynamic array; S303. Traverse all text objects and filter out the equipment kilometer markers that meet the conditions for being downlink and uplink respectively. The screening criteria for step S303 are as follows: Determine if the Y coordinate of the text object is within the Y coordinate range (up / down) of the downlink kilometer marker column, and if the text content contains the user-defined downlink identifier DnSign; if so, add it to the downlink device kilometer marker array. Determine if the Y coordinate of the text object is within the Y coordinate range (up / down) of the uplink kilometer marker column, and if the text content contains the user-defined uplink identifier UpSign; if so, add it to the uplink device kilometer marker array. Otherwise, iterate through the next text object.
[0053] S304. Sort the text objects in the up / down device kilometer marker arrays in ascending order by X coordinate to obtain the sequentially arranged down / up device coordinate arrays, and prompt the user "KP values have been sorted. Please select the track to which you want to add a beacon / block".
[0054] IV. Track Object Acquisition and Classification S4. In the CAD interface, the user selects the track segments where the equipment needs to be laid out, and the system identifies and classifies the types of the track segments. Step S4 specifically includes: S401. Users can select the track segments to which passive beacons or block sections need to be added from left to right in the order of track number in the "TrackID to be configured" row of the "Draw Passive Beacon" table or "Draw Block" table through the CAD interface (single selection and multiple selection are supported).
[0055] S402. The system obtains the selected track entities (AcadEntity) through the AcadSelectionSet interface and analyzes their geometric attributes (starting point, ending point, slope, type, etc.). If the order in which the user clicks on the track in the CAD interface is n, the Track_ID of this track will be marked by the system as the value in the cell at the (n + 1)-th column of the row where "TrackID to be configured" is located in the worksheet, which is used to match the track where the device needs to be added.
[0056] S403. Classify according to the track type: Polyline track: The geometric attribute of the entity is a polyline (AcDbPolyline), which is classified as a horizontal polyline track and is applicable to main line tracks, side line storage tracks, access tracks, etc. (by default, turnouts in the signal plan view are not drawn using polylines). Straight track: The geometric attribute of the entity is a straight track (AcDbLine). If the slope is judged to be close to horizontal (a < 0.001), it is classified as a straight track and is applicable to main line tracks, side line storage tracks, access tracks, etc. Turnout track: The geometric attribute of the entity is a straight track (AcDbLine). If the slope is judged to be an inclined line segment (a ≥ 0.001), it is classified as a turnout and is applicable to turnout tracks such as "捺" type, single crossover, and double crossover. V. Automatic drawing of passive beacons and Block sections S5. The system automatically completes the drawing of passive beacons and Block sections according to different track types. Among them, for passive beacons, it is necessary to complete the drawing of the kilometer mark of the passive beacon and the device name, as well as the passive beacon module on the track side and the device name. The Block section is a virtual device, and only the device name drawing on the track side needs to be completed.
[0057] As Figure 7 shown, the detailed steps are as follows: S501. Initialize the drawing of the passive beacon table (Beacon_Name, Track_ID, Kp) or draw the passive beacons in the passive beacon table (Track_ID, Block_Name, Kp_Begin, Kp_End). Traverse the passive beacons (Beacon_Name) or Block sections (Block_Name). S502. Judge whether the beacon belongs to the current track: If the name and KP of the passive beacon or Block section are not empty and the Track_ID of the beacon is equal to the Track_ID marked in S402, then judge that the beacon belongs to the current track and continue to execute S503; otherwise, traverse the next beacon. S503. According to different track types, judge whether the beacon or Block belongs to an up-line device or a down-line device: As follows Figure 8 shown as follows Polyline track: Traverse the Coordinates property of the polyline object to extract the vertex coordinate sequence, and calculate the minimum vertex coordinate Min_Track_Y of the polyline; By judging the relative distance between the minimum vertex of the polyline and the up / down kilometer column, judge the beacon attribution, that is: If , it is a downlink beacon; If , it is an uplink beacon; Straight track: By judging the relative distance between the Y coordinate Track_Y of the straight line and the up / down kilometer column, judge the beacon attribution, that is: If , it is a downlink beacon; If , it is an uplink beacon; Turnout track: Obtain the starting coordinates (sx, sy) and ending coordinates (ex, ey) of the straight line segment of the turnout, and calculate the slope Track_a and intercept Track_b of the turnout track. The formula is as follows:
[0058]
[0059] If 90 ≤ Track_a ≤ 180 or 270 ≤ Track_a ≤ 360, it is a "捺" type turnout, and judge that the beacon belongs to the downlink device; If 0 < Track_a < 90 or 180 < Track_a < 270, it is a "丿" type turnout, and judge that the beacon belongs to the uplink device.
[0060] S504, Kilometer marker range determination: According to the judgment result of S503, if the beacon is a downlink beacon, select the sorted downlink kilometer marker array in S303; if the beacon is an uplink beacon, select the sorted uplink kilometer marker array in S303. Convert the selected kilometer marker array from string format (such as "K12+345.67") to digital format (12345.67).
[0061] Traverse the array of kilometer markers sorted and converted to numerical format, and compare the KP values corresponding to passive beacons or Block sections one by one with the elements in the array. For each pair of adjacent elements kpStart and kpFinal in the array, determine whether KP satisfies kpStart ≤ KP < kpFinal. Continuously execute this comparison process until kpStart and kpFinal that meet the above conditions are found, and determine the position interval [kpStart, kpFinal] of KP in the kilometer marker array.
[0062] S505. Use the linear interpolation method to calculate the X coordinate Pt_X of the insertion point of the device according to the kilometer marker range and the corresponding insertion point range, as Figure 9 shown. The specific calculation method is as follows: Calculate the length of the kilometer marker range:
[0063] where kpStart and kpFinal are respectively the previous KP and the next KP at the position of the beacon KP in the kilometer marker array; Calculate the length of the insertion point range:
[0064] where ptStart and ptFinal are respectively the X coordinates of the text objects of kpStart and kpFinal; Calculate the X coordinate Pt_X of the beacon / Block insertion point according to the linear interpolation method: .
[0065] S506. Calculate the Y coordinate Base_Y of the insertion reference point of the device module according to different track types. Specifically, as Figure 10 shown: Polyline track: Traverse the vertex coordinates of the polyline, and judge in which X coordinate range of which segment of the polyline the X coordinate Pt_X of the device insertion point is located. If a segment that meets the conditions is found, return the Y coordinate of the starting vertex of this segment as the Y coordinate Base_Y of the device module insertion reference point; if no segment that meets the conditions is found, return 0; Straight track: Obtain the Y coordinate of the straight line, Track_Y = Base_Y; Turnout track: Calculate the turnout insertion reference point Base_Y according to the X coordinate Pt_X of the device insertion point. The formula is as follows:
[0066] After completing the calculation of the Y coordinate Base_Y of the module insertion reference point, if the inserted device is a beacon, continue to execute S507; otherwise, directly execute S509. S507, CAD inserts beacon / kilometer marker and equipment name, specifically: The formula for converting the beacon's KP from numeric format to string format KpResult is as follows:
[0067]
[0068]
[0069] Where kpNormal is the kp of the beacon, and UpSign / DnSign are the beacon uplink / downlink kilometer marker identifiers; The AutoCAD API, including acadDoc.ModelSpace.AddText, is used to write the beacon kilometer marker (KpResult) and beacon device name (Beacon_Name) strings to the "Beacon Layer - Passive" layer, aligning their positions with those of other device kilometer markers and device names. The insertion coordinates for the beacon kilometer marker are (Pt_X, kpStart.Y), the downlink beacon device name is (Pt_X, dn_dc_btm_line + 4), and the uplink beacon device name is (Pt_X, up_dc_btm_line + 4). The text insertion angle is set to 90 degrees, the color is set to display with the layer, and the height is set to 2.
[0070] S508, CAD inserts trackside beacon module and beacon name, details: Calling AutoCAD API interfaces such as acadDoc.ModelSpace.InsertBlock and acadDoc.ModelSpace.AddText, based on Pt_X and Base_Y calculated by S505 and S506, the "Passive Beacon-RB" block of the library layer and the beacon name Beacon_Name from Excel are inserted into the "Beacon Layer - Passive" layer, as shown below. Figure 4 As shown, where: If it is a polyline track or a straight track, then: The downlink beacon is inserted at the upper edge of the track, with the insertion coordinates being (Pt_X, Base_Y + 2). The uplink beacon is inserted at the lower edge of the track, with the insertion coordinates being (Pt_X, Base_Y - 2). The downlink beacon name is centered and inserted at the top edge of the beacon module, with insertion coordinates of (Pt_X - len(Beacon_Name) / 2, Base_Y + 4). The uplink beacon name is centered and inserted at the bottom edge of the beacon module, with insertion coordinates of Pt_X - len(Beacon_Name) / 2, Base_Y + 4). If it is a turnout track, then: The beacon is inserted at coordinates (Pt_X, Base_Y + 2) and rotated at an angle of Track_a. The beacon name is inserted at coordinates (Pt_X, Base_Y + 6) and rotated by a rotation angle of Track_a.
[0071] S509, CAD insertion of track-side Block section name, details: If it is a polyline track or a straight track, then: The downlink block name is inserted at the upper edge of the track, with the insertion coordinates being (Pt_X, Base_Y + 2). The uplink block segment name beacon is inserted at the lower edge of the track, with the insertion coordinates being (Pt_X, Base_Y - 2). If it is a turnout track, then: The Block segment name is inserted at coordinates (Pt_X, Base_Y + 2) and rotated at a angle of Track_a.
[0072] S510, Update Device Insertion Status After successful insertion, update the status of the corresponding device in the Excel spreadsheet and mark it in green; VI. Saving and Tips Save the graph and save the Excel file; a completion message will pop up.
[0073] The core innovations of this invention are as follows: 1. Modular layered architecture design Excel data layer: Structured management of data input is achieved through customized forms (passive beacon table, block table), supporting users to configure equipment information by parameters such as track number and KP value, and dynamically interacting with CAD drawings.
[0074] Library layer: Predefined standardized passive beacon graphics (.dwg format) to ensure the standardization and consistency of drawing output.
[0075] VBA and CAD interface layer: Based on AutoCAD APIs (such as AcadSelectionSet and AcadEntity), it realizes data extraction, entity classification and automatic graphic insertion, and connects the data flow between Excel and CAD.
[0076] 2. Automated configuration and dynamic data extraction technology Automatically identify key line segments (such as the boundary of kilometer markers) in CAD drawings, extract coordinate data and fill them into an Excel spreadsheet, reducing manual annotation errors.
[0077] By using dynamic array sorting algorithms (such as sorting in ascending order by Y-axis coordinate) and fixed offset adjustments, the coordinate range of the device bar can be accurately determined.
[0078] 3. Intelligent Track Classification and Matching Mechanism The track type is automatically classified based on the geometric attributes of the track entity (polyline, straight slope, turnout angle), and the data is bound to the Track_ID in Excel.
[0079] The X-coordinate of the equipment insertion point is dynamically calculated using a linear interpolation algorithm, and the Y-coordinate is adjusted in combination with the differences in track type to ensure that the equipment position and mileage are strictly matched.
[0080] The embodiments of the present invention have been described in detail above, but the present invention is not limited to the described embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of the present invention, and these equivalents or substitutions are all included within the scope defined by the claims of the present invention.
Claims
1. A method for drawing passive beacons and block sections in urban rail transit signal plan, characterized in that, Includes the following steps: S1. The passive beacon table or block table in the Excel spreadsheet interacts with CAD through a VBA program to automatically extract the key line segment data of the range of the kilometer marker / equipment name column in the signal plan from the CAD drawing and fill it into the Excel spreadsheet; S2. Display a confirmation dialog box using VBA's MsgBox, obtain user authorization, and then initialize the system with preset coordinate ranges and identifiers based on an Excel spreadsheet. S3. Extract text information from CAD drawing elements, identify up / down equipment kilometer markers according to preset coordinate range and identifiers, and then generate an ordered equipment location sequence array by coordinate sorting; S4. In the CAD interface, select the track segments where the equipment needs to be arranged, and identify and classify the track types in the track segments. S5. Based on the device location sequence array and track type, draw the passive beacon and block segment of the signal plane diagram.
2. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 1, characterized in that, In step S1, the passive beacon table includes: Up / down kilometer marker configuration area, including: up / down kilometer marker identification input field, up / down kilometer marker / equipment field Y-axis range; The track configuration area includes: TrackID, which is used to enter the track number for which a passive beacon needs to be configured; The track information area includes: Track ID and Track name; The passive beacon information area includes: the track number (Track_ID) matched with the passive beacon, the beacon name (Beacon_Name), and the kilometer marker information (KP) of the passive beacon; In step S1, the Block table includes: Up / down kilometer marker configuration area, including: up / down kilometer marker identification input field, up / down kilometer marker / equipment field Y-axis range; The track configuration area includes: TrackID, used to enter the track number for configuring the Block; The track information area includes: Track ID and Track name; The Block section information area includes: the track number (Track_ID) matched to the Block section, the name (Block_Name), the midpoint kilometer marker (KP), the starting kilometer marker (Kp_Begin), and the ending kilometer marker (Kp_End).
3. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 1, characterized in that, Step S1 includes the following steps: S101. Call the AcadSelectionSet interface to create a selection set, and select CAD entities that meet the preset conditions to add to the selection set; S102. Traverse the entities in the selection set, parse and obtain the starting coordinates, ending coordinates, length, and angle information of the entities, and store them in a dynamic array; S103. Sort the line segments in the dynamic array in ascending order of Y-axis coordinate; S104. Adjust the boundary of the equipment / km column by adding a fixed offset to the sorting results, and fill it into the corresponding cell of the Excel table.
4. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 1, characterized in that, The system initialization in step S2 includes the following steps: S201. Obtain the Y-axis range of the downlink kilometer marker / equipment column and the Y-axis range of the uplink kilometer marker / equipment column from the corresponding positions in the Excel spreadsheet; S202. Obtain the up / down line kilometer post identifier from the corresponding position in the Excel table; S203. Determine whether to draw passive beacons or Block sections; If it is to draw passive beacons, obtain the path of the passive beacon library; If it is to draw a Block section, automatically calculate the midpoint kilometer post Kp of the Block according to the start kilometer post Kp_Begin column and the end kilometer post Kp_End column in the drawing Block form, and fill it into the Kp column; S204. VBA creates a layer "Beacon Layer - Passive" or "Block Layer" by calling the AcadLayer interface.
5. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 1, characterized in that, Step S3 includes the following steps: S301. Call the AcadSelectionSet interface to create a selection set, allowing all entities in the current CAD to be selected; S302. Traverse the entities in the selection set, filter text objects, including multi-line text and single-line text; parse and obtain the position X coordinate, position Y coordinate, and text content characteristics of all text objects, and store the text objects in a dynamic array; S303. Traverse all text objects, respectively filter out the device kilometer posts belonging to the down line and the device kilometer posts belonging to the up line that meet the conditions, and store them in the down line device kilometer post array and the up line device kilometer post array; S304. Sort the text objects in the up line device kilometer post array and the down line device kilometer post array in ascending order of the X coordinate respectively, obtain the sorted up line device kilometer post array and down line device kilometer post array and form a device position sequence array, and prompt the user "The KP value sorting is completed. Please select the track where the beacon / Block needs to be added." 6. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 1, characterized in that, Step S4 includes the following steps: S401. The user sequentially selects the track segments where passive beacons or Block sections need to be added from left to right in the order of the track numbers in the "TrackID to be configured" row in the passive beacon table or the Block table through the CAD interface; S402. Obtain the selected track entity through the AcadSelectionSet interface and parse its geometric attributes; if the order in which the user clicks on the track in the CAD interface is n, the Track_ID of this track will be marked by the system as the value of the cell in the (n + 1)-th column of the row where "TrackID to be configured" is located in the worksheet, which is used to match the track where the device needs to be added; S403. Classify the track segments according to the track type, including: Polyline track: The geometric attribute of the entity is a polyline, which is classified as a horizontal polyline track and is applicable to main line tracks, sideline storage tracks, and access tracks; Straight track: The geometric attribute of the entity is a straight track. Judge that the slope is close to horizontal and classify it as a straight track, which is applicable to main line tracks, sideline storage tracks, and access tracks; Turnout track: The geometric attribute of the entity is a straight track. Judge that the slope is an inclined line segment and classify it as a turnout, which is applicable to "捺"-type, "丿"-type single crossover, and diamond crossover turnout tracks.
7. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 1, characterized in that, Step S5 includes the following steps: S501. Traverse the passive beacons in the passive beacon table or the Block sections in the Block table; S502: If there is no passive beacon or the Block section name and kilometer post KP are not empty and the track number Track_ID is equal to the TrackID to be configured, then continue to execute step S503; otherwise, traverse the next passive beacon or Block section; S503: According to different track types, determine whether the beacon or Block belongs to an uplink device or a downlink device; S504: Determine the kilometer post range according to the judgment result; S505: Using the linear interpolation method, calculate the X coordinate Pt_X of the insertion point of the device according to the kilometer post range and the corresponding insertion point range; S506: According to different track types, calculate the Y coordinate Base_Y of the insertion reference point of the device module. After the calculation, if the inserted device is a beacon, then continue to execute step S507; if the inserted device is a Block, then execute step S509; S507: CAD inserts the beacon kilometer post and device name, and then executes step S508; S508: CAD inserts the beacon module and beacon name on the track side, and then executes step S510; S509: CAD inserts the Block section name on the track side, and then executes step S510; S510: Update the device insertion status.
8. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 7, characterized in that, Step S503 includes: Method 1: If the track type is a polyline track, it includes: Traverse the Coordinates property of the polyline object to extract the vertex coordinate sequence, and calculate the minimum vertex coordinate Min_Track_Y of the polyline; Judge the attribution of the beacon or Block by judging the relative distance between the minimum vertex of the polyline and the up / down kilometer column, including: like If so, it is a downstream device; like If so, it is an uplink device; Among them, dn_dc_btm_line is the coordinate of the downlink kilometer column, and up_kp_top_line is the coordinate of the uplink kilometer column; Method 2: If the track type is a straight track, it includes: Judge the attribution of the beacon or Block by the relative distance between the Y coordinate Track_Y of the straight line and the up / down kilometer column, including: like If so, it is a downstream device; like If so, it is an uplink device; Method 3: If the track type is a turnout track, it includes: Obtain the starting point coordinates (sx, sy) and ending point coordinates (ex, ey) of the straight section of the turnout, and calculate the slope Track_a and intercept Track_b of the turnout track. The formula is: If 90°≤ Track_a ≤180° or 270°≤Track_a≤360°, it is a "捺" type turnout, and it is judged to belong to a downlink device; If 0°< Track_a <90° or 180°< Track_a <270°, it is a "丿" type turnout, and it is judged to belong to an uplink device.
9. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 7, characterized in that, Step S505 includes: Calculate the length of the kilometer marker range: , where kpStart and kpFinal are the preceding and following KP positions of the beacon KP in the kilometer marker array, respectively; Calculate the length of the insertion point range: , where ptStart and ptFinal are the X coordinates of the text objects kpStart and kpFinal, respectively; Calculate the X coordinate Pt_X of the insertion point of the beacon / Block according to the linear interpolation method: 。 10. The method for drawing passive beacons and block sections of urban rail transit signal plan as described in claim 7, characterized in that, Step S506 calculates the Y coordinate Base_Y of the insertion reference point of the device module, including: If it is a polyline track, it iterates through the coordinates of the polyline vertices and determines which segment of the polyline the X coordinate Pt_X of the device insertion point falls within. If a matching segment is found, the Y coordinate of the starting vertex of that segment is returned as the Y coordinate Base_Y of the device module insertion reference point. If no matching segment is found, it returns and continues to traverse the coordinates of the polyline vertices. If it is a straight track, then obtain the Y coordinate of the straight line, Track_Y=Base_Y; If it is a turnout track, the turnout insertion reference point Base_Y is calculated based on the X coordinate Pt_X of the equipment insertion point. The calculation formula is as follows: Where Track_a and Track_b are the slope and intercept of the turnout track.