개정판 ededa814
cad symbol import test fix items connection
Change-Id: Ia9f6dfe114816c6c8b0f18464939f3505ec3a068
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
934 | 934 |
try: |
935 | 935 |
scale_x = max([id2_bbox[2] / autocad_bbox[2], id2_bbox[3] / autocad_bbox[3]]) if self.ui.doubleSpinBox.value() < 1 else self.ui.doubleSpinBox.value() |
936 | 936 |
scale_y = max([id2_bbox[2] / autocad_bbox[2], id2_bbox[3] / autocad_bbox[3]]) if self.ui.doubleSpinBox_2.value() < 1 else self.ui.doubleSpinBox_2.value() |
937 |
offsets = [id2_bbox[0] - autocad_bbox[0] * scale_x, (id2_bbox[1] + id2_bbox[3]) - autocad_bbox[1] * scale_y] |
|
937 |
offsets = [id2_bbox[0] + self.ui.spinBoxX.value() - autocad_bbox[0] * scale_x, (id2_bbox[1] + id2_bbox[3]) + self.ui.spinBoxY.value() - autocad_bbox[1] * scale_y] |
|
938 |
#offsets = [id2_bbox[0] - autocad_bbox[0] * scale_x, (id2_bbox[1] + id2_bbox[3]) - autocad_bbox[1] * scale_y] |
|
938 | 939 |
#offsets = [self.ui.spinBoxTextX.value(), self.drawing_height + self.ui.spinBoxTextY.value()] |
939 | 940 |
|
940 | 941 |
name = blk_ref_node.attrib['Name'] |
... | ... | |
947 | 948 |
else: |
948 | 949 |
angle = round(float(blk_ref_node.attrib['Angle']), 2) |
949 | 950 |
|
951 |
if angle > 6.28: |
|
952 |
angle = angle - 2 * math.pi |
|
953 |
|
|
950 | 954 |
"""check if maxtents or minextents attribute exists""" |
951 | 955 |
if 'MaxExtents' not in blk_ref_node.attrib or 'MinExtents' not in blk_ref_node.attrib: |
952 | 956 |
return None |
... | ... | |
966 | 970 |
allowed_error = 0.01 |
967 | 971 |
if abs(angle - 1.57) < allowed_error: |
968 | 972 |
_height, _width = _width, _height |
969 |
origin[0], origin[1] = origin[0] - _width, origin[1] - _height + _width |
|
973 |
#origin[0], origin[1] = origin[0] - _width, origin[1] - _height + _width
|
|
970 | 974 |
elif abs(angle - 4.71) < allowed_error: |
971 | 975 |
_height, _width = _width, _height |
972 |
origin[0], origin[1] = origin[0] - _width, origin[1] + _height - _width |
|
976 |
#origin[0], origin[1] = origin[0] - _width, origin[1] + _height - _width
|
|
973 | 977 |
|
974 | 978 |
uid = None |
975 | 979 |
for config in mapping_configs: |
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
795 | 795 |
|
796 | 796 |
for item in lines_short + unknowns: |
797 | 797 |
item.transfer.onRemoved.emit(item) |
798 |
|
|
798 |
|
|
799 |
# connect symbol to symbol |
|
800 |
try: |
|
801 |
for symbol in symbols: |
|
802 |
matches = [it for it in symbols if it is not symbol and symbol.is_connectable(it, toler=toler)] |
|
803 |
for match in matches: |
|
804 |
symbol.connect_if_possible(match, toler=int(toler / 5 * 3)) |
|
805 |
except Exception as ex: |
|
806 |
message = f"error occurred({repr(ex)}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:" \ |
|
807 |
f"{sys.exc_info()[-1].tb_lineno}" |
|
808 |
self.addMessage.emit(MessageType.Error, message) |
|
809 |
# up to here |
|
810 |
|
|
799 | 811 |
if lines: |
800 | 812 |
new_lines = [] |
801 | 813 |
try: |
... | ... | |
808 | 820 |
if item is None: |
809 | 821 |
conns.append(sym.connectors[index]) |
810 | 822 |
|
811 |
new_lines.extend(Worker.make_short_lines_sts(conns, None)) |
|
823 |
#new_lines.extend(Worker.make_short_lines_sts(conns, None))
|
|
812 | 824 |
|
813 | 825 |
conns = [] |
814 | 826 |
for sym in symbols: |
... | ... | |
819 | 831 |
if item is None and sym.connectors[index]: |
820 | 832 |
conns.append(sym.connectors[index]) |
821 | 833 |
|
822 |
new_lines.extend(Worker.make_short_lines_stl(lines, conns, None)) |
|
834 |
#new_lines.extend(Worker.make_short_lines_stl(lines, conns, None))
|
|
823 | 835 |
|
824 | 836 |
for line in new_lines: |
825 | 837 |
self.graphicsView.scene().addItem(line) |
내보내기 Unified diff