개정판 1cbbd9f3
fix cad text import
Change-Id: Ie908424da8783286a026c9b56ac0f00515beaf8a
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
1138 | 1138 |
"""up to here""" |
1139 | 1139 |
|
1140 | 1140 |
"""add text, line and symbol from autocad file to id2 xml file""" |
1141 |
#if 'Text' in will_be_converted_items: # text for attrdef
|
|
1142 |
# for record in autocad_xml_root.iter('AcDbText'):
|
|
1143 |
# if record.attrib['Layer'] not in exclude_layers:
|
|
1144 |
# node = self.text_to_xml(record)
|
|
1145 |
# if node:
|
|
1146 |
# textInfo.append(node)
|
|
1141 |
if 'Text' in will_be_converted_items: # text for attrdef |
|
1142 |
for record in autocad_xml_root.iter('AcDbText'): |
|
1143 |
if record.attrib['Layer'] not in exclude_layers: |
|
1144 |
node = self.text_to_xml(record) |
|
1145 |
if node: |
|
1146 |
textInfo.append(node) |
|
1147 | 1147 |
|
1148 | 1148 |
for blk_tbl_record in autocad_xml_root.iter('AcDbBlockTableRecord'): |
1149 | 1149 |
if blk_tbl_record.attrib['Name'].upper() != '*Model_Space'.upper(): |
... | ... | |
1167 | 1167 |
self.offsets = [self.ui.spinBoxTextX.value(), self.ui.spinBoxTextY.value(), id2_bbox[5]] |
1168 | 1168 |
|
1169 | 1169 |
if 'Text' in will_be_converted_items: |
1170 |
for record in blk_tbl_record.iter('AcDbText'): |
|
1171 |
if record.attrib['Layer'] not in exclude_layers: |
|
1172 |
node = self.text_to_xml(record) |
|
1173 |
if node: |
|
1174 |
textInfo.append(node) |
|
1170 |
pass |
|
1171 |
#for record in blk_tbl_record.iter('AcDbText'): |
|
1172 |
# if record.attrib['Layer'] not in exclude_layers: |
|
1173 |
# node = self.text_to_xml(record) |
|
1174 |
# if node: |
|
1175 |
# textInfo.append(node) |
|
1176 |
|
|
1177 |
#for record in blk_tbl_record.iter('AcDbAttribute'): |
|
1178 |
# if record.attrib['Layer'] not in exclude_layers: |
|
1179 |
# node = self.text_to_xml(record) |
|
1180 |
# if node: |
|
1181 |
# textInfo.append(node) |
|
1175 | 1182 |
|
1176 | 1183 |
for blk_ref in blk_tbl_record.iter('AcDbBlockReference'): |
1177 | 1184 |
if 'Symbol' in will_be_converted_items: |
... | ... | |
1188 | 1195 |
symbols_node.append(node) |
1189 | 1196 |
|
1190 | 1197 |
if 'Text' in will_be_converted_items: |
1191 |
#angle = round(float(blk_ref.attrib['Angle']), 2) |
|
1192 |
for record in blk_ref.iter('AcDbAttribute'): |
|
1193 |
node = self.text_to_xml(record) |
|
1194 |
if node: |
|
1195 |
textInfo.append(node) |
|
1198 |
if blk_ref.attrib['Layer'] not in exclude_layers: |
|
1199 |
#angle = round(float(blk_ref.attrib['Angle']), 2) |
|
1200 |
for record in blk_ref.iter('AcDbAttribute'): |
|
1201 |
node = self.text_to_xml(record) |
|
1202 |
if node: |
|
1203 |
textInfo.append(node) |
|
1196 | 1204 |
|
1197 | 1205 |
if 'Line' in will_be_converted_items: |
1198 | 1206 |
for record in blk_tbl_record.iter('AcDbLine'): |
... | ... | |
1458 | 1466 |
loc = self.convert_to_image_coords([float(text_node.attrib['X']), float(text_node.attrib['Y'])]) |
1459 | 1467 |
|
1460 | 1468 |
text = text_node.text |
1469 |
if text == '323001B': |
|
1470 |
print('a') |
|
1461 | 1471 |
angle = round(float(text_node.attrib['Angle']), 2) |
1462 | 1472 |
if 'IsMirroredInX' in text_node.attrib and text_node.attrib['IsMirroredInX'] == 'True': |
1463 | 1473 |
if abs(math.pi * 0.5 - angle) < 0.01 or abs(math.pi * 1.5 - angle) < 0.01: |
내보내기 Unified diff