refactor(demos): build the sample machine tools with GeneralXyzabcMachineTool.CreateFromChainCode and set the buckle and axis transformers through the machine

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-18 20:23:25 +08:00
co-authored by Claude Opus 5
parent 04bffeccaf
commit 65a8cce19e
2 changed files with 9 additions and 10 deletions
+6 -7
View File
@@ -39,10 +39,11 @@ namespace Sample.MachineTool
/// <returns>A configured machine tool model.</returns>
public static GeneralXyzabcMachineTool GenXyzabcMachineTool()
{
CodeXyzabcChain chain = new CodeXyzabcChain("[O][Y][X][C][w];[O][Z][B][S][t]");
if (chain.ToolBuckleTransformer is StaticTranslation st)
GeneralXyzabcMachineTool dst = GeneralXyzabcMachineTool.CreateFromChainCode(
"[O][Y][X][C][w];[O][Z][B][S][t]");
if (dst.ToolBuckleTransformer is StaticTranslation st)
st.Trans = new Vec3d(-72.40, 72.40, 176.44);
chain.TransformerB.Pivot = new Vec3d(-72.4, -177.4, 225.94);
dst.TransformerB.Pivot = new Vec3d(-72.4, -177.4, 225.94);
Dictionary<string, Solid> solidMap = new Dictionary<string, Solid>()
{
["O"] = new Solid(new Stl("MachineTool/base.stl")),
@@ -53,10 +54,8 @@ namespace Sample.MachineTool
["C"] = new Solid(new Stl("MachineTool/C.stl")),
["S"] = new Solid(new Stl("MachineTool/spindle.stl")),
};
chain.AnchorToSolid.BuildAnchorToSolid(
chain.Asmb.DescendantAnchors(), solidMap);
GeneralXyzabcMachineTool dst = new GeneralXyzabcMachineTool(chain);
dst.AnchorToSolid.BuildAnchorToSolid(
dst.Asmb.DescendantAnchors(), solidMap);
dst.GenerateCollisionIndexPairs();
return dst;
}