Engineering drawing dimension checking method based on RAG enhanced AI agent
Patent Information
- Application Number
- CN202611134116.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-29
- Publication Date
- 2026-10-16
AI Technical Summary
这样会丢失矢量 PDF 内原本精确的线段、曲线、坐标和线宽信息;即使识别出“5.4”这样的文字,也不一定知道它是孔径、孔距还是边距,更不知道它对应三维模型中的哪个结构
本发明通过同时获取矢量PDF工程图和对应三维模型文件,将二维标注信息与三维实体信息纳入同一校核流程,能够避免单独识别图纸文字或单独测量模型所产生的信息割裂。直接解析矢量图元、文本块、箭头、界线和目标几何,可保留坐标、方向、线宽及拓扑关系,并将尺寸文字表达的名义值、公差和数量与箭头指向的孔、边、面及槽建立明确关联,使孔径、孔中心距、边距、孔到边距离和槽尺寸等语义具备可追溯的几何依据。通过解析三维模型中的圆柱面、平面、圆边和顶点,形成与不同尺寸语义相适配的测量候选,能够限制测量值的来源范围,减少将数值接近但几何含义不同的尺寸强行配对。依据孔径和孔群距离指纹建立初始对应关系,并在非镜像与镜像坐标条件下估计同类变换,可适应二维视图相对三维投影存在尺度变化、旋转、平移及左右翻转的情况,提高复杂视图条件下的配准稳定性。结合尺寸语义、配准位置和候选置信度确定对应测量值,再比较图纸值与模型值,可形成通过、待复核和无三维对应值等具有明确依据的校核结果。人工复核信息、匹配来源和失败原因被持续保存并构成RAG案例数据,AI智能体据此检索同类成功案例和错配案例,按任务状态执行重试、候选切换、人工复核请求及报告输出,使历史经验能够参与后续任务决策,同时保留每项尺寸的识别来源、匹配路径和判定依据,从而提升工程图尺寸校核的准确性、自动化程度、异常定位效率和结果可追溯性。
Smart Images

Figure CN122929600A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer-aided design technology, and in particular to a method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents. Background Technology
[0002] Manufacturing companies often need to verify the consistency between 2D drawings and 3D models during quotation review, drawing inspection, process review, and pre-production verification. Current methods primarily rely on manually reading dimension annotations, locating corresponding structures in 3D software, and measuring each element individually. This is labor-intensive and prone to omissions.
[0003] Existing drawing recognition solutions often convert PDFs into images and then use OCR. This process loses the precise line segments, curves, coordinates, and line width information originally contained in the vector PDF; even if text like "5.4" is recognized, it may not be known whether it represents hole diameter, hole spacing, or edge distance, let alone which structure in the 3D model it corresponds to.
[0004] Two-dimensional views may also be rotated, translated, or mirrored relative to the three-dimensional model, making direct hard matching by coordinates impossible. Therefore, the actual problems that need to be solved are five consecutive issues: primitive recognition, size semantic recovery, three-dimensional feature extraction, two-dimensional-three-dimensional registration, and line-by-line verification. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of existing technologies by proposing a method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a method for verifying the dimensions of engineering drawings of RAG-enhanced AI agents, comprising the following steps: Obtain vector PDF engineering drawings and corresponding 3D model files; Parse the vector primitives and text blocks in the vector PDF engineering drawing to generate a two-dimensional primitive set; Based on the set of two-dimensional primitives, arrows, boundaries, target geometry, and size text are bound together to generate two-dimensional size objects with size semantics; The geometric entities in the 3D model file are parsed to generate a 3D measurement candidate set; The initial correspondence between the two-dimensional object and the three-dimensional measurement candidate set is established based on the aperture and aperture group distance fingerprint, and the same type of transformation that allows mirroring is estimated to obtain the registration relationship. Based on the dimensional semantics of the two-dimensional object and the registration relationship, the corresponding measurement value is determined from the three-dimensional measurement candidate set, the drawing value is compared with the corresponding measurement value, and a verification result is generated. Acquire and save the manual review information and the verification results to construct RAG case data; The AI agent performs retries, candidate switching, manual review requests, and report output based on the task status and similar cases retrieved from the RAG case data.
[0007] Preferably, the steps to obtain vector PDF engineering drawings and corresponding 3D model files are as follows: Receive the vector PDF engineering drawing and the STEP format 3D model file corresponding to the same part, read the page coordinate system and units of the vector PDF engineering drawing, and read the model coordinate system, units and entity information of the 3D model file; Verify the part identifiers, version identifiers, and unit information of the vector PDF engineering drawing and the 3D model file, unify the length units of the page coordinate system and the model coordinate system, and obtain the task to be verified. Write the unit conversion relationship of the task to be verified into the task status.
[0008] Preferably, the step of parsing the vector primitives and text blocks in the vector PDF engineering drawing to generate a two-dimensional primitive set specifically includes: The vector interface reads line segments, curves, fill paths, and text blocks from the vector PDF engineering drawing, and retains the coordinates and line width of each vector primitive. The hole profile is extracted based on the roundness, radius difference, and closure error of the curve; the part profile, dimension line, boundary line, and leader line are distinguished based on the mode of the line width, length distribution, direction, and connection relationship of the line segments. Arrows are extracted based on the number of vertices, side length ratio, and symmetry axis direction of the filling path. The hole outline, part outline, dimension line, boundary line, leader line, arrow, and text block are written into a unified coordinate system to generate the two-dimensional primitive set.
[0009] Preferably, the step of generating a two-dimensional dimension object with dimension semantics based on the two-dimensional primitive set by binding arrows, boundaries, target geometry, and dimension text is as follows: Extract hole contours and part contours from the set of two-dimensional primitives, pair arrows with opposite directions and whose cusp connection line makes an angle with the arrow direction no greater than a preset angle threshold, and obtain the arrow span; Search along the apex of the arrow span for the boundary line whose angle deviation from the arrow span is not greater than a preset vertical threshold, and take the hole contour and the part contour hit by the extension line of the boundary line as the target geometry; Based on the type of the target geometry and the intersection relationship between the arrow span and the hole profile, assign dimensional semantics to the hole diameter, hole center distance, edge distance, hole-to-edge distance, and slot size; Aggregate the glyphs around the arrow span, perform dual-channel text recognition through page image cropping and vector masking, and correct the engineering symbols according to the chamfer distance of the glyph template, the number of inner holes, the direction of the diagonal line and the aspect ratio to obtain dimensional text containing nominal values, tolerances and quantities; The dimension text is bound to the arrow span, the boundary line, and the target geometry, allowing the dimension text located on the extension line of the arrow tail to participate in the binding, thereby generating the two-dimensional dimension object.
[0010] Preferably, the step of parsing the geometric entities in the 3D model file to generate a 3D measurement candidate set specifically includes: Read the analytical points, directions, coordinate axes, cylindrical surfaces, planes, circular edges, and vertices from the 3D model file, and establish the topological adjacency relationship of the geometric entities; Inward cylindrical surfaces with radius differences not exceeding a preset radius threshold, axial distances not exceeding a preset coaxial threshold, and circumferential coverage angles not exceeding a preset coverage angle threshold are merged into hole candidates, and the hole center, axis, and diameter of the hole candidates are recorded. The plane is layered according to the included angle of the normal and the offset along the normal to obtain the plane layer candidate, and the waist-shaped groove candidate is generated according to the two semicircular ends with the same radius and the parallel edge connecting the two semicircular ends. Based on the vertex, a model bounding box is generated, and the hole candidate, the planar layer candidate, the waist-shaped groove candidate, and the model bounding box are written into the three-dimensional measurement candidate set.
[0011] Preferably, the steps of establishing an initial correspondence between the two-dimensional object and the three-dimensional measurement candidate set based on the aperture and aperture group distance fingerprint, estimating the permissible mirror transformations, and obtaining the registration relationship are as follows: Extract the two-dimensional hole targets associated with the two-dimensional objects, extract hole candidates from the three-dimensional measurement candidate set, and sort the distances from each two-dimensional hole target to the remaining two-dimensional hole targets and the distances from each hole candidate to the remaining hole candidates in ascending order to generate a hole group distance fingerprint; The candidate matching cost is calculated based on the difference between the aperture of the two-dimensional hole target and the hole candidate and the difference between the hole group and the corresponding distance in the fingerprint. Hole pairs whose candidate matching costs are not greater than a preset matching threshold and satisfy the one-to-one correspondence constraint are selected to obtain the initial correspondence. By performing the same least-squares transformation on both non-mirror and mirror coordinates, the scale, rotation angle, translation amount, and root mean square residual are obtained. Select the transformation result with the smallest root mean square residual, map the two-dimensional object to the three-dimensional projection coordinate system, and generate the registration relationship.
[0012] Preferably, the steps of determining the corresponding measurement value from the three-dimensional measurement candidate set based on the dimensional semantics of the two-dimensional object and the registration relationship, comparing the drawing value with the corresponding measurement value, and generating the verification result are as follows: Hole candidates, model bounding boxes, planar layer candidates, and waist-shaped groove candidates are extracted from the three-dimensional measurement candidate set. The target geometry is mapped according to the registration relationship. The candidate confidence is calculated according to the mapping distance and size semantic consistency. Candidates with a confidence score less than a preset confidence threshold are deleted. When the dimension semantics are aperture, the diameter of the hole candidate is read; when the dimension semantics are hole center distance, the projection distance of the center of the two hole candidates on the annotation axis is calculated; when the dimension semantics are hole-to-edge distance, the distance from the center of the hole candidate to the corresponding edge of the model bounding box is calculated; when the dimension semantics are edge distance, the value is determined from the span of the model bounding box and the interlayer distance of the planar layer candidate; when the dimension semantics are slot size, the slot width, slot length and slot center distance of the waist-shaped slot candidate are read to obtain the corresponding measurement value. Extract the drawing value and tolerance from the dimension text, calculate the absolute difference between the drawing value and the corresponding measured value, generate a pass result when the absolute difference is not greater than the tolerance, generate a pending review result when the absolute difference is greater than the tolerance, and generate a no-3D corresponding value result when the corresponding measured value is not determined. The pass result, the result to be reviewed, and the result without a corresponding 3D value, along with the matching source, calculation basis, failure reason, drawing location, and model location, are written into the verification result.
[0013] Preferably, the steps for acquiring and saving the manual review information and the verification results to construct RAG case data are as follows: Receive the manual confirmation and manual modification information of the verification results, record the size type, two-dimensional target geometry, three-dimensional measurement candidate, the drawing value, the corresponding measurement value, the matching source and the reason for failure, and obtain the manual review information; The manually reviewed information is associated with the corresponding size semantics, geometric topology, numerical features, registration residuals, and candidate matching states to form case entries; The case entries are labeled as successful cases, mismatch cases, and unmatched cases. The processing strategies, rule parameters, matching weights, and verification results of the case entries are saved to construct the RAG case data.
[0014] Preferably, the steps of the AI agent performing retry, candidate switching, manual review request, and report output based on the task status and similar cases retrieved from the RAG case data are as follows: The AI agent reads the parsing completion status, registration residual, candidate confidence and non-matching reason in the task status, and uses the size semantics, target geometry, topological relationship, drawing value and candidate matching status of the two-dimensional object to form the retrieval conditions; Based on the search criteria, retrieve similar successful cases and mismatch cases from the RAG case data, and extract the verified parsing tool call order, rule parameters, matching weights, and retry conditions; When the parsing completion status does not meet the preset integrity condition, the parsing tool corresponding to the missing data type is called. When the registration residual is greater than the preset residual threshold, the hole pair candidate is switched and the registration relationship is re-estimated. When the candidate confidence is less than the preset manual review threshold, the manual review request is generated. After all the two-dimensional size objects form the verification result, the final report is output. Only the rule parameters and matching weights that have passed regression verification after manual review are written into the RAG case data.
[0015] Compared with the prior art, the advantages and positive effects of the present invention are as follows: This invention simultaneously acquires vector PDF engineering drawings and corresponding 3D model files, incorporating 2D annotation information and 3D entity information into the same verification process. This avoids the information fragmentation caused by separately recognizing drawing text or separately measuring the model. Directly parsing vector primitives, text blocks, arrows, boundaries, and target geometry preserves coordinates, directions, line widths, and topological relationships. It establishes a clear association between the nominal values, tolerances, and quantities expressed by dimension text and the holes, edges, faces, and slots pointed to by arrows, providing traceable geometric evidence for semantics such as hole diameter, hole center distance, edge distance, hole-to-edge distance, and slot dimensions. By parsing cylindrical surfaces, planes, rounded edges, and vertices in the 3D model, it forms measurement candidates adapted to different dimension semantics, limiting the range of measurement value sources and reducing the forced pairing of dimensions with similar values but different geometric meanings. Establishing an initial correspondence based on hole diameter and hole group distance fingerprints, and estimating similar transformations under non-mirror and mirror coordinate conditions, it can adapt to situations where the 2D view has scale changes, rotations, translations, and left / right flips relative to the 3D projection, improving registration stability under complex view conditions. By combining dimensional semantics, registration location, and candidate confidence levels to determine the corresponding measured values, and then comparing the drawing values with the model values, a verification result with clear evidence can be generated, such as passed, pending verification, and no corresponding 3D value. Manual verification information, matching sources, and reasons for failure are continuously saved and constitute RAG case data. The AI agent uses this data to retrieve similar successful and mismatched cases, and executes retries, candidate switching, manual verification requests, and report outputs according to the task status. This allows historical experience to participate in subsequent task decisions, while retaining the identification source, matching path, and judgment criteria for each dimension, thereby improving the accuracy, automation, anomaly location efficiency, and result traceability of engineering drawing dimension verification. Attached Figure Description
[0016] Figure 1 This is a schematic diagram of the steps of the present invention. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention.
[0018] Example 1, please refer to Figure 1 This embodiment provides a method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents. The method is used by manufacturing enterprises to verify the dimensional consistency of two-dimensional engineering drawings and three-dimensional models of the same part during quotation review, drawing inspection, process review, design verification, and pre-production inspection.
[0019] This embodiment does not simply convert 2D engineering drawings into images and perform text recognition. Instead, it directly preserves line segments, arcs, closed paths, fill paths, coordinates, line widths, and text blocks from the vector PDF engineering drawing, and recovers the actual orientation of dimension annotations through the topological relationships between vector primitives. Furthermore, this embodiment does not search for arbitrary values close to the drawing values from the 3D model. Instead, it first extracts hole candidates, plane layer candidates, waist-shaped groove candidates, and model bounding boxes, and then selects the corresponding measurement method based on the dimensional semantics, thereby reducing the probability of irrelevant values being incorrectly matched.
[0020] In this embodiment, RAG is a retrieval enhancement generation mechanism. The RAG case data stores successful cases, mismatch cases, and unmatched cases that have been manually verified or validated through regression. When processing the current task to be verified, the AI agent retrieves similar cases based on the current task's size semantics, two-dimensional topology, three-dimensional topology, numerical features, registration residuals, and matching status. Based on the search results, it determines the parsing tool calling order, candidate weights, retry conditions, and manual review conditions.
[0021] This embodiment specifically includes the following steps: Obtain vector PDF engineering drawings and corresponding 3D model files.
[0022] In this step, a vector PDF engineering drawing of the same part and a 3D model file in STEP format are received via a file import interface. The STEP format can be STEP AP203, or it can be STEP AP214 or STEP AP242, which provides information on analytical points, directions, coordinate axes, surfaces, edges, and vertices. To ensure consistency in subsequent verification, after importing the files, the filenames, part numbers, drawing numbers, version numbers, material identifiers, unit information, and generation times of both files are read first.
[0023] Parse vector graphics primitives and text blocks in a vector PDF engineering drawing to generate a 2D primitive set.
[0024] In this process, line segments, curves, fill paths, and text blocks are read page by page through the PDF vector interface, without pre-rasterizing the vector PDF engineering drawing into a regular image. For each read vector element, the page number, element number, start coordinates, end coordinates, control point coordinates, enclosing area, line width, fill attributes, and stroke attributes are saved. For each read text block, the page number, text content, character position, character direction, font information, and text enclosing area are saved.
[0025] By binding arrows, boundaries, target geometry, and dimension text to a set of two-dimensional primitives, a two-dimensional dimension object with dimension semantics is generated.
[0026] In this step, hole contours, part contours, arrows, dimension lines, boundary lines, leader lines, and dimension text are first identified from the set of two-dimensional primitives. Then, based on spatial adjacency, directional, and intersection relationships, the hole contours, part contours, arrows, dimension lines, boundary lines, leader lines, and dimension text are bound into complete two-dimensional dimension objects. Each two-dimensional dimension object contains at least the dimension object number, dimension semantics, nominal value, tolerance, quantity, dimension axis, arrow span, target geometry, text position, and confidence information.
[0027] Parse the geometric entities in the 3D model file to generate a set of 3D measurement candidates.
[0028] In this step, the topological and geometric entities in the 3D model file are read, multiple cylindrical surfaces corresponding to the same structure are merged into hole candidates, planes with similar normals and a certain offset distance are assigned to plane layer candidates, the contour composed of two semicircular ends and parallel structures is assigned to waist groove candidates, and a model bounding box is generated based on all vertices.
[0029] Based on the aperture and aperture group distance fingerprint, an initial correspondence is established between two-dimensional objects and three-dimensional measurement candidate sets. The same type of transformation that allows mirroring is estimated to obtain the registration relationship.
[0030] In this embodiment, "similar transformation" refers to a coordinate transformation with uniform scale, rotation, and translation relationships within the two-dimensional projection plane, allowing for mirroring of one of the coordinate axes before solving. By solving the non-mirrored and mirrored cases separately, it can accommodate situations where the two-dimensional view is rotated, translated, scaled, or flipped horizontally relative to the projection of the three-dimensional model.
[0031] Based on the dimensional semantics and registration relationship of the two-dimensional object, the corresponding measurement value is determined from the three-dimensional measurement candidate set, the drawing value is compared with the corresponding measurement value, and the verification result is generated.
[0032] In the steps, dimensional semantics are used to define the type and method of 3D measurement candidates. For example, when the dimensional semantics is hole diameter, only the diameter is read from the hole candidates; when the dimensional semantics is hole center distance, only the distance between the center of two hole candidates is calculated; when the dimensional semantics is hole-to-edge distance, the distance from the hole center to the corresponding edge of the model bounding box or the edge of the defined contour is calculated; when the dimensional semantics is slot size, the slot width, slot length, or slot center distance is extracted from the waist-shaped slot candidates.
[0033] Acquire and save manual review information and verification results to construct RAG case data.
[0034] Human reviewers can confirm system results and modify dimensions, 2D target geometry, 3D corresponding objects, or reasons for failure. The human review information generated from confirmations and modifications is saved along with the context of the current verification task, forming case entries available for subsequent retrieval.
[0035] The AI agent performs retries, candidate switching, manual review requests, and report output based on the task status and similar cases retrieved from the RAG case data.
[0036] Instead of directly modifying 2D drawings or 3D models, the AI agent schedules the processes of 2D analysis, 3D analysis, registration, dimensional measurement, case retrieval, manual review, and report generation based on the task status. When the current step lacks necessary data, the AI agent invokes the corresponding analysis tool; when multiple candidate objects exist, the AI agent adjusts the candidate weights based on similar cases; when the confidence level of a candidate is insufficient, the AI agent stops automatically confirming and generates a manual review request.
[0037] Example 2: The specific steps for obtaining vector PDF engineering drawings and corresponding 3D model files are as follows: It can receive vector PDF engineering drawings and STEP format 3D model files corresponding to the same part, read the page coordinate system and units of the vector PDF engineering drawings, and read the model coordinate system, units and entity information of the 3D model files. In this embodiment, the file receiving interface assigns file identifiers to two-dimensional and three-dimensional files respectively. For vector PDF engineering drawings, it reads the page width, page height, page rotation angle, page clipping area, drawing area, coordinate origin, and length unit. For three-dimensional model files, it reads the model's global coordinate system, local coordinate system, length unit, number of entities, number of shells, number of surfaces, number of edges, and number of vertices.
[0038] When a vector PDF engineering drawing contains multiple pages, first determine the pages to be processed based on the drawing number, page number, view name, and scale information in the title bar. Different pages can correspond to the main view, top view, side view, or enlarged detail of a part. All two-dimensional coordinates on the pages are uniformly converted to a coordinate system with the bottom left corner of the page as the origin to avoid inconsistencies in coordinate directions caused by different PDF parsing tools using the top left corner as the origin.
[0039] Verify the part identification, version identification, and unit information of the vector PDF engineering drawing and the 3D model file, unify the length units of the page coordinate system and the model coordinate system, and obtain the task to be verified. In this embodiment, part identifiers can be obtained from the drawing title block, file attributes, file name, or user input information. Version identifiers may include revision number, release date, and design status. The system compares the part identifiers and version identifiers in the 2D and 3D files. When the part identifiers are inconsistent, automatic verification stops and a file mismatch message is output. When the part identifiers are consistent but the version identifiers are inconsistent, the inconsistent version identifier information is written to the task status and a priority review mark is generated.
[0040] Unit information includes millimeters, centimeters, meters, inches, and page drawing units converted from the document scale. For 3D models using millimeters as units, the unit conversion factor is set to one; for 3D models using inches as units, the length values in the 3D model are multiplied by 25.4 before being converted to millimeters. Coordinates on the page are not directly used as actual dimensions, but rather a length conversion relationship is established by combining the drawing scale, the identified nominal dimensions, and the page unit information.
[0041] Write the unit conversion relationships of the tasks to be verified into the task status.
[0042] The task status is used throughout the entire verification process and should record at least the task number, 2D file identifier, 3D file identifier, page coordinate system, model coordinate system, 2D length unit, 3D length unit, unit conversion relationship, parsing completion status, registration status, verification status, and manual review status.
[0043] In one implementation scenario, the data content of the task status is shown in the table below.
[0044] Table 1. Data Content of Task Status ; Example 3: The specific steps for parsing vector primitives and text blocks in a vector PDF engineering drawing to generate a two-dimensional primitive set are as follows: Read line segments, curves, fill paths, and text blocks from vector PDF engineering drawings through a vector interface, and retain the coordinates and line width of each vector primitive; In this embodiment, line segments include straight line segments, straight sections within polylines, and straight edges described by path instructions. Curves include circles, arcs, elliptical arcs, Bézier curves, and near-circular structures formed by fitting multiple short line segments. Fill paths include filled outlines formed by solid arrows, solid symbols, and curved text. Text blocks include directly readable character codes and complete text content formed by aggregating multiple character objects according to their spatial positions.
[0045] For each vector primitive, the system saves its minimum bounding area, center position, length, direction, line width, closure state, fill state, and adjacent primitive numbers. For curves, it also saves the curvature variation, fitted circle center, fitted radius, and circumferential coverage angle. For text blocks, it also saves the text baseline direction, character spacing, line spacing, and character bounding area.
[0046] The hole profile is extracted based on the roundness, radius difference, and closure error of the curve. The part profile, dimension line, boundary line, and leader line are distinguished based on the mode of line width, length distribution, direction, and connection relationship of the line segments. In this embodiment, circle fitting is performed on each closed curve or approximately closed curve. Roundness indicates the consistency of distances from each sampling point on the curve to the center of the fitted circle. Radius difference indicates the difference between the maximum and minimum distances from each sampling point on the curve to the center of the fitted circle. Closure error indicates the distance between the start and end points of the curve.
[0047] When the roundness meets the hole profile threshold, the radius difference is not greater than the hole profile radius threshold, and the closure error is not greater than the closure threshold, the curve is marked as a hole profile candidate. For a circular hole composed of multiple arcs, multiple arcs with the same fitted center and a radius difference not greater than the merging threshold are merged into one hole profile.
[0048] The mode of line width reflects the line width that appears most frequently in the current drawing. Dimension lines and boundary lines usually use the same or similar thin line width, while part outlines usually use a different line width than dimension lines. The system uses line width, length, and connection relationships together to avoid misjudgments caused by relying solely on line width.
[0049] For line segments with arrows connecting both ends and aligned with the dimension direction, mark them as dimension lines. For line segments connecting dimension lines and extending into the part structure, mark them as boundary lines. For lines extending from dimension text to the target geometry and containing polyline or arc segments, mark them as leader lines. For line segments or curves forming a closed shape, with continuous lengths and not belonging to the dimensioning structure, mark them as part contours.
[0050] Arrows are extracted based on the number of vertices, side length ratio, and symmetry axis direction of the filling path. Hole contours, part contours, dimension lines, boundary lines, leader lines, arrows, and text blocks are written into a unified coordinate system to generate a set of two-dimensional primitives.
[0051] In this embodiment, the filling path is approximated as a polygon. For a filling path that approximates a triangle, three main vertices are extracted and the lengths of the three sides are calculated. If the length difference between two sides is not greater than a preset side length difference threshold, and the vertex formed by the intersection of the two sides is a cusp, then the filling path is identified as an arrow candidate. The direction from the cusp to the midpoint of the opposite side is recorded as the arrow direction.
[0052] For arrows composed of polylines, the cusp is extracted based on the region enclosed by the polylines and the distribution of vertices. For non-solid arrows, the arrow direction is extracted based on the intersection of the two diagonal lines and the direction of the axis of symmetry. The arrow recognition result includes at least the arrow number, cusp coordinates, tail coordinates, arrow direction, enclosing region, and recognition confidence level.
[0053] The unified coordinate system is based on the PDF page coordinates, corrects for page rotation angles, and uniformly transforms text blocks, hole outlines, part outlines, dimension lines, boundary lines, leader lines, and arrows to the same coordinate direction. Each object in the 2D primitive set has a unique number, enabling the recording of the source primitive when generating subsequent 2D dimension objects.
[0054] Example 4, the specific steps for generating a two-dimensional dimension object with dimension semantics based on a two-dimensional primitive set bound to arrows, boundaries, target geometry, and dimension text are as follows: Extract hole and part contours from a set of two-dimensional primitives, pair arrows with opposite directions and whose cusp line makes an angle with the arrow direction no greater than a preset angle threshold, and obtain the arrow span. In this embodiment, arrows are first candidate-paired based on the distance between their apexes. For two arrows, the angle between the direction of the first arrow and the direction of the line connecting its apexes, and the angle between the direction of the second arrow and the direction of the line connecting its opposite apexes are compared. When both angles are not greater than a preset angle threshold, and the two arrows are in opposite directions, the two arrows are paired.
[0055] The preset angle threshold can be set to ten degrees based on the drawing's precision. For drawings with scanning distortion or vector path discrepancies, the AI agent can adjust the preset angle threshold to twelve or fifteen degrees based on parameters validated in similar cases. The line connecting the two arrow tips forms the arrow span, and the direction of the arrow span forms the annotation axis.
[0056] Search along the apex of the arrow span for the boundary line whose angle deviation from the arrow span is no greater than a preset vertical threshold, and use the hole contour and part contour hit by the extension line of the boundary line as the target geometry. For each of the two cusps of the arrow span, candidate boundary lines are searched in the neighborhood of each cusp. A boundary line satisfies the direction condition when the angle between it and the arrow span is close to 90 degrees. A preset vertical threshold is used to limit the allowable angular deviation between the boundary line and the strictly vertical direction; for example, it can be set to eight degrees.
[0057] The boundary line that meets the directional conditions is extended along its own direction, and it is determined whether the extended boundary line passes through the central region of the hole profile, intersects with the hole profile, intersects with the part profile, or reaches the waist-shaped groove profile. If the extended boundary line passes through the central region of the hole profile, the corresponding hole profile is taken as the hole target geometry; if the extended boundary line intersects with the part profile, the edge of the part profile near the intersection point is taken as the edge target geometry.
[0058] Based on the type of target geometry and the intersection relationship between the arrow span and the hole profile, assign dimensional semantics to the hole diameter, hole center distance, edge distance, hole-to-edge distance, and slot size; When the two apexes of the arrow span are located on opposite sides of the same hole profile, and the arrow span passes through or is close to the center of the hole profile, the dimension semantics are determined as the hole diameter. When two boundary lines respectively hit the center regions of two different hole profiles, the dimension semantics are determined as the hole center distance. When two boundary lines respectively hit the edges of two part profiles, the dimension semantics are determined as the edge distance. When one boundary line hits the hole profile and the other boundary line hits the edge of the part profile, the dimension semantics are determined as the hole-to-edge distance.
[0059] When the target geometry contains two semicircular ends and a parallel contour edge connecting the two semicircular ends, the target geometry is marked as a slot target. If the arrow span is perpendicular to the two parallel contour edges, it is assigned the meaning of slot width; if the arrow span extends along the direction of the line connecting the centers of the two semicircular ends, it is assigned the meaning of slot length or slot center distance.
[0060] Aggregate the glyphs around the arrow span, perform dual-channel text recognition through page image cropping and vector masking, and correct the engineering symbols according to the glyph template chamfer distance, number of inner holes, diagonal line direction and aspect ratio to obtain dimensional text containing nominal values, tolerances and quantities; In this embodiment, a text search area is established based on the center position of the arrow span, the position of the dimension line, and the extension line of the arrow tail. Adjacent glyphs in the search area are aggregated into text blocks according to the baseline direction, character spacing, and character height. For text whose character encoding can be directly read from the PDF, the character encoding result is used first; for text that cannot be directly read, such as outlined or curved text, both page image cropping recognition and vector mask recognition are performed simultaneously.
[0061] The page image cropping channel renders the target text area as a local image at a preset resolution and performs character recognition. The vector mask channel fills the text path into a binary mask and matches it based on the chamfer distance between the character outline and the engineering character template.
[0062] The characters "0" and "8" are distinguished by the number of internal holes. The diameter symbol "Φ" and the number "0" are distinguished by the direction of the diagonal line, the aspect ratio of the profile, and whether the diagonal line passes through the closed profile. The multiplication sign "×" and the letter "x" are distinguished by the intersection angle of the two diagonal lines and their aspect ratio. The angle symbol "°" is distinguished by the area of the closed profile and its position relative to the baseline.
[0063] After the text recognition results are parsed using engineering rules, the quantity, diameter symbol, nominal value, upper deviation, lower deviation, and unit are obtained. For example, the text "3-Φ5.4 ±0.1" is parsed as the quantity three, the aperture semantics, the nominal value five point four millimeters, the upper deviation zero point one millimeter, and the lower deviation negative zero point one millimeter.
[0064] Bind dimension text to arrow span, boundary, and target geometry, allowing dimension text located on the extension line of the arrow tail to participate in the binding, generating a 2D dimension object.
[0065] The binding of dimension text to arrow spans considers distance, direction, and occlusion relationships. For ordinary annotations where the text is located between two arrows, the arrow span with the smallest distance and consistent annotation axis is directly bound. For small-sized annotations, where the dimension text may be located outside the arrow tail, the system searches for text blocks along the extension line of the arrow tail and allows these text blocks to participate in the binding.
[0066] Two-dimensional objects can use the following data structure: Table 2 Data Structure of Two-Dimensional Objects ; Example 5, the specific steps for parsing geometric entities in a 3D model file and generating a 3D measurement candidate set are as follows: Read the analytical points, directions, coordinate axes, cylindrical surfaces, planes, circular edges, and vertices from the 3D model file, and establish the topological adjacency relationships of the geometric entities; In this embodiment, the boundary representation information of the entity is read through the STEP parsing interface. For each cylindrical surface, the cylinder axis, cylinder radius, axial range, normal direction, circumferential coverage area, and adjacent faces are stored. For each plane, the plane normal, plane offset, area, boundary profile, and adjacent faces are stored. For each circular edge, the center, radius, normal, circumferential coverage angle, and adjacent faces are stored. For each vertex, the three-dimensional coordinates and adjacent edges are stored.
[0067] Topological adjacency relationships include adjacency between faces, adjacency between a face and an edge, connection between an edge and a vertex, and membership within the same closed shell. After establishing topological adjacency relationships, it is possible to determine whether multiple cylindrical faces belong to the same hole structure, and also to determine whether the ends of two semicircles are connected by parallel structures.
[0068] Inward cylindrical surfaces with radius differences not exceeding a preset radius threshold, axial distances not exceeding a preset coaxial threshold, and circumferential coverage angles not exceeding a preset coverage angle threshold are merged into hole candidates, and the hole center, axis, and diameter of the hole candidates are recorded. For cylindrical surfaces in a 3D model, first determine whether the cylindrical surface is an inward cylindrical surface based on the normal direction and the side where the solid material is located. An inward cylindrical surface indicates that the space enclosed by the cylindrical surface belongs to the material removal region, and therefore can be used as a candidate for hole structure.
[0069] A single through hole or stepped hole may consist of multiple cylindrical surfaces distributed along the axial direction. The system compares the radii, axial directions, and axial positions of the multiple cylindrical surfaces. When the radius difference is not greater than a preset radius threshold, the axial distance is not greater than a preset coaxial threshold, and the combined circumferential coverage angle is close to 360 degrees, the corresponding cylindrical surfaces are merged.
[0070] In one implementation, the preset radius threshold is set to 0.05 mm, the preset coaxial threshold is set to 0.05 mm, and the preset coverage angle threshold is set to 2 degrees. For STEP files with different model accuracies, the thresholds can be adjusted according to the model units and modeling accuracy.
[0071] The hole candidate record includes the hole candidate number, hole center, axis, diameter, hole depth, inlet circle edge, outlet circle edge, associated entity, and source cylindrical surface. For through holes, the hole center can be the intersection of the hole axis and the main projection plane; for blind holes, the hole center can be the center of the inlet circle edge.
[0072] The plane is layered according to the included angle of the normal and the offset along the normal to obtain the candidate plane layer. The candidate waist-shaped groove is generated according to the two semicircular ends with the same radius and the parallel edge connecting the two semicircular ends. For planes, they are first grouped according to their normal direction. If the angle between the normals of two planes is not greater than a preset normal threshold, the two planes are grouped into the same normal group. Within the same normal group, the planes are sorted and layered according to their offset distance along the normal direction. The distance between adjacent plane layers can be used to measure plate thickness, step height, and interlayer distance.
[0073] Larger planes are preferred as the main surface or reference surface of the part. Smaller planes that are parallel to the main surface can be used as step surfaces or groove bottom surfaces. For each candidate plane layer, at least the normal, offset distance, area, boundary range, and plane number should be recorded.
[0074] The candidate waist-shaped groove consists of two semicircular ends and a parallel structure connecting them. The system searches within the circular edge for two semicircular ends with the same radius, the same normal, and their centers lying in the same plane. It then determines whether the two semicircular ends are connected by two parallel edges or parallel curved surfaces. When the conditions are met, a candidate waist-shaped groove is generated, and the groove width, total groove length, center-to-center distance between the two semicircles, groove center position, and groove direction are recorded.
[0075] Generate model bounding boxes based on vertices, and write hole candidates, planar layer candidates, waist-shaped groove candidates, and model bounding boxes into the 3D measurement candidate set.
[0076] In this embodiment, an axis-aligned model bounding box is generated based on the minimum and maximum coordinate values of all vertices of the 3D model in the model coordinate system. Simultaneously, a projected bounding box facing the current 2D view can be generated based on the main plane direction. The model bounding box is used to provide candidate dimensions for the part's outline span, hole-to-outline distance, and overall size.
[0077] Each candidate in the 3D measurement candidate set stores its candidate type, geometric parameters, topological source, measurable items, and projection location. Measurable items for hole candidates include diameter, hole center location, and distance between holes; measurable items for planar layer candidates include interlayer distance; measurable items for waist-shaped groove candidates include groove width, groove length, and groove center distance; and measurable items for model bounding boxes include the shape span in different directions and the distance from the hole to the edge of the bounding box.
[0078] Example 6: The steps for establishing an initial correspondence between a two-dimensional object and a three-dimensional measurement candidate set based on aperture and aperture group distance fingerprints, estimating similar transformations that allow mirroring, and obtaining the registration relationship are as follows: Extract the two-dimensional hole targets associated with the two-dimensional objects, extract hole candidates from the three-dimensional measurement candidate set, and sort the distances from each two-dimensional hole target to the remaining two-dimensional hole targets and the distances from each hole candidate to the remaining hole candidates in ascending order to generate a hole group distance fingerprint; In this embodiment, the two-dimensional hole target is obtained from the hole profile associated with the two-dimensional dimension object. If the same hole profile is referenced by multiple two-dimensional dimension objects, only one two-dimensional hole target record is retained to avoid duplicate calculations. Each two-dimensional hole target stores the hole center page coordinates and the two-dimensional hole diameter obtained by hole diameter annotation or circular profile fitting.
[0079] For each 2D hole target, calculate the Euclidean distance from the 2D hole target to the other 2D hole targets, and sort the distances from smallest to largest to form a 2D hole group distance fingerprint. For each 3D hole candidate, project the hole candidate onto the candidate projection plane, calculate the projected distance from the hole candidate to the other hole candidates, and sort the projected distances from smallest to largest to form a 3D hole group distance fingerprint.
[0080] The aperture group distance fingerprint remains unchanged after translation, rotation, and mirroring. When the scale is unknown, the aperture group distance fingerprint can be scaled down, for example, by using the maximum or median value in the distance sequence as the normalization benchmark. The normalized aperture group distance fingerprint is used to compare the aperture group structure of two-dimensional aperture targets and three-dimensional aperture candidates.
[0081] The candidate matching cost is calculated based on the difference between the aperture of the two-dimensional hole target and the hole candidate and the difference between the hole group and the corresponding distance in the fingerprint. Hole pairs with candidate matching costs not greater than the preset matching threshold and satisfying the one-to-one correspondence constraint are selected to obtain the initial correspondence. The candidate matching cost consists of aperture difference, distance fingerprint difference, and local adjacency difference. Aperture difference is used to prevent matching of aperture structures with different aperture sizes. Distance fingerprint difference is used to evaluate the consistency of the aperture group layout. Local adjacency difference is used to evaluate the number and orientation relationship of the nearest apertures.
[0082] For each 2D hole target, multiple 3D hole candidates are generated and sorted according to their matching costs. A one-to-one correspondence constraint is then applied, meaning that a 2D hole target can only correspond to one 3D hole candidate, and a 3D hole candidate can only correspond to one 2D hole target. Multiple hole pairs with similar or identical matching costs are retained as initial candidate correspondences and determined based on the root mean square residual in subsequent similar transformation solutions.
[0083] By performing the same least-squares transformation on both non-mirror and mirror coordinates, the scale, rotation angle, translation amount, and root mean square residual are obtained. Non-mirror coordinates preserve the original coordinate orientation of the 2D hole target. Mirror coordinates mirror the 2D hole target relative to a preset coordinate axis, for example, by reversing the x-coordinate. For both non-mirror and mirror coordinates, the scale, rotation angle, and translation are solved using at least two hole pairs, preferably using three or more hole pairs to perform a least-squares solution.
[0084] The scale represents the uniform ratio from 2D page coordinates to 3D projected coordinates. The rotation angle represents the directional change of the 2D view relative to the 3D projection. The translation represents the offset between the origins of the two coordinate systems. The root mean square residual represents the combined error between the mapped positions of multiple 2D hole targets and their corresponding 3D hole candidate projection positions after applying the scale, rotation angle, and translation.
[0085] When abnormal hole pairs exist, an iterative approach can be used to delete the hole pair with the largest residual and resolve the problem. However, after deletion, the correspondence that satisfies the minimum number of hole pairs should still be retained. The deleted hole pairs are recorded as candidate switching information for use by the AI agent and RAG case data.
[0086] Select the transformation result with the smallest root mean square residual, map the two-dimensional object to the three-dimensional projected coordinate system, and generate the registration relationship.
[0087] The system compares the root mean square (RMS) residuals of the non-mirrored and mirrored results. The result with the smallest RMS residual, which is less than a preset residual threshold, is selected as the registration relation. The registration relation must include at least whether it is mirrored, scale, rotation angle, translation amount, hole pairs involved in the solution, excluded hole pairs, and RMS residual.
[0088] By using registration relationships, the center of the hole profile, the edge of the part profile, the tip of the arrow, the boundary point, and the position of the groove profile in a two-dimensional object can be mapped to a three-dimensional projected coordinate system. The mapped target geometry is then used to search for candidates that are spatially close and semantically consistent from the set of three-dimensional measurement candidates.
[0089] Example 7: Based on the dimensional semantics and registration relationship of the two-dimensional object, the corresponding measurement value is determined from the three-dimensional measurement candidate set, and the drawing value is compared with the corresponding measurement value to generate the verification result. The specific steps are as follows: From the 3D measurement candidate set, hole candidates, model bounding box candidates, planar layer candidates, and waist-shaped groove candidates are extracted. The target geometry is mapped according to the registration relationship. The candidate confidence is calculated according to the mapping distance and size semantic consistency. Candidates with confidence scores less than the preset confidence threshold are deleted. In this embodiment, the candidate types are first defined based on the dimensional semantics of the two-dimensional object. The aperture and hole center distance are selected only from the hole candidates; the edge distance is preferentially selected from the model bounding box and the planar layer candidates with the corresponding orientation; the hole-to-edge distance is selected from the combination of the hole candidate and the corresponding edge of the model bounding box; and the slot size is selected from the waist slot candidates.
[0090] Mapping distance represents the distance between the 2D target geometry after registration mapping and the 3D candidate projection position. Dimensional semantic consistency indicates whether the 3D candidate can provide valid measurements according to the current dimensional semantics. Candidate confidence can also be combined with aperture proximity, annotation axis direction consistency, topological adjacency consistency, and candidate weights in similar cases.
[0091] The preset confidence threshold can be set to 0.7. Candidates with a confidence level less than 0.7 are not used for automatic confirmation. Candidates with a confidence level between 0.7 and 0.85 can be retained as candidates for review. Candidates with a confidence level of not less than 0.85 can enter the automatic measurement process. The specific threshold can be adjusted using validated RAG case data.
[0092] When the dimension semantics are hole diameter, the diameter of the hole candidate is read. When the dimension semantics are hole center distance, the projection distance of the hole centers of the two hole candidates on the annotation axis is calculated. When the dimension semantics are hole-to-edge distance, the distance from the hole center of the hole candidate to the corresponding edge of the model bounding box is calculated. When the dimension semantics are edge distance, the value is determined from the model bounding box span and the interlayer distance of the planar layer candidate. When the dimension semantics are slot size, the slot width, slot length and slot center distance of the waist-shaped slot candidate are read to obtain the corresponding measurement value. For the aperture, directly read the candidate aperture diameter corresponding to the 2D aperture target. When the dimension text includes a quantity, check if the corresponding number of candidate apertures have the same diameter, and record the diameter of each candidate aperture separately.
[0093] For the hole center distance, first project the centers of the two candidate holes onto the 3D projection direction corresponding to the 2D annotation axis, and then calculate the distance between the two projection points. When the 2D annotation axis is horizontal, use the registered horizontal component; when the 2D annotation axis is vertical, use the registered vertical component.
[0094] For the distance from the hole to the edge, determine the hole target and the edge target in the 2D object, map the hole target to the corresponding hole candidate, map the edge target to the corresponding edge of the model bounding box or the plane layer boundary, and calculate the vertical distance from the hole center to the corresponding edge.
[0095] For margins, first read the corresponding span of the model bounding box according to the annotation axis direction. If the model bounding box span is inconsistent with the 2D annotation target, then search for candidate planar layers based on the target's geometric position and calculate the interlayer distance between the corresponding planar layers. For step dimensions, prioritize the distance between local planar layers rather than the overall model bounding box span.
[0096] For groove dimensions, when the dimension axis is perpendicular to the long axis of the waist-shaped groove, read the groove width; when the dimension axis is parallel to the long axis of the waist-shaped groove and the target geometry points to the two ends of the groove, read the groove length; when the boundary line hits the center position of the two semicircular ends, read the groove center distance.
[0097] Extract drawing values and tolerances from dimension text, calculate the absolute difference between drawing values and corresponding measured values, generate a pass result when the absolute difference is not greater than the tolerance, generate a pending review result when the absolute difference is greater than the tolerance, and generate a result without a corresponding 3D value when the corresponding measured value is not determined. When the dimension text has symmetrical tolerances, the symmetrical tolerance value is used as the allowable deviation. When the dimension text has upper and lower deviations, it is determined whether the corresponding measured value is within the range of nominal value plus lower deviation to nominal value plus deviation. When the dimension text does not explicitly state the tolerance, the source of the tolerance can be determined according to the company's preset verification tolerance, the general tolerance in the drawing title block, or the rules corresponding to the current dimension range, and the source of the tolerance should be recorded in the verification results.
[0098] Results indicating that the corresponding measured values meet the drawing values and tolerance requirements. Results pending verification indicating that a 3D candidate with a credible semantic and spatial correspondence has been found, but the corresponding measured values do not meet the drawing values and tolerance requirements. Results with no 3D corresponding values indicating that no 3D candidate meeting the semantic and confidence conditions was found, or that the 3D model lacks the corresponding structure.
[0099] The system does not use 3D values that are close to the values on the drawing but semantically inconsistent as substitutes. For example, the hole diameter annotation must not use the plane layer distance as the corresponding measurement value, and the slot width annotation must not use the overall width of the model bounding box as the corresponding measurement value.
[0100] The results, results pending verification, and results without corresponding 3D values, along with the matching source, calculation basis, reason for failure, drawing location, and model location, will be written into the verification results.
[0101] The verification results should include at least the dimension object number, dimension name, dimension semantics, drawing value, tolerance, corresponding measured value, deviation value, judgment result, matching source, calculation basis, failure reason, drawing location, and model location. The drawing location is used to highlight the corresponding dimension annotation in the vector PDF engineering drawing, and the model location is used to highlight the corresponding hole, plane, edge, or waist-shaped groove in the 3D model.
[0102] Example 8: The specific steps for acquiring and saving manual review information and verification results to construct RAG case data are as follows: Receive manual confirmation and manual modification information of the verification results, record the size type, two-dimensional target geometry, three-dimensional measurement candidate, drawing value, corresponding measurement value, matching source and failure reason, and obtain manual review information; The manual review interface simultaneously displays the location of the 2D engineering drawing, the location of the 3D model, the drawing values, the corresponding measurement values, the semantics of the dimensions, the candidate confidence level, and the matching source. Manual reviewers can perform confirmation, modification, or rejection operations.
[0103] A confirmation operation indicates that the current dimension semantics, 2D target geometry, 3D measurement candidates, and verification results are all correct. A modification operation allows you to modify the dimension semantics, reselect the 2D target geometry, reselect the 3D measurement candidate, or correct the dimension text. A rejection operation indicates that the current task lacks sufficient data to establish the correspondence and requires recording the specific reason for the failure.
[0104] The manual review information also records the reviewer's identification, review time, content before modification, content after modification, and review instructions, thereby ensuring the traceability of case data.
[0105] The manual review information is associated with the corresponding size semantics, geometric topology, numerical features, registration residuals and candidate matching status to form case entries; Dimensional semantics include aperture, hole center distance, edge distance, hole-to-edge distance, and slot size. Geometric topology includes arrow-to-boundary relationship, boundary-to-target geometric relationship, number of hole groups, hole group adjacency relationship, 3D candidate adjacency relationship, and planar layer relationship. Numerical features include drawing values, corresponding measured values, tolerances, aperture sequence, hole group distance fingerprint, and candidate matching cost. Candidate matching status includes candidate number, candidate ranking, candidate confidence, whether candidate switching occurred, and whether a retrieval occurred.
[0106] The case entries are labeled as successful cases, mismatch cases, and unmatched cases. The processing strategies, rule parameters, matching weights, and verification results of the case entries are saved to construct RAG case data.
[0107] Successful cases indicate that the system results have been manually verified as correct. Mismatch cases indicate that the system initially selected the wrong target geometry or 3D measurement candidate, which was corrected manually to obtain the correct correspondence. Unmatched cases indicate that the system failed to determine the corresponding measurement value, and the specific reasons for the mismatch are recorded.
[0108] The processing strategies include the text recognition channel used, arrow pairing strategy, boundary search strategy, aperture group matching strategy, mirror solution strategy, candidate selection strategy, and manual review strategy. Rule parameters include preset angle thresholds, preset vertical thresholds, preset radius thresholds, preset coaxial thresholds, preset matching thresholds, preset residual thresholds, and preset confidence thresholds. Matching weights include aperture difference weights, aperture group distance fingerprint weights, mapping distance weights, size semantic consistency weights, and topological consistency weights.
[0109] Case entries in RAG case data can be stored using a combination of structured fields and vector representations. Structured fields are used to rigorously filter part types, dimensional semantics, and failure reasons, while vector representations are used to retrieve similar cases with similar textual semantics, geometric context, and processing strategies.
[0110] Example 9: The steps for the AI agent to perform retry, candidate switching, manual review request, and report output based on the task status and similar cases retrieved from the RAG case data are as follows: The AI agent reads the parsing completion status, registration residual, candidate confidence and non-matching reason in the task status, and uses the size semantics of the two-dimensional object, target geometry, topological relationship, drawing value and candidate matching status to form the retrieval conditions; In this embodiment, the AI agent reads the task status after each major step is completed. The completion status is used to determine whether the 2D primitive set, 2D dimension objects, and 3D measurement candidate set have been generated. The registration residual is used to determine whether a stable spatial correspondence has been established between the 2D objects and the 3D candidates. The candidate confidence score is used to determine whether the current corresponding measurement value can be automatically confirmed. The reason for non-matching is used to determine whether the current problem is due to text recognition failure, arrow matching failure, missing target geometry, missing 3D candidates, registration failure, or candidate ambiguity.
[0111] The search criteria include not only textual descriptions, but also structured size semantics, target geometric type, number of pore groups, pore size sequence, pore group distance fingerprint, registration residual range, and candidate confidence range, so that the search results simultaneously meet the requirements of semantic similarity and geometric similarity.
[0112] Based on the search criteria, retrieve similar successful cases and mismatch cases from the RAG case data, and extract the verified parsing tool call order, rule parameters, matching weights, and retry conditions; Successful similar cases are used to provide proven and effective processing strategies. For example, if the dimension text in the current drawing is located on the extension line of the arrow's tail, cases where the tail text binding has been successfully processed can be recalled, and the corresponding text search range and binding weight can be applied. Mismatch cases are used to exclude candidate combinations that have previously caused incorrect results. For example, if there are multiple holes of the same diameter in the current hole group, mismatch cases where the hole group is close to the fingerprint but has different local directional relationships can be recalled, and the matching weight of the corresponding candidates can be reduced.
[0113] The order in which the parsing tools for AI agent extraction are invoked can include first performing vector text reading, then performing page image cropping and recognition, and finally performing vector mask recognition; or it can include first performing registration using all hole candidates, then deleting the hole pair with the largest residual and re-registering. The tool invocation order is only used after the case has been manually confirmed or validated by regression.
[0114] When the parsing completion status does not meet the preset integrity conditions, the parsing tool corresponding to the missing data type is called. When the registration residual is greater than the preset residual threshold, the hole pair candidate is switched and the registration relationship is re-estimated. When the candidate confidence is less than the preset manual review threshold, a manual review request is generated. After all two-dimensional objects form the verification results, the final report is output. Preset integrity conditions may include the existence of a generated set of 2D primitives, the existence of at least one 2D dimensional object, the existence of a generated set of 3D measurement candidates, and the existence of saved unit conversion relationships. When a 2D text block is missing, the AI agent invokes page image cropping and vector mask recognition tools. When an arrow is missing, the AI agent adjusts the fill path recognition parameters and re-extracts the arrow. When a hole candidate is missing, the AI agent re-examines the cylinder merging threshold and the inward cylinder judgment results.
[0115] When the registration residual is greater than the preset residual threshold, the AI agent checks the hole pairs in the initial correspondence, deletes the hole pair with the largest residual or switches to the hole pair with the second smallest candidate matching cost, and then re-executes the least squares similar transformation solution for non-mirror coordinates and mirror coordinates.
[0116] When the confidence level of a candidate is lower than the preset manual review threshold, the system does not automatically generate a pass result, but instead generates a manual review request. The manual review request includes the current 2D dimension object, candidate 3D measurement objects, candidate ranking, reasons for low confidence, and similar case suggestions.
[0117] After all 2D dimensional objects have been processed, a final report is generated. The final report includes task information, file information, unit conversion relationships, total number of dimensions, number of passed dimensions, number of dimensions pending review, number of dimensions without corresponding 3D values, drawing value for each dimension, corresponding measurement value, deviation, judgment result, matching source, reason for failure, and 2D and 3D positioning information.
[0118] Only rule parameters and matching weights that have passed regression verification after manual review are written into the RAG case data.
[0119] Manual review and confirmation do not directly make the new parameters take effect globally. The system first saves the manual review results as candidate cases, and then performs regression verification using previously confirmed tasks. Only when the correct results of historical tasks do not change adversely after adopting new rule parameters or new matching weights, and the matching accuracy of the current type of task meets the preset verification conditions, are the rule parameters and matching weights written into the effective strategy of the RAG case data.
[0120] Example 10 illustrates the complete verification process using a plate-shaped part with three holes, a double step, and a waist-shaped groove as an example. The vector PDF engineering drawing includes a front view and enlarged details, and the 3D model file is in STEP AP203 format.
[0121] After receiving the vector PDF engineering drawing and the 3D model file, the system reads the same part identifier and version identifier from the title bar. The vector PDF engineering drawing uses millimeters, and the 3D model file also uses millimeters, so the unit conversion is the same.
[0122] During the 2D analysis process, the system reads the part's outer contour, the contours of three circular holes, the contour of a set of oblong grooves, fifteen arrows, corresponding boundary lines, and multiple text blocks. The system extracts arrows based on the cusp of the filled triangle and the direction of the axis of symmetry, and distinguishes dimension lines, boundary lines, and leader lines based on line width and connection relationships.
[0123] For the text "3-Φ5.4 ±0.1", the system first obtains the numbers and partial symbols through vector text reading, and then identifies the diameter symbol through vector mask recognition. The system resolves the quantity to three, the nominal value to five point four millimeters, and the tolerance to plus or minus 0.1 millimeters. The leader line points to one of the three hole contours along the broken line path. Based on the quantity and the topological relationship between the three identical hole contours, the system associates the dimension text with the three hole targets, generating a two-dimensional dimension object of the hole diameter type.
[0124] For the dimension annotation between two holes, the system identifies arrows pointing in opposite directions, forming an arrow span between the tips of the two arrows. The extended lines of the boundary at both ends of the arrow span pass through the centers of the two hole outlines, thus defining the dimension semantics as the hole center distance.
[0125] For the step dimensions, the boundary lines hit the two parallel part contour edges respectively, and the system defines the dimension semantics as the edge distance. For the waist-shaped groove dimensions, the arrow span is perpendicular to the two parallel edges of the groove, so the dimension semantics are defined as the groove width.
[0126] During the 3D analysis process, the system reads multiple cylindrical surfaces, planes, circular edges, and vertices. Inward cylindrical surfaces with the same radius and coincident axes are merged into three hole candidates. Multiple planes form the main surface layer, the first step surface layer, and the second step surface layer according to their normal and offset distances. The ends of two semicircles with the same radius are combined with two parallel structures to form waist-shaped groove candidates. All vertices are used to generate the model bounding box.
[0127] Three 2D target holes and three 3D candidate holes are used to generate hole group distance fingerprints. After calculating the candidate matching cost using the hole diameter difference and the hole group distance fingerprint difference, three initial hole pairs are obtained. The system solves the same type of transformation for both non-mirror and mirror cases. The root mean square residual for the mirror case is smaller than that for the non-mirror case, and the rotation angle is close to 90 degrees. Therefore, the mirror case with a rotation of approximately 90 degrees is selected as the registration relationship.
[0128] Using the registration relationship, three 2D hole targets are mapped to three 3D hole candidates. The hole diameters of the three candidates are read, yielding 5.38 mm, 5.39 mm, and 5.41 mm, all within the tolerance range of 5.3 mm to 5.5 mm, thus generating a pass result.
[0129] The drawing value for the hole center distance is 32 mm, and the projection distance of the three-dimensional hole center on the dimension axis is 32.18 mm. The tolerance is ±0.1 mm. The corresponding measured value exceeds the allowable range, so a result pending verification is generated.
[0130] The first step dimension is obtained from the interlayer distance between the main surface layer and the first step surface layer, and the second step dimension is obtained from the interlayer distance between the first step surface layer and the second step surface layer. Both step dimensions meet the drawing tolerances, therefore a pass result is generated.
[0131] The width of the waist-shaped slot is read from the two parallel structures of the waist-shaped slot candidate. If a local slot structure in the STEP model is missing a complete parallel edge, causing the confidence of the waist-shaped slot candidate to be lower than the preset confidence threshold, the system will not use the width with a similar value in the model bounding box to replace it, but will generate a result without a corresponding 3D value, and record the failure reason as incomplete waist-shaped slot topology.
[0132] Manual reviewers confirmed the dimensions of the three apertures and two steps, verified that the center distance between the apertures did indeed exceed the tolerance, and manually selected local groove surfaces in the model to supplement the candidate waist-shaped grooves. The manual review information was correlated with the current number of aperture groups, aperture sequence, mirror state, rotation angle, registration residual, and missing groove topology to form case entries.
[0133] The AI agent marks case entries as those containing successful matching, dimensional deviations, and 3D topology missing handling. After regression validation, the mirror registration, hole group candidate weights, and slot topology supplementation strategies from these cases are written into the RAG case data for use in subsequent verification tasks with the same drawing layout and model structure.
[0134] Through the above implementation methods, the present invention can directly use geometric coordinates, primitive topology, and text information in vector PDF engineering drawings; it can recover dimensional semantics based on the relationship between arrows, boundaries, target geometry, and dimensional text; it can form measurable candidates corresponding to dimensional semantics from 3D models; it can establish registration relationships between 2D and 3D models using aperture, aperture group distance fingerprints, and similar transformations that allow mirroring; and it can form a traceable closed loop of parsing, registration, verification, review, and report output through RAG case data and AI agents.
[0135] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments that can be applied to other fields. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.
Claims
1. A method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents, characterized in that, Includes the following steps: Obtain vector PDF engineering drawings and corresponding 3D model files; Parse the vector primitives and text blocks in the vector PDF engineering drawing to generate a two-dimensional primitive set; Based on the set of two-dimensional primitives, arrows, boundaries, target geometry, and size text are bound together to generate two-dimensional size objects with size semantics; The geometric entities in the 3D model file are parsed to generate a 3D measurement candidate set; The initial correspondence between the two-dimensional object and the three-dimensional measurement candidate set is established based on the aperture and aperture group distance fingerprint, and the same type of transformation that allows mirroring is estimated to obtain the registration relationship. Based on the dimensional semantics of the two-dimensional object and the registration relationship, the corresponding measurement value is determined from the three-dimensional measurement candidate set, the drawing value is compared with the corresponding measurement value, and a verification result is generated. Acquire and save the manual review information and the verification results to construct RAG case data; The AI agent performs retries, candidate switching, manual review requests, and report output based on the task status and similar cases retrieved from the RAG case data.
2. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The specific steps to obtain vector PDF engineering drawings and corresponding 3D model files are as follows: Receive the vector PDF engineering drawing and the STEP format 3D model file corresponding to the same part, read the page coordinate system and units of the vector PDF engineering drawing, and read the model coordinate system, units and entity information of the 3D model file; Verify the part identifiers, version identifiers, and unit information of the vector PDF engineering drawing and the 3D model file, unify the length units of the page coordinate system and the model coordinate system, and obtain the task to be verified. Write the unit conversion relationship of the task to be verified into the task status.
3. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The specific steps for parsing the vector primitives and text blocks in the vector PDF engineering drawing to generate a two-dimensional primitive set are as follows: The vector interface reads line segments, curves, fill paths, and text blocks from the vector PDF engineering drawing, and retains the coordinates and line width of each vector primitive. The hole profile is extracted based on the roundness, radius difference, and closure error of the curve; the part profile, dimension line, boundary line, and leader line are distinguished based on the mode of the line width, length distribution, direction, and connection relationship of the line segments. Arrows are extracted based on the number of vertices, side length ratio, and symmetry axis direction of the filling path. The hole outline, part outline, dimension line, boundary line, leader line, arrow, and text block are written into a unified coordinate system to generate the two-dimensional primitive set.
4. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The specific steps for generating a two-dimensional dimension object with dimension semantics based on the aforementioned two-dimensional primitive set, bound to arrows, boundaries, target geometry, and dimension text, are as follows: Extract hole contours and part contours from the set of two-dimensional primitives, pair arrows with opposite directions and whose cusp connection line makes an angle with the arrow direction no greater than a preset angle threshold, and obtain the arrow span; Search along the apex of the arrow span for the boundary line whose angle deviation from the arrow span is not greater than a preset vertical threshold, and take the hole contour and the part contour hit by the extension line of the boundary line as the target geometry; Based on the type of the target geometry and the intersection relationship between the arrow span and the hole profile, assign dimensional semantics to the hole diameter, hole center distance, edge distance, hole-to-edge distance, and slot size; Aggregate the glyphs around the arrow span, perform dual-channel text recognition through page image cropping and vector masking, and correct the engineering symbols according to the chamfer distance of the glyph template, the number of inner holes, the direction of the diagonal line and the aspect ratio to obtain dimensional text containing nominal values, tolerances and quantities; The dimension text is bound to the arrow span, the boundary line, and the target geometry, allowing the dimension text located on the extension line of the arrow tail to participate in the binding, thereby generating the two-dimensional dimension object.
5. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The specific steps for parsing the geometric entities in the 3D model file and generating a 3D measurement candidate set are as follows: Read the analytical points, directions, coordinate axes, cylindrical surfaces, planes, circular edges, and vertices from the 3D model file, and establish the topological adjacency relationship of the geometric entities; Inward cylindrical surfaces with radius differences not exceeding a preset radius threshold, axial distances not exceeding a preset coaxial threshold, and circumferential coverage angles not exceeding a preset coverage angle threshold are merged into hole candidates, and the hole center, axis, and diameter of the hole candidates are recorded. The plane is layered according to the included angle of the normal and the offset along the normal to obtain the plane layer candidate, and the waist-shaped groove candidate is generated according to the two semicircular ends with the same radius and the parallel edge connecting the two semicircular ends. Based on the vertex, a model bounding box is generated, and the hole candidate, the planar layer candidate, the waist-shaped groove candidate, and the model bounding box are written into the three-dimensional measurement candidate set.
6. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The steps for establishing an initial correspondence between the two-dimensional object and the three-dimensional measurement candidate set based on the aperture and aperture group distance fingerprint, estimating the allowed mirror-like transformations, and obtaining the registration relationship are as follows: Extract the two-dimensional hole targets associated with the two-dimensional objects, extract hole candidates from the three-dimensional measurement candidate set, and sort the distances from each two-dimensional hole target to the remaining two-dimensional hole targets and the distances from each hole candidate to the remaining hole candidates in ascending order to generate a hole group distance fingerprint; The candidate matching cost is calculated based on the difference between the aperture of the two-dimensional hole target and the hole candidate and the difference between the hole group and the corresponding distance in the fingerprint. Hole pairs whose candidate matching costs are not greater than a preset matching threshold and satisfy the one-to-one correspondence constraint are selected to obtain the initial correspondence. By performing the same least-squares transformation on both non-mirror and mirror coordinates, the scale, rotation angle, translation amount, and root mean square residual are obtained. Select the transformation result with the smallest root mean square residual, map the two-dimensional object to the three-dimensional projection coordinate system, and generate the registration relationship.
7. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The steps for determining the corresponding measurement value from the three-dimensional measurement candidate set based on the dimensional semantics of the two-dimensional object and the registration relationship, comparing the drawing value with the corresponding measurement value, and generating the verification result are as follows: Hole candidates, model bounding boxes, planar layer candidates, and waist-shaped groove candidates are extracted from the three-dimensional measurement candidate set. The target geometry is mapped according to the registration relationship. The candidate confidence is calculated according to the mapping distance and size semantic consistency. Candidates with a confidence score less than a preset confidence threshold are deleted. When the dimension semantics are aperture, the diameter of the hole candidate is read; when the dimension semantics are hole center distance, the projection distance of the center of the two hole candidates on the annotation axis is calculated; when the dimension semantics are hole-to-edge distance, the distance from the center of the hole candidate to the corresponding edge of the model bounding box is calculated; when the dimension semantics are edge distance, the value is determined from the span of the model bounding box and the interlayer distance of the planar layer candidate; when the dimension semantics are slot size, the slot width, slot length and slot center distance of the waist-shaped slot candidate are read to obtain the corresponding measurement value. Extract the drawing value and tolerance from the dimension text, calculate the absolute difference between the drawing value and the corresponding measured value, generate a pass result when the absolute difference is not greater than the tolerance, generate a pending review result when the absolute difference is greater than the tolerance, and generate a no-3D corresponding value result when the corresponding measured value is not determined. The pass result, the result to be reviewed, and the result without a corresponding 3D value, along with the matching source, calculation basis, failure reason, drawing location, and model location, are written into the verification result.
8. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The specific steps for acquiring and saving manual review information and the verification results to construct RAG case data are as follows: Receive the manual confirmation and manual modification information of the verification results, record the size type, two-dimensional target geometry, three-dimensional measurement candidate, the drawing value, the corresponding measurement value, the matching source and the reason for failure, and obtain the manual review information; The manually reviewed information is associated with the corresponding size semantics, geometric topology, numerical features, registration residuals, and candidate matching states to form case entries; The case entries are labeled as successful cases, mismatch cases, and unmatched cases. The processing strategies, rule parameters, matching weights, and verification results of the case entries are saved to construct the RAG case data.
9. The method for verifying the dimensions of engineering drawings based on RAG-enhanced AI agents according to claim 1, characterized in that, The AI agent performs the following steps—retrying, candidate switching, requesting manual review, and outputting a report—based on the task status and similar cases retrieved from the RAG case data: The AI agent reads the parsing completion status, registration residual, candidate confidence and non-matching reason in the task status, and uses the size semantics, target geometry, topological relationship, drawing value and candidate matching status of the two-dimensional object to form the retrieval conditions; Based on the search criteria, retrieve similar successful cases and mismatch cases from the RAG case data, and extract the verified parsing tool call order, rule parameters, matching weights, and retry conditions; When the parsing completion status does not meet the preset integrity condition, the parsing tool corresponding to the missing data type is called. When the registration residual is greater than the preset residual threshold, the hole pair candidate is switched and the registration relationship is re-estimated. When the candidate confidence is less than the preset manual review threshold, the manual review request is generated. After all the two-dimensional size objects form the verification result, the final report is output. Only the rule parameters and matching weights that have passed regression verification after manual review are written into the RAG case data.