Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Concatenate Toolpath Modifier #224

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions noether_gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ qt5_wrap_cpp(${PROJECT_NAME}_widget_mocs
# Tool Path Modifiers
include/${PROJECT_NAME}/widgets/tool_path_modifiers/circular_lead_in_modifier_widget.h
include/${PROJECT_NAME}/widgets/tool_path_modifiers/circular_lead_out_modifier_widget.h
include/${PROJECT_NAME}/widgets/tool_path_modifiers/concatenate_modifier_widget.h
include/${PROJECT_NAME}/widgets/tool_path_modifiers/direction_of_travel_orientation_modifier_widget.h
include/${PROJECT_NAME}/widgets/tool_path_modifiers/fixed_orientation_modifier_widget.h
include/${PROJECT_NAME}/widgets/tool_path_modifiers/moving_average_orientation_smoothing_modifier_widget.h
Expand Down Expand Up @@ -82,6 +83,7 @@ add_library(${PROJECT_NAME} SHARED
# Tool Path Modifiers
src/widgets/tool_path_modifiers/circular_lead_in_modifier_widget.cpp
src/widgets/tool_path_modifiers/circular_lead_out_modifier_widget.cpp
src/widgets/tool_path_modifiers/concatenate_modifier_widget.cpp
src/widgets/tool_path_modifiers/direction_of_travel_orientation_modifier_widget.cpp
src/widgets/tool_path_modifiers/fixed_orientation_modifier_widget.cpp
src/widgets/tool_path_modifiers/moving_average_orientation_smoothing_modifier_widget.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include <noether_gui/widgets.h>

#include <noether_tpp/core/tool_path_modifier.h>

namespace noether
{
struct ConcatenateModifierWidget : public ToolPathModifierWidget
{
Q_OBJECT
public:
using ToolPathModifierWidget::ToolPathModifierWidget;

ToolPathModifier::ConstPtr create() const override;
};

} // namespace noether
4 changes: 4 additions & 0 deletions noether_gui/src/plugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
// Tool Path Modifiers
#include <noether_gui/widgets/tool_path_modifiers/circular_lead_in_modifier_widget.h>
#include <noether_gui/widgets/tool_path_modifiers/circular_lead_out_modifier_widget.h>
#include <noether_gui/widgets/tool_path_modifiers/concatenate_modifier_widget.h>
#include <noether_gui/widgets/tool_path_modifiers/direction_of_travel_orientation_modifier_widget.h>
#include <noether_gui/widgets/tool_path_modifiers/fixed_orientation_modifier_widget.h>
#include <noether_gui/widgets/tool_path_modifiers/moving_average_orientation_smoothing_modifier_widget.h>
Expand Down Expand Up @@ -97,6 +98,8 @@ using LinearApproachToolPathModifierWidgetPlugin =
using LinearDepartureToolPathModifierWidgetPlugin =
WidgetPluginImpl<LinearDepartureToolPathModifierWidget, ToolPathModifierWidget>;

using ConcatenateModifierWidgetPlugin = WidgetPluginImpl<ConcatenateModifierWidget, ToolPathModifierWidget>;

// Raster Tool Path Planners
struct PlaneSlicerRasterPlannerWidgetPlugin : ToolPathPlannerWidgetPlugin
{
Expand Down Expand Up @@ -146,6 +149,7 @@ EXPORT_TOOL_PATH_MODIFIER_WIDGET_PLUGIN(noether::CircularLeadInToolPathModifierW
EXPORT_TOOL_PATH_MODIFIER_WIDGET_PLUGIN(noether::CircularLeadOutToolPathModifierWidgetPlugin, CircularLeadOutModifier)
EXPORT_TOOL_PATH_MODIFIER_WIDGET_PLUGIN(noether::LinearApproachToolPathModifierWidgetPlugin, LinearApproachModifier)
EXPORT_TOOL_PATH_MODIFIER_WIDGET_PLUGIN(noether::LinearDepartureToolPathModifierWidgetPlugin, LinearDepartureModifier)
EXPORT_TOOL_PATH_MODIFIER_WIDGET_PLUGIN(noether::ConcatenateModifierWidgetPlugin, ConcatenateModifier)

EXPORT_TPP_WIDGET_PLUGIN(noether::PlaneSlicerRasterPlannerWidgetPlugin, PlaneSlicerRasterPlanner)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include <noether_gui/widgets/tool_path_modifiers/concatenate_modifier_widget.h>

#include <noether_tpp/tool_path_modifiers/concatenate_modifier.h>

namespace noether
{
ToolPathModifier::ConstPtr ConcatenateModifierWidget::create() const { return std::make_unique<ConcatenateModifier>(); }

} // namespace noether
1 change: 1 addition & 0 deletions noether_tpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ add_library(${PROJECT_NAME} SHARED
src/tool_path_modifiers/circular_lead_in_modifier.cpp
src/tool_path_modifiers/circular_lead_out_modifier.cpp
src/tool_path_modifiers/compound_modifier.cpp
src/tool_path_modifiers/concatenate_modifier.cpp
src/tool_path_modifiers/direction_of_travel_orientation_modifier.cpp
src/tool_path_modifiers/fixed_orientation_modifier.cpp
src/tool_path_modifiers/moving_average_orientation_smoothing_modifier.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#pragma once

#include <noether_tpp/core/tool_path_modifier.h>

namespace noether
{
/**
* @brief Combines existing toolpaths into one toolpath
* @details A RasterOrganizationModifier is first used to organize the tool paths into a raster pattern. The tool paths
* are then looped through to create a single concatenated toolpath.
DavidSpielman marked this conversation as resolved.
Show resolved Hide resolved
*/
struct ConcatenateModifier : OneTimeToolPathModifier
{
using OneTimeToolPathModifier::OneTimeToolPathModifier;

ToolPaths modify(ToolPaths) const override;
};

} // namespace noether
32 changes: 32 additions & 0 deletions noether_tpp/src/tool_path_modifiers/concatenate_modifier.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <noether_tpp/tool_path_modifiers/concatenate_modifier.h>
#include <noether_tpp/tool_path_modifiers/raster_organization_modifier.h>
#include <noether_tpp/utils.h>

#include <numeric>

namespace noether
{
ToolPaths ConcatenateModifier::modify(ToolPaths tool_paths) const
{
// Create a raster
RasterOrganizationModifier raster;
tool_paths = raster.modify(tool_paths);
DavidSpielman marked this conversation as resolved.
Show resolved Hide resolved
ToolPath combined_tool_path;
ToolPaths combined_tool_paths;
DavidSpielman marked this conversation as resolved.
Show resolved Hide resolved

// Loop through the existing toolpaths to create a single combined toolpath
for (std::size_t i = 0; i < tool_paths.size(); i += 1)
{
ToolPath& tool_path = tool_paths.at(i);

for (ToolPathSegment& segment : tool_path)
{
combined_tool_path.push_back(segment);
}
}
DavidSpielman marked this conversation as resolved.
Show resolved Hide resolved
combined_tool_paths.push_back(combined_tool_path);

return combined_tool_paths;
DavidSpielman marked this conversation as resolved.
Show resolved Hide resolved
}

} // namespace noether
Loading