Script Commands
The test suite also uses many single-string script calls (RunScript("…") and RunScriptWithOutput("…")).
These commands mostly fall into a few common groups.
Selection Commands
Most frequent group. Used to open globs and target objects for UI edits.
RunScript("Flux.Hub.SetSelection(Flux.PartEditor.Current.Part.BendTech.Ops[0], Flux.EModifiers.None);");
RunScript("Flux.Hub.SetSelection(Flux.PartEditor.Current.Part.BendTech.Ops[0].Setup.Mounts.First(a=>a.IsUpper), Flux.EModifiers.None);");
RunScript("Flux.Hub.SetSelection(Flux.PartEditor.Current.Part.BendTech.Cell.GripperBC, Flux.EModifiers.None);");
RunScript("Flux.BHub.SetSelection(Flux.PartEditor.Current.Part.Dwg.Entities[0], Flux.EModifiers.None);");
Machine/Tool Cache Reset Commands
Used after config/inventory changes to avoid stale state.
RunScript("Flux.Machine.UnloadAll();");
RunScriptWithOutput("Flux.Machine.Reload(120057); var result = \"done\";");
RunScript("Flux.BToolLibrary.Unload(1);");
RunScriptWithOutput("Flux.BToolLists.Flush(); var result = \"done\";");
RunScript("Flux.BTLIndex.Flush(); Flux.Machine.UnloadAll();");
View/Mode Context Commands
Switch active skin or simulation operation before checks.
RunScript("Flux.PartEditor.Current.Skin = Flux.EPartView.Model");
RunScript("Flux.PartEditor.Current.Part.BendTech.SimOp = Flux.PartEditor.Current.Part.BendTech.Ops[1];");
RunScriptWithOutput("Flux.PartEditor.Current.Part.DoFoldTo3D(); Flux.PartEditor.Current.Part.DoSwitchToBending(Flux.EDoFlags.Default, Flux.BendMachine.Get(120057)); Flux.PartEditor.Current.Skin = Flux.EPartView.BendCAM; var result = \"done\";");
Feature/Test Flag Commands
Temporary toggles used in targeted behavior tests.
RunScript("Flux.FX.DeveloperMC = false;");
RunScript("Flux.FX.Testing = true;");
RunScript("Flux.FX.Testing = false;");
RunScriptWithOutput("Flux.Experimental.MultiGripperMS = true; Flux.Experimental.Save(); Flux.BCupGrip.Flush(); var result = \"done\";");
Output/Export/Save Commands
Used to emit reports/config files and diagnostics.
RunScript("var part = Flux.PartEditor.Current.Part; var outfile = @\"<temp-path>\" + part.Info.RootFileName.Split('\\').Last(); Flux.ProgOutput.GenBendReport(part, -1, outfile, Flux.Sheaf.ERepFormat.HTML);");
RunScript("Flux.PartEditor.Current.Part.SaveFX(@\"<temp-path>temp.fx\");");
RunScript("Flux.PartEditor.Current.Part.BendTech.Setups[0].Save(@\"<temp-path>temp.bsetup\");");
RunScriptWithOutput("Flux.PartEditor.Current.Part.BendTech.BMachine.ExportConfig(@\"<temp-path>C149235.fxmcconfig\"); var result = \"done\";");
RunScriptWithOutput("Flux.MConsole.DumpHistory(@\"<temp-path>temp.txt\"); var result = \"done\";");
Query-For-Assertion Commands
Common assertion pattern: compute a value and assign to result.
RunScriptWithOutput("var result = Flux.PartEditor.Current.Part.BendTech.Ops[0].State.ToString();");
RunScriptWithOutput("var result = Flux.PartEditor.Current.Part.BendTech.Cell.Pickup.CState.ToString();");
RunScriptWithOutput("var result = (Flux.PartEditor.Current.Part.BendTech.Ops[0].Deduction = Flux.PartEditor.Current.Part.BendTech.Ops[2].Deduction).ToString();");
Select Bend Objects
Use selection commands to open matching globs and edit properties.
RunScript("Flux.Hub.SetSelection(Flux.PartEditor.Current.Part.BendTech.Ops[0], Flux.EModifiers.None);");
RunScript("Flux.Hub.SetSelection(Flux.PartEditor.Current.Part.BendTech.Ops[0].Setup.Mounts.First(a=>a.IsUpper), Flux.EModifiers.None);");
RunScript("Flux.Hub.SetSelection(Flux.PartEditor.Current.Part.BendTech.Cell.Deposits[0], Flux.EModifiers.None)");
Load Part and Switch to Bending
Used repeatedly for script-driven setup before assertions.
var commands = new List<string> {
"var part = Flux.FX.LoadPart(@\"<part-path>\");",
"if (!part.Info.IsSrc3D) part.DoFoldTo3D();",
"part.DoSwitchToBending(Flux.EDoFlags.Default, Flux.BendMachine.Get(\"120057\"));",
"Flux.PartEditor.Current.Skin = Flux.EPartView.BendCAM;"
};
RunScript(commands);
Read Command Output for Assertions
Set result in script and validate with RunScriptWithOutput.
var res = RunScriptWithOutput(
"var result = (Flux.PartEditor.Current.Part.BendTech.Ops[0].Deduction = " +
"Flux.PartEditor.Current.Part.BendTech.Ops[2].Deduction).ToString ();"
);
Assert.AreEqual(res, "True");
Configure Machine Output Behavior
Adjust destination and output formats before bend code/report generation.
var commands = new List<string>();
commands.Add("var mc = Flux.BendMachine.Get(120057);");
commands.Add("mc.Settings.Outputs.BendRepFormat = Flux.Sheaf.ERepFormat.PDF;");
commands.Add("mc.Settings.Outputs.BendRepAttachToNC = true;");
commands.Add("mc.Settings.Outputs.BendCodeDestination = @\"<temp-path>\";");
RunScript(commands);
Generate NC and Reports
Used for naming/output validation scenarios.
RunScript("Flux.ProgOutput.GenBendCode(part, @\"<out>.dlc\");");
RunScript("Flux.ProgOutput.GenBendReport(part, -1, @\"<out>\", Flux.Sheaf.ERepFormat.HTML);");
Library and Machine Refresh Commands
Stabilize state after catalog/tool changes.
RunScript("Flux.BToolLibrary.Unload(1);");
RunScript("Flux.BToolLists.Flush(); var result = \"done\";");
RunScript("Flux.BTLIndex.Flush(); var result = \"done\";");
RunScript("Flux.Machine.Reload(120057); var result = \"done\";");
RunScript("Flux.Machine.UnloadAll();");
Toggle Global/Test Flags
Temporary flags used in targeted behavior checks.
RunScript("Flux.FX.DeveloperMC = false;");
RunScript("Flux.FX.Testing = true;");
RunScript("Flux.FX.Testing = false;");
Query Bend-Tech Geometry/State
Typical query style: derive a value, assign to result, then assert.
var commands = new List<string>();
commands.Add("var op = Flux.PartEditor.Current.Part.BendTech.Ops[0];");
commands.Add("var result = op.Setup.Mounts.First(a=>a.Tool is Flux.BPunch).ToString();");
var outText = RunScriptWithOutput(commands);