Path.Area: add abs_center parameter to Path.fromShapes
Set to true to enable absolute arc center mode (G90.1)
This commit is contained in:
@@ -2596,14 +2596,13 @@ static void addG0(bool verbose, Toolpath &path,
|
||||
addGCode(verbose,path,pt,next,"G0");
|
||||
}
|
||||
|
||||
static void addGArc(bool verbose,Toolpath &path,
|
||||
const gp_Pnt &pstart, const gp_Pnt &pend,
|
||||
const gp_Pnt ¢er, bool clockwise,
|
||||
double f, double &last_f)
|
||||
static void addGArc(bool verbose,bool abs_center, Toolpath &path,
|
||||
const gp_Pnt &pstart, const gp_Pnt &pend, const gp_Pnt ¢er,
|
||||
bool clockwise, double f, double &last_f)
|
||||
{
|
||||
Command cmd;
|
||||
cmd.Name = clockwise?"G2":"G3";
|
||||
if(verbose) {
|
||||
if(abs_center) {
|
||||
addParameter(verbose,cmd,"I",0.0,center.X());
|
||||
addParameter(verbose,cmd,"J",0.0,center.Y());
|
||||
addParameter(verbose,cmd,"K",0.0,center.Z());
|
||||
@@ -2664,10 +2663,8 @@ void Area::toPath(Toolpath &path, const std::list<TopoDS_Shape> &shapes,
|
||||
|
||||
// absolute mode
|
||||
addGCode(path,"G90");
|
||||
if(verbose)
|
||||
if(abs_center)
|
||||
addGCode(path,"G90.1"); // absolute center for arc move
|
||||
else
|
||||
addGCode(path,"G91.1"); // relative center for arc move
|
||||
|
||||
short currentArcPlane = arc_plane;
|
||||
if(arc_plane==ArcPlaneZX)
|
||||
@@ -2800,13 +2797,13 @@ void Area::toPath(Toolpath &path, const std::list<TopoDS_Shape> &shapes,
|
||||
if(reversed) {
|
||||
for (int i=nbPoints-1; i>=1; --i) {
|
||||
gp_Pnt pt = curve.Value(discretizer.Parameter(i));
|
||||
addGArc(verbose,path,plast,pt,center,clockwise,nf,cur_f);
|
||||
addGArc(verbose,abs_center,path,plast,pt,center,clockwise,nf,cur_f);
|
||||
plast = pt;
|
||||
}
|
||||
}else{
|
||||
for (int i=2; i<=nbPoints; i++) {
|
||||
gp_Pnt pt = curve.Value(discretizer.Parameter(i));
|
||||
addGArc(verbose,path,plast,pt,center,clockwise,nf,cur_f);
|
||||
addGArc(verbose,abs_center,path,plast,pt,center,clockwise,nf,cur_f);
|
||||
plast = pt;
|
||||
}
|
||||
}
|
||||
@@ -2817,10 +2814,10 @@ void Area::toPath(Toolpath &path, const std::list<TopoDS_Shape> &shapes,
|
||||
if(fabs(first-last)>M_PI) {
|
||||
// Split arc(circle) larger than half circle.
|
||||
gp_Pnt mid = curve.Value((last-first)*0.5+first);
|
||||
addGArc(verbose,path,plast,mid,center,clockwise,nf,cur_f);
|
||||
addGArc(verbose,abs_center,path,plast,mid,center,clockwise,nf,cur_f);
|
||||
plast = mid;
|
||||
}
|
||||
addGArc(verbose,path,plast,p,center,clockwise,nf,cur_f);
|
||||
addGArc(verbose,abs_center,path,plast,p,center,clockwise,nf,cur_f);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -228,6 +228,7 @@
|
||||
((double,feedrate,FeedRate,0.0, "Normal move feed rate", App::PropertyFloat)) \
|
||||
((double,feedrate_v,FeedRateVertical,0.0, "Vertical only (step down) move feed rate", App::PropertyFloat)) \
|
||||
((bool,verbose,Verbose,true, "If true, each motion GCode will contain full coordinate and feedrate")) \
|
||||
((bool,abs_center,AbsoluteArcCenter,false, "Use absolute arc center mode (G90.1)")) \
|
||||
AREA_PARAMS_DEFLECTION
|
||||
|
||||
/** Group of all Area configuration parameters except CArea's*/
|
||||
|
||||
Reference in New Issue
Block a user