mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Added extra checks & logging to 3mf reader
CURA-382
This commit is contained in:
parent
9a0946687b
commit
dadcf45f45
@ -77,6 +77,7 @@ class ThreeMFReader(MeshReader):
|
|||||||
mesh_data = mesh_builder.build().getTransformed(rotation)
|
mesh_data = mesh_builder.build().getTransformed(rotation)
|
||||||
|
|
||||||
if not len(mesh_data.getVertices()):
|
if not len(mesh_data.getVertices()):
|
||||||
|
Logger.log("d", "One of the objects does not have vertices. Skipping it.")
|
||||||
continue # This object doesn't have data, so skip it.
|
continue # This object doesn't have data, so skip it.
|
||||||
|
|
||||||
node.setMeshData(mesh_data)
|
node.setMeshData(mesh_data)
|
||||||
@ -114,6 +115,7 @@ class ThreeMFReader(MeshReader):
|
|||||||
try:
|
try:
|
||||||
node.getBoundingBox() # Selftest - There might be more functions that should fail
|
node.getBoundingBox() # Selftest - There might be more functions that should fail
|
||||||
except:
|
except:
|
||||||
|
Logger.log("w", "Bounding box test for object failed. Skipping this object")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
result.addChild(node)
|
result.addChild(node)
|
||||||
@ -125,7 +127,10 @@ class ThreeMFReader(MeshReader):
|
|||||||
group_decorator = GroupDecorator()
|
group_decorator = GroupDecorator()
|
||||||
result.addDecorator(group_decorator)
|
result.addDecorator(group_decorator)
|
||||||
elif len(objects) == 1:
|
elif len(objects) == 1:
|
||||||
result = result.getChildren()[0] # Only one object found, return that.
|
if result.getChildren():
|
||||||
|
result = result.getChildren()[0] # Only one object found, return that.
|
||||||
|
else: # we failed to load any data
|
||||||
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Logger.log("e", "exception occured in 3mf reader: %s", e)
|
Logger.log("e", "exception occured in 3mf reader: %s", e)
|
||||||
try: # Selftest - There might be more functions that should fail
|
try: # Selftest - There might be more functions that should fail
|
||||||
|
Loading…
x
Reference in New Issue
Block a user