Gcode: support 6 axis machine (work line ncviewer.com)#1403
Conversation
source/MRMesh/MRGcodeProcessor.h
Outdated
| // settings | ||
| enum class RotationParameterName | ||
| { | ||
| None = -1, | ||
| A, | ||
| B, | ||
| C, | ||
| Count | ||
| }; | ||
| MRMESH_API void setRotationParams( RotationParameterName paramName, const Vector3f& rotationAxis ); | ||
| MRMESH_API Vector3f getRotationParams( RotationParameterName paramName ); | ||
| MRMESH_API bool setRotationOrder( std::array<RotationParameterName, 3> rotationAxisOrder ); | ||
| MRMESH_API std::array<RotationParameterName, 3> getRotationOrder(); |
There was a problem hiding this comment.
mb make single structure with gcode axis name to real axis map, and order, and one getter setter for it
There was a problem hiding this comment.
it's possible, but i don't see serious advantages
There was a problem hiding this comment.
I think it will be just more friendly interface
There was a problem hiding this comment.
do we need translation order too? mb some devices has moving axis (that means that translation is applied before rotation)
There was a problem hiding this comment.
in current version it has no effect (will added in next PR)
source/MRMesh/MRGcodeProcessor.cpp
Outdated
| GcodeProcessor::GcodeProcessor() | ||
| { | ||
| rotationAxes_ = { Vector3f::minusX(), Vector3f::minusY(), Vector3f::plusZ() }; | ||
| setRotationOrder( { RotationParameterName::A, RotationParameterName::B, RotationParameterName::C } ); | ||
| } | ||
|
|
There was a problem hiding this comment.
why do in constructor, mb just initialize it in class body?
source/MRMesh/MRGcodeProcessor.cpp
Outdated
| const bool validParamName = intParamName >= int( RotationParameterName::A ) && intParamName < int( RotationParameterName::Count ); | ||
| assert( validParamName ); | ||
| if ( !validParamName ) | ||
| return; |
There was a problem hiding this comment.
looks like excessive checks
There was a problem hiding this comment.
no, not all RotationParameterName have axis (RotationParameterName::None or Count)
source/MRMesh/MRGcodeProcessor.cpp
Outdated
| const int intParamName = int( paramName ); | ||
| const bool validParamName = intParamName >= int( RotationParameterName::A ) && intParamName < int( RotationParameterName::Count ); | ||
| assert( validParamName ); |
There was a problem hiding this comment.
assert removed. range check saved (same reason)
source/MRMesh/MRGcodeProcessor.h
Outdated
| MRMESH_API void setRotationParams( RotationParameterName paramName, const Vector3f& rotationAxis ); | ||
| MRMESH_API Vector3f getRotationParams( RotationParameterName paramName ); | ||
| MRMESH_API bool setRotationOrder( std::array<RotationParameterName, 3> rotationAxisOrder ); | ||
| MRMESH_API std::array<RotationParameterName, 3> getRotationOrder(); |
There was a problem hiding this comment.
return const ref, and make the function const
source/MRMesh/MRGcodeProcessor.h
Outdated
| MRMESH_API MoveAction processLine( const std::string_view& line ); | ||
|
|
||
| // settings | ||
| enum class RotationParameterName |
source/MRMesh/MRGcodeProcessor.h
Outdated
| }; | ||
| MRMESH_API void setRotationParams( RotationParameterName paramName, const Vector3f& rotationAxis ); | ||
| MRMESH_API Vector3f getRotationParams( RotationParameterName paramName ); | ||
| MRMESH_API bool setRotationOrder( std::array<RotationParameterName, 3> rotationAxisOrder ); |
There was a problem hiding this comment.
mb make alias?
using RotationAxisMap = std::array<RotationParameterName, size_t(RotationParameterName::Count)>;pass non-trivial args my reference
const RotationAxisMap&
source/MRMesh/MRGcodeProcessor.cpp
Outdated
| const int parameterIndex = int( rotationAxisOrder[i] ); | ||
| if ( parameterIndex < int( RotationParameterName::None ) || parameterIndex >= int( RotationParameterName::Count ) ) | ||
| { | ||
| validInput = false; | ||
| break; | ||
| } |
source/MRMesh/MRGcodeProcessor.h
Outdated
| // settings | ||
| enum class RotationAxisName | ||
| { | ||
| None = -1, |
source/MRMesh/MRGcodeProcessor.cpp
Outdated
| if ( axisIndex < 0 || axisIndex > 2 ) | ||
| continue; |
source/MRMesh/MRGcodeProcessor.cpp
Outdated
| if ( axisIndex < 0 || axisIndex > 2 ) | ||
| continue; |
No description provided.