fix SoftNcRunner GM code normalization.

This commit is contained in:
2026-05-06 13:21:19 +08:00
parent 0fe9497552
commit 2f57932000
1238 changed files with 69405 additions and 22511 deletions
@@ -1,236 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Class DemoMessageAndExceptionHandling | HiAPI-C# 2025 </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class DemoMessageAndExceptionHandling | HiAPI-C# 2025 ">
<meta name="description" content="Demonstrates common message and exception handling patterns in HiAPI applications">
<link rel="icon" href="../img/HiAPI.favicon.ico">
<link rel="stylesheet" href="../public/docfx.min.css">
<link rel="stylesheet" href="../public/main.css">
<meta name="docfx:navrel" content="../toc.html">
<meta name="docfx:tocrel" content="toc.html">
<meta name="docfx:rel" content="../">
<meta name="loc:inThisArticle" content="In this article">
<meta name="loc:searchResultsCount" content="{count} results for &quot;{query}&quot;">
<meta name="loc:searchNoResults" content="No results for &quot;{query}&quot;">
<meta name="loc:tocFilter" content="Filter by title">
<meta name="loc:nextArticle" content="Next">
<meta name="loc:prevArticle" content="Previous">
<meta name="loc:themeLight" content="Light">
<meta name="loc:themeDark" content="Dark">
<meta name="loc:themeAuto" content="Auto">
<meta name="loc:changeTheme" content="Change theme">
<meta name="loc:copy" content="Copy">
<meta name="loc:downloadPdf" content="Download PDF">
<script type="module" src="./../public/docfx.min.js"></script>
<script>
const theme = localStorage.getItem('theme') || 'auto'
document.documentElement.setAttribute('data-bs-theme', theme === 'auto' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme)
</script>
</head>
<body class="tex2jax_ignore" data-layout="" data-yaml-mime="ManagedReference">
<header class="bg-body border-bottom">
<nav id="autocollapse" class="navbar navbar-expand-md" role="navigation">
<div class="container-xxl flex-nowrap">
<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../img/HiAPI.logo.png" alt="">
</a>
<button class="btn btn-lg d-md-none border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navpanel" aria-controls="navpanel" aria-expanded="false" aria-label="Toggle navigation">
<i class="bi bi-three-dots"></i>
</button>
<div class="collapse navbar-collapse" id="navpanel">
<div id="navbar">
<form class="search" role="search" id="search">
<i class="bi bi-search"></i>
<input class="form-control" id="search-query" type="search" disabled placeholder="Search" autocomplete="off" aria-label="Search">
</form>
</div>
</div>
</div>
</nav>
</header>
<main class="container-xxl">
<div class="toc-offcanvas">
<div class="offcanvas-md offcanvas-start" tabindex="-1" id="tocOffcanvas" aria-labelledby="tocOffcanvasLabel">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="tocOffcanvasLabel">Table of Contents</h5>
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" data-bs-target="#tocOffcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<nav class="toc" id="toc"></nav>
</div>
</div>
</div>
<div class="content">
<div class="actionbar">
<button class="btn btn-lg border-0 d-md-none" type="button" data-bs-toggle="offcanvas" data-bs-target="#tocOffcanvas" aria-controls="tocOffcanvas" aria-expanded="false" aria-label="Show table of contents">
<i class="bi bi-list"></i>
</button>
<nav id="breadcrumb"></nav>
</div>
<article data-uid="Sample.Common.DemoMessageAndExceptionHandling">
<h1 id="Sample_Common_DemoMessageAndExceptionHandling" data-uid="Sample.Common.DemoMessageAndExceptionHandling" class="text-break">
Class DemoMessageAndExceptionHandling
</h1>
<div class="facts text-secondary">
<dl><dt>Namespace</dt><dd><a class="xref" href="Sample.html">Sample</a>.<a class="xref" href="Sample.Common.html">Common</a></dd></dl>
<dl><dt>Assembly</dt><dd>Hi.Sample.dll</dd></dl>
</div>
<div class="markdown summary"><p>Demonstrates common message and exception handling patterns in HiAPI applications</p>
</div>
<div class="markdown conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public static class DemoMessageAndExceptionHandling</code></pre>
</div>
<dl class="typelist inheritance">
<dt>Inheritance</dt>
<dd>
<div><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object">object</a></div>
<div><span class="xref">DemoMessageAndExceptionHandling</span></div>
</dd>
</dl>
<dl class="typelist inheritedMembers">
<dt>Inherited Members</dt>
<dd>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object, object)</a>
</div>
<div>
<a class="xref" href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>
</div>
</dd></dl>
<h2 id="Sample_Common_DemoMessageAndExceptionHandling_remarks">Remarks</h2>
<div class="markdown level0 remarks"><h3 id="source-code">Source Code</h3>
<pre><code class="lang-csharp" name="SampleCode">using System;
using System.Threading.Tasks;
using Hi.Common;
using Hi.Common.Messages;
namespace Sample.Common;
/// &lt;summary&gt;
/// Demonstrates common message and exception handling patterns in HiAPI applications
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// ### Source Code
/// [!code-csharp[SampleCode](~/../Hi.Sample/Common/DemoMessageAndExceptionHandling.cs)]
/// &lt;/remarks&gt;
public static class DemoMessageAndExceptionHandling
{
/// &lt;summary&gt;
/// Demonstrates normal message handling
/// &lt;/summary&gt;
internal static void DemoNormalMessages()
{
#region Normal_Messages
MessageUtil.ReportMessage(&quot;Operation completed successfully.&quot;);
MessageUtil.ReportWarning(&quot;Please check your input.&quot;);
#endregion
}
/// &lt;summary&gt;
/// Demonstrates exception handling in synchronous code
/// &lt;/summary&gt;
internal static void DemoSynchronousExceptionHandling()
{
#region Sync_Exception
try
{
// Your code here
throw new NotImplementedException(&quot;Demo exception&quot;);
}
catch (Exception ex)
{
ExceptionUtil.ShowException(ex, null);
}
#endregion
}
/// &lt;summary&gt;
/// Demonstrates exception handling in asynchronous code
/// &lt;/summary&gt;
internal static async Task DemoAsynchronousExceptionHandling()
{
#region Async_Exception
await Task.Run(() =&gt;
{
// Your async operation here
throw new NotImplementedException(&quot;Demo async exception&quot;);
}).ShowIfCatched(null);
#endregion
}
}
</code></pre></div>
</article>
<div class="contribution d-print-none">
</div>
</div>
<div class="affix">
<nav id="affix"></nav>
</div>
</main>
<div class="container-xxl search-results" id="search-results"></div>
<footer class="border-top text-secondary">
<div class="container-xxl">
<div class="flex-fill">
<span> Copyright © 2025 <a href='https://superhightech.com.tw'>Tech Coordinate</a>. All rights reserved. <a href='https://superhightech.com.tw'>超級高科技股份有限公司</a> © 2025 版權所有 </span>
</div>
</div>
</footer>
</body>
</html>
@@ -94,11 +94,6 @@
<h3 id="classes">
Classes
</h3>
<dl class="jumplist">
<dt><a class="xref" href="Sample.Common.DemoMessageAndExceptionHandling.html">DemoMessageAndExceptionHandling</a></dt>
<dd><p>Demonstrates common message and exception handling patterns in HiAPI applications</p>
</dd>
</dl>
<dl class="jumplist">
<dt><a class="xref" href="Sample.Common.DemoSessionMessage.html">DemoSessionMessage</a></dt>
<dd></dd>
@@ -155,6 +155,7 @@ Handles common initialization and cleanup tasks for visualization examples.</p>
using Hi.HiNcKits;
using Hi.Licenses;
using Hi.WpfPlus.Disp;
using Microsoft.Extensions.Logging;
using System.Windows;
namespace Sample.Disp;
@@ -179,7 +180,8 @@ public static class DemoUtil
/// &lt;param name=&quot;displayee&quot;&gt;The object that implements IDisplayee to be rendered&lt;/param&gt;
public static void RunApplication(string title, IDisplayee displayee)
{
LocalApp.AppBegin();
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample.Wpf&quot;));
Application app = new Application();
app.Exit += (o, e) =&gt;
{
@@ -153,6 +153,7 @@ Shows the basic setup of display engine, MongoDB server, licensing, and other co
It demonstrates proper initialization and teardown of key components.</p>
<h3 id="source-code">Source Code</h3>
<pre><code class="lang-csharp" name="SampleCode">using Hi.HiNcKits;
using Microsoft.Extensions.Logging;
using System;
namespace Sample
@@ -172,7 +173,8 @@ namespace Sample
static int Main(string[] args)
{
Console.WriteLine(&quot;HiAPI starting.&quot;);
LocalApp.AppBegin();
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample&quot;));
Console.WriteLine(&quot;Hello World! HiAPI.&quot;);
@@ -182,7 +182,7 @@ namespace Sample.MachineTool
{
static DemoBuildMachineTool()
{
XFactory.Regs.Add(XName, (xml, baseDirectory, relFile, res) =&gt; new DemoBuildMachineTool());
XFactory.Regs.Add(XName, (xml, baseDirectory, relFile, progress, res) =&gt; new DemoBuildMachineTool());
}
/// &lt;summary&gt;
/// Generates an XYZ-ABC machine tool instance from embedded resources.
@@ -164,6 +164,7 @@ using Hi.NcMech.Holders;
using Hi.Machining;
using Hi.HiNcKits;
using Hi.Milling.MillingTools;
using Microsoft.Extensions.Logging;
namespace Sample.Machining;
@@ -192,7 +193,8 @@ public static class DemoBuildGeomOnlyMachiningProject
static void Main()
{
LocalApp.AppBegin();
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample&quot;));
LocalProjectService localProjectService = new LocalProjectService();
var projectPath = &quot;C:/HiNC-Projects/NewProject/Main.hincproj&quot;;
@@ -232,9 +234,10 @@ public static class DemoBuildGeomOnlyMachiningProject
WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
};
IProgress&lt;object&gt; progress = null;
localProjectService.MachiningChain
= XFactory.GenByFile&lt;CodeXyzabcMachineTool&gt;(
&quot;Resource&quot;, &quot;MachineTool/PMC-B1/PMC-B1.mt&quot;, GenMode.Default);
&quot;Resource&quot;, &quot;MachineTool/PMC-B1/PMC-B1.mt&quot;, progress);
localProjectService.MachiningChainFile = &quot;PMC-B1/PMC-B1.mt&quot;;
localProjectService.SaveProject();
@@ -171,6 +171,7 @@ using Hi.MachiningProcs;
using System.IO;
using Hi.HiNcKits;
using Hi.Milling.MillingTools;
using Microsoft.Extensions.Logging;
namespace Sample.Machining;
@@ -296,7 +297,8 @@ public static class DemoBuildMachiningProject
[STAThread]
static void Main()
{
LocalApp.AppBegin();
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample&quot;));
LocalProjectService localProjectService = new LocalProjectService();
var projectPath = &quot;C:/HiNC-Projects/NewProject/Main.hincproj&quot;;
@@ -305,6 +307,8 @@ public static class DemoBuildMachiningProject
localProjectService.LoadProject(projectPath);
MachiningProject machiningProject = localProjectService.MachiningProject;
IProgress&lt;object&gt; progress = null;
#region ConfigureMachiningToolHouse
localProjectService.MachiningToolHouse = new MachiningToolHouse()
{
@@ -348,16 +352,16 @@ public static class DemoBuildMachiningProject
IdealGeom = null,
WorkpieceGeomToFixtureBuckleTransformer = new StaticTranslation(new Vec3d(0, 0, 0)),
CuttingPara = XFactory.GenByFile&lt;ICuttingPara&gt;(
&quot;Resource/CuttingParameter&quot;, &quot;Al6061T6.mp&quot;, GenMode.Default),
&quot;Resource/CuttingParameter&quot;, &quot;Al6061T6.mp&quot;, progress),
WorkpieceMaterial = XFactory.GenByFile&lt;WorkpieceMaterial&gt;(
&quot;Resource/WorkpieceMaterial&quot;, &quot;Al6061T6.WorkpieceMaterial&quot;, GenMode.Default),
&quot;Resource/WorkpieceMaterial&quot;, &quot;Al6061T6.WorkpieceMaterial&quot;, progress),
};
#endregion
#region ConfigureMachineChain
localProjectService.MachiningChain
= XFactory.GenByFile&lt;CodeXyzabcMachineTool&gt;(
&quot;Resource&quot;, &quot;MachineTool/PMC-B1/PMC-B1.mt&quot;, GenMode.Default);
&quot;Resource&quot;, &quot;MachineTool/PMC-B1/PMC-B1.mt&quot;, progress);
#endregion
machiningProject.MakeXmlSourceToFile(projectPath);
@@ -148,7 +148,7 @@ Class DemoMillingByCutterLocation
<h2 id="Sample_Machining_DemoMillingByCutterLocation_remarks">Remarks</h2>
<div class="markdown level0 remarks"><h3 id="source-code">Source Code</h3>
<pre><code class="lang-csharp" name="SampleCode">using Hi.Common;
<pre><code class="lang-csharp" name="SampleCode">using Hi.Common.Messages;
using Hi.Disp;
using Hi.Geom;
using Hi.Geom.Resolution;
@@ -157,6 +157,7 @@ using Hi.MachiningProcs;
using Hi.Numerical.Acts;
using Hi.WpfPlus.Disp;
using HiMachining.Milling;
using Microsoft.Extensions.Logging;
using System;
using System.IO;
using System.Threading.Tasks;
@@ -184,7 +185,8 @@ namespace Sample.Machining
new Cylindroid(new PairZr(-h, 18), new PairZr(0, 18))
.GenStl(new PolarResolution2d(1, MathUtil.ToRad(15))).WriteBin(stlFile_CylinderR18);
LocalApp.AppBegin();
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample.Wpf&quot;));
LocalProjectService localProjectService = new LocalProjectService();
@@ -202,8 +204,8 @@ namespace Sample.Machining
localProjectService.ClStrip.IsShowDot = true;
double resolution_mm = 0.5;
var projectDir = Path.GetDirectoryName(projectPath);
localProjectService.Workpiece.InitGeom = new StlFile(stlFile_CylinderR20, projectDir);
localProjectService.Workpiece.IdealGeom = new StlFile(stlFile_CylinderR19, projectDir);
localProjectService.WorkpieceService.InitGeom = new StlFile(stlFile_CylinderR20, projectDir);
localProjectService.WorkpieceService.IdealGeom = new StlFile(stlFile_CylinderR19, projectDir);
localProjectService.Workpiece.InitResolution = resolution_mm;
RuntimeApi runtimeApi = localProjectService.RuntimeApi;
@@ -236,7 +238,7 @@ namespace Sample.Machining
{
RunSession(projectService, resolution_mm);
Console.WriteLine($&quot;task done.&quot;);
}).ShowIfCatched(null);
}).CatchExceptions(ex =&gt; Console.WriteLine(ex));
#region Create and Run WPF Application
Application app = new Application
@@ -284,7 +286,7 @@ namespace Sample.Machining
}
static bool IsDifferenceAceptable(LocalProjectService localProjectService, double diffLimit)
{
foreach (var attachment in localProjectService.Workpiece.DiffAttachmentBag)
foreach (var attachment in localProjectService.WorkpieceService.DiffAttachmentBag)
{
if (double.IsNaN(attachment.Diff) || Math.Abs(attachment.Diff) &gt; diffLimit)
{
@@ -158,6 +158,7 @@ using Hi.Common.FileLines;
using System.Windows;
using Hi.MachiningSteps;
using Hi.HiNcKits;
using Microsoft.Extensions.Logging;
namespace Sample.Machining
{
@@ -175,7 +176,8 @@ namespace Sample.Machining
[STAThread]
static void Main(string[] args)
{
LocalApp.AppBegin();
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample.Wpf&quot;));
LocalProjectService localProjectService = new LocalProjectService();
#region Load Machining Project
@@ -184,10 +186,11 @@ namespace Sample.Machining
localProjectService.LoadProject(projectPath);
MachiningProject machiningProject = localProjectService.MachiningProject;
localProjectService.RuntimeApi.MachiningStepSelected += (MachiningStep step) =&gt;
localProjectService.RuntimeApi.SessionStepSelected += (MachiningStep step) =&gt;
{
var sourceCommand = step.SourceCommand;
Console.WriteLine($&quot;Step Selected: MRR = {step.Mrr_mm3ds} At \&quot;{sourceCommand?.FilePath}\&quot; (Line {sourceCommand?.GetLineNo()}) \&quot;{sourceCommand?.Line}\&quot;&quot;);
var indexedFileLine = sourceCommand.GetSentence().FirstIndexedFileLine;
Console.WriteLine($&quot;Step Selected: MRR = {step.Mrr_mm3ds} At \&quot;{indexedFileLine?.FilePath}\&quot; (Line {indexedFileLine?.GetLineNo()}) \&quot;{indexedFileLine?.Line}\&quot;&quot;);
};
localProjectService.PacePlayer.Start();
#endregion
@@ -156,6 +156,7 @@ execute NC files, and properly manage project resources using
using Hi.Common.Messages;
using Hi.HiNcKits;
using Hi.MachiningProcs;
using Microsoft.Extensions.Logging;
using System;
using System.IO;
@@ -175,7 +176,8 @@ public static class DemoUseMachiningProject
{
static void Main()
{
LocalApp.AppBegin();
using var loggerFactory = Microsoft.Extensions.Logging.LoggerFactory.Create(b =&gt; b.AddConsole());
LocalApp.AppBegin(loggerFactory.CreateLogger(&quot;Hi.Sample&quot;));
LocalProjectService localProjectService = new LocalProjectService();
#region ProjectLoading
@@ -202,10 +204,10 @@ public static class DemoUseMachiningProject
};
Console.WriteLine($&quot;Set machining step event.&quot;);
//show MRR.
localProjectService.RuntimeApi.MachiningStepBuilt += (preStep, curStep) =&gt;
localProjectService.RuntimeApi.SessionStepBuilt += (preStep, curStep) =&gt;
{
var sourceCommand = curStep.SourceCommand;
var indexedFileLine=sourceCommand?.GetSentence()?.IndexedFileLine;
var indexedFileLine=sourceCommand?.GetSentence()?.FirstIndexedFileLine;
if (curStep.Mrr_mm3ds &gt; 500) //show only the step that contains large MRR.
Console.WriteLine($&quot;MRR = {curStep.Mrr_mm3ds} At \&quot;{indexedFileLine?.FilePath}\&quot; (Line {indexedFileLine?.GetLineNo()}) \&quot;{indexedFileLine?.Line}\&quot;&quot;);
};
@@ -156,80 +156,79 @@ using Hi.Disp;
using Hi.Geom;
using Hi.Mech.Topo;
namespace Sample.Mech
namespace Sample.Mech;
/// &lt;summary&gt;
/// Demonstrates the creation and visualization of mechanical assemblies with kinematic linkages.
/// Shows how to build coordinate systems, establish kinematic relationships, and capture visual output.
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// ### Source Code
/// [!code-csharp[SampleCode](~/../Hi.Sample/Mech/DemoTopo1.cs)]
/// &lt;/remarks&gt;
public static class DemoTopo1
{
/// &lt;summary&gt;
/// Demonstrates the creation and visualization of mechanical assemblies with kinematic linkages.
/// Shows how to build coordinate systems, establish kinematic relationships, and capture visual output.
/// Creates a demonstration assembly with kinematic linkages.
/// Builds a mechanical assembly with multiple anchors and branches, including both static and dynamic transformations.
/// &lt;/summary&gt;
/// &lt;remarks&gt;
/// ### Source Code
/// [!code-csharp[SampleCode](~/../Hi.Sample/Mech/DemoTopo1.cs)]
/// &lt;/remarks&gt;
public static class DemoTopo1
/// &lt;returns&gt;A tuple containing the assembly and root anchor&lt;/returns&gt;
static (Asmb asmb, Anchor root) GetDemoAsmb()
{
/// &lt;summary&gt;
/// Creates a demonstration assembly with kinematic linkages.
/// Builds a mechanical assembly with multiple anchors and branches, including both static and dynamic transformations.
/// &lt;/summary&gt;
/// &lt;returns&gt;A tuple containing the assembly and root anchor&lt;/returns&gt;
static (Asmb asmb,Anchor root) GetDemoAsmb()
#region DocSite.DemoTopo1
//build coordinate systems and the assembly.
Asmb asmb = new Asmb { Name = &quot;Mech&quot; };
Anchor O = new Anchor(asmb, &quot;O&quot;);
Anchor O1 = new Anchor(asmb, &quot;O1&quot;);
Anchor X = new Anchor(asmb, &quot;X&quot;);
Anchor Z = new Anchor(asmb, &quot;Z&quot;);
Anchor B = new Anchor(asmb, &quot;B&quot;);
//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)));
//drive the dynamic transformation by single value for each branch.
brnX.Step = 200;
brnZ.Step = 100;
brnB.Step = MathUtil.ToRad(-60);
//Get and show the transform matrices relative to O.
Dictionary&lt;Anchor, Mat4d&gt; matMap = asmb.GetMat4dMap(O);
Console.WriteLine(&quot;Transform Matrix relative to O:&quot;);
foreach (KeyValuePair&lt;Anchor, Mat4d&gt; keyValue in matMap)
Console.WriteLine($&quot;{keyValue.Key.Name} : {keyValue.Value}&quot;);
#endregion
return (asmb, O);
}
/// &lt;summary&gt;
/// Captures the assembly visualization and saves it to a file.
/// Initializes the display engine, sets up the assembly visualization with an isometric view, and saves a snapshot to a bitmap file.
/// &lt;/summary&gt;
/// &lt;param name=&quot;src&quot;&gt;A tuple containing the assembly and root anchor for visualization&lt;/param&gt;
static void SnapshotToFile((Asmb asmb, Anchor root) src)
{
//all the drawing function has to call DispEngine.Init() before using.
DispEngine.Init();
DispEngine.EnableSuppressDefaultLogo = true;
using (DispEngine dispEngine = new DispEngine(
src.asmb.GetAsmbDraw(src.root)))
{
#region DocSite.DemoTopo1
//build coordinate systems and the assembly.
Asmb asmb = new Asmb { Name = &quot;Mech&quot; };
Anchor O = new Anchor(asmb, &quot;O&quot;);
Anchor O1 = new Anchor(asmb, &quot;O1&quot;);
Anchor X = new Anchor(asmb, &quot;X&quot;);
Anchor Z = new Anchor(asmb, &quot;Z&quot;);
Anchor B = new Anchor(asmb, &quot;B&quot;);
//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)));
//drive the dynamic transformation by single value for each branch.
brnX.Step = 200;
brnZ.Step = 100;
brnB.Step = MathUtil.ToRad(-60);
//Get and show the transform matrices relative to O.
Dictionary&lt;Anchor, Mat4d&gt; matMap = asmb.GetMat4dMap(O);
Console.WriteLine(&quot;Transform Matrix relative to O:&quot;);
foreach (KeyValuePair&lt;Anchor, Mat4d&gt; keyValue in matMap)
Console.WriteLine($&quot;{keyValue.Key.Name} : {keyValue.Value}&quot;);
#endregion
return (asmb,O);
dispEngine.SetViewToIsometricView();
dispEngine.Snapshot(&quot;DemoTopo1.bmp&quot;, 680, 480);
}
/// &lt;summary&gt;
/// Captures the assembly visualization and saves it to a file.
/// Initializes the display engine, sets up the assembly visualization with an isometric view, and saves a snapshot to a bitmap file.
/// &lt;/summary&gt;
/// &lt;param name=&quot;src&quot;&gt;A tuple containing the assembly and root anchor for visualization&lt;/param&gt;
static void SnapshotToFile((Asmb asmb, Anchor root) src)
{
//all the drawing function has to call DispEngine.Init() before using.
DispEngine.Init();
DispEngine.EnableSuppressDefaultLogo = true;
Console.WriteLine(&quot;Snapshot file output.&quot;);
using (DispEngine dispEngine = new DispEngine(
src.asmb.GetAsmbDraw(src.root)))
{
dispEngine.SetViewToIsometricView();
dispEngine.Snapshot(&quot;DemoTopo1.bmp&quot;, 680, 480);
}
Console.WriteLine(&quot;Snapshot file output.&quot;);
DispEngine.FinishDisp();
}
static void Main()
{
SnapshotToFile(GetDemoAsmb());
}
DispEngine.FinishDisp();
}
static void Main()
{
SnapshotToFile(GetDemoAsmb());
}
}
</code></pre></div>
@@ -27,9 +27,6 @@
<a href="Sample.Common.html" name="" title="Sample.Common">Sample.Common</a>
<ul class="nav level2">
<li>
<a href="Sample.Common.DemoMessageAndExceptionHandling.html" name="" title="DemoMessageAndExceptionHandling">DemoMessageAndExceptionHandling</a>
</li>
<li>
<a href="Sample.Common.DemoSessionMessage.html" name="" title="DemoSessionMessage">DemoSessionMessage</a>
</li>
File diff suppressed because one or more lines are too long