feat: classify fillet ordered pair row
This commit is contained in:
@@ -246,6 +246,29 @@ def collect_rejected():
|
||||
feature.Edges = [(index, 0.4, 0.4) for index in range(1, len(source.Shape.Edges) + 1)]
|
||||
diagnostic["parameter"] = {"name": "distance", "value": 0.4}
|
||||
diagnostic["input"] = link_snapshot(feature.Base)
|
||||
elif operation == "draft":
|
||||
body = document.addObject("PartDesign::Body", "Body")
|
||||
draft_base = body.newObject("PartDesign::Feature", "DraftBase")
|
||||
draft_base.Shape = source.Shape.copy()
|
||||
datum_plane = body.newObject("PartDesign::Plane", "DatumPlane")
|
||||
datum_plane.AttachmentSupport = [(document.XY_Plane, "")]
|
||||
datum_plane.MapMode = "FlatFace"
|
||||
datum_line = body.newObject("PartDesign::Line", "DatumLine")
|
||||
datum_line.AttachmentSupport = [(document.Z_Axis, "")]
|
||||
datum_line.MapMode = "TwoPointLine"
|
||||
feature = body.newObject("PartDesign::Draft", "PairResult")
|
||||
feature.Base = (draft_base, ["Face1"])
|
||||
feature.NeutralPlane = (datum_plane, [""])
|
||||
feature.PullDirection = (datum_line, [""])
|
||||
feature.Angle = 5.0
|
||||
feature.Reversed = False
|
||||
diagnostic["parameter"] = {"name": "angle", "value": round(float(feature.Angle), 7)}
|
||||
diagnostic["input"] = link_snapshot(feature.Base)
|
||||
diagnostic["input"]["sourceName"] = source.Name
|
||||
draft_base_shape = shape_snapshot_from_shape(draft_base.Shape, include_brep=True)
|
||||
diagnostic["input"]["shapeSummaryTransferredExactly"] = {key: value for key, value in draft_base_shape.items() if key != "brepSha256"} == {key: value for key, value in baseline_source_shape.items() if key != "brepSha256"}
|
||||
diagnostic["input"]["sourceBrepSha256"] = baseline_source_shape["brepSha256"]
|
||||
diagnostic["input"]["draftBaseBrepSha256"] = draft_base_shape["brepSha256"]
|
||||
elif operation == "thickness":
|
||||
feature = document.addObject("Part::Thickness", "PairResult")
|
||||
feature.Faces = (source, ["Face2"])
|
||||
@@ -268,6 +291,8 @@ def collect_rejected():
|
||||
diagnostic["state"] = [str(value) for value in feature.State]
|
||||
diagnostic["shapeNull"] = bool(feature.Shape.isNull())
|
||||
diagnostic["shapeValid"] = False if feature.Shape.isNull() else bool(feature.Shape.isValid())
|
||||
if not feature.Shape.isNull():
|
||||
diagnostic["resultShape"] = shape_snapshot_from_shape(feature.Shape)
|
||||
finally:
|
||||
document.abortTransaction()
|
||||
document.recompute()
|
||||
@@ -297,12 +322,13 @@ def collect_rejected():
|
||||
or "Error" in diagnostic["state"]
|
||||
or "Invalid" in diagnostic["state"]
|
||||
)
|
||||
freecad_profile_accepted = operation in ("fillet", "chamfer", "thickness") and not feature_rejected and not diagnostic["shapeNull"] and diagnostic["shapeValid"] and diagnostic["statusString"] == "Valid"
|
||||
expected_type_id = {"pad": "PartDesign::Pad", "loft": "Part::Loft", "pipe": "Part::Sweep", "revolution": "Part::Revolution", "fuse": "Part::Fuse", "fillet": "Part::Fillet", "chamfer": "Part::Chamfer", "thickness": "Part::Thickness"}[operation]
|
||||
input_names = [diagnostic.get("input", {}).get("name")] if operation in ("pad", "revolution", "fillet", "chamfer", "thickness") else ([diagnostic.get("input", {}).get(key, {}).get("name") for key in ("base", "tool")] if operation == "fuse" else [item["name"] for item in diagnostic.get("input", {}).get("sections", [])])
|
||||
freecad_profile_no_op = operation == "thickness" and not feature_rejected and not diagnostic["shapeNull"] and diagnostic["shapeValid"] and diagnostic["statusString"] == "Valid" and diagnostic.get("resultShape") == diagnostic.get("inputShape")
|
||||
freecad_profile_accepted = operation in ("fillet", "chamfer", "thickness") and not freecad_profile_no_op and not feature_rejected and not diagnostic["shapeNull"] and diagnostic["shapeValid"] and diagnostic["statusString"] == "Valid"
|
||||
expected_type_id = {"pad": "PartDesign::Pad", "loft": "Part::Loft", "pipe": "Part::Sweep", "revolution": "Part::Revolution", "fuse": "Part::Fuse", "fillet": "Part::Fillet", "chamfer": "Part::Chamfer", "draft": "PartDesign::Draft", "thickness": "Part::Thickness"}[operation]
|
||||
input_names = [diagnostic.get("input", {}).get("sourceName", diagnostic.get("input", {}).get("name"))] if operation in ("pad", "revolution", "fillet", "chamfer", "draft", "thickness") else ([diagnostic.get("input", {}).get(key, {}).get("name") for key in ("base", "tool")] if operation == "fuse" else [item["name"] for item in diagnostic.get("input", {}).get("sections", [])])
|
||||
checks = {
|
||||
"nativeFeatureConstructed": diagnostic.get("nativeTypeId") == expected_type_id,
|
||||
"fuseSolidUsedAsInput": source_name in input_names and diagnostic.get("inputShape", {}).get("solids") == 1,
|
||||
"fuseSolidUsedAsInput": source_name in input_names and diagnostic.get("inputShape", {}).get("solids") == 1 and (operation != "draft" or diagnostic.get("input", {}).get("shapeSummaryTransferredExactly") is True),
|
||||
"recomputeStatusCaptured": diagnostic["recomputeResult"] is not None or diagnostic["exceptionType"] is not None,
|
||||
"nativeFeatureRejected": feature_rejected,
|
||||
"freecadProfileAccepted": freecad_profile_accepted,
|
||||
@@ -311,6 +337,8 @@ def collect_rejected():
|
||||
"documentUnpolluted": baseline == initial,
|
||||
"documentStable": initial == reopened_snapshot and initial == resaved_snapshot,
|
||||
}
|
||||
if freecad_profile_no_op:
|
||||
checks["freecadProfileNoOp"] = True
|
||||
return {
|
||||
"schemaVersion": 1,
|
||||
"baselineId": "freecad-1.1.1-ordered-operation-pair-resave",
|
||||
@@ -332,7 +360,7 @@ def collect_rejected():
|
||||
},
|
||||
"phases": {"initial": initial, "reopened": reopened_snapshot, "resaved": resaved_snapshot},
|
||||
"checks": checks,
|
||||
"status": "pass" if all(checks.values()) or (operation in ("fillet", "chamfer", "thickness") and freecad_profile_accepted and all(value for key, value in checks.items() if key != "nativeFeatureRejected")) or (not freecad_profile_accepted and feature_rejected and all(value for key, value in checks.items() if key != "freecadProfileAccepted")) else "failed",
|
||||
"status": "pass" if all(checks.values()) or (operation in ("fillet", "chamfer", "thickness") and freecad_profile_accepted and all(value for key, value in checks.items() if key != "nativeFeatureRejected")) or (freecad_profile_no_op and all(value for key, value in checks.items() if key not in ("nativeFeatureRejected", "freecadProfileAccepted"))) or (not freecad_profile_accepted and feature_rejected and all(value for key, value in checks.items() if key != "freecadProfileAccepted")) else "failed",
|
||||
}
|
||||
finally:
|
||||
for name in list(App.listDocuments().keys()):
|
||||
|
||||
Reference in New Issue
Block a user