Compare commits

...
8 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
iambossandClaude Fable 5.1 1b834cff0d refactor(Hi.Sample)!: Box3d, Tri3d, DVec3d and Box2d are named box3d_t, tri3d_t, dvec3d_t and box2d_t -- the C++ typedef names, following HiGeom; the Hi.Native vec3d/tri3d/box3d mirrors are the Hi.Geom values now and vec3f is Hi.Geom.vec3f_t (a word-boundary identifier rename; compound names, string literals and the wire kind names are untouched)
BREAKING CHANGE: source that names these types must use the _t names; the Hi.Native mirrors are gone.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-24 13:54:35 +08:00
iambossandClaude Fable 5.1 7d79db5685 refactor(Hi.Sample): follow HiGeom's Box3d struct -- the demo displayees take ref Box3d and expand through Expanded, DemoSatellite scales its boxes with ScaledFromCenter, and MachiningProjectDisplayee forwards ref dst to the assembly
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-24 13:05:35 +08:00
iambossandClaude Fable 5.1 060fb66029 refactor(Hi.Sample): follow HiGeom's Tri3d struct -- DemoDrawing reads the apexes through the indexer instead of the ps array
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-24 12:19:45 +08:00
iambossandClaude Fable 5.1 6571576eaa refactor(Hi.Sample)!: Vec3d and Vec2d are named vec3d_t and vec2d_t -- the C++ typedef names, following HiGeom 43fccaf (a word-boundary identifier rename over the 14 demo files the 09-24 rename batch left behind; the repo builds against the HiGeom project reference, so it had stopped compiling)
BREAKING CHANGE: source that names Hi.Geom.Vec3d or Hi.Geom.Vec2d as the vector type must say vec3d_t / vec2d_t.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-24 10:21:20 +08:00
18 changed files with 92 additions and 83 deletions
+6 -6
View File
@@ -20,19 +20,19 @@ namespace Sample.Disp
public void Display(Bind bind)
{
bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
new Box3d(0, 0, 0, 1, 1, 1).ToDraw_Face().Display(bind);
new box3d_t(0, 0, 0, 1, 1, 1).ToDraw_Face().Display(bind);
bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
new Box3d(1, 0, 0, 2, 1, 1).ToDraw_Face().Display(bind);
new box3d_t(1, 0, 0, 2, 1, 1).ToDraw_Face().Display(bind);
bind.Rgb = ColorUtil.GetDiscreteRGB_Env();
new Box3d(2, 0, 0, 3, 1, 1).ToDraw_Face().Display(bind);
new box3d_t(2, 0, 0, 3, 1, 1).ToDraw_Face().Display(bind);
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
dst.Expand(new Vec3d(0, 0, 0));
dst.Expand(new Vec3d(3, 1, 1));
dst = dst.Expanded(new vec3d_t(0, 0, 0));
dst = dst.Expanded(new vec3d_t(3, 1, 1));
}
static void Main()
+17 -17
View File
@@ -40,14 +40,14 @@ namespace Sample.Disp
/// </summary>
public static void DrawLines()
{
List<Vec3d> ps;
List<vec3d_t> ps;
double[] vs;
int n = 10; //vertex num
////create drawPoints
ps = new List<Vec3d>(n);
ps = new List<vec3d_t>(n);
for (int i = 0; i < n; i++)
ps.Add(new Vec3d(i, 0, 0));
ps.Add(new vec3d_t(i, 0, 0));
vs = new double[ps.Count * 3];
for (int i = 0; i < ps.Count; i++)
{
@@ -125,16 +125,16 @@ namespace Sample.Disp
for (int i = 0, k = 0; i < n; i++)
{
//the rgb values set as casual.
Vec3d rgb = ColorUtil.GetDiscreteRgb(i);
Tri3d tri = new Tri3d(new Vec3d(i, 0, 0), new Vec3d(i + 1, 0, 0), new Vec3d(i + 0.5, 0, 1));
vec3d_t rgb = ColorUtil.GetDiscreteRgb(i);
tri3d_t tri = new tri3d_t(new vec3d_t(i, 0, 0), new vec3d_t(i + 1, 0, 0), new vec3d_t(i + 0.5, 0, 1));
for (int j = 0; j < 3; j++)
{
vs[k++] = rgb.x;
vs[k++] = rgb.y;
vs[k++] = rgb.z;
vs[k++] = tri.ps[j].x;
vs[k++] = tri.ps[j].y;
vs[k++] = tri.ps[j].z;
vs[k++] = tri[j].x;
vs[k++] = tri[j].y;
vs[k++] = tri[j].z;
}
}
//V means Vertex; C means Color
@@ -146,9 +146,9 @@ namespace Sample.Disp
for (int i = 0, k = 0; i < n; i++)
{
//the rgb values set as casual.
Vec3d rgb = ColorUtil.GetDiscreteRgb(i);
Tri3d tri = new Tri3d(new Vec3d(i, 0, 3), new Vec3d(i + 1, 0, 3), new Vec3d(i + 0.5, 0, 4));
Vec3d nn = tri.GetNormal();
vec3d_t rgb = ColorUtil.GetDiscreteRgb(i);
tri3d_t tri = new tri3d_t(new vec3d_t(i, 0, 3), new vec3d_t(i + 1, 0, 3), new vec3d_t(i + 0.5, 0, 4));
vec3d_t nn = tri.GetNormal();
for (int j = 0; j < 3; j++)
{
vs[k++] = rgb.x;
@@ -157,9 +157,9 @@ namespace Sample.Disp
vs[k++] = nn.x;
vs[k++] = nn.y;
vs[k++] = nn.z;
vs[k++] = tri.ps[j].x;
vs[k++] = tri.ps[j].y;
vs[k++] = tri.ps[j].z;
vs[k++] = tri[j].x;
vs[k++] = tri[j].y;
vs[k++] = tri[j].z;
}
}
//V means Vertex; C means Color; N means Normal
@@ -171,16 +171,16 @@ namespace Sample.Disp
}
/// <summary>
/// Demonstrates drawing 3D triangles using the Tri3d helper class.
/// Demonstrates drawing 3D triangles using the tri3d_t helper class.
/// Creates a series of triangles and renders them as both face (filled) and line (wireframe) drawings.
/// Shows how to apply different colors to faces and lines of the same geometry.
/// </summary>
public static void DrawTri3d()
{
int n = 10;
List<Tri3d> tris = new List<Tri3d>(n);
List<tri3d_t> tris = new List<tri3d_t>(n);
for (int i = 0; i < n; i++)
tris.Add(new Tri3d(new Vec3d(i, 0, 0), new Vec3d(i + 1, 0, 0), new Vec3d(i + 0.5, 0, 1)));
tris.Add(new tri3d_t(new vec3d_t(i, 0, 0), new vec3d_t(i + 1, 0, 0), new vec3d_t(i + 0.5, 0, 1)));
Drawing faceDraw = tris.GetFaceDrawing();
Drawing linesDraw = tris.ToLineDrawing();
+5 -5
View File
@@ -20,15 +20,15 @@ namespace Sample.Disp
public void Display(Bind bind)
{
bind.PickID = PickingID;
bind.Rgb = new Vec3d(isMouseOver ? 0 : 1, 1, 1);
new Box3d(0, 0, 0, 1, 1, 1).DisplayFace(bind);
bind.Rgb = new vec3d_t(isMouseOver ? 0 : 1, 1, 1);
new box3d_t(0, 0, 0, 1, 1, 1).DisplayFace(bind);
bind.PickID = 0;
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
dst.Expand(new Vec3d(0, 0, 0));
dst.Expand(new Vec3d(1, 1, 1));
dst = dst.Expanded(new vec3d_t(0, 0, 0));
dst = dst.Expanded(new vec3d_t(1, 1, 1));
}
/// <inheritdoc/>
public override void OnMouseEnter(ui_event_type e, DispEngine dispEngine)
+6 -6
View File
@@ -24,23 +24,23 @@ namespace Sample.Disp
{
bind.PickID = pickableA.PickingID;
bind.Rgb = ColorUtil.GetDiscreteRgb(1);
new Box3d(0, 0, 0, 1, 1, 1).DisplayFace(bind);
new box3d_t(0, 0, 0, 1, 1, 1).DisplayFace(bind);
bind.PickID = pickableB.PickingID;
bind.Rgb = ColorUtil.GetDiscreteRgb(2);
new Box3d(0, 0, 1, 1, 1, 2).DisplayFace(bind);
new box3d_t(0, 0, 1, 1, 1, 2).DisplayFace(bind);
bind.PickID = pickableC.PickingID;
bind.Rgb = ColorUtil.GetDiscreteRgb(3);
new Box3d(0, 0, 2, 1, 1, 3).DisplayFace(bind);
new box3d_t(0, 0, 2, 1, 1, 3).DisplayFace(bind);
bind.PickID = 0;
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
dst.Expand(new Vec3d(0, 0, 0));
dst.Expand(new Vec3d(1, 1, 3));
dst = dst.Expanded(new vec3d_t(0, 0, 0));
dst = dst.Expanded(new vec3d_t(1, 1, 3));
}
#region IDisposable Support
private bool disposedValue = false; // To detect redundant calls
+2 -2
View File
@@ -40,9 +40,9 @@ public class DemoPickable : IDisplayee
draw.Display(bind);
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
draw.ExpandToBox3d(dst);
draw.ExpandToBox3d(ref dst);
}
/// <summary>
+11 -11
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
@@ -21,30 +21,30 @@ namespace Sample.Disp
double angle_moon;
DemoSatellite()
{
sun = Box3d.CenterUnitBox.ScaleFromCenter(4).ToDraw_Face();
earth = Box3d.CenterUnitBox.ScaleFromCenter(2).ToDraw_Face();
moon = Box3d.CenterUnitBox.ToDraw_Face();
sun = box3d_t.CenterUnitBox.ScaledFromCenter(4).ToDraw_Face();
earth = box3d_t.CenterUnitBox.ScaledFromCenter(2).ToDraw_Face();
moon = box3d_t.CenterUnitBox.ToDraw_Face();
}
/// <inheritdoc/>
public void Display(Bind bind)
{
sun.Display(bind);
bind.ModelMatStack.Push();
bind.ModelMatStack.Mul(new Mat4d(new AxisAngle4d(new Vec3d(0, 0, 1), angle_earth += 0.03)));
bind.ModelMatStack.Mul(new Mat4d(new Vec3d(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(0, 0, 1), angle_moon += 0.02)));
bind.ModelMatStack.Mul(new Mat4d(new Vec3d(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();
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
dst.Expand(new Vec3d(-14, -14, -2));
dst.Expand(new Vec3d(14, 14, 2));
dst = dst.Expanded(new vec3d_t(-14, -14, -2));
dst = dst.Expanded(new vec3d_t(14, 14, 2));
}
static void Main()
+2 -2
View File
@@ -32,8 +32,8 @@ public static class DemoUtil
LocalApp.AppBegin(loggerFactory.CreateLogger("Hi.Sample"));
try
{
Box3d box = new Box3d();
displayee.ExpandToBox3d(box);
box3d_t box = new box3d_t();
displayee.ExpandToBox3d(ref box);
Console.WriteLine($"{title}: {displayee.GetType().Name} bounding {box}");
Console.WriteLine("Assign it to your canvas' DispEngine.Displayee to see it.");
}
+6 -6
View File
@@ -62,10 +62,10 @@ namespace Sample.Disp
////Console.WriteLine($"B: {CoordinateIndex}; {coordinateMove}");
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null
|| !equipment.TryGetMachinePositionAtTableMountZero(out Vec3d mcXyz_AttacherAtTableMountZero))
|| !equipment.TryGetMachinePositionAtTableMountZero(out vec3d_t mcXyz_AttacherAtTableMountZero))
return;
Vec3d coordinateMove;
vec3d_t coordinateMove;
string text;
if (HeidenhainCycleDef247Q339 == 0 && HeidenhainCycleDef7Arg == null)
return;
@@ -90,7 +90,7 @@ namespace Sample.Disp
bind.ModelMatStack.Pop();
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
HardNcEnv ncEnv = NcEnv;
if (ncEnv == null || NcEnv.CncBrand != CncBrand.Heidenhain)
@@ -98,16 +98,16 @@ namespace Sample.Disp
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null
|| !equipment.TryGetMachinePositionAtTableMountZero(out Vec3d mcXyz_AttacherAtTableMountZero))
|| !equipment.TryGetMachinePositionAtTableMountZero(out vec3d_t mcXyz_AttacherAtTableMountZero))
return;
Vec3d coordinateMove;
vec3d_t coordinateMove;
if (HeidenhainCycleDef247Q339 == 0 && HeidenhainCycleDef7Arg == null)
return;
coordinateMove = NcFlagUtil.GetHeidenhainCoordinateOffset(
HeidenhainCycleDef247Q339, HeidenhainCycleDef7Arg, ncEnv);
dst.Expand(-mcXyz_AttacherAtTableMountZero + coordinateMove);
dst = dst.Expanded(-mcXyz_AttacherAtTableMountZero + coordinateMove);
}
/// <inheritdoc/>
public Anchor GetAnchor()
+6 -6
View File
@@ -45,12 +45,12 @@ public class IsoCoordinateEntryDisplayee : IAnchoredDisplayee
if (ncEnv == null)
return;
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out Vec3d coordinateMove) != true)
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out vec3d_t coordinateMove) != true)
return;
string text = IsoCoordinateId ?? "";
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out Vec3d attacherPos))
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out vec3d_t attacherPos))
return;
bind.ModelMatStack.Push();
@@ -59,18 +59,18 @@ public class IsoCoordinateEntryDisplayee : IAnchoredDisplayee
bind.ModelMatStack.Pop();
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
HardNcEnv ncEnv = NcEnv;
if (ncEnv == null)
return;
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out Vec3d coordinateMove) != true)
if (ncEnv.IsoCoordinateTable?.TryGetValue(IsoCoordinateId, out vec3d_t coordinateMove) != true)
return;
IMachiningEquipment equipment = MillingEquipmentFunc?.Invoke();
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out Vec3d attacherPos))
if (equipment == null || !equipment.TryGetIsoCoordinatePosition(coordinateMove, out vec3d_t attacherPos))
return;
dst.Expand(attacherPos);
dst = dst.Expanded(attacherPos);
}
/// <inheritdoc/>
/// <returns>Table Mount if existed; otherwise, return null.</returns>
+2 -2
View File
@@ -239,10 +239,10 @@ public class MachiningProjectDisplayee : IDisplayee, IGetAnchor
bind.PopColor();
}
/// <inheritdoc/>
public void ExpandToBox3d(Box3d dst)
public void ExpandToBox3d(ref box3d_t dst)
{
//Console.WriteLine($"dst.A: {dst}");
LocalProjectService?.MachiningEquipment?.GetAsmb()?.ExpandToBox3d(dst,
LocalProjectService?.MachiningEquipment?.GetAsmb()?.ExpandToBox3d(ref dst,
GetAnchor(),
GetAnchoredDisplayeeList().ToArray());
//Console.WriteLine($"dst.B: {dst}");
+2 -2
View File
@@ -30,8 +30,8 @@ public static class DemoBuildGeom
TransformationGeom transformationGeom = new TransformationGeom()
{
Transformer = new GeneralTransform(1,
new StaticRotation(new Vec3d(0, 0, 1), MathUtil.ToRad(15), new Vec3d(0, 0, 0)),
new StaticTranslation(new Vec3d(0, 0, 0))),
new StaticRotation(new vec3d_t(0, 0, 1), MathUtil.ToRad(15), new vec3d_t(0, 0, 0)),
new StaticTranslation(new vec3d_t(0, 0, 0))),
Geom = stl
};
GeomCombination geomCombination = new GeomCombination(stlFile, transformationGeom);
+5 -5
View File
@@ -5,7 +5,7 @@ namespace Sample.Geom;
/// <summary>
/// Demonstrates how to create and calculate bounding boxes for different geometric objects.
/// Shows the use of Box3d to encompass multiple geometric elements with a single boundary.
/// Shows the use of box3d_t to encompass multiple geometric elements with a single boundary.
/// </summary>
/// <remarks>
/// ### Source Code
@@ -16,11 +16,11 @@ public static class DemoIExpandToBox3d
static void Main()
{
#region DocSite.CountBoundingBox
Box3d objA = new Box3d(0, 0, 0, 1, 1, 1);
Box3d objB = new Box3d(-1, -2, -3, 3, 2, 1);
Vec3d objC = new Vec3d(-2, 3, -5);
box3d_t objA = new box3d_t(0, 0, 0, 1, 1, 1);
box3d_t objB = new box3d_t(-1, -2, -3, 3, 2, 1);
vec3d_t objC = new vec3d_t(-2, 3, -5);
Box3d boundingbox = new Box3d(objA, objB, objC);
box3d_t boundingbox = new box3d_t(objA, objB, objC);
Console.WriteLine("boundingbox: " + boundingbox);
#endregion
}
+5 -2
View File
@@ -42,8 +42,11 @@ namespace Sample.MachineTool
GeneralXyzabcMachineTool dst = GeneralXyzabcMachineTool.CreateFromChainCode(
"[O][Y][X][C][w];[O][Z][B][S][t]");
if (dst.ToolMountTransformer is StaticTranslation st)
st.Trans = new Vec3d(-72.40, 72.40, 176.44);
dst.TransformerB.Pivot = new Vec3d(-72.4, -177.4, 225.94);
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>()
{
["O"] = new Solid(new Stl("MachineTool/base.stl")),
@@ -23,7 +23,7 @@ public static class DemoBuildMachineToolWithoutGeometrys
GeneralXyzabcMachineTool xyzabcMachineTool = GeneralXyzabcMachineTool.CreateFromChainCode(
"[O][C][w];[O][X][Y][Z][B][S][t]");
if (xyzabcMachineTool.ToolMountTransformer is StaticTranslation st)
st.Trans = new Vec3d(-200, 200, 400);
st.Trans = new vec3d_t(-200, 200, 400);
return xyzabcMachineTool;
}
}
@@ -74,9 +74,9 @@ 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(new Vec3d(-40, -40, 0), new Vec3d(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(0, 0, 10));
= new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture;
//The default shape already leads from the geometry anchor to the fixture
@@ -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,9 +187,9 @@ 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(new Vec3d(-40, -40, 0), new Vec3d(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(0, 0, 10));
= new StaticTranslation(new vec3d_t(0, 0, 10));
localProjectService.Fixture = fixture;
#endregion
@@ -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();
+6 -6
View File
@@ -33,10 +33,10 @@ public static class DemoTopo1
Anchor B = new Anchor(asmb, "B");
//build kinematic link
Branch.Attach(O, O1, new StaticTranslation(new Vec3d(0, 0, 80)));
Branch brnX = Branch.Attach(O1, X, new DynamicTranslation(new Vec3d(1, 0, 0)));
Branch brnZ = Branch.Attach(X, Z, new DynamicTranslation(new Vec3d(0, 0, 1)));
Branch brnB = Branch.Attach(Z, B, new DynamicRotation(new Vec3d(0, 1, 0), 0, new Vec3d(-100, 0, 0)));
Branch.Attach(O, O1, new StaticTranslation(new vec3d_t(0, 0, 80)));
Branch brnX = Branch.Attach(O1, X, new DynamicTranslation(new vec3d_t(1, 0, 0)));
Branch brnZ = Branch.Attach(X, Z, new DynamicTranslation(new vec3d_t(0, 0, 1)));
Branch brnB = Branch.Attach(Z, B, new DynamicRotation(new vec3d_t(0, 1, 0), 0, new vec3d_t(-100, 0, 0)));
//drive the dynamic transformation by single value for each branch.
brnX.Step = 200;
@@ -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