개정판 7c29f267
issue #49: add nominal allowable and change allowable method
Change-Id: Ib7fc6000fb65e489a5ca477262a81a912dd99f3a
DTI_PID/DTI_PID/CodeTables.py | ||
---|---|---|
32 | 32 |
else: |
33 | 33 |
for value in self.values: |
34 | 34 |
if text.startswith(value[1]): |
35 |
return value[1] |
|
35 |
return value[1], value[1]
|
|
36 | 36 |
else: |
37 | 37 |
matches = [x for x in value[3] if x and text.startswith(x)] |
38 |
if matches: return value[1] |
|
38 |
if matches: return value[1], matches[0]
|
|
39 | 39 |
|
40 | 40 |
return None |
41 | 41 |
|
DTI_PID/DTI_PID/Configs.py | ||
---|---|---|
38 | 38 |
|
39 | 39 |
if lineType == 'Code Table': |
40 | 40 |
tableName = lineProp[0].Attribute |
41 |
found = CodeTable.instance(tableName).find_starts_with(_text, self.unit) |
|
41 |
found, origin = CodeTable.instance(tableName).find_starts_with(_text, self.unit)
|
|
42 | 42 |
if not found: return (False,) |
43 |
_text = _text[len(found):len(_text)]
|
|
43 |
_text = _text[len(origin):len(_text)]
|
|
44 | 44 |
res.append(found) |
45 | 45 |
elif lineType == 'Int': |
46 | 46 |
if lineProp[0].Expression: |
DTI_PID/DTI_PID/NominalPipeSize.py | ||
---|---|---|
77 | 77 |
""" find text start with """ |
78 | 78 |
if size_unit.upper() == 'INCH': |
79 | 79 |
if value.startswith(self.inchStr): |
80 |
return self.inchStr |
|
80 |
return self.inchStr, self.inchStr
|
|
81 | 81 |
else: |
82 | 82 |
matches = [x for x in self.allowable_inch_str.split(',') if value.startswith(x)] |
83 |
if matches: return matches[0] |
|
83 |
if matches: return self.inchStr, matches[0]
|
|
84 | 84 |
elif size_unit.upper() == 'METRIC': |
85 | 85 |
if value.startswith(self.metricStr): |
86 |
return self.metricStr |
|
86 |
return self.metricStr, self.metricStr
|
|
87 | 87 |
else: |
88 | 88 |
matches = [x for x in self.allowable_metric_str.split(',') if value.startswith(x)] |
89 |
if matches: return matches[0] |
|
89 |
if matches: return self.metricStr, matches[0]
|
|
90 | 90 |
else: |
91 | 91 |
if value.startswith(self.inchStr): |
92 |
return self.inchStr |
|
92 |
return self.inchStr, self.inchStr
|
|
93 | 93 |
elif value.startswith(self.metricStr): |
94 |
return self.metricStr |
|
94 |
return self.metricStr, self.metricStr
|
|
95 | 95 |
else: |
96 | 96 |
matches = [x for x in self.allowable_inch_str.split(',') if value.startswith(x)] |
97 |
if matches: return matches[0] |
|
97 |
if matches: return self.inchStr, matches[0]
|
|
98 | 98 |
|
99 | 99 |
matches = [x for x in self.allowable_metric_str.split(',') if value.startswith(x)] |
100 |
if matches: return matches[0] |
|
100 |
if matches: return self.metricStr, matches[0]
|
|
101 | 101 |
|
102 | 102 |
return None |
103 | 103 |
|
DTI_PID/DTI_PID/Scripts/MSSQL/ID2.sql | ||
---|---|---|
1748 | 1748 |
Metric REAL, |
1749 | 1749 |
Inch REAL, |
1750 | 1750 |
InchStr VARCHAR(32), |
1751 |
AllowableInchStr VARCHAR(32),
|
|
1751 |
AllowableInchStr TEXT,
|
|
1752 | 1752 |
MetricStr VARCHAR(32), |
1753 |
AllowableMetricStr VARCHAR(32)
|
|
1753 |
AllowableMetricStr TEXT
|
|
1754 | 1754 |
); |
1755 | 1755 |
|
1756 | 1756 |
INSERT INTO NominalDiameter ( |
minorTools/makeallowable/makeallowables.py | ||
---|---|---|
1 |
import os |
|
2 |
|
|
3 |
input_path = os.path.join("E:\Projects\DTIPID_GERRIT\minorTools\makeallowable", "nominal.txt") |
|
4 |
output_path = os.path.join("E:\Projects\DTIPID_GERRIT\minorTools\makeallowable", "nominal2.txt") |
|
5 |
fw = open(input_path, 'r', encoding='utf8') |
|
6 |
contents = fw.read() |
|
7 |
fw.close() |
|
8 |
contents = contents.split('\n')[:-1] |
|
9 |
|
|
10 |
allowables = [] |
|
11 |
for text in contents: |
|
12 |
allowable = text.replace('\"', '\'') |
|
13 |
allowable += ',' + text.replace('\"', 'II') |
|
14 |
if '-' in text: |
|
15 |
allowable += ',' + text.replace('-', '') |
|
16 |
allowable += ',' + text.replace('-', '').replace('\"', '\'') |
|
17 |
allowable += ',' + text.replace('-', '').replace('\"', 'II') |
|
18 |
|
|
19 |
allowables.append(allowable) |
|
20 |
|
|
21 |
|
|
22 |
allowables = '\n'.join(allowables) |
|
23 |
fw = open(output_path, 'w', encoding='utf8') |
|
24 |
fw.write(allowables) |
|
25 |
fw.close() |
|
26 |
|
minorTools/makeallowable/nominal.txt | ||
---|---|---|
1 |
38" |
|
2 |
36" |
|
3 |
3-1/2" |
|
4 |
34" |
|
5 |
32" |
|
6 |
3" |
|
7 |
1/4" |
|
8 |
30" |
|
9 |
28" |
|
10 |
26" |
|
11 |
2-1/2" |
|
12 |
24" |
|
13 |
1/8" |
|
14 |
22" |
|
15 |
20" |
|
16 |
2" |
|
17 |
18" |
|
18 |
16" |
|
19 |
1-1/2" |
|
20 |
14" |
|
21 |
1-1/4" |
|
22 |
12" |
|
23 |
100" |
|
24 |
10" |
|
25 |
1" |
|
26 |
98" |
|
27 |
96" |
|
28 |
94" |
|
29 |
92" |
|
30 |
90" |
|
31 |
88" |
|
32 |
86" |
|
33 |
84" |
|
34 |
82" |
|
35 |
80" |
|
36 |
8" |
|
37 |
3/4" |
|
38 |
78" |
|
39 |
76" |
|
40 |
74" |
|
41 |
72" |
|
42 |
70" |
|
43 |
68" |
|
44 |
66" |
|
45 |
64" |
|
46 |
62" |
|
47 |
60" |
|
48 |
6" |
|
49 |
1/2" |
|
50 |
58" |
|
51 |
56" |
|
52 |
54" |
|
53 |
52" |
|
54 |
50" |
|
55 |
5" |
|
56 |
48" |
|
57 |
44" |
|
58 |
42" |
|
59 |
40" |
|
60 |
4" |
|
61 |
3/8" |
minorTools/makeallowable/nominal2.txt | ||
---|---|---|
1 |
38',38II |
|
2 |
36',36II |
|
3 |
3-1/2',3-1/2II,31/2",31/2',31/2II |
|
4 |
34',34II |
|
5 |
32',32II |
|
6 |
3',3II |
|
7 |
1/4',1/4II |
|
8 |
30',30II |
|
9 |
28',28II |
|
10 |
26',26II |
|
11 |
2-1/2',2-1/2II,21/2",21/2',21/2II |
|
12 |
24',24II |
|
13 |
1/8',1/8II |
|
14 |
22',22II |
|
15 |
20',20II |
|
16 |
2',2II |
|
17 |
18',18II |
|
18 |
16',16II |
|
19 |
1-1/2',1-1/2II,11/2",11/2',11/2II |
|
20 |
14',14II |
|
21 |
1-1/4',1-1/4II,11/4",11/4',11/4II |
|
22 |
12',12II |
|
23 |
100',100II |
|
24 |
10',10II |
|
25 |
1',1II |
|
26 |
98',98II |
|
27 |
96',96II |
|
28 |
94',94II |
|
29 |
92',92II |
|
30 |
90',90II |
|
31 |
88',88II |
|
32 |
86',86II |
|
33 |
84',84II |
|
34 |
82',82II |
|
35 |
80',80II |
|
36 |
8',8II |
|
37 |
3/4',3/4II |
|
38 |
78',78II |
|
39 |
76',76II |
|
40 |
74',74II |
|
41 |
72',72II |
|
42 |
70',70II |
|
43 |
68',68II |
|
44 |
66',66II |
|
45 |
64',64II |
|
46 |
62',62II |
|
47 |
60',60II |
|
48 |
6',6II |
|
49 |
1/2',1/2II |
|
50 |
58',58II |
|
51 |
56',56II |
|
52 |
54',54II |
|
53 |
52',52II |
|
54 |
50',50II |
|
55 |
5',5II |
|
56 |
48',48II |
|
57 |
44',44II |
|
58 |
42',42II |
|
59 |
40',40II |
|
60 |
4',4II |
|
61 |
3/8',3/8II |
내보내기 Unified diff