MeshLib Documentation
Loading...
Searching...
No Matches
MRCNCMachineSettings.h
Go to the documentation of this file.
1#pragma once
2#include "MRMeshFwd.h"
3#include "MRVector3.h"
4#include "MRVector2.h"
5#include "MRPch/MRJson.h"
6#include <array>
7#include <optional>
8
9namespace MR
10{
11
14{
15public:
16 // enumeration of axes of rotation
18 {
19 A,
20 B,
21 C
22 };
23 using RotationAxesOrder = std::vector<RotationAxisName>;
24 using RotationLimits = std::optional<Vector2f>;
25
26 static int getAxesCount() { return int( RotationAxisName::C ) + 1; }
27
28 // rotationAxis length will be more then 0.01
29 MRMESH_API void setRotationAxis( RotationAxisName paramName, const Vector3f& rotationAxis );
30 MRMESH_API const Vector3f& getRotationAxis( RotationAxisName paramName ) const;
31 // rotationLimits = {min, max}
32 // valid range -180 <= min < max <= 180
33 MRMESH_API void setRotationLimits( RotationAxisName paramName, const RotationLimits& rotationLimits );
35 // duplicated values will be removed (ABAAC - > ABC)
36 MRMESH_API void setRotationOrder( const RotationAxesOrder& rotationAxesOrder );
37 const RotationAxesOrder& getRotationOrder() const { return rotationAxesOrder_; }
38 // set feedrate idle. valid range - [0, 100000]
39 // 0 - feedrate idle set as maximum feedrate on any action, or 100 if feedrate is not set in any action
40 MRMESH_API void setFeedrateIdle( float feedrateIdle );
41 float getFeedrateIdle() const { return feedrateIdle_; }
42 void setHomePosition( const Vector3f& homePosition ) { homePosition_ = homePosition; }
43 const Vector3f& getHomePosition() const { return homePosition_; }
44
46 bool operator!=( const CNCMachineSettings& rhs ) { return !(*this == rhs); }
47
48 MRMESH_API Json::Value saveToJson() const;
49 MRMESH_API bool loadFromJson( const Json::Value& jsonValue );
50
51private:
52 // direction of axes around which the rotation occurs A, B, C
53 std::array<Vector3f, 3> rotationAxes_ = { Vector3f::minusX(), Vector3f::minusY(), Vector3f::plusZ() };
54 // rotation limits
55 std::array<RotationLimits, 3> rotationLimits_;
56 // order of application of rotations
57 RotationAxesOrder rotationAxesOrder_ = { RotationAxisName::A, RotationAxisName::B, RotationAxisName::C };
58 // feedrate idle. 0 - feedrate idle set as maximum feedrate on any action, or 100 if feedrate is not set in any action
59 float feedrateIdle_ = 10000.f;
60 Vector3f homePosition_;
61};
62
63}
#define MRMESH_API
Definition MRMesh/MRMeshFwd.h:46
#define MRMESH_CLASS
Definition MRMesh/MRMeshFwd.h:50
class with CNC machine emulation settings
Definition MRCNCMachineSettings.h:14
bool operator!=(const CNCMachineSettings &rhs)
Definition MRCNCMachineSettings.h:46
static int getAxesCount()
Definition MRCNCMachineSettings.h:26
MRMESH_API bool operator==(const CNCMachineSettings &rhs)
const Vector3f & getHomePosition() const
Definition MRCNCMachineSettings.h:43
MRMESH_API const Vector3f & getRotationAxis(RotationAxisName paramName) const
float getFeedrateIdle() const
Definition MRCNCMachineSettings.h:41
const RotationAxesOrder & getRotationOrder() const
Definition MRCNCMachineSettings.h:37
MRMESH_API void setRotationOrder(const RotationAxesOrder &rotationAxesOrder)
RotationAxisName
Definition MRCNCMachineSettings.h:18
std::vector< RotationAxisName > RotationAxesOrder
Definition MRCNCMachineSettings.h:23
MRMESH_API void setRotationLimits(RotationAxisName paramName, const RotationLimits &rotationLimits)
MRMESH_API void setFeedrateIdle(float feedrateIdle)
MRMESH_API const RotationLimits & getRotationLimits(RotationAxisName paramName) const
MRMESH_API bool loadFromJson(const Json::Value &jsonValue)
void setHomePosition(const Vector3f &homePosition)
Definition MRCNCMachineSettings.h:42
MRMESH_API Json::Value saveToJson() const
std::optional< Vector2f > RotationLimits
Definition MRCNCMachineSettings.h:24
MRMESH_API void setRotationAxis(RotationAxisName paramName, const Vector3f &rotationAxis)
Definition MRCameraOrientationPlugin.h:8