개정판 275be6e7
issue #000: stop line tracing at spec break
Change-Id: I0568df1cd911b3da14bc8bccd60a2ed578607de6
DTI_PID/DTI_PID/LineNoTracer.py | ||
---|---|---|
35 | 35 |
self._lines = lines |
36 | 36 |
#for line in self._lines: line.owner = None |
37 | 37 |
self._lineNos = lineNos |
38 |
self._specBreak = specBreak
|
|
39 |
self._specBreakUID = [] |
|
38 |
self._spec_breaks = specBreak
|
|
39 |
#self._specBreakUID = []
|
|
40 | 40 |
self._lineIndicator = lineIndicator |
41 | 41 |
|
42 |
""" |
|
42 | 43 |
for spec in self._specBreak: |
43 | 44 |
for attr in spec.attrs: |
44 | 45 |
if type(attr) is tuple and attr[1] != '': |
45 | 46 |
self._specBreakUID.append(attr[1]) |
46 |
|
|
47 |
""" |
|
47 | 48 |
except Exception as ex: |
48 | 49 |
print('error occured({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, sys.exc_info()[-1].tb_lineno)) |
49 | 50 |
|
... | ... | |
327 | 328 |
pool = [] |
328 | 329 |
pool.append((0, startLine)) |
329 | 330 |
|
331 |
""" check startLine is upstream or downstream of spec break """ |
|
332 |
matches = [spec_break for spec_break in self._spec_breaks if spec_break.is_connected(startLine)] |
|
333 |
if matches: return visited |
|
334 |
|
|
330 | 335 |
while len(pool) > 0: |
331 | 336 |
sign, obj = pool.pop() |
332 | 337 |
if type(obj) is QEngineeringLineItem: |
... | ... | |
342 | 347 |
matches.extend([x for x in symbolMatches if not issubclass(type(x), QEngineeringEquipmentItem)]) # except equipment |
343 | 348 |
matches.extend(lineMatches) |
344 | 349 |
|
345 |
# specBreak 확인 |
|
346 |
isContainSpecBreak = False |
|
347 |
for uid in self._specBreakUID: |
|
348 |
if obj.uid == uid: |
|
349 |
isContainSpecBreak = True |
|
350 |
for item in matches: |
|
351 |
if item.uid == uid: |
|
352 |
isContainSpecBreak = True |
|
353 |
|
|
354 |
if isContainSpecBreak: |
|
355 |
break |
|
356 |
|
|
357 |
# specBreak 포함시 |
|
358 |
if isContainSpecBreak: |
|
359 |
isConnSpecBreak = obj.isConnectSpecBreak(self._specBreak) |
|
360 |
if isConnSpecBreak[0]: |
|
361 |
connector = isConnSpecBreak[1] |
|
362 |
removeList = [] |
|
363 |
if connector.connectedItem is not None: |
|
364 |
for item in matches: |
|
365 |
if item == connector.connectedItem: |
|
366 |
removeList.append(connector.connectedItem) |
|
367 |
|
|
368 |
# connectedItem 제거 |
|
369 |
if connector.connectedItem is not None: |
|
370 |
connector.connectedItem.disconnectedItemAtConnector(connector) |
|
371 |
obj.disconnectedItemAtConnector(connector) |
|
372 |
|
|
373 |
for item in removeList: |
|
374 |
matches.remove(item) |
|
375 |
|
|
376 |
|
|
377 | 350 |
if sign == 0 and len(matches) > 1: |
378 | 351 |
mid = int(len(matches)*0.5) |
379 | 352 |
lhs = matches[0:mid] |
DTI_PID/DTI_PID/Scripts/VendorPackages.sql | ||
---|---|---|
1 |
CREATE TABLE IF NOT EXISTS VendorPackages ( |
|
2 |
UID TEXT PRIMARY KEY, |
|
3 |
Drawings_UID TEXT REFERENCES Drawings (UID) NOT NULL, |
|
4 |
PTS TEXT |
|
5 |
); |
DTI_PID/DTI_PID/Shapes/EngineeringSpecBreakItem.py | ||
---|---|---|
35 | 35 |
attr.Attribute = 'DownStream' |
36 | 36 |
attr.AttributeType = 'Comp Item' |
37 | 37 |
self.attrs[attr] = None |
38 |
#attr = SymbolAttr() |
|
39 |
#attr.Attribute = 'SetSpecs' |
|
40 |
#attr.AttributeType = 'Link Dialog' |
|
41 |
#self.attrs[attr] = 'Double Click' |
|
42 |
''' |
|
43 |
attr = SymbolAttr() |
|
44 |
attr.Attribute = 'Spec' |
|
45 |
attr.AttributeType = 'FluidCode' |
|
46 |
self.attrs[attr] = ['P', 'OWS'] |
|
47 |
attr = SymbolAttr() |
|
48 |
attr.Attribute = 'Spec' |
|
49 |
attr.AttributeType = 'InsulationPurpose' |
|
50 |
self.attrs[attr] = ['N', 'Ic'] |
|
51 |
''' |
|
52 | 38 |
|
39 |
def is_connected(self, item): |
|
40 |
""" check if given item is connected to spec break """ |
|
41 |
import uuid |
|
42 |
|
|
43 |
matches = [(attr,value) for attr,value in self.attrs.items() if (attr.Attribute == 'UpStream' or attr.Attribute == 'DownStream')] |
|
44 |
for match in matches: |
|
45 |
if (type(match[1]) is uuid.UUID) and (match[1] == item.uid): |
|
46 |
return True |
|
47 |
elif not (type(match[1]) is uuid.UUID) and (match[1] == item): |
|
48 |
return True |
|
49 |
|
|
50 |
return False |
|
53 | 51 |
|
54 | 52 |
''' |
55 | 53 |
@brief get attribute |
내보내기 Unified diff