Mercurial Hosting > harelet
changeset 4:0ed615367b10
Automated Vimcurial commmit
author | VilyaemKenyaz |
---|---|
date | Fri, 08 Sep 2023 08:16:07 -0400 |
parents | eb7a7364994c |
children | 3879c1178448 |
files | .harelet.c.swp README.md c.ksh harelet harelet.c minibasediolib.h |
diffstat | 6 files changed, 73 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/README.md Fri Sep 08 08:02:33 2023 -0400 +++ b/README.md Fri Sep 08 08:16:07 2023 -0400 @@ -1,7 +1,21 @@ # Harelet -CNC CAD program for milling machines +A simple CNC CAD program for milling machines You may export RAW gcode or Superhare machines To configure some settings edit the definitions in the source code and recompile easily by executing the compile script. By default the units are imperial. +--- + +## USAGE + +Vim keys (HJKL), or arrow keys. + +A to add a point at the current cursor's position + +C to compile GCODE + +S to change step size + + +
--- a/c.ksh Fri Sep 08 08:02:33 2023 -0400 +++ b/c.ksh Fri Sep 08 08:16:07 2023 -0400 @@ -1,6 +1,6 @@ #!/bin/sh clear rm harelet -cc harelet -o harelet +cc harelet.c -o harelet cp harelet /usr/bin/ -gdb -ex run harelet \ No newline at end of file +gdb -ex run harelet
--- a/harelet.c Fri Sep 08 08:02:33 2023 -0400 +++ b/harelet.c Fri Sep 08 08:16:07 2023 -0400 @@ -6,7 +6,9 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "basedfilelib.h" +#include "minibasediolib.h" #define DEEPNESS 5 #define MAXPOINT 4096 @@ -17,7 +19,7 @@ unsigned int X,Y,down; }point; -points[MAXPOINT]; +point points[MAXPOINT]; unsigned int X,Y,step,down,numpoints; char action; @@ -74,30 +76,32 @@ if(choice == 1){ //Set the miller strcat(file,UNITS); - + //Meat of instructions for(int i = 0;i != numpoints;i++){ - //Compose - char * instruction; - strcat(instruction,"G0 X"); - strcat(instruction,sprintf("%d",points[i].X)); - strcat(instruction," Y"); - strcat(inustrction,sprintf("%d",points[i].Y)); - strcat(instructions," Z"); - strcat(instructions,sprintf("%d",points[i].Z)); - //Write to string - strcat(file,instruction); + //Compose + char * instruction; + strcat(instruction,"G0 X"); + strcat(instruction,sprintf("%d",points[i].X)); + strcat(instruction," Y"); + strcat(instruction,sprintf("%d",points[i].Y)); + strcat(instruction," Z"); + strcat(instruction,sprintf("%d",DEEPNESS)); + //Write to string + strcat(file,instruction); } //Finish strcat(file,"G0, X0, Y0, Z0"); WriteFile(filename,file); } else{ + puts("Superhare implementation not done"); + exit(1); //Set the miller - + //Meat of instructions - + //Finish @@ -138,6 +142,9 @@ puts("Enter new step:"); scanf("%d",&step); break; + + case 'c': Compile(); + break; default: break; }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/minibasediolib.h Fri Sep 08 08:16:07 2023 -0400 @@ -0,0 +1,35 @@ +//BasedIOLib without *nix conio implementation + +//Clear the screen like in the Temple! +void DocClear(){ + +puts("\x1b[H\x1b[J"); + +} + + +//Mova the cursor to the top of the screen like in the temple! +void DocTop(){ + +puts("\033[2J"); + +} + +//Move the cursor to this line and column +void SetCursor(int line, int column){ + +printf("\033[<%d>;<%d>f",line,column); + +} + +//Print the rest of a string given an indice +void PutRest(char* ptr, int index){ + +ptr += index; + +puts(ptr); + +} + + +