Skip to content

Gcode: support 6 axis machine (work line ncviewer.com)#1403

Merged
ABSitf merged 5 commits intomasterfrom
i2198_settings_6_axis_machine
Jul 12, 2023
Merged

Gcode: support 6 axis machine (work line ncviewer.com)#1403
ABSitf merged 5 commits intomasterfrom
i2198_settings_6_axis_machine

Conversation

@ABSitf
Copy link
Contributor

@ABSitf ABSitf commented Jul 10, 2023

No description provided.

Comment on lines +53 to +65
// 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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb make single structure with gcode axis name to real axis map, and order, and one getter setter for it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's possible, but i don't see serious advantages

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be just more friendly interface

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need translation order too? mb some devices has moving axis (that means that translation is applied before rotation)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in current version it has no effect (will added in next PR)

Comment on lines +17 to +22
GcodeProcessor::GcodeProcessor()
{
rotationAxes_ = { Vector3f::minusX(), Vector3f::minusY(), Vector3f::plusZ() };
setRotationOrder( { RotationParameterName::A, RotationParameterName::B, RotationParameterName::C } );
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do in constructor, mb just initialize it in class body?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines +84 to +87
const bool validParamName = intParamName >= int( RotationParameterName::A ) && intParamName < int( RotationParameterName::Count );
assert( validParamName );
if ( !validParamName )
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like excessive checks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, not all RotationParameterName have axis (RotationParameterName::None or Count)

Comment on lines +101 to +103
const int intParamName = int( paramName );
const bool validParamName = intParamName >= int( RotationParameterName::A ) && intParamName < int( RotationParameterName::Count );
assert( validParamName );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like escessive test

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assert removed. range check saved (same reason)

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();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return const ref, and make the function const

MRMESH_API MoveAction processLine( const std::string_view& line );

// settings
enum class RotationParameterName
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb RotationAxisName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

};
MRMESH_API void setRotationParams( RotationParameterName paramName, const Vector3f& rotationAxis );
MRMESH_API Vector3f getRotationParams( RotationParameterName paramName );
MRMESH_API bool setRotationOrder( std::array<RotationParameterName, 3> rotationAxisOrder );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mb make alias?

using RotationAxisMap = std::array<RotationParameterName, size_t(RotationParameterName::Count)>;

pass non-trivial args my reference

const RotationAxisMap& 

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines +120 to +125
const int parameterIndex = int( rotationAxisOrder[i] );
if ( parameterIndex < int( RotationParameterName::None ) || parameterIndex >= int( RotationParameterName::Count ) )
{
validInput = false;
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excessive checks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

// settings
enum class RotationAxisName
{
None = -1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need None?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines +540 to +541
if ( axisIndex < 0 || axisIndex > 2 )
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can it be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

Comment on lines +503 to +504
if ( axisIndex < 0 || axisIndex > 2 )
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can it be?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed

@ABSitf ABSitf merged commit 1bba226 into master Jul 12, 2023
@ABSitf ABSitf deleted the i2198_settings_6_axis_machine branch July 12, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants