feat: close builder mutation and roundtrip evidence gaps

This commit is contained in:
2026-08-10 21:27:42 -04:00
parent 3907f50ff1
commit 26ea9b57d7
49 changed files with 5797 additions and 687 deletions

View File

@@ -6,6 +6,8 @@ import Part
import Sketcher
import TestSketcherApp
from freecad_mutation_evidence import capture_property_mutation
def version_text():
return ".".join(str(value) for value in App.Version()[:3])
@@ -38,7 +40,9 @@ def additive_loft():
feature = body.newObject("PartDesign::AdditiveLoft", "AdditiveLoft")
feature.Profile = profile
feature.Sections = [section]
mutation = capture_property_mutation(document, feature, "Ruled", True)
result = shape_result("additive-loft", document, feature)
result["mutation"] = mutation
App.closeDocument(document.Name)
return result
@@ -59,10 +63,17 @@ def subtractive_loft():
section.AttachmentSupport = (document.XZ_Plane, [""])
document.recompute()
TestSketcherApp.CreateRectangleSketch(section, (0, 1), (1, 1))
edited_section = body.newObject("Sketcher::SketchObject", "EditedSection")
edited_section.MapMode = "FlatFace"
edited_section.AttachmentSupport = (document.XZ_Plane, [""])
document.recompute()
TestSketcherApp.CreateRectangleSketch(edited_section, (0, 1), (0.75, 0.75))
feature = body.newObject("PartDesign::SubtractiveLoft", "SubtractiveLoft")
feature.Profile = profile
feature.Sections = [section]
mutation = capture_property_mutation(document, feature, "Sections", [edited_section])
result = shape_result("subtractive-loft", document, feature)
result["mutation"] = mutation
App.closeDocument(document.Name)
return result
@@ -70,6 +81,8 @@ def subtractive_loft():
def pipe_sketches(document, body):
profile = body.newObject("Sketcher::SketchObject", "Profile")
TestSketcherApp.CreateCircleSketch(profile, (0, 0), 1)
edited_profile = body.newObject("Sketcher::SketchObject", "EditedProfile")
TestSketcherApp.CreateCircleSketch(edited_profile, (0, 0), 0.75)
spine = body.newObject("Sketcher::SketchObject", "Spine")
spine.MapMode = "FlatFace"
spine.AttachmentSupport = (document.XZ_Plane, [""])
@@ -78,17 +91,19 @@ def pipe_sketches(document, body):
spine.addConstraint(Sketcher.Constraint("Coincident", 0, 1, -1, 1))
spine.addConstraint(Sketcher.Constraint("PointOnObject", 0, 2, -2))
spine.addConstraint(Sketcher.Constraint("DistanceY", 0, 1, 0, 2, 1))
return profile, spine
return profile, edited_profile, spine
def additive_pipe():
document = App.newDocument("AdditivePipeOracle")
body = document.addObject("PartDesign::Body", "Body")
profile, spine = pipe_sketches(document, body)
profile, edited_profile, spine = pipe_sketches(document, body)
feature = body.newObject("PartDesign::AdditivePipe", "AdditivePipe")
feature.Profile = profile
feature.Spine = spine
mutation = capture_property_mutation(document, feature, "Profile", edited_profile)
result = shape_result("additive-pipe", document, feature)
result["mutation"] = mutation
result["transition"] = str(feature.Transition)
App.closeDocument(document.Name)
return result
@@ -97,7 +112,7 @@ def additive_pipe():
def subtractive_pipe():
document = App.newDocument("SubtractivePipeOracle")
body = document.addObject("PartDesign::Body", "Body")
profile, spine = pipe_sketches(document, body)
profile, edited_profile, spine = pipe_sketches(document, body)
pad_sketch = body.newObject("Sketcher::SketchObject", "PadSketch")
TestSketcherApp.CreateRectangleSketch(pad_sketch, (-5, -5), (10, 10))
pad = body.newObject("PartDesign::Pad", "Pad")
@@ -107,7 +122,9 @@ def subtractive_pipe():
feature = body.newObject("PartDesign::SubtractivePipe", "SubtractivePipe")
feature.Profile = profile
feature.Spine = spine
mutation = capture_property_mutation(document, feature, "Profile", edited_profile)
result = shape_result("subtractive-pipe", document, feature)
result["mutation"] = mutation
result["transition"] = str(feature.Transition)
App.closeDocument(document.Name)
return result