개정판 2823dd31
cad symbol point import test
Change-Id: Ibdd6a8cab67fbef1621c9961a493b1a54f16e55e
DTI_PID/DTI_PID/ImportTextFromCADDialog.py | ||
---|---|---|
1127 | 1127 |
if 3 == len(tokens): |
1128 | 1128 |
min_extents = self.convert_to_image_coords([float(tokens[0]), float(tokens[1])]) |
1129 | 1129 |
|
1130 |
_height = abs(max_extents[1] - min_extents[1])
|
|
1131 |
_width = abs(max_extents[0] - min_extents[0])
|
|
1130 |
_height = math.ceil(abs(max_extents[1] - min_extents[1]))
|
|
1131 |
_width = math.ceil(abs(max_extents[0] - min_extents[0]))
|
|
1132 | 1132 |
|
1133 | 1133 |
loc = [min(min_extents[0], max_extents[0]), min(min_extents[1], max_extents[1])] |
1134 | 1134 |
|
1135 | 1135 |
origin = [math.ceil(_origin[0] - loc[0]), math.ceil(_origin[1] - loc[1])] |
1136 | 1136 |
|
1137 |
points = [] |
|
1138 |
if blk_ref_node.attrib['Nodes']: |
|
1139 |
_points = blk_ref_node.attrib['Nodes'].replace('(', '').replace(')', '').split('/') |
|
1140 |
if _points: |
|
1141 |
for _point in _points: |
|
1142 |
_point = _point.split(',') |
|
1143 |
point = self.convert_to_image_coords([float(_point[0]), float(_point[1])]) |
|
1144 |
point[0] = 0 if math.ceil(point[0] - loc[0]) <= 0 else (_width if math.ceil(point[0] - loc[0]) > _width else math.ceil(point[0] - loc[0])) |
|
1145 |
point[1] = 0 if math.ceil(point[1] - loc[1]) <= 0 else (_height if math.ceil(point[1] - loc[1]) > _height else math.ceil(point[1] - loc[1])) |
|
1146 |
points.append(point) |
|
1147 |
|
|
1148 |
strPoints = [] |
|
1149 |
for point in points: |
|
1150 |
strPoint = 'AUTO,' + str(point[0]) + ',' + str(point[1]) + ',0,None,X,Secondary' |
|
1151 |
strPoints.append(strPoint) |
|
1152 |
|
|
1137 | 1153 |
ret = symbol.SymbolBase(name, type, 0.75, 0, 1, 0, 0, 0, \ |
1138 | 1154 |
"{},{}".format(origin[0], origin[1]), \ |
1139 |
'', \
|
|
1155 |
'/'.join(strPoints), \
|
|
1140 | 1156 |
'None', '', 0, 0, -1, \ |
1141 | 1157 |
iType=-2, detectFlip=0, text_area='') |
1142 | 1158 |
|
내보내기 Unified diff