Arch: Better output messages if the shape of an arch object is invalid

This commit is contained in:
Yorik van Havre 2014-05-19 17:51:19 -03:00
parent a871364066
commit 581d88485d
3 changed files with 23 additions and 12 deletions

View File

@ -584,16 +584,23 @@ class Component:
"checks and cleans the given shape, and apply it to the object" "checks and cleans the given shape, and apply it to the object"
if shape: if shape:
if not shape.isNull(): if not shape.isNull():
if shape.isValid() and shape.Solids: if shape.isValid():
if shape.Volume < 0: if shape.Solids:
shape.reverse() if shape.Volume < 0:
if shape.Volume < 0: shape.reverse()
FreeCAD.Console.PrintError(translate("Arch","Error computing the shape of this object")) if shape.Volume < 0:
return FreeCAD.Console.PrintError(translate("Arch","Error computing the shape of this object")+"\n")
shape = shape.removeSplitter() return
obj.Shape = shape shape = shape.removeSplitter()
if not placement.isNull(): obj.Shape = shape
obj.Placement = placement if not placement.isNull():
obj.Placement = placement
else:
FreeCAD.Console.PrintWarning(obj.Label + " " + translate("Arch","has no solid")+"\n")
else:
FreeCAD.Console.PrintWarning(obj.Label + " " + translate("Arch","has an invalid shape")+"\n")
else:
FreeCAD.Console.PrintWarning(obj.Label + " " + translate("Arch","has a null shape")+"\n")
class ViewProviderComponent: class ViewProviderComponent:

View File

@ -568,7 +568,9 @@ class _Structure(ArchComponent.Component):
if obj.Base.Shape.isNull(): if obj.Base.Shape.isNull():
return return
if not obj.Base.Shape.isValid(): if not obj.Base.Shape.isValid():
return if not obj.Base.Shape.Solids:
# let pass invalid objects if they have solids...
return
if hasattr(obj,"Tool"): if hasattr(obj,"Tool"):
if obj.Tool: if obj.Tool:
try: try:

View File

@ -413,7 +413,9 @@ class _Wall(ArchComponent.Component):
if obj.Base.Shape.isNull(): if obj.Base.Shape.isNull():
return return
if not obj.Base.Shape.isValid(): if not obj.Base.Shape.isValid():
return if not obj.Base.Shape.Solids:
# let pass invalid objects if they have solids...
return
if hasattr(obj,"Face"): if hasattr(obj,"Face"):
if obj.Face > 0: if obj.Face > 0: