- a bit of optimization in camblib.clear_polygon() method

- added the update of bounds for the TclCommands: Mirror, Scale, Offset, Skew, Buffer
This commit is contained in:
Marius Stanciu
2023-06-15 00:50:10 +03:00
parent dd49b21176
commit aa7758c885
7 changed files with 99 additions and 25 deletions

View File

@@ -110,3 +110,13 @@ class TclCommandBuffer(TclCommand):
factor = bool(eval(str(args['factor']).capitalize())) if 'factor' in args else None
obj_to_buff.buffer(distance, join, factor, only_exterior=True)
try:
xmin, ymin, xmax, ymax = obj_to_buff.bounds()
obj_to_buff.obj_options['xmin'] = xmin
obj_to_buff.obj_options['ymin'] = ymin
obj_to_buff.obj_options['xmax'] = xmax
obj_to_buff.obj_options['ymax'] = ymax
except Exception as e:
self.app.log.error("TclCommandBuffer -> The object has no bounds properties. %s" % str(e))
return "fail"

View File

@@ -162,3 +162,13 @@ class TclCommandMirror(TclCommandSignaled):
except Exception as e:
self.app.log.error("Operation failed: %s" % str(e))
return "fail"
try:
xmin, ymin, xmax, ymax = obj.bounds()
obj.obj_options['xmin'] = xmin
obj.obj_options['ymin'] = ymin
obj.obj_options['xmax'] = xmax
obj.obj_options['ymax'] = ymax
except Exception as e:
self.app.log.error("TclCommandMirror -> The object has no bounds properties. %s" % str(e))
return "fail"

View File

@@ -72,3 +72,13 @@ class TclCommandOffset(TclCommand):
return "fail"
obj.offset((x, y))
try:
xmin, ymin, xmax, ymax = obj.bounds()
obj.obj_options['xmin'] = xmin
obj.obj_options['ymin'] = ymin
obj.obj_options['xmax'] = xmax
obj.obj_options['ymax'] = ymax
except Exception as e:
self.app.log.error("TclCommandOffset -> The object has no bounds properties. %s" % str(e))
return "fail"

View File

@@ -155,3 +155,13 @@ class TclCommandScale(TclCommand):
f_x = float(args['x'])
f_y = float(args['y'])
obj_to_scale.scale(f_x, f_y, point=point)
try:
xmin, ymin, xmax, ymax = obj_to_scale.bounds()
obj_to_scale.obj_options['xmin'] = xmin
obj_to_scale.obj_options['ymin'] = ymin
obj_to_scale.obj_options['xmax'] = xmax
obj_to_scale.obj_options['ymax'] = ymax
except Exception as e:
self.app.log.error("TclCommandScale -> The object has no bounds properties. %s" % str(e))
return "fail"

View File

@@ -202,3 +202,13 @@ class TclCommandSkew(TclCommand):
angle_y = math.degrees(math.atan(dist_y/width))
obj_to_skew.skew(angle_x, angle_y, point=ref_point)
try:
xmin, ymin, xmax, ymax = obj_to_skew.bounds()
obj_to_skew.obj_options['xmin'] = xmin
obj_to_skew.obj_options['ymin'] = ymin
obj_to_skew.obj_options['xmax'] = xmax
obj_to_skew.obj_options['ymax'] = ymax
except Exception as e:
self.app.log.error("TclCommandSkew -> The object has no bounds properties. %s" % str(e))
return "fail"