[OpenSCAD] Add additional recompute() logic

This commit is contained in:
Chris Hennes
2021-03-29 13:58:52 -05:00
parent f525904c1b
commit b18cabae05

View File

@@ -463,13 +463,14 @@ def p_minkowski_action(p):
def p_resize_action(p):
'''
resize_action : resize LPAREN keywordargument_list RPAREN OBRACE block_list EBRACE '''
import Draft
print(p[3])
new_size = p[3]['newsize']
auto = p[3]['auto']
print(new_size)
print(auto)
p[6][0].recompute()
if p[6][0].Shape.isNull():
doc.recompute()
old_bbox = p[6][0].Shape.BoundBox
print ("Old bounding box: " + str(old_bbox))
old_size = [old_bbox.XLength, old_bbox.YLength, old_bbox.ZLength]
@@ -482,7 +483,6 @@ def p_resize_action(p):
# Calculate a transform matrix from the current bounding box to the new one:
transform_matrix = FreeCAD.Matrix()
#new_part.Shape = part.Shape.transformGeometry(transform_matrix)
scale = FreeCAD.Vector(float(new_size[0])/old_size[0],
float(new_size[1])/old_size[1],
@@ -978,10 +978,10 @@ def p_multmatrix_action(p):
part.ViewObject.hide()
else :
if printverbose: print("Transform Geometry")
# Need to recompute to stop transformGeometry causing a crash
doc.recompute()
part.recompute()
if part.Shape.isNull():
doc.recompute()
new_part = doc.addObject("Part::Feature","Matrix Deformation")
# new_part.Shape = part.Base.Shape.transformGeometry(transform_matrix)
new_part.Shape = part.Shape.transformGeometry(transform_matrix)
if gui:
part.ViewObject.hide()