Skip to content

Commit

Permalink
feat: add laser option skipping depth management
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Aug 10, 2024
1 parent 3ed5751 commit f7ff0f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/exporter/renderer/renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Renderer
private:
const config::Tools::Tool &m_tool;
const config::Profiles::Profile &m_profile;
const bool m_laser;
const float m_depthPerCut;
const float m_maximumStartDepth;
const float m_depthToRetract;
Expand Down Expand Up @@ -50,7 +51,6 @@ class Renderer

void render(const geometry::Polyline &polyline, const model::PathSettings &settings, geometry::CuttingDirection cuttingDirection) const
{
const float maxDepth = settings.depth();
const float intensity = settings.intensity();
const float planeFeedRate = settings.planeFeedRate();
const float depthFeedRate = settings.depthFeedRate();
Expand All @@ -59,11 +59,17 @@ class Renderer

m_visitor.startOperation((*iterator).start(), intensity);

const float startDepth = std::min(m_maximumStartDepth, maxDepth);
for (float depth = startDepth; depth < maxDepth + m_depthPerCut; depth += m_depthPerCut, ++iterator) {
const float boundDepth = std::fminf(depth, maxDepth);
if (m_laser) {
m_visitor.processPathAtDepth(*iterator, 0.0f, planeFeedRate, depthFeedRate);
}
else {
const float maxDepth = settings.depth();
const float startDepth = std::min(m_maximumStartDepth, maxDepth);
for (float depth = startDepth; depth < maxDepth + m_depthPerCut; depth += m_depthPerCut, ++iterator) {
const float boundDepth = std::fminf(depth, maxDepth);

m_visitor.processPathAtDepth(*iterator, -boundDepth, planeFeedRate, depthFeedRate);
m_visitor.processPathAtDepth(*iterator, -boundDepth, planeFeedRate, depthFeedRate);
}
}

m_visitor.endOperation(m_depthToRetract);
Expand All @@ -73,9 +79,10 @@ class Renderer
explicit Renderer(const config::Tools::Tool& tool, const config::Profiles::Profile& profile, Visitor& visitor)
:m_tool(tool),
m_profile(profile),
m_laser(m_tool.general().laser()),
m_depthPerCut(m_tool.general().depthPerCut()),
m_maximumStartDepth(m_profile.cut().passAtZeroDepth() ? 0.0f : m_depthPerCut),
m_depthToRetract(m_tool.general().retractDepth()),
m_depthToRetract(m_laser ? 0.0f : m_tool.general().retractDepth()),
m_visitor(visitor)
{
}
Expand Down
1 change: 1 addition & 0 deletions template/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<list name="tools">
<group name="tool">
<group name="general">
<property name="laser" type="bool" default="false"/>
<property name="radius" type="float" default="0.5"/>
<property name="depth per cut" type="float" default="1"/>
<property name="retract depth" type="float" default="1"/>
Expand Down

0 comments on commit f7ff0f1

Please sign in to comment.