프로젝트

일반

사용자정보

개정판 610614bc

ID610614bc6ad78d276de193ac9d5980a7765f714e
상위 a10d7f23
하위 b6e3c792

백흠경이(가) 약 4년 전에 추가함

issue #1493: MText 지원 그리고 Polyline 오류 수정

Change-Id: Ic1e55fc2c2c130c1723f4ece3ac5258cd41bd30b

차이점 보기:

DTI_PID/DTI_PID/ImportTextFromCADDialog.py
880 880
                        if 'Line' in will_be_converted_items:
881 881
                            for record in blk_tbl_record.iter('AcDbLine'):
882 882
                                if record.attrib['Layer'] not in exclude_layers:
883
                                    node = self.lines_to_xml(layers, line_types, record, id2_bbox, autocad_bbox)
884
                                    if node:
885
                                        line_infos.append(node)
883
                                    nodes = self.lines_to_xml(layers, line_types, record, id2_bbox, autocad_bbox)
884
                                    if nodes:
885
                                        for node in nodes:
886
                                            line_infos.append(node)
886 887

  
887 888
                            for record in blk_tbl_record.iter('AcDbPolyline'):
888 889
                                if record.attrib['Layer'] not in exclude_layers:
889
                                    node = self.lines_to_xml(layers, line_types, record, id2_bbox, autocad_bbox)
890
                                    if node:
891
                                        line_infos.append(node)
890
                                    nodes = self.lines_to_xml(layers, line_types, record, id2_bbox, autocad_bbox)
891
                                    if nodes:
892
                                        for node in nodes:
893
                                            line_infos.append(node)
892 894

  
893 895
                    id2_xml.write(id2_xml_path, encoding="utf-8", xml_declaration=True)
894 896
                    """up to here"""
......
1061 1063

  
1062 1064
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1063 1065

  
1064
    def lines_to_xml(self, layers: list, line_types: list, line_node, id2_bbox, autocad_bbox):
1066
    def lines_to_xml(self, layers: list, line_types: list, line_node, id2_bbox, autocad_bbox) -> list:
1065 1067
        """try to convert line element to id2 xml"""
1066 1068
        from LineTypeConditions import LineTypeConditions
1067 1069
        from EngineeringLineItem import QEngineeringLineItem
......
1092 1094
                pts.append((float(vertex.attrib['X']) * scale_x + offsets[0],
1093 1095
                            -float(vertex.attrib['Y']) * scale_y + offsets[1]))
1094 1096

  
1097
            # append first point if 'Closed' attribute is True
1098
            if 'Closed' in line_node.attrib and line_node.attrib['Closed'].upper() == 'True'.upper():
1099
                pts.append(pts[0])
1100

  
1095 1101
            """get id2 line type uid"""
1096 1102
            line_type, line_type_cond = get_line_type(layers, line_types, line_node.attrib['Layer'],
1097 1103
                                                      line_node.attrib['Linetype']), None
......
1111 1117
                        break
1112 1118
            """up to here"""
1113 1119

  
1114
            node = None
1120
            nodes = []
1115 1121
            for idx in range(len(pts) - 1):
1116 1122
                start, end = pts[idx], pts[idx + 1]
1117 1123
                dx, dy = end[0] - start[0], end[1] - start[1]
......
1123 1129

  
1124 1130
                item = QEngineeringLineItem(vertices=[start, end], thickness=5)
1125 1131

  
1132
                # import lines which is horizontal or vertical
1126 1133
                angle = math.degrees(item.angle())
1127 1134
                if not ((-5 < angle < 5) or (85 < angle < 95) or (175 < angle < 185) or (355 < angle < 365)):
1128 1135
                    continue
......
1133 1140
                    item.lineType = line_type_cond.name
1134 1141

  
1135 1142
                node = item.toXml()
1143
                nodes.append(node)
1136 1144

  
1137
            return node
1145
            return nodes
1138 1146
        except Exception as ex:
1139 1147
            from App import App
1140 1148
            from AppDocData import MessageType
DTI_PID/DTI_PID/ImportTextFromCAD_UI.py
2 2

  
3 3
# Form implementation generated from reading ui file '.\UI\ImportTextFromCAD.ui'
4 4
#
5
# Created by: PyQt5 UI code generator 5.15.2
5
# Created by: PyQt5 UI code generator 5.15.1
6 6
#
7 7
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
8 8
# run again.  Do not edit this file unless you know what you are doing.
......
181 181
        self.tabWidgetEntities.setTabText(self.tabWidgetEntities.indexOf(self.tabSymbols), _translate("ImportTextFromCADDialog", "Symbols"))
182 182
        self.label_5.setText(_translate("ImportTextFromCADDialog", "Search Text 2(Line No.) :"))
183 183
        self.label_6.setText(_translate("ImportTextFromCADDialog", "Scale :"))
184
        self.pushButtonImport.setToolTip(_translate("ImportTextFromCADDialog", "Only horizontal and vertical lines"))
184 185
        self.pushButtonImport.setText(_translate("ImportTextFromCADDialog", "Import"))
185 186
        self.label_3.setText(_translate("ImportTextFromCADDialog", "Text Offset(x, y, scale) : "))
186 187
        self.label.setText(_translate("ImportTextFromCADDialog", "Line Offset(x, y) : "))
DTI_PID/DTI_PID/UI/ImportTextFromCAD.ui
198 198
     </item>
199 199
     <item row="11" column="2">
200 200
      <widget class="QPushButton" name="pushButtonImport">
201
       <property name="toolTip">
202
        <string>Only horizontal and vertical lines</string>
203
       </property>
201 204
       <property name="text">
202 205
        <string>Import</string>
203 206
       </property>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)