Feat/Sketch: associative pattern tools with independent directions and Flip/Center controls (#1601)

Thanks @Karl-VonRichter.
This commit is contained in:
Karl Von Richter authored and GitHub committed 2026-10-16 00:32:32 -04:00
1 parent 44968dbfe6
commit 371578a06f
36 files changed
+1394 -87

No files matched your search

@@ -0,0 +1,48 @@
[
{"note":"Each column has independent spacing, quantity and alignment. Center keeps the original in the middle; Left follows the negative second guide."},
{"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
{"call":"engine.execute","params":{"command":"sketch.circle.center","params":{"center":[5,5],"radius":2,"id":"seed"}}},
{"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[0,-10],[20,-10]],"ids":["guide1"]}}},
{"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[0,-30],[12,-14]],"ids":["guide2"]}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide1","guide2"],"fixed":true}}},
{"call":"ui.view","params":{"view":"top"}},
{"click":{"handle":"toolbar:sketch.pattern.rectangular"}},
{"click":{"sketch":[7,5]}},
{"click":{"handle":"dialog:Direction"}},
{"click":{"sketch":[10,-10]}},
{"click":{"handle":"dialog:Direction 2"}},
{"click":{"sketch":[6,-22]}},
{"click":{"handle":"dialog:Quantity"}},
{"key":"A","cmd":true},
{"text":"3"},
{"click":{"handle":"dialog:Spacing"}},
{"key":"A","cmd":true},
{"text":"20"},
{"click":{"handle":"dialog:Quantity 2"}},
{"key":"A","cmd":true},
{"text":"2"},
{"click":{"handle":"dialog:Spacing 2"}},
{"key":"A","cmd":true},
{"text":"10"},
{"expect":{"dialog":"PatternRect","errors":0,"sketch_curves":{"own":3}}},
{"click":{"handle":"dialog:Alignment:Center"}},
{"click":{"handle":"dialog:Alignment 2:Flip direction"}},
{"shot":"sketch_pattern_alignment_preview"},
{"click":{"handle":"dialog:OK"}},
{"expect":{"dialog":null,"errors":0,"sketch_curves":{"own":8}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",0],"value":-21}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",1],"value":-3}}},
{"call":"ui.view","params":{"view":"fit"}},
{"shot":"sketch_pattern_alignment_before"},
{"call":"engine.execute","params":{"command":"sketch.drag","params":{"entity":"seed.center","from":[5,5],"to":[7,8]}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",0],"value":-19}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",1],"value":0}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["seed"],"fixed":true}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide2"],"fixed":false}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide2.start"],"fixed":true}}},
{"call":"engine.execute","params":{"command":"sketch.drag","params":{"entity":"guide2.end","from":[12,-14],"to":[16,-18]}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",0],"value":-21}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",1],"value":2}}},
{"expect":{"errors":0,"sketch_curves":{"own":8}}},
{"shot":"sketch_pattern_alignment_after"}
]
@@ -0,0 +1,33 @@
[
{"note":"Six total holes span 90 degrees around the original; Flip chooses the extra side without moving the seed."},
{"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
{"call":"engine.execute","params":{"command":"sketch.circle.center","params":{"center":[40,0],"radius":2,"id":"seed"}}},
{"call":"engine.execute","params":{"command":"sketch.point","params":{"point":[0,0],"id":"axis_center"}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["axis_center"]}}},
{"call":"ui.view","params":{"view":"top"}},
{"call":"ui.camera","params":{"target":[25,0,0],"distance":120}},
{"start":"sketch.pattern.circular"},
{"click":{"sketch":[42,0]}},
{"click":{"handle":"dialog:Center"}},
{"click":{"sketch":[0,0]}},
{"click":{"handle":"dialog:Quantity"}},
{"key":"A","cmd":true},
{"text":"6"},
{"click":{"handle":"dialog:Total angle"}},
{"key":"A","cmd":true},
{"text":"90 deg"},
{"click":{"handle":"dialog:Alignment:Center"}},
{"shot":"sketch_pattern_circular_center_before_flip"},
{"click":{"handle":"dialog:Alignment:Flip direction"}},
{"shot":"sketch_pattern_circular_center_after_flip"},
{"click":{"handle":"dialog:OK"}},
{"expect":{"dialog":null,"errors":0,"sketch_curves":{"own":6}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",5,"center_at",0],"value":23.511410091698927}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",5,"center_at",1],"value":-32.3606797749979}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",0,"center_at",0],"value":40}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",0,"center_at",1],"value":0}}},
{"call":"engine.execute","params":{"command":"sketch.drag","params":{"entity":"seed.center","from":[40,0],"to":[45,0]}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",5,"center_at",0],"value":26.45033635316129}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",5,"center_at",1],"value":-36.405764746872634}}},
{"shot":"sketch_pattern_circular_center_source_edit"}
]
@@ -0,0 +1,49 @@
[
{"note":"Even centered totals keep the original fixed; Flip chooses the extra side independently for each direction."},
{"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
{"call":"engine.execute","params":{"command":"sketch.circle.center","params":{"center":[5,5],"radius":2,"id":"seed"}}},
{"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[0,-10],[20,-10]],"ids":["guide1"]}}},
{"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[0,-30],[12,-14]],"ids":["guide2"]}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide1","guide2"],"fixed":true}}},
{"call":"ui.view","params":{"view":"top"}},
{"click":{"handle":"toolbar:sketch.pattern.rectangular"}},
{"click":{"sketch":[7,5]}},
{"click":{"handle":"dialog:Direction"}},
{"click":{"sketch":[10,-10]}},
{"click":{"handle":"dialog:Direction 2"}},
{"click":{"sketch":[6,-22]}},
{"click":{"handle":"dialog:Quantity"}},
{"key":"A","cmd":true},
{"text":"4"},
{"click":{"handle":"dialog:Spacing"}},
{"key":"A","cmd":true},
{"text":"20"},
{"click":{"handle":"dialog:Quantity 2"}},
{"key":"A","cmd":true},
{"text":"2"},
{"click":{"handle":"dialog:Spacing 2"}},
{"key":"A","cmd":true},
{"text":"10"},
{"expect":{"dialog":"PatternRect","errors":0,"sketch_curves":{"own":3}}},
{"click":{"handle":"dialog:Alignment:Center"}},
{"click":{"handle":"dialog:Alignment 2:Center"}},
{"click":{"handle":"dialog:Alignment:Flip direction"}},
{"shot":"sketch_pattern_even_center_preview"},
{"click":{"handle":"dialog:OK"}},
{"expect":{"dialog":null,"errors":0,"sketch_curves":{"own":10}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",9,"center_at",0],"value":-29}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",9,"center_at",1],"value":13}}},
{"call":"ui.view","params":{"view":"fit"}},
{"shot":"sketch_pattern_even_center_before"},
{"call":"engine.execute","params":{"command":"sketch.drag","params":{"entity":"seed.center","from":[5,5],"to":[7,8]}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",9,"center_at",0],"value":-27}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",9,"center_at",1],"value":16}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["seed"],"fixed":true}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide2"],"fixed":false}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide2.start"],"fixed":true}}},
{"call":"engine.execute","params":{"command":"sketch.drag","params":{"entity":"guide2.end","from":[12,-14],"to":[16,-18]}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",9,"center_at",0],"value":-25}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",9,"center_at",1],"value":14}}},
{"expect":{"errors":0,"sketch_curves":{"own":10}}},
{"shot":"sketch_pattern_even_center_after"}
]
@@ -0,0 +1,38 @@
[
{"note":"The PATTERN toolbar opens a linear pattern with two independent picked direction lines. Copies follow the original and both lines."},
{"call":"engine.execute","params":{"command":"sketch.create","params":{"plane":"XY"}}},
{"call":"engine.execute","params":{"command":"sketch.circle.center","params":{"center":[5,5],"radius":2,"id":"seed"}}},
{"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[0,-10],[20,-10]],"ids":["guide1"]}}},
{"call":"engine.execute","params":{"command":"sketch.line","params":{"points":[[0,-30],[12,-14]],"ids":["guide2"]}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide1","guide2"],"fixed":true}}},
{"call":"ui.view","params":{"view":"top"}},
{"click":{"handle":"toolbar:sketch.pattern.rectangular"}},
{"click":{"sketch":[7,5]}},
{"click":{"handle":"dialog:Direction"}},
{"click":{"sketch":[10,-10]}},
{"click":{"handle":"dialog:Direction 2"}},
{"click":{"sketch":[6,-22]}},
{"click":{"handle":"dialog:Quantity"}}, {"key":"A","cmd":true}, {"text":"3"},
{"click":{"handle":"dialog:Spacing"}}, {"key":"A","cmd":true}, {"text":"20"},
{"click":{"handle":"dialog:Quantity 2"}}, {"key":"A","cmd":true}, {"text":"2"},
{"click":{"handle":"dialog:Spacing 2"}}, {"key":"A","cmd":true}, {"text":"10"},
{"expect":{"dialog":"PatternRect","errors":0,"sketch_curves":{"own":3}}},
{"shot":"sketch_pattern_two_directions_preview"},
{"click":{"handle":"dialog:OK"}},
{"expect":{"dialog":null,"errors":0,"sketch_curves":{"own":8}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",0],"value":51}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",1],"value":13}}},
{"call":"ui.view","params":{"view":"fit"}},
{"shot":"sketch_pattern_two_directions_before"},
{"call":"engine.execute","params":{"command":"sketch.drag","params":{"entity":"seed.center","from":[5,5],"to":[7,8]}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",0],"value":53}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",1],"value":16}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["seed"],"fixed":true}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide2"],"fixed":false}}},
{"call":"engine.execute","params":{"command":"sketch.constraint.fix","params":{"entities":["guide2.start"],"fixed":true}}},
{"call":"engine.execute","params":{"command":"sketch.drag","params":{"entity":"guide2.end","from":[12,-14],"to":[16,-18]}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",0],"value":55}}},
{"expect":{"query":{"command":"sketch.inspect","path":["curves",7,"center_at",1],"value":14}}},
{"expect":{"errors":0,"sketch_curves":{"own":8}}},
{"shot":"sketch_pattern_two_directions_after"}
]