MeshLib C++ Docs
Loading...
Searching...
No Matches
MRToolPath.h
Go to the documentation of this file.
1#pragma once
2#include "MRVoxelsFwd.h"
3
4#include "MRMesh/MRAxis.h"
5#include "MRMesh/MRMesh.h"
6#include "MRMesh/MRPolyline.h"
8#include "MRMesh/MRExpected.h"
9
10namespace MR
11{
14
15
22
25{
27 float millRadius = {};
29 float voxelSize = {};
32 float sectionStep = {};
37 float plungeLength = {};
39 float retractLength = {};
41 float plungeFeed = {};
43 float retractFeed = {};
45 float baseFeed = {};
47 float safeZ = {};
51 const AffineXf3f* xf = nullptr;
53 bool flatTool = false;
56
59 float toolpathExpansion = 0.f;
60
62 Contours3f* isolines = nullptr;
66 std::vector<Vector3f>* startVertices = nullptr;
67
69 MeshPart* offsetMesh = nullptr;
70};
71
78
81{
83 float eps = {};
85 float maxLength = {};
88};
89
92{
94 float eps = {};
96 float maxRadius = {};
99};
100
102enum class MoveType
103{
104 None = -1,
106 Linear = 1,
107 ArcCW = 2,
109};
110
112enum class ArcPlane
113{
114 None = -1,
115 XY = 17,
116 XZ = 18,
117 YZ = 19
118};
119
122{
128 float feed = std::numeric_limits<float>::quiet_NaN();
130 float x = std::numeric_limits<float>::quiet_NaN();
131 float y = std::numeric_limits<float>::quiet_NaN();
132 float z = std::numeric_limits<float>::quiet_NaN();
134 Vector3f arcCenter = Vector3f::diagonal( std::numeric_limits<float>::quiet_NaN() );
135};
136
139{
143 FaceBitSet modifiedRegion;
145 std::vector<GCommand> commands;
146};
147
155
162MRVOXELS_API Expected<ToolPathResult> lacingToolPath( const MeshPart& mp, const ToolPathParams& params, Axis cutDirection );
163
172
176MRVOXELS_API std::shared_ptr<ObjectGcode> exportToolPathToGCode( const std::vector<GCommand>& commands );
177
183MRVOXELS_API Expected<void> interpolateLines( std::vector<GCommand>& commands, const LineInterpolationParams& params, Axis axis );
184
190MRVOXELS_API Expected<void> interpolateArcs( std::vector<GCommand>& commands, const ArcInterpolationParams& params, Axis axis );
191
199MRVOXELS_API FaceBitSet smoothSelection( Mesh& mesh, const FaceBitSet& region, float expandOffset, float shrinkOffset );
200
201}
#define MRVOXELS_API
see explanation in MRMesh/MRMeshFwd.h
Definition MRVoxelsFwd.h:14
std::function< bool(float)> ProgressCallback
Definition MRMeshFwd.h:758
float eps
maximal deviation from given line
Definition MRToolPath.h:83
Axis
Definition MRAxis.h:9
Expected< ToolPathResult > constantCuspToolPath(const MeshPart &mp, const ConstantCuspParams &params)
float toolpathExpansion
Definition MRToolPath.h:59
float safeZ
z-coordinate of plane where tool can move in any direction without touching the object
Definition MRToolPath.h:47
Contours3f * isolines
optional output, stores isolines without transits
Definition MRToolPath.h:62
float y
Definition MRToolPath.h:131
float critTransitionLength
Definition MRToolPath.h:35
float sectionStep
Definition MRToolPath.h:32
MeshPart * offsetMesh
optional pre-computed offset mesh; if null, it will be computed internally
Definition MRToolPath.h:69
FaceBitSet smoothSelection(Mesh &mesh, const FaceBitSet &region, float expandOffset, float shrinkOffset)
std::vector< GCommand > commands
contains type of movement and its feed
Definition MRToolPath.h:145
float baseFeed
speed of regular milling
Definition MRToolPath.h:45
float x
coordinates of destination point
Definition MRToolPath.h:130
std::shared_ptr< ObjectGcode > exportToolPathToGCode(const std::vector< GCommand > &commands)
ArcPlane arcPlane
plane of the arc; only relevant when type is ArcCW or ArcCCW
Definition MRToolPath.h:126
BypassDirection
Direction in which the tool traverses each contour.
Definition MRToolPath.h:18
Expected< ToolPathResult > lacingToolPath(const MeshPart &mp, const ToolPathParams &params, Axis cutDirection)
Contours3< float > Contours3f
Definition MRMeshFwd.h:392
float retractFeed
speed of slow movement up
Definition MRToolPath.h:43
BypassDirection bypassDir
which direction isolines or sections should be passed in
Definition MRToolPath.h:49
float maxRadius
maximal radius of the arc
Definition MRToolPath.h:96
ProgressCallback cb
callback for reporting on progress
Definition MRToolPath.h:87
float maxLength
maximal length of the line
Definition MRToolPath.h:85
Contours3f * startContours
optional output, polyline containing start vertices for isolines
Definition MRToolPath.h:64
Expected< void > interpolateLines(std::vector< GCommand > &commands, const LineInterpolationParams &params, Axis axis)
tl::expected< T, E > Expected
Definition MRExpected.h:31
float eps
maximal deviation of arc from given path
Definition MRToolPath.h:94
float voxelSize
size of voxel needed to offset mesh
Definition MRToolPath.h:29
float plungeLength
when the mill is moving down, it will be slowed down in this distance from mesh
Definition MRToolPath.h:37
float retractLength
when the mill is moving up, it will be slowed down in this distance from mesh
Definition MRToolPath.h:39
MoveType
G-code move command type.
Definition MRToolPath.h:103
Expected< ToolPathResult > constantZToolPath(const MeshPart &mp, const ToolPathParams &params)
FaceBitSet modifiedRegion
selected region projected from the original mesh to the offset
Definition MRToolPath.h:143
float plungeFeed
speed of slow movement down
Definition MRToolPath.h:41
MoveType type
type of command GX (G0, G1, etc). By default - G1
Definition MRToolPath.h:124
float millRadius
radius of the milling tool
Definition MRToolPath.h:27
ProgressCallback cb
callback for reporting on progress
Definition MRToolPath.h:98
ProgressCallback cb
callback for reporting on progress
Definition MRToolPath.h:55
Vector3f arcCenter
if type is ArcCW or ArcCCW center of the arc should be specified
Definition MRToolPath.h:134
float feed
feedrate for move
Definition MRToolPath.h:128
Expected< void > interpolateArcs(std::vector< GCommand > &commands, const ArcInterpolationParams &params, Axis axis)
bool flatTool
if true then a tool path for a flat milling tool will be generated
Definition MRToolPath.h:53
std::vector< Vector3f > * startVertices
start vertices on the offset mesh used for calculating isolines
Definition MRToolPath.h:66
ArcPlane
G-code arc plane selection.
Definition MRToolPath.h:113
Mesh modifiedMesh
mesh after fixing undercuts and offset
Definition MRToolPath.h:141
bool fromCenterToBoundary
if true isolines will be processed from center point to the boundary (usually it means from up to dow...
Definition MRToolPath.h:76
float z
Definition MRToolPath.h:132
const AffineXf3f * xf
mesh can be transformed using xf parameter
Definition MRToolPath.h:51
@ CounterClockwise
Tool moves counter-clockwise around the section.
Definition MRToolPath.h:20
@ Clockwise
Tool moves clockwise around the section.
Definition MRToolPath.h:19
@ Linear
Definition MREnums.h:13
@ Linear
G1 linear interpolation at feed rate.
Definition MRToolPath.h:106
@ FastLinear
G0 rapid positioning.
Definition MRToolPath.h:105
@ ArcCW
G2 circular interpolation, clockwise.
Definition MRToolPath.h:107
@ ArcCCW
G3 circular interpolation, counter-clockwise.
Definition MRToolPath.h:108
@ XZ
G18 — XZ plane.
Definition MRToolPath.h:116
@ None
No plane selected.
Definition MRToolPath.h:114
@ XY
= 2 cause main axis is z - [2]
Definition MRVoxelPath.h:32
@ YZ
= 0 cause main axis is x - [0]
Definition MRVoxelPath.h:30
@ None
special value not to limit path in one slice
Definition MRVoxelPath.h:33
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Tolerance parameters for arc interpolation of tool path segments.
Definition MRToolPath.h:92
Tool path parameters specific to the constant-cusp strategy.
Definition MRToolPath.h:74
A single G-code move command.
Definition MRToolPath.h:122
Tolerance parameters for linear interpolation of tool path segments.
Definition MRToolPath.h:81
Definition MRMesh.h:23
Parameters shared by all tool path generation functions.
Definition MRToolPath.h:25
Result of a tool path computation.
Definition MRToolPath.h:139