개정판 2104f867
cad text fix and line size test
Change-Id: Iddc6a28ce747e02b2dca5ef7a04df3e5cfeee9d1
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
1494 | 1494 |
|
1495 | 1495 |
allowed_error = 0.01 |
1496 | 1496 |
if abs(angle - 1.57) < allowed_error: |
1497 |
_height, _width = _width, _height |
|
1498 |
loc[0], loc[1] = loc[0] - _width, loc[1] - _height + _width |
|
1497 |
# height, _width = _width, _height |
|
1498 |
# loc[0], loc[1] = loc[0] - _width, loc[1] - _height + _width |
|
1499 |
loc[0] -= _width |
|
1499 | 1500 |
elif abs(angle - 4.71) < allowed_error: |
1500 |
_height, _width = _width, _height |
|
1501 |
loc[0], loc[1] = loc[0] - _width, loc[1] + _height - _width |
|
1501 |
# _height, _width = _width, _height |
|
1502 |
# loc[0], loc[1] = loc[0] - _width, loc[1] + _height - _width |
|
1503 |
loc[0] -= _width |
|
1502 | 1504 |
|
1503 | 1505 |
#_height = round(float(text_node.attrib['Height']) * self.scales[1]) |
1504 | 1506 |
loc[1] -= _height |
DTI_PID/DTI_PID/Shapes/EngineeringAbstractItem.py | ||
---|---|---|
483 | 483 |
if res: |
484 | 484 |
self.sizeDepth = 0 |
485 | 485 |
return res |
486 |
''' |
|
487 |
if type(matches[0].items[0]) is QEngineeringLineItem and type(matches[0].items[-1]) is QEngineeringLineItem: |
|
488 |
res1 = None |
|
489 |
res2 = None |
|
490 |
|
|
491 |
_item = matches[0].items[0] |
|
492 |
connectedItems = [conn.connectedItem for conn in _item.connectors if conn.connectedItem and conn.connectedItem not in matches[0].items] |
|
493 |
if connectedItems: |
|
494 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
495 |
res1 = connectedItems[0].EvaluatedSize |
|
496 |
|
|
497 |
_item = matches[0].items[-1] |
|
498 |
connectedItems = [conn.connectedItem for conn in _item.connectors if conn.connectedItem and conn.connectedItem not in matches[0].items] |
|
499 |
connectedItems.reverse() |
|
500 |
if connectedItems: |
|
501 |
connectedItems[0].sizeDepth = self.sizeDepth + 1 |
|
502 |
res2 = connectedItems[0].EvaluatedSize |
|
503 |
if res1 and res2: |
|
504 |
self.sizeDepth = 0 |
|
505 |
return res1 if self.inch_to_number(res1) <= self.inch_to_number(res2) else res2 |
|
506 |
''' |
|
486 | 507 |
if type(matches[0].items[0]) is QEngineeringLineItem: |
487 | 508 |
_item = matches[0].items[0] |
488 | 509 |
connectedItems = [conn.connectedItem for conn in _item.connectors if conn.connectedItem and conn.connectedItem not in matches[0].items] |
... | ... | |
1158 | 1179 |
|
1159 | 1180 |
def center(self): |
1160 | 1181 |
return self.sceneBoundingRect().center() |
1182 |
|
|
1183 |
def inch_to_number(self, inch_str): |
|
1184 |
inch_str = str(inch_str) |
|
1185 |
inchs = inch_str.replace('"', '').split('-') |
|
1186 |
number = 0 |
|
1187 |
for inch in inchs: |
|
1188 |
if '/' not in inch: |
|
1189 |
number += float(inch) |
|
1190 |
else: |
|
1191 |
fraction = inch.split('/') |
|
1192 |
number += float(fraction[0]) / float(fraction[1]) |
|
1193 |
|
|
1194 |
return number |
|
1161 | 1195 |
|
1162 | 1196 |
|
1163 | 1197 |
if __name__ == '__main__': |
DTI_PID/DTI_PID/Shapes/EngineeringLineNoTextItem.py | ||
---|---|---|
1040 | 1040 |
message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename, |
1041 | 1041 |
sys.exc_info()[-1].tb_lineno) |
1042 | 1042 |
App.mainWnd().addMessage.emit(MessageType.Error, message) |
1043 |
|
|
1044 |
def inch_to_number(self, inch_str): |
|
1045 |
inchs = inch_str.replace('"', '').split('-') |
|
1046 |
number = 0 |
|
1047 |
for inch in inchs: |
|
1048 |
if '/' not in inch: |
|
1049 |
number += float(inch) |
|
1050 |
else: |
|
1051 |
fraction = inch.split('/') |
|
1052 |
number += float(fraction[0]) / float(fraction[1]) |
|
1053 |
|
|
1054 |
return number |
|
1055 | 1043 |
|
1056 | 1044 |
def validate(self): |
1057 | 1045 |
""" validation check """ |
내보내기 Unified diff