GCMC source code: grip pocketing for ironing weight / tailor's clapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ironing weight pocketing | |
// Ed Nisley KE4ZNU - 2023-01 | |
//----- | |
// Library routines | |
include("/opt/gcmc/example/cc_hole.inc.gcmc"); | |
include("varcs.inc.gcmc"); | |
include("tracepath_comp.inc.gcmc"); | |
include("trochoidal.inc.gcmc"); | |
/* | |
include("tracepath.inc.gcmc"); | |
include("engrave.inc.gcmc"); | |
*/ | |
//----- | |
// Useful constants | |
SafeZ = 10.0mm; // above all obstructions | |
TravelZ = 2.0mm; // within engraving / milling area | |
BlockHome = [0.0mm,0.0mm,TravelZ]; // Origin on surface at center of pocket | |
FALSE = 0; | |
TRUE = !FALSE; | |
//----- | |
// Overall values | |
Socket = [160.0mm,25.0mm,7.0mm]; // raw grip recess into block | |
RoundEnds = TRUE; // TRUE for smooth rounded endcaps | |
SocketRadius = RoundEnds ? Socket.y/2 : 10.0mm; | |
comment("SocketRadius: ",SocketRadius); | |
CutterDia = 6.32mm - 0.15; // actual cutter diameter - windage | |
MillStep = 0.25 * CutterDia; // stepover in XY plane | |
comment("CutterDia: ",CutterDia," MillStep: ",MillStep); | |
MillClean = MillStep/2; | |
PlungeSpeed = 150.0mm; // cutter Z plunge into work | |
MillSpeed = 600.0mm; // XY speed | |
if (CutterDia > SocketRadius) { | |
error("Cutter too large for corner radius"); | |
} | |
CornerOC = head(Socket,2) - 2*[SocketRadius,SocketRadius]; | |
comment("CornerOC: ",CornerOC); | |
Corners = RoundEnds ? // rear left CCW around slot | |
{-CornerOC/2, CornerOC/2} : | |
{[-CornerOC.x,CornerOC.y]/2, [-CornerOC.x,-CornerOC.y]/2, [CornerOC.x,-CornerOC.y]/2, CornerOC/2}; | |
comment("Corners: ", Corners); | |
if (RoundEnds) { | |
SlotPerimeter = {[0.0mm,Socket.y/2,-Socket.z]}; // entry point at center rear | |
SlotPerimeter += {Corners[0] + [0.0mm,SocketRadius]}; | |
SlotPerimeter += varc_ccw([-SocketRadius,-SocketRadius],SocketRadius) + SlotPerimeter[-1]; | |
SlotPerimeter += varc_ccw([+SocketRadius,-SocketRadius],SocketRadius) + (Corners[0] + [-SocketRadius,0.0mm]); | |
SlotPerimeter += {Corners[1] + [0.0mm,-SocketRadius]}; // across front | |
SlotPerimeter += varc_ccw([+SocketRadius,+SocketRadius],SocketRadius) + SlotPerimeter[-1]; | |
SlotPerimeter += varc_ccw([-SocketRadius,+SocketRadius],SocketRadius) + (Corners[1] + [+SocketRadius,0.0mm]); | |
} | |
else { | |
SlotPerimeter = {[0.0mm,Socket.y/2,-Socket.z]}; // entry point at center rear | |
SlotPerimeter += {Corners[0] + [0.0mm,SocketRadius]}; | |
SlotPerimeter += varc_ccw([-SocketRadius,-SocketRadius],SocketRadius) + SlotPerimeter[-1]; | |
SlotPerimeter += {Corners[1] + [-SocketRadius,0.0mm]}; | |
SlotPerimeter += varc_ccw([+SocketRadius,-SocketRadius],SocketRadius) + SlotPerimeter[-1]; | |
SlotPerimeter += {Corners[2] + [0.0mm,-SocketRadius]}; // across front | |
SlotPerimeter += varc_ccw([SocketRadius,SocketRadius],SocketRadius) + SlotPerimeter[-1]; | |
SlotPerimeter += {Corners[3] + [SocketRadius,0.0mm]}; | |
SlotPerimeter += varc_ccw([-SocketRadius,SocketRadius],SocketRadius) + SlotPerimeter[-1]; | |
} | |
//--- Begin cutting | |
goto([-,-,TravelZ]); | |
goto(BlockHome); | |
if (!RoundEnds) { // clear corners outward of main pocket | |
foreach(Corners; xy) { | |
comment("Plunge corner at: ",xy); | |
feedrate(PlungeSpeed); | |
goto(xy); | |
move([-,-,-Socket.z]); | |
comment(" pocket"); | |
feedrate(MillSpeed); | |
cc_hole(xy,(SocketRadius - MillClean),CutterDia/2,MillStep,-Socket.z); | |
goto([-,-,TravelZ]); | |
comment(" done!"); | |
} | |
} | |
comment("Open slot"); | |
TrochRadius = (Socket.y - CutterDia)/2 - MillClean; | |
TrochPath = {[-(Socket.x/2 - TrochRadius - CutterDia/2 - MillStep),TrochRadius], | |
[ (Socket.x/2 - TrochRadius - CutterDia/2 - MillStep),TrochRadius]}; | |
comment(" clear landing zone"); | |
xy = [TrochPath[0].x,0.0mm]; | |
feedrate(PlungeSpeed); | |
goto(xy); | |
move([-,-,-Socket.z]); | |
feedrate(MillSpeed); | |
cc_hole(xy,Socket.y/2 - MillClean,CutterDia/2,MillStep,-Socket.z); | |
goto([-,-,TravelZ]); | |
comment(" trochoid pocket milling"); | |
feedrate(MillSpeed); | |
trochoid_move(TrochPath[0],TrochPath[1], | |
-Socket.z, TrochRadius, MillStep); | |
goto([-,-,TravelZ]); | |
comment("Clean slot perimeter"); | |
feedrate(MillSpeed); | |
goto([-,-,-Socket.z]); | |
tracepath_comp(SlotPerimeter,CutterDia/2,TPC_CLOSED + TPC_LEFT + TPC_ARCIN + TPC_ARCOUT); | |
goto([-,-,TravelZ]); | |
goto(BlockHome); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Ironing weight finger grip pocketing | |
# Ed Nisley KE4ZNU - 2023-01 | |
Flags='-P 4 --pedantic' # quote to avoid leading hyphen gotcha | |
# Set these to match your file layout | |
LibPath='/opt/gcmc/library' | |
Prolog='prolog.gcmc' | |
Epilog='epilog.gcmc' | |
#----- | |
gcmc $Flags \ | |
--include "$LibPath" --prologue "$Prolog" --epilogue "$Epilog" \ | |
"Ironing weight grip pocket.gcmc" > "Grip pocket.ngc" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
More details on my blog at https://softsolder.com/2023/02/02/tailors-clapper-cnc-pocketing/