Ici ce trouve notre code utilisé dans notre projet. Ci-dessous celui utilisé dans l’arduino :
#include <Stepper.h>
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define X_AXIS_STEPS 40
#define Y_AXIS_STEPS 80
#define Z_AXIS_STEPS 80
#define X_MIN_PIN 3
Stepper x_axis(X_AXIS_STEPS, X_STEP_PIN, X_DIR_PIN);
Stepper y_axis(Y_AXIS_STEPS, Y_STEP_PIN, Y_DIR_PIN);
Stepper z_axis(Z_AXIS_STEPS, Z_STEP_PIN, Z_DIR_PIN);
bool x_endstop = 0;
int data[38];
void setup() {
pinMode(X_ENABLE_PIN, OUTPUT);
pinMode(Y_ENABLE_PIN, OUTPUT);
pinMode(Z_ENABLE_PIN, OUTPUT);
pinMode(X_MIN_PIN, INPUT_PULLUP);
digitalWrite(X_ENABLE_PIN, LOW);
digitalWrite(Y_ENABLE_PIN, LOW);
digitalWrite(Z_ENABLE_PIN, LOW);
x_axis.setSpeed(17000);
y_axis.setSpeed(100);
z_axis.setSpeed(100);
//x_axis.step(-5000);
x_endstop = digitalRead(X_MIN_PIN);
while (x_endstop == 1)
{
x_endstop = digitalRead(X_MIN_PIN);
x_axis.setSpeed(4000);
x_axis.step(-10);
}
x_axis.setSpeed(3000);
x_axis.step(700);
x_endstop = digitalRead(X_MIN_PIN);
while (x_endstop == 1)
{
x_endstop = digitalRead(X_MIN_PIN);
x_axis.setSpeed(2500);
x_axis.step(-1);
}
x_axis.setSpeed(4000);
x_axis.step(10000);
}
void loop()
{
deplace = Serial.readStringUntil('\n');
}
#include "CaracteresCNC.h"
#include "Arduino.h"
#include "Stepper.h"
#include "ctype.h"
String data[38]; // Tableau pour stocker les données reçues sur le port série
String data2[38]; // Tableau pour stocker les données reçues sur le port série
#define X_STEP_PIN 54
#define X_DIR_PIN 55
#define X_ENABLE_PIN 38
#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define X_AXIS_STEPS 40
#define Y_AXIS_STEPS 80
#define Z_AXIS_STEPS 80
#define X_MIN_PIN 3
#define Y_MIN_PIN 14
#define Z_MIN_PIN 18
#define fraise 8
#define start_defoncage 16
#define start_decoupe 17
#define start_gravure 23
// 1 mm -> 800 steps
int echelle = 800;
//String affi = 0 ;
int X_dep = 0 ;
int Y_dep = 0 ;
int Z_dep = 0 ;
int Z_dep_calcul = 0 ;
int X_l = 0 ;
int Y_l = 0 ;
int Z_l = 0 ;
int nb_passe = 0 ;
int X_l_gros = 0 ;
int Y_l_gros = 0 ;
int finission = 0 ;
int X_l_cop = 0 ;
int Y_l_cop = 0 ;
int Z_l_cop = 0 ;
int X_defonce = 0 ;
int Y_defonce = 0 ;
int origin_X = 0 ;
int origin_Y = 0 ;
int taille_objet_X = 0 ;
int taille_objet_Y = 0 ;
int X_l_origin = 0 ;
int Y_l_origin = 0 ;
int X_retour_machine = 0 ;
int Y_retour_machine = 0 ;
int Z_retour_machine = 0 ;
int X_retour_travail = 0 ;
int Y_retour_travail = 0 ;
int Z_retour_travail = 0 ;
int X_retour_travail_caracs = 0 ;
int Y_retour_travail_caracs = 0 ;
int Z_retour_travail_caracs = 0 ;
int diam_fraise = 4 ;
int diam_fraise_div = 2 ;
int hauteur_fraise = 46 ;
//ep_matériaux
//
int coordo[6] = {10, 10, 25, 30, 20, 2};
int coordo_grav[4] = {10, 10, 20, 1};
//String affiche[36] = {afficherA, afficherB, afficherC, afficherD, afficherE, afficherF, afficherG, afficherH, afficherI, afficherJ, afficherK, afficherL, afficherM, afficherN, afficherO, afficherP, afficherQ, afficherR, afficherS, afficherT, afficherU, afficherV, afficherW, afficherX, afficherY, afficherZ, afficher0, afficher1, afficher2, afficher3, afficher4, afficher5, afficher6, afficher7, afficher8, afficher9};
Stepper x_axis(X_AXIS_STEPS, X_STEP_PIN, X_DIR_PIN);
Stepper y_axis(Y_AXIS_STEPS, Y_STEP_PIN, Y_DIR_PIN);
Stepper z_axis(Z_AXIS_STEPS, Z_STEP_PIN, Z_DIR_PIN);
void setup_axe() // init broche
{
pinMode(X_ENABLE_PIN, OUTPUT);
pinMode(Y_ENABLE_PIN, OUTPUT);
pinMode(Z_ENABLE_PIN, OUTPUT);
pinMode(X_MIN_PIN, INPUT_PULLUP);
pinMode(Y_MIN_PIN, INPUT_PULLUP);
pinMode(Z_MIN_PIN, INPUT_PULLUP);
pinMode(fraise, OUTPUT);
digitalWrite(X_ENABLE_PIN, LOW);
digitalWrite(Y_ENABLE_PIN, LOW);
digitalWrite(Z_ENABLE_PIN, LOW);
digitalWrite(fraise, LOW);
x_axis.setSpeed(17000);
y_axis.setSpeed(17000);
z_axis.setSpeed(17000);
diam_fraise_div = diam_fraise / 2;
}
///////////////
void sethome() // fonction retour fin de course
{
sethome_axe_Z();
sethome_axe_Y();
sethome_axe_X();
}
///////////////
void sethome_axe_X() // sethome X
{
while (digitalRead(X_MIN_PIN) == 1)
{
x_axis.setSpeed(4000);
x_axis.step(-1);
}
while (digitalRead(X_MIN_PIN) == 0)
{
x_axis.setSpeed(2500);
x_axis.step(1);
}
}
/////////////////
void sethome_axe_Y() // sethome Y
{
while (digitalRead(Y_MIN_PIN) == 1)
{
y_axis.setSpeed(4000);
y_axis.step(-1);
}
while (digitalRead(Y_MIN_PIN) == 0)
{
y_axis.setSpeed(2500);
y_axis.step(1);
}
}
////////////////////
void sethome_axe_Z() // sethome Z
{
while (digitalRead(Z_MIN_PIN) == 1)
{
z_axis.setSpeed(4000);
z_axis.step(1);
}
while (digitalRead(Z_MIN_PIN) == 0)
{
z_axis.setSpeed(2500);
z_axis.step(-1);
}
}
////////////////
void sethome_fraise() // sethome fraise
{
digitalWrite(fraise, HIGH);
delay(750);
digitalWrite(fraise, LOW);
}
////////////////
void start_pros_decoupe() // test fonction 1 (decoupe)
{
mise_en_place_valeur();
calcul_Z_dep();
depart();
val_F1();
decoupe_F1();
}
////////////////
void start_pros_defonce() // test fonction 2 (défonce)
{
mise_en_place_valeur();
calcul_Z_dep();
depart();
val_F1();
defoncage_F1();
}
////////////////
void start_pros_gravure() // test fonction 3 (gravure)
{
mise_en_place_valeur_gravure();
calcul_Z_dep();
depart();
// set speed travail
x_axis.setSpeed(3500);
y_axis.setSpeed(3500);
z_axis.setSpeed(2500);
afficherS();
xd(15);
zd(1);
X_retour_travail_caracs = 0 ;
Y_retour_travail_caracs = 0 ;
afficherT();
xd(15);
zd(1);
X_retour_travail_caracs = 0 ;
Y_retour_travail_caracs = 0 ;
afficherI();
xd(15);
zd(1);
X_retour_travail_caracs = 0 ;
Y_retour_travail_caracs = 0 ;
afficher2();
xd(15);
zd(1);
X_retour_travail_caracs = 0 ;
Y_retour_travail_caracs = 0 ;
afficherD();
}
////////////////
void execution()
{
}
////////////////
void mise_en_place_valeur_slice()
{
X_dep = data[0].toInt();
Y_dep = data[1].toInt();
Z_dep_calcul = data[2].toInt();
taille_objet_X = data[3].toInt();
taille_objet_Y = data[4].toInt();
X_l = data[5].toInt();
Y_l = data[6].toInt();
Z_l = data[7].toInt();
X_l_origin = data[8].toInt();
Y_l_origin = data[9].toInt();
/*X_dep
X_l = X_l_origin - origin_X;
Y_l = Y_l_origin - origin_Y;*/
Z_l = Z_l - Z_dep_calcul;
}
////////////////
void mise_en_place_valeur()
{
X_dep = coordo[0];
Y_dep = coordo[1];
Z_dep_calcul = coordo[2];
X_l = coordo[3];
Y_l = coordo[4];
Z_l = coordo[5];
}
////////////////
void mise_en_place_valeur_gravure()
{
X_dep = coordo_grav[0];
Y_dep = coordo_grav[1];
Z_dep_calcul = coordo_grav[2];
Z_l = coordo_grav[3];
diam_fraise = 0;
diam_fraise_div = 0;
}
////////////////
void depart()
{
X_dep = X_dep + diam_fraise_div;
Y_dep = Y_dep + diam_fraise_div;
x_axis.setSpeed(10000);
y_axis.setSpeed(10000);
z_axis.setSpeed(7500);
for (int X = 0; X < X_dep; X++)
{
x_axis.step(800);
X_retour_machine = X_retour_machine + 1;
}
for (int Y = 0; Y < Y_dep; Y++)
{
y_axis.step(800);
Y_retour_machine = Y_retour_machine + 1;
}
for (int Z = 0; Z < Z_dep; Z++)
{
z_axis.step(-800);
Z_retour_machine = Z_retour_machine + 1;
}
}
////////////////
void val_F1()
{
X_l_cop = X_l;
Y_l_cop = Y_l;
Z_l_cop = Z_l;
X_l = X_l-diam_fraise;
Y_l = Y_l-diam_fraise;
X_l_gros = X_l - 2;
Y_l_gros = Y_l - 2;
while(Z_l_cop >= 1)
{
Z_l_cop = Z_l_cop - 1;
nb_passe = nb_passe + 1;
}
nb_passe = nb_passe * 2;
if(X_l > 3)
{
finission = 2;
}
else
{
finission = 1;
}
while(Y_l_cop >= 1)
{
Y_l_cop = Y_l_cop - 1;
Y_defonce = Y_defonce + 1;
}
Y_defonce = Y_defonce - 8;
Y_defonce = Y_defonce / 2;
while(X_l_cop >= 1)
{
X_l_cop = X_l_cop - 1;
X_defonce = X_defonce + 1;
}
X_defonce = X_defonce - 8;
}
////////////////
void decoupe_F1()
{
// set speed travail
x_axis.setSpeed(4000);
y_axis.setSpeed(4000);
z_axis.setSpeed(3000);
// démarrage fraise
digitalWrite(fraise, HIGH);
// positionnement passage grossier
x_axis.step(800);
y_axis.step(800);
// passage grossier
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(-400);
for (int X = 0; X < X_l_gros; X++)
{
x_axis.step(800);
}
for (int Y = 0; Y < Y_l_gros; Y++)
{
y_axis.step(800);
}
for (int X = 0; X < X_l_gros; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_l_gros; Y++)
{
y_axis.step(-800);
}
}
// revient début découpe
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(400);
}
// set speed finission
x_axis.setSpeed(3500);
y_axis.setSpeed(3500);
z_axis.setSpeed(3000);
// positionnement passage finition
x_axis.step(-800);
y_axis.step(-800);
// finission brodure
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(-400);
for (int X = 0; X < X_l; X++)
{
x_axis.step(800);
}
for (int Y = 0; Y < Y_l; Y++)
{
y_axis.step(800);
}
for (int X = 0; X < X_l; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_l; Y++)
{
y_axis.step(-800);
}
for (int X = 0; X < finission; X++)
{
x_axis.step(800);
}
for (int X = 0; X < finission; X++)
{
x_axis.step(-800);
}
}
// revient début découpe
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(400);
}
// arrêt fraise
digitalWrite(fraise, LOW);
// fin travail
delay(2000);
retour_machine();
}
////////////////
void defoncage_F1()
{
// set speed travail
x_axis.setSpeed(4000);
y_axis.setSpeed(4000);
z_axis.setSpeed(3000);
// démarrage fraise
digitalWrite(fraise, HIGH);
// positionnement passage grossier
x_axis.step(800);
y_axis.step(800);
// passage grossier + défonçage
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(-400);
for (int X = 0; X < X_l_gros; X++)
{
x_axis.step(800);
}
for (int Y = 0; Y < Y_l_gros; Y++)
{
y_axis.step(800);
}
for (int X = 0; X < X_l_gros; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_l_gros; Y++)
{
y_axis.step(-800);
}
// positionnement passage défonçage
x_axis.step(800);
// passage défonçage
for (int nb = 0; nb < Y_defonce; nb++)
{
y_axis.step(800);
for (int X = 0; X < X_defonce; X++)
{
x_axis.step(800);
}
y_axis.step(800);
for (int X = 0; X < X_defonce; X++)
{
x_axis.step(-800);
}
}
// revient début défonçage + contour
z_axis.step(800);
for (int nb = 0; nb < Y_defonce; nb++)
{
y_axis.step(-1600);
}
x_axis.step(-800);
z_axis.step(800);
}
// set speed finission
x_axis.setSpeed(3500);
y_axis.setSpeed(3500);
z_axis.setSpeed(3000);
// positionnement pour passage finition
x_axis.step(-800);
y_axis.step(-800);
// finission brodure
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(-400);
for (int X = 0; X < X_l; X++)
{
x_axis.step(800);
}
for (int Y = 0; Y < Y_l; Y++)
{
y_axis.step(800);
}
for (int X = 0; X < X_l; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_l; Y++)
{
y_axis.step(-800);
}
for (int X = 0; X < finission; X++)
{
x_axis.step(800);
}
for (int X = 0; X < finission; X++)
{
x_axis.step(-800);
}
}
// revient début découpe
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(400);
}
// arrêt fraise
digitalWrite(fraise, LOW);
// fin travail
delay(2000);
retour_machine();
}
////////////////
void gravure_F1()
{
// set speed travail
x_axis.setSpeed(3500);
y_axis.setSpeed(3500);
z_axis.setSpeed(2500);
xd(1);
yd(1);
delay(500);
affiches1();
}
////////////////
void retour_machine()
{
x_axis.setSpeed(10000);
y_axis.setSpeed(10000);
z_axis.setSpeed(7500);
for (int Z = 0; Z < Z_retour_machine; Z++)
{
z_axis.step(800);
}
for (int X = 0; X < X_retour_machine; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_retour_machine; Y++)
{
y_axis.step(-800);
}
X_retour_machine = 0;
Y_retour_machine = 0;
Z_retour_machine = 0;
}
////////////////
void retour_travail()
{
//
}
////////////////
void calcul_Z_dep()
{
Z_dep = hauteur_fraise - Z_dep_calcul;
}
////////////////
void calibrage_foret()
{
calcul_Z_dep();
X_dep = X_dep + diam_fraise_div;
Y_dep = Y_dep + diam_fraise_div;
x_axis.setSpeed(10000);
y_axis.setSpeed(10000);
z_axis.setSpeed(7500);
for (int X = 0; X < X_dep; X++)
{
x_axis.step(800);
X_retour_machine = X_retour_machine + 1;
}
for (int Y = 0; Y < Y_dep; Y++)
{
y_axis.step(800);
Y_retour_machine = Y_retour_machine + 1;
}
for (int Z = 0; Z < Z_dep; Z++)
{
z_axis.step(-800);
Z_retour_machine = Z_retour_machine + 1;
}
}
////////////////
void calibrage_pointe()
{
calcul_Z_dep();
x_axis.setSpeed(10000);
y_axis.setSpeed(10000);
z_axis.setSpeed(7500);
for (int X = 0; X < X_dep; X++)
{
x_axis.step(800);
X_retour_machine = X_retour_machine + 1;
}
for (int Y = 0; Y < Y_dep; Y++)
{
y_axis.step(800);
Y_retour_machine = Y_retour_machine + 1;
}
for (int Z = 0; Z < Z_dep; Z++)
{
z_axis.step(-800);
Z_retour_machine = Z_retour_machine + 1;
}
}
////////////////
void recep_var()
{
if (Serial.available())
{ // Si des données sont disponibles sur le port série
String message = Serial.readStringUntil('\n'); // Lit les données jusqu'à un retour à la ligne
message.trim(); // Supprime les espaces en début et fin de chaîne
// Découpe la chaîne de caractères en 38 sous-chaînes séparées par des virgules
for (int i = 0; i < 38; i++)
{
int commaIndex = message.indexOf(',');
if (commaIndex >= 0)
{
String value = message.substring(0, commaIndex);
message = message.substring(commaIndex + 1);
data[i] = value;
}
}
if (data[0]=="x")
{
if (data[1].toInt()>0)
{
for (int X = 0; X < data[1].toInt(); X++)
{
x_axis.step(800);
}
}
else
{
for (int X = 0; X < -data[1].toInt(); X++)
{
x_axis.step(-800);
}
}
}
if (data[0]=="y")
{
if (data[1].toInt()>0)
{
for (int X = 0; X < data[1].toInt(); X++)
{
y_axis.step(800);
}
}
else
{
for (int X = 0; X < -data[1].toInt(); X++)
{
y_axis.step(-800);
}
}
}
if (data[0]=="z")
{
if (data[1].toInt()>0)
{
for (int X = 0; X < data[1].toInt(); X++)
{
z_axis.step(800);
}
}
else
{
for (int X = 0; X < -data[1].toInt(); X++)
{
z_axis.step(-800);
}
}
}
if (data[0]=="o")
{
digitalWrite(fraise, LOW);
}
if (data[0]=="i")
{
digitalWrite(fraise, HIGH);
}
if (data[0]=="t1") // test découpe
{
start_pros_decoupe();
}
if (data[0]=="t2") // test défonce
{
start_pros_defonce();
}
if (data[0]=="t3") // test gravure
{
start_pros_gravure();
}
if (data[0]=="t4") // test calibrage
{
calibrage_foret();
}
if (data[0]=="t5") // test calibrage
{
calibrage_pointe();
}
if (data[0]=="t") //écrire du texte
{
/*mise_en_place_valeur_gravure();
calcul_Z_dep();
depart();
// set speed travail
x_axis.setSpeed(3500);
y_axis.setSpeed(3500);
z_axis.setSpeed(2500);
for (int N = 1; N < 36; N++)
{
affi = data[N];
(*affiche[int(affi) - 1])();
xd(15);
zd(1);
X_retour_travail_caracs = 0 ;
Y_retour_travail_caracs = 0 ;
}*/
}
if (data[0]=="r")
{
sethome();
}
if (data[0].toInt() != 0)
{
mise_en_place_valeur_slice();
calcul_Z_dep();
depart();
val_F1();
// set speed travail
x_axis.setSpeed(4000);
y_axis.setSpeed(4000);
z_axis.setSpeed(3000);
// démarrage fraise
digitalWrite(fraise, HIGH);
// positionnement passage grossier
x_axis.step(800);
y_axis.step(800);
// passage grossier
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(-400);
for (int X = 0; X < X_l_gros; X++)
{
x_axis.step(800);
}
for (int Y = 0; Y < Y_l_gros; Y++)
{
y_axis.step(800);
}
for (int X = 0; X < X_l_gros; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_l_gros; Y++)
{
y_axis.step(-800);
}
}
// revient début découpe
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(400);
}
// set speed finission
x_axis.setSpeed(3500);
y_axis.setSpeed(3500);
z_axis.setSpeed(3000);
// positionnement passage finition
x_axis.step(-800);
y_axis.step(-800);
// finission brodure
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(-400);
for (int X = 0; X < X_l; X++)
{
x_axis.step(800);
}
for (int Y = 0; Y < Y_l; Y++)
{
y_axis.step(800);
}
for (int X = 0; X < X_l; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_l; Y++)
{
y_axis.step(-800);
}
for (int X = 0; X < finission; X++)
{
x_axis.step(800);
}
for (int X = 0; X < finission; X++)
{
x_axis.step(-800);
}
}
// revient début découpe
for (int P = 0; P < nb_passe; P++)
{
z_axis.step(400);
}
// arrêt fraise
digitalWrite(fraise, LOW);
// fin travail
delay(2000);
retour_machine();
}
// Envoie les données stockées sur le port série
for (int i = 0; i < 38; i++) {
Serial.print(data[i]);
if (i < 37) { // Ajoute un hashtag entre chaque valeur (sauf après la dernière)
Serial.print("#");
}
}
for (int i = 0; i < 38; i++) {
data[i] = '#';
}
Serial.println(); // Ajoute deux retour à la ligne à la fin de la liste de données
Serial.println();
data[0] = 'w';
}
}
////////////////
////////////////
////////////////
// Code caractères
void retour_travail_caracs()
{
for (int X = 0; X < X_retour_travail_caracs; X++)
{
x_axis.step(-800);
}
for (int Y = 0; Y < Y_retour_travail_caracs; Y++)
{
y_axis.step(-800);
}
X_retour_travail_caracs = 0 ;
Y_retour_travail_caracs = 0 ;
}
// boucle mouvement
void xd(int val1)
{
for (int X = 0; X < val1; X++)
{
x_axis.step(800);
X_retour_travail_caracs = X_retour_travail_caracs + 1;
}
}
void xg(int val2)
{
for (int X = 0; X < val2; X++)
{
x_axis.step(-800);
X_retour_travail_caracs = X_retour_travail_caracs - 1;
}
}
void yd(int val3)
{
for (int Y = 0; Y < val3; Y++)
{
y_axis.step(800);
Y_retour_travail_caracs = Y_retour_travail_caracs + 1;
}
}
void ym(int val4)
{
for (int Y = 0; Y < val4; Y++)
{
y_axis.step(-800);
Y_retour_travail_caracs = Y_retour_travail_caracs - 1;
}
}
void zd(int val5)
{
for (int Z = 0; Z < val5; Z++)
{
z_axis.step(-800);
}
}
void zm(int val6)
{
for (int Z = 0; Z < val6; Z++)
{
z_axis.step(800);
}
}
// boucle caractères
void afficherA()
{
// placer avant travail à rat le matériaux
zm(1);
yd(2);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// début travail
xd(2);
ym(2);
xd(6);
yd(2);
xd(2);
yd(13);
xg(2);
ym(6);
xg(6);
yd(6);
xg(2);
ym(13);
// lève pour déplacement
zm(2);
// déplacement
xd(2);
// descente pour reprendre travail
zd(2);
// travail
xd(6);
yd(4);
xg(6);
ym(4);
// fin travail
// remonte fraise
zm(2);
// arrêt fraise
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherB()
{
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(1);
// travail
xd(8);
yd(2);
xd(2);
yd(4);
xg(2);
yd(3);
xd(2);
yd(4);
xg(2);
yd(2);
xg(8);
ym(15);
// déplacement
zm(2);
xd(2);
yd(2);
zd(2);
//reprise travail
xd(6);
yd(4);
xg(6);
ym(4);
// déplacement
zm(2);
yd(7);
zd(2);
//reprise travail
xd(6);
yd(4);
xg(6);
ym(4);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherC()
{
// placer avant travail à rat le matériaux
zm(1);
yd(2);
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(2);
ym(2);
xd(6);
yd(2);
xd(2);
yd(2);
xg(2);
ym(2);
xg(6);
yd(11);
xd(6);
ym(2);
xd(2);
yd(2);
xg(2);
yd(2);
xg(6);
ym(2);
xg(2);
ym(11);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherD()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(8);
yd(2);
xd(2);
yd(11);
xg(2);
yd(2);
xg(8);
ym(15);
// déplacement
zm(2);
xd(2);
yd(2);
zd(2);
//reprise travail
xd(6);
yd(11);
xg(6);
ym(11);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherE()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(10);
yd(2);
xg(8);
yd(4);
xd(6);
yd(3);
xg(6);
yd(4);
xd(8);
yd(2);
xg(10);
ym(15);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherF()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(10);
yd(2);
xg(8);
yd(4);
xd(6);
yd(3);
xg(6);
yd(6);
xg(2);
ym(15);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherG()
{
// placer avant travail à rat le matériaux
zm(1);
yd(2);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(2);
ym(2);
xd(6);
yd(2);
xd(2);
yd(2);
xg(2);
ym(2);
xg(6);
yd(11);
xd(6);
ym(2);
xg(2);
ym(2);
xd(4);
yd(4);
xg(2);
yd(2);
xg(6);
ym(2);
xg(2);
ym(11);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherH()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(6);
xd(6);
ym(6);
xd(2);
yd(15);
xg(2);
ym(6);
xg(6);
yd(6);
xg(2);
ym(15);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherI()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(10);
yd(2);
xg(4);
yd(11);
xd(4);
yd(2);
xg(10);
ym(2);
xd(4);
ym(11);
xg(4);
ym(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherJ()
{
// placer avant travail à rat le matériaux
zm(1);
xd(4);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(6);
yd(2);
xg(2);
yd(11);
xg(2);
yd(2);
xg(4);
ym(2);
xg(2);
ym(3);
xd(2);
yd(3);
xd(4);
ym(11);
xg(2);
ym(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherK()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(6);
xd(2);
ym(2);
xd(2);
ym(2);
xd(2);
ym(2);
xd(2);
yd(2);
xg(2);
yd(2);
xg(2);
yd(2);
xg(2);
yd(3);
xd(2);
yd(2);
xd(2);
yd(2);
xd(2);
yd(2);
xg(2);
ym(2);
xg(2);
ym(2);
xg(2);
ym(2);
xg(2);
yd(6);
xg(2);
ym(15);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherL()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(13);
xd(8);
yd(2);
xg(10);
ym(15);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherM()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(2);
xd(2);
yd(2);
xd(2);
ym(2);
xd(2);
ym(2);
xd(2);
yd(15);
xg(2);
ym(11);
xg(2);
yd(4);
xg(2);
ym(4);
xg(2);
yd(11);
xg(2);
ym(15);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherN()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(4);
xd(2);
yd(2);
xd(2);
yd(2);
xd(2);
ym(8);
xd(2);
yd(15);
xg(2);
ym(5);
xg(2);
ym(2);
xg(2);
ym(2);
xg(2);
yd(9);
xg(2);
ym(15);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherO()
{
// placer avant travail à rat le matériaux
zm(1);
xd(2);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(6);
yd(2);
xd(2);
yd(11);
xg(2);
yd(2);
xg(6);
ym(2);
xg(2);
ym(11);
xd(2);
ym(2);
// lève pour déplacement
zm(2);
// déplacement
yd(2);
// descente pour reprendre travail
zd(2);
// travail
xd(6);
yd(11);
xg(6);
ym(11);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherP()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(8);
yd(2);
xd(2);
yd(4);
xg(2);
yd(2);
xg(6);
yd(7);
xg(2);
ym(15);
//boucle
xd(2);
zm(2);
yd(2);
zd(2);
xd(6);
yd(4);
xg(6);
ym(4);
zm(2);
ym(2);
xg(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherQ()
{
// placer avant travail à rat le matériaux
zm(1);
xd(2);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(6);
yd(2);
xd(2);
yd(8);
xg(2);
yd(2);
xd(2);
yd(2);
xg(2);
ym(2);
xg(2);
yd(2);
xg(4);
ym(2);
xg(2);
ym(10);
xd(8);
yd(8);
xg(2);
ym(2);
xg(2);
yd(2);
xd(2);
yd(2);
xg(4);
ym(12);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherR()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(8);
yd(2);
xd(2);
yd(4);
xg(2);
yd(2);
xg(2);
yd(2);
xd(2);
yd(2);
xd(2);
yd(2);
xg(2);
ym(2);
xg(2);
ym(2);
xg(2);
yd(6);
xg(2);
ym(14);
// lève pour déplacement
zm(2);
// déplacement
xd(2);
yd(2);
// descente pour reprendre travail
zd(2);
// travail
xd(6);
yd(4);
xg(6);
ym(4);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherS()
{
// placer avant travail à rat le matériaux
zm(1);
xd(2);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(8);
yd(2);
xg(8);
yd(4);
xd(6);
yd(2);
xd(2);
yd(4);
xg(2);
yd(2);
xg(8);
ym(2);
xd(8);
ym(4);
xg(6);
ym(2);
xg(2);
ym(4);
xd(2);
ym(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherT()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(10);
yd(2);
xg(4);
yd(12);
xg(2);
ym(12);
xg(4);
ym(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherU()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(12);
xd(6);
ym(12);
xd(2);
yd(12);
xg(2);
yd(2);
xg(6);
ym(2);
xg(2);
ym(12);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherV()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
yd(8);
xd(2);
yd(4);
xd(2);
yd(2);
xd(2);
ym(2);
xd(2);
ym(4);
xd(2);
ym(8);
xg(2);
yd(8);
xg(2);
yd(4);
xg(2);
ym(4);
xg(2);
ym(8);
xg(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherW()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(12);
xd(2);
ym(6);
xd(2);
yd(6);
xd(2);
ym(12);
xd(2);
yd(12);
xg(2);
yd(2);
xg(2);
ym(2);
xg(2);
yd(2);
xg(2);
ym(2);
xg(2);
ym(12);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherX()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(4);
xd(2);
yd(2);
xd(2);
ym(2);
xd(2);
ym(4);
xd(2);
yd(4);
xg(2);
yd(2);
xg(2);
yd(2);
xd(2);
yd(2);
xd(2);
yd(4);
xg(2);
ym(4);
xg(2);
ym(2);
xg(2);
yd(2);
xg(2);
yd(4);
xg(2);
ym(4);
xd(2);
ym(2);
xd(2);
ym(2);
xg(2);
ym(2);
xg(2);
ym(4);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherY()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(2);
yd(4);
xd(2);
yd(2);
xd(2);
ym(2);
xd(2);
ym(4);
xd(2);
yd(4);
xg(2);
yd(2);
xg(2);
yd(8);
xg(2);
ym(8);
xg(2);
ym(2);
xg(2);
ym(4);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficherZ()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
xd(10);
yd(4);
xg(2);
yd(2);
xg(2);
yd(2);
xg(2);
yd(2);
xg(2);
yd(2);
xd(8);
yd(2);
xg(10);
ym(4);
xd(2);
ym(2);
xd(2);
ym(2);
xd(2);
ym(2);
xd(2);
ym(2);
xg(8);
ym(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher0()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher1()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher2()
{
// placer avant travail à rat le matériaux
zm(1);
xd(2);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(6);
yd(2);
xd(2);
yd(4);
xg(2);
yd(2);
xg(2);
yd(2);
xg(2);
yd(2);
xd(6);
yd(2);
xg(10);
ym(2);
xd(2);
ym(2);
xd(2);
ym(2);
xd(2);
ym(2);
xd(2);
ym(4);
xg(6);
yd(2);
xg(2);
ym(2);
xd(2);
ym(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher3()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher4()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher5()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher6()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher7()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher8()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void afficher9()
{
// descente pour début travail
zd(1);
digitalWrite(fraise, HIGH);
// travail
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
void affiches1()
{
// placer avant travail à rat le matériaux
zm(1);
xd(10);
//mise en route fraise
digitalWrite(fraise, HIGH);
// descente pour début travail
zd(2);
// travail
xd(8); //debut premier cercle
yd(2);
xd(4);
yd(2);
xd(2);
yd(2);
xd(2);
yd(4);
xd(2);
yd(8);
xg(2);
yd(4);
xg(2);
yd(2);
xg(2);
yd(2);
xg(4);
yd(2);
xg(8);
ym(2);
xg(4);
ym(2);
xg(2);
ym(2);
xg(2);
ym(4);
xg(2);
ym(8);
xd(2);
ym(4);
xg(2);
ym(2);
xd(2);
ym(2);
xd(4);
ym(2); //fin premier cercle
zm(2);
yd(2);
zd(2);
xd(8); //début deuxième cercle
yd(2);
xd(4);
yd(2);
xd(2);
yd(2);
xd(2);
yd(4);
xd(2);
yd(8);
xg(2);
yd(4);
xg(2);
yd(2);
xg(2);
yd(2);
xg(4);
yd(2);
xg(8);
ym(2);
xg(4);
ym(2);
xg(2);
ym(2);
xg(2);
ym(4);
xg(2);
ym(8);
xd(2);
ym(4);
xg(2);
ym(2);
xd(2);
ym(2);
xd(4); //fin deuxième cercle
zm(2); //première oeil
yd(6);
zd(2);
yd(4);
xg(4);
ym(4);
xd(4);
zm(2); // deuxieme oeil
xd(12);
zd(2);
yd(4);
xg(4);
ym(4);
xd(4);
zm(2); //bouche
yd(6);
zd(2);
yd(2);
xg(2);
yd(2);
xg(2);
yd(2);
xg(8);
ym(2);
xg(2);
ym(2);
xg(2);
ym(2);
xd(2);
yd(2);
xd(2);
yd(2);
xd(8);
ym(2);
xd(2);
ym(2);
xd(2);
// fin travail
// remonte fraise
zm(2);
digitalWrite(fraise, LOW);
delay(500);
retour_travail_caracs();
delay(500);
}
#ifndef CaracteresCNC_h
#define CaracteresCNC_h
#include "Arduino.h"
#include "ctype.h"
void setup_axe();
void sethome();
void sethome_axe_X();
void sethome_axe_Y();
void sethome_axe_Z();
void sethome_fraise();
void start_pros_decoupe();
void start_pros_defonce();
void start_pros_gravure();
void calibrage_foret();
void calibrage_pointe();
void execution();
void mise_en_place_valeur();
void mise_en_place_valeur_slice();
void mise_en_place_valeur_gravure();
void depart();
void val_F1();
void decoupe_F1();
void defoncage_F1();
void gravure_F1();
void retour_machine();
void retour_travail();
void calcul_Z_dep();
void retour_travail_caracs();
void afficherA();
void afficherB();
void afficherC();
void afficherD();
void afficherE();
void afficherF();
void afficherG();
void afficherH();
void afficherI();
void afficherJ();
void afficherK();
void afficherL();
void afficherM();
void afficherN();
void afficherO();
void afficherP();
void afficherQ();
void afficherR();
void afficherS();
void afficherT();
void afficherU();
void afficherV();
void afficherW();
void afficherX();
void afficherY();
void afficherZ();
void afficher1();
void afficher2();
void afficher3();
void afficher4();
void afficher5();
void afficher6();
void afficher7();
void afficher8();
void afficher9();
void afficher0();
void affiches1();
void xd(int val1);
void xg(int val2);
void yd(int val3);
void ym(int val4);
void zd(int val5);
void zm(int val6);
void recep_var();
#endif
Ci-dessous celui utilisé dans lazarus/delphi: Unit1.pas
unit Unit1;
{$MODE Delphi}
interface
uses
LCLIntf, LCLType, LMessages, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Unit2;
type
TForm1 = class(TForm)
Frame21: TFrame2;
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
end.
Project1.lpr
program Project1;
{$MODE Delphi}
uses
{$ifdef UseCmem}
cmem,
{$endif}
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Forms, Interfaces,
Unit1 in 'Unit1.pas' {Form1},
Unit2 in 'Unit2.pas' {Frame2: TFrame};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Project1.cfg
-$A8
-$B-
-$C+
-$D+
-$E-
-$F-
-$G+
-$H+
-$I+
-$J-
-$K-
-$L+
-$M-
-$N+
-$O+
-$P+
-$Q-
-$R-
-$S-
-$T-
-$U-
-$V+
-$W-
-$X+
-$YD
-$Z1
-cg
-AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-H+
-W+
-M
-$M16384,1048576
-K$00400000
-LE"c:\delphi6\Projects\Bpl"
-LN"c:\delphi6\Projects\Bpl"
Project1.lpi
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasUsesSectionForAllUnits Value="False"/>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Project1"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="4">
<Item1>
<PackageName Value="laz_synapse"/>
</Item1>
<Item2>
<PackageName Value="LazSerialPort"/>
</Item2>
<Item3>
<PackageName Value="TAChartLazarusPkg"/>
</Item3>
<Item4>
<PackageName Value="LCL"/>
</Item4>
</RequiredPackages>
<Units Count="5">
<Unit0>
<Filename Value="Project1.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="Unit1.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
</Unit1>
<Unit2>
<Filename Value="Unit2.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Frame2"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
</Unit2>
<Unit3>
<Filename Value="unitportcom.lfm"/>
<IsPartOfProject Value="True"/>
</Unit3>
<Unit4>
<Filename Value="unitportcom.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
<UnitName Value="UnitPortCOM"/>
</Unit4>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<SyntaxMode Value="Delphi"/>
</SyntaxOptions>
</Parsing>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other>
<CustomOptions Value="-dBorland -dVer150 -dDelphi7 -dCompiler6_Up -dPUREPASCAL"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>
Unit2.dfm cliquez ici pour voir
Unit2.lrs
LazarusResources.Add('TFrame2','FORMDATA',[
'TPF0'#7'TFrame2'#6'Frame2'#4'Left'#2#0#6'Height'#3#146#2#3'Top'#2#0#5'Width'
+#3'$'#5#12'ClientHeight'#3#146#2#11'ClientWidth'#3'$'#5#8'TabOrder'#2#0#9'De'
+'signTop'#3#196#0#0#9'TGroupBox'#9'GroupBox1'#4'Left'#2#24#6'Height'#3'y'#2#3
+'Top'#2#8#5'Width'#3'i'#1#7'Caption'#6#4'TROU'#12'ClientHeight'#3'i'#2#11'Cl'
+'ientWidth'#3'g'#1#8'TabOrder'#2#0#0#6'TLabel'#6'Label1'#4'Left'#2#16#6'Heig'
+'ht'#2#15#3'Top'#2#16#5'Width'#2'.'#7'Caption'#6#6'X (mm)'#11'ParentColor'#8
+#0#0#6'TLabel'#6'Label2'#4'Left'#2'P'#6'Height'#2#15#3'Top'#2#16#5'Width'#2
+'-'#7'Caption'#6#6'Y (mm)'#11'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'
+#3#144#0#6'Height'#2#15#3'Top'#2#16#5'Width'#2'6'#7'Caption'#6#7'X2 (mm)'#11
+'ParentColor'#8#0#0#6'TLabel'#6'Label4'#4'Left'#3#208#0#6'Height'#2#15#3'Top'
+#2#16#5'Width'#2'5'#7'Caption'#6#7'Y2 (mm)'#11'ParentColor'#8#0#0#6'TLabel'#6
+'Label5'#4'Left'#3#16#1#6'Height'#2#15#3'Top'#2#16#5'Width'#2'.'#7'Caption'#6
+#6'Z (mm)'#11'ParentColor'#8#0#0#7'TButton'#3'new'#4'Left'#2#16#6'Height'#2
+#25#3'Top'#2'H'#5'Width'#2'K'#7'Caption'#6#3'NEW'#7'OnClick'#7#4'trou'#8'Tab'
+'Order'#2#0#0#0#5'TEdit'#5'xtrou'#4'Left'#2#16#6'Height'#2' '#3'Top'#2'('#5
+'Width'#2'9'#8'TabOrder'#2#1#4'Text'#6#1' '#0#0#5'TEdit'#5'ytrou'#4'Left'#2
+'P'#6'Height'#2' '#3'Top'#2'('#5'Width'#2'9'#8'TabOrder'#2#2#4'Text'#6#1' '#0
+#0#5'TEdit'#8'xtroufin'#4'Left'#3#144#0#6'Height'#2' '#3'Top'#2'('#5'Width'#2
+'9'#8'TabOrder'#2#3#4'Text'#6#1' '#0#0#5'TEdit'#8'ytroufin'#4'Left'#3#208#0#6
+'Height'#2' '#3'Top'#2'('#5'Width'#2'9'#8'TabOrder'#2#4#4'Text'#6#1' '#0#0#5
+'TEdit'#5'ztrou'#4'Left'#3#16#1#6'Height'#2' '#3'Top'#2'('#5'Width'#2'9'#8'T'
+'abOrder'#2#5#4'Text'#6#1' '#0#0#0#9'TGroupBox'#9'GroupBox2'#4'Left'#3#128#1
+#6'Height'#3'y'#2#3'Top'#2#8#5'Width'#3#233#3#7'Caption'#6#6'SLICER'#12'Clie'
+'ntHeight'#3'i'#2#11'ClientWidth'#3#231#3#8'TabOrder'#2#1#0#6'TShape'#6'Shap'
+'e1'#4'Left'#3#0#1#6'Height'#3#25#1#3'Top'#3#192#0#5'Width'#3#201#1#0#0#6'TL'
+'abel'#1'X'#4'Left'#2'0'#6'Height'#2#15#3'Top'#2'0'#5'Width'#2'.'#7'Caption'
+#6#6'X (mm)'#11'ParentColor'#8#0#0#6'TLabel'#1'Y'#4'Left'#3#144#0#6'Height'#2
+#15#3'Top'#2'0'#5'Width'#2'-'#7'Caption'#6#6'Y (mm)'#11'ParentColor'#8#0#0#5
+'TEdit'#5'Edit1'#4'Left'#2'0'#6'Height'#2' '#3'Top'#2'@'#5'Width'#2'Q'#8'OnC'
+'hange'#7#7'xchange'#8'TabOrder'#2#0#4'Text'#6#3'270'#0#0#5'TEdit'#5'Edit2'#4
+'Left'#3#144#0#6'Height'#2' '#3'Top'#2'@'#5'Width'#2'Q'#8'OnChange'#7#7'ycha'
+'nge'#8'TabOrder'#2#1#4'Text'#6#3'150'#0#0#6'TPanel'#5'trou1'#4'Left'#3#8#1#6
+'Height'#2#25#3'Top'#3#200#0#5'Width'#2'1'#7'Caption'#6#1' '#8'TabOrder'#2#2
+#0#0#0#0
]);
unitportcom.pas
unit UnitPortCOM;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, process, Forms, Controls, Graphics, Dialogs, StdCtrls,
LazSerial, Serial;
type
{ TForm1 }
TForm1 = class(TForm)
BTNconnect: TButton;
BTNrefresh: TButton;
Button1: TButton;
Button2: TButton;
Button3: TButton;
CbPort: TComboBox;
Label1: TLabel;
LabelportCOM: TLabel;
LabelportCOM1: TLabel;
LabelportCOM2: TLabel;
Memo1: TMemo;
PortCOM1: TLabel;
LazCom: TLazSerial;
PortCOM2: TLabel;
Process1: TProcess;
procedure BTNconnectClick(Sender: TObject);
procedure BTNrefreshClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure CbPortChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure LazComRxData(Sender: TObject);
procedure PortCOM1Click(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.PortCOM1Click(Sender: TObject);
begin
end;
procedure TForm1.BTNrefreshClick(Sender: TObject);
begin
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.clear;
end;
procedure TForm1.Button2Click(Sender: TObject);
var
GServerStream: TStream;
begin
Lazcom.WriteData('coucou');
end;
procedure TForm1.Button3Click(Sender: TObject);
var
Result : Integer;
s:ansistring;
begin
//Result := ShellExecute(0, nil, 'start', '.\nircmd.exe changesysvolume 0', nil, SW_SHOWNORMAL);
//RunCommand('.\nircmd.exe changesysvolume 0',s);
//ShellExecute(Handle,'cmd',PChar('C:\nircmd-x64\nircmd.exe changesysvolume 0'),nil,nil,5);
//sizeof(MyWaveOutCaps)=MMSYSERR_NOERROR then
process1.Execute;
end;
procedure TForm1.BTNconnectClick(Sender: TObject);
begin
lazcom.Device:='/dev/ttyACM0';
if LazCom.active then
begin
LazCom.close;
BTNconnect.caption:= 'Connecter';
PortCOM1.caption:='Déconnecté';
end else
begin
Lazcom.Open;
BTNconnect.caption:= 'Connecter';
PortCOM1.caption:='Connecté';
end;
end;
procedure TForm1.CbPortChange(Sender: TObject);
var StrX : String;
S, E : Integer;
begin
StrX := CbPort.Text;
S := AnsiPos ('COM', StrX);
E := AnsiPos (')' , StrX) ;
if S<>0 then LazCom.Device :=Copy (StrX, S, E-S)
else LazCom. Device :='No Port';
PortCOM2.Caption := LazCom.Device;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
BTNrefreshClick(sender);
end;
procedure TForm1.LazComRxData(Sender: TObject);
var
Temp : String;
Proc: TProcess;
Temp2: string;
begin
if LazCom.DataAvailable then
begin
Temp := LazCom.ReadData ;
Memo1.text := Memo1.text+Temp;
Memo1.Lines.Add('');
//Label1.caption:=Temp;
end;
end;
end.
Unit2.pas
unit Unit2;
interface
uses
Messages, SysUtils, Classes, process, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, TypInfo, Clipbrd, ComCtrls, LCLIntf, Buttons, Menus,
LazSerial, TAGraph, Serial;
type
{ TFrame2 }
TFrame2 = class(TFrame)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
CLEAR: TButton;
center: TButton;
circle: TButton;
del: TButton;
delcircle: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Panel2: TPanel;
Panel3: TPanel;
positiononx: TEdit;
positionony: TEdit;
positiononz: TEdit;
ONOFF: TEdit;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
Image1: TImage;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
RadioButton5: TRadioButton;
RadioButton6: TRadioButton;
RadioGroup1: TRadioGroup;
Shape4: TImage;
ImageList1: TImageList;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
LazCom: TLazSerial;
Memo1: TMemo;
Memo2: TMemo;
new: TButton;
ok: TButton;
OpenDialog1: TOpenDialog;
PageControl1: TPageControl;
Panel1: TPanel;
pick: TButton;
SelectDirectoryDialog1: TSelectDirectoryDialog;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
ToggleBox1: TToggleBox;
ToggleBox2: TToggleBox;
TrackBar1: TTrackBar;
TrackBar2: TTrackBar;
trou1: TPanel;
trou2: TPanel;
X: TLabel;
xorigin: TEdit;
Xoriginlabel: TLabel;
xtrou: TEdit;
xtrou1: TEdit;
xtrou2: TEdit;
xtroufin: TEdit;
xtroufin1: TEdit;
xtroufin2: TEdit;
Y: TLabel;
yorigin: TEdit;
Yoriginlabel: TLabel;
ytrou: TEdit;
ytrou1: TEdit;
ytrou2: TEdit;
ytroufin: TEdit;
ytroufin1: TEdit;
ytroufin2: TEdit;
Z: TLabel;
zedit: TEdit;
ztrou: TEdit;
ztrou1: TEdit;
ztrou2: TEdit;
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure ButtonClick(Sender: TObject);
procedure centerClick(Sender: TObject); //center the shape
procedure check(Sender: TObject);
procedure clearcanva(Sender: TObject);
procedure close(Sender: TObject);
procedure delClick(Sender: TObject); //delete a hole
procedure circledraw(Sender: TObject); //draw a circle
procedure delecircle(Sender: TObject); //delete a circle
procedure Image1Click(Sender: TObject); //send to the site when clicking the logo
procedure LazComRxData(Sender: TObject);
procedure newfile(Sender: TObject);
procedure Panel1Click(Sender: TObject);
procedure pickonscreen2(Sender: TObject); //pick 2 points on the shape to make a hole
procedure RadioButton6Change(Sender: TObject);
procedure startpick(Sender: TObject); //manage the pickonscreen2 procedure
procedure TabSheet3Show(Sender: TObject);
procedure Test(Sender: TObject);
procedure ToggleBox1Change(Sender: TObject);
procedure ToggleBox1Click(Sender: TObject);
procedure ToggleBox2Change(Sender: TObject);
procedure validate(Sender: TObject); //actualise the hole and the shape
procedure xbar(Sender: TObject); //executed when changing the x progressbar value
procedure xoriginchange(Sender: TObject); //executed when changing the x origin edit
procedure ybar(Sender: TObject); //executed when changing the y progressbar value
procedure ychange(Sender: TObject); //executed when changing the y value of the shape
procedure xchange(Sender: TObject); //executed when changing the x value of the shape
procedure trou(Sender: TObject); //activate a new rectangular hole
procedure savefile(Sender: TObject); //save settings to test.txt
procedure readfile(sender: TObject); //read settings from test.txt
procedure yoriginchange(Sender: TObject); //executed when changing the y origin edit
private
{ Déclarations privées }
public
{ Déclarations publiques }
var
Image: TImage;
onetime: integer;
CursorPos: TPoint;
placed: integer;
xpos: integer;
ypos: integer;
input: string;
positionx: integer;
positiony: integer;
xhere, yhere, zhere: integer;
checkedvar: integer;
end;
implementation
{$R *.dfm}
procedure TFrame2.ychange(Sender: TObject);
begin
if(Edit2.Text='') then
begin
Edit2.Text:=inttostr(0);
end;
if(strtoint(Edit2.Text)>150) then
begin
Edit2.Text:=inttostr(150);
end;
Shape1.Height:= strtoint(Edit2.Text)*2;
validate(Sender);
end;
procedure TFrame2.validate(Sender: TObject);
begin
if(xtrou2.enabled=true)then
begin
while(strtoint(xtroufin2.Text)+strtoint(xtrou2.Text)>shape1.Width div 2)do
begin
xtroufin2.Text:=inttostr(strtoint(xtroufin2.Text)-1);
while(strtoint(xtrou2.Text)>shape1.Width div 2)do
begin
xtrou2.Text:=inttostr(strtoint(xtrou2.Text)-1);
end;
end;
while(strtoint(ytroufin2.Text)+strtoint(ytrou2.Text)>shape1.height div 2)do
begin
ytroufin2.Text:=inttostr(strtoint(ytroufin2.Text)-1);
while(strtoint(ytrou2.Text)>shape1.height div 2)do
begin
ytrou2.Text:=inttostr(strtoint(ytrou2.Text)-1);
end;
end;
shape3.top:=shape1.Top + strtoint(ytrou2.Text) * 2;
shape3.left:=shape1.left + strtoint(xtrou2.Text) * 2;
shape3.height:=strtoint(ytroufin2.Text) * 2;
shape3.width:=strtoint(xtroufin2.Text) * 2;
//shape3.caption:=ztrou2.text; //don't work with this shape
end;
if(xtrou.Enabled=true) then
begin
while(strtoint(xtroufin.Text)+strtoint(xtrou.Text)>shape1.Width div 2)do
begin
xtroufin.Text:=inttostr(strtoint(xtroufin.Text)-1);
while(strtoint(xtrou.Text)>shape1.Width div 2)do
begin
xtrou.Text:=inttostr(strtoint(xtrou.Text)-1);
end;
end;
while(strtoint(ytroufin.Text)+strtoint(ytrou.Text)>shape1.height div 2)do
begin
ytroufin.Text:=inttostr(strtoint(ytroufin.Text)-1);
while(strtoint(ytrou.Text)>shape1.height div 2)do
begin
ytrou.Text:=inttostr(strtoint(ytrou.Text)-1);
end;
end;
trou1.top:=shape1.Top + strtoint(ytrou.Text) * 2;
trou1.left:=shape1.left + strtoint(xtrou.Text) * 2;
trou1.height:=strtoint(ytroufin.Text) * 2;
trou1.width:=strtoint(xtroufin.Text) * 2;
trou1.caption:=ztrou.text;
end;
if(xtrou1.Enabled=true) then
begin
while(strtoint(xtroufin1.Text)+strtoint(xtrou1.Text)>shape1.Width div 2)do
begin
xtroufin1.Text:=inttostr(strtoint(xtroufin1.Text)-1);
while(strtoint(xtrou1.Text)>shape1.Width div 2)do
begin
xtrou1.Text:=inttostr(strtoint(xtrou1.Text)-1);
end;
end;
while(strtoint(ytroufin1.Text)+strtoint(ytrou1.Text)>shape1.height div 2)do
begin
ytroufin.Text:=inttostr(strtoint(ytroufin1.Text)-1);
while(strtoint(ytrou1.Text)>shape1.height div 2)do
begin
ytrou1.Text:=inttostr(strtoint(ytrou1.Text)-1);
end;
end;
trou2.top:=shape1.Top + strtoint(ytrou1.Text) * 2;
trou2.left:=shape1.left + strtoint(xtrou1.Text) * 2;
trou2.height:=strtoint(ytroufin1.Text) * 2;
trou2.width:=strtoint(xtroufin1.Text) * 2;
trou2.caption:=ztrou1.text;
end;
end;
procedure TFrame2.xbar(Sender: TObject);
begin
edit1.Text:=inttostr(Trackbar1.Position - strtoint(xorigin.Text));
end;
procedure TFrame2.xoriginchange(Sender: TObject);
begin
if(xorigin.Text='') then
begin
xorigin.Text:=inttostr(0);
end;
if(strtoint(xorigin.Text)>250) then
begin
xorigin.Text:=inttostr(250);
end;
Trackbar1.Min:=strtoint(Xorigin.Text);
shape1.Left:=240 + strtoint(Xorigin.Text)*2;
Trackbar1.left:=230 + strtoint(Xorigin.Text)*2;
Trackbar1.Width:=560 - strtoint(Xorigin.Text)*2;
xbar(sender);
end;
procedure TFrame2.ybar(Sender: TObject);
begin
edit2.Text:=inttostr(Trackbar2.Position - strtoint(yorigin.Text));
end;
procedure TFrame2.delClick(Sender: TObject);
begin
if(new.top=110)then
begin
xtrou1.Top:=xtrou1.top-30;
ytrou1.Top:=ytrou1.top-30;
xtroufin1.Top:=xtroufin1.top-30;
ytroufin1.Top:=ytroufin1.top-30;
ztrou1.Top:=ztrou1.top-30;
trou2.Visible:=false;
xtrou1.Enabled:=false;
ytrou1.enabled:=false;
xtroufin1.Enabled:=false;
ytroufin1.enabled:=false;
ztrou1.Enabled:=false;
xtrou1.text:=inttostr(0);
ytrou1.text:=inttostr(0);
xtroufin1.text:=inttostr(0);
ytroufin1.text:=inttostr(0);
ztrou1.text:=inttostr(0);
new.enabled:=true;
new.Top:= new.Top-30;
ok.Top:=ok.Top-30;
del.Top:=del.top-30;
button1.top:=button1.top-30;
end
else
begin
xtrou.text:=inttostr(0);
ytrou.text:=inttostr(0);
xtroufin.text:=inttostr(0);
ytroufin.text:=inttostr(0);
ztrou.text:=inttostr(0);
xtrou.Enabled:=false;
ytrou.enabled:=false;
xtroufin.Enabled:=false;
ytroufin.enabled:=false;
ztrou.Enabled:=false;
trou1.Visible:=false;
//ok.enabled:=false;
del.enabled:=false;
end;
end;
procedure TFrame2.circledraw(Sender: TObject);
var
placed: integer;
begin
xtrou2.top := circle.top - 30;
ytrou2.top := circle.top - 30;
xtroufin2.top := circle.top - 30;
ytroufin2.top := circle.top - 30;
ztrou2.top := circle.top - 30;
xtrou2.enabled := true;
ytrou2.Enabled := true;
xtroufin2.enabled := true;
ytroufin2.enabled := true;
ztrou2.enabled := true;
circle.enabled := false;
delcircle.enabled := true;
showmessage('Now you can pick 2 points on the area' + #13#10 + 'Note: This pick will works only for the circular hole');
onetime:=0;
while(placed<>2)do
begin
while(onetime=0)do
begin
Application.ProcessMessages; //just waiting still the user pick 1 points
GetCursorPos(CursorPos);
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtrou2.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5);
ytrou2.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33);
validate(Sender);
end;
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtrou2.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5);
ytrou2.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33);
placed:=1;
while(onetime=1)do
begin
Application.ProcessMessages; //just waiting still the user pick 1 points
GetCursorPos(CursorPos);
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtroufin2.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5 - strtoint(xtrou2.Text));
ytroufin2.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33 - strtoint(ytrou2.text));
validate(Sender);
end;
begin
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtroufin2.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5 - strtoint(xtrou2.Text));
ytroufin2.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33 - strtoint(ytrou2.text));
placed:=2;
end;
end;
Input := InputBox('Depth', 'Depth of the hole :', '');
ztrou2.text:=Input;
placed:=0;
onetime:=0;
validate(Sender);
end;
procedure TFrame2.delecircle(Sender: TObject);
begin
xtrou2.top := xtrou.top;
ytrou2.top := xtrou.top;
xtroufin2.top := xtrou.top;
ytroufin2.top := xtrou.top;
ztrou2.top := xtrou.top;
xtrou2.enabled := false;
ytrou2.Enabled := false;
xtroufin2.enabled := false;
ytroufin2.enabled := false;
ztrou2.enabled := false;
circle.enabled := true;
delcircle.enabled := false;
end;
procedure TFrame2.centerClick(Sender: TObject);
begin
xorigin.Text:=inttostr(135 div 2);
yorigin.Text:=inttostr(75 div 2);
trackbar1.Position:=135 + 135 div 2;
trackbar2.position:=75 + 75 div 2;
end;
procedure TFrame2.check(Sender: TObject);
begin
case (Sender as TCheckBox).Tag of
1: begin //test1
Checkedvar:=1;
end;
2: begin //test2
Checkedvar:=2;
end;
3: begin //test3
Checkedvar:=3;
end;
end;
end;
procedure TFrame2.clearcanva(Sender: TObject);
begin
Shape4.Canvas.Clear;
Shape4.Canvas.Pen.Width:=5;
Shape4.Canvas.pen.Color:=clWhite;
Shape4.Canvas.Rectangle(0,0,Shape4.Width,Shape4.Height);
Shape4.Canvas.pen.Color:=clBlack;
Button2.Enabled:=true;
Button3.Enabled:=true;
Button4.Enabled:=true;
Button5.Enabled:=true;
ToggleBox2.Enabled:=true;
Button6.Enabled:=true;
Button7.Enabled:=true;
Button8.caption:='READY';
xhere:=0;
yhere:=0;
zhere:=40;
lazcom.WriteData('r');
lazcom.WriteData(',');
end;
procedure TFrame2.ButtonClick(Sender: TObject);
var
dx, dy, dz: integer;
begin
// Determine the direction of the line based on the button that was clicked
Panel2.Visible:=true;
Button9.Enabled:=false;
case (Sender as TButton).Tag of
1: begin // Up
dx := 0;
dy := -5;
end;
2: begin // Down
dx := 0;
dy := 5;
end;
3: begin // Left
dx := -5;
dy := 0;
end;
4: begin // Right
dx := 5;
dy := 0;
end;
5: begin // upside
dz := 5;
end;
6: begin // downside
dz := -5
end;
end;
// Draw the line on Shape4
//Shape4.Canvas.Pen.Width:=round((zhere+dz) div 10);
if (xhere=0) and (dx=-5) then
dx:=0;
if (yhere=0) and (dy=-5) then
dy:=0;
if (xhere=270) and (dx=5) then
dx:=0;
if (yhere=150) and (dy=5) then
dy:=0;
if not(dx = 0) then
begin
lazcom.WriteData('x');
lazcom.WriteData(',');
lazcom.WriteData(inttostr(dx));
lazcom.WriteData(',');
end;
if not(dy = 0) then
begin
lazcom.WriteData('y');
lazcom.WriteData(',');
lazcom.WriteData(inttostr(dy));
lazcom.WriteData(',');
end;
Shape4.Canvas.Line(xhere*2,yhere*2,xhere*2+dx*2, yhere*2+dy*2);
xhere:=xhere+dx;
yhere:=yhere+dy;
zhere:=zhere+dz;
positiononx.Text:=inttostr(xhere);
positionony.Text:=inttostr(yhere);
positiononz.Text:=inttostr(zhere);
end;
procedure TFrame2.Button2Click(Sender: TObject);
begin
lazcom.WriteData('z');
lazcom.WriteData(',');
lazcom.WriteData('5');
lazcom.WriteData(',');
end;
procedure TFrame2.Button3Click(Sender: TObject);
begin
lazcom.WriteData('z');
lazcom.WriteData(',');
lazcom.WriteData('-5');
lazcom.WriteData(',');
end;
procedure TFrame2.Button9Click(Sender: TObject);
var
text: String;
i: Integer;
begin
Panel2.Visible:=true;
Button9.enabled:=false;
if (RadioButton1.Checked=true) then
begin
lazcom.WriteData('t1');
lazcom.WriteData(',');
end;
if (RadioButton2.Checked=true) then
begin
lazcom.WriteData('t2');
lazcom.WriteData(',');
end;
if (RadioButton3.Checked=true) then
begin
lazcom.WriteData('t3');
lazcom.WriteData(',');
end;
if (Radiobutton4.Checked=true) then
begin
lazcom.WriteData('t4');
lazcom.WriteData(',');
end;
if (RadioButton3.Checked=true) then
begin
lazcom.WriteData('t5');
lazcom.WriteData(',');
end;
if (RadioButton6.Checked=true) then
begin
lazcom.WriteData('t');
lazcom.WriteData(',');
text := edit3.Text;
for i := 1 to Length(text) do
begin
if (text[i] >= 'a') and (text[i] <= 'z') then
lazcom.WriteData(IntToStr(Ord(text[i]) - Ord('a') + 1))
else if (text[i] >= '0') and (text[i] <= '9') then
lazcom.WriteData(IntToStr(Ord(text[i]) - Ord('0') + 27))
else
lazcom.WriteData('');
lazcom.WriteData(',');
end;
end;
end;
procedure TFrame2.close(Sender: TObject);
begin
application.Terminate;
end;
procedure TFrame2.Image1Click(Sender: TObject);
begin
OpenURL('https://stistlouis.netlify.app');
end;
procedure TFrame2.LazComRxData(Sender: TObject);
var
Temp : String;
Proc: TProcess;
Temp2: string;
begin
if LazCom.DataAvailable then
begin
Button9.enabled:=true;
Panel2.Visible:=false;
Temp := LazCom.ReadData ;
Memo2.text := Memo2.text+Temp;
//Memo2.Lines.Add('');
//Label1.caption:=Temp;
end;
end;
procedure TFrame2.newfile(Sender: TObject);
begin
xorigin.text:='0';
yorigin.Text:='0';
zedit.text:='0';
xtrou.text:='0';
ytrou.text:='0';
ztrou.text:='0';
xtrou1.text:='0';
ytrou1.text:='0';
ztrou1.text:='0';
xtrou2.text:='0';
ytrou2.text:='0';
ztrou2.text:='0';
xtroufin1.text:='0';
ytroufin1.text:='0';
xtroufin.text:='0';
ytroufin.text:='0';
xtroufin2.text:='0';
ytroufin2.text:='0';
Trackbar1.Position:=Trackbar1.Max;
Trackbar2.Position:=Trackbar2.Max;
validate(sender);
end;
procedure TFrame2.Panel1Click(Sender: TObject);
begin
end;
procedure TFrame2.pickonscreen2(Sender: TObject);
begin
GetCursorPos(CursorPos);
onetime:=onetime+1;
end;
procedure TFrame2.RadioButton6Change(Sender: TObject);
begin
edit3.enabled:=radiobutton6.Checked;
end;
procedure TFrame2.startpick(Sender: TObject);
begin
if(xtrou1.enabled=false)then
begin
showmessage('Now you can pick 2 points on the area' + #13#10 + 'Note: This pick will works only for the first hole');
onetime:=0;
while(placed<>2)do
begin
while(onetime=0)do
begin
Application.ProcessMessages; //just waiting still the user pick 1 points
GetCursorPos(CursorPos);
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtrou.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2);
ytrou.Text:=inttostr((ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2)-33);
validate(Sender);
end;
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtrou.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5);
ytrou.Text:=inttostr((ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2) - 33);
placed:=1;
while(onetime=1)do
begin
Application.ProcessMessages; //just waiting still the user pick 1 points
GetCursorPos(CursorPos);
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtroufin.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5 - strtoint(xtrou.Text));
ytroufin.Text:=inttostr((ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 -55 -strtoint(ytrou.text)));
validate(Sender);
end;
begin
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtroufin.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5 - strtoint(xtrou.Text));
ytroufin.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 -55- strtoint(ytrou.text));
placed:=2;
end;
end;
Input := InputBox('Depth', 'Depth of the hole :', '');
ztrou.text:=Input;
placed:=0;
onetime:=0;
validate(Sender);
end
else
begin
showmessage('Now you can pick 2 points on the area' + #13#10 + 'Note: This pick will works only for the second hole');
onetime:=0;
while(placed<>2)do
begin
while(onetime=0)do
begin
Application.ProcessMessages; //just waiting still the user pick 1 points
GetCursorPos(CursorPos);
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtrou1.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5);
ytrou1.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33);
validate(Sender);
end;
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtrou1.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5);
ytrou1.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33);
placed:=1;
while(onetime=1)do
begin
Application.ProcessMessages; //just waiting still the user pick 1 points
GetCursorPos(CursorPos);
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtroufin1.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5 - strtoint(xtrou1.Text));
ytroufin1.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33 - strtoint(ytrou1.text));
validate(Sender);
end;
begin
xpos:= CursorPos.X;
ypos:= CursorPos.Y;
xtroufin1.Text:=inttostr(xpos div 2 - shape1.Left div 2 - Groupbox2.Left div 2 - 5 - strtoint(xtrou1.Text));
ytroufin1.Text:=inttostr(ypos div 2 - shape1.Top div 2 - Groupbox2.Top div 2 - 33 - strtoint(ytrou1.text));
placed:=2;
end;
end;
Input := InputBox('Depth', 'Depth of the hole :', '');
ztrou1.text:=Input;
placed:=0;
onetime:=0;
validate(Sender);
end;
end;
procedure TFrame2.TabSheet3Show(Sender: TObject);
begin
//positiononx:=Shape4.Left;
//positionony:=Shape4.Top;
end;
procedure TFrame2.Test(Sender: TObject);
begin
if Button8.caption='READY' then
begin
Button9.enabled:=true;
Shape4.Canvas.Pen.Width:=5;
Shape4.Canvas.pen.Color:=clWhite;
Shape4.Canvas.Rectangle(0,0,Shape4.Width,Shape4.Height);
Shape4.Canvas.pen.Color:=clBlack;
Button2.Enabled:=true;
Button3.Enabled:=true;
Button4.Enabled:=true;
Button5.Enabled:=true;
ToggleBox2.Enabled:=true;
Button6.Enabled:=true;
Button7.Enabled:=true;
Button8.Caption:='DISCONNECT';
xhere:=0;
yhere:=0;
zhere:=40;
lazcom.ShowSetupDialog;
lazcom.Active:=true;
Lazcom.Open;
end
else
begin
Shape4.Canvas.Pen.Width:=5;
Shape4.Canvas.pen.Color:=clWhite;
Shape4.Canvas.Rectangle(0,0,Shape4.Width,Shape4.Height);
Shape4.Canvas.pen.Color:=clBlack;
Button2.Enabled:=false;
Button3.Enabled:=false;
Button4.Enabled:=false;
Button5.Enabled:=false;
ToggleBox2.Enabled:=false;
Button6.Enabled:=false;
Button7.Enabled:=false;
Button8.Caption:='READY';
xhere:=0;
yhere:=0;
zhere:=40;
Lazcom.Close;
lazcom.Active:=false;
end;
end;
procedure TFrame2.ToggleBox1Change(Sender: TObject);
begin
end;
//TShape1.Canvas.MoveTo(TShape1.Left, TShape1.Top); // start at the current position
//TShape1.Canvas.LineTo(TShape1.Left + 10, TShape1.Top); // draw a line to the new position
procedure TFrame2.ToggleBox1Click(Sender: TObject);
var
Txt: TextFile;
s: string;
AllText: string;
i: integer;
filename: string;
l: integer;
begin
Panel2.Visible:=true;
button9.Enabled:=false;
AllText := '';
if OpenDialog1.execute then
begin
filename := OpenDialog1.Filename;
AssignFile(Txt, filename);
Reset(Txt);
i:=1;
l:=0;
while not Eof(Txt) do
begin
Readln(Txt, s);
l:=l+1;
AllText := AllText + s;
// Write out each line; comment out to stop.
//Writeln(s);
Lazcom.WriteData(s);
Lazcom.WriteData(',');
i:=i+1;
end;
CloseFile(Txt);
memo2.Lines.Add(alltext);
end;
end;
procedure TFrame2.ToggleBox2Change(Sender: TObject);
begin
if ToggleBox2.Checked = true then
begin
ONOFF.Text:='True';
lazcom.WriteData('i');
lazcom.WriteData(',');
end
else
ONOFF.Text:='False';
lazcom.WriteData('o');
lazcom.WriteData(',');
end;
procedure TFrame2.xchange(Sender: TObject);
begin
if(Edit1.Text='') then
begin
Edit1.Text:=inttostr(0);
end;
if(strtoint(Edit1.Text)>270) then
begin
Edit1.Text:=inttostr(270);
end;
Shape1.width:= strtoint(Edit1.Text)*2;
validate(Sender);
end;
procedure TFrame2.trou(Sender: TObject);
begin
if(xtrou.enabled=false) then
begin
xtrou.Enabled:=true;
ytrou.enabled:=true;
xtroufin.Enabled:=true;
ytroufin.enabled:=true;
ztrou.Enabled:=true;
trou1.Visible:=true;
ok.enabled:=true;
del.enabled:=true;
end
else
begin
if(new.top=80)then
begin
xtrou1.Top:=xtrou1.top+30;
ytrou1.Top:=ytrou1.top+30;
xtroufin1.Top:=xtroufin1.top+30;
ytroufin1.Top:=ytroufin1.top+30;
ztrou1.Top:=ztrou1.top+30;
trou2.Visible:=true;
xtrou1.Enabled:=true;
ytrou1.enabled:=true;
xtroufin1.Enabled:=true;
ytroufin1.enabled:=true;
ztrou1.Enabled:=true;
new.enabled:=false;
end;
new.Top:= new.Top+30;
ok.Top:=ok.Top+30;
del.Top:=del.top+30;
button1.Top:=button1.top+30;
end;
end;
procedure TFrame2.savefile(Sender: TObject);
var
MyText: TStringlist;
movx: integer;
movy: integer;
z: integer;
begin
MyText:= TStringlist.create;
try
xtrou.text := StringReplace(xtrou.text, ' ', '', [rfReplaceAll]); //Remove spaces
ytrou.Text := StringReplace(ytrou.Text, ' ', '', [rfReplaceAll]); //Remove spaces
xtroufin.text := StringReplace(xtroufin.text, ' ', '', [rfReplaceAll]); //Remove spaces
ytroufin.text := StringReplace(ytroufin.text, ' ', '', [rfReplaceAll]); //Remove spaces
ztrou.text := StringReplace(ztrou.text, ' ', '', [rfReplaceAll]); //Remove spaces
xtrou1.text := StringReplace(xtrou1.text, ' ', '', [rfReplaceAll]); //Remove spaces
ytrou1.text := StringReplace(ytrou1.text, ' ', '', [rfReplaceAll]); //Remove spaces
xtroufin1.text := StringReplace(xtroufin1.text, ' ', '', [rfReplaceAll]); //Remove spaces
ytroufin1.text := StringReplace(ytroufin1.text, ' ', '', [rfReplaceAll]); //Remove spaces
ztrou1.Text := StringReplace(ztrou1.Text, ' ', '', [rfReplaceAll]); //Remove spaces
xtrou2.text := StringReplace(xtrou2.text, ' ', '', [rfReplaceAll]); //Remove spaces
ytrou2.Text := StringReplace(ytrou2.Text, ' ', '', [rfReplaceAll]); //Remove spaces
xtroufin2.text := StringReplace(xtroufin2.text, ' ', '', [rfReplaceAll]); //Remove spaces
ytroufin2.text := StringReplace(ytroufin2.text, ' ', '', [rfReplaceAll]); //Remove spaces
ztrou2.text := StringReplace(ztrou2.text, ' ', '', [rfReplaceAll]); //Remove spaces
xorigin.Text := StringReplace(xorigin.text, ' ', '', [rfReplaceAll]); //Remove spaces
yorigin.Text := StringReplace(yorigin.Text, ' ', '', [rfReplaceAll]); //Remove spaces
zedit.Text := StringReplace(zedit.Text, ' ', '', [rfReplaceAll]); //Remove spaces
if(xtrou.Enabled=true) then
begin
//object
MyText.Add(xorigin.Text);
MyText.Add(yorigin.Text);
MyText.Add(zedit.Text);
MyText.Add(inttostr(trackbar1.Position));
MyText.Add(inttostr(trackbar2.Position));
//hole0
MyText.Add(xtrou.Text);
MyText.Add(ytrou.Text);
z:=strtoint(zedit.Text) + strtoint(ztrou.Text);
MyText.Add(inttostr(z));
movx:=strtoint(xtrou.Text) + strtoint(xtroufin.Text);
MyText.Add(inttostr(movx));
movy:=strtoint(ytrou.text) + strtoint(ytroufin.Text);
MyText.Add(inttostr(movy));
movx:=movx - strtoint(xtroufin.Text);
MyText.Add(inttostr(movx));
movy:=movy - strtoint(ytroufin.Text);
MyText.Add(inttostr(movy));
MyText.Add('0'); //reset Z
end
else
begin
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
end;
if(xtrou1.Enabled=true) then //hole1
begin
MyText.Add('---'); //distinc line to separate hole, represented as a rectangle ABCD
MyText.Add(xorigin.Text); //xorigin
MyText.Add(yorigin.Text); //yorigin
MyText.Add(zedit.Text); //zobject
MyText.Add(inttostr(trackbar1.Position));
MyText.Add(inttostr(trackbar2.Position));
//hole
MyText.Add(xtrou1.Text); //point A (x)
MyText.Add(ytrou1.Text); //point A (y)
z:=strtoint(zedit.Text) + strtoint(ztrou1.Text); //point A (z)
MyText.Add(inttostr(z));
movx:=strtoint(xtrou1.Text) + strtoint(xtroufin1.Text); //point B(x)
MyText.Add(inttostr(movx));
movy:=strtoint(ytrou1.Text) + strtoint(ytroufin1.Text); //point D (y)
MyText.Add(inttostr(movy));
movx:=movx - strtoint(xtroufin1.Text); //point C (x)
MyText.Add(inttostr(movx));
movy:=movy - strtoint(ytroufin1.Text); //point A (y)
MyText.Add(inttostr(movy));
MyText.Add('0'); //reset Z //point A (z)
end
else
begin
MyText.Add('---');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
end;
if(xtrou2.Enabled=true) then //circle
begin
MyText.Add('+++'); //distinc line to separate hole
MyText.Add(xorigin.Text);
MyText.Add(yorigin.Text);
MyText.Add(zedit.Text);
MyText.Add(inttostr(trackbar1.Position));
MyText.Add(inttostr(trackbar2.Position));
//hole
MyText.Add(xtrou2.Text);
MyText.Add(ytrou2.Text);
z:=strtoint(zedit.Text) + strtoint(ztrou2.Text);
MyText.Add(inttostr(z));
//we are wroting data for a eliptic shape, to get a shorter code, we will
//write it as a rectangle ABCD, so the higest point in the left is on AC
//the higest point in the top is on AB, the higest on the right is on BD,
//and the higest in the down on CD
MyText.Add(xtrou2.text);
MyText.Add(ytrou2.text);
movx:=strtoint(xtrou2.text) + strtoint(xtroufin2.text);
MyText.Add(inttostr(movx));
movy:=strtoint(ytrou2.text) + strtoint(ytroufin2.text);
MyText.Add(inttostr(movy));
movx:=movx - strtoint(xtroufin2.text);
MyText.Add(inttostr(movx));
movy:=movy - strtoint(ytroufin2.text);
MyText.Add(inttostr(movy));
MyText.Add('0'); //reset Z
end
else
begin
MyText.Add('---');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
MyText.Add('0');
end;
MyText.Add('...'); //end the file
with SelectDirectoryDialog1.Create(nil) do
try
if Execute then
begin
if (filename = '')then
begin
filename:= '.';
end;
Input := InputBox('Filename', 'Chose a filename for the file :', '');
if(input='')then
begin
Input:='data';
end;
MyText.SaveToFile(filename + '/' + Input + '.sti2d');
end;
finally
SelectDirectoryDialog1.Close;
end;
finally
MyText.Free
end; {try}
end;
procedure TFrame2.readfile(sender: TObject);
var
Txt: TextFile;
s: string;
AllText: string;
i: integer;
filename: string;
l: integer;
begin
AllText := '';
if OpenDialog1.execute then
begin
filename := OpenDialog1.Filename;
AssignFile(Txt, filename);
Reset(Txt);
i:=1;
l:=0;
while not Eof(Txt) do
begin
Readln(Txt, s);
l:=l+1;
AllText := AllText + s;
// Write out each line; comment out to stop.
//Writeln(s);
if(i=1) then
begin
xorigin.text:=s;
end;
if(i=2)then
begin
yorigin.text:=s;
end;
if(i=3)then
begin
zedit.text:=s;
end;
if(i=4)then
begin
trackbar1.Position:=strtoint(s);
end;
if(i=5)then
begin
trackbar2.Position:=strtoint(s);
end;
if(i=6)then
begin
xtrou.text:=s;
end;
if(i=7)then
begin
ytrou.text:=s;
end;
if(i=8)then
begin
ztrou.text:=inttostr(strtoint(s) - strtoint(zedit.text));
end;
if(i=9)then
begin
xtroufin.text:=inttostr(strtoint(s) - strtoint(xtrou.Text));
end;
if(i=10)then
begin
ytroufin.text:=inttostr(strtoint(s) - strtoint(ytrou.Text));
end;
if(s='...')then
begin
Exit();
end;
if(i=15) then
begin
xorigin.text:=s;
end;
if(i=16)then
begin
yorigin.text:=s;
end;
if(i=17)then
begin
zedit.text:=s;
end;
if(i=18)then
begin
trackbar1.Position:=strtoint(s);
end;
if(i=19)then
begin
trackbar2.Position:=strtoint(s);
end;
if(i=20)then
begin
xtrou1.text:=s;
end;
if(i=21)then
begin
ytrou1.text:=s;
end;
if(i=22)then
begin
ztrou1.text:=inttostr(strtoint(s) - strtoint(zedit.text));
end;
if(i=23)then
begin
xtroufin1.text:=inttostr(strtoint(s) - strtoint(xtrou1.Text));
end;
if(i=24)then
begin
ytroufin1.text:=inttostr(strtoint(s) - strtoint(ytrou1.Text));
end;
if(s='+++')then
begin
xtrou2.top := circle.top - 30;
ytrou2.top := circle.top - 30;
xtroufin2.top := circle.top - 30;
ytroufin2.top := circle.top - 30;
ztrou2.top := circle.top - 30;
xtrou2.enabled := true;
ytrou2.Enabled := true;
xtroufin2.enabled := true;
ytroufin2.enabled := true;
ztrou2.enabled := true;
circle.enabled := false;
delcircle.enabled := true;
end;
if(i=29) then
begin
xorigin.text:=s;
end;
if(i=30)then
begin
yorigin.text:=s;
end;
if(i=31)then
begin
zedit.text:=s;
end;
if(i=32)then
begin
trackbar1.Position:=strtoint(s);
end;
if(i=33)then
begin
trackbar2.Position:=strtoint(s);
end;
if(i=34)then
begin
xtrou2.text:=s;
end;
if(i=35)then
begin
ytrou2.text:=s;
end;
if(i=36)then
begin
ztrou2.text:=inttostr(strtoint(s) - strtoint(zedit.text));
end;
if(i=37)then
begin
xtroufin2.text:=inttostr(strtoint(s) - strtoint(xtrou2.Text));
end;
if(i=38)then
begin
ytroufin2.text:=inttostr(strtoint(s) - strtoint(ytrou2.Text));
end;
i:=i+1;
end;
CloseFile(Txt);
memo1.Lines.Add(alltext);
validate(Sender);
end;
end;
procedure TFrame2.yoriginchange(Sender: TObject);
begin
if(yorigin.Text='') then
begin
yorigin.Text:=inttostr(0);
end;
if(strtoint(yorigin.Text)>130) then
begin
yorigin.Text:=inttostr(130);
end;
Trackbar2.Min:=strtoint(yorigin.Text);
Shape1.Top:=152 + strtoint(yorigin.Text)*2;
Trackbar2.top:=120 + strtoint(Yorigin.Text)*2;
Trackbar2.Height:=344 - strtoint(Yorigin.Text)*2;
ybar(sender);
end;
end.
Project1.lps
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="9">
<Unit0>
<Filename Value="Project1.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<UsageCount Value="195"/>
</Unit0>
<Unit1>
<Filename Value="Unit1.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="5"/>
<CursorPos Y="26"/>
<UsageCount Value="195"/>
<Loaded Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit1>
<Unit2>
<Filename Value="Unit2.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Frame2"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<IsVisibleTab Value="True"/>
<TopLine Value="1067"/>
<CursorPos X="36" Y="1073"/>
<FoldState Value=" T1ka0C11123 T3me032A2M"/>
<UsageCount Value="195"/>
<Loaded Value="True"/>
<LoadedDesigner Value="True"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit2>
<Unit3>
<Filename Value="unitportcom.lfm"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="62"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit3>
<Unit4>
<Filename Value="unitportcom.pas"/>
<IsPartOfProject Value="True"/>
<HasResources Value="True"/>
<UnitName Value="UnitPortCOM"/>
<EditorIndex Value="-1"/>
<TopLine Value="118"/>
<CursorPos X="30" Y="99"/>
<UsageCount Value="62"/>
</Unit4>
<Unit5>
<Filename Value="../../Vidéos/Lazarus/unitportcom.pas"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="18"/>
<DefaultSyntaxHighlighter Value="Delphi"/>
</Unit5>
<Unit6>
<Filename Value="../../Vidéos/Lazarus/unitportcom.lfm"/>
<EditorIndex Value="-1"/>
<WindowIndex Value="-1"/>
<TopLine Value="-1"/>
<CursorPos X="-1" Y="-1"/>
<UsageCount Value="18"/>
<DefaultSyntaxHighlighter Value="LFM"/>
</Unit6>
<Unit7>
<Filename Value="/root/.lazarus/onlinepackagemanager/packages/LazSerial/lazserial.pas"/>
<UnitName Value="LazSerial"/>
<EditorIndex Value="-1"/>
<TopLine Value="282"/>
<CursorPos Y="294"/>
<UsageCount Value="10"/>
</Unit7>
<Unit8>
<Filename Value="../../.lazarus/onlinepackagemanager/packages/LazSerial/lazserial.pas"/>
<UnitName Value="LazSerial"/>
<EditorIndex Value="1"/>
<TopLine Value="279"/>
<CursorPos Y="294"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit8>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="Unit2.pas"/>
<Caret Line="549" Column="38" TopLine="542"/>
</Position1>
<Position2>
<Filename Value="Unit2.pas"/>
<Caret Line="622" Column="7" TopLine="617"/>
</Position2>
<Position3>
<Filename Value="Unit2.pas"/>
<Caret Line="623" Column="7" TopLine="618"/>
</Position3>
<Position4>
<Filename Value="Unit2.pas"/>
<Caret Line="622" Column="7" TopLine="617"/>
</Position4>
<Position5>
<Filename Value="Unit2.pas"/>
<Caret Line="623" Column="7" TopLine="618"/>
</Position5>
<Position6>
<Filename Value="Unit2.pas"/>
<Caret Line="622" Column="7" TopLine="617"/>
</Position6>
<Position7>
<Filename Value="Unit2.pas"/>
<Caret Line="633" Column="6" TopLine="605"/>
</Position7>
<Position8>
<Filename Value="Unit2.pas"/>
<Caret Line="563" Column="31" TopLine="548"/>
</Position8>
<Position9>
<Filename Value="Unit2.pas"/>
<Caret Line="312" Column="14" TopLine="306"/>
</Position9>
<Position10>
<Filename Value="Unit2.pas"/>
<Caret Line="316" Column="32" TopLine="300"/>
</Position10>
<Position11>
<Filename Value="Unit2.pas"/>
<Caret Line="317" Column="32" TopLine="301"/>
</Position11>
<Position12>
<Filename Value="Unit2.pas"/>
<Caret Line="318" Column="32" TopLine="302"/>
</Position12>
<Position13>
<Filename Value="Unit2.pas"/>
<Caret Line="317" Column="32" TopLine="301"/>
</Position13>
<Position14>
<Filename Value="Unit2.pas"/>
<Caret Line="318" Column="32" TopLine="302"/>
</Position14>
<Position15>
<Filename Value="Unit2.pas"/>
<Caret Line="1083" Column="36" TopLine="1076"/>
</Position15>
<Position16>
<Filename Value="Unit2.pas"/>
<Caret Line="1267" TopLine="929"/>
</Position16>
<Position17>
<Filename Value="Unit2.pas"/>
<Caret Line="576" Column="47" TopLine="565"/>
</Position17>
<Position18>
<Filename Value="Unit2.pas"/>
<Caret Line="581" Column="33" TopLine="567"/>
</Position18>
<Position19>
<Filename Value="Unit2.pas"/>
<Caret Line="1067" Column="39" TopLine="1069"/>
</Position19>
<Position20>
<Filename Value="Unit2.pas"/>
<Caret Line="1083" Column="40" TopLine="1067"/>
</Position20>
<Position21>
<Filename Value="Unit2.pas"/>
<Caret Line="1067" TopLine="1058"/>
</Position21>
<Position22>
<Filename Value="../../.lazarus/onlinepackagemanager/packages/LazSerial/lazserial.pas"/>
<Caret Line="294" TopLine="279"/>
</Position22>
<Position23>
<Filename Value="Unit2.pas"/>
<Caret Line="1067" TopLine="1058"/>
</Position23>
<Position24>
<Filename Value="Unit2.pas"/>
<Caret Line="542" Column="24" TopLine="587"/>
</Position24>
<Position25>
<Filename Value="Unit2.pas"/>
<Caret Line="821" Column="24" TopLine="816"/>
</Position25>
<Position26>
<Filename Value="Unit2.pas"/>
<Caret Line="806" Column="6" TopLine="802"/>
</Position26>
<Position27>
<Filename Value="Unit2.pas"/>
<Caret Line="822" Column="25" TopLine="812"/>
</Position27>
<Position28>
<Filename Value="Unit2.pas"/>
<Caret Line="1085" Column="15" TopLine="1067"/>
</Position28>
<Position29>
<Filename Value="Unit2.pas"/>
<Caret Line="918" Column="32" TopLine="906"/>
</Position29>
<Position30>
<Filename Value="Unit2.pas"/>
<Caret Line="922" Column="25" TopLine="907"/>
</Position30>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>