我会尽我所能回答,但你应该考虑定义你想要实现的范围,即如果你只想要一个坐标系或一个 UI 来配合它,比如 UGS。
仅制作坐标系的最佳方法是定义您需要的所有数据,例如位置、旋转、进给、快速、偏移等。然后将所有这些数据包装在一个类中以用于机器状态,并提供帮助您的方法操作数据。
例子
public struct Vector3
{
public float x,y,z
}
public struct Rotation
{
public float x,y,z //Or whatever your machine uses, the 5 axis at my work is v,w for rotation.
//I recommend leaving it as x,y,z though cause it will make it more robust as you
//can use the same code on different machines by interpreting the values differently later on.
//Alternatively you could use a Quaternion if need but most machines interprat eular angles just fine without gimble lock.
}
//only if you need scale. stay away from this if you can help it, it will make zeroing harder because you will have to use matrix math to make the position and rotation work properly with it(I could be wrong about that though).
public struct Scale
{
public float x,y,z
}
public struct Transform
{
public Vector3 position;
public Rotation rotation;
}
//then create a class to define the state of the machine.
public class MachineState
{
public bool rapid = false;
public bool feed = false;
public bool flood = false;
public bool mist = false;
public Transform transform;
//An example of a method to manipulate the data.
public Vector3 CalculateOffset (Vector3 offsetPosition, Vector3 offset)
{
//Add your offset logic here.
}
}
如果您也需要 UI,那么我建议您使用 .net MUAI 或 Windows 窗体,它们中的任何一个都应该可以直接创建一个 UI 来使用这些数据,以及添加 3D 视图和您能想到的任何其他内容的。
.Net MAUI:
https://docs.microsoft.com/en-us/dotnet/maui/what-is-maui
Windows 窗体:
https://docs.microsoft.com/en-us/dotnet/desktop/winforms/?view=netdesktop-5.0
我希望这能帮助你走上正确的道路,但也对我所说的一切持保留态度,因为我以前从未编写过操纵 cnc 机器的程序。
我只是对它们进行操作和数据分析。不过,我确实对坐标系有很多了解,因为我曾经是一名游戏开发人员。