CN108846398A - CAD knows drawing method and device - Google Patents

CAD knows drawing method and device Download PDF

Info

Publication number
CN108846398A
CN108846398A CN201810674049.3A CN201810674049A CN108846398A CN 108846398 A CN108846398 A CN 108846398A CN 201810674049 A CN201810674049 A CN 201810674049A CN 108846398 A CN108846398 A CN 108846398A
Authority
CN
China
Prior art keywords
lines
text
notch
bin
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810674049.3A
Other languages
Chinese (zh)
Other versions
CN108846398B (en
Inventor
付浩伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Tiangong Matrix Information Technology Co Ltd
Original Assignee
Beijing Tiangong Matrix Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Tiangong Matrix Information Technology Co Ltd filed Critical Beijing Tiangong Matrix Information Technology Co Ltd
Priority to CN201810674049.3A priority Critical patent/CN108846398B/en
Publication of CN108846398A publication Critical patent/CN108846398A/en
Application granted granted Critical
Publication of CN108846398B publication Critical patent/CN108846398B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds

Abstract

The present invention provides a kind of CAD to know drawing method and device, wherein this method includes:After the file for receiving CAD, the lines in file are screened and corrected first;There are the lines of cross reference to be divided into a sub-regions lines frame;According to preset bin feature, is identified from subregion and isolate bin;According to preset notch feature, effective notch and the corresponding circuit of effective notch are identified from bin;According to preset list library and words direction, the text in file is screened, element text is obtained;The element text in effective notch setting range is searched, according to the merging rule of setting, the element text found is merged;According to preset case number (CN) feature, the case number (CN) of bin is searched and identified in the bin frame setting range apart from bin;Finally recognition result is exported according to specified format.The present invention can be with information such as bin, elements in automatic identification cad file, and it is convenient to operate, and recognition efficiency is high.

Description

CAD knows drawing method and device
Technical field
The present invention relates to engineering drawing technique fields, know drawing method and device more particularly, to a kind of CAD.
Background technique
In the prior art, what user needed manually implemented cad file takes off figure, and rule of thumb the presence or absence of judgment component, is obtained The component specification in drawing is taken, is finally manually entered into excel table, operating process is cumbersome.Even if there is partial software can be with It helps user to realize and takes off figure, but still user is needed to manually select the element of " real ", operating process is still cumbersome, especially exists There are figure process time-consuming when a large amount of bin, is taken off too long in one quotation file, working efficiency is greatly reduced.
Summary of the invention
In view of this, the purpose of the present invention is to provide a kind of CAD to know drawing method and device, to improve the effect of CAD knowledge figure Rate.
In a first aspect, the embodiment of the invention provides a kind of CAD to know drawing method, method includes:Receive the file of CAD Afterwards, according to the average word height of the page in file and preset line orientations, the lines in file are screened and is corrected;It will be each In a lines, there are lines frame the lines of cross reference to be divided into a sub-regions;Wherein, belonging to one or more subregions Figure frame be limb region;According to preset bin feature, is identified from subregion and isolate bin;
According to preset notch feature, effective notch and the corresponding circuit of effective notch are identified from bin;According to default List library and words direction, screen file in text, obtain element text;List library includes that element white list, element are black List and particular element list;The element text in effective notch setting range is searched, it is right according to the merging rule of setting The element text found merges;According to preset case number (CN) feature, looked into the bin frame setting range apart from bin Look for and identify the case number (CN) of bin;Recognition result is exported according to specified format.
Further, the above-mentioned average word height according to the page in file and preset line orientations, to the lines in file The step of being screened and being corrected, including:The average word for obtaining the page in file is high, deletes in the lines in file, lines are long The degree lines high less than the average word of specified multiple;It deletes in the lines in file, line orientations are beyond predetermined angle range Lines;Correction process is carried out to remaining lines, so that the direction of remaining lines is horizontal direction or vertical direction.
Further, above-mentioned by each lines, there are lines frame the lines of cross reference to be divided into a sub-regions The step of, including:According to the length of lines, all lines are traversed;Using the frame of first lines as front bezel is worked as, judge The frame of next lines whether with intersect when front bezel;If so, generating new frame, is contained in new frame and work as front The frame of frame and next lines;
Using new frame as front bezel is worked as, continue to execute judge next lines frame whether with mutually hand over when front bezel The step of fork, until traversing to the last one lines, frame of the obtained new frame as subregion.
Further, above-mentioned preset bin feature includes at least one of the following:There are backbones in subregion;Subregion Chinese number of words is greater than preset text threshold value, and lines quantity is greater than preset lines threshold value;There are at least one frame lines; Method further includes:If there are bins in subregion, subregion is updated to limb region, using bin as new subregion.
Further, above-mentioned CAD knowledge drawing method further includes:If subregion is located in figure frame, figure frame is made For the limb region of subregion;If subregion is not in figure frame, by subregion setting in specified drawing.
Further, above-mentioned according to preset notch feature, identify that effective notch and effective notch are corresponding from bin The step of circuit includes:The lines being located in specified range are determined as lines group;The direction phase of each lines in each lines group Together;
If the gap of adjacent lines meets preset length range in lines group, gap is determined as notch object;Sentence Whether breakthrough mouth object is effective;If so, the corresponding lines group of effective notch is determined as using notch object as effective notch Circuit;Notch object includes horizontal cut and longitudinal breach.
Further, the first regular expression comprising the first specified word is provided in said elements white list;Element The second regular expression comprising the second specified word is provided in blacklist;It is provided in particular element list and refers to comprising third Determine the third regular expression of text;Third specified word includes phase sequence, power flag, electric current label, equipment code name, circuit generation Number, it is a variety of in cable pipeline code name, distribution box, bin model, bin sizes;
According to preset list library and words direction, the step of screening the text in file, obtain element text, including: Text in file is matched with the first regular expression, component file will be determined as by matched text;By file In text matched with the second regular expression, delete matched text;By the component file matched and third canonical Expression formula is matched, the type of recognition component text.
Further, the step of element text of the above-mentioned lookup in effective notch setting range, including:If effectively In the top setting range of notch there are element texts, component file is determined as to the major component of effective notch;If effectively Element text is not present in the top setting range of notch, the element text in the lower section setting range of effective notch is determined For the major component of effective notch;The merging rule of setting includes:
If major component is located at the top of effective notch, and there are other texts between major component and effective notch, by it His text and major component are saved into the merging list of effective notch;If major component is located at the top of effective notch, and pivot Other texts are not present between part and effective notch, search the text between effective notch and the adjacent gap of effective bottom of the gap This;If the amount of text effectively between notch and adjacent gap is greater than setting amount threshold, according to preset order by not element The text and major component of text are saved into the merging list of effective notch.
Further, above-mentioned preset case number (CN) feature includes subcharacter and the corresponding weight of subcharacter;Subcharacter includes number There is horizontal line, a variety of in character position under word, English, connector, white list, blacklist, character length, character.
Second aspect, the embodiment of the invention provides a kind of CAD to know map device, and device includes:Lines processing module, is used for After the file for receiving CAD, according to the average word height of the page in file and preset line orientations, to the lines in file It is screened and is corrected;Region division module, for by each lines, to there are lines frame the lines of cross reference to be divided into One sub-regions;
Bin separation module, for being identified from subregion and isolating bin according to preset bin feature;Notch returns Road identification module, for identifying effective notch and the corresponding circuit of effective notch from bin according to preset notch feature;Text This screening module, for screening the text in file, obtaining element text according to preset list library and words direction;List Library includes element white list, element blacklist and particular element list;
Element text merging module, for according to searching element text in effective notch setting range, according to setting Fixed merging rule, merges the element text found;Case number (CN) identification module is used for according to preset case number (CN) feature, The case number (CN) of bin is searched and identified in the bin frame setting range apart from bin;Result return module, for according to specified Format export recognition result.
The embodiment of the present invention brings following beneficial effect:
The present invention provides a kind of CAD knowledge drawing method and device, after the file for receiving CAD, first to the line in file Item is screened and is corrected;There are the lines of cross reference to be divided into a sub-regions lines frame;According to preset bin Feature identifies from subregion and isolates bin;According to preset notch feature, effective notch and effectively is identified from bin The corresponding circuit of notch;According to preset list library and words direction, the text in file is screened, element text is obtained;It searches Element text in effective notch setting range closes the element text found according to the merging rule of setting And;According to preset case number (CN) feature, the case number (CN) of bin is searched and identified in the bin frame setting range apart from bin;Finally Recognition result is exported according to specified format.The present invention can be with the information such as bin, element in automatic identification cad file, operation Convenient, recognition efficiency is high.Which can be with bin, the element etc. in automatic identification cad file, and it is convenient to operate, and recognition efficiency is high.
Other features and advantages of the present invention will illustrate in the following description, alternatively, Partial Feature and advantage can be with Deduce from specification or unambiguously determine, or by implementing above-mentioned technology of the invention it can be learnt that.
To enable the above objects, features and advantages of the present invention to be clearer and more comprehensible, better embodiment is cited below particularly, and match Appended attached drawing is closed, is described in detail below.
Detailed description of the invention
It, below will be to specific in order to illustrate more clearly of the specific embodiment of the invention or technical solution in the prior art Embodiment or attached drawing needed to be used in the description of the prior art be briefly described, it should be apparent that, it is described below Attached drawing is some embodiments of the present invention, for those of ordinary skill in the art, before not making the creative labor It puts, is also possible to obtain other drawings based on these drawings.
Fig. 1 is the flow chart that a kind of CAD provided in an embodiment of the present invention knows drawing method;
Fig. 2 is a kind of refrigerator structure schematic diagram provided in an embodiment of the present invention;
Fig. 3 is the flow chart that another kind CAD provided in an embodiment of the present invention knows drawing method;
Fig. 4 is the flow chart that another kind CAD provided in an embodiment of the present invention knows drawing method;
Fig. 5 is the flow chart that another kind CAD provided in an embodiment of the present invention knows drawing method;
Fig. 6 is the flow chart that another kind CAD provided in an embodiment of the present invention knows drawing method;
Fig. 7 is the flow chart that another kind CAD provided in an embodiment of the present invention knows drawing method;
Fig. 8 is the structural schematic diagram that a kind of CAD provided in an embodiment of the present invention knows map device.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with attached drawing to the present invention Technical solution be clearly and completely described, it is clear that described embodiments are some of the embodiments of the present invention, rather than Whole embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art are not making creative work premise Under every other embodiment obtained, shall fall within the protection scope of the present invention.
In view of existing CAD knows drawing method, need the element inside user's manual identification CAD diagram paper, it is cumbersome and Low efficiency.The embodiment of the invention provides a kind of CAD to know drawing method and device, which can be applied to the drawing identification of CAD In, which can use relevant software or hardware realization, be described below by embodiment.
A kind of CAD shown in Figure 1 knows the flow chart of drawing method;This method comprises the following steps:
Step S102, after the file for receiving CAD, according to the average word height of the page in file and preset line orientations, Lines in file are screened and corrected;
The cad file can be the drawing of dwg or dxf format preservation, text text in a height of page of average word of the page The difference of this frame upper right point and lower-left point Y axis coordinate value.
Step S104, by each lines, there are lines frame the lines of cross reference to be divided into a sub-regions;Its In, figure frame belonging to one or more subregions is limb region;
During CAD knows figure, tree structure data is established, current file is root zone domain;One or more sub-districts Figure frame belonging to domain is limb region;Each sub-regions are leaf region.
Step S106 is identified from subregion according to preset bin feature and is isolated bin;The structure of bin is as schemed Multiple notches are set shown in 2, in bin, notch and circuit are respectively positioned on the right side of bin, and notch and circuit connect one by one, in figure with Notch is illustrated for being connected with each other with circuit.
Step S108 identifies effective notch and the corresponding circuit of effective notch according to preset notch feature from bin;
Step S110 screens the text in file, obtains element text according to preset list library and words direction;It should List library includes element white list, element blacklist and particular element list;
Step S112 searches element text in effective notch setting range, according to the merging rule of setting, to looking into The element text found merges;
Step S114 is searched and is identified in the bin frame setting range apart from bin according to preset case number (CN) feature The case number (CN) of bin;
Step S116 exports recognition result according to specified format;The specified format can be that the form of table can also Think the form of list, which realizes the Fast Quotation of element convenient for user.
The present invention provides a kind of CAD knowledge drawing method, after the file for receiving CAD, the lines in file are carried out first Screening and correction;There are the lines of cross reference to be divided into a sub-regions lines frame;According to preset bin feature, from It is identified in subregion and isolates bin;According to preset notch feature, effective notch and effective notch pair are identified from bin The circuit answered;According to preset list library and words direction, the text in file is screened, element text is obtained;Searching distance has The element text in notch setting range is imitated, according to the merging rule of setting, the element text found is merged;According to Preset case number (CN) feature searches and identifies the case number (CN) of bin in the bin frame setting range apart from bin;Finally according to finger Fixed format exports recognition result.The present invention can be with information such as bin, elements in automatic identification cad file, and it is convenient to operate, and knows It is not high-efficient.
Another CAD shown in Figure 3 knows the flow chart of drawing method;On the basis of this method is method shown in Fig. 1 It realizes, this method comprises the following steps:
Step S302, after receiving cad file, the average word for obtaining the page in file is high, deletes in the lines in file, The line length lines high less than the average word of specified multiple;
Step S304 is deleted in the lines in file, and line orientations exceed the lines of predetermined angle range;The line orientations It can be horizontal or vertical direction, for horizontal direction, predetermined angle range is less than 5 ° or greater than 175 °;For vertical side To predetermined angle range is greater than 85 ° and less than 95 °.The angle of the lines can be directly according to above-mentioned in the range of 180 ° Condition is determined;If the angle of the lines is greater than 180 °, the angular range of the angle and 180 ° of differences according to lines is needed Carry out the judgement in direction.
For example, the angle of lines A is 182 ° (being greater than 180 °), the angular range of the angle of lines A and 180 ° of differences is 2 ° (less than 5 °), in the horizontal direction in preset angular range, therefore lines A is the lines of horizontal direction;The angle of lines B is 270 ° (being greater than 180 °), the angular range of the angle of lines B and 180 ° of differences is 90 ° (being greater than 85 ° and less than 95 °), vertical In the preset angular range in direction, therefore lines B is the lines of vertical direction.
Step S306 carries out correction process to remaining lines, so that the direction of remaining lines is horizontal direction or vertical side To;
After lines are corrected, Y axis coordinate of the average value of lines two-end-point Y axis coordinate value as horizontal direction lines Value;X axis coordinate value of the average value of lines two-end-point X axis coordinate value as vertical direction lines.
For example, the two-end-point of the lines A of horizontal direction is respectively a1 and a2, wherein the Y axis coordinate value of a1 is 10cm, a2's Y axis coordinate value is 20cm, then the Y axis coordinate value of lines A is then the average value 15cm of 10cm and 20cm;The lines of vertical direction The two-end-point of B is respectively b1 and b2, and wherein the X axis coordinate value of b1 is 4cm, and the X axis coordinate value of b2 is 8cm, then the X of lines B Axial coordinate value is then the average value 6cm of 4cm and 8cm.
Step S308, by each lines, there are lines frame the lines of cross reference to be divided into a sub-regions;
Step S310 is identified from subregion according to preset bin feature and is isolated bin;
Step S312 identifies effective notch and the corresponding circuit of effective notch according to preset notch feature from bin;
Step S314 screens the text in file, obtains element text according to preset list library and words direction;It should List library includes element white list, element blacklist and particular element list;
Step S316 searches element text in effective notch setting range, according to the merging rule of setting, to looking into The element text found merges;
Step S318 is searched and is identified in the bin frame setting range apart from bin according to preset case number (CN) feature The case number (CN) of bin;
Step S320 exports recognition result according to specified format.
Average word height and preset line orientations of the aforesaid way according to the page in file, sieve the lines in file Choosing and correction, preferably to identify CAD diagram, which operation is convenient, and recognition efficiency is high.
Another CAD shown in Figure 4 knows the flow chart of drawing method;On the basis of this method is method shown in Fig. 1 It realizes, specific step is as follows:
Step S402, after the file for receiving CAD, according to the average word height of the page in file and preset line orientations, Lines in file are screened and corrected;
Step S404 traverses all lines according to the length of lines;
Step S406, using the frame of first lines as working as front bezel;The frame of the lines is just to play lines frame The rectangular shaped rim come, the lines can be used as a diagonal line in rectangular shaped rim;
Step S408, judge next lines frame whether with when front bezel intersects;If so, executing step S410;If not, new frame will be named as when front bezel, step S412 is executed.
Step S410 generates new frame, and the frame when front bezel and next lines is contained in the new frame;
Step S412 judges whether to traverse the last one lines;If so, executing step 414;If not, executing step Rapid 408;
Above-mentioned new frame C and the relationship for intersecting frame A and B are as follows:
If that there are partial intersections is overlapping by frame A and frame B, new frame C is formed after the polymerization of two frames, new frame C is not only It further include other marginal portions comprising frame A and B;Frame C or side if frame B can completely include frame A, after polymerization Frame B;If frame B and frame A are not above two relationships, and there are the intersection of frame, shape after frame A polymerize with frame B At new frame C can just include A and two frames of B rectangle.
Step S414, using obtained new frame as the frame of subregion;Wherein, figure belonging to one or more subregions Shape frame is limb region;
If subregion is located in figure frame, using figure frame as the limb region of subregion;If subregion is not In figure frame, by subregion setting in specified drawing.
Step S416 is identified from subregion according to preset bin feature and is isolated bin;
Above-mentioned preset bin feature includes at least one of the following:
(1) there are backbones in subregion;(2) subregion Chinese number of words is greater than preset text threshold value, and number of lines Amount is greater than preset lines threshold value;(3) there are at least one frame lines;Wherein, preset text threshold value can be set to 3, in advance If lines threshold value can be set to 4.
The above method further includes:If there are bins in subregion, subregion is updated to limb region, using bin as New subregion.
Being ranked up subregion according to size and successively traversing is needed in the identification process of bin, according to upper The feature stated judges bin, and if there is multiple bins, then by Region Decomposition, a bin is placed on one individually In drawing, for knowing the quotation of figure and element.
Step S418 identifies effective notch and the corresponding circuit of effective notch according to preset notch feature from bin;
Step S420 screens the text in file, obtains element text according to preset list library and words direction;Name Single library includes element white list, element blacklist and particular element list;
Step S422 searches element text in effective notch setting range, according to the merging rule of setting, to looking into The element text found merges;
Step S424 is searched and is identified in the bin frame setting range apart from bin according to preset case number (CN) feature The case number (CN) of bin;
Step S426 exports recognition result according to specified format.
Aforesaid way is by each lines, and there are lines frame the lines intersected to be divided into a sub-regions, so as to more preferable Ground identifies bin, helps preferably to identify CAD diagram, which operation is convenient, and recognition efficiency is high.
Another CAD shown in Figure 5 knows the flow chart of drawing method;On the basis of this method is method shown in Fig. 1 It realizes, specific step is as follows:
Step S502, after the file for receiving CAD, according to the average word height of the page in file and preset line orientations, Lines in file are screened and corrected;
Step S504, by each lines, there are lines frame the lines of cross reference to be divided into a sub-regions;
Step S506 is identified from subregion according to preset bin feature and is isolated bin;
The lines being located in specified range are determined as lines group by step S508;The direction of each lines in each lines group It is identical;
Step S510 judges whether the gap of adjacent lines in lines group is notch object;If not, executing step S512;If so, executing step S514;
Step S512, gap are not notch objects, and gap is discarded;
Step S514, the gap of adjacent lines meets preset length range in lines group, and gap is determined as notch pair As;
Step S516 judges whether the notch object is effective;If not, executing step S518;If so, executing step S520;
Step S518, notch object are then invalid notch, and invalid notch is discarded;
The corresponding lines group of effective notch is determined as circuit using notch object as effective notch by step S520;This is lacked Mouth object includes horizontal cut and longitudinal breach.
All regions for being marked as leaf in cad file are traversed, all lines in region are obtained, with the line of horizontal direction It is illustrated for item, for the lines of horizontal direction, in some specified range (coordinate of the Y-axis of lines two-end-point Be worth in the error range set) in by the line markings of vertical direction be lines foundation lines side in same group, same group The coordinate value of frame lower-left point X-axis is successively ranked up from left to right, successively judges next line of current line and current line The gap that whether there is designated length range between item, and if so, being determined as notch object, if there is no then by gap It discards, wherein the direction of notch is consistent with the direction of same group of lines, including horizontal cut and longitudinal breach.
The notch object of above-mentioned judgement is traversed, is judged that effective notch can be retained and stick notch type mark Label, and participate in the merging of element text;Notch through being judged as invalid will be designated to abandon reason and be not involved in element text Merge.
Step S522 screens the text in file, obtains element text according to preset list library and words direction;Name Single library includes element white list, element blacklist and particular element list;
Step S524 searches element text in effective notch setting range, according to the merging rule of setting, to looking into The element text found merges;
Step S526 is searched and is identified in the bin frame setting range apart from bin according to preset case number (CN) feature The case number (CN) of bin;
Step S528 exports recognition result according to specified format.
Aforesaid way identifies effective notch and the corresponding circuit of effective notch, from bin according to notch feature so as to more CAD diagram is identified well, and which operation is convenient, and recognition efficiency is high.
Another CAD shown in Figure 6 knows the flow chart of drawing method;On the basis of this method is method shown in Fig. 1 It realizes, according to preset list library and words direction, screens the text in file, obtain element text, list library includes member Part white list, element blacklist and particular element list.
In the present embodiment, the first regular expression comprising the first specified word is provided in said elements white list;Member The second regular expression comprising the second specified word is provided in part blacklist;It is provided in particular element list comprising third The third regular expression of specified word;Third specified word includes phase sequence, power flag, electric current label, equipment code name, circuit It is code name, cable pipeline code name, distribution box, bin model, a variety of in bin sizes;Specific step is as follows:
Step S602, after the file for receiving CAD, according to the average word height of the page in file and preset line orientations, Lines in file are screened and corrected;
Step S604, by each lines, there are lines frame the lines of cross reference to be divided into a sub-regions;
Step S606 is identified from subregion according to preset bin feature and is isolated bin;
Step S608 identifies effective notch and the corresponding circuit of effective notch according to preset notch feature from bin;
Step S610 matches the text in file with the first regular expression, will be determined by matched text For component file;It is marked as element by the Chinese matched text of element canonical, is greater than 3 if pass through and Chinese character quantity Text be not considered as element.
Text in file is matched with the second regular expression, deletes matched text by step S612;
Step S614 matches the component file matched with third regular expression, the class of recognition component text Type.
The text angular range of horizontal direction:0°-45°,135°-225°,315°-360°;The text angle of vertical direction Range:45°-135°,225°-315°;Text not in above-mentioned angular range is deleted.
Step S616 searches element text in effective notch setting range, according to the merging rule of setting, to looking into The element text found merges;
Step S618 is searched and is identified in the bin frame setting range apart from bin according to preset case number (CN) feature The case number (CN) of bin;
Step S620 exports recognition result according to specified format.
It is above-mentioned according to preset list library and words direction, screen the text in file, element text obtained, so as to more preferable Ground identifies CAD diagram, and which operation is convenient, and recognition efficiency is high.
Another CAD shown in Figure 7 knows the flow chart of drawing method;On the basis of this method is method shown in Fig. 1 It realizes.Specific step is as follows:
Step S702, after the file for receiving CAD, according to the average word height of the page in file and preset line orientations, Lines in file are screened and corrected;
Step S704, by each lines, there are lines frame the lines of cross reference to be divided into a sub-regions;
Step S706 is identified from subregion according to preset bin feature and is isolated bin;
Step S708 identifies effective notch and the corresponding circuit of effective notch according to preset notch feature from bin;
Step S710 screens the text in file, obtains element text according to preset list library and words direction;Name Single library includes element white list, element blacklist and particular element list;
Component file is determined as having by step S712 if there are element texts in the top setting range of effectively notch Imitate the major component of notch;
Step S714, if element text is not present in the top setting range of effectively notch, by the lower section of effective notch Element text in setting range is determined as the major component of effective notch;
Since the element text object being merged should be in the range of effective notch, it is therefore desirable to traverse having in bin Imitate notch, search the corresponding major component of effective notch, the top setting range of effective notch x is 5cm, within this range by close and Element is successively far traversed, element is then determined as major component if there is element;If in the top setting range of effective notch x It is interior that element is not present, then the text in setting range is found, the top text of setting range is determined as major component;If there is It imitates and element text is not present in the top setting range of notch x, found in the lower section of effective notch nearest apart from effective notch x Element text is as major component, if element is to find that merging judgement will not be done in effective bottom of the gap.
Step S716 merges the element text found according to the merging rule of setting;The merging of the setting is advised Then include:
If major component is located at the top of effective notch, and there are other texts between major component and effective notch, by it His text and major component are saved into the merging list of effective notch;
If major component is located at the top of effective notch, and is not present other texts between major component and effective notch, look into Look for the text between effective notch and the adjacent gap of effective bottom of the gap;
If the amount of text between effective notch and adjacent gap is greater than setting amount threshold, will be non-according to preset order The text and major component of element text are saved into the merging list of effective notch.
For example, if major component between the top of effective notch x, major component and effective notch x there are multiple texts, will These texts are put into and effective notch x is associated merges in list according to sequence from top to bottom;
If major component does not have other texts between the top of effective notch x, major component and effective notch x, then search Text between notch x and notch y, amount of text are greater than 2, these texts are put into according to sequence from top to bottom and are effectively lacked In mouthful associated the mergings list of x, if not finding notch y, then obtain the lower section notch x it is all be not element text, equally These texts are put into and effective notch x is associated merges in list according to sequence from top to bottom, during traversing text, Text and the identical text of preceding 3 letters of major component text or text identical with the text of element is encountered then to stop time It goes through;
If major component does not have other texts between the top of effective notch x, major component and effective notch x, then search Text between notch x and notch y, if the text between notch x and notch y without merging if only one.
Element text needs to be traversed for all areas when merging, the notch object in region is traversed, if existing object does not close Connection object then skips over, and does not do then and merges if 1, starts whether judgment component merges if more than 1.The text being merged should not be Element;The then nonjoinder identical as the text of major component of first three character of text;Set code name nonjoinder;It obtains and merges both sides not The character lists that can repeat are existed simultaneously if the text in list and are skipped over if merging in both sides.
It, will be without associated notch neither element is also not case number (CN), figure number, equipment code name when individual text filtering The text that object does not also merge with other texts discards.
Step S718 is searched and is identified in the bin frame setting range apart from bin according to preset case number (CN) feature The case number (CN) of bin;
Preset case number (CN) feature includes subcharacter and the corresponding weight of subcharacter;The subcharacter includes number, English, connection There is horizontal line, a variety of in character position under symbol, white list, blacklist, character length, character.
Expand the identification range of case number (CN) first:It is upward according to the identification range of bin, left, lower to expand certain model respectively It encloses, it is assumed that both the average word that the range of expansion is 4 times is high, intersects if existing with other bin boundaries, and the range of expansion takes The half of distance;Case number (CN) is not present in the range in circuit;Obtained using set decision rule may be case number (CN) text, by What it is labeled as element is not case number (CN), by it is matched be exactly that case number (CN) is alternative, judge that every numerical value of case number (CN) weight is as follows:
Number:+1;English:+2;Connector:+4;White list:+4;Blacklist:-5;Character length 2-15:+10;Character is long Degree is more than 15:+5;There is horizontal line under character:+5;There are identical score value, the leftmost side:+0.5;By weight calculation, weight is maximum Be case number (CN).The top is taken if bin does not have case number (CN) and is not the text of element as case number (CN);If it is empty van, case Without notch in cabinet;Effective line quantity is less than 2 in bin;Number of elements is 0 in bin.
Step S720 exports recognition result according to specified format.
Element text of the above-mentioned lookup in effective notch setting range, preferably to identify CAD diagram, which behaviour It is convenient to make, and recognition efficiency is high.
A kind of CAD shown in Figure 8 knows the structural schematic diagram of map device, which includes:
Lines processing module 80, after according to the file for receiving CAD, according to the average word height of the page in file and in advance If line orientations, the lines in file are screened and are corrected;
Region division module 81, for by each lines, to there are lines frame the lines of cross reference to be divided into one Subregion;
Bin separation module 82, for being identified from subregion and isolating bin according to preset bin feature;
Notch Circuit Searching module 83, for according to preset notch feature, identifying effective notch and effectively from bin The corresponding circuit of notch;
Text screening module 84, for screening the text in file, obtaining member according to preset list library and words direction Part text;List library includes element white list, element blacklist and particular element list;
Element text merging module 85, for according to searching element text in effective notch setting range, according to The merging rule of setting, merges the element text found;
Case number (CN) identification module 86 is used for according to preset case number (CN) feature, in the bin frame setting range apart from bin Search and identify the case number (CN) of bin;
Result return module 87, for exporting recognition result according to specified format.
The embodiment of the invention provides a kind of CAD to know map device, after which receives the file of CAD, first to file In lines screened and corrected;Then by each lines, there are lines frame the lines of cross reference to be divided into one Subregion;According to preset bin feature, is identified from subregion and isolate bin;According to preset notch feature, from case Effective notch and the corresponding circuit of effective notch are identified in cabinet;According to preset list library and words direction, screen in file Text obtains element text;The element text found is merged;According to preset case number (CN) feature, searches and identify case The case number (CN) of cabinet;Finally recognition result is exported according to specified format.The present invention can be with the bin in automatic identification cad file, member Part etc., it is convenient to operate, and recognition efficiency is high.
CAD provided in an embodiment of the present invention knows map device, and it is having the same to know drawing method with CAD provided by the above embodiment Technical characteristic reaches identical technical effect so also can solve identical technical problem.
CAD provided by the embodiment of the present invention knows the computer program product of drawing method and device, including stores program The computer readable storage medium of code, the instruction that said program code includes can be used for executing described in previous methods embodiment Method, specific implementation can be found in embodiment of the method, details are not described herein.
It, can be with if the function is realized in the form of SFU software functional unit and when sold or used as an independent product It is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other words The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meter Calculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be a People's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention. And storage medium above-mentioned includes:USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited The various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.
Finally it should be noted that:Embodiment described above, only a specific embodiment of the invention, to illustrate the present invention Technical solution, rather than its limitations, scope of protection of the present invention is not limited thereto, although with reference to the foregoing embodiments to this hair It is bright to be described in detail, those skilled in the art should understand that:Anyone skilled in the art In the technical scope disclosed by the present invention, it can still modify to technical solution documented by previous embodiment or can be light It is readily conceivable that variation or equivalent replacement of some of the technical features;And these modifications, variation or replacement, do not make The essence of corresponding technical solution is detached from the spirit and scope of technical solution of the embodiment of the present invention, should all cover in protection of the invention Within the scope of.Therefore, protection scope of the present invention should be subject to the protection scope in claims.

Claims (10)

1. a kind of CAD knows drawing method, which is characterized in that the method includes:
After the file for receiving CAD, according to the average word height of the page in the file and preset line orientations, to the file In lines screened and corrected;
By in each lines, there are lines frame the lines of cross reference to be divided into a sub-regions;Wherein, one or more Figure frame belonging to sub-regions is limb region;
According to preset bin feature, is identified from the subregion and isolate bin;
According to preset notch feature, effective notch and the corresponding circuit of effective notch are identified from the bin;
According to preset list library and words direction, the text in the file is screened, obtains element text;The list library packet Include element white list, element blacklist and particular element list;
The element text in effective notch setting range is searched, according to the merging rule of setting, to finding The element text merge;
According to preset case number (CN) feature, is searched in the bin frame setting range apart from the bin and identify the bin Case number (CN);
Recognition result is exported according to specified format.
2. the method according to claim 1, wherein the average word height according to the page in the file and pre- If line orientations, the step of the lines in the file are screened and are corrected, including:
The average word for obtaining the page in the file is high, deletes in the lines in the file, and line length is less than specified multiple The high lines of average word;
It deletes in the lines in the file, line orientations exceed the lines of predetermined angle range;
Correction process is carried out to remaining lines, so that the direction of the residue lines is horizontal direction or vertical direction.
3. lines frame has friendship the method according to claim 1, wherein described by each lines The step of lines of fork relationship are divided into a sub-regions, including:
According to the length of the lines, all lines are traversed;
Using the frame of first lines as front bezel is worked as, judge next lines frame whether with mutually hand over when front bezel Fork;
If so, generating new frame, the frame when front bezel and next lines is contained in the new frame;
Using the new frame as front bezel is worked as, continue to execute judge next lines frame whether with mutually hand over when front bezel The step of fork, until traversing to the last one lines, frame of the obtained new frame as subregion.
4. the method according to claim 1, wherein the preset bin feature includes at least one of the following:
There are backbones in the subregion;
The subregion Chinese number of words is greater than preset text threshold value, and lines quantity is greater than preset lines threshold value;
There are at least one frame lines;
The method also includes:If there are bins in the subregion, the subregion is updated to limb region, it will be described Bin is as new subregion.
5. the method according to claim 1, wherein the method also includes:If the subregion is located at figure In shape frame, using the figure frame as the limb region of the subregion;If the subregion not in figure frame, By subregion setting in specified drawing.
6. the method according to claim 1, wherein described according to preset notch feature, from the bin The step of identifying effective notch and effective notch corresponding circuit include:
The lines being located in specified range are determined as lines group;The direction of each lines is identical in each lines group;
If the gap of adjacent lines meets preset length range in lines group, the gap is determined as notch object;
Judge whether the notch object is effective;
If so, using the notch object as effective notch, the corresponding lines group of the effective notch is determined as circuit;Institute Stating notch object includes horizontal cut and longitudinal breach.
7. the method according to claim 1, wherein being provided in the element white list comprising the first specified text First regular expression of word;The second regular expression comprising the second specified word is provided in the element blacklist;Institute It states and is provided with the third regular expression comprising third specified word in particular element list;The third specified word includes phase Sequence, power flag, electric current label, equipment code name, circuit code name, cable pipeline code name, distribution box, bin model, bin sizes In it is a variety of;
It is described according to preset list library and words direction, the step of screening the text in the file, obtain element text, packet It includes:
Text in the file is matched with first regular expression, element will be determined as by matched text File;
Text in the file is matched with second regular expression, deletes matched text;
The component file matched is matched with the third regular expression, identifies the class of the element text Type.
8. the method according to claim 1, wherein the lookup is in effective notch setting range The step of element text, including:
If in the top setting range of effective notch there are element text, the component file is determined as described having Imitate the major component of notch;
If element text is not present in the top setting range of effective notch, the lower section of effective notch is set Element text in range is determined as the major component of effective notch;
The merging rule of the setting includes:
If the major component is located at the top of effective notch, and there are it between the major component and effective notch His text, other described texts and the major component are saved into the merging list of effective notch;
If the major component is located at the top of effective notch, and is not present between the major component and effective notch Other texts search the text between effective notch and the adjacent gap of effective bottom of the gap;
If the amount of text between effective notch and the adjacent gap is greater than setting amount threshold, according to preset order The text of not element text and the major component are saved into the merging list of effective notch.
9. the method according to claim 1, wherein the preset case number (CN) feature includes subcharacter and the son The corresponding weight of feature;The subcharacter includes having under number, English, connector, white list, blacklist, character length, character It is a variety of in horizontal line, character position.
10. a kind of CAD knows map device, which is characterized in that described device includes:
Lines processing module according to the average word height of the page in the file and is preset after according to the file for receiving CAD Line orientations, the lines in the file are screened and are corrected;
Region division module, for by each lines, to there are lines frame the lines of cross reference to be divided into a son Region;
Bin separation module, for being identified from the subregion and isolating bin according to preset bin feature;
Notch Circuit Searching module, for according to preset notch feature, identifying effective notch from the bin and described having Imitate the corresponding circuit of notch;
Text screening module, for screening the text in the file, obtaining element according to preset list library and words direction Text;The list library includes element white list, element blacklist and particular element list;
Element text merging module, for pressing according to the element text in effective notch setting range is searched According to the merging rule of setting, the element text found is merged;
Case number (CN) identification module, for being looked into the bin frame setting range apart from the bin according to preset case number (CN) feature Look for and identify the case number (CN) of the bin;
Result return module, for exporting recognition result according to specified format.
CN201810674049.3A 2018-06-26 2018-06-26 CAD graph recognition method and device Active CN108846398B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810674049.3A CN108846398B (en) 2018-06-26 2018-06-26 CAD graph recognition method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810674049.3A CN108846398B (en) 2018-06-26 2018-06-26 CAD graph recognition method and device

Publications (2)

Publication Number Publication Date
CN108846398A true CN108846398A (en) 2018-11-20
CN108846398B CN108846398B (en) 2021-09-07

Family

ID=64202815

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810674049.3A Active CN108846398B (en) 2018-06-26 2018-06-26 CAD graph recognition method and device

Country Status (1)

Country Link
CN (1) CN108846398B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110728260A (en) * 2019-10-23 2020-01-24 北京天工矩阵信息技术有限公司 Method and device for identifying electrical construction drawing
CN111027429A (en) * 2019-11-29 2020-04-17 陈韬文 Data preprocessing method and system for intelligent identification of electrical drawings
CN111160018A (en) * 2019-12-13 2020-05-15 广东施富电气实业有限公司 Method and system for recognizing non-component text of electrical drawing and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101021902A (en) * 2007-03-09 2007-08-22 永凯软件技术(上海)有限公司 Vector graphics identifying method for engineering CAD drawing
US20130041868A1 (en) * 2011-07-20 2013-02-14 International Business Machines Corporation Data synchronization
CN104765939A (en) * 2015-05-04 2015-07-08 上海利驰软件有限公司 Pick-up and converting DWG format electrical diagram method and device
CN104992007A (en) * 2015-06-24 2015-10-21 国家电网公司 Automatic evaluation method for power supply scheme design drawing
CN107358259A (en) * 2017-07-13 2017-11-17 国家电网公司 Covering ice for insulator detection method based on GLOH descriptions and GVF Snake models

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101021902A (en) * 2007-03-09 2007-08-22 永凯软件技术(上海)有限公司 Vector graphics identifying method for engineering CAD drawing
US20130041868A1 (en) * 2011-07-20 2013-02-14 International Business Machines Corporation Data synchronization
CN104765939A (en) * 2015-05-04 2015-07-08 上海利驰软件有限公司 Pick-up and converting DWG format electrical diagram method and device
CN104992007A (en) * 2015-06-24 2015-10-21 国家电网公司 Automatic evaluation method for power supply scheme design drawing
CN107358259A (en) * 2017-07-13 2017-11-17 国家电网公司 Covering ice for insulator detection method based on GLOH descriptions and GVF Snake models

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
朱江、孙家广等: "《电气原理图的自动识别》", 《计算机工程与科学》 *
琪琪: "《cad图纸如何拾取到excel里?利驰CAD扒图使用教程》", 《互联网HTTP://M.JISUXZ.COM/LIDT/ARTICLE-5.HTML》 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110728260A (en) * 2019-10-23 2020-01-24 北京天工矩阵信息技术有限公司 Method and device for identifying electrical construction drawing
CN111027429A (en) * 2019-11-29 2020-04-17 陈韬文 Data preprocessing method and system for intelligent identification of electrical drawings
CN111027429B (en) * 2019-11-29 2024-01-12 广东工业大学 Data preprocessing method and system for intelligent recognition of electrical drawing
CN111160018A (en) * 2019-12-13 2020-05-15 广东施富电气实业有限公司 Method and system for recognizing non-component text of electrical drawing and storage medium
CN111160018B (en) * 2019-12-13 2022-11-01 广东施富电气实业有限公司 Method and system for recognizing non-component text of electrical drawing and storage medium

Also Published As

Publication number Publication date
CN108846398B (en) 2021-09-07

Similar Documents

Publication Publication Date Title
CN108846398A (en) CAD knows drawing method and device
CN102156751B (en) Method and device for extracting video fingerprint
CN105551082B (en) A kind of pavement identification method and device based on laser point cloud
CN104717124B (en) A kind of friend recommendation method, apparatus and server
CN104536953B (en) A kind of recognition methods of text emotional valence and device
CN111104476B (en) Archive data generation method, archive data generation device, and readable storage medium
CN107845144B (en) Method for efficiently organizing and switching OpenGL rendering states
CN111429980A (en) Automatic acquisition method for material crystal structure characteristics
CN108984695A (en) A kind of character string matching method and device
CN105095910A (en) Classification method of DICOM images
CN104346405B (en) A kind of method and device of the Extracting Information from webpage
CN105205636A (en) Method and device for calculating material requirement planning (MRP)
CN114661810A (en) Lightweight multi-source heterogeneous data fusion method and system
CN106777130A (en) A kind of index generation method, data retrieval method and device
CN112364014A (en) Data query method, device, server and storage medium
CN111045612A (en) Printing order parameter matching method, storage medium and computer equipment
CN114816410A (en) Interface generation method, device and storage medium
CN109062921B (en) Method and system for extracting ship tray management information
CN107493370A (en) Traffic Profile determines method, flow information recognition methods and device
CN111079402B (en) Document hierarchy dividing method, document hierarchy dividing device, and readable storage medium
KR102016370B1 (en) AN IoT DEVICE WITH ITS IDENTIFIER AND THE INTEGRATED MANAGEMENT SYSTEM OF THE IoT DEVICE USING THE SAME
CN109783139A (en) Software interface feature extracting method, device and electronic equipment
KR101218795B1 (en) Feature selection method and apparatus using topological similar graphs for graph classification
CN114419356A (en) Detection method, system, equipment and storage medium for densely-arranged power equipment
CN105868857A (en) Method for optimizing shortest path for recovering garbage in district

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant