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
17{
20};
21
23{
25 float millRadius = {};
27 float voxelSize = {};
30 float sectionStep = {};
35 float plungeLength = {};
37 float retractLength = {};
39 float plungeFeed = {};
41 float retractFeed = {};
43 float baseFeed = {};
45 float safeZ = {};
49 const AffineXf3f* xf = nullptr;
51 bool flatTool = false;
53 ProgressCallback cb = {};
54
58 float toolpathExpansion = 0.f;
59
61 Contours3f* isolines = nullptr;
63 Contours3f* startContours = nullptr;
65 std::vector<Vector3f>* startVertices = nullptr;
66
67 MeshPart* offsetMesh = nullptr;
68};
69
75
77{
79 float eps = {};
81 float maxLength = {};
83 ProgressCallback cb = {};
84};
85
87{
89 float eps = {};
91 float maxRadius = {};
93 ProgressCallback cb = {};
94};
95
96enum class MoveType
97{
98 None = -1,
99 FastLinear = 0,
100 Linear = 1,
101 ArcCW = 2,
102 ArcCCW = 3
103};
104
105enum class ArcPlane
106{
107 None = -1,
108 XY = 17,
109 XZ = 18,
110 YZ = 19
111};
112
114{
120 float feed = std::numeric_limits<float>::quiet_NaN();
122 float x = std::numeric_limits<float>::quiet_NaN();
123 float y = std::numeric_limits<float>::quiet_NaN();
124 float z = std::numeric_limits<float>::quiet_NaN();
126 Vector3f arcCenter = Vector3f::diagonal( std::numeric_limits<float>::quiet_NaN() );
127};
128
130{
134 FaceBitSet modifiedRegion;
136 std::vector<GCommand> commands;
137};
138
142
143MRVOXELS_API Expected<ToolPathResult> constantZToolPath( const MeshPart& mp, const ToolPathParams& params );
144
147
149MRVOXELS_API Expected<ToolPathResult> lacingToolPath( const MeshPart& mp, const ToolPathParams& params, Axis cutDirection );
150
155MRVOXELS_API Expected<ToolPathResult> constantCuspToolPath( const MeshPart& mp, const ConstantCuspParams& params );
156
158MRVOXELS_API std::shared_ptr<ObjectGcode> exportToolPathToGCode( const std::vector<GCommand>& commands );
159
161MRVOXELS_API Expected<void> interpolateLines( std::vector<GCommand>& commands, const LineInterpolationParams& params, Axis axis );
163MRVOXELS_API Expected<void> interpolateArcs( std::vector<GCommand>& commands, const ArcInterpolationParams& params, Axis axis );
164
168MRVOXELS_API FaceBitSet smoothSelection( Mesh& mesh, const FaceBitSet& region, float expandOffset, float shrinkOffset );
169
170}
float eps
maximal deviation from given line
Definition MRToolPath.h:79
Axis
Definition MRAxis.h:9
MRVOXELS_API Expected< ToolPathResult > constantCuspToolPath(const MeshPart &mp, const ConstantCuspParams &params)
float toolpathExpansion
Definition MRToolPath.h:58
float safeZ
z-coordinate of plane where tool can move in any direction without touching the object
Definition MRToolPath.h:45
Contours3f * isolines
optional output, stores isolines without transits
Definition MRToolPath.h:61
float y
Definition MRToolPath.h:123
float critTransitionLength
Definition MRToolPath.h:33
float sectionStep
Definition MRToolPath.h:30
MeshPart * offsetMesh
Definition MRToolPath.h:67
std::vector< GCommand > commands
constains type of movement and its feed
Definition MRToolPath.h:136
float baseFeed
speed of regular milling
Definition MRToolPath.h:43
float x
coordinates of destination point
Definition MRToolPath.h:122
ArcPlane arcPlane
Place for comment.
Definition MRToolPath.h:118
BypassDirection
Definition MRToolPath.h:17
float retractFeed
speed of slow movement up
Definition MRToolPath.h:41
BypassDirection bypassDir
which direction isolines or sections should be passed in
Definition MRToolPath.h:47
float maxRadius
maximal radius of the arc
Definition MRToolPath.h:91
ProgressCallback cb
callback for reporting on progress
Definition MRToolPath.h:83
float maxLength
maximal length of the line
Definition MRToolPath.h:81
Contours3f * startContours
optional output, polyline containing start vertices for isolines
Definition MRToolPath.h:63
MRVOXELS_API std::shared_ptr< ObjectGcode > exportToolPathToGCode(const std::vector< GCommand > &commands)
generates G-Code for milling tool
tl::expected< T, E > Expected
Definition MRExpected.h:31
float eps
maximal deviation of arc from given path
Definition MRToolPath.h:89
float voxelSize
size of voxel needed to offset mesh
Definition MRToolPath.h:27
float plungeLength
when the mill is moving down, it will be slowed down in this distance from mesh
Definition MRToolPath.h:35
float retractLength
when the mill is moving up, it will be slowed down in this distance from mesh
Definition MRToolPath.h:37
MoveType
Definition MRToolPath.h:97
MRVOXELS_API Expected< void > interpolateLines(std::vector< GCommand > &commands, const LineInterpolationParams &params, Axis axis)
interpolates several points lying on the same straight line with one move
FaceBitSet modifiedRegion
selected region projected from the original mesh to the offset
Definition MRToolPath.h:134
float plungeFeed
speed of slow movement down
Definition MRToolPath.h:39
MRVOXELS_API Expected< void > interpolateArcs(std::vector< GCommand > &commands, const ArcInterpolationParams &params, Axis axis)
interpolates given path with arcs
MoveType type
type of command GX (G0, G1, etc). By default - G1
Definition MRToolPath.h:116
float millRadius
radius of the milling tool
Definition MRToolPath.h:25
ProgressCallback cb
callback for reporting on progress
Definition MRToolPath.h:93
ProgressCallback cb
callback for reporting on progress
Definition MRToolPath.h:53
MRVOXELS_API FaceBitSet smoothSelection(Mesh &mesh, const FaceBitSet &region, float expandOffset, float shrinkOffset)
Vector3f arcCenter
if moveType is ArcCW or ArcCCW center of the arc shoult be specified
Definition MRToolPath.h:126
float feed
feedrate for move
Definition MRToolPath.h:120
bool flatTool
if true then a tool path for a flat milling tool will be generated
Definition MRToolPath.h:51
std::vector< Vector3f > * startVertices
start vertices on the offset mesh used for calcutating isolines
Definition MRToolPath.h:65
ArcPlane
Definition MRToolPath.h:106
Mesh modifiedMesh
mesh after fixing undercuts and offset
Definition MRToolPath.h:132
bool fromCenterToBoundary
if true isolines will be processed from center point to the boundary (usually it means from up to dow...
Definition MRToolPath.h:73
MRVOXELS_API Expected< ToolPathResult > constantZToolPath(const MeshPart &mp, const ToolPathParams &params)
float z
Definition MRToolPath.h:124
MRVOXELS_API Expected< ToolPathResult > lacingToolPath(const MeshPart &mp, const ToolPathParams &params, Axis cutDirection)
Slices are built along the axis defined by cutDirection argument (can be Axis::X or Axis::Y)
const AffineXf3f * xf
mesh can be transformed using xf parameter
Definition MRToolPath.h:49
@ 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
Definition MRToolPath.h:87
Definition MRToolPath.h:71
Definition MRToolPath.h:114
Definition MRToolPath.h:77
Definition MRMesh.h:23
Definition MRToolPath.h:23
Definition MRToolPath.h:130