add CAM helical clockwise, reverse, and entry params
This commit is contained in:
parent
0beeb78ace
commit
b467984222
5 changed files with 94 additions and 8 deletions
|
|
@ -65,6 +65,10 @@
|
||||||
"camHelicalForceStartAngle": false,
|
"camHelicalForceStartAngle": false,
|
||||||
"camHelicalStartAngle": 0,
|
"camHelicalStartAngle": 0,
|
||||||
"camHelicalOffsetOverride": 0,
|
"camHelicalOffsetOverride": 0,
|
||||||
|
"camHelicalEntry": false,
|
||||||
|
"camHelicalEntryOffset":0,
|
||||||
|
"camHelicalReverse": false,
|
||||||
|
"camHelicalClockwise": true,
|
||||||
"camFlipAxis": "X",
|
"camFlipAxis": "X",
|
||||||
"camFlipOther": "",
|
"camFlipOther": "",
|
||||||
"camTabsWidth": 20,
|
"camTabsWidth": 20,
|
||||||
|
|
|
||||||
|
|
@ -529,6 +529,10 @@ export const conf = {
|
||||||
camHelicalForceStartAngle: false,
|
camHelicalForceStartAngle: false,
|
||||||
camHelicalStartAngle: 0,
|
camHelicalStartAngle: 0,
|
||||||
camHelicalOffsetOverride: 0,
|
camHelicalOffsetOverride: 0,
|
||||||
|
camHelicalEntry: false,
|
||||||
|
camHelicalEntryOffset:0,
|
||||||
|
camHelicalReverse: false,
|
||||||
|
camHelicalClockwise: true,
|
||||||
camFlipAxis: "X",
|
camFlipAxis: "X",
|
||||||
camFlipOther: "",
|
camFlipOther: "",
|
||||||
camLaserEnable: ["M321"],
|
camLaserEnable: ["M321"],
|
||||||
|
|
|
||||||
|
|
@ -535,6 +535,10 @@ export function createPopOps() {
|
||||||
finish: 'camHelicalBottomFinish',
|
finish: 'camHelicalBottomFinish',
|
||||||
startAng:'camHelicalStartAngle',
|
startAng:'camHelicalStartAngle',
|
||||||
offOver: 'camHelicalOffsetOverride',
|
offOver: 'camHelicalOffsetOverride',
|
||||||
|
entry: 'camHelicalEntry',
|
||||||
|
entryOffset: 'camHelicalEntryOffset',
|
||||||
|
reverse: 'camHelicalReverse',
|
||||||
|
clockwise:'camHelicalClockwise',
|
||||||
thru: 'camHelicalThru',
|
thru: 'camHelicalThru',
|
||||||
forceStartAng:'camHelicalForceStartAngle',
|
forceStartAng:'camHelicalForceStartAngle',
|
||||||
fromTop: 'camHelicalFromStockTop',
|
fromTop: 'camHelicalFromStockTop',
|
||||||
|
|
@ -549,7 +553,12 @@ export function createPopOps() {
|
||||||
startAng: UC.newInput(LANG.ch_stra_s, {title:LANG.ch_stra_l, convert:UC.toDegsFloat, bound:UC.bound(-360,360),show:() => env.poppedRec.forceStartAng}),
|
startAng: UC.newInput(LANG.ch_stra_s, {title:LANG.ch_stra_l, convert:UC.toDegsFloat, bound:UC.bound(-360,360),show:() => env.poppedRec.forceStartAng}),
|
||||||
offOver: UC.newInput(LANG.cc_offd_s, {title:LANG.cc_offd_l, convert:UC.toFloat, units:true, bound:UC.bound(0,Infinity)}),
|
offOver: UC.newInput(LANG.cc_offd_s, {title:LANG.cc_offd_l, convert:UC.toFloat, units:true, bound:UC.bound(0,Infinity)}),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
finish: UC.newBoolean(LANG.ch_fini_s,undefined, { title:LANG.ch_fini_l }),
|
entry: UC.newBoolean(LANG.ch_entr_s,undefined, {title:LANG.ch_entr_l}),
|
||||||
|
entryOffset: UC.newInput(LANG.ch_ento_s, {title:LANG.ch_ento_l, convert:UC.toFloat, units:true, show:() => env.poppedRec.entry}),
|
||||||
|
reverse: UC.newBoolean(LANG.ch_rvrs_s,undefined, {title:LANG.ch_rvrs_l}),
|
||||||
|
clockwise:UC.newBoolean(LANG.ch_clkw_s,undefined, {title:LANG.ch_clkw_l}),
|
||||||
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
|
finish: UC.newBoolean(LANG.ch_fini_s,undefined, { title:LANG.ch_fini_l ,show: ()=>!env.poppedRec.reverse}),
|
||||||
forceStartAng: UC.newBoolean(LANG.ch_fsta_s, undefined, {title:LANG.ch_fsta_l }),
|
forceStartAng: UC.newBoolean(LANG.ch_fsta_s, undefined, {title:LANG.ch_fsta_l }),
|
||||||
fromTop: UC.newBoolean(LANG.cd_ftop_s,undefined, {title:LANG.cd_ftop_l}),
|
fromTop: UC.newBoolean(LANG.cd_ftop_s,undefined, {title:LANG.cd_ftop_l}),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,11 @@ export class OpHelical extends CamOp {
|
||||||
down,
|
down,
|
||||||
thru,
|
thru,
|
||||||
finish,
|
finish,
|
||||||
|
|
||||||
|
clockwise,
|
||||||
|
reverse,
|
||||||
|
entry,
|
||||||
|
entryOffset,
|
||||||
} = op;
|
} = op;
|
||||||
let {stock} = settings
|
let {stock} = settings
|
||||||
|
|
||||||
|
|
@ -59,7 +64,7 @@ export class OpHelical extends CamOp {
|
||||||
|
|
||||||
let radAdd,
|
let radAdd,
|
||||||
zBottom = zmin - thru,
|
zBottom = zmin - thru,
|
||||||
clockwise = true,
|
|
||||||
numSegs = faces.length / 2,
|
numSegs = faces.length / 2,
|
||||||
poly = newPolygon().setOpen();
|
poly = newPolygon().setOpen();
|
||||||
|
|
||||||
|
|
@ -122,7 +127,8 @@ export class OpHelical extends CamOp {
|
||||||
let toBottom = currentZ - zBottom,
|
let toBottom = currentZ - zBottom,
|
||||||
ofFull = toBottom / down,
|
ofFull = toBottom / down,
|
||||||
ofCircle = ofFull * (2 * Math.PI),
|
ofCircle = ofFull * (2 * Math.PI),
|
||||||
finalAngle = startAngle + ofCircle,
|
cwMultiplier = clockwise ? -1 : 1,
|
||||||
|
finalAngle = startAngle + (ofCircle*cwMultiplier),
|
||||||
finalEnd = center
|
finalEnd = center
|
||||||
.clone()
|
.clone()
|
||||||
.setZ(zBottom)
|
.setZ(zBottom)
|
||||||
|
|
@ -134,19 +140,75 @@ export class OpHelical extends CamOp {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// console.log({down,toBottom,ofFull,ofCircle,finalAngle,finalEnd});
|
console.log({down,toBottom,ofFull,ofCircle,startAngle,finalAngle,finalEnd});
|
||||||
|
|
||||||
//circle down to final point
|
//circle down to final point
|
||||||
poly.addPoints(
|
poly.addPoints(
|
||||||
arcToPath(startPoint.setZ(currentZ), finalEnd, numSegs , {
|
arcToPath(startPoint.setZ(currentZ), finalEnd, numSegs , {
|
||||||
clockwise: !clockwise,
|
clockwise,
|
||||||
radius,
|
radius,
|
||||||
center,
|
center,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
//if settings dictate, do a full circle at the bottom
|
//if starting at the bottom, reverse poly
|
||||||
if(finish){
|
if (reverse){
|
||||||
|
poly.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( entry ){
|
||||||
|
//get first z of poly to use for entry
|
||||||
|
let firstZ = poly.first().z;
|
||||||
|
|
||||||
|
//create new pointArray
|
||||||
|
let entry =[newPoint(0,0,0)];
|
||||||
|
//add center point
|
||||||
|
let entryCenter = center.clone().setZ(firstZ)
|
||||||
|
|
||||||
|
console.log({firstZ,entry,})
|
||||||
|
|
||||||
|
//if doing a curved enter, add more
|
||||||
|
|
||||||
|
if ( entryOffset > 0 ){
|
||||||
|
if(entryOffset > radius){
|
||||||
|
|
||||||
|
console.error("entryOffset must be less than radius of helix");
|
||||||
|
}else{
|
||||||
|
//calculate entry center
|
||||||
|
let lineOut = radius - entryOffset;
|
||||||
|
let centerOffset = (entryOffset**2 + 2*entryOffset*lineOut) / (2*(entryOffset + lineOut));
|
||||||
|
//add entry points
|
||||||
|
entry.push(...
|
||||||
|
newPoint(0,-lineOut,0),
|
||||||
|
arcToPath(
|
||||||
|
newPoint(0,-lineOut,0),
|
||||||
|
newPoint(radius,0,0),
|
||||||
|
128,
|
||||||
|
{
|
||||||
|
clockwise:false,
|
||||||
|
radius:lineOut,
|
||||||
|
center:newPoint(centerOffset,0,0)
|
||||||
|
}
|
||||||
|
),
|
||||||
|
newPoint(radius,0,0),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//for each point
|
||||||
|
entry = entry.map(p => {
|
||||||
|
//rotate by start angle
|
||||||
|
// add to hole center
|
||||||
|
// TODO: there's totally a way to do this with a matrix
|
||||||
|
p.y *= clockwise ? 1 : -1
|
||||||
|
p.rotate(startAngle)
|
||||||
|
return p.add(entryCenter)
|
||||||
|
})
|
||||||
|
//append to start of poly
|
||||||
|
poly = newPolygon().setOpen().addPoints(entry).addPoints(poly.points);
|
||||||
|
}
|
||||||
|
//if doing a finish pass, do a full circle at the bottom
|
||||||
|
if(finish && !reverse){
|
||||||
poly.addPoints(
|
poly.addPoints(
|
||||||
arcToPath(finalEnd, finalEnd, numSegs, {
|
arcToPath(finalEnd, finalEnd, numSegs, {
|
||||||
clockwise,
|
clockwise,
|
||||||
|
|
|
||||||
|
|
@ -619,7 +619,14 @@ self.lang['en-us'] = {
|
||||||
ch_selc_l: ["select a cylinder face", "inner holes that are too small","will be ignored."],
|
ch_selc_l: ["select a cylinder face", "inner holes that are too small","will be ignored."],
|
||||||
ch_fini_s: "bottom finish pass",
|
ch_fini_s: "bottom finish pass",
|
||||||
ch_fini_l: ["trace a circle at bottom of helix","used for hole clearing"],
|
ch_fini_l: ["trace a circle at bottom of helix","used for hole clearing"],
|
||||||
|
ch_entr_s: "enter from center",
|
||||||
|
ch_entr_l: ["start cut from center of cylinder","gently arcing in horisontaly", "instead of plunging"],
|
||||||
|
ch_ento_s: "center entry offset",
|
||||||
|
ch_ento_l: ["offset from path for curved entry","usually thread depth if threadmilling","in workspace units","0 for a linear entry"],
|
||||||
|
ch_rvrs_s: "reverse",
|
||||||
|
ch_rvrs_l: ["reverse helical z-axis direction","low-Z to high-Z when checked","useful for thread milling","not recomended for other operations"],
|
||||||
|
ch_clkw_s: "clockwise",
|
||||||
|
ch_clkw_l: ["reverse helical rotation around cylinder","clockwise when checked"],
|
||||||
|
|
||||||
// CNC FLIP
|
// CNC FLIP
|
||||||
cf_menu: "flip",
|
cf_menu: "flip",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue