MeshLib C++ Docs
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
6#include <array>
7#include <optional>
8
9namespace Json { class Value; }
10
11namespace MR
12{
13
15class MRMESH_CLASS CNCMachineSettings
16{
17public:
18 // enumeration of axes of rotation
19 enum class RotationAxisName
20 {
21 A,
22 B,
23 C
24 };
25 using RotationAxesOrder = std::vector<RotationAxisName>;
26 using RotationLimits = std::optional<Vector2f>;
27
28 static int getAxesCount() { return int( RotationAxisName::C ) + 1; }
29
30 // rotationAxis length will be more then 0.01
31 MRMESH_API void setRotationAxis( RotationAxisName paramName, const Vector3f& rotationAxis );
32 MRMESH_API const Vector3f& getRotationAxis( RotationAxisName paramName ) const;
33 // rotationLimits = {min, max}
34 // valid range -180 <= min < max <= 180
35 MRMESH_API void setRotationLimits( RotationAxisName paramName, const RotationLimits& rotationLimits );
36 MRMESH_API const RotationLimits& getRotationLimits( RotationAxisName paramName ) const;
37 // duplicated values will be removed (ABAAC - > ABC)
38 MRMESH_API void setRotationOrder( const RotationAxesOrder& rotationAxesOrder );
39 const RotationAxesOrder& getRotationOrder() const { return rotationAxesOrder_; }
40 // set feedrate idle. valid range - [0, 100000]
41 // 0 - feedrate idle set as maximum feedrate on any action, or 100 if feedrate is not set in any action
42 MRMESH_API void setFeedrateIdle( float feedrateIdle );
43 float getFeedrateIdle() const { return feedrateIdle_; }
44 void setHomePosition( const Vector3f& homePosition ) { homePosition_ = homePosition; }
45 const Vector3f& getHomePosition() const { return homePosition_; }
46
47 MRMESH_API bool operator==( const CNCMachineSettings& rhs );
48 bool operator!=( const CNCMachineSettings& rhs ) { return !(*this == rhs); }
49
50 MRMESH_API Json::Value saveToJson() const;
51 MRMESH_API bool loadFromJson( const Json::Value& jsonValue );
52
53private:
54 // direction of axes around which the rotation occurs A, B, C
55 std::array<Vector3f, 3> rotationAxes_ = { Vector3f::minusX(), Vector3f::minusY(), Vector3f::plusZ() };
56 // rotation limits
57 std::array<RotationLimits, 3> rotationLimits_;
58 // order of application of rotations
59 RotationAxesOrder rotationAxesOrder_ = { RotationAxisName::A, RotationAxisName::B, RotationAxisName::C };
60 // feedrate idle. 0 - feedrate idle set as maximum feedrate on any action, or 100 if feedrate is not set in any action
61 float feedrateIdle_ = 10000.f;
62 Vector3f homePosition_;
63};
64
65}
constexpr bool operator==(ImVec2 a, ImVec2 b)
Definition MRImGuiVectorOperators.h:117
#define MRMESH_API
Definition MRMeshFwd.h:80
#define MRMESH_CLASS
Definition MRMeshFwd.h:87
Definition MRCameraOrientationPlugin.h:8
bool operator!=(const Color &a, const Color &b)
Definition MRMesh/MRColor.h:101