A CAD inspection dimension viewing method and device
By automatically extracting and classifying the size data in CAD drawings, the problem of inefficiency in various size inspections in machining production is solved, and centralized inspection and efficient inspection of similar sizes are achieved.
Patent Information
- Application Number
- CN202411796819.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-09
- Publication Date
- 2025-04-01
AI Technical Summary
In mechanical processing production, it is difficult for the prior art to efficiently inspect the various processing sizes, shape and position tolerances and roughness in CAD drawings, resulting in low inspection efficiency and missing dimensions.
By providing a CAD test size viewing method and device, the dimension data in the CAD drawings are automatically extracted, converted into textual expressions, and the textual size is classified and managed, so that similar sizes can be inspected in one go with an inspection tool.
Centralized inspection of similar sizes is realized, inspection efficiency is improved, the problem of missing size failure is avoided, and the inspection process is simplified.
Smart Images

Figure CN119739884A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a CAD inspection dimension viewing method and device, belonging to the field of dimension inspection and information processing. Background Art
[0002] In mechanical processing production, when a component is transformed from raw materials through a series of processing steps such as cutting, turning, milling, planing, and grinding to finally become a finished product, it is necessary to inspect the semi-finished products during and after processing in each process, especially the inspection of processing dimensions, to check whether the semi-finished product is consistent with the design requirements of the drawing, and whether it is within the tolerance range of the dimension. The inspection of dimensions is usually done by the processing workers themselves and the quality inspectors re-inspect. Processing workers or quality inspectors usually hold paper drawings or open the drawings on electronic terminals (such as PADs, computer screens, etc.), and inspect while looking at the drawings. When there are many dimensions in the drawings, there will be situations where you cannot find the dimension to be inspected, whether the dimension has been inspected, missing dimensions that have not been inspected, and dimensions of the same type that have not been inspected together, such as Figure 1 .
[0003] Figure 1 In the drawings, there are three types of dimensions: processing dimensions, form and position tolerances, and roughness. Processing dimensions include length, circle diameter, depth, etc. Form and position tolerances include runout, verticality, coaxiality, symmetry, parallelism, etc. There are many dimensions to be inspected, and a tool is needed to extract these dimensions, classify them, number them, and mark whether to inspect them. Summary of the invention
[0004] Purpose of the invention: The purpose of the present invention is to provide a CAD inspection dimension viewing method and device, which automatically extracts dimension data in existing CAD drawings, converts them into textual expressions, and classifies and manages the textual dimensions, so that similar dimensions can be inspected with one inspection tool, thereby improving inspection efficiency.
[0005] Technical solution: To achieve the above-mentioned invention object, the present invention adopts the following technical solution:
[0006] In a first aspect, the present invention provides a CAD inspection dimension viewing method, comprising the following steps:
[0007] Open the CAD drawing, load all the graphic elements in the drawing, and store them in the graphic element collection;
[0008] Traverse each entity object in the graphic element collection, create a text dimension entity object for the entity object whose name contains "Dimension", and use a regular expression to match the dimension description text to obtain the dimension category information;
[0009] Add the text dimension entity objects with dimension categories to the dimension text list and display them together with the CAD drawings in the software interface;
[0010] When the user selects one, multiple or a type of text dimensions in the dimension text list, the ObjectId value in the text dimension is obtained, and the graphic elements corresponding to the selected ObjectId value are traversed and located in the CAD drawing;
[0011] Select the graphic element to be positioned in the CAD drawing.
[0012] Furthermore, the dimension categories include length, circle radius, diameter, depth, run-out, perpendicularity, coaxiality, symmetry, parallelism and roughness; the same dimensions are inspected using one inspection tool.
[0013] Furthermore, each entity object corresponds to an ObjectId, and the ObjectId includes a unique identifier, category, coordinates, and graphic data of the graphic element.
[0014] Furthermore, each text dimension entity object is converted from the entity object, and the text dimension entity class has three subclasses: processing dimension class, geometric tolerance class and roughness class.
[0015] Furthermore, the CAD drawing is a local drawing or a drawing in a network system.
[0016] Furthermore, the CAD drawing is displayed on the left side of the software interface, and the dimension text list is displayed on the right side. When you click on a dimension in the left drawing, the corresponding dimension in the right dimension text list is selected. When you click on a dimension in the right dimension text list, the corresponding dimension in the left drawing is selected.
[0017] Furthermore, the dimension text list supports classification and sorting according to dimension categories.
[0018] In a second aspect, the present invention provides a CAD inspection dimension viewing device, comprising:
[0019] The dimension extraction unit is used to open the CAD drawing, load all the graphic elements in the drawing, and store them in the graphic element collection;
[0020] A text dimension filtering and creation unit is used to traverse each entity object in the graphic element collection, and for an entity object whose name contains "Dimension", create a text dimension entity object;
[0021] Size classification unit, used to match size description text using regular expressions to obtain size category information;
[0022] List display unit, used to add text dimension entity objects with dimension categories added to the dimension text list, and display them together with CAD drawings in the software interface;
[0023] And a dimension positioning unit is used to obtain the ObjectId value in the text dimension when the user selects one, multiple or a type of text dimensions in the dimension text list, traverse the graphic elements corresponding to the selected ObjectId value in the CAD drawing and locate them; select the located graphic elements in the CAD drawing.
[0024] In a third aspect, the present invention provides a computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein the computer program / instruction, when executed by the processor, implements the steps of a CAD inspection dimension viewing method.
[0025] In a fourth aspect, the present invention provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, implements the steps of the CAD inspection dimension viewing method.
[0026] Beneficial effects: Compared with the prior art, the present invention has the following beneficial effects:
[0027] 1. Through the size classification of the present invention, the same size can be inspected at one time with one inspection tool, avoiding the need to constantly change the inspection tool in the middle, thereby improving the inspection efficiency.
[0028] 2. The present invention facilitates the retrieval of the location and value of the dimension through the function of mutual positioning of the graphic dimension and the text dimension, thereby improving the inspection efficiency.
[0029] 3. The present invention extracts all dimensions in the CAD drawing and manages them in the form of a list, effectively avoiding omissions. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 This is a sample CAD drawing.
[0031] Figure 2 The figure is a schematic diagram of a method flow of an embodiment of the present invention.
[0032] Figure 3 This is a class structure design diagram in an embodiment of the present invention.
[0033] Figure 4 This is an example diagram of the system interface in an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings and specific embodiments.
[0035] The technical solution of the present invention is further described below in conjunction with the accompanying drawings.
[0036] The present invention combines the data structure of CAD drawings and the secondary development capability provided by the CAD system to identify and extract dimension data, convert it into textual expression, and classify and manage the textual dimensions, mainly realizing the following functions: 1) Identify dimension graphic elements through the secondary development interface provided by the CAD system, and convert the graphic elements into text dimension structures through regular expressions; 2) Classify text dimensions of the same type, so that dimensions of the same type can be inspected with one inspection tool, thereby improving inspection efficiency. 3) Graphic dimensions and text dimensions can be positioned relative to each other, and the selected graphic dimension can automatically correspond to the text dimension, and the selected text dimension can automatically correspond to the graphic dimension, so as to facilitate the positioning of the inspection dimension in the drawing.
[0037] like Figure 2 As shown, a CAD inspection dimension viewing method disclosed in an embodiment of the present invention mainly includes the following steps:
[0038] Step 1, open the CAD drawing, load all the graphic elements in the drawing, and store them in the graphic element collection.
[0039] Step 2, traverse each entity object in the graphic element collection, create a text dimension entity object for the entity object whose name contains "Dimension", and use a regular expression to match the dimension description text to obtain the dimension category information.
[0040] Step 3, add the text dimension entity object with the dimension category added to the dimension text list, and display it together with the CAD drawing in the software interface;
[0041] Step 4, when the user selects one, multiple or a type of text dimensions in the dimension text list, obtain the ObjectId value in the text dimension, traverse the graphic elements corresponding to the selected ObjectId value in the CAD drawing and locate them.
[0042] Step 5. Select the located graphic element in the CAD drawing.
[0043] Figure 3An example of a class structure design to implement the above method is given. Among them, DimensionRetriever is a dimension extraction tool class, which is responsible for opening CAD drawings and loading all graphic elements in the drawings. Database is a collection of all graphic elements (Entity) in the drawings. Each Entity corresponds to an ObjectId, which contains the unique identifier, category, coordinates, graphic data, etc. of each graphic element. DimensionEntity is a text dimension class, which is converted from the graphic dimension class Entity. DimensionEntity has an attribute to record the id value in the graphic dimension. If Entity.id.type == 'Dimension', it is a dimension element. DimensionEntity has three subclasses: LengthEntity (processing dimension class), xwgcEntity (geometric tolerance class), and czdEntity (roughness class).
[0044] The following are examples of properties of the text size class:
[0045] public class DimensionEntity:IComparable <dimensionentity>
[0046] {
[0047] static public double s_x_min,s_y_max;
[0048] public ObjectId id;
[0049] public string handle; / / entity identifier
[0050] public string dig_handle; / / digital label identifier
[0051] public double x,y,z; / / Coordinates of digital labels
[0052] public int sn; / / sequential value of digital label
[0053] public string std_val; / / standard value
[0054] public string low_val; / / lower deviation
[0055] public string up_val; / / upper deviation
[0056] public string group_num; / / Number of the same size 3×Ra1.6=3
[0057] public string dimsuffix; / / dimension prefix, such as φ, Ra, etc.
[0058] public string dim_type; / / size category
[0059] public bool selected; / / Selected
[0060] public string device; / / device
[0061] public string desc; / / Remarks
[0062] public int txtHeight; / / word height
[0063] public bool no_empty; / / Not empty, required
[0064] public bool use_default = false; / / use default tolerance
[0065] public double prepareHour=0.0;
[0066] public double testHour=0.0;
[0067] public string viewport; / / view, xlsx
[0068] }
[0069] DimensionFilter is a class that identifies the dimension class of Entity one by one and distinguishes the dimension class. It distinguishes the dimension class based on the graphic data contained in the graphic dimension Entity according to the rules of regular expressions. The recognition logic code example is as follows:
[0070] Foreach(var v in Database.CurrentSpaceId)
[0071] {
[0072] Entity ent=v.GetObject()as Entity;
[0073] string entname=ent.GetType().Name;
[0074] if(entname.Contains("Dimension")) / / It is a size element
[0075] {
[0076] DimensionEntity dent=null;
[0077] String str=ent.DimensionText;
[0078] if(Regex.IsMatch(str,@"^R<>")) / / radius size
[0079] {
[0080] dent=new lengthEntity(ent,str);
[0081] if(Regex.IsMatch(str,@"^[+-]?\d*[.]?\d*$")) / / Size with upper and lower deviations
[0082] {
[0083] / / Here we decompose the upper and lower deviations from str and assign the values to the upper and lower deviation attributes of dent
[0084] }
[0085] }
[0086] Else if(Regex.IsMatch(str,@"^%%C<>")) / / Diameter size
[0087] {
[0088] …… / / Omitted here
[0089] }
[0090] …… / / Other sizes have their own string characteristics, which are omitted here
[0091] }
[0092] }
[0093] The regular expressions corresponding to various sizes can be used to extract specific values by analyzing the conventional expressions of sizes, so we will not go into details here.
[0094] The mutual positioning function of graphic size and text size is implemented as follows:
[0095] In the drawing, there are dimension object (Entity) lists and text dimension (DimensionEntity) lists. Both Entity and DimensionEntity contain the same ObjectId value. When you click on a dimension entity in the drawing, the corresponding text dimension in the dimension text list can be automatically selected. The code example is as follows:
[0096] for(int jj=0; jj <dimsize_list.Rows.Count;jj++)
[0097] {
[0098] dimsize_list.Rows[jj].Selected=false;
[0099] DimensionEntity de=dimsize_list.Rows[jj].Cells[0].Value asDimensionEntity;
[0100] if(de.Objectid==Database.Selected.ObjectId) / / When the ID of the selected element in the current drawing is the same as the ID of the object in the size list
[0101] {
[0102] dimsize_list.Rows[jj].Selected=true;
[0103] }
[0104] }
[0105] If you select the DimensionEntity object in the dimension text list, you can use this object to locate the dimension object in the drawing. The sample code is as follows:
[0106] ObjectId id;
[0107] if(Database.TryGetObjectId(de.ObjectId,out id)&&!id.IsErased) / / de, text size object
[0108] {
[0109] DBObject db=id.GetObject(OpenMode.ForWrite);
[0110] Entity ent=db as Entity;
[0111] if (ent!=null)
[0112] {
[0113] ent.Highlight();
[0114] }
[0115] }
[0116] A CAD inspection dimension viewing device disclosed in an embodiment of the present invention includes: a dimension extraction unit, which is used to open a CAD drawing, load all graphic elements in the drawing, and store them in a graphic element set; a text dimension filtering and creation unit, which is used to traverse each entity object in the graphic element set, and create a text dimension entity object for an entity object whose name contains "Dimension"; a dimension classification unit, which is used to match dimension description texts using regular expressions to obtain dimension category information; a list display unit, which is used to add text dimension entity objects with dimension categories added to a dimension text list, and display them together with the CAD drawing in a software interface; and a dimension positioning unit, which is used to obtain an ObjectId value in the text dimension when a user selects one, more than one or a class of text dimensions in the dimension text list, traverse and locate the graphic elements corresponding to the selected ObjectId value in the CAD drawing; and select the located graphic element in the CAD drawing.
[0117] Figure 4 The main interface of the CAD inspection dimension viewing device is shown in the example. The left side of the interface is used to display drawings, and the right side is used to display dimension text lists. Select a local drawing or a drawing in the network system, extract the dimensions, and the device will list all the dimensions in the drawing, classify the dimension types, and number the dimensions. Clicking on the dimension in the drawing on the left will locate the corresponding dimension on the right, and clicking on the dimension on the right will point to the dimension in the drawing on the left.
[0118] An embodiment of the present invention also discloses a computer system, including a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein the steps of the CAD inspection dimension viewing method are implemented when the computer program / instruction is executed by the processor.
[0119] The embodiment of the present invention also discloses a computer program product, including a computer program / instruction, which implements the steps of the CAD inspection dimension viewing method when the computer program / instruction is executed by a processor. The details not described in detail in the present invention are all well-known technologies of those skilled in the art.< / dimensionentity>
Claims
1. A CAD inspection dimension viewing method, characterized in that: The steps include: Open the CAD drawing, load all the graphic elements in the drawing, and store them in the graphic element collection; Traverse each entity object in the graphic element collection, create a text dimension entity object for the entity object whose name contains "Dimension", and use a regular expression to match the dimension description text to obtain the dimension category information; Add the text dimension entity objects with dimension categories to the dimension text list and display them together with the CAD drawings in the software interface; When the user selects one, multiple or a type of text dimensions in the dimension text list, the ObjectId value in the text dimension is obtained, and the graphic elements corresponding to the selected ObjectId value are traversed and located in the CAD drawing; Select the graphic element to be positioned in the CAD drawing.
2. A CAD inspection dimension viewing method according to claim 1, characterized in that: Dimension categories include length, radius, diameter, depth, run-out, perpendicularity, coaxiality, symmetry, parallelism and roughness; the same dimensions can be inspected using one inspection tool.
3. A CAD inspection dimension viewing method according to claim 1, characterized in that: Each entity object corresponds to an ObjectId, which contains the unique identifier, category, coordinates and graphic data of the graphic element.
4. A CAD inspection dimension viewing method according to claim 1, characterized in that: Each text dimension entity object is converted from a physical object. The text dimension entity class has three subclasses: processing dimension class, geometric tolerance class, and roughness class.
5. A CAD inspection dimension viewing method according to claim 1, characterized in that: The CAD drawings are local drawings or drawings in a network system.
6. A CAD inspection dimension viewing method according to claim 1, characterized in that: The CAD drawing is displayed on the left side of the software interface, and the dimension text list is displayed on the right side. When you click on a dimension in the drawing on the left, the corresponding dimension in the dimension text list on the right is selected. Click on a dimension in the dimension text list on the right to select the corresponding dimension in the drawing on the left.
7. A CAD inspection dimension viewing method according to claim 1, characterized in that: The dimension text list supports classification and sorting by dimension category.
8. A CAD inspection dimension viewing device, characterized in that: include: The dimension extraction unit is used to open the CAD drawing, load all the graphic elements in the drawing, and store them in the graphic element collection; The text dimension filtering and creation unit is used to traverse each entity object in the graphic element collection, and create a text dimension entity object for the entity object whose name contains "Dimension"; Size classification unit, used to match size description text using regular expressions to obtain size category information; List display unit, used to add text dimension entity objects with dimension categories added to the dimension text list, and display them together with CAD drawings in the software interface; And a dimension positioning unit is used to obtain the ObjectId value in the text dimension when the user selects one, multiple or a type of text dimensions in the dimension text list, traverse the graphic elements corresponding to the selected ObjectId value in the CAD drawing and locate them; select the located graphic elements in the CAD drawing.
9. A computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, characterized in that: When the computer program / instructions are executed by a processor, the steps of a CAD inspection dimension viewing method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of a CAD inspection dimension viewing method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Method for automatic categorisation of drawing data
RU2856757C1