프로젝트

일반

사용자정보

개정판 833b2cd8

ID833b2cd819b43018df8b43ae02a5c91eb45a8162
상위 8d5a086c
하위 c235988e

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

issue #1493: AutoCAD에서 블럭을 추출하여 ID2 XML 파일로 저장한다

Change-Id: I22eafaabecfcb70d41602154d43005e8cd614d26

차이점 보기:

DTI_PID/DTI_PID/Shapes/SymbolSvgItem.py
62 62
        self.hasInstrumentLabel = 0
63 63
        self.flip = flip
64 64
        self.hit_ratio = None
65
        self._converted = False  # flag indicate whether symbol is converted or not
65 66
        # attributeType uid
66 67
        self.attribute = ''
67 68
        self._properties = {SymbolProp(None, 'Supplied By', 'String'): None}
......
118 119
        configs = app_doc_data.getConfigs('Symbol Style', 'Opacity')
119 120
        self.setOpacity(float(configs[0].value) / 100 if configs else 0.5)
120 121

  
122
    @property
123
    def converted(self):
124
        """return whethere symbol is converted or not"""
125
        return self._converted
126

  
127
    @converted.setter
128
    def converted(self, value):
129
        """set converted flag with given value"""
130
        self._converted = value
131

  
121 132
    def has_in_out_connector(self):
122 133
        """ return True if item has in or out connector """
123 134
        if len(self.in_out_connector[0]) > 0 and len(self.in_out_connector[1]) > 0:
......
1138 1149

  
1139 1150
        try:
1140 1151
            node = Element('SYMBOL')
1152
            node.attrib['Converted'] = str(self.converted)
1141 1153
            uidNode = Element('UID')
1142 1154
            uidNode.text = str(self.uid)
1143 1155
            node.append(uidNode)
......
1173 1185
            # up to here
1174 1186

  
1175 1187
            originNode = Element('ORIGINALPOINT')
1176
            origin = self.mapToScene(self.transformOriginPoint())
1177
            originNode.text = f"{origin.x()},{origin.y()}"
1188
            if not self.transformOriginPoint().isNull():
1189
                origin = self.mapToScene(self.transformOriginPoint())
1190
                originNode.text = f"{origin.x()},{origin.y()}"
1191
            else:
1192
                origin = self.origin
1193
                originNode.text = f"{origin[0]},{origin[1]}"
1178 1194
            node.append(originNode)
1179 1195

  
1180 1196
            connectorsNode = Element('CONNECTORS')
......
1256 1272

  
1257 1273
            node.append(attributesNode)
1258 1274

  
1259
            currentPointModeIndexNode = Element('CURRENTPOINTMODEINDEX')
1260
            currentPointModeIndexNode.text = str(self.currentPointModeIndex)
1261
            node.append(currentPointModeIndexNode)
1275
            if hasattr(self, 'currentPointModeIndex'):
1276
                currentPointModeIndexNode = Element('CURRENTPOINTMODEINDEX')
1277
                currentPointModeIndexNode.text = str(self.currentPointModeIndex) if self.currentPointModeIndex else ''
1278
                node.append(currentPointModeIndexNode)
1262 1279
        except Exception as ex:
1263 1280
            from App import App
1264
            message = 'error occurred({}) in {}:{}'.format(ex, sys.exc_info()[-1].tb_frame.f_code.co_filename,
1265
                                                          sys.exc_info()[-1].tb_lineno)
1281
            message = f'error occurred({ex}) in {sys.exc_info()[-1].tb_frame.f_code.co_filename}:' \
1282
                      f'{sys.exc_info()[-1].tb_lineno}'
1266 1283
            App.mainWnd().addMessage.emit(MessageType.Error, message)
1267 1284

  
1268 1285
            return None
......
1646 1663
    '''
1647 1664

  
1648 1665
    @staticmethod
1649
    def createItem(type, name, path, uid=None, owner=None, flip=0):
1666
    def createItem(type: str, name: str, path: str, uid=None, owner=None, flip=0):
1650 1667
        from QEngineeringOPCItem import QEngineeringOPCItem
1651 1668
        from EngineeringEquipmentItem import QEngineeringEquipmentItem
1652 1669
        from EngineeringInstrumentItem import QEngineeringInstrumentItem

내보내기 Unified diff

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