Compare commits

...
4 Commits
Author SHA1 Message Date
iambossandClaude Opus 5.5 bc67d8469b fix(demos): the machining demos dispose their LocalProjectService before LocalApp.AppEnd -- DemoUseMachiningProject, DemoBuildMachiningProject and DemoBuildGeomOnlyMachiningProject ended with machiningProject.Dispose(); LocalApp.AppEnd();, so the service was never disposed: MachiningProject.Dispose releases only the project's TimeMapping, while the service's machining runner keeps its threads, its native pipeline, the strip and the workpiece tree, everything AppEnd's documentation asks to be gone before it ends the native core. Each demo now disposes the service right after the project, one line with a comment saying why; not a using declaration, which would dispose it after AppEnd.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 20:07:15 +08:00
iambossandClaude Fable 5.1 a03aa1c1ff fix(demos): DemoBuildMachineTool puts the spindle's pivot on the tool-mount offset
CreateFromChainCode now seeds S with a DynamicRotation about -Z through S's origin (the spindle
role); the sample moves the tool mount to (-72.40, 72.40, 176.44) right after, so it moves the
spindle's pivot there too -- otherwise turning the spindle would swing the tool around S's origin.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-29 16:42:52 +08:00
iambossandClaude Fable 5.1 46bfea4a87 refactor(Hi.Sample): Mat4d is spelled mat4d_t -- the workspace-wide word-boundary rename that follows HiGeom naming the matrix struct after the C++ typedef; compound identifiers (GetMat4dMap, Mat4dKey, ProgramZeroToGeomMat4d, ...) and the "Mat4d" JSON key keep their spelling, no behaviour changes
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 15:48:56 +08:00
iambossandClaude Fable 5.1 734ed008b0 refactor(Hi.Sample): geometry slots take new Box3d(...) -- DemoBuildGeom's IGetStl list and the fixture and workpiece geometries of DemoBuildGeomOnlyMachiningProject and DemoBuildMachiningProject: box3d_t is the value only after HiGeom's box geometry split and no longer fits an IGetStl / IMakeXmlSource slot; the demos' value uses (bounds, ExpandToBox3d, drawings) stay box3d_t
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-25 00:22:01 +08:00
7 changed files with 21 additions and 12 deletions
+5 -5
View File
@@ -6,7 +6,7 @@ namespace Sample.Disp
/// <summary>
/// Demonstrates a simple solar system animation using <see cref="IDisplayee"/> interface.
/// Shows how to create a hierarchical transform structure with sun, earth and moon using
/// <see cref="Mat4d"/> matrices and model matrix stack transformations.
/// <see cref="mat4d_t"/> matrices and model matrix stack transformations.
/// </summary>
/// <remarks>
/// ### Source Code
@@ -30,12 +30,12 @@ namespace Sample.Disp
{
sun.Display(bind);
bind.ModelMatStack.Push();
bind.ModelMatStack.Mul(new Mat4d(new AxisAngle4d(new vec3d_t(0, 0, 1), angle_earth += 0.03)));
bind.ModelMatStack.Mul(new Mat4d(new vec3d_t(12, 0, 0)));
bind.ModelMatStack.Mul(new mat4d_t(new AxisAngle4d(new vec3d_t(0, 0, 1), angle_earth += 0.03)));
bind.ModelMatStack.Mul(new mat4d_t(new vec3d_t(12, 0, 0)));
earth.Display(bind);
bind.ModelMatStack.Push();
bind.ModelMatStack.Mul(new Mat4d(new AxisAngle4d(new vec3d_t(0, 0, 1), angle_moon += 0.02)));
bind.ModelMatStack.Mul(new Mat4d(new vec3d_t(4, 0, 0)));
bind.ModelMatStack.Mul(new mat4d_t(new AxisAngle4d(new vec3d_t(0, 0, 1), angle_moon += 0.02)));
bind.ModelMatStack.Mul(new mat4d_t(new vec3d_t(4, 0, 0)));
moon.Display(bind);
bind.ModelMatStack.Pop();
bind.ModelMatStack.Pop();
+1 -1
View File
@@ -22,7 +22,7 @@ public static class DemoBuildGeom
/// <returns>A list of geometries implementing the IGetStl interface</returns>
public static List<IGetStl> GenGeoms()
{
box3d_t box = new box3d_t(0, 0, -50, 70, 50, 0);
Box3d box = new Box3d(0, 0, -50, 70, 50, 0);
Cylindroid cylindroid = new Cylindroid([ new PairZr(0,12),new PairZr(20,12),
new PairZr(20,16),new PairZr(30,16)]);
Stl stl = new Stl("geom.stl");
+3
View File
@@ -43,6 +43,9 @@ namespace Sample.MachineTool
"[O][Y][X][C][w];[O][Z][B][S][t]");
if (dst.ToolMountTransformer is StaticTranslation st)
st.Trans = new vec3d_t(-72.40, 72.40, 176.44);
//the spindle turns the tool about its own axis: the rotation's pivot
//sits on the tool mount's origin, where the offset above moved it.
dst.SpindleTransformer.Pivot = new vec3d_t(-72.40, 72.40, 176.44);
dst.TransformerB.Pivot = new vec3d_t(-72.4, -177.4, 225.94);
Dictionary<string, Solid> solidMap = new Dictionary<string, Solid>()
{
@@ -74,7 +74,7 @@ public static class DemoBuildGeomOnlyMachiningProject
//geometry anchor to each mount, so the workpiece mount is placed by the
//transformer of the branch to it: on top of the 10 mm thick fixture geom.
Fixture fixture = Fixture.CreateDefault();
fixture.Geom = new box3d_t(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
fixture.Geom = new Box3d(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer
= new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture;
@@ -83,7 +83,7 @@ public static class DemoBuildGeomOnlyMachiningProject
//mount and to program zero by zero translations.
Workpiece workpiece = Workpiece.CreateDefault();
workpiece.InitResolution = 0.25;
workpiece.InitGeom = new box3d_t(0, 0, -50, 70, 50, 0);
workpiece.InitGeom = new Box3d(0, 0, -50, 70, 50, 0);
workpiece.IdealGeom = null;
localProjectService.Workpiece = workpiece;
@@ -96,6 +96,8 @@ public static class DemoBuildGeomOnlyMachiningProject
localProjectService.SaveProject();
machiningProject.Dispose();
//the service holds the play threads, the strip and the cut workpiece tree: dispose it before AppEnd
localProjectService.Dispose();
LocalApp.AppEnd();
}
+4 -2
View File
@@ -187,7 +187,7 @@ public static class DemoBuildMachiningProject
//geometry anchor to each mount, so the workpiece mount is placed by the
//transformer of the branch to it: on top of the 10 mm thick fixture geom.
Fixture fixture = Fixture.CreateDefault();
fixture.Geom = new box3d_t(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
fixture.Geom = new Box3d(new vec3d_t(-40, -40, 0), new vec3d_t(40, 40, 10));
Branch.Get(fixture.GeomAnchor, fixture.WorkpieceMount).Transformer
= new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture;
@@ -198,7 +198,7 @@ public static class DemoBuildMachiningProject
//mount and to program zero by zero translations.
Workpiece workpiece = Workpiece.CreateDefault();
workpiece.InitResolution = 0.25;
workpiece.InitGeom = new box3d_t(0, 0, -50, 70, 50, 0);
workpiece.InitGeom = new Box3d(0, 0, -50, 70, 50, 0);
workpiece.IdealGeom = null;
workpiece.CuttingPara = XFactory.GenByFile<ICuttingPara>(
"Resource/CuttingParameter", "Al6061T6.default.mp", progress);
@@ -216,6 +216,8 @@ public static class DemoBuildMachiningProject
machiningProject.MakeXmlSourceToFile(projectPath);
machiningProject.Dispose();
//the service holds the play threads, the strip and the cut workpiece tree: dispose it before AppEnd
localProjectService.Dispose();
LocalApp.AppEnd();
}
#endregion
+2
View File
@@ -85,6 +85,8 @@ public static class DemoUseMachiningProject
#region CleanupResources
Console.WriteLine($"Close Project: {projectPath}");
machiningProject.Dispose();
//the service holds the play threads, the strip and the cut workpiece tree: dispose it before AppEnd
localProjectService.Dispose();
LocalApp.AppEnd();
+2 -2
View File
@@ -44,9 +44,9 @@ public static class DemoTopo1
brnB.Step = MathUtil.ToRad(-60);
//Get and show the transform matrices relative to O.
Dictionary<Anchor, Mat4d> matMap = asmb.GetMat4dMap(O);
Dictionary<Anchor, mat4d_t> matMap = asmb.GetMat4dMap(O);
Console.WriteLine("Transform Matrix relative to O:");
foreach (KeyValuePair<Anchor, Mat4d> keyValue in matMap)
foreach (KeyValuePair<Anchor, mat4d_t> keyValue in matMap)
Console.WriteLine($"{keyValue.Key.Name} : {keyValue.Value}");
#endregion