프로젝트

일반

사용자정보

개정판 a1801fe0

IDa1801fe0b9409592a3d388a9e5f1718008009395
상위 59f02d4f
하위 bab64619

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

issue #1493: 변환 항목을 선택할 수 있도록 옵션 추가

Change-Id: I6e7b1bdb1fbed468875427d20653a1d11b3657a3

차이점 보기:

DTI_PID/DTI_PID/ImportTextFromCADDialog.py
758 758

  
759 759
        self.text_scale = self.ui.doubleSpinBoxScale.value()
760 760

  
761
        """get exclude layers mapping"""
761 762
        exclude_layers = []
762 763
        model = self.ui.listViewExcludeLayers.model()
763 764
        for row in range(model.rowCount()):
......
765 766
            if item.checkState() == Qt.Checked:
766 767
                exclude_layers.append(item.text())
767 768

  
769
        """get items to be converted"""
770
        will_be_converted_items = []
771
        if self.ui.checkBoxLine.checkState() == Qt.Checked:
772
            will_be_converted_items.append('Line')
773
        if self.ui.checkBoxText.checkState() == Qt.Checked:
774
            will_be_converted_items.append('Text')
775
        if self.ui.checkBoxSymbol.checkState() == Qt.Checked:
776
            will_be_converted_items.append('Symbol')
777

  
768 778
        mapping_configs = app_doc_data.getConfigs(section='Symbol Mapping')
769 779

  
770 780
        for _file in self._dwgs:
......
802 812
                    id2_bbox = get_contents_size_from_image(id2_image_file)
803 813
                    id2_bbox_text = id2_bbox
804 814

  
805
                    symbols_node = id2_xml_root.find(xg.SYMBOL_LIST_NODE_NAME)
806
                    if symbols_node:
807
                        symbols = symbols_node.findall('SYMBOL')
808
                        # remove only converted symbol nodes
809
                        for symbol in symbols:
810
                            if 'Converted' in symbol.attrib and symbol.attrib['Converted'] == str(True):
811
                                symbols_node.remove(symbol)
812

  
813
                    """remove texts from id2 xml file"""
814
                    textInfo = id2_xml_root.find(xg.TEXT_INFO_LIST_NODE_NAME)
815
                    textInfo.clear()
816

  
817
                    noteInfo = id2_xml_root.find(xg.NOTE_TEXT_INFO_LIST_NOTE_NAME)
818
                    noteInfo.clear()
819

  
820
                    lineNoInfo = id2_xml_root.find(xg.LINE_NOS_NODE_NAME)
821
                    lineNoInfo.clear()
822
                    """up to here"""
815
                    if 'Symbol' in will_be_converted_items:
816
                        symbols_node = id2_xml_root.find(xg.SYMBOL_LIST_NODE_NAME)
817
                        if symbols_node:
818
                            symbols = symbols_node.findall('SYMBOL')
819
                            # remove only converted symbol nodes
820
                            for symbol in symbols:
821
                                if 'Converted' in symbol.attrib and symbol.attrib['Converted'] == str(True):
822
                                    symbols_node.remove(symbol)
823

  
824
                    if 'Text' in will_be_converted_items:
825
                        """remove texts from id2 xml file"""
826
                        textInfo = id2_xml_root.find(xg.TEXT_INFO_LIST_NODE_NAME)
827
                        textInfo.clear()
828

  
829
                        noteInfo = id2_xml_root.find(xg.NOTE_TEXT_INFO_LIST_NOTE_NAME)
830
                        noteInfo.clear()
831

  
832
                        lineNoInfo = id2_xml_root.find(xg.LINE_NOS_NODE_NAME)
833
                        lineNoInfo.clear()
834
                        """up to here"""
823 835

  
824
                    """remove lines from id2 xml file"""
825
                    line_infos = id2_xml_root.find(xg.LINE_INFOS_NODE_NAME)
826
                    line_infos.clear()
827
                    """up to here"""
836
                    if 'Line' in will_be_converted_items:
837
                        """remove lines from id2 xml file"""
838
                        line_infos = id2_xml_root.find(xg.LINE_INFOS_NODE_NAME)
839
                        line_infos.clear()
840
                        """up to here"""
828 841

  
829 842
                    """remove unknowns from id2 xml file"""
830 843
                    unknowns = id2_xml_root.find(xg.UNKNOWNS_NODE_NAME)
......
843 856
                        autocad_bbox = [min_values[0], min_values[1],
844 857
                                        max_values[0] - min_values[0], max_values[1] - min_values[1]]
845 858

  
846
                        for record in blk_tbl_record.iter('AcDbText'):
847
                            if record.attrib['Layer'] not in exclude_layers:
848
                                node = self.text_to_xml(record, id2_bbox_text, autocad_bbox)
849
                                if node:
850
                                    textInfo.append(node)
859
                        if 'Text' in will_be_converted_items:
860
                            for record in blk_tbl_record.iter('AcDbText'):
861
                                if record.attrib['Layer'] not in exclude_layers:
862
                                    node = self.text_to_xml(record, id2_bbox_text, autocad_bbox)
863
                                    if node:
864
                                        textInfo.append(node)
851 865

  
852 866
                        for blk_ref in blk_tbl_record.iter('AcDbBlockReference'):
853
                            if blk_ref.attrib['Layer'] not in exclude_layers:
854
                                node = self.symbol_to_xml(blk_ref, id2_bbox, autocad_bbox, mapping_configs)
855
                                if node:
856
                                    symbols_node.append(node)
867
                            if 'Symbol' in will_be_converted_items:
868
                                if blk_ref.attrib['Layer'] not in exclude_layers:
869
                                    node = self.symbol_to_xml(blk_ref, id2_bbox, autocad_bbox, mapping_configs)
870
                                    if node:
871
                                        symbols_node.append(node)
857 872

  
873
                            if 'Text' in will_be_converted_items:
858 874
                                for record in blk_ref.iter('AcDbAttribute'):
859 875
                                    node = self.text_to_xml(record, id2_bbox_text, autocad_bbox)
860 876
                                    if node:
861 877
                                        textInfo.append(node)
862 878

  
863
                        for record in blk_tbl_record.iter('AcDbLine'):
864
                            if record.attrib['Layer'] not in exclude_layers:
865
                                node = self.lines_to_xml(layers, line_types, record, id2_bbox, autocad_bbox)
866
                                if node:
867
                                    line_infos.append(node)
868

  
869
                        for record in blk_tbl_record.iter('AcDbPolyline'):
870
                            if record.attrib['Layer'] not in exclude_layers:
871
                                node = self.lines_to_xml(layers, line_types, record, id2_bbox, autocad_bbox)
872
                                if node:
873
                                    line_infos.append(node)
879
                        if 'Line' in will_be_converted_items:
880
                            for record in blk_tbl_record.iter('AcDbLine'):
881
                                if record.attrib['Layer'] not in exclude_layers:
882
                                    node = self.lines_to_xml(layers, line_types, record, id2_bbox, autocad_bbox)
883
                                    if node:
884
                                        line_infos.append(node)
885

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

  
875 892
                    id2_xml.write(id2_xml_path, encoding="utf-8", xml_declaration=True)
876 893
                    """up to here"""
DTI_PID/DTI_PID/ImportTextFromCAD_UI.py
143 143
        self.listViewExcludeLayers = QtWidgets.QListView(ImportTextFromCADDialog)
144 144
        self.listViewExcludeLayers.setObjectName("listViewExcludeLayers")
145 145
        self.gridLayout.addWidget(self.listViewExcludeLayers, 9, 1, 1, 3)
146
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
147
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
148
        self.checkBoxLine = QtWidgets.QCheckBox(ImportTextFromCADDialog)
149
        self.checkBoxLine.setChecked(True)
150
        self.checkBoxLine.setObjectName("checkBoxLine")
151
        self.horizontalLayout_2.addWidget(self.checkBoxLine)
152
        self.checkBoxText = QtWidgets.QCheckBox(ImportTextFromCADDialog)
153
        self.checkBoxText.setChecked(True)
154
        self.checkBoxText.setObjectName("checkBoxText")
155
        self.horizontalLayout_2.addWidget(self.checkBoxText)
156
        self.checkBoxSymbol = QtWidgets.QCheckBox(ImportTextFromCADDialog)
157
        self.checkBoxSymbol.setObjectName("checkBoxSymbol")
158
        self.horizontalLayout_2.addWidget(self.checkBoxSymbol)
159
        self.gridLayout.addLayout(self.horizontalLayout_2, 11, 0, 1, 2)
146 160
        self.verticalLayout.addLayout(self.gridLayout)
147 161
        self.errorLabel = QtWidgets.QLabel(ImportTextFromCADDialog)
148 162
        self.errorLabel.setMaximumSize(QtCore.QSize(16777215, 0))
......
173 187
        self.pushButtonClose.setText(_translate("ImportTextFromCADDialog", "Close"))
174 188
        self.label_2.setText(_translate("ImportTextFromCADDialog", "AutoCAD Files : "))
175 189
        self.label_7.setText(_translate("ImportTextFromCADDialog", "Exclude Layers"))
190
        self.checkBoxLine.setText(_translate("ImportTextFromCADDialog", "Line"))
191
        self.checkBoxText.setText(_translate("ImportTextFromCADDialog", "Text"))
192
        self.checkBoxSymbol.setText(_translate("ImportTextFromCADDialog", "Symbol"))
176 193
import MainWindow_rc
DTI_PID/DTI_PID/UI/ImportTextFromCAD.ui
255 255
     <item row="9" column="1" colspan="3">
256 256
      <widget class="QListView" name="listViewExcludeLayers"/>
257 257
     </item>
258
     <item row="11" column="0" colspan="2">
259
      <layout class="QHBoxLayout" name="horizontalLayout_2">
260
       <item>
261
        <widget class="QCheckBox" name="checkBoxLine">
262
         <property name="text">
263
          <string>Line</string>
264
         </property>
265
         <property name="checked">
266
          <bool>true</bool>
267
         </property>
268
        </widget>
269
       </item>
270
       <item>
271
        <widget class="QCheckBox" name="checkBoxText">
272
         <property name="text">
273
          <string>Text</string>
274
         </property>
275
         <property name="checked">
276
          <bool>true</bool>
277
         </property>
278
        </widget>
279
       </item>
280
       <item>
281
        <widget class="QCheckBox" name="checkBoxSymbol">
282
         <property name="text">
283
          <string>Symbol</string>
284
         </property>
285
        </widget>
286
       </item>
287
      </layout>
288
     </item>
258 289
    </layout>
259 290
   </item>
260 291
   <item>

내보내기 Unified diff

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