CATIA V5 | 3DEXPERIENCE
Vous souhaitez réagir à ce message ? Créez un compte en quelques clics ou connectez-vous pour continuer.
Le deal à ne pas rater :
Pokémon EV06 : où acheter le Bundle Lot 6 Boosters Mascarade ...
Voir le deal

essai post-processeur 5 axes table-table broche verticale - fanuc

2 participants

Page 1 sur 2 1, 2  Suivant

Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 2:15

bonjour,

je ne suis pas informaticien, mais utilisateur catia en usinage sur centre de fraisage.
j'ai essayé de bricoler un post-processeur en macro vba catia, qui est aussi compatible excel.

j"aimerais vous soumettre mon travail pour critique Exclamation!
c'est surement plein de bugues.

c'est mon premier forum, je ne sais pas joindre des fichiers à mon messages !

au secours

bruno

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par Guss_ Lun 25 Juin 2012 - 14:29

Si c'est une macro, copie le code avec l'ajout des balise code qu'il faut pour la mise en page (bouton au dessus de la zone de rédaction de ton message avec les symboles <> )
Ensuite explique ce qui ne te plais pas où ce qui te gène, ce qui ne fonctionne pas ou que tu n'arrives pas à mettre en place .

Guss_
Admin
Admin

Messages : 530
Date d'inscription : 08/01/2010

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 18:41

bon, je vais essayer

tout d abord, la notice inspirée d un pp que j utilise:

Code:

MACHINE: 5 AXES TABLE-TABLE BROCHE VERTICALE - FANUC 30
==================




1.Nom du Programme
------------------

1.1.Déclaration
---------------

Programmation
PARTNO 055V024V02  (pour exemple)

code généré
    %
    <055V024V02>







2.Commentaire, insertion libre
------------------------------

2.1.Commentaire
---------------
PPRINT PIECE D ESSAI

code généré
    (PIECE D ESSAI)


2.2.Insertion libre
-------------------
INSERT G90  (pour exemple)

code généré
    G90

nota: aucun contrôle n'est réalisé.








3.Calcul des points 5 axes
--------------------------


3.1.Définition du décalage entre l'axe de rotation primaire et secondaire
-------------------------------------------------------------------------

Programmation
PIVOTZ/2,px,py,pz








4.Décalages d'origine
---------------------


4.1.Décalage d'origine programme
--------------------------------

Programmation
ORIGIN/x, y, z   

    N.. G52 Xx Yy Zz



4.2.Appel des origines machine de g53 a g59
-------------------------------------------

Programmation
ORIGIN/TYPE, numéro  de 0 (G53) a 6 (G59)

ou

ORIGIN/TYPE, numéro, OUT
force la sortie du code G5x immédiatement.


Nota : Par défaut, l'origine G54 est activée








5. Changement d'outil
---------------------

Programmation LOADTL/t

Exemple de blocs génères :

PARTNO 000V001V01

    % 
    <000V001V01>

LOADTL/1.
PPRINT FRAISE 2T DIA 20
FEDRAT/1000.
SPINDL/400.,CLW
RAPID/
GOTO/O.,100.,100.


    N0001M98P9141
    Ml
    T0001M6
    T0002
    ( FRAISE 2T DIA 20 )
    M79
    M11
    G0G54.G90B0.
    M78
    M10
    X0.Y100.S400M3
    G43Z100.H1




5.1.Changement de correcteur
----------------------------
Programmation


1) Correcteur de longueur
TOOLNO/d
    G43 Z.. Hd



2) Correcteur de rayon
TOOLNO/RADIUS,d
    (G41,G42) X.. Y.. Dd




5.2.Travail en correction de rayon
----------------------------------

Correction a gauche
CUTCOM/LEFT

Correction a droite
CUTCOM/RIGHT

Annulation
CUTCOM/OFF

NOTA: CUTCOM/LEFT, RIGHT, OFF ne sort qu'avec le mode G1 seulement.




6. Définition de l'avance
-------------------------

6.1 Avance Rapide
-----------------
Programmation
RAPID/

    GO ..

Nota : Cette instruction n'est pas modale.



6.2.    Gestion d'axes en positionnement rapide
-----------------------------------------------

Tous les mouvements qui suivent sont casses.
Si on passe du point (xO, yO, zO, a0, c0) au point (xl, yl, zl, a1, c1),

le PP généré :
si zl > zO
    ... Zzl ...
    ... Aal Ccl
    ... Xxl Yyl ...

si zl < zO
    ... Aal Ccl
    ... Xxl Yyl ...
    ... Zzl ...



6.3.Avance Travail
------------------
Programmation
FEDRAT/v, (MMPM/MMPR)
   
    Gl Ff...

(IPM/IPR)
Par défaut, le PP suppose MMPM ou IPM présent, et f = v mm/min.
Si MMPR ou IPR est programme,
le PP tient compte de la dernière vitesse de broche rencontrée s,
et calcule f = v*s mm/min.



6.4.Avance en inverse du temps en 4 ou 5 axes
---------------------------------------------

Calcul de l'avance en G93 Programmation    Blocs génères
FEDRAT/INVERS,ON   
    G1 G93 X.. Y.. A.. C.. Ff

FEDRAT/INVERS,OFF
    Gl G94 X.. Y.. A.. C.. Ff

nota: le G93 sort uniquement s'il y a un déplacement sur A, ou C, ou A et C,
ensuite il revient en G94.


6.5.Avance tangentielle
-----------------------

Le calcul de l'avance tangentielle sur les mouvements circulaires
se fait automatiquement des que la correction de rayon d'outil
est activée et que le diamètre de l'outil a été défini dans
l'instruction CUTTER.


Mais il est possible de suspendre le calcul par l'instruction:

COUPLE/OFF

Nota : Le PP est en mode COUPLE/OFF par défaut.

COUPLE/ON,1
en G41 G02 ou G42 G03, l'avance maxi est limitée a 2 fois l'avance programmée.

COUPLE/ON ou COUPLE/ON,2
en G41 G02 ou G42 G03, l'avance est égale à l'avance programmée, il n'y a pas de majoration.






7. Définition de la vitesse de broche
-------------------------------------

7.1.Démarrage ou changement de vitesse
--------------------------------------

Programmation
SPINDL/s (, CLW/CCLW) (, SFM/RPM)

si SFM est programmée :
s : vitesse de coupe désirée,
en m/mn on calcul s' = (1000 x s) / (Pi x d)

sinon :
s : nombre de tr/mn, même si RPM non programmée

dans tous les cas :
CLW : rotation sens M3 (mode par défaut)
CCLW : rotation sens M4

Blocs génères :
    ... S.. M(3/4)

SPINDL/OUT sort le bloc S avec la vitesse courante, immédiatement.


7.2.Arrêt
---------

Programmation   
SPINDL/OFF   
    M5

7.3.Arrêt indexé
----------------

Programmation    Blocs génères
SPINDL/LOCK   
    Ml9





8.Arrosages
-----------

8.1.Activation
--------------

Programmation
COOLNT/FLOOD

    M8

COOLNT/MIST,1

    M58

COOLNT/MIST,2

    M58
    M52

COOLNT/MIST,3

    M58
    M7


8.2.Désactivation
-----------------

COOLNT/OFF

    M9





9.Arrêts Machine
----------------

9.1.Arrêt programmé
--------------------

STOP/

    M0


9.2.Arrêt optionnel
--------------------

OSTOP/

    M1






10.Interpolation hélicoïdale
----------------------------


HELICAL/......






11.Gestion annexe des axes (MOVETO)
-----------------------------------

11.1.Reset de un ou plusieurs axes
----------------------------------

MOVETO/XAXIS, (et, ou) YAXIS, (et, ou) ZAXIS, (et, ou) AAXIS, (et, ou) CAXIS

exemple
MOVETO/AAXIS

sortira A... au prochain GOTO.
fonction non modale


11.2.Sortie immédiate de un ou plusieurs axes
---------------------------------------------

MOVETO/XAXIS, , (et, ou) YAXIS,.....,OUT
 
force la sortie des axes indiqués immédiatement, avec leurs dernières valeurs.
fonction non modale


11.3.Activation d'une position CAXIS par default à AAXIS = 0
------------------------------------------------------------

MOVETO/CAXIS,START

il faut au préalable avoir définit un ROTABL/CAXIS, angle, BOTH

Toutes les positions ou AAXIS = 0, le CAXIS = angle.
fonction modale

si un ROTABL/CAXIS est programmé après, il est bien sure prioritaire.


11.4.Désactivation d'une position CAXIS par défault
---------------------------------------------------

MOVETO/START,OFF






12. Cycles fixes
----------------

12.1.    Activation

Le bloc d'activation d'un cycle doit TOUJOURS comporter, dans un ordre quelconque :
-    Le type de cycle,
-    La cote de fond de trou, en relatif / au bord du trou,
-    La cote de remontee, en relatif / au bord du trou,
-    La vitesse travail utilisee, specifiee en mm/min ou mm/tr.


Si c'est MMPR ou IPR, le PP tient compte de la demiere vitesse de broche rencontree s,
 et calcule f = v*s mm/min.

Selon le cycle programme, PARFOIS ce bloc contient :
-    Un mot mineur pour différents types de cycles,
-    Une temporisation,
-    Un pas d'avance pour les cycles a avance altemee
-    Une distance de retraction en fin de cycle



12.2.Changement de conditions
-----------------------------

Les conditions du cycle données par le bloc d'appel peuvent être modifiées
pour les exécutions suivantes de celui ci.
 
Il suffit de reprogrammer le bloc d'appel, mais avec des valeurs différentes.

On doit redonner même les valeurs inchangées,





12.3.Annulation
----------------

La procedure d'annulation est la meme pour tous les cycles. Programmation :

CYCLE/OFF

Blocs génères :
    G80 ... (sur le déplacement suivant)





12.5.Brise copeaux G73
----------------------

Programmation :
CYCLE/BRKCHP, zf, pl, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G73 G98 Xxp Yyp Qpl Z(zp+zf) R(zp+d) Ff





12.6.Taraudage a gauche G74
---------------------------

Programmation :
CYCLE/INVERS, zf, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G74 G98 Xxp Yyp Z(zp+zf) R(zp+d) Ff




12.7.Alésage avec arrêt indexé G76
----------------------------------

Programmation :
CYCLE/LOCK, zf, pl, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G76 G98 Xxp Yyp Qpl Z(zp+zf) R(zp+d) Ff




12.8.Perçage - Centrage G81
---------------------------

Programmation :
CYCLE/DRILL, zf, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G81 G98 Xxp Yyp Z(zp+zf) R(zp+d) Ff




12.9.Perçage avec temporisation G82
-----------------------------------

Programmation :
CYCLE/FACE, zf, (MMPM/MMPR, f), d, DWELLV, t, [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G82 G98 Xxp Yyp Z(zp+zf) R(zp+d) Pt Ff



12.10.Perçage étagé G83
-----------------------

Programmation :
CYCLE/DEEP, zf, pl, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G83 G98 Xxp Yyp Z(zp+zf) Qpl R(zp+d) Ff



12.11.Taraudage G84
-------------------

Programmation :
CYCLE/TAP, zf, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G84 G98 Xxp Yyp Z(zp+zf) R(zp+d) Ff




12.12.Alésage G85
-----------------

Programmation :
CYCLE/BORE, zf, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G85 G98 Xxp Yyp Z(zp+zf) R(zp+d) Ff



12.13.Alésage avec retour broche arrêtée G86
--------------------------------------------

Programmation :
CYCLE/REAM, zf, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G86 G98 Xxp Yyp Z(zp+zf) R(zp+d) Ff



12.14.Alésage G87
-----------------

Programmation :
CYCLE/STEP, zf, (MMPM/MMPR, f), d [, POSZ, r]

Blocs génères :
    G00 Xxp Yyp Z(zp+r)
    G87 G98 Xxp Yyp Z(zp+zf) R(zp+d) Ff



12.15.Alésage G88
-----------------

Programmation :
CYCLE MANUAL, zf, (MMPM/MMPR, f), d, DWELLV, t [, POSZ, r]

Blocs génères :
    GOO Xxp Yyp Z(zp-r)
    G88 G98 Xxp Yyp Z(zp+zf) Pt R(zp+d) Ff




12.16.Alésage avec temporisation en fond de trou G89
----------------------------------------------------

Programmation :
CYCLE THRU, zf, (MMPM/MMPR, f), d, DWELLV, t, [, POSZ, r]

Blocs génères :
    GOO Xxp Yyp Z(zp-r)
    G89 G98 Xxp Yyp Z(zp+zf) R(zp+d) Ft Ff







13.Programmation des axes rotatifs
----------------------------------

Programmation de l'axe primaire : axe portant la pièce
ROTABL/CAXIS, c, BOTH
c : Angle a atteindre en absolu .


Programmation de l'axe secondaire : axe portant le 5eme axe
ROTABL/AAXIS, b, BOTH
b : Angle a atteindre en absolu .



13.1.Blocage de l axe rotatif
-----------------------------

Blocage des 2 axes rotatifs

Programmation   
CLAMP/ON   

    M79
    M11
    Aa Cc
    M78
    M10



13.2.Déblocage des 2 axes rotatifs
----------------------------------

Programmation
CLAMP/OFF   

    M11
    M79
    A ang C ang

Blocage et déblocage de l'axe primaire : axe portant la piece
CLAMP/l, (ON/OFF)

    M10/M11


Blocage et déblocage de l'axe secondaire : axe portant le 5eme axe
CLAMP/2, (ON OFF)

    M78/M79

Nota : Par défaut le pp est initialise en "CLAMP/ON".







14.Temporisation
----------------

Programmation
DELAYt   

    G4Xt

t = temps en secondes, inférieur a 100.00 s




15.Définition et appel de sous programmes
-----------------------------------------

15.1.Définition d'un sous programme
-----------------------------------

Programmation
DEFSUB/n
usinage catia (tip,side,pocket,..)
ENDSUB/n

n = numéro du sous programme.

11 est interdit de définir un sous programme dans un autre sous programme,
c'est a dire ,avoir de DEFSUB a suivre.




15.2.Appel d’un sous programmme
-------------------------------

Programmation
CALSUB/n

n = numéro du sous programme.


Nota : Il est interdit d'appeler un sous programme qui n'a pas été défini avant le calsub.






16.Travail en plan incliné
--------------------------

16.1.Activation du mode plan incliné
------------------------------------

Programmation :
REVERS/x,y,z


Nota: Lorsque ce mode est actif, le post processeur génère automatiquement le fonction G68.2
à chaque changement de position des axes A et C.


16.2.Désactivation du mode plan incliné
--------------------------------------

Programmation :
REVERS/OFF






17.Interpolation 5 axes simultanés G43.4
----------------------------------------

17.1.Activation
---------------

MODE/ON

    G43.4X...Y...Z...A0.C0.H correcteur d'outil

doit débuter a A0. C0.


17.2.Désactivation
------------------

MODE/OFF







18.Linéarisation avec LINTOL
----------------------------

18.1.Activation
---------------

LINTOL/n    (n: tolérance)

par rapport au théorique, c'est +n, -n  donc la tolérance totale est de 2n.


18.2.Désactivation
------------------

LINTOL/OFF






19.Gestion des fonctions UGV
----------------------------

19.1.Activation
---------------

MODE/HIGH,n  (n valeur de 1 à 10)

exemple:
MODE/HIGH,5

    G5.1Q1R5


19.2.Annulation de la fonction
------------------------------

MODE/HIGH,OFF

    G5P0





bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 18:49

la pptable a placer dans startup\manufacturing\pptables:

Code:

/
*START_MAJOR_WORDS_WITHOUT_PARAMETERS
DELAY  ,    1010,DRAWLI  ,      17,DRESS  ,      8,END    ,      1,
FACEML  ,      22,GOCLER  ,      16,GOHOME  ,      14,ISTOP  ,      4,
LOCKX  ,      21,OPSTOP  ,      3,PENDWN  ,      12,PENUP  ,      11,
PICKUP  ,      9,PROBX  ,      19,PROBY  ,      18,RAPID  ,      5,
RESET  ,      15,RETRCT  ,      7,REWIND  ,    1006,STOP    ,      2,
SWITCH  ,      6,ULOCKX  ,      20,UNLOAD  ,      10,ZERO    ,      13
*END
/
*START_MAJOR_WORDS_WITH_TEXT
INSERT  ,    1046,PARTNO  ,    1045,PPRINT  ,    1044
*END
/
*START_MAJOR_WORDS_WITH_PARAMETERS
AIR    ,    1011,ARCSLP  ,    1029,ASLOPE  ,    1053,AUXFUN  ,    1022,
BREAK  ,    1083,CAMERA  ,    1047,CHECK  ,    1023,CLAMP  ,    1060,
CLEARP  ,    1004,CLRSRF  ,    1057,COOLNT  ,    1030,CORNFD  ,    1067,
COUPLE  ,    1049,CUTCOM  ,    1007,CYCLE  ,    1054,DELAY  ,    1010,
DISPLY  ,    1021,DRAFT  ,    1059,FEDRAT  ,    1009,HEAD    ,    1002,
IFRO    ,    1032,INTCOD  ,    1020,LEADER  ,    1013,LETTER  ,    1043,
LINTOL  ,    1073,LOADTL  ,    1055,LPRINT  ,    1065,MACHIN  ,    1015,
MAGTAP  ,    1072,MAXDPM  ,    1062,MAXVEL  ,    1064,MCHFIN  ,    1018,
MCHTOL  ,    1016,MDEND  ,    1052,MDWRIT  ,    1051,MODE    ,    1003,
MOVETO  ,    1066,OPSKIP  ,    1012,ORIGIN  ,    1027,OVPLOT  ,    1042,
PBS    ,    1068,PITCH  ,    1050,PIVOTZ  ,    1017,PLABEL  ,    1061,
PLOT    ,    1041,PLUNGE  ,    1001,POSMAP  ,    1034,POSTN  ,    1024,
PPLOT  ,    1014,PREFUN  ,    1048,REGBRK  ,    1069,REVERS  ,    1008,
REWIND  ,    1006,ROTHED  ,    1035,SAFETY  ,    1028,SECTN3  ,    1082,
SELCTL  ,    1056,SEQNO  ,    1019,SLOWDN  ,    1063,SPINDL  ,    1031,
THREAD  ,    1036,TMARK  ,    1005,TOOLNO  ,    1025,TPRINT  ,    1075,
TRANS  ,    1037,TURRET  ,    1033,VTLAXS  ,    1070,WCORN  ,    1071
*END
/
*START_MINOR_WORDS
3PT2SL  ,      43,4PT1SL  ,      44,5PT    ,      45,AAXIS  ,    140,
ADJUST  ,    159,ALL    ,      51,ANGLE  ,    236,ANTSPI  ,    176,
ARC    ,      87,AT      ,    175,ATANGL  ,      1,AUTO    ,      88,
AVOID  ,    173,AXIS    ,      84,BAXIS  ,    141,BCD    ,    165,
BINARY  ,    164,BISECT  ,    230,BLACK  ,    130,BLUE    ,    133,
BORE    ,      82,BOREOS  ,    214,BOTH    ,      83,BRKCHP  ,    206,
CAM    ,    169,CAXIS  ,    142,CBORE  ,    213,CCLW    ,      59,
CENTER  ,      2,CHORD  ,    237,CHUCK  ,    138,CIRCUL  ,      75,
CIRLIN  ,    126,CLEARV  ,    205,CLW    ,      60,CNSINK  ,    211,
COLLET  ,    139,COMBIN  ,    238,CONST  ,      64,CROSS  ,      3,
CRSSPL  ,    204,CSINK  ,    255,CURSEG  ,    209,CUTANG  ,    160,
DARK    ,    137,DASH    ,    124,DECR    ,      65,DEEP    ,    153,
DEEPHL  ,    207,DEPTHV  ,    201,DIAMTR  ,    203,DITTO  ,    127,
DOTTED  ,    125,DOWN    ,    113,DRILL  ,    163,DWELL  ,    279,
DWELLV  ,    208,DWL    ,    253,ENDARC  ,      58,FACE    ,      81,
FEED    ,    248,FLOOD  ,      89,FLOW    ,    239,FOURPT  ,    101,
FRONT  ,    148,FULL    ,    147,FUNOFY  ,      4,GAPLES  ,    180,
GENCUR  ,    240,GREEN  ,    132,HIGH    ,      62,HOLDER  ,    157,
IN      ,      48,INCR    ,      66,INTENS  ,    134,INTERC  ,      46,
INTGRV  ,    221,INTOF  ,      5,INVERS  ,      6,KEYBOR  ,    217,
LARGE  ,      7,LAST    ,      52,LATER  ,    252,LEFT    ,      8,
LENGTH  ,      9,LIGHT  ,    100,LIMIT  ,    207,LINCIR  ,      95,
LINEAR  ,      76,LITE    ,    135,LOCK    ,    114,LOW    ,      63,
MAIN    ,      93,MANUAL  ,    158,MAXRPM  ,      79,MED    ,    136,
MEDIUM  ,      61,MILL    ,    151,MINUS  ,      10,MIRROR  ,      56,
MIST    ,      90,MMPM    ,    171,MMPR    ,    172,MODIFY  ,      55,
MULTRD  ,    119,MXMMPM  ,    177,NEGX    ,      11,NEGY    ,      12,
NEGZ    ,      13,NEXT    ,    162,NIXIE  ,      99,NOMORE  ,      53,
NORMAL  ,    111,NOTE    ,    181,NOW    ,    161,NOX    ,      14,
NOY    ,      15,NOZ    ,      16,OFF    ,      72,OMIT    ,    172,
ON      ,      71,OPEN    ,      50,OPTION  ,    144,ORIENT  ,    246,
OUT    ,      49,PARAB  ,      77,PARAM  ,    241,PARLEL  ,      17,
PART    ,    166,PAST    ,      70,PEN    ,    128,PERPTO  ,      18,
PERSP  ,      67,PILOTD  ,    224,PLUS    ,      19,PNTVEC  ,    200,
POSX    ,      20,POSY    ,      21,POSZ    ,      22,PTNORM  ,    104,
PTSLOP  ,    103,PULBOR  ,    218,PULFAC  ,    223,QUILL  ,    287,
RADIUS  ,      23,RAIL    ,      93,RANDOM  ,    174,RANGE  ,    145,
REAM    ,    167,REAMA  ,    219,REAR    ,    149,RED    ,    131,
RETAIN  ,    171,REV    ,      97,REVOLV  ,    208,RIGHT  ,      24,
ROTREF  ,      68,RPM    ,      78,RTHETA  ,    106,RULED  ,    210,
SADDLE  ,    150,SAME    ,      54,SCALE  ,      25,SCRIBE  ,    129,
SEG    ,    242,SETANG  ,    156,SETOOL  ,    155,SFM    ,    115,
SIDE    ,      94,SLOPE  ,      47,SMALL  ,      26,SMESH  ,    243,
SOLID  ,    123,SPDRL  ,    210,SPECDP  ,    202,SPEED  ,    249,
SPLINE  ,    105,SPMIL  ,    212,START  ,      57,STEP    ,      92,
TANON  ,    109,TANTO  ,      27,TAP    ,    168,TAPKUL  ,      91,
THETAR  ,    107,THRU    ,    152,TIMES  ,      28,TO      ,      69,
TPMM    ,    178,TRANSL  ,      29,TRAV    ,    154,TRFORM  ,    110,
TRYBOR  ,    215,TRYBOS  ,    216,TURN    ,      80,TWOPT  ,    102,
TYPE    ,      98,UAXIS  ,    227,UNIT    ,      30,UP      ,    112,
VAXIS  ,    228,WAXIS  ,    229,WDEFAC  ,    222,WEIGHT  ,    206,
XAXIS  ,      84,XCOORD  ,    116,XLARGE  ,      31,XSMALL  ,      32,
XYOF    ,    209,XYPLAN  ,      33,XYROT  ,      34,XYVIEW  ,    120,
XYZ    ,    108,YAXIS  ,      85,YCOORD  ,    117,YLARGE  ,      35,
YSMALL  ,      36,YZPLAN  ,      37,YZROT  ,      38,YZVIEW  ,    121,
ZAXIS  ,      86,ZCOORD  ,    118,ZIGZAG  ,    170,ZLARGE  ,      39,
ZSMALL  ,      40,ZXPLAN  ,      41,ZXROT  ,      42,ZXVIEW  ,    122,
NORMDS  ,    707,NORMPS  ,    708
*END
/                                                                             
*START_SYNTAXES                                                               
COOLNT/(ON,OFF,FLOOD,MIST,TAPKUL)                                             
CUTCOM/&LEFT                                                                   
CUTCOM/&LEFT,&47,&.500,&61,&60                                                 
CUTCOM/&LEFT,&47,&.500,&61,&62                                                 
CUTCOM/&OFF                                                                   
CUTCOM/&OFF,&47,&.500                                                         
CUTCOM/&RIGHT                                                                 
CUTCOM/(ON,OFF,LEFT,RIGHT),(XYPLAN,YZPLAN,ZXPLAN)                             
CUTCOM/(ON,OFF,LEFT,RIGHT),LENGTH,&LVAL                                       
CUTCOM/(ON,OFF,LEFT,RIGHT),RADIUS,&RVAL                                       
CUTCOM/(ON,OFF,LEFT,RIGHT),XCOORD,&XVAL,YCOORD,&YVAL,ZCOORD,&ZVAL             
SPINDL/(LEFT,RIGHT),XYPLAN                                                     
SPINDL/(ON,OFF,LOCK)                                                           
SPINDL/OFF                                                                     
SPINDL/RPM,&VITES                                                             
SPINDL/RPM,&VITES,(CLW,CCLW)
                                                                                     
*END                                                                           
/
*START_NC_COMMAND                      NC_HELICAL_INTERPOLATION
*START_SEQUENCE
HELICAL/%MFG_HELICAL_X_CENTER,%MFG_HELICAL_Y_CENTER,%MFG_HELICAL_Z_CENTER,$
%MFG_HELICAL_INDIRV_I,%MFG_HELICAL_INDIRV_J,%MFG_HELICAL_INDIRV_K,$
%MFG_HELICAL_I_AXIS,%MFG_HELICAL_J_AXIS,%MFG_HELICAL_K_AXIS,$
%MFG_HELICAL_PITCH,%MFG_HELICAL_RADIUS,%MFG_HELICAL_ANGLE,%MFG_HELICAL_HEIGHT,$
%MFG_HELICAL_ROUND,$
%MFG_HELICAL_X_END,%MFG_HELICAL_Y_END,%MFG_HELICAL_Z_END
*END
*END
/
*START_NC_COMMAND                      NC_DELAY
DELAY/%MFG_DELAY_VALUE,&MFG_DELAY_UNIT
*END
/
*START_NC_COMMAND                      NC_FEEDRATE
*START_LIST                            MFG_FEED_UNIT                         
MMPM    ,MMPR                                                                   
*END                                                                           
FEDRAT/%MFG_FEED_VALUE,&MFG_FEED_UNIT
*END
/
*START_NC_COMMAND                      NC_SPINDLE_START
*START_LIST                            MFG_SPNDL_UNIT                         
RPM      ,SMM                                                                   
*END
SPINDL/%MFG_SPNDL_SPEED,&MFG_SPNDL_UNIT,&MFG_SPNDL_WAY
*END
/
*START_NC_COMMAND                      NC_SPINDLE_LATHE
SPINDL/%MFG_SPNDL_SPEED,&MFG_SPNDL_UNIT
*END
/
*START_NC_COMMAND                      NC_CHANGE_REF_PT
SWITCH/%MFG_QUADRANT
*END
/
*START_NC_COMMAND                      NC_SPINDLE_LOCK
SPINDL/LOCK
*END
/
*START_NC_COMMAND                      NC_SPINDLE_OFF
SPINDL/OFF
*END
/
*START_NC_COMMAND                      NC_SPINDLE
SPINDL/%MFG_SPNDL_SPEED,&MFG_SPNDL_UNIT,&MFG_SPNDL_WAY
*END
/
*START_NC_COMMAND                      NC_CUTCOM_ON
CUTCOM/ON
*END
/
*START_NC_COMMAND                      NC_CUTCOM_OFF
CUTCOM/OFF
*END
/
*START_NC_COMMAND                      NC_CUTCOM_LEFT
CUTCOM/LEFT
*END
/
*START_NC_COMMAND                      NC_CUTCOM_RIGHT
CUTCOM/RIGHT
*END
/
*START_NC_COMMAND                      NC_CUTCOM_NORMDS_ON
CUTCOM/SAME, NORMDS
*END
/
*START_NC_COMMAND                      NC_CUTCOM_NORMDS_OFF
CUTCOM/OFF
*END
/
*START_NC_COMMAND                      NC_CUTCOM_NORMPS_ON
CUTCOM/NORMPS
*END
/
*START_NC_COMMAND                      NC_CUTCOM_NORMPS_OFF
CUTCOM/OFF
*END
/
*START_NC_COMMAND                      NC_THREAD_TURN
THREAD/TURN
*END
/
*START_NC_COMMAND                      NC_THREAD_TURN_OFF
THREAD/OFF
*END
/
*START_NC_COMMAND                      NC_PITCH
PITCH/%MFG_THREAD_PITCH
*END
/
*START_NC_COMMAND                      NC_SPINDLE_ON
SPINDL/ON
*END
/
*START_NC_COMMAND                      NC_COMMENT
%MFG_MO_COMMENT
*END
/
*START_NC_COMMAND                      NC_COMPENSATION
*END
/
*START_NC_INSTRUCTION                  NC_HEAD_ROTATION
*START_SEQUENCE
CLAMP/OFF
ROTHED/%MFG_ABC_AXIS,%MFG_AMOUNT_ROT,%MFG_DIR_OF_ROT
CLAMP/ON
*END
*END
/
*START_NC_INSTRUCTION                  NC_TABLE_ROTATION
*START_SEQUENCE
CLAMP/OFF
ROTABL/%MFG_ABC_AXIS,%MFG_AMOUNT_ROT,%MFG_DIR_OF_ROT
CLAMP/ON
*END
*END
/
*START_NC_COMMAND                      NC_MACHINING_AXIS
*START_SEQUENCE
$$*CATIA0
$$ %MFG_NCAXIS_IDENTIFIER
$$ %MFG_NCAXIS_X_VECX %MFG_NCAXIS_X_VECY %MFG_NCAXIS_X_VECZ %MFG_NCAXIS_X_ORIG
$$ %MFG_NCAXIS_Y_VECX %MFG_NCAXIS_Y_VECY %MFG_NCAXIS_Y_VECZ %MFG_NCAXIS_Y_ORIG
$$ %MFG_NCAXIS_Z_VECX %MFG_NCAXIS_Z_VECY %MFG_NCAXIS_Z_VECZ %MFG_NCAXIS_Z_ORIG
CATMAT/%MFG_NCAXIS_X_VECX,%MFG_NCAXIS_X_VECY,%MFG_NCAXIS_X_VECZ,%MFG_NCAXIS_Y_VECX,%MFG_NCAXIS_Y_VECY,%MFG_NCAXIS_Y_VECZ,%MFG_NCAXIS_Z_VECX,%MFG_NCAXIS_Z_VECY,%MFG_NCAXIS_Z_VECZ,%MFG_NCAXIS_X_ORIG,%MFG_NCAXIS_Y_ORIG,%MFG_NCAXIS_Z_ORIG,%MFG_NCAXIS_IDENTIFIER
*END
*END
/
*START_NC_INSTRUCTION                  NC_ORIGIN
*START_SEQUENCE
ORIGIN/TYPE,%MFG_ORIGIN_NUMBER
*END
*END
/
*START_NC_INSTRUCTION                  NC_TOOL_CHANGE
*START_SEQUENCE
COOLNT/OFF                                                                     
PPRINT %MFG_TOOL_NAME                                                         
LOADTL/%MFG_TOOL_NUMBER                                   
COOLNT/%MFG_COOLNT_SNTX                                                       
RAPID                 
*END
*END
/
*START_NC_INSTRUCTION                  NC_TOOL_CHANGE_LATHE
*START_SEQUENCE
TOOLNO/%MFG_TOOL_NUMBER,TURN
*END
*END
/
*START_NC_COMMAND                      NC_MULTAX_ON
MULTAX/ON
*END
/
*START_NC_COMMAND                      NC_MULTAX_OFF
MULTAX/OFF
*END
/
*START_NC_INSTRUCTION                  NC_START_MACRO
*START_SEQUENCE
$$ PARTNO %MFG_PROGRAM_NAME
$$ PROGRAM. %MFG_IDENTIFIER
$$ MACHINE. %MFG_MACHINE_NAME
$$ CATPROCESS. %MFG_MODEL_NAME
$$ CATPRODUCT. %MFG_PRODUCT_NAME 
*END
*END
/
*START_NC_INSTRUCTION                  NC_END_MACRO
*START_SEQUENCE
COOLNT/OFF
INSERT M30
INSERT %
*END
*END
/
*START_NC_INSTRUCTION                  NC_BORING_SPINDLE_STOP
*START_SEQUENCE
CYCLE/LOCK,%MFG_TOTAL_DEPTH*-1,%MFG_LIFT_DIST,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_BORING_AND_CHAMFERING
*START_SEQUENCE
PPRINT CYCLE NON DECODE
*END
*END
/
*START_NC_INSTRUCTION                  NC_DEEPHOLE
*START_SEQUENCE
CYCLE/DEEP,%MFG_TOTAL_DEPTH*-1,%MFG_AXIAL_DEPTH,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_TAPPING
*START_SEQUENCE
CYCLE/TAP,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_THREAD_WITHOUT_TAP_HEAD
*START_SEQUENCE
PPRINT CYCLE NON DECODE
*END
*END
/
*START_NC_INSTRUCTION                  NC_REVERSE_THREADING
*START_SEQUENCE
CYCLE/INVERS,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_BORING
*START_SEQUENCE
CYCLE/THRU,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_COUNTERBORING
*START_SEQUENCE
CYCLE/FACE,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST   
*END
*END
/
*START_NC_INSTRUCTION                  NC_COUNTERSINKING
*START_SEQUENCE
CYCLE/FACE,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST 
*END
*END
/
*START_NC_INSTRUCTION                  NC_DRILLING_DWELL_DELAY
*START_SEQUENCE
CYCLE/FACE,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST   
*END
*END
/
*START_NC_INSTRUCTION                  NC_BREAK_CHIPS
*START_SEQUENCE
CYCLE/BRKCHP,%MFG_TOTAL_DEPTH*-1,%MFG_AXIAL_DEPTH,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_REAMING
*START_SEQUENCE
CYCLE/FACE,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST 
*END
*END
/
*START_NC_INSTRUCTION                  NC_SPOT_DRILLING
*START_SEQUENCE
CYCLE/FACE,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST 
*END
*END
/
*START_NC_INSTRUCTION                  NC_DRILLING
*START_SEQUENCE
CYCLE/DRILL,%MFG_TOTAL_DEPTH*-1,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_TWO_SIDES_CHAMFERING
*START_SEQUENCE
PPRINT CYCLE NON DECODE
*END
*END
/
*START_NC_INSTRUCTION                  NC_BACK_BORING
*START_SEQUENCE
CYCLE/STEP,%MFG_TOTAL_DEPTH*-1,%MFG_LIFT_DIST,&MFG_FEED_UNIT,%MFG_FEED_MACH,%MFG_CLEAR_TIP,DWELLV,%MFG_DWELL_MODE,%MFG_DWELL_REVOL,%MFG_DWELL_TIME,POSZ,%MFG_JUMP_DIST
*END
*END
/
*START_NC_INSTRUCTION                  NC_T_SLOTTING
*START_SEQUENCE
PPRINT CYCLE NON DECODE
*END
*END
/
*START_NC_INSTRUCTION                  NC_CIRCULAR_MILLING
*START_SEQUENCE
PPRINT CYCLE NON DECODE
*END
*END
/
*START_NC_INSTRUCTION                  NC_THREAD_MILLING
*START_SEQUENCE
PPRINT CYCLE NON DECODE
*END
*END
/
*START_NC_INSTRUCTION                  NC_LATHE_THREADING
*START_SEQUENCE
PPRINT PAS DE CYCLE SUR FANUC
*END
*END
/
*START_NC_COMMAND                      NC_SYNCHRONISATION
PPRINT PAS DE CYCLE SUR FANUC
*END
/
*START_NC_COMMAND                      NC_AXIS_MOVE
MOVE,%MFG_NCAXIS_NAME,%MFG_AXIS_POSITION
*END
/
*START_NC_COMMAND                      NC_AXIS_LOCK
CLAMP/%MFG_AXIS_LOCK_STATUS,%MFG_NCAXIS_NAME
*END
/


bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 18:54

maintenant, le code visual basic excel 2007:

module: PostPro_5AX

Code:

Attribute VB_Name = "PostPro_5AX"
Sub CATMain()
pp_saisie.Show

End Sub

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 19:06

un autre module Module_PP_5AX

partie 1:

Code:

Attribute VB_Name = "Module_PP_5AX"
' version du 05/06/2012

Type pointdebut
        x As Double
        y As Double
        z As Double
        i As Double
        J As Double
        K As Double
End Type



Type pointfinal
        ax As Double
        bx As Double
        cx As Double
        dx As Double
        ex As Double
End Type

Type pointfinalcercle
        ax As Double
        bx As Double
        cx As Double
        ix As Double
        jx As Double
        g As Double
        ac As Double
        pas As Double
        bc As Double
        at As Double
End Type

Type gclass
        g(99) As Double
End Type

Type mclass
        m(99) As Double
End Type

Type outilclass
        tc As Double
        ts As Double
        dia As Double
        s As Double
        rot As Double
        arr As Double
        code_arr(10) As String
        f As Double
        Forigin As Double
        couple As Double
        h As Double
        corrh As Double
        d As Double
        corrd As Double
End Type

Type cycleclass
        Za As Double
        Zaf As Double
        Zp As Double
        Zr As Double
        Q As Double
        P As Double
        Gs As Double
End Type





Type varclass
        ptd As pointdebut

        ptf As pointfinal

        ptfa As pointfinal

        ptc As pointfinalcercle

        g As gclass

        m As mclass

        outil As outilclass

        cycle As cycleclass

        sortie As String
       
        px As Double
        py As Double
        pz As Double
       
        cldx As Integer
        clex As Integer
        xdec As Double
        ydec As Double
        zdec As Double
        plunge As Double
        Zplunge As Double
        rotdx As Double
        rotex As Double
        defaultex As Double
        finvers As Integer
        g682x As Double
        g682y As Double
        g682z As Double
        g682m As Double
        g682auto As Double
        g434etat As Integer
        lintol As Double
        etat As Integer

End Type








Type sortieclass
        erreur As String
        chaine As String
        chainearr As String
        etat As Integer
End Type



Dim newvar As varclass
Dim oldvar As varclass
Dim sortie As sortieclass












Private Sub ecrire(ByVal texte As String, ByVal fichier As String)

          Dim fichier_sortie As Integer
          fichier_sortie = FreeFile


          Open fichier + ".tap" For Append As #fichier_sortie
         
         
          Print #fichier_sortie, texte
         
          Close #fichier_sortie
         
End Sub








Sub ppvp400(ByVal urlaptsource As String)





                pp_saisie.Label1.Caption = "debut traitement"
                DoEvents
               
               


                Dim ch0 As String
                Dim path As String
                path = ""
                Dim nom_de_fichier As String
                           


                ch0 = urlaptsource
                Do While InStr(ch0, Chr(92)) > 0
                path = path + Mid(ch0, 1, InStr(ch0, Chr(92)))
                ch0 = Mid(ch0, InStr(ch0, Chr(92)) + 1)

                Loop

 
                nom_de_fichier = Mid(ch0, 1, InStr(ch0, ".") - 1)


                Dim fichier_sortie As String
 '              fichier_sortie = nom_de_fichier
                Dim fichier_sortie_etat As Integer
                fichier_sortie_etat = 0

                pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                DoEvents
 

                Dim fichier_sortie2 As Integer
                fichier_sortie2 = FreeFile

         
         
         
         


       
       

        oldvar.g.g(1) = 1E+100
        oldvar.g.g(2) = 1E+100
        oldvar.g.g(3) = 1E+100
        oldvar.g.g(5) = -99
        oldvar.ptf.ax = 1E+100
        oldvar.ptf.bx = 1E+100
        oldvar.ptf.cx = 1E+100
        oldvar.ptf.dx = 1E+100
        oldvar.ptf.ex = 0
        oldvar.outil.tc = 1E+100
        oldvar.outil.arr = 0
        oldvar.outil.s = 1E+100
        oldvar.outil.rot = 1E+100
        oldvar.outil.corrd = 40
        oldvar.cycle.Zaf = 1E+100
        oldvar.ptc.ac = 1E+100
        oldvar.ptc.bc = 1E+100
        oldvar.ptc.at = 0
        oldvar.cycle.Gs = 1E+100
        oldvar.plunge = 0
        oldvar.cldx = 1
        oldvar.clex = 1
        oldvar.g682m = 69

        newvar.px = 0
        newvar.py = 0
        newvar.pz = 0
       
        newvar.g.g(1) = 1E+100
        newvar.g.g(2) = 54
        newvar.g.g(3) = 90
        newvar.g.g(5) = 94
        newvar.ptf.dx = 0
        newvar.ptf.ex = 0
        newvar.outil.arr = 0
        newvar.outil.code_arr(0) = "M9"
        newvar.outil.code_arr(1) = "M8"
        newvar.outil.code_arr(2) = "M58"
        newvar.outil.code_arr(3) = "M58" + vbLf + "M52"
        newvar.outil.code_arr(4) = "M58" + vbLf + "M7"
        newvar.outil.s = 1E+100
        newvar.outil.f = 10000000000#
        newvar.outil.rot = 1E+100
        newvar.outil.couple = 0
        newvar.outil.corrd = 40
        newvar.cycle.Zaf = 1E+100
        newvar.ptc.at = 0
        newvar.plunge = 0
        newvar.cldx = 1
        newvar.clex = 1
        newvar.rotdx = 1E+100
        newvar.rotex = 1E+100
        newvar.defaultex = 1E+100
        newvar.g682auto = 0
        newvar.g682m = 69
        newvar.g682x = 0
        newvar.g682y = 0
        newvar.g682z = 0
        newvar.g434etat = 0
        newvar.lintol = 0
       
       


        Dim ptd As pointdebut
        Dim ptf As pointfinal
        Dim ptfa As pointfinal
       
        sortie.chainearr = ""
        sortie.chaine = ""
        sortie.erreur = ""



        Dim saisie As String
        Dim buffer As String
        Dim buffer2 As String
        Dim chaine1 As String
        Dim chaine2 As String
        Dim cle1 As String
        Dim concat As Integer
        Dim compteur As Double
        Dim num1 As Integer
        Dim i_outil_suivant As Integer
        Dim at As Double
        Dim az As Double
        Dim var1 As Double
        Dim var2 As Double
        Dim var3 As Double
        Dim ch1 As String
        Dim total As Long
        total = 0
       

        newvar.etat = 0

        Dim liste_outils(1999) As Long
        Dim i1 As Integer
        i1 = 1


 
 
 
          Dim fichier_entree0 As Integer
          fichier_entree0 = FreeFile
 
          Open urlaptsource For Input As fichier_entree0
       
       
            Do While Not EOF(fichier_entree0)
           
           
            Line Input #fichier_entree0, saisie

 
 
                total = total + 1
                chaine1 = saisie
                If InStr(chaine1, "LOADTL") = 1 Then
                        chaine1 = Mid(saisie, InStr(saisie, "/") + 1)
                        If InStr(chaine1, ",") > 0 Then
                                chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                        Else
                                chaine2 = chaine1
                        End If
                liste_outils(i1) = CLng(Fix(Val(chaine2)))

                If (i1 > 1) And (liste_outils(i1) = liste_outils(i1 - 1)) Then
                        i1 = i1 - 1
                End If

                i1 = i1 + 1
                End If

        Loop

        liste_outils(i1) = 9999

        Close #fichier_entree0

       
       
        i_outil_suivant = 2
        Dim ligne As Long
        ligne = 0
        concat = 0
       
       
       
       
            Dim fichier_entree As Integer
            fichier_entree = FreeFile
 
            Open urlaptsource For Input As #fichier_entree
       
       
        Do While Not EOF(fichier_entree)
           
           
            Line Input #fichier_entree, saisie




        compteur = compteur + 1
        If CLng(compteur / 100) <> ligne Then
       
            ligne = CLng(compteur / 100)
            pp_saisie.Label1.Caption = Str(ligne * 100) + "  lignes traitees sur " + Str(total)
            DoEvents
           
        End If
       







        If InStr(saisie, "$$") > 0 Then
                saisie = "rien"
          newvar.etat = 0
        Else

        buffer2 = saisie

        End If
       

        num1 = Len(saisie)
       

       


        If InStr(saisie, "$") > 0 Then
                If concat = 0 Then
                        buffer = Mid(saisie, 1, InStr(saisie, "$") - 1)
                        concat = 1
          Else
                        buffer = buffer + Mid(saisie, 1, InStr(saisie, "$") - 1)
          End If

         
        Else
     
                If concat = 0 Then
                        buffer = saisie
          Else
                  buffer = buffer + saisie
                  concat = 0
          End If
         
      End If
     
       


        If concat = 0 Then

                sortie.chaine = ""
                newvar.etat = 0
       



        If InStr(buffer, "PARTNO") > 0 Then
                  sortie.chaine = "<" + Mid(buffer, 8) + ">"
                  fichier_sortie_principal = Mid(buffer, 8)
                  fichier_sortie = fichier_sortie_principal
                  newvar.etat = 1
                 
                  If Dir(path + fichier_sortie + ".tap") <> "" Then
                      Set fs = CreateObject("Scripting.FileSystemObject")
                      Set f = fs.GetFile(path + fichier_sortie + ".tap")
                      f.Delete
                  End If



                pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                DoEvents
        End If


        If InStr(buffer, "PPRINT") > 0 Then
                  chaine1 = Mid(buffer, 7)
                  chaine1 = StrConv(chaine1, vbUpperCase)
                  chaine2 = "("
                  chaine2 = chaine2 + chaine1
                  chaine2 = chaine2 & ")"
                  sortie.chaine = chaine2
                  newvar.etat = 1

        End If


        If InStr(buffer, "TPRINT") > 0 Then
                  chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                  chaine1 = StrConv(chaine1, vbUpperCase)
                  chaine2 = "("
                  chaine2 = chaine2 + chaine1
                  chaine2 = chaine2 & ")"
                  sortie.chaine = chaine2
                  newvar.etat = 1

        End If


        If InStr(buffer, "INSERT") > 0 Then
                  chaine2 = Mid(buffer, 8)
                  chaine2 = chaine2
                  sortie.chaine = chaine2
                  newvar.etat = 1

        End If


        If InStr(buffer, "DEFSUB") > 0 Then
                If fichier_sortie_etat = 0 Then
                  chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                  chaine2 = Str(10000 + Val(chaine1))
                  chaine2 = Mid(chaine2, 3)
                  fichier_sortie = fichier_sortie_principal & "S" & chaine2
 
                  If Dir(path + fichier_sortie + ".tap") <> "" Then
                      Set fs = CreateObject("Scripting.FileSystemObject")
                      Set f = fs.GetFile(path + fichier_sortie + ".tap")
                      f.Delete
                  End If
                   
 
                  pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                  DoEvents
 
                  sortie.chaine = "<" & fichier_sortie_principal & "S" & chaine2 & ">"
                  sortie.chainearr = ""
                  newvar.etat = 1
                  fichier_sortie_etat = 1
                End If
        End If

        If InStr(buffer, "ENDSUB") > 0 Then
                If fichier_sortie_etat = 1 Then
                  sortie.chaine = "M99" & vbLf & "%" & vbLf
                  newvar.etat = 1
                  fichier_sortie_etat = 0
                End If
        End If

        If InStr(buffer, "CALSUB") > 0 Then
                  chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                  chaine2 = Str(10000 + Val(chaine1))
                  chaine2 = Mid(chaine2, 3)

                  sortie.chaine = "M198 <" & fichier_sortie_principal & "S" & chaine2 & ">"
                  sortie.chainearr = ""
                  newvar.etat = 1

        End If




        If InStr(buffer, "LOADTL") > 0 Then
          newvar.outil.ts = liste_outils(i_outil_suivant)
          Call word_loadtl(buffer, newvar, oldvar, sortie)
          i_outil_suivant = i_outil_suivant + 1
        End If


        If InStr(buffer, "SPINDL") > 0 Then
          Call word_spindl(buffer, oldvar, newvar, sortie)
        End If




        If InStr(buffer, "MODE") > 0 Then
            If InStr(buffer, "HIGH") > 0 Then
                If InStr(buffer, "OFF") > 0 Then
                    sortie.chaine = "G5.1Q0"
                    newvar.etat = 1
                Else
                    var1 = Val(Mid(buffer, InStr(buffer, ",") + 1))
                    If var1 >= 1 And var1 <= 10 Then
                        sortie.chaine = "G5.1Q1R" + Mid(Str(var1), 2)
                        newvar.etat = 1
                    End If
                End If
            End If
            If InStr(buffer, "XYZ") = 0 And InStr(buffer, "HIGH") = 0 Then
                If InStr(buffer, "OFF") > 0 Then
                  sortie.chaine = "G49G53Z0"
                  newvar.g434etat = 0
                  newvar.etat = 1
                End If
                If InStr(buffer, "ON") > 0 Then
                          newvar.g.g(4) = 43.4
                          oldvar.g.g(4) = 1E+100
                          oldvar.g.g(1) = 1E+100
                          oldvar.g.g(3) = 1E+100
                          oldvar.outil.f = 100000000
                          newvar.g434etat = 1
                          newvar.etat = 0
                  End If
          End If
       
End If




If InStr(buffer, "CLAMP") > 0 Then
        If InStr(buffer, "1") > 0 Then
                If InStr(buffer, "OFF") > 0 Then
                        newvar.cldx = 0
                Else
                        newvar.cldx = 1
                End If
        Else
                If InStr(buffer, "2") > 0 Then
                        If InStr(buffer, "OFF") > 0 Then
                                newvar.clex = 0
                        Else
                                newvar.clex = 1
                        End If
                Else
                        If InStr(buffer, "OFF") > 0 Then
                                newvar.cldx = 0
                                newvar.clex = 0

                        Else
                                newvar.cldx = 1
                                newvar.clex = 1
                        End If
                End If
        End If
        newvar.etat = 0

End If





        If InStr(buffer, "RAPID") > 0 Then
                  If newvar.g.g(1) <> 80 Then
                          newvar.g.g(1) = 0
                  End If
                  newvar.etat = 0

        End If




        If InStr(buffer, "CUTTER") > 0 Then
                newvar.outil.dia = Val(Mid(buffer, InStr(buffer, "/") + 1, InStr(buffer, ",")))
                newvar.etat = 0

        End If




        If InStr(buffer, "FEDRAT") > 0 Then
                Call word_fedrat(buffer, newvar, oldvar, sortie)
        End If




        If InStr(buffer, "COUPLE") > 0 Then
                If InStr(buffer, "ON") > 0 Then
                        If InStr(buffer, "1") > 0 Then
                                newvar.outil.couple = 1
                        Else
                                newvar.outil.couple = 2
                        End If
                Else
                        newvar.outil.couple = 0
                End If
                newvar.etat = 0

        End If




        If InStr(buffer, "REVERS") > 0 Then
                If InStr(buffer, "OFF") > 0 Then
                        newvar.g682auto = 0
                        newvar.g682m = 69
                        newvar.g682x = 0
                        newvar.g682y = 0
                        newvar.g682z = 0
                        sortie.chaine = "G69"
                        oldvar.g682m = 69
                        newvar.etat = 1

                Else
                        chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                        chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                        newvar.g682x = Val(chaine2)
                        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                        chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                        newvar.g682y = Val(chaine2)
                        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                        If InStr(chaine1, ",") > -1 Then
                                chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                        Else
                                chaine2 = chaine1
                        End If
                        newvar.g682z = Val(chaine2)
                newvar.g682auto = 1
                newvar.g682m = 68.2
                newvar.etat = 0

                End If
        End If


        If InStr(buffer, "GOTO") > 0 Then
                Call word_goto(buffer, newvar, oldvar, sortie)
           
        End If




        If InStr(buffer, "PIVOTZ") > 0 Then
            If InStr(buffer, "OFF") > 0 Or InStr(buffer, "AUTO") > 0 Then
            Else
                Call word_pivotz(buffer, newvar)
                oldvar.px = newvar.px
                oldvar.py = newvar.py
                oldvar.pz = newvar.pz
            End If
        End If



        If InStr(buffer, "INDIRV") > 0 Then
                ptfa = extract_indirv(buffer, newvar, oldvar)
                newvar.ptfa = ptfa
                sortie.chaine = ""
                newvar.etat = 0

        End If






        If InStr(buffer, "CIRCLE") > 0 Or InStr(buffer, "CYLNDR") > 0 Then
                Call words_circle_cylndr(buffer, oldvar, newvar, sortie)
        End If





        If InStr(buffer, "HELICAL") > 0 Then
            Call word_helical(buffer, oldvar, newvar, sortie)
        End If


        If InStr(buffer, "TOOLNO") > 0 Then
                If InStr(buffer, "RADIUS") > 0 Then
                        newvar.outil.d = CInt(Fix(Val(Mid(buffer, InStr(buffer, ",") + 1))))

                Else
                        newvar.outil.h = CInt(Fix(Val(Mid(buffer, InStr(buffer, "/") + 1))))
                        oldvar.outil.corrh = -1
                End If
                newvar.etat = 0

        End If


        If InStr(buffer, "COOLNT") > 0 Then
                If InStr(buffer, "FLOOD") > 0 Then
                        newvar.outil.arr = 1
                End If
                If InStr(buffer, "MIST") > 0 Then
                    If InStr(buffer, ",1") > 0 Or InStr(buffer, ",") = 0 Then
                        newvar.outil.arr = 2
                    End If
                    If InStr(buffer, ",2") > 0 Then
                        newvar.outil.arr = 3
                    End If
                    If InStr(buffer, ",3") > 0 Then
                        newvar.outil.arr = 4
                    End If
                End If
                If InStr(buffer, "OFF") > 0 Then
                        newvar.outil.arr = 0
                        If newvar.outil.arr <> oldvar.outil.arr Then
                            sortie.chaine = "M9"
                        Else
                            sortie.chaine = ""
                        End If
                        newvar.etat = 1
                Else
                    newvar.etat = 0
                End If
        End If




        If InStr(buffer, "STOP") = 1 Then

                        sortie.chaine = "M0"
                        newvar.etat = 1
        End If




        If InStr(buffer, "OSTOP") = 1 Then

                        sortie.chaine = "M1"
                        newvar.etat = 1
        End If


       
       
        If InStr(buffer, "ROTABL") > 0 Then


                        chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

                        If InStr(chaine1, "AAXIS") > 0 Then
                                chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

                        If InStr(chaine1, ",") > 0 Then
                                chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                        Else
                                chaine2 = chaine1
                        End If

                        newvar.rotdx = Val(chaine2)
                        End If


                        If InStr(chaine1, "CAXIS") > 0 Then
                                chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

                        If InStr(chaine1, ",") > 0 Then
                                chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                        Else
                                chaine2 = chaine1
                        End If

                        newvar.rotex = Val(chaine2)
                        End If

                        newvar.etat = 0
        End If




        If InStr(buffer, "MOVETO") > 0 Then
       
            Call word_moveto(buffer, newvar, oldvar, sortie)

        End If



        If InStr(buffer, "DELAY") > 0 Then
                        chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                        sortie.chaine = "G4X" + chaine(Val(chaine1))
                        newvar.etat = 1
        End If
       
       

        If InStr(buffer, "CUTCOM") > 0 Then
                Call extract_cutcom(buffer, newvar)
                newvar.etat = 0
        End If
       
       

        If InStr(buffer, "ORIGIN") > 0 Then
                Call word_origin(buffer, newvar, oldvar, sortie)
        End If


        If InStr(buffer, "CYCLE/OFF") > 0 Then
            newvar.g.g(1) = 1E+100
            oldvar.g.g(1) = 1E+100
            newvar.cycle.Gs = 999
            sortie.chaine = "G80"
            newvar.etat = 1
        End If


        If InStr(buffer, "LINTOL") > 0 Then
            If InStr(buffer, "OFF") > 0 Then
                newvar.lintol = 0
            Else
                newvar.lintol = Val(Mid(buffer, InStr(buffer, "/") + 1))
            End If
            newvar.etat = 0

        End If




        If InStr(buffer, "CYCLE/BRKCHP") > 0 Or InStr(buffer, "CYCLE/INVERS") > 0 Or InStr(buffer, "CYCLE/LOCK") > 0 Or InStr(buffer, "CYCLE/DRILL") > 0 Or InStr(buffer, "CYCLE/FACE") > 0 Or InStr(buffer, "CYCLE/DEEP") > 0 Or InStr(buffer, "CYCLE/TAP") > 0 Or InStr(buffer, "CYCLE/BORE") > 0 Or InStr(buffer, "CYCLE/REAM") > 0 Or InStr(buffer, "CYCLE/STEP") > 0 Or InStr(buffer, "CYCLE/MANUAL") > 0 Or InStr(buffer, "CYCLE/THRU") > 0 Then
                          oldvar.cycle.Gs = 999
                          Call word_cycle(buffer, newvar)
                          newvar.outil.Forigin = newvar.outil.f
                          oldvar.outil.f = -1
                          newvar.etat = 0


        End If





   

   




        If newvar.etat = 1 Then
        If Len(sortie.erreur) > 0 Then
                Call ecrire(sortie.erreur, path + fichier_sortie)
                End If
                If Len(sortie.chainearr) > 0 Then
                Call ecrire(sortie.chainearr, path + fichier_sortie)
                End If
                If Len(sortie.chaine) > 0 Then
                Call ecrire(sortie.chaine, path + fichier_sortie)
                End If
                sortie.chainearr = ""
                sortie.chaine = ""
                sortie.erreur = ""
        End If


        If newvar.etat = 3 Then
        If Len(sortie.erreur) > 0 Then
                Call ecrire(sortie.erreur, path + fichier_sortie)
                End If
                If Len(sortie.chainearr) > 0 Then
                Call ecrire(sortie.chainearr, path + fichier_sortie)
                End If
                sortie.chainearr = ""
                sortie.chaine = ""
                sortie.erreur = ""
        End If



        If newvar.etat = 10 Then
        If Len(sortie.erreur) > 0 Then
                Call ecrire(sortie.erreur, path + fichier_sortie)
                End If
                If Len(sortie.chainearr) > 0 Then
                Call ecrire(sortie.chainearr, path + fichier_sortie)
                End If
                sortie.chainearr = sortie.chaine
                sortie.chaine = ""
                sortie.erreur = ""
        End If

        If fichier_sortie_etat = 0 Then
                fichier_sortie = fichier_sortie_principal
       
                pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                DoEvents
 
        End If
       
        End If
       
   
       

        Loop


        Close #fichier_entree

                pp_saisie.Label1.Caption = "fin traitement"


End Sub

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 19:09

la suite partie 2:

Code:




Private Sub word_loadtl(buffer As String, varnew As varclass, oldvar As varclass, sortie As sortieclass)


          Dim chaine1 As String
          Dim num1 As Integer
          Dim chaine2, tc As String
         

          chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
          If InStr(chaine1, ",") > 0 Then
                  chaine1 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  varnew.outil.tc = Val(chaine1)
          Else
                  varnew.outil.tc = Val(chaine1)
          End If


          sortie.chaine = ""


        If varnew.outil.tc <> oldvar.outil.tc Then

                  If oldvar.outil.tc = 1E+100 Then
                    sortie.chaine = sortie.chaine & "M68" & vbLf
                  End If
                  If oldvar.g682m = 68.2 Then
                          sortie.chaine = "G69" & vbLf
                  End If
                          sortie.chaine = sortie.chaine & "N"
                          chaine1 = Str(10000 + varnew.outil.tc)
                          sortie.chaine = sortie.chaine + Mid(chaine1, 3)
                          sortie.chaine = sortie.chaine & "M98P9145" & vbLf

                  sortie.chaine = sortie.chaine & "M1" & vbLf & "T"
                  tc = Str(10000 + varnew.outil.tc)
                  tc = Mid(tc, 3)
                  sortie.chaine = sortie.chaine + tc & "M6"
                  chaine1 = Str(varnew.outil.ts + 10000)
                  chaine1 = Mid(chaine1, 3)
                  sortie.chaine = sortie.chaine & vbLf & "T" & chaine1
                  sortie.chaine = sortie.chaine + vbLf + "M51"


          varnew.ptf.ax = 1E+100
          varnew.ptf.bx = 1E+100
          varnew.ptf.cx = 1E+100
          varnew.ptf.dx = 0
          varnew.g682m = 69

          varnew.g.g(1) = 1E+100
          varnew.outil.s = -10
          varnew.outil.rot = 3
          varnew.outil.h = varnew.outil.tc
          varnew.outil.corrh = 43
          varnew.outil.d = varnew.outil.tc
       


               
                  sortie.chainearr = ""
                  oldvar.outil.tc = varnew.outil.tc
                  oldvar.outil.ts = varnew.outil.ts
                  oldvar.outil.h = 1E+100
                  oldvar.outil.d = 1E+100
                  oldvar.outil.s = 0
                  oldvar.outil.arr = 0
                  oldvar.cycle.Zaf = 1E+100
                  oldvar.g.g(1) = 1E+100
                  oldvar.g.g(2) = 1E+100
                  oldvar.g.g(3) = 1E+100
                  oldvar.g.g(5) = -99
                  oldvar.ptf.ax = 1E+100
                  oldvar.ptf.bx = 1E+100
                  oldvar.ptf.cx = 1E+100
                  oldvar.ptf.dx = 1E+100
                  oldvar.g682m = 69
                  End If

                  If varnew.g682auto = 1 Then
                          varnew.g682m = 68.2
                  End If
                  oldvar.outil.f = -1
                  If varnew.defaultex <> 1E+100 Then
                          oldvar.ptf.ex = 1E+100
                  End If

                  sortie.etat = -2
                  varnew.etat = 1

          End Sub






Private Function chaine(ByVal d As Double) As String
               
                Dim s0 As String
                s0 = ""
                Dim A As Double
                A = d


'                If d > 0 Then
'                        A = (d + 0.000499999)
'                End If
'                If d < 0 Then
'                        A = (d - 0.000499999)
'                End If

                If Abs(A) < 0.001 Then
                        A = 0
                End If

       
               
                s0 = Str(FormatNumber(A, 3))
               
                If A >= 0 Then
                    s0 = Mid(s0, 2)
                End If
               
                If InStr(s0, ".") = 0 Then
                    s0 = s0 + "."
                End If
               
       
               
             
 
        chaine = s0

        End Function






Private Sub word_goto(buffer As String, newvar As varclass, oldvar As varclass, sortie As sortieclass)

        Dim chaine1 As String
        Dim chaine2 As String
        Dim chaineX As String
        Dim chaineY As String
        Dim chaineZ As String
        Dim chaineI As String
        Dim chaineJ As String
        Dim chaineK As String

        Dim ptd As pointdebut

          chaine2 = Mid(buffer, InStr(buffer, "/") + 1)
          chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.x = Val(chaineX)

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.y = Val(chaineY)

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineZ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.z = Val(chaineZ)

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineI = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.i = Val(chaineI)

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineJ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.J = Val(chaineJ)

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          If InStr(chaine2, "PT") > 0 Then
          chaineK = Mid(chaine2, 1, InStr(chaine2, "PT") - 1)
          Else
                  chaineK = chaine2
          End If
          ptd.K = Val(chaineK)




                  newvar.ptf = CalculPointFinal(ptd, newvar, oldvar)
                  newvar.ptd = ptd
                  newvar.rotdx = 1E+100
                  newvar.rotex = 1E+100


                  If sortie.etat = -2 Then
                          oldvar.ptf.ex = 1E+100
                  End If



                  If (newvar.g.g(1) <> 0) And (newvar.g.g(1) <> 73) And (newvar.g.g(1) <> 74) And (newvar.g.g(1) <> 76) And (newvar.g.g(1) <> 81) And (newvar.g.g(1) <> 82) And (newvar.g.g(1) <> 83) And (newvar.g.g(1) <> 84) And (newvar.g.g(1) <> 85) And (newvar.g.g(1) <> 86) And (newvar.g.g(1) <> 87) And (newvar.g.g(1) <> 88) And (newvar.g.g(1) <> 89) Then
                                newvar.g.g(1) = 1

                                var1 = Val(chaine(newvar.ptf.dx))
                                var2 = Val(chaine(oldvar.ptf.dx))
                                var3 = var1 - var2
                                var1 = Val(chaine(newvar.ptf.ex))
                                var2 = Val(chaine(oldvar.ptf.ex))
                                var3 = var3 + (var1 - var2)

                                If (newvar.finvers = 1) And (var3 <> 0) Then
                                        newvar.g.g(5) = 93
                                Else
                                        newvar.g.g(5) = 94
                                End If
                  End If
                 
       
                  If newvar.lintol > 0 And newvar.g.g(1) = 1 And oldvar.ptf.ax <> 1E+100 And oldvar.ptf.bx <> 1E+100 And oldvar.ptf.cx <> 1E+100 Then
                        Call linearisation(oldvar, newvar, sortie)
                  End If


                  Call format_sortie(oldvar, newvar, sortie)


                  If (sortie.etat = -1) Then

                  Else

                                newvar.ptc.at = 0
                                oldvar.ptc.at = 0
                                newvar.ptc.pas = 0
                                oldvar.ptc.pas = 0


                  If newvar.g.g(1) = 0 Then
                          oldvar.cldx = newvar.cldx
                          oldvar.clex = newvar.clex
                          oldvar.ptd = newvar.ptd
                          oldvar.ptf = newvar.ptf

                          oldvar.outil.tc = newvar.outil.tc
                          oldvar.outil.s = newvar.outil.s
                          oldvar.outil.rot = newvar.outil.rot
                          oldvar.outil.h = newvar.outil.h
                          oldvar.outil.corrh = newvar.outil.corrh
                          oldvar.g.g(1) = 0
                          oldvar.g.g(2) = newvar.g.g(2)
                          oldvar.g.g(3) = newvar.g.g(3)
                          oldvar.g682m = newvar.g682m
                          oldvar.g.g(4) = newvar.g.g(4)

                        Else
                                  oldvar.cldx = newvar.cldx
                                  oldvar.clex = newvar.clex
                                  oldvar.ptd = newvar.ptd
                                  oldvar.ptf = newvar.ptf


                                oldvar.outil = newvar.outil
                                oldvar.cycle = newvar.cycle
                                oldvar.g.g(4) = newvar.g.g(4)


                                If Len(sortie.chaine) > 0 Then
                                oldvar.g.g(1) = newvar.g.g(1)
                                oldvar.g.g(2) = newvar.g.g(2)
                                oldvar.g.g(3) = newvar.g.g(3)
                                oldvar.g.g(5) = newvar.g.g(5)
                                End If
                        End If

                  If newvar.g.g(1) = 0 Then
                                  newvar.g.g(1) = 1E+100
                                  oldvar.cycle.P = -1
                                  oldvar.cycle.Q = -1
                  End If
                  oldvar.outil.arr = newvar.outil.arr
                  newvar.etat = 1
                  End If

       
End Sub





Private Function angle(ByVal i As Double, ByVal J As Double) As Double
        Dim i0 As Double
        Dim j0 As Double
        Dim angle_Renamed As Double
        angle_Renamed = 0
        Dim angleR As Double
        Dim pi As Double
        pi = 3.14159265358979


        If i = 0 Then
                  If J > 0 Then
                          angle_Renamed = (pi / 2)
                  End If
                If J < 0 Then
                        angle_Renamed = 0 - (pi / 2)
                End If
                If J = 0 Then
                        angle_Renamed = 0
                End If
        End If

        If i > 0 Then
                  If J >= 0 Then
                        If J <= i Then
                                angle_Renamed = Atn(J / i)
                        End If
                  If J > i Then
                          angle_Renamed = (pi / 2) - Atn(i / J)
                  End If
                  End If

                If J < 0 Then
                          j0 = J * (0 - 1)
                        If j0 <= i Then
                                angle_Renamed = 0 - Atn(j0 / i)
                        End If
                        If j0 > i Then
                                angle_Renamed = 0 - (pi / 2) + Atn(i / j0)
                        End If
                End If
        End If

        If i < 0 Then
                  i0 = i * (0 - 1)

                If J >= 0 Then
                          If J <= i0 Then
                                  angle_Renamed = pi - Atn(J / i0)
                          End If
                        If J > i0 Then
                                angle_Renamed = (pi / 2) + Atn(i0 / J)
                        End If
                End If

                If J < 0 Then
                          j0 = J * (0 - 1)
                        If j0 <= i0 Then
                                angle_Renamed = 0 - pi + Atn(j0 / i0)
                        End If
                        If j0 > i0 Then
                                angle_Renamed = 0 - (pi / 2) - Atn(i0 / j0)
                        End If
                End If
        End If

        angleR = angle_Renamed * (180 / pi)



        angle = angleR

End Function





Private Function CalculPointFinal(ptd As pointdebut, varnew As varclass, varold As varclass) As pointfinal

        Dim r4axe1 As Double
        Dim r5axe1 As Double
        Dim tab1(6, 3) As Double
        Dim axy As Double
        Dim ay5z5 As Double
        Dim rij As Double
        Dim x5f As Double
        Dim y5f As Double
        Dim z5f As Double
        Dim ry5z5 As Double
        Dim rxy As Double
        Dim xf1 As Double
        Dim yf1 As Double
        Dim zf1 As Double
        Dim a0 As Double, A1 As Double
        s1 = 0
        Dim a2 As Double
        s2 = 0
        Dim ar As Double, j1 As Double, y1 As Double, ry1k As Double
        Dim rpypz, apypz, raxbx, aaxbx As Double
        Dim pi As Double
        pi = 3.14159265358979
        Dim etat As Integer
        etat = 0
        Dim i1 As Integer
        i1 = 0
        Dim i2 As Integer
        i2 = 0


        Dim ptf As pointfinal
       
        ptd.x = FormatNumber(ptd.x, 6)
        ptd.y = FormatNumber(ptd.y, 6)
        ptd.z = FormatNumber(ptd.z, 6)
        ptd.i = FormatNumber(ptd.i, 6)
        ptd.J = FormatNumber(ptd.J, 6)
        ptd.K = FormatNumber(ptd.K, 6)


        r5axe1 = angle(ptd.i, ptd.J)


        rij = Sqr((ptd.i * ptd.i) + (ptd.J * ptd.J))
       

        r4axe1 = angle(ptd.K, rij)


        If (r4axe1 <> 0) Then
                r5axe1 = 90 - r5axe1


        End If


        If r4axe1 = 0 Then
                r5axe1 = varnew.ptf.ex

              If ((varnew.defaultex <> 1E+100) And (varold.ptf.ex = 1E+100)) Or ((varnew.defaultex <> 1E+100) And (varold.ptf.dx <> 0)) Then
                        r5axe1 = varnew.defaultex
                        etat = 1
                End If


                If varnew.rotex <> 1E+100 Then
                        r5axe1 = varnew.rotex
                        etat = 1
                End If


        End If


        Do While (Abs(r5axe1 - varnew.ptf.ex) > 180) And (etat = 0)
                If varnew.ptf.ex <= 0 Then
                        If r5axe1 < varnew.ptf.ex Then
                                r5axe1 = r5axe1 + 360
                        Else
                                r5axe1 = r5axe1 - 360
                        End If
                End If
                If varnew.ptf.ex > 0 Then
                        If r5axe1 < varnew.ptf.ex Then
                                r5axe1 = r5axe1 + 360
                        Else
                                r5axe1 = r5axe1 - 360
                        End If
                End If
        Loop



        tab1(1, 2) = varnew.ptf.dx
        tab1(1, 3) = varnew.ptf.ex
        tab1(2, 2) = r4axe1
        tab1(2, 3) = r5axe1
        tab1(2, 1) = Abs(tab1(2, 2) - tab1(1, 2)) + Abs(tab1(2, 3) - tab1(1, 3))
        tab1(3, 2) = r4axe1
        tab1(3, 3) = r5axe1
        tab1(3, 1) = Abs(tab1(3, 2) - tab1(1, 2)) + Abs(tab1(3, 3) - tab1(1, 3))
        tab1(4, 2) = 0 - r4axe1
        tab1(4, 3) = r5axe1 - 180
        tab1(4, 1) = Abs(tab1(4, 2) - tab1(1, 2)) + Abs(tab1(4, 3) - tab1(1, 3))
        tab1(5, 2) = 0 - r4axe1
        tab1(5, 3) = r5axe1 + 180
        tab1(5, 1) = Abs(tab1(5, 2) - tab1(1, 2)) + Abs(tab1(5, 3) - tab1(1, 3))

        i2 = 4

        If (tab1(4, 2) < -30) Or (r4axe1 = 0) Then
                i2 = 2
        End If

        tab1(6, 2) = tab1(2, 2)
        tab1(6, 3) = tab1(2, 3)

        i1 = 2

        Do While i1 <= i2
                If tab1(2, 1) > tab1(i1, 1) Then
                                        tab1(6, 1) = tab1(i1, 1)
                                        tab1(6, 2) = tab1(i1, 2)
                                        tab1(6, 3) = tab1(i1, 3)
                End If
                i1 = i1 + 1
        Loop



        r4axe1 = tab1(6, 2)
        r5axe1 = tab1(6, 3)




        rxy = Sqr(((ptd.x - varnew.g682x) * (ptd.x - varnew.g682x)) + ((ptd.y - varnew.g682y) * (ptd.y - varnew.g682y)))

        axy = angle((ptd.x - varnew.g682x), (ptd.y - varnew.g682y))

                x5f = rxy * Cos((axy + r5axe1) * pi / 180)
                y5f = rxy * Sin((axy + r5axe1) * pi / 180)
                z5f = ptd.z - varnew.g682z


        ry5z5 = Sqr((y5f * y5f) + (z5f * z5f))
        ay5z5 = angle(z5f, y5f)

        rpypz = Sqr((varnew.py * varnew.py) + (varnew.pz * varnew.pz))
        apypz = angle(varnew.pz, varnew.py)


        yf1 = ((ry5z5) * Sin((ay5z5 - r4axe1) * pi / 180)) + newvar.py - (rpypz * Sin((apypz - r4axe1) * pi / 180))
        xf1 = x5f
        zf1 = ((ry5z5) * Cos((ay5z5 - r4axe1) * pi / 180)) + newvar.pz - (rpypz * Cos((apypz - r4axe1) * pi / 180))


        ptf.ax = xf1
        ptf.bx = yf1
        ptf.cx = zf1
        ptf.dx = r4axe1
        ptf.ex = r5axe1

        If varnew.g434etat = 1 Then
                ptf.ax = ptd.x
                ptf.bx = ptd.y
                ptf.cx = ptd.z
        End If
       


        ptf.ax = FormatNumber(ptf.ax, 6)
        ptf.bx = FormatNumber(ptf.bx, 6)
        ptf.cx = FormatNumber(ptf.cx, 6)
        ptf.dx = FormatNumber(ptf.dx, 6)
        ptf.ex = FormatNumber(ptf.ex, 6)

        CalculPointFinal = ptf


 End Function




Private Sub linearisation(oldvar As varclass, newvar As varclass, sortie As sortieclass)

Dim var1 As varclass
Dim pA As pointdebut
Dim pB As pointdebut
Dim p1 As pointdebut
Dim pfA As pointfinal
Dim pfB As pointfinal
Dim pf1 As pointfinal
Dim pr1 As pointfinal
Dim E1, AA, AB, BA, BB, A1, B1 As Double
Dim linetat As Integer
        Dim pi As Double
        pi = 3.14159265358979

var1 = newvar
pB = newvar.ptd
linetat = 1
i1 = 0

While linetat = 1

    pA = oldvar.ptd
    pfA = CalculPointFinal(pA, oldvar, oldvar)
    pfB = CalculPointFinal(pB, oldvar, oldvar)
 
    p1.x = pA.x + ((pB.x - pA.x) / 2)
    p1.y = pA.y + ((pB.y - pA.y) / 2)
    p1.z = pA.z + ((pB.z - pA.z) / 2)
   
    AA = 90 - pfA.ex
    BA = 90 - pfB.ex
    AB = pfA.dx
    BB = pfB.dx
   
'    MsgBox (Str(AB) + " AB " + Str(BB) + " BB " + Str(AA) + " AA " + Str(BA) + " BA ")
   
    A1 = AA + ((BA - AA) / 2)
    B1 = AB + ((BB - AB) / 2)
   
    p1.i = Sin(B1 * pi / 180) * Cos(A1 * pi / 180)
    p1.J = Sin(B1 * pi / 180) * Sin(A1 * pi / 180)
    p1.K = Cos(B1 * pi / 180)
'    MsgBox (Str(p1.x) + " p1 " + Str(p1.y) + " / " + Str(p1.z) + " / " + Str(p1.i) + " / " + Str(p1.J) + " / " + Str(p1.K))
 
    pf1 = CalculPointFinal(p1, oldvar, oldvar)


 '  MsgBox (Str(pf1.ax) + " pf1 " + Str(pf1.bx) + " / " + Str(pf1.cx) + " / " + Str(pf1.dx) + " / " + Str(pf1.ex))

   
   
'    MsgBox (Str(pfA.ax) + " pfA " + Str(pfA.bx) + " / " + Str(pfA.cx) + " / " + Str(pfA.dx) + " / " + Str(pfA.ex))
   
   
 '  MsgBox (Str(pfB.ax) + " pfB " + Str(pfB.bx) + " / " + Str(pfB.cx) + " / " + Str(pfB.dx) + " / " + Str(pfB.ex))
   
   
    pr1.ax = pfA.ax + ((pfB.ax - pfA.ax) / 2)
    pr1.bx = pfA.bx + ((pfB.bx - pfA.bx) / 2)
    pr1.cx = pfA.cx + ((pfB.cx - pfA.cx) / 2)
   
   

'    MsgBox (Str(pr1.ax) + " pr1 " + Str(pr1.bx) + " / " + Str(pr1.cx))

   
   
    E1 = Sqr(((pr1.ax - pf1.ax) * (pr1.ax - pf1.ax)) + ((pr1.bx - pf1.bx) * (pr1.bx - pf1.bx)) + ((pr1.cx - pf1.cx) * (pr1.cx - pf1.cx)))
    E1 = FormatNumber(E1, 6)
   
   
    If E1 <= newvar.lintol Then
       
                                var01 = Val(chaine(pfB.dx))
                                var02 = Val(chaine(pfA.dx))
                                var03 = var01 - var02
                                var01 = Val(chaine(pfB.ex))
                                var02 = Val(chaine(pfA.ex))
                                var03 = var03 + (var01 - var02)

                                If (newvar.finvers = 1) And (var03 <> 0) Then
                                        var1.g.g(5) = 93
                                Else
                                        var1.g.g(5) = 94
                                End If
 '                                MsgBox (Str(newvar.finvers) + " / " + Str(var03) + " / " + Str(var1.g.g(5)))

        If pfB.ax = newvar.ptf.ax And pfB.bx = newvar.ptf.bx And pfB.cx = newvar.ptf.cx And pfB.dx = newvar.ptf.dx And pfB.ex = newvar.ptf.ex Then
            linetat = 0
        Else
       
            var1.ptd = pB
            var1.ptf = pfB
               
       
            Call format_sortie(oldvar, var1, sortie)
            oldvar = var1
            pB = newvar.ptd
'            MsgBox (sortie.chaine)
        End If
    Else
        pB = p1
    End If
   
Wend


End Sub








Private Sub format_sortie(oldvar As varclass, varnew As varclass, sortie As sortieclass)


                Dim ch1 As String
                ch1 = ""
          Dim varptf As pointfinal
         

          Dim parg1 As String
          Dim parg2 As String
          Dim parg3 As String, parg4 As String
          parg4 = ""
          Dim parg5 As String
          parg5 = ""
          Dim sarr As String
          sarr = ""

          Dim tc As String
          Dim ax As String
          Dim bx As String
          Dim cx As String
          Dim dx As String
          Dim ex As String
          Dim xx As String
          Dim yx As String
          Dim zx As String
          Dim ix As String
          Dim jx As String
          Dim tc2 As String
          Dim ssrot As String
          Dim sh As String
          Dim scorrh As String
          Dim sfed As String
          Dim sd As String
          Dim scorrd As String
          Dim sab As String
          Dim sde As String
          Dim scx1 As String
          Dim scx2 As String
          Dim sGs As String
          Dim sZp As String
          Dim sZr As String
          Dim sQ, sP As String
          Dim scldx1 As String
          Dim scldx2 As String
          Dim sclex1 As String
          Dim sclex2 As String
          Dim sg682 As String
          sg682 = ""
          Dim sg682f As String
          sg682f = ""
          Dim y As Double
          Dim z As Double
          Dim tcn As Double
          Dim ncx1 As Double
          Dim ncx2 As Double

'          sortie.chaine = ""
          sortie.etat = 0


        If varnew.outil.s <> oldvar.outil.s Then
          ssrot = "S"
          ssrot = ssrot + Mid(Str(varnew.outil.s), 2)
          ssrot = ssrot & "M"
          ssrot = ssrot + Mid(Str(varnew.outil.rot), 2)
          If InStr(ssrot, "S-10M3") > 0 Then
                  ssrot = ""
          End If
          Else
                  ssrot = ""
          End If



        If (varnew.outil.h <> oldvar.outil.h) Or (varnew.g.g(4) <> oldvar.g.g(4)) Then
          sh = "H"
          sh = sh + Mid(Str(varnew.outil.h), 2)
          scorrh = "G"
          scorrh = scorrh + Mid(Str(varnew.outil.corrh), 2)
          Else
                  sh = ""
                  scorrh = ""
          End If

        If varnew.outil.corrd <> oldvar.outil.corrd Then
          If varnew.outil.corrd <> 40 Then
                sd = "D" + Mid(Str(varnew.outil.d), 2)
          Else
                        sd = ""
          End If
          scorrd = "G" + Mid(Str(varnew.outil.corrd), 2)
          Else
                  sd = ""
                  scorrd = ""
          End If

        If varnew.outil.arr <> oldvar.outil.arr Then
          sarr = newvar.outil.code_arr(newvar.outil.arr)
          Else
                  sarr = ""
          End If



        If varnew.g.g(1) <> oldvar.g.g(1) Then
          parg1 = "G"
          parg1 = parg1 + Mid(Str(varnew.g.g(1)), 2)
          Else
                  parg1 = ""
          End If

        If varnew.g.g(2) <> oldvar.g.g(2) Then
          parg2 = "G"
          parg2 = parg2 + Mid(Str(varnew.g.g(2)), 2)
          Else
                  parg2 = ""
          End If

        If varnew.g.g(3) <> oldvar.g.g(3) Then
          parg3 = "G"
          parg3 = parg3 + Mid(Str(varnew.g.g(3)), 2)
          Else
                  parg3 = ""
          End If

        If varnew.g.g(4) <> oldvar.g.g(4) Then
          parg4 = "G"
          parg4 = parg4 + Mid(Str(varnew.g.g(4)), 2)
          Else
                  parg4 = ""
          End If


        If varnew.g.g(5) <> oldvar.g.g(5) Then
          parg5 = "G"
          parg5 = parg5 + Mid(Str(varnew.g.g(5)), 2)
          Else
                  parg5 = ""
          End If



          yx = chaine(varnew.ptf.ax)
          zx = chaine(oldvar.ptf.ax)
          y = Val(yx)
          z = Val(zx)

          If Abs(varnew.ptf.ax) > 999999.999 Then
                  sortie.erreur = sortie.erreur & vbLf & "M00( DEPASSEMENT COORDONNEE X )"
          End If


          If (y <> z) Or (varnew.g434etat = 1) Then
          ax = "X"
          ax = ax + chaine(varnew.ptf.ax)
          Else
                  ax = ""
          End If

          yx = chaine(varnew.ptf.bx)
          zx = chaine(oldvar.ptf.bx)
          y = Val(yx)
          z = Val(zx)

          If Abs(varnew.ptf.bx) > 999999.999 Then
                  sortie.erreur = sortie.erreur & vbLf & "M00( DEPASSEMENT COORDONNEE Y )"
          End If

          If (y <> z) Or (varnew.g434etat = 1) Then
          bx = "Y"
          bx = bx + chaine(varnew.ptf.bx)
          Else
                  bx = ""
          End If

          yx = chaine(varnew.ptf.cx)
          zx = chaine(oldvar.ptf.cx)
          y = Val(yx)
          z = Val(zx)

          If Abs(varnew.ptf.cx) > 999999.999 Then
                  sortie.erreur = sortie.erreur & vbLf & "M00( DEPASSEMENT COORDONNEE Z )"
          End If

          If (y <> z) Or (varnew.g434etat = 1) Then
          cx = "Z"
          cx = cx + chaine(varnew.ptf.cx)
          Else
                  cx = ""
          End If

          If Abs(varnew.ptc.ix) > 999999.999 Then
                  sortie.erreur = sortie.erreur & vbLf & "M00( DEPASSEMENT COORDONNEE I )"
          End If


          ix = "I"
          ix = ix + chaine(varnew.ptc.ix)


          If Abs(varnew.ptc.jx) > 999999.999 Then
                  sortie.erreur = sortie.erreur & vbLf & "M00( DEPASSEMENT COORDONNEE J )"
          End If


          jx = "J"
          jx = jx + chaine(varnew.ptc.jx)


          yx = chaine(varnew.ptf.dx * -1)
          zx = chaine(oldvar.ptf.dx * -1)
          y = Val(yx)
          z = Val(zx)

          If Math.Abs(varnew.ptf.dx) > 999999.999 Then
                  sortie.erreur = sortie.erreur & vbLf & "M00( DEPASSEMENT COORDONNEE A )" & vbLf
          End If


          If (y <> z) Or (varnew.g434etat = 1) Then
          dx = "A"
          dx = dx + yx

          Else
                  dx = ""
          End If

          yx = chaine(varnew.ptf.ex * -1)
          zx = chaine(oldvar.ptf.ex * -1)
          y = Val(yx)
          z = Val(zx)

          If Math.Abs(varnew.ptf.ex) > 999999.999 Then
                  sortie.erreur = sortie.erreur & vbLf & "M00( DEPASSEMENT COORDONNEE C )" & vbLf
          End If

          If (y <> z) Or (varnew.g434etat = 1) Then
          ex = "C"
          ex = ex + yx
          Else
                  ex = ""
          End If

        scldx1 = ""
        scldx2 = ""
        sclex1 = ""
        sclex2 = ""




          If InStr(dx, "A") > 0 Then
                  If varnew.cldx = 0 Then
                          If oldvar.cldx = 1 Then
                                  scldx1 = "M79"
                          Else
                                  scldx1 = ""
                          End If
                          scldx2 = ""
                  Else
                          If oldvar.cldx = 1 Then
                                  scldx1 = "M79"
                          Else
                                  scldx1 = ""
                          End If
                          scldx2 = "M78"
                  End If

          End If




          If InStr(ex, "C") > 0 Then
                  If varnew.clex = 0 Then
                          If oldvar.clex = 1 Then
                                  sclex1 = "M11"
                          Else
                                  sclex1 = ""
                          End If
                          sclex2 = ""
                  Else
                          If oldvar.clex = 1 Then
                                  sclex1 = "M11"
                          Else
                                  sclex1 = ""
                          End If
                          sclex2 = "M10"
                  End If

          End If

          sg682f = ""

          ch1 = dx + ex


          If (Len(ch1) > 0) And (varnew.g682auto = 1) Then
            If Val(chaine(varnew.ptf.dx)) = 0 And Val(chaine(varnew.ptf.ex)) = 0 Then
                sg682 = vbLf + "G68.2X" & chaine(varnew.g682x) & "Y" & chaine(varnew.g682y) & "Z" & chaine(varnew.g682z) & "I90.J0.K-90." & vbLf & "G53.1"
            Else
                sg682 = vbLf + "G68.2X" & chaine(varnew.g682x) & "Y" & chaine(varnew.g682y) & "Z" & chaine(varnew.g682z) & "I" & chaine(varnew.ptf.ex * -1) & "J" & chaine(varnew.ptf.dx * -1) & "K0" & vbLf & "G53.1"
            End If
            If oldvar.g682m = 68.2 Then
                sg682f = "G69"
            End If
          End If










                If (varnew.outil.couple = 1) Or (varnew.outil.couple = 2) Then
                        y = Sqr((varnew.ptc.ix * varnew.ptc.ix) + (varnew.ptc.jx * varnew.ptc.jx))

                        If varnew.outil.corrd = 41 Then
                                If varnew.g.g(1) = 3 Then
                                        varnew.outil.f = varnew.outil.Forigin * y / (y + (varnew.outil.dia / 2))
                                        If CInt(Fix(varnew.outil.f)) = 0 Then
                                                varnew.outil.f = 1
                                        End If
                                End If
                                If varnew.g.g(1) = 2 Then
                                        z = y - (varnew.outil.dia / 2)
                                        If z = 0 Then
                                                varnew.outil.f = varnew.outil.Forigin * 2
                                        Else
                                                varnew.outil.f = varnew.outil.Forigin * y / (y - (varnew.outil.dia / 2))
                                                If varnew.outil.f > (varnew.outil.Forigin * 2) Then
                                                        varnew.outil.f = varnew.outil.Forigin * 2
                                                End If
                                        End If
                                        If varnew.outil.couple = 2 Then
                                                varnew.outil.f = varnew.outil.Forigin
                                        End If
                                End If
                        End If
                        If varnew.outil.corrd = 42 Then
                                If varnew.g.g(1) = 3 Then

                                        z = y - (varnew.outil.dia / 2)
                                        If z = 0 Then
                                                varnew.outil.f = varnew.outil.Forigin * 2
                                        Else
                                                varnew.outil.f = varnew.outil.Forigin * y / (y - (varnew.outil.dia / 2))
                                                If varnew.outil.f > (varnew.outil.Forigin * 2) Then
                                                        varnew.outil.f = varnew.outil.Forigin * 2
                                                End If
                                        End If

                                        If varnew.outil.couple = 2 Then
                                                varnew.outil.f = varnew.outil.Forigin
                                        End If
                                End If
                                If varnew.g.g(1) = 2 Then
                                        varnew.outil.f = varnew.outil.Forigin * y / (y + (varnew.outil.dia / 2))
                                        If CInt(Fix(varnew.outil.f)) = 0 Then
                                                varnew.outil.f = 1
                                        End If

                                End If
                        End If
                        If varnew.outil.corrd = 40 Then
                                varnew.outil.f = varnew.outil.Forigin
                        End If
                        If varnew.g.g(1) = 1 Then
                                If (ax = "") And (bx = "") And (cx = "") And (dx = "") And (ex = "") Then
                                Else
                                varnew.outil.f = varnew.outil.Forigin
                                End If
                        End If

                End If

                If varnew.outil.couple = 0 Then
                        varnew.outil.f = varnew.outil.Forigin
                End If


                If (varnew.g.g(5) = 93) And (varnew.g.g(1) = 1) Then

                        var1 = ((varnew.ptd.x - oldvar.ptd.x) * (varnew.ptd.x - oldvar.ptd.x)) + ((varnew.ptd.y - oldvar.ptd.y) * (varnew.ptd.y - oldvar.ptd.y)) + ((varnew.ptd.z - oldvar.ptd.z) * (varnew.ptd.z - oldvar.ptd.z))
                       
                        If var1 = 0 Then
                            varnew.outil.f = varnew.outil.Forigin
                            varnew.g.g(5) = 94
                            If varnew.g.g(5) <> oldvar.g.g(5) Then
                                parg5 = "G94"
                            Else
                                parg5 = ""
                            End If
                        Else
                            varnew.outil.f = varnew.outil.Forigin / Sqr(var1)
                        End If
                End If



                If CLng(varnew.outil.f) <> CLng(oldvar.outil.f) Then
                  sfed = "F" + Mid(Str(CLng(varnew.outil.f)), 2)
                  Else
                          sfed = ""
                  End If


                  If (varnew.g.g(5) = 93) And (varnew.g.g(1) = 1) And (Len(dx) + Len(ex) > 0) Then
                          sfed = "F" & chaine(varnew.outil.f)
                  End If





          If ((varnew.g.g(1) = 0) Or (varnew.g.g(1) = 80)) And (varnew.g434etat = 0) Then
                If Len(ax) + Len(bx) + Len(cx) + Len(dx) + Len(ex) = 0 Then
                          sortie.etat = -1

                  Else
                          sortie.chaine = ""

          If varnew.etat = 1 Then
                  sortie.chainearr = ""
          End If


          If sarr <> "" Then
          sortie.chaine = sortie.chaine + sarr + vbLf
          End If

          scx1 = chaine(varnew.ptf.cx)
          ncx1 = Val(scx1)

          scx2 = chaine(oldvar.ptf.cx)
          ncx2 = Val(scx2)

          sab = ax
          sab = sab + bx
          sab = sab + ssrot
          sde = dx
          sde = sde + ex


          If ncx2 > ncx1 Then
          sortie.chaine = sortie.chaine + sg682f
                  If Len(scldx1) > 1 And Len(sg682f) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + scldx1
                  If Len(sclex1) > 1 And (Len(scldx1) > 1 Or Len(sg682f) > 1) Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + sclex1
                  If Len(scldx1) > 1 Or Len(sclex1) > 1 Or Len(sg682f) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          If Len(sde) > 1 Then
          sortie.chaine = sortie.chaine + parg1 + parg2 + parg3
          End If
          sortie.chaine = sortie.chaine + sde
          sortie.chaine = sortie.chaine + sg682
                  If Len(scldx2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + scldx2
                  If Len(sclex2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + sclex2
          If Len(sde) > 1 And Len(sab) > 1 Then
          sortie.chaine = sortie.chaine & vbLf
          End If
          If Len(sde) = 0 Then
          sortie.chaine = sortie.chaine + parg1 + parg2 + parg3
          End If
          sortie.chaine = sortie.chaine + sab
          If (Len(sde) > 1 Or Len(sab) > 1) And Len(cx) > 1 Then
          sortie.chaine = sortie.chaine & vbLf
          End If
          sortie.chaine = sortie.chaine + scorrh
          sortie.chaine = sortie.chaine + cx
          sortie.chaine = sortie.chaine + sh
          End If


          If ncx1 > ncx2 Then
          sortie.chaine = sortie.chaine + parg1 + parg2 + parg3
          sortie.chaine = sortie.chaine + scorrh
          sortie.chaine = sortie.chaine + cx
          sortie.chaine = sortie.chaine + sh
          If Len(cx) > 1 And Len(sde) > 1 Then
          sortie.chaine = sortie.chaine & vbLf
          End If
          sortie.chaine = sortie.chaine + sg682f
                  If Len(scldx1) > 1 And Len(sg682f) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + scldx1
                  If Len(sclex1) > 1 And (Len(scldx1) > 1 Or Len(sg682f) > 1) Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + sclex1
                  If Len(scldx1) > 1 Or Len(sclex1) > 1 Or Len(sg682f) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
        sortie.chaine = sortie.chaine + sde
          sortie.chaine = sortie.chaine + sg682
                  If Len(scldx2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + scldx2
                  If Len(sclex2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + sclex2
          If (Len(cx) > 1 And Len(sde) > 1 And Len(sab) > 1) Or (Len(cx) > 1 And Len(sab) > 1) Then
          sortie.chaine = sortie.chaine & vbLf
          End If
          sortie.chaine = sortie.chaine + sab
          End If



          If ncx1 = ncx2 Then
          sortie.chaine = sortie.chaine + sg682f
                  If Len(scldx1) > 1 And Len(sg682f) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + scldx1
                  If Len(sclex1) > 1 And (Len(scldx1) > 1 Or Len(sg682f) > 1) Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + sclex1
                  If Len(scldx1) > 1 Or Len(sclex1) > 1 Or Len(sg682f) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + parg1 + parg2 + parg3
          sortie.chaine = sortie.chaine + sde
          sortie.chaine = sortie.chaine + sg682
                  If Len(scldx2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + scldx2
                  If Len(sclex2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + sclex2
          If Len(sab) > 1 And Len(sde) > 1 Then
          sortie.chaine = sortie.chaine & vbLf
          End If
          sortie.chaine = sortie.chaine + sab
          End If

            End If
                 
                If (sortie.etat <> 2) And (sortie.etat <> 3) Then
                  sortie.etat = 0
                End If
          End If



                If (varnew.g.g(1) = 0) And (varnew.g434etat = 1) Then

                          If (Len(ax) + Len(bx) + Len(cx) + Len(dx) + Len(ex)) = 0 Then
                                  sortie.etat = -1

                          Else
                                  sortie.chaine = ""
                  If Len(ssrot) > 1 Then
                  sortie.chaine = sortie.chaine + ssrot
                  sortie.chaine = sortie.chaine & vbLf
                  End If
                  sortie.chaine = sortie.chaine + scldx1
                  If Len(sclex1) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
                  sortie.chaine = sortie.chaine + sclex1
                  If Len(scldx1) > 1 Or Len(sclex1) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
                  sortie.chaine = sortie.chaine + parg1 + parg3 + parg4
                  sortie.chaine = sortie.chaine + ax
                  sortie.chaine = sortie.chaine + bx
                  sortie.chaine = sortie.chaine + cx
                  sortie.chaine = sortie.chaine + dx
                  sortie.chaine = sortie.chaine + ex
                  sortie.chaine = sortie.chaine + sh
                  sortie.chaine = sortie.chaine + sd
                  If Len(scldx2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
                  sortie.chaine = sortie.chaine + scldx2
                  If Len(sclex2) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
                  sortie.chaine = sortie.chaine + sclex2

                  If varnew.etat = 1 Then
                          sortie.chainearr = ""
                  End If

                          sortie.etat = 0
                          End If
                End If



                        If (varnew.g.g(1) = 1) And (varnew.g434etat = 1) Then

                                  If (Len(ax) + Len(bx) + Len(cx) + Len(dx) + Len(ex)) = 0 Then
                                          sortie.etat = -1

                                  Else
                                          sortie.chaine = ""
                          If Len(ssrot) > 0 Then
                          sortie.chaine = sortie.chaine + ssrot
                          sortie.chaine = sortie.chaine & vbLf
                          End If
                         
                          sortie.chaine = sortie.chaine + scldx1
                          If Len(sclex1) > 0 Then
                          sortie.chaine = sortie.chaine & vbLf
                          End If
                          sortie.chaine = sortie.chaine + sclex1
                    If Len(scldx1) > 1 Or Len(sclex1) > 1 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
                        sortie.chaine = sortie.chaine + parg1 + parg3 + parg4
                          sortie.chaine = sortie.chaine + ax
                          sortie.chaine = sortie.chaine + bx
                          sortie.chaine = sortie.chaine + cx
                          sortie.chaine = sortie.chaine + dx
                          sortie.chaine = sortie.chaine + ex
                          sortie.chaine = sortie.chaine + sh
                          sortie.chaine = sortie.chaine + sd
                          sortie.chaine = sortie.chaine + sfed
                          If Len(scldx2) > 0 Then
                          sortie.chaine = sortie.chaine & vbLf
                          End If
                          sortie.chaine = sortie.chaine + scldx2
                          If Len(sclex2) > 0 Then
                          sortie.chaine = sortie.chaine & vbLf
                          End If
                          sortie.chaine = sortie.chaine + sclex2

                          If varnew.etat = 1 Then
                                  sortie.chainearr = ""
                          End If

                                  sortie.etat = 0
                                  End If
                        End If





        If (varnew.g.g(1) = 1) And (varnew.g434etat = 0) Then

                  If (Len(ax) + Len(bx) + Len(cx) + Len(dx) + Len(ex)) = 0 Then
                          sortie.etat = -1

                  Else
       
          If Len(sortie.chaine) > 0 Then
              sortie.chaine = sortie.chaine + vbLf
          End If
       
          If Len(ssrot) > 0 Then
              sortie.chaine = sortie.chaine + ssrot
              sortie.chaine = sortie.chaine & vbLf
          End If
          sortie.chaine = sortie.chaine + scldx1
                          If Len(scldx1) > 0 Then
                          sortie.chaine = sortie.chaine & vbLf
                          End If
          sortie.chaine = sortie.chaine + sclex1
                  If Len(scldx1) > 0 Or Len(sclex1) > 0 Then
                  sortie.chaine = sortie.chaine & vbLf
                  End If
          sortie.chaine = sortie.chaine + parg1 + parg2 + parg3 + parg5
          sortie.chaine = sortie.chaine + scorrd
          sortie.chaine = sortie.chaine + ax
          sortie.chaine = sortie.chaine + bx
          sortie.chaine = sortie.chaine + cx
          sortie.chaine = sortie.chaine + dx
          sortie.chaine = sortie.chaine + ex
          sortie.chaine = sortie.chaine + sd
          sortie.chaine = sortie.chaine + sfed
                          If Len(scldx2) > 0 Then
                          sortie.chaine = sortie.chaine & vbLf
                          End If
          sortie.chaine = sortie.chaine + scldx2
                          If Len(sclex2) > 0 Then
                          sortie.chaine = sortie.chaine & vbLf
                          End If
          sortie.chaine = sortie.chaine + sclex2

          If varnew.etat = 1 Then
                  sortie.chainearr = ""
          End If

                  sortie.etat = 0
                  End If
        End If



        If (varnew.g.g(1) = 2) Or (varnew.g.g(1) = 3) Then


          If varnew.etat = 0 Then
         
          If Len(sortie.chainearr) > 0 Then
          sortie.chainearr = sortie.chainearr + vbLf
          End If
          If Len(ssrot) > 0 Then
          sortie.chainearr = sortie.chainearr + ssrot
          sortie.chainearr = sortie.chainearr & vbLf
          End If
          sortie.chainearr = sortie.chainearr + parg1 + parg3 + parg4 + parg5
          sortie.chainearr = sortie.chainearr + ax
          sortie.chainearr = sortie.chainearr + bx
          sortie.chainearr = sortie.chainearr + cx
          sortie.chainearr = sortie.chainearr + ix
          sortie.chainearr = sortie.chainearr + jx
          sortie.chainearr = sortie.chainearr + sfed

          End If



          If (varnew.etat = 1) Or (varnew.etat = 10) Then
                 
          sortie.chaine = ""
          If Len(ssrot) > 2 Then
          sortie.chaine = sortie.chaine + ssrot
          sortie.chaine = sortie.chaine & vbLf
          End If
          sortie.chaine = sortie.chaine + parg1 + parg3 + parg4 + parg5
          sortie.chaine = sortie.chaine + ax
          sortie.chaine = sortie.chaine + bx
          sortie.chaine = sortie.chaine + cx
          sortie.chaine = sortie.chaine + ix
          sortie.chaine = sortie.chaine + jx
          sortie.chaine = sortie.chaine + sfed
          End If




          If varnew.etat = 2 Then

        yx = ""
        If InStr(sortie.chainearr, "X") > 1 Then
            yx = Mid(sortie.chainearr, 1, InStr(sortie.chainearr, "X") - 1)
        End If


          zx = ""
          If InStr(sortie.chainearr, "I") > 0 Then
            zx = Mid(sortie.chainearr, InStr(sortie.chainearr, "I"))
          End If

          sortie.chainearr = yx
          sortie.chainearr = sortie.chainearr + ax
          sortie.chainearr = sortie.chainearr + bx
          sortie.chainearr = sortie.chainearr + cx
          sortie.chainearr = sortie.chainearr + zx

          End If




          If varnew.etat = 3 Then

                  yx = ""
                  If InStr(sortie.chainearr, "X") > 1 Then
                    yx = yx + Mid(sortie.chainearr, 1, InStr(sortie.chainearr, "X") - 1)
                  Else
                    yx = yx + parg1 + parg3 + parg4 + parg5
                  End If
               
                zx = ""
                If InStr(sortie.chainearr, "I") > 0 Then
                    zx = Mid(sortie.chainearr, InStr(sortie.chainearr, "I"))
                Else
                    zx = ix + jx + sfed
                End If
         
          sortie.chainearr = yx
          sortie.chainearr = sortie.chainearr + ax
          sortie.chainearr = sortie.chainearr + bx
          sortie.chainearr = sortie.chainearr + cx
          sortie.chainearr = sortie.chainearr + zx
          sortie.chaine = ""

          sortie.etat = 0
        End If
        End If
       





          If (varnew.g.g(1) = 73) Or (varnew.g.g(1) = 74) Or (varnew.g.g(1) = 76) Or (varnew.g.g(1) = 81) Or (varnew.g.g(1) = 82) Or (varnew.g.g(1) = 83) Or (varnew.g.g(1) = 84) Or (varnew.g.g(1) = 85) Or (varnew.g.g(1) = 86) Or (varnew.g.g(1) = 87) Or (varnew.g.g(1) = 88) Or (varnew.g.g(1) = 89) Then
         
          varnew.cycle.Zaf = Val(chaine(varnew.ptf.cx + varnew.cycle.Za))
         
          If varnew.cycle.Zaf <> oldvar.cycle.Zaf Then
            var1 = varnew.g.g(1)
            varptf = varnew.ptf
            varnew.g.g(1) = 0
            varnew.ptf.cx = varnew.cycle.Zaf
            Call format_sortie(oldvar, varnew, sortie)
            oldvar.ptf = varnew.ptf
            varnew.g.g(1) = var1
            varnew.ptf = varptf
            oldvar.cycle.Gs = 1E+100
'            oldvar.ptf.cx = 1E+100
            oldvar.cycle.Zaf = varnew.cycle.Zaf
            Call format_sortie(oldvar, varnew, sortie)
          Else
         
          yx = chaine(varnew.ptf.cx + varnew.cycle.Zp)
          zx = chaine(oldvar.ptf.cx + oldvar.cycle.Zp)
          y = Val(yx)
          z = Val(zx)


          If y <> z Or Len(parg1) > 0 Then
          sZp = "Z"
          sZp = sZp + yx
          Else
                  sZp = ""
          End If

          yx = chaine(varnew.ptf.cx + varnew.cycle.Zr)
          zx = chaine(oldvar.ptf.cx + oldvar.cycle.Zr)
          y = Val(yx)
          z = Val(zx)

          If y <> z Or Len(parg1) > 0 Then
          sZr = "R"
          sZr = sZr + yx
          Else
                  sZr = ""
          End If


          sQ = ""

        If (varnew.g.g(1) = 73) Or (varnew.g.g(1) = 76) Or (varnew.g.g(1) = 83) Then

                  yx = chaine(varnew.cycle.Q)
                  zx = chaine(oldvar.cycle.Q)
                  y = Val(yx)
                  z = Val(zx)

                  If y <> z Or Len(parg1) > 0 Then
                  sQ = "Q"
                  sQ = sQ + yx
                  End If
        End If
          sP = ""

        If (varnew.g.g(1) = 82) Or (varnew.g.g(1) = 89) Or (varnew.g.g(1) = 88) Then

                  yx = chaine(varnew.cycle.P)
                  zx = chaine(oldvar.cycle.P)
                  y = Val(yx)
                  z = Val(zx)

                  If y <> z Or Len(parg1) > 0 Then
                  sQ = "P"
                  sQ = sQ + yx
                  End If
        End If




        If varnew.cycle.Gs <> oldvar.cycle.Gs Then
          sGs = "G"
          sGs = sGs + Mid(Str(varnew.cycle.Gs), 2)
        Else
                sGs = ""
        End If
       
            If Len(sortie.chaine) > 0 Then
            sortie.chaine = sortie.chaine + vbLf
            End If
           

          sortie.chaine = sortie.chaine + parg1
          sortie.chaine = sortie.chaine + sGs
          sortie.chaine = sortie.chaine + ax
          sortie.chaine = sortie.chaine + bx
          sortie.chaine = sortie.chaine + sZp
          sortie.chaine = sortie.chaine + sQ
          sortie.chaine = sortie.chaine + sP
          sortie.chaine = sortie.chaine + sZr
          sortie.chaine = sortie.chaine + sfed
          If varnew.etat = 1 Then
                  sortie.chainearr = ""
          End If

          End If

        End If

        If (InStr(sortie.chaine, parg1) > 0) And (Len(sortie.chaine) = (Len(parg1) + 1)) Then
                        sortie.chaine = ""
        End If

       
End Sub






bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 19:12

la suite partiev 3:

Code:





Function extract_indirv(ByVal buffer As String, varnew As varclass, oldvar As varclass) As pointfinal
               
               
        Dim Pindirv As pointdebut
        Dim ptf99 As pointfinal
        Dim ptindirv As pointfinal
        Dim chaine1 As String
        Dim chaine2 As String
        Dim chaineI As String
        Dim chaineJ As String
        Dim chaineK As String


          chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
          chaineI = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
          Pindirv.x = Val(chaineI) + varnew.ptd.x

          chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
          chaineJ = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
          Pindirv.y = Val(chaineJ) + varnew.ptd.y

          chaineK = Mid(chaine1, InStr(chaine1, ",") + 1)
          Pindirv.z = Val(chaineK) + varnew.ptd.z

          Pindirv.i = varnew.ptd.i
          Pindirv.J = varnew.ptd.J
          Pindirv.K = varnew.ptd.K


          ptf99 = CalculPointFinal(Pindirv, varnew, oldvar)

          ptindirv.ax = ptf99.ax
          ptindirv.bx = ptf99.bx
          ptindirv.cx = ptf99.cx
          ptindirv.dx = ptf99.dx
          ptindirv.ex = ptf99.ex

        extract_indirv = ptindirv
       
       
End Function







Private Sub words_circle_cylndr(buffer As String, oldvar As varclass, varnew As varclass, sortie As sortieclass)


                Dim retour As varclass
                Dim ptdepart As pointfinal
                Dim ptindirv As pointfinal
                Dim ptd As pointdebut
                Dim ptcercle As pointfinal
                Dim ptf As pointfinal
                Dim ptc As pointfinalcercle
                Dim chaine1 As String
                Dim chaine2 As String
                Dim chaineX As String
                Dim chaineY As String
                Dim chaineZ As String
                Dim saxc As String
                Dim saxd As String
                Dim sbxc As String
                Dim sbxd As String
                Dim A As Double
                Dim API As Double
                Dim APC As Double
                Dim AA As Double
                Dim AB As Double
                Dim ac As Double

                  ptdepart.ax = oldvar.ptf.ax
                  ptdepart.bx = oldvar.ptf.bx
                  ptdepart.cx = oldvar.ptf.cx
                  ptdepart.dx = oldvar.ptf.dx
                  ptdepart.ex = oldvar.ptf.ex
                  ptindirv.ax = varnew.ptfa.ax
                  ptindirv.bx = varnew.ptfa.bx
                  ptindirv.cx = varnew.ptfa.cx
                  ptindirv.dx = varnew.ptfa.dx
                  ptindirv.ex = varnew.ptfa.ex
                  ptd.x = varnew.ptd.x
                  ptd.y = varnew.ptd.y
                  ptd.z = varnew.ptd.z
                  ptd.i = varnew.ptd.i
                  ptd.J = varnew.ptd.J
                  ptd.K = varnew.ptd.K

                  retour = varnew


                If InStr(buffer, "CIRCLE") > 0 Then
               
                  chaine1 = Mid(buffer, InStr(buffer, "CIRCLE/") + 7)
                  chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.x = Val(chaineX)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.y = Val(chaineY)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineZ = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.z = Val(chaineZ)

                        ptf = CalculPointFinal(ptd, varnew, oldvar)

                        ptcercle.ax = ptf.ax
                        ptcercle.bx = ptf.bx
                        ptcercle.cx = ptf.cx
                        ptcercle.dx = ptf.dx
                        ptcercle.ex = ptf.ex


                    chaine1 = Mid(chaine1, InStr(chaine1, "LINE/") + 5)
                   
                    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

                  chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.x = Val(chaineX)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.y = Val(chaineY)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineZ = Mid(chaine1, 1, InStr(chaine1, ")") - 1)
                  ptd.z = Val(chaineZ)

                        ptf = CalculPointFinal(ptd, varnew, oldvar)

                Else
               
                  chaine1 = Mid(buffer, InStr(buffer, "CYLNDR/") + 7)
                  chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.x = Val(chaineX)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.y = Val(chaineY)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineZ = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.z = Val(chaineZ)

                        ptf = CalculPointFinal(ptd, varnew, oldvar)

                        ptcercle.ax = ptf.ax
                        ptcercle.bx = ptf.bx
                        ptcercle.cx = ptf.cx
                        ptcercle.dx = ptf.dx
                        ptcercle.ex = ptf.ex


                          chaine1 = Mid(chaine1, InStr(chaine1, "VECTOR/") + 7)
                          chaine1 = Mid(chaine1, InStr(chaine1, "POINT/") + 6)
                          chaine1 = Mid(chaine1, InStr(chaine1, "POINT/") + 6)

                  chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.x = Val(chaineX)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
                  ptd.y = Val(chaineY)

                  chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
                  chaineZ = Mid(chaine1, 1, InStr(chaine1, ")") - 1)
                  ptd.z = Val(chaineZ)

                        ptf = CalculPointFinal(ptd, varnew, oldvar)

            End If

                        API = angle((ptindirv.ax - ptdepart.ax), (ptindirv.bx - ptdepart.bx))
                        APC = angle((ptcercle.ax - ptdepart.ax), (ptcercle.bx - ptdepart.bx))

                        A = APC - API
                        If A > 180 Then
                                A = A - 360
                        End If
                        If A < -180 Then
                                A = A + 360
                        End If
                        If A > 0 Then
                                  ptc.g = 3
                        Else
                                  ptc.g = 2
                        End If



                                AA = angle((ptcercle.ax - ptdepart.ax), (ptcercle.bx - ptdepart.bx))
                                AB = angle((ptcercle.ax - ptf.ax), (ptcercle.bx - ptf.bx))
                                If (ptc.g = 3) And (AB < AA) Then
                                          AB = 360 + AB
                                End If
                                If (ptc.g = 2) And (AB > AA) Then
                                          AB = AB - 360
                                End If
                                ac = AB - AA
                                If ac < 0 Then
                                        ac = 0 - ac
                                End If
                               
                                If Val(chaine(ptf.ax)) = Val(chaine(oldvar.ptf.ax)) And Val(chaine(ptf.bx)) = Val(chaine(oldvar.ptf.bx)) Then
                                    ac = 360
                                End If
                               


'                                ac = Val(chaine(ac))


                  ptc.ac = ptcercle.ax
                  ptc.bc = ptcercle.bx

                  ptc.ax = ptf.ax
                  ptc.bx = ptf.bx
                  ptc.cx = ptf.cx
                  saxc = chaine(ptcercle.ax)
                  saxd = chaine(ptdepart.ax)
                  sbxc = chaine(ptcercle.bx)
                  sbxd = chaine(ptdepart.bx)
                  ptc.ix = ptcercle.ax - ptdepart.ax
                  ptc.jx = ptcercle.bx - ptdepart.bx

                  If ptc.g = oldvar.g.g(1) Then
                        If Val(chaine(ptcercle.ax)) = Val(chaine(oldvar.ptc.ac)) And Val(chaine(ptcercle.bx)) = Val(chaine(oldvar.ptc.bc)) And (varnew.outil.Forigin = oldvar.outil.Forigin) Then
                                ptc.at = oldvar.ptc.at + ac

                                If ptc.at = ac Then
                                          retour.etat = 0
                                End If
                                If (ptc.at < 360) And (ptc.at > ac) Then
                                          retour.etat = 2
                                End If
                                If ptc.at = 360 Then
                                          retour.etat = 3
                                          ptc.at = 0
                                End If
                                If ptc.at > 360 Then
                                          retour.etat = 1
                                          ptc.at = 0
                                End If
                          Else
                                        If varnew.ptc.at = 0 Then
                                          retour.etat = 0
                                          ptc.at = ac
                                  Else
                                          retour.etat = 10
                                          ptc.at = ac
                                  End If
                          End If
                        Else
                                If varnew.ptc.at = 0 Then
                                          retour.etat = 0
                                          ptc.at = ac
                                  Else
                                          retour.etat = 10
                                          ptc.at = ac
                                  End If
                        End If

                  retour.ptc.ax = ptc.ax
                  retour.ptc.bx = ptc.bx
                  retour.ptc.cx = ptc.cx
                  retour.ptc.ix = ptc.ix
                  retour.ptc.jx = ptc.jx
                  retour.ptc.ac = ptc.ac
                  retour.ptc.bc = ptc.bc
                  retour.ptc.at = ptc.at
                  retour.ptc.g = ptc.g
                  retour.ptd.x = ptd.x
                  retour.ptd.y = ptd.y
                  retour.ptd.z = ptd.z
                  retour.ptd.i = ptd.i
                  retour.ptd.J = ptd.J
                  retour.ptd.K = ptd.K
                  retour.ptf.ax = retour.ptc.ax
                  retour.ptf.bx = retour.ptc.bx
                  retour.ptf.cx = retour.ptc.cx
                  If retour.plunge <> 0 Then
                          If oldvar.plunge = 0 Then
                                        retour.Zplunge = retour.ptf.cx
                          End If
                          retour.Zplunge = retour.Zplunge + ((ac / 360) * retour.plunge)
                          retour.ptf.cx = retour.Zplunge
                  End If
                  retour.g.g(1) = ptc.g

                    varnew = retour
                   
                   
                  oldvar.ptf.ax = 1E+100
                  oldvar.ptf.bx = 1E+100
                  oldvar.ptc.ix = 1E+100
                  oldvar.ptc.jx = 1E+100


                Call format_sortie(oldvar, newvar, sortie)
               
       

                oldvar.ptd = newvar.ptd
                oldvar.ptf = newvar.ptf
                oldvar.ptc = newvar.ptc
                oldvar.g.g(1) = newvar.g.g(1)
                oldvar.g.g(3) = newvar.g.g(3)
                oldvar.g.g(4) = newvar.g.g(4)
                oldvar.g.g(5) = newvar.g.g(5)
                oldvar.m.m(1) = newvar.m.m(1)
                oldvar.outil = newvar.outil
                oldvar.cycle = newvar.cycle

                oldvar.sortie = newvar.sortie
                oldvar.cldx = newvar.cldx
                oldvar.clex = newvar.clex
                oldvar.plunge = newvar.plunge
                oldvar.Zplunge = newvar.Zplunge
                oldvar.etat = newvar.etat

 End Sub







Private Sub word_helical(buffer As String, oldvar As varclass, varnew As varclass, sortie As sortieclass)

        Dim retour As varclass
        Dim ptdepart As pointfinal
        Dim ptindirv As pointfinal
        Dim ptd As pointdebut
        Dim ptcercle As pointfinal
        Dim ptf As pointfinal
        Dim ptc As pointfinalcercle
        Dim chaine1 As String
        Dim chaine2 As String
        Dim chaineX As String
        Dim chaineY As String
        Dim chaineZ As String
        Dim saxc As String
        Dim saxd As String
        Dim sbxc As String
        Dim sbxd As String
        Dim A As Double
        Dim API As Double
        Dim APC As Double
        Dim AA As Double
        Dim AB As Double
        Dim ac As Double

          ptdepart = oldvar.ptf
          ptindirv = varnew.ptfa
          ptd = varnew.ptd
          retour = varnew

          chaine2 = Mid(buffer, InStr(buffer, "HELICAL/") + 9)
          chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.x = Val(chaineX)

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.y = Val(chaineY)
     
          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineZ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.z = Val(chaineZ)
 
                ptf = CalculPointFinal(ptd, varnew, oldvar)
               
                ptcercle = ptf


          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.x = Val(chaineX) + varnew.ptd.x

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.y = Val(chaineY) + varnew.ptd.y

          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaineZ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          ptd.z = Val(chaineZ) + varnew.ptd.z

 
                ptf = CalculPointFinal(ptd, varnew, oldvar)

                ptindirv = ptf

                API = angle((ptindirv.ax - ptdepart.ax), (ptindirv.bx - ptdepart.bx))
                APC = angle((ptcercle.ax - ptdepart.ax), (ptcercle.bx - ptdepart.bx))

                A = APC - API
                If A > 180 Then
                        A = A - 360
                End If
                If A < -180 Then
                        A = A + 360
                End If
                If A > 0 Then
                          ptc.g = 3
                Else
                          ptc.g = 2
                End If



                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                 
                  ac = Val(Mid(chaine2, 1, InStr(chaine2, ",") - 1))
                 
                   

                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)

                 
                  chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
                  ptd.x = Val(chaineX)

                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
                  ptd.y = Val(chaineY)

                  chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                  chaineZ = chaine2
                  ptd.z = Val(chaineZ)
                 
                        ptf = CalculPointFinal(ptd, varnew, oldvar)





          saxc = chaine(ptcercle.ax)
          saxd = chaine(ptdepart.ax)
          sbxc = chaine(ptcercle.bx)
          sbxd = chaine(ptdepart.bx)
          ptc.ix = ptcercle.ax - ptdepart.ax
          ptc.jx = ptcercle.bx - ptdepart.bx

                ptc.pas = (ptf.cx - oldvar.ptf.cx) / ac * 360
                ptc.pas = Val(chaine(ptc.pas))
               
                ac = Val(chaine(ac))

                If ac < 0 Then
                        ac = 0 - ac
                End If
                ac = Val(chaine(ac))
                If ac = 0 Then
                        ac = 360
                End If




                If ac > 360 Then
                        ptc.at = ac

                Else



  ptc.ac = ptcercle.ax
  ptc.bc = ptcercle.bx

  ptc.ax = ptf.ax
  ptc.bx = ptf.bx
  ptc.cx = ptf.cx
  saxc = chaine(ptcercle.ax)
  saxd = chaine(ptdepart.ax)
  sbxc = chaine(ptcercle.bx)
  sbxd = chaine(ptdepart.bx)
  ptc.ix = ptcercle.ax - ptdepart.ax
  ptc.jx = ptcercle.bx - ptdepart.bx


 If ptc.g = oldvar.g.g(1) Then
        If (Val(chaine(ptcercle.ax)) = Val(chaine(oldvar.ptc.ac))) And (Val(chaine(ptcercle.bx)) = Val(chaine(oldvar.ptc.bc))) And (ptc.pas = oldvar.ptc.pas) And (varnew.outil.Forigin = oldvar.outil.Forigin) Then
                ptc.at = oldvar.ptc.at + ac

                If ptc.at = ac Then
                          retour.etat = 0
                End If
                If (ptc.at < 360) And (ptc.at > ac) Then
                          retour.etat = 2
                End If
                If ptc.at = 360 Then
                          retour.etat = 3
                          ptc.at = 0
                End If
                If ptc.at > 360 Then
                          retour.etat = 1
                          ptc.at = 0
                End If

          Else
                        If varnew.ptc.at = 0 Then
                          retour.etat = 0
                          ptc.at = ac
                  Else
                          retour.etat = 10
                          ptc.at = ac
                  End If
          End If


 Else
                If varnew.ptc.at = 0 Then
                  retour.etat = 0
                  ptc.at = ac
          Else
                  retour.etat = 10
                  ptc.at = ac
          End If


 End If



                End If




          retour.ptc.ac = ptcercle.ax
          retour.ptc.bc = ptcercle.bx
          retour.ptc.cx = ptcercle.cx
          retour.ptc.ix = ptc.ix
          retour.ptc.jx = ptc.jx
          retour.ptc.at = ptc.at
          retour.ptc.pas = ptc.pas
          retour.ptc.g = ptc.g
          retour.ptd = ptd
          retour.ptf = ptf
          retour.g.g(1) = ptc.g


        varnew = retour
       
                ptf.ax = newvar.ptf.ax
                ptf.bx = newvar.ptf.bx
                ptf.cx = newvar.ptf.cx

                at = newvar.ptc.at

                Do While at > 360
                        at = at - 360
                        newvar.ptf.ax = oldvar.ptf.ax
                        newvar.ptf.bx = oldvar.ptf.bx
                        az = ptf.cx - oldvar.ptf.cx
                        newvar.ptf.cx = ptf.cx - ((az / newvar.ptc.at) * at)

                  oldvar.ptf.ax = 1E+100
                  oldvar.ptf.bx = 1E+100
                  oldvar.ptc.ix = 1E+100
                  oldvar.ptc.jx = 1E+100

                Call format_sortie(oldvar, newvar, sortie)
               
                  oldvar.ptf.ax = newvar.ptf.ax
                  oldvar.ptf.bx = newvar.ptf.bx
                  oldvar.ptc.ix = newvar.ptc.ix
                  oldvar.ptc.jx = newvar.ptc.jx
                  oldvar.outil.f = newvar.outil.f
                Loop

           
                newvar.ptf.ax = ptf.ax
                newvar.ptf.bx = ptf.bx
                newvar.ptf.cx = ptf.cx

                oldvar.ptf.ax = 1E+100
                oldvar.ptf.bx = 1E+100
                oldvar.ptc.ix = 1E+100
                oldvar.ptc.jx = 1E+100

                Call format_sortie(oldvar, newvar, sortie)
               

                oldvar.ptd = newvar.ptd
                oldvar.ptf = newvar.ptf
                oldvar.ptc = newvar.ptc
                oldvar.g.g(1) = newvar.g.g(1)
                oldvar.g.g(3) = newvar.g.g(3)
                oldvar.g.g(4) = newvar.g.g(4)
                oldvar.g.g(5) = newvar.g.g(5)
                oldvar.m.m(1) = newvar.m.m(1)
                oldvar.outil = newvar.outil
                oldvar.cycle = newvar.cycle
                oldvar.sortie = newvar.sortie
                oldvar.cldx = newvar.cldx
                oldvar.clex = newvar.clex
                oldvar.plunge = newvar.plunge
                oldvar.Zplunge = newvar.Zplunge
                oldvar.etat = newvar.etat

       
        End Sub





Private Sub word_spindl(ByVal buffer As String, oldvar As varclass, newvar As varclass, sortie As sortieclass)
          Dim chaine1 As String
          Dim chaine2 As String
                 
          oldvar.outil.s = newvar.outil.s
          oldvar.outil.rot = newvar.outil.rot

          chaine1 = Mid(buffer, InStr(buffer, "/") + 1)


          If InStr(buffer, "OFF") = 0 And InStr(buffer, "LOCK") = 0 And InStr(buffer, "ON") = 0 And InStr(buffer, "OUT") = 0 Then
          If InStr(chaine1, ",") > 0 Then
          chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
          Else
                  chaine2 = chaine1
          End If
          newvar.outil.s = Val(chaine2)

          If InStr(buffer, "SFM") > 0 Then
                  newvar.outil.s = 1000 * newvar.outil.s / (3.14159265 * newvar.outil.dia)
          End If
          If InStr(buffer, "CCLW") > 0 Then
          newvar.outil.rot = 4
          End If
          If InStr(buffer, ",CLW") > 0 Then
          newvar.outil.rot = 3
          End If
          End If

           
                  newvar.etat = 0

                  If InStr(buffer, "OFF") > 0 Then
                          sortie.chaine = "M5"
                          newvar.etat = 1
                  End If

                  If InStr(buffer, "LOCK") > 0 Then
                          sortie.chaine = "M19"
                          newvar.etat = 1
                  End If

                  If InStr(buffer, "ON") > 0 Then
                          oldvar.outil.s = -1
                          oldvar.outil.rot = -1
                          newvar.etat = 0
                  End If
                  If InStr(buffer, "OUT") > 0 Then
                          sortie.chaine = "S" + Mid(Str(newvar.outil.s), 2) + "M" + Mid(Str(newvar.outil.rot), 2)
                          newvar.etat = 1

                  End If
 
          End Sub







Private Sub word_fedrat(buffer As String, varnew As varclass, oldvar As varclass, sortie As sortieclass)
          Dim chaine2 As String

          If InStr(buffer, "INVERS") > 0 Then
                  If InStr(buffer, "ON") > 0 Then
                          varnew.finvers = 1
                  Else
                        varnew.finvers = 0
                  End If
          Else
          chaine2 = Mid(buffer, InStr(buffer, "/") + 1, InStr(buffer, ","))
          varnew.outil.Forigin = Val(chaine2)
          varnew.outil.f = varnew.outil.Forigin
          If InStr(buffer, "MMPR") > 0 Then
                  varnew.outil.Forigin = varnew.outil.s * varnew.outil.Forigin
                  varnew.outil.f = varnew.outil.Forigin
          End If
          End If
               
          newvar.etat = 0
       
        End Sub



 
Private Sub extract_cutcom(ByVal buffer As String, varnew As varclass)
          Dim retour As varclass

          retour = varnew

          If InStr(buffer, "LEFT") > 0 Then
                  retour.outil.corrd = 41
          End If

          If InStr(buffer, "RIGHT") > 0 Then
                  retour.outil.corrd = 42
          End If

          If InStr(buffer, "OFF") > 0 Then
                  retour.outil.corrd = 40
          End If


        varnew = retour
        End Sub




Private Sub word_cycle(buffer As String, newvar As varclass)

        Dim retour As varclass
        Dim chaine2 As String
        Dim chaine3 As String
        Dim var1 As Double
       
        retour = newvar
       
       
       
            If InStr(buffer, "CYCLE/BRKCHP") > 0 Then
                retour.g.g(1) = 73
                End If

            If InStr(buffer, "CYCLE/INVERS") > 0 Then
                retour.g.g(1) = 74
                End If
           
            If InStr(buffer, "CYCLE/LOCK") > 0 Then
                retour.g.g(1) = 76
                End If
           
            If InStr(buffer, "CYCLE/DRILL") > 0 Then
                retour.g.g(1) = 81
                End If

            If InStr(buffer, "CYCLE/FACE") > 0 Then
                retour.g.g(1) = 82
                End If

            If InStr(buffer, "CYCLE/DEEP") > 0 Then
                retour.g.g(1) = 83
                End If
         
            If InStr(buffer, "CYCLE/TAP") > 0 Then
                retour.g.g(1) = 84
                End If
         
            If InStr(buffer, "CYCLE/BORE") > 0 Then
                retour.g.g(1) = 85
                End If
         
            If InStr(buffer, "CYCLE/REAM") > 0 Then
                retour.g.g(1) = 86
                End If
         
            If InStr(buffer, "CYCLE/STEP") > 0 Then
                retour.g.g(1) = 87
                End If
         
            If InStr(buffer, "CYCLE/MANUAL") > 0 Then
                retour.g.g(1) = 88
                End If
         
            If InStr(buffer, "CYCLE/THRU") > 0 Then
                retour.g.g(1) = 89
                End If
       
          chaine2 = Mid(buffer, InStr(buffer, ",") + 1)
          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          retour.cycle.Zp = Val(chaine3)
         
          If InStr(buffer, "CYCLE/BRKCHP") > 0 Or InStr(buffer, "CYCLE/LOCK") > 0 Or InStr(buffer, "CYCLE/DEEP") > 0 Then
          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          retour.cycle.Q = Val(chaine3)
          End If

          If InStr(chaine2, "MMPM") > 0 Then
          chaine2 = Mid(chaine2, InStr(chaine2, "MMPM") + 5)
          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          retour.outil.f = Val(chaine3)
          Else
                  chaine2 = Mid(chaine2, InStr(chaine2, "MMPR") + 5)
                  chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
                  retour.outil.f = Val(chaine3) * retour.outil.s
          End If
          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          If InStr(chaine2, ",") > 0 Then
          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          Else
                  chaine3 = chaine2
          End If
          retour.cycle.Zr = Val(chaine3)

          If InStr(buffer, "CYCLE/FACE") > 0 Or InStr(buffer, "CYCLE/MANUAL") > 0 Or InStr(buffer, "CYCLE/THRU") > 0 Then
          chaine2 = Mid(chaine2, InStr(chaine2, "DWELLV") + 7)
          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          var1 = Val(chaine3)
          If var1 = 0 Then
                retour.cycle.P = 0
          End If
          If var1 = 1 Then
              chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
              chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
              retour.cycle.P = (Val(chaine3) / retour.outil.s) * 60
          End If
          If var1 = 2 Then
              chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
              chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
              chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
              retour.cycle.P = Val(chaine3)
          End If
          End If

          If InStr(chaine2, "POSZ") > 0 Then
          chaine2 = Mid(chaine2, InStr(chaine2, "POSZ") + 5)
          If InStr(chaine2, ",") > 0 Then
          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
          Else
                  chaine3 = chaine2
          End If
          retour.cycle.Za = Val(chaine3)
          If retour.cycle.Za <= retour.cycle.Zr Then
                retour.cycle.Za = retour.cycle.Zr
                retour.cycle.Gs = 99
          Else
          retour.cycle.Gs = 98
          End If
          Else
                  retour.cycle.Za = retour.cycle.Zr
                  retour.cycle.Gs = 99
          End If
         
          retour.etat = 0

   
       

        newvar = retour
   

End Sub


 
Private Sub word_pivotz(buffer As String, newvar As varclass)
       
        Dim chaine1 As String
        Dim chaine2 As String
        Dim chaineX As String
        Dim chaineY As String
        Dim chaineZ As String


          chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

          chaine2 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
          If Val(chaine2) = 2 Then

          chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
          chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
          newvar.px = Val(chaineX)

          chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
          chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
          newvar.py = Val(chaineY)

          chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
          chaineZ = chaine1
          newvar.pz = Val(chaineZ)
          Else
                  newvar.px = 0
                  newvar.py = 0
                  newvar.pz = 0
          End If
         

            sortie.chaine = ""
            newvar.etat = 0

        End Sub



Private Sub word_origin(buffer As String, newvar As varclass, oldvar As varclass, sortie As sortieclass)
        Dim retour As varclass
        Dim chaine1 As String
        Dim chaine2 As String
        Dim chaine3 As String

        retour = newvar
        retour.xdec = 1E+100
        retour.ydec = 1E+100
        retour.zdec = 1E+100

          chaine2 = Mid(buffer, InStr(buffer, "/") + 1)

          If InStr(chaine2, "TYPE") > 0 Then
          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
          If InStr(chaine2, ",") > 0 Then
                  chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
                  Else
                          chaine3 = chaine2
                  End If
          retour.g.g(2) = 53 + Val(chaine3)
          Else
                  If InStr(chaine2, ",") > 0 Then
                          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
                          Else
                                  chaine3 = chaine2
                          End If
                          retour.xdec = Val(chaine3)

                  If InStr(chaine2, ",") > 0 Then
                          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                          If InStr(chaine2, ",") > 0 Then
                          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
                          Else
                                  chaine3 = chaine2
                          End If
                          retour.ydec = Val(chaine3)
                  End If
                  If InStr(chaine2, ",") > 0 Then
                          chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                          If InStr(chaine2, ",") > 0 Then
                          chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
                          Else
                                  chaine3 = chaine2
                          End If
                          retour.zdec = Val(chaine3)
                  End If

          End If


        newvar = retour
       

                newvar.etat = 0
                If (newvar.xdec <> 1E+100) And (newvar.ydec <> 1E+100) And (newvar.zdec <> 1E+100) Then
                        sortie.chaine = "G52X" + chaine(newvar.xdec) + "Y" + chaine(newvar.ydec) + "Z" + chaine(newvar.zdec)
                        newvar.etat = 1
                End If

                If (InStr(buffer, "OUT") > 0) And (newvar.g.g(2) <> 1E+100) Then
                        sortie.chaine = "G" + Mid(Str(newvar.g.g(2)), 2)
                        oldvar.g.g(2) = newvar.g.g(2)
                        newvar.etat = 1
                End If

        End Sub


Private Sub word_moveto(buffer As String, newvar As varclass, oldvar As varclass, sortie As sortieclass)


        Dim chaine1 As String
       

                        chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

                        If InStr(chaine1, "START") > 0 Then
                                                If InStr(chaine1, "OFF") > 0 Then
                                                        newvar.defaultex = 1E+100
                                                Else

                                                        If InStr(chaine1, "CAXIS") > 0 Then
                                                                If newvar.rotex <> 1E+100 Then

                                                                newvar.defaultex = newvar.rotex
                                                                Else
                                                                        newvar.defaultex = 0
                                                                End If
                                                        End If
                                                End If
                                                newvar.etat = 0


                        End If


                        If InStr(buffer, "OUT") > 0 Then
                                If InStr(buffer, "AAXIS") > 0 Then

                                oldvar.ptf.dx = 1E+100

                                If newvar.rotdx <> 1E+100 Then

                                newvar.ptf.dx = newvar.rotdx
                                End If
                                End If

                                If InStr(buffer, "CAXIS") > 0 Then

                                oldvar.ptf.ex = 1E+100

                                If newvar.rotex <> 1E+100 Then

                                newvar.ptf.ex = newvar.rotex
                                End If
                                End If

                                If InStr(chaine1, "XAXIS") > 0 Then

                                oldvar.ptf.ax = 1E+100

                                End If

                                If InStr(chaine1, "YAXIS") > 0 Then

                                oldvar.ptf.bx = 1E+100

                                End If

                                If InStr(chaine1, "ZAXIS") > 0 Then

                                oldvar.ptf.cx = 1E+100

                                End If


                          If (newvar.g.g(1) <> 0) And (newvar.g.g(1) <> 73) And (newvar.g.g(1) <> 74) And (newvar.g.g(1) <> 76) And (newvar.g.g(1) <> 81) And (newvar.g.g(1) <> 82) And (newvar.g.g(1) <> 83) And (newvar.g.g(1) <> 84) And (newvar.g.g(1) <> 85) And (newvar.g.g(1) <> 86) And (newvar.g.g(1) <> 87) And (newvar.g.g(1) <> 88) And (newvar.g.g(1) <> 80) Then
                                        newvar.g.g(1) = 1
                          End If
                          oldvar.g.g(1) = 1E+100

                        Call format_sortie(oldvar, newvar, sortie)
                       
                        oldvar.ptf = newvar.ptf
                        oldvar.outil.tc = newvar.outil.tc
                        oldvar.outil.arr = newvar.outil.arr
                        oldvar.g.g(1) = newvar.g.g(1)
                        oldvar.g.g(2) = newvar.g.g(2)
                        oldvar.g.g(3) = newvar.g.g(3)
                        oldvar.g.g(4) = newvar.g.g(4)
                        newvar.etat = 1
                        End If


                        If (InStr(buffer, "START") = 0) And (InStr(buffer, "OUT") = 0) Then
                                If InStr(chaine1, "XAXIS") > 0 Then

                                oldvar.ptf.ax = 1E+100

                                End If
                                If InStr(chaine1, "YAXIS") > 0 Then

                                oldvar.ptf.bx = 1E+100

                                End If
                                If InStr(chaine1, "ZAXIS") > 0 Then

                                oldvar.ptf.cx = 1E+100

                                End If

                                If InStr(chaine1, "AAXIS") > 0 Then

                                oldvar.ptf.dx = 1E+100

                                End If
                                If InStr(chaine1, "CAXIS") > 0 Then

                                oldvar.ptf.ex = 2E+120

                                End If
                                oldvar.g.g(1) = 1E+100
                                newvar.etat = 0
                        End If


End Sub


bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 19:16

maintenant, l interface graphique pp_saisie:

Code:

VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} pp_saisie
  Caption        =  "UserForm3"
  ClientHeight    =  3780
  ClientLeft      =  45
  ClientTop      =  375
  ClientWidth    =  10785
  OleObjectBlob  =  "pp_saisie.frx":0000
  StartUpPosition =  1  'CenterOwner
End
Attribute VB_Name = "pp_saisie"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub CommandButton1_Click()
                urlaptsource = pp_saisie.TextBox1.Text
               
'                UserForm3.Label1.Caption = urlaptsource
               
               
                Call ppvp400(urlaptsource)
               

End Sub


bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 19:21

je joins un fichier aptsource pour un premier test:

Code:

$$ -----------------------------------------------------------------
$$    Généré le lundi 25 juin 2012 05:56:24
$$    CATIA APT VERSION 1.0
$$ -----------------------------------------------------------------
$$ Programme de fabrication.1
$$  PROG1
$$*CATIA0
$$ Programme de fabrication.1
$$    0.76604    -0.64279    0.00000  -92.09450
$$    0.63302    0.75441    -0.17365  -107.48403
$$    0.11162    0.13302    0.98481    0.00000
CATMAT/    0.76604,  -0.64279,    0.00000,    0.63302,    0.75441,  -$
0.17365,    0.11162,    0.13302,    0.98481,  -92.09450, -107.48403,  $
 0.00000,Programme de fabrication.1
$$ PARTNO Programme de fabrication.1
$$ PROGRAM. PROG1
$$ MACHINE. 5-axes.1
$$ CATPROCESS. essai2.CATProcess
$$ CATPRODUCT. Produit1
$$ OPERATION NAME : Instruction post-processeur.1
$$  Début de génération de: Instruction post-processeur.1
PARTNO P001
PPRINT ESSAI1
PIVOTZ/2,0,0,0
$$  Fin de génération de: Instruction post-processeur.1
$$ OPERATION NAME : Changement outil.2
$$  Début de génération de: Changement outil.2
MULTAX/ON
FROM  /    0.00000,    0.00000,  500.00000, 0.000000, 0.000000, 1.000000
$$ TOOLCHANGEBEGINNING
CUTTER/ 20.000000,  2.000000,  8.000000,  2.000000,  0.000000,$
        0.000000, 60.000000
COOLNT/OFF
PPRINT T1 FRAISE D20
LOADTL/1
COOLNT/FLOOD
RAPID
$$ TOOLCHANGEEND
$$  Fin de génération de: Changement outil.2
$$ OPERATION NAME : CONTOURNAGE HELICOIDAL
$$  Début de génération de: CONTOURNAGE HELICOIDAL
SPINDL/  70.0000,RPM,CLW
RAPID
GOTO  /  46.32161,  86.31842,  135.40446, 0.111619, 0.133022, 0.984808
RAPID
GOTO  /  35.15972,  73.01620,  36.92369, 0.111619, 0.133022, 0.984808
FEDRAT/ 1000.0000,MMPM
CUTCOM/LEFT
$$ START CUTCOM PLANAR XT,YT,ZT,I,J,K
GOTO  /  33.26066,  70.75298,  37.44463, 0.111619, 0.133022, 0.984808
INTOL /    0.00200
OUTTOL/    0.00000
PSIS/(PLANE/(POINT/  39.59088,  78.29705,  35.70815),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.76604,  -0.64279,    0.00000
TLON,GOFWD/(CYLNDR/  39.59088,  78.29705,  35.70815,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  39.59088,  78.29705,  35.70815),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  39.59088,  78.29705,  35.70815),$
      (POINT/  47.25132,  71.86917,  35.70815))
GOTO  /  96.47894,  130.53636,  21.26533, 0.111619, 0.133022, 0.984808
HELICAL/  104.13938,  124.10848,  21.26533,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  103.16180,  133.97363,  19.94930
GOTO  /  120.86002,  135.40720,  17.53385, 0.111619, 0.133022, 0.984808
HELICAL/  121.82724,  125.52970,  18.75842,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  128.14702,  133.06133,  16.92985
GOTO  /  222.83356,  53.27687,  15.48306, 0.111619, 0.133022, 0.984808
HELICAL/  182.14666,    4.78811,  26.64413,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  175.55324,  -58.75223,  33.99868
GOTO  /  175.55324,  -58.75223,  33.99868, 0.111619, 0.133022, 0.984808
HELICAL/  168.29765, -130.76060,  44.54752,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  122.80066,  -73.58503,  41.29827
GOTO  /  122.80066,  -73.58503,  41.29827, 0.111619, 0.133022, 0.984808
HELICAL/  104.64779,  -50.69906,  40.26442,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  86.44693,  -73.10493,  44.87838
GOTO  /  -1.43400,  -1.95356,  43.86589, 0.111619, 0.133022, 0.984808
HELICAL/    4.77500,    5.69063,  42.12962,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -2.90645,  12.09346,  41.94424
GOTO  /  46.32116,  70.76065,  27.50142, 0.111619, 0.133022, 0.984808
GOTO  /  95.54878,  129.42784,  13.05860, 0.111619, 0.133022, 0.984808
HELICAL/  103.20922,  122.99996,  13.05860,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  102.23164,  132.86511,  11.74257
GOTO  /  119.92987,  134.29868,    9.32712, 0.111619, 0.133022, 0.984808
HELICAL/  120.89708,  124.42118,  10.55169,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  127.21687,  131.95281,    8.72312
GOTO  /  221.90340,  52.16835,    7.27633, 0.111619, 0.133022, 0.984808
HELICAL/  181.21650,    3.67959,  18.43740,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  174.62308,  -59.86075,  25.79195
GOTO  /  174.62308,  -59.86075,  25.79195, 0.111619, 0.133022, 0.984808
HELICAL/  167.36749, -131.86912,  36.34079,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  121.87050,  -74.69355,  33.09154
GOTO  /  121.87050,  -74.69355,  33.09154, 0.111619, 0.133022, 0.984808
HELICAL/  103.71763,  -51.80757,  32.05769,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  85.51678,  -74.21344,  36.67165
GOTO  /  -2.36415,  -3.06208,  35.65916, 0.111619, 0.133022, 0.984808
HELICAL/    3.84485,    4.58211,  33.92289,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -3.83661,  10.98495,  33.73751
GOTO  /  45.39101,  69.65213,  19.29469, 0.111619, 0.133022, 0.984808
GOTO  /  94.61862,  128.31932,    4.85187, 0.111619, 0.133022, 0.984808
HELICAL/  102.27907,  121.89145,    4.85187,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  101.30149,  131.75659,    3.53584
GOTO  /  118.99971,  133.19016,    1.12039, 0.111619, 0.133022, 0.984808
HELICAL/  119.96692,  123.31267,    2.34496,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  126.28671,  130.84429,    0.51639
GOTO  /  220.97324,  51.05984,  -0.93040, 0.111619, 0.133022, 0.984808
HELICAL/  180.28634,    2.57108,  10.23067,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  173.69292,  -60.96927,  17.58522
GOTO  /  173.69292,  -60.96927,  17.58522, 0.111619, 0.133022, 0.984808
HELICAL/  166.43733, -132.97764,  28.13405,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  120.94034,  -75.80207,  24.88481
GOTO  /  120.94034,  -75.80207,  24.88481, 0.111619, 0.133022, 0.984808
HELICAL/  102.78747,  -52.91609,  23.85096,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  84.58662,  -75.32196,  28.46492
GOTO  /  -3.29431,  -4.17060,  27.45242, 0.111619, 0.133022, 0.984808
HELICAL/    2.91469,    3.47359,  25.71616,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -4.76677,    9.87643,  25.53078
GOTO  /  44.46085,  68.54362,  11.08796, 0.111619, 0.133022, 0.984808
GOTO  /  93.68847,  127.21080,  -3.35486, 0.111619, 0.133022, 0.984808
HELICAL/  101.34891,  120.78293,  -3.35486,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  100.37133,  130.64807,  -4.67089
GOTO  /  118.06955,  132.08164,  -7.08634, 0.111619, 0.133022, 0.984808
HELICAL/  119.03677,  122.20415,  -5.86177,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  125.35655,  129.73577,  -7.69034
GOTO  /  220.04309,  49.95132,  -9.13713, 0.111619, 0.133022, 0.984808
HELICAL/  179.35619,    1.46256,    2.02394,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  172.76277,  -62.07779,    9.37849
GOTO  /  172.76277,  -62.07779,    9.37849, 0.111619, 0.133022, 0.984808
HELICAL/  165.50717, -134.08616,  19.92732,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  120.01018,  -76.91059,  16.67808
GOTO  /  120.01018,  -76.91059,  16.67808, 0.111619, 0.133022, 0.984808
HELICAL/  101.85731,  -54.02461,  15.64423,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  83.65646,  -76.43048,  20.25819
GOTO  /  -4.22447,  -5.27912,  19.24569, 0.111619, 0.133022, 0.984808
HELICAL/    1.98453,    2.36507,  17.50943,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -5.69692,    8.76791,  17.32404
GOTO  /  43.53069,  67.43510,    2.88122, 0.111619, 0.133022, 0.984808
GOTO  /  92.75831,  126.10229,  -11.56160, 0.111619, 0.133022, 0.984808
HELICAL/  100.41875,  119.67441,  -11.56160,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  99.44117,  129.53955,  -12.87762
GOTO  /  117.13939,  130.97312,  -15.29308, 0.111619, 0.133022, 0.984808
HELICAL/  118.10661,  121.09563,  -14.06851,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  124.42639,  128.62726,  -15.89707
GOTO  /  219.11293,  48.84280,  -17.34386, 0.111619, 0.133022, 0.984808
HELICAL/  178.42603,    0.35404,  -6.18279,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  171.83261,  -63.18630,    1.17176
GOTO  /  171.83261,  -63.18630,    1.17176, 0.111619, 0.133022, 0.984808
HELICAL/  164.57702, -135.19468,  11.72059,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  119.08003,  -78.01911,    8.47135
GOTO  /  119.08003,  -78.01911,    8.47135, 0.111619, 0.133022, 0.984808
HELICAL/  100.92716,  -55.13313,    7.43750,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  82.72630,  -77.53900,  12.05146
GOTO  /  -5.15463,  -6.38764,  11.03896, 0.111619, 0.133022, 0.984808
HELICAL/    1.05437,    1.25655,    9.30269,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -6.62708,    7.65939,    9.11731
GOTO  /  42.60053,  66.32658,  -5.32551, 0.111619, 0.133022, 0.984808
GOTO  /  91.82815,  124.99377,  -19.76833, 0.111619, 0.133022, 0.984808
HELICAL/  99.48859,  118.56589,  -19.76833,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  98.51101,  128.43103,  -21.08435
GOTO  /  116.20924,  129.86461,  -23.49981, 0.111619, 0.133022, 0.984808
HELICAL/  117.17645,  119.98711,  -22.27524,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  123.49624,  127.51874,  -24.10380
GOTO  /  218.18277,  47.73428,  -25.55059, 0.111619, 0.133022, 0.984808
HELICAL/  177.49587,  -0.75448,  -14.38952,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  170.90245,  -64.29482,  -7.03497
GOTO  /  170.90245,  -64.29482,  -7.03497, 0.111619, 0.133022, 0.984808
HELICAL/  163.64686, -136.30319,    3.51386,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  118.14987,  -79.12762,    0.26461
GOTO  /  118.14987,  -79.12762,    0.26461, 0.111619, 0.133022, 0.984808
HELICAL/  99.99700,  -56.24165,  -0.76923,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  81.79615,  -78.64752,    3.84473
GOTO  /  -6.08478,  -7.49616,    2.83223, 0.111619, 0.133022, 0.984808
HELICAL/    0.12422,    0.14804,    1.09596,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -7.55724,    6.55087,    0.91058
GOTO  /  41.67038,  65.21806,  -13.53224, 0.111619, 0.133022, 0.984808
GOTO  /  91.00120,  124.00824,  -27.06448, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  98.66164,  117.58037,  -27.06448),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.63302,    0.75441,  -0.17365
TLON,GOFWD/(CYLNDR/  98.66164,  117.58037,  -27.06448,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  98.66164,  117.58037,  -27.06448),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  98.66164,  117.58037,  -27.06448),$
      (POINT/  97.69443,  127.45786,  -28.28905))
GOTO  /  115.41638,  128.91972,  -30.49513, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  116.38360,  119.04222,  -29.27056),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.98903,    0.08158,  -0.12312
TLON,GOFWD/(CYLNDR/  116.38360,  119.04222,  -29.27056,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  116.38360,  119.04222,  -29.27056),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  116.38360,  119.04222,  -29.27056),$
      (POINT/  122.71382,  126.58629,  -31.00704))
GOTO  /  217.56433,  46.99725,  -31.00704, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  176.87743,  -1.49150,  -19.84597),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.76604,  -0.64279,    0.00000
TLON,GOFWD/(CYLNDR/  176.87743,  -1.49150,  -19.84597,$
      0.11162,    0.13302,    0.98481,  64.27405),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  176.87743,  -1.49150,  -19.84597),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  176.87743,  -1.49150,  -19.84597),$
      (POINT/  170.50116,  -64.77306,  -10.57556))
PSIS/(PLANE/(POINT/  163.24557, -136.78144,  -0.02673),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/  -0.98879,    0.11380,    0.09670
TLON,GOFWD/(CYLNDR/  163.24557, -136.78144,  -0.02673,$
      0.11162,    0.13302,    0.98481,  73.13773),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  163.24557, -136.78144,  -0.02673),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  163.24557, -136.78144,  -0.02673),$
      (POINT/  117.82365,  -79.51640,  -2.61360))
PSIS/(PLANE/(POINT/  99.67078,  -56.63042,  -3.64745),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/  -0.77579,  -0.60766,    0.17001
TLON,GOFWD/(CYLNDR/  99.67078,  -56.63042,  -3.64745,$
      0.11162,    0.13302,    0.98481,  29.22950),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  99.67078,  -56.63042,  -3.64745),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  99.67078,  -56.63042,  -3.64745),$
      (POINT/  81.52218,  -78.97401,    1.42757))
GOTO  /  -6.20900,  -7.64419,    1.73627, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/    0.00000,    0.00000,    0.00000),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/  -0.77590,    0.63085,    0.00273
TLON,GOFWD/(CYLNDR/    0.00000,    0.00000,    0.00000,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/    0.00000,    0.00000,    0.00000),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/    0.00000,    0.00000,    0.00000),$
      (POINT/  -7.66044,    6.42788,    0.00000))
GOTO  /  41.67038,  65.21806,  -13.53224, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  34.00993,  71.64594,  -13.53224),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.63302,    0.75441,  -0.17365
TLON,GOFWD/(CYLNDR/  34.00993,  71.64594,  -13.53224,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  34.00993,  71.64594,  -13.53224),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  34.00993,  71.64594,  -13.53224),$
      (POINT/  40.34016,  79.19000,  -15.26872))
CUTCOM/OFF
$$ END CUTCOM PLANAR XT,YT,ZT,I,J,K
GOTO  /  38.44109,  76.92678,  -14.74778, 0.111619, 0.133022, 0.984808
RAPID
GOTO  /  55.18392,  96.88012,  132.97339, 0.111619, 0.133022, 0.984808
$$  Fin de génération de: CONTOURNAGE HELICOIDAL
$$ OPERATION NAME : Changement outil.3
$$  Début de génération de: Changement outil.3
$$ TOOLCHANGEBEGINNING
CUTTER/ 10.000000,  0.000000,  5.000000,  2.886751, 30.000000,$
        0.000000, 50.000000
COOLNT/OFF
PPRINT T2 FORET D 10
LOADTL/3
COOLNT/FLOOD
RAPID
$$ TOOLCHANGEEND
$$  Fin de génération de: Changement outil.3
$$ OPERATION NAME : PERCAGE
$$  Début de génération de: PERCAGE
SPINDL/ 2000.0000,RPM,CLW
RAPID
GOTO  /  202.22595,  18.52789,  127.90633, 0.111619, 0.133022, 0.984808
RAPID
GOTO  /  191.06406,    5.22567,  29.42555, 0.111619, 0.133022, 0.984808
CYCLE/DEEP,  -30.000000,  10.000000,MMPM,  300.000000,    1.000000,POS$
Z,    0.000000
GOTO  /  190.95244,    5.09265,  28.44074, 0.111619, 0.133022, 0.984808
CYCLE/OFF
RAPID
GOTO  /  202.22595,  18.52789,  127.90633, 0.111619, 0.133022, 0.984808
$$  Fin de génération de: PERCAGE
COOLNT/OFF
INSERT M30
INSERT


bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 19:25

voila le resultat que vous devez avoir:

Code:

<P001>
( ESSAI1)
( T1 FRAISE D20)
M68
N0001M98P9145
M1
T0001M6
T0003
M51
M8
M79
M11
G0G54G90A-10.C-40.
M78
M10
X-20.Y70.929S70M3
G43Z150.H1
Z50.
G1G94G41Y67.929D1F1000
G3X-10.Y77.929I0.J10.
G1Y155.858Z49.075
G2X-7.09Y162.91Z48.982I10.J0.
G1X5.546Y175.614Z48.77
G2X12.636Y178.562Z48.676I7.09J-7.052
G1X136.454Y178.563Z47.207
G2X172.247Y60.902Z45.262I0.J-64.274
G3X141.37Y15.051Z44.589I40.728J-60.748
G2X113.213Y-8.221Z44.121I-28.617J5.954
G1X.157Y-9.999Z42.78
G2X-10.Y0.Z42.591I-.157J9.999
G1Y77.929Z41.667
Y155.858Z40.742
G2X-7.09Y162.91Z40.649I10.J0.
G1X5.546Y175.614Z40.437
G2X12.636Y178.562Z40.343I7.09J-7.052
G1X136.454Y178.563Z38.874
G2X172.247Y60.902Z36.929I0.J-64.274
G3X141.37Y15.051Z36.256I40.728J-60.748
G2X113.213Y-8.221Z35.788I-28.617J5.954
G1X.157Y-9.999Z34.446
G2X-10.Y0.Z34.258I-.157J9.999
G1Y77.929Z33.333
Y155.858Z32.409
G2X-7.09Y162.91Z32.316I10.J0.
G1X5.546Y175.614Z32.103
G2X12.636Y178.562Z32.01I7.09J-7.052
G1X136.454Y178.563Z30.541
G2X172.247Y60.902Z28.595I0.J-64.274
G3X141.37Y15.051Z27.923I40.728J-60.748
G2X113.213Y-8.221Z27.454I-28.617J5.954
G1X.157Y-9.999Z26.113
G2X-10.Y0.Z25.925I-.157J9.999
G1Y77.929Z25.
Y155.858Z24.075
G2X-7.09Y162.91Z23.982I10.J0.
G1X5.546Y175.614Z23.77
G2X12.636Y178.562Z23.676I7.09J-7.052
G1X136.454Y178.563Z22.207
G2X172.247Y60.902Z20.262I0.J-64.274
G3X141.37Y15.051Z19.589I40.728J-60.748
G2X113.213Y-8.221Z19.121I-28.617J5.954
G1X.157Y-9.999Z17.78
G2X-10.Y0.Z17.591I-.157J9.999
G1Y77.929Z16.667
Y155.858Z15.742
G2X-7.09Y162.91Z15.649I10.J0.
G1X5.546Y175.614Z15.437
G2X12.636Y178.562Z15.343I7.09J-7.052
G1X136.454Y178.563Z13.874
G2X172.247Y60.902Z11.929I0.J-64.274
G3X141.37Y15.051Z11.256I40.728J-60.748
G2X113.213Y-8.221Z10.788I-28.617J5.954
G1X.157Y-9.999Z9.446
G2X-10.Y0.Z9.258I-.157J9.999
G1Y77.929Z8.333
Y155.858Z7.409
G2X-7.09Y162.91Z7.316I10.J0.
G1X5.546Y175.614Z7.103
G2X12.636Y178.562Z7.01I7.09J-7.052
G1X136.454Y178.563Z5.541
G2X172.247Y60.902Z3.595I0.J-64.274
G3X141.37Y15.051Z2.923I40.728J-60.748
G2X113.213Y-8.221Z2.454I-28.617J5.954
G1X.157Y-9.999Z1.113
G2X-10.Y0.Z.925I-.157J9.999
G1Y77.929Z0.
Y155.858
G2X-7.09Y162.91I10.J0.
G1X5.546Y175.614
G2X12.636Y178.562I7.09J-7.052
G1X136.454Y178.563
G2X172.247Y60.902I0.J-64.274
G3X141.37Y15.051I40.728J-60.748
G2X113.213Y-8.221I-28.617J5.954
G1X.157Y-9.999
G2X-10.Y0.I-.157J9.999
G1Y77.929
G3X-20.Y87.929I-10.J0.
G1G40Y84.929
G0Z150.
M9
( T2 FORET D 10)
N0003M98P9145
M1
T0003M6
T9999
M51
M8
M79
M11
G0G54G90A-10.C-40.
M78
M10
X143.004Y119.781S2000M3
G43Z151.H3
Z51.
G83G99Z20.Q10.R51.F300
G80
G0Z151.
M9
M30

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 19:28

attention, sur la machine, les axes de rotations A et C sont inverses:

c est a dire que la rotation A de 30 degres par exemple sort a A-30.

idem pour l axe B.

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par bruno18100 Lun 25 Juin 2012 - 20:05

Ah oui, pour l interface graphique pp_saisie, je n ai pas pu joindre le fichier
.frx car c est du binaire !

il suffit de creer un userform avec un textbox1, un label1,
et un commandbutton1.

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par Guss_ Mar 26 Juin 2012 - 9:37

Que sont les fichier pp ?

Je connais le vb mais pas vraiment le langage machine, donc explique ce que tu veux faire, et les points qui te bloquent.

Guss_
Admin
Admin

Messages : 530
Date d'inscription : 08/01/2010

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty pptable

Message par bruno18100 Sam 2 Mar 2013 - 21:51

bonjour,

la pptable, a mon avis, configure la sortie aptsource de catia, le fichier aptsource est un fichier intermédiaire qui est lu par le post-processeur.

comme avec une pptable on peut presque tout reconfigurer (la sortie aptsource), il est absolument nécessaire d'avoir la pptable
correspondant au post processeur utilisé pour généré le fichier iso.

sous catia v5 et v6, dans la déclaration de la machine, il faut sélectionner la pptable... et il y a d'autres manips...

j'ai une nouvelle version de mon post processeur revu et corrigé, mais on ne peut pas placer de fichier zip...

ce que j'attends, si ça intéresse, c'est des essais sur un simulateur (j'ai essayé sur ncsimul par exemple...)


dans l'attente de vous lire...

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty pp 5axes v2

Message par bruno18100 Dim 3 Mar 2013 - 1:01

bonjour,

je vais essayer de déposer ma macro catia V6:

tout d'abord, creer une interface de saisie,

essai post-processeur 5 axes table-table broche verticale   -  fanuc Ecrans11

1 TextBox1
1 Label1
1 Label2
1 ComandButton1 "EXECUTION"
1 ComandButton2 "PARCOURIR"
1 ComandButton3 "EDITER"

ensuite, inserer le code suivant:


Code:

VERSION 5.00
Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} pp_saisie
  Caption        =  "UserForm3"
  ClientHeight    =  3780
  ClientLeft      =  45
  ClientTop      =  375
  ClientWidth    =  10785
  OleObjectBlob  =  "pp_saisieV6.frx":0000
  StartUpPosition =  1  'CenterOwner
End
Attribute VB_Name = "pp_saisie"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False






Private Sub CommandButton1_Click()
                urlaptsource = pp_saisie.TextBox1.Text
               
                If PresenceFichier(urlaptsource) = False Then
                    MsgBox ("Fichier non trouvé !")
                    Exit Sub
                End If
               
                Call pp5axes(urlaptsource)
               

End Sub

Private Sub CommandButton2_Click()
   
   
    urlaptsource = CATIA.FileSelectionBox("Select  File", "*.aptsource", 0)
   

        If urlaptsource = False Then
            MsgBox "Pas de fichier selectionné !"
            Exit Sub
        Else
            pp_saisie.TextBox1.Text = urlaptsource
        End If
       
       

   
End Sub

Private Sub CommandButton3_Click()

    Dim path As String
   
    ch0 = pp_saisie.TextBox1.Text
               
    Do While InStr(ch0, Chr(92)) > 0
   
        path = path + Mid(ch0, 1, InStr(ch0, Chr(92)))
        ch0 = Mid(ch0, InStr(ch0, Chr(92)) + 1)

    Loop


    If PresenceFichier(path + Label2.Caption) = False Then
        Shell "C:\Program Files\Windows NT\Accessories\Wordpad.EXE  ", vbNormalFocus
    Else
        Shell "C:\Program Files\Windows NT\Accessories\Wordpad.EXE  " + Chr(34) + path + Label2.Caption + Chr(34), vbNormalFocus
    End If


End Sub

Private Sub Label1_Click()

End Sub

Private Sub Label2_Click()

End Sub

nommer l'interface pp_saisie.

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty suite 1er module

Message par bruno18100 Dim 3 Mar 2013 - 1:08

creer le module PostPro_5AX, insérer le code:

Code:

Attribute VB_Name = "PostPro_5AX"
Sub CATMain()
pp_saisie.Show

End Sub



bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty suite 2eme module

Message par bruno18100 Dim 3 Mar 2013 - 1:44

creer le module: Module_PP_5AX

ajouter les blocs suivants,

bloc 1:
Code:

Attribute VB_Name = "Module_PP_5AX"
' version du 02/03/2013

Const Smini As Long = 10
Const Smaxi As Long = 20000

Const Fmini As Long = 1
Const Fmaxi As Long = 10000


Const debutligne1 As String = " G0 G40 G49 G80 G90 M9"
Const debutligne2 As String = " G52 X0. Y0. Z0."
Const debutligne3 As String = " (------------)"

Const retourChangtOutil As String = " G53 G90 G0 Z0. H0"

Const finligne1 As String = " G53 G90 G0 Z0. H0"
Const finligne2 As String = " M5"
Const finligne3 As String = " G53 G90 G0 X0. Y0."
Const finligne4 As String = " M30"

Const cstarr0 As String = " M9"
Const cstarr1 As String = " M8"
Const cstarr2 As String = " M7"
Const cstarr3 As String = " (CODE ARROSAGE NON DEFINI)"
Const cstarr4 As String = " (CODE ARROSAGE NON DEFINI)"

Const cstn As String = "N"

Const cg0 As String = " G0"
Const cg1 As String = " G1"
Const cg2 As String = " G2"
Const cg3 As String = " G3"

Const cstx As String = " X"
Const csty As String = " Y"
Const cstz As String = " Z"

Const csti As String = " I"
Const cstj As String = " J"

Const csta As String = " A"
Const cstc As String = " C"

Const cstp As String = " P"
Const cstq As String = " Q"
Const cst_r As String = " R"

Const caunclamp As String = " M79"
Const caclamp As String = " M78"
Const ccunclamp As String = " M11"
Const ccclamp As String = " M10"

Const cg90 As String = " G90"

Const cg52 As String = " G52"
Const cg53 As String = " G53"
Const cg54 As String = " G54"
Const cg55 As String = " G55"
Const cg56 As String = " G56"
Const cg57 As String = " G57"
Const cg58 As String = " G58"
Const cg59 As String = " G59"
Const cg541p As String = " G54.1 P"

Const cstt As String = " T"
Const cm0 As String = " M0"
Const cm1 As String = " M1"
Const cm6 As String = " M6"
Const cvitesse As String = " S"
Const cm3 As String = " M3"
Const cm4 As String = " M4"
Const cm5 As String = " M5"
Const cm51 As String = " M51"
Const cm68 As String = " M68"

Const cavance As String = " F"
Const cg94 As String = " G94"
Const cg93 As String = " G93"

Const cg43 As String = " G43"
Const cg434 As String = " G43.4"
Const cg49 As String = " G49"
Const csth As String = " H"

Const cg41 As String = " G41"
Const cg42 As String = " G42"
Const cg40 As String = " G40"
Const cstd As String = " D"

Const cg682 As String = " G68.2"
Const cg69 As String = " G69"
Const cg531 As String = " G53.1"

Const cg80 As String = " G80"
Const cg73 As String = " G73"
Const cg74 As String = " G74"
Const cg76 As String = " G76"
Const cg81 As String = " G81"
Const cg82 As String = " G82"
Const cg83 As String = " G83"
Const cm29s As String = ""
Const cg84 As String = " G84"
Const cg85 As String = " G85"
Const cg86 As String = " G86"
Const cg87 As String = " G87"
Const cg88 As String = " G88"
Const cg89 As String = " G89"

Const cg98 As String = " G98"
Const cg99 As String = " G99"

Const cg51q0 As String = " G5.1 Q0"
Const cg51q1r As String = " G5.1 Q1 R"

Const cstFinSP As String = " M99" & vbLf & "%"
Const cstFinProg As String = " M99" & vbLf & "%"

Const pi As Double = 3.14159265358979





Type pointdebut
        x As Double
        y As Double
        z As Double
        i As Double
        j As Double
        k As Double
End Type



Type pointfinal
        ax As Double
        bx As Double
        cx As Double
        dx As Double
        ex As Double
End Type

Type pointfinalcercle
        debut As pointfinal
        fin  As pointfinal
        axc As Double
        bxc As Double
        ix As Double
        jx As Double
        g As Double
        ac As Double
        pas As Double
        bc As Double
        at As Double
End Type

Type gclass
        g(99) As Double
End Type

Type mclass
        m(99) As Double
End Type

Type outilclass
        tc As Double
        ts As Double
        dia As Double
        s As Double
        rot As Double
        arr As Double
        code_arr(10) As String
        f As Double
        Forigin As Double
        couple As Double
        h As Double
        corrh As Double
        d As Double
        corrd As Double
End Type

Type cycleclass
        Za As Double
        Zaf As Double
        Zp As Double
        Zr As Double
        Q As Double
        P As Double
        Gs As Double
End Type


Type rotmat
    mat(1 To 3, 1 To 4)
End Type




Type varclass
        rota As rotmat
       
        rotb As rotmat
       
        rotetat As Integer
       
       
        ptd As pointdebut

        ptf As pointfinal

        ptfa As pointfinal

        ptc As pointfinalcercle

        g As gclass

        m As mclass

        outil As outilclass

        cycle As cycleclass

        sortie As String
       
        px As Double
        py As Double
        pz As Double
       
        cldx As Integer
        clex As Integer
        xdec As Double
        ydec As Double
        zdec As Double
        plunge As Double
        Zplunge As Double
        rotdx As Double
        rotex As Double
        defaultex As Double
        finvers As Integer
        g682x As Double
        g682y As Double
        g682z As Double
        g682m As Double
        g682auto As Double
        g434etat As Integer
        lintol As Double
        high As Integer
        high_etat As Integer
        etat As Integer

End Type








Type sortieclass
        imanew1 As varclass
        imaold1 As varclass
        Erreur As String
        chaine As String
        cetat As Integer
End Type



Dim newvar As varclass
Dim oldvar As varclass
Dim sortie As sortieclass
Dim path As String
Dim numeroBloc As Long
Dim increment As Integer






Function numN() As String
   
    If numeroBloc = -1 Then
        numN = ""
    Else
        numeroBloc = numeroBloc + increment
        numN = cstn + Mid(Str(numeroBloc), 2)
    End If
   
End Function





Function PresenceFichier(varNomFichier) As Boolean
 
    Dim objFSO As Object

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If (objFSO.FileExists(varNomFichier)) Then
        PresenceFichier = True
    Else
        PresenceFichier = False
    End If
    Set objFSO = Nothing

End Function




bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty ajouter

Message par bruno18100 Dim 3 Mar 2013 - 1:48

bloc 2:

Code:



Sub pp5axes(ByVal urlaptsource As String)


    pp_saisie.Label1.Caption = "debut traitement"
    DoEvents
               
               
    Dim newvar0 As varclass
    Dim oldvar0 As varclass
           

    Dim ch0 As String
    Dim path As String
    path = ""
    Dim nom_de_fichier As String
                           


    ch0 = urlaptsource
               
    Do While InStr(ch0, Chr(92)) > 0
   
        path = path + Mid(ch0, 1, InStr(ch0, Chr(92)))
        ch0 = Mid(ch0, InStr(ch0, Chr(92)) + 1)

    Loop

 
    nom_de_fichier = Mid(ch0, 1, InStr(ch0, ".") - 1)


    Dim fichier_sortie As String
   
    Dim fichier_sortie_principal As String
   
   
    Dim fichier_sortie_etat As Integer
    fichier_sortie_etat = -1

 

    Dim fichier_sortie2 As Integer
    fichier_sortie2 = FreeFile

         
    numeroBloc = 5
    increment = 5
       

    oldvar.g.g(1) = 1E+100
    oldvar.g.g(2) = 1E+100
    oldvar.g.g(3) = 1E+100
    oldvar.g.g(5) = 9999
    oldvar.ptf.ax = 1E+100
    oldvar.ptf.bx = 1E+100
    oldvar.ptf.cx = 1E+100
    oldvar.ptf.dx = 1E+100
    oldvar.ptf.ex = 0
    oldvar.outil.tc = 1E+100
    oldvar.outil.arr = 0
    oldvar.outil.s = 1E+100
    oldvar.outil.rot = 1E+100
    oldvar.outil.corrd = 40
    oldvar.cycle.Zaf = 1E+100
    oldvar.ptc.ac = 1E+100
    oldvar.ptc.bc = 1E+100
    oldvar.ptc.at = 0
    oldvar.cycle.Gs = 1E+100
    oldvar.plunge = 0
    oldvar.cldx = 1
    oldvar.clex = 1
    oldvar.g682m = 69

    newvar.px = 0
    newvar.py = 0
    newvar.pz = 0
       
    newvar.g.g(1) = 1E+100
    newvar.g.g(2) = 54
    newvar.g.g(3) = 90
    newvar.g.g(5) = 94
    newvar.ptf.dx = 0
    newvar.ptf.ex = 0
    newvar.outil.arr = 0
    newvar.outil.code_arr(0) = cstarr0
    newvar.outil.code_arr(1) = cstarr1
    newvar.outil.code_arr(2) = cstarr2
    newvar.outil.code_arr(3) = cstarr3
    newvar.outil.code_arr(4) = cstarr4
    newvar.outil.s = 1E+100
    newvar.outil.f = 10000000000#
    newvar.outil.rot = 1E+100
    newvar.outil.couple = 0
    newvar.outil.corrd = 40
    newvar.cycle.Zaf = 1E+100
    newvar.ptc.at = 0
    newvar.plunge = 0
    newvar.cldx = 1
    newvar.clex = 1
    newvar.rotdx = 1E+100
    newvar.rotex = 1E+100
    newvar.defaultex = 1E+100
    newvar.g682auto = 0
    newvar.g682m = 69
    newvar.g682x = 0
    newvar.g682y = 0
    newvar.g682z = 0
    newvar.g434etat = 0
    newvar.lintol = 0
    newvar.rotetat = 0
       
    sortie.cetat = 0
       

    Dim ptd As pointdebut
    Dim ptf As pointfinal
    Dim ptfa As pointfinal
       
    sortie.chaine = ""
    sortie.Erreur = ""



    Dim saisie As String
    Dim buffer As String
    Dim buffer2 As String
    Dim chaine1 As String
    Dim chaine2 As String
    Dim cle1 As String
    Dim concat As Integer
    Dim compteur As Double
    Dim num1 As Integer
    Dim i_outil_suivant As Integer
    Dim at As Double
    Dim az As Double
    Dim var1 As Double
    Dim var2 As Double
    Dim var3 As Double
    Dim ch1 As String
    Dim total As Long
    total = 0
       

    newvar.etat = 0

    Dim liste_outils(1999) As Long
    Dim i1 As Integer
    i1 = 1

 
 
    Dim fichier_entree0 As Integer
    fichier_entree0 = FreeFile
 
    Open urlaptsource For Input As fichier_entree0
       
       
       
    Do While Not EOF(fichier_entree0)
           
           
        Line Input #fichier_entree0, saisie

        total = total + 1
        chaine1 = saisie
               
               
        If InStr(chaine1, "LOADTL") = 1 Then
       
            chaine1 = Mid(saisie, InStr(saisie, "/") + 1)
           
            If InStr(chaine1, ",") > 0 Then
                chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
            Else
                chaine2 = chaine1
            End If
           
            liste_outils(i1) = CLng(Fix(Val(chaine2)))

            If (i1 > 1) And (liste_outils(i1) = liste_outils(i1 - 1)) Then
                i1 = i1 - 1
            End If

            i1 = i1 + 1
        End If

    Loop

    liste_outils(i1) = liste_outils(1)

    Close #fichier_entree0

       
       
    i_outil_suivant = 2
    Dim ligne As Long
    ligne = 0
    concat = 0
    boucle = 1
    passage = 0
       
     
       
       
       
    Dim fichier_entree As Integer
    fichier_entree = FreeFile
 
    Open urlaptsource For Input As #fichier_entree
       
       
       
       
    Do While Not EOF(fichier_entree)
       
       
        If boucle = 1 Then
            Line Input #fichier_entree, saisie
        Else
            saisie = buffer
            passage = 1
        End If



        compteur = compteur + 1
       
        If CLng(compteur / 100) <> ligne Then
            ligne = CLng(compteur / 100)
            pp_saisie.Label1.Caption = Str(ligne * 100) + "  lignes traitees sur " + Str(total)
            DoEvents
        End If
       


        If InStr(saisie, "$$") > 0 Then
            saisie = "rien"
            newvar.etat = 0
        Else
            buffer2 = saisie
        End If
       

        num1 = Len(saisie)
       


        If InStr(saisie, "$") > 0 Then
            If concat = 0 Then
                buffer = Mid(saisie, 1, InStr(saisie, "$") - 1)
                concat = 1
            Else
                buffer = buffer + Mid(saisie, 1, InStr(saisie, "$") - 1)
            End If
        Else
            If concat = 0 Then
                buffer = saisie
            Else
                buffer = buffer + saisie
                concat = 0
            End If
        End If
     
       


        If concat = 0 Then

            newvar.etat = 0
       
            If InStr(buffer, "PARTNO") = 1 Then
       
                ch0 = UCase(Mid(buffer, 8))
                fichier_sortie_principal = ""
               
                For i1 = 1 To Len(ch0)
                    num1 = Asc(Mid(ch0, i1, 1))
                    If num1 >= 48 And num1 <= 57 Then
                        fichier_sortie_principal = fichier_sortie_principal + Chr(num1)
                    End If
                Next
               
                If Val(fichier_sortie_principal) = 0 Or Val(fichier_sortie_principal) > 9999 Then
                    fichier_sortie_principal = "0001"
                    MsgBox ("PARTNO incorrect, sortie renommée en 0001 ")
                End If
               
                sortie.chaine = "%O" + Mid(Str(Val(fichier_sortie_principal) + 10000), 3)
                fichier_sortie = fichier_sortie_principal
                newvar.etat = 1
                 
                If PresenceFichier(path + fichier_sortie + ".tap") <> False Then
                    Set fs = CreateObject("Scripting.FileSystemObject")
                    Set f = fs.GetFile(path + fichier_sortie + ".tap")
                    f.Delete
                End If

                Dim Fichier0 As Long
   
                Fichier0 = FreeFile
                Open path + fichier_sortie + ".tap" For Append As #Fichier0
   
                pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                DoEvents
               
                fichier_sortie_etat = 0
               
            End If





            If InStr(buffer, "SEQNO") = 1 Then
                If InStr(buffer, "OFF") > 0 Then
                    numeroBloc = -1
                Else
                    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                    numeroBloc = Abs(Val(Mid(chaine1, 1, InStr(chaine1, ",") - 1)))
                    chaine1 = Mid(chaine1, InStr(chaine1, "INCR,") + 5)
                    increment = Abs(Val(chaine1))
                End If
            End If
           


            If InStr(buffer, "PPRINT") = 1 Then
       
                chaine1 = Mid(buffer, 7)
                chaine1 = StrConv(chaine1, vbUpperCase)
                chaine2 = "("
                chaine2 = chaine2 + chaine1
                chaine2 = chaine2 & ")"
                sortie.chaine = chaine2
                newvar.etat = 1
                 
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If

            End If



            If InStr(buffer, "INSERT") = 1 Then
       
                chaine2 = Mid(buffer, 8)
                chaine2 = chaine2
                sortie.chaine = chaine2
                newvar.etat = 1

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If



            If InStr(buffer, "PIVOTZ") = 1 Then
       
                If InStr(buffer, "OFF") > 0 Or InStr(buffer, "AUTO") > 0 Then
                Else
                    Call word_pivotz(buffer, newvar)
                    oldvar.px = newvar.px
                    oldvar.py = newvar.py
                    oldvar.pz = newvar.pz
                End If
           
            End If





            If InStr(buffer, "DEFSUB") = 1 Then
       
                If fichier_sortie_etat = 0 Then
               
                    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                    chaine2 = Str(10000 + Val(chaine1))
                    chaine2 = Mid(chaine2, 3)
                    fichier_sortie = fichier_sortie_principal & "S" & chaine2
 
                    If PresenceFichier(path + fichier_sortie + ".tap") <> False Then
                        Set fs = CreateObject("Scripting.FileSystemObject")
                        Set f = fs.GetFile(path + fichier_sortie + ".tap")
                        f.Delete
                    End If

                    Close #Fichier0
                   
                    Fichier0 = FreeFile
                    Open path + fichier_sortie + ".tap" For Append As #Fichier0
   
                    pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                    DoEvents
 
                    sortie.chaine = "%O" & chaine2
                    newvar.etat = 1
                    fichier_sortie_etat = 1
                End If
               
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If



            If InStr(buffer, "ENDSUB") = 1 Then
       
                If fichier_sortie_etat = 1 Then
                    newvar.etat = 0
                    Print #Fichier0, numN + " M99" + vbLf + "%" + vbLf
                    Close #Fichier0
                   
                    fichier_sortie_etat = 0
                    fichier_sortie = fichier_sortie_principal
                   
                    Fichier0 = FreeFile
                    Open path + fichier_sortie + ".tap" For Append As #Fichier0
                   
                    pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                    DoEvents
               
                End If
               
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If



            If InStr(buffer, "CALSUB") = 1 Then
       
                chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                chaine2 = Str(10000 + Val(chaine1))
                chaine2 = Mid(chaine2, 3)

                sortie.chaine = numN + " M98 P" & chaine2
                newvar.etat = 1

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If






            If InStr(buffer, "CLAMP") = 1 Then
           
                If InStr(buffer, "1") > 0 Then
                    If InStr(buffer, "OFF") > 0 Then
                        newvar.cldx = 0
                    Else
                        newvar.cldx = 1
                    End If
                Else
                    If InStr(buffer, "2") > 0 Then
                        If InStr(buffer, "OFF") > 0 Then
                            newvar.clex = 0
                        Else
                            newvar.clex = 1
                        End If
                    Else
                        If InStr(buffer, "OFF") > 0 Then
                            newvar.cldx = 0
                            newvar.clex = 0
                        Else
                            newvar.cldx = 1
                            newvar.clex = 1
                        End If
                    End If
                End If
               
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If






            If InStr(buffer, "CUTTER") = 1 Then
           
                newvar.outil.dia = Val(Mid(buffer, InStr(buffer, "/") + 1, InStr(buffer, ",")))
                newvar.etat = 0

            End If





            If InStr(buffer, "LOADTL") = 1 Then
       
                newvar.outil.ts = liste_outils(i_outil_suivant)
                Call word_loadtl(buffer, newvar, oldvar, sortie)
                i_outil_suivant = i_outil_suivant + 1
                 
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "COOLNT") = 1 Then
       
                If InStr(buffer, "FLOOD") > 0 Then
                        newvar.outil.arr = 1
                End If
               
                If InStr(buffer, "MIST") > 0 Then
                    If InStr(buffer, ",1") > 0 Or InStr(buffer, ",") = 0 Then
                        newvar.outil.arr = 2
                    End If
                    If InStr(buffer, ",2") > 0 Then
                        newvar.outil.arr = 3
                    End If
                    If InStr(buffer, ",3") > 0 Then
                        newvar.outil.arr = 4
                    End If
                End If
               
                If InStr(buffer, "OFF") > 0 Then
                    newvar.outil.arr = 0
                   
                    If newvar.outil.arr <> oldvar.outil.arr Then
                        sortie.chaine = cm9
                    Else
                        sortie.chaine = ""
                    End If
                   
                    newvar.etat = 1
                Else
                    newvar.etat = 0
                End If
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "SPINDL") = 1 Then
       
                Call word_spindl(buffer, oldvar, newvar, sortie)
                 
                If sortie.cetat = 1 And newvar.outil.s <> oldvar.outil.s Then
                    sortie.cetat = 2
                End If
       
            End If




            If InStr(buffer, "COUPLE") = 1 Then
       
                If InStr(buffer, "ON") > 0 Then
           
                    If InStr(buffer, "1") > 0 Then
                        newvar.outil.couple = 1
                    Else
                        newvar.outil.couple = 2
                    End If
               
                Else
           
                    newvar.outil.couple = 0
               
                End If
               
                newvar.etat = 0
                   
                If sortie.cetat = 1 And newvar.outil.couple <> oldvar.outil.couple Then
                    sortie.cetat = 2
                End If

            End If




            If InStr(buffer, "FEDRAT") = 1 Then
       
                Call word_fedrat(buffer, newvar, oldvar, sortie)
               
 '              MsgBox ("fedrat  " + Str(newvar.outil.Forigin))
               
               
                If sortie.cetat = 1 And newvar.outil.Forigin <> oldvar.outil.Forigin Then
                    sortie.cetat = 2
                End If
                   
            End If






            If InStr(buffer, "RAPID") = 1 Then
       
                If newvar.g.g(1) <> 80 Then
                    newvar.g.g(1) = 0
                End If
           
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If




            If InStr(buffer, "CUTCOM") = 1 Then
       
                Call extract_cutcom(buffer, newvar)
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If
       
       


            If InStr(buffer, "GOTO") = 1 Then
               
                Call word_goto(buffer, newvar, oldvar, sortie)
           
            End If





            If InStr(buffer, "INDIRV") > 0 Then
       
                Call extract_indirv(buffer, newvar, oldvar)
                newvar.etat = 0

            End If






            If InStr(buffer, "CIRCLE") > 0 Or InStr(buffer, "CYLNDR") > 0 Then
       
                If sortie.cetat = 10 Then
                    sortie.cetat = 2
                Else
                    Call words_circle_cylndr(buffer, oldvar, newvar, sortie)
                End If
               
            End If





            If InStr(buffer, "HELICAL") > 0 Then
       
                If sortie.cetat = 10 Then
                    sortie.cetat = 2
                Else
                    Call word_helical(buffer, oldvar, newvar, sortie)
                End If
           
            End If




            If InStr(buffer, "MODE") = 1 Then
           
                If InStr(buffer, "HIGH") > 0 Then
                    If InStr(buffer, "OFF") > 0 Then
                        newvar.high = 0
                        If newvar.high_etat = 1 Then
                            newvar.etat = 0
                        Else
                            sortie.chaine = cg51q0
                            newvar.etat = 1
                        End If
                    Else
                        ch1 = Mid(buffer, InStr(buffer, ",") + 1)
                        If InStr(ch1, ",") > 0 Then
                            ch1 = Mid(ch1, 1, InStr(ch1, ",") - 1)
                        End If
                        newvar.high = Val(ch1)
                        If InStr(buffer, "START") > 0 Then
                            newvar.high_etat = 1
                            newvar.etat = 0
                        Else
                            newvar.high_etat = 0
                        End If
                        If newvar.high >= 1 And newvar.high <= 10 And newvar.high_etat = 0 Then
                            sortie.chaine = cg51q1r + Mid(Str(newvar.high), 2)
                            newvar.etat = 1
                        End If
                    End If
                End If
               
                If InStr(buffer, "XYZ") = 0 And InStr(buffer, "HIGH") = 0 Then
                    If InStr(buffer, "OFF") > 0 Then
                        sortie.chaine = "G49G53Z0"
                        newvar.g434etat = 0
                        newvar.etat = 1
                    End If
                    If InStr(buffer, "ON") > 0 Then
                        newvar.g.g(4) = 43.4
                        oldvar.g.g(4) = 1E+100
                        oldvar.g.g(1) = 1E+100
                        oldvar.g.g(3) = 1E+100
                        oldvar.outil.f = 100000000
                        newvar.g434etat = 1
                        newvar.etat = 0
                    End If
                End If
       
            End If





            If InStr(buffer, "REVERS") = 1 Then
       
                If InStr(buffer, "OFF") > 0 Then
                    newvar.g682auto = 0
                    newvar.g682m = 69
                    newvar.g682x = 0
                    newvar.g682y = 0
                    newvar.g682z = 0
                    sortie.chaine = "G69"
                    oldvar.g682m = 69
                    newvar.etat = 1
                Else
                    newvar.g682auto = 1
                    newvar.g682m = 68.2
                    newvar.etat = 0
                End If
               
            End If




            If InStr(buffer, "TOOLNO") = 1 Then
       
                If InStr(buffer, "RADIUS") > 0 Then
                    newvar.outil.d = CInt(Fix(Val(Mid(buffer, InStr(buffer, ",") + 1))))
                Else
                    newvar.outil.h = CInt(Fix(Val(Mid(buffer, InStr(buffer, "/") + 1))))
                    oldvar.outil.corrh = -1
                End If
               
                newvar.etat = 0

            End If




            If InStr(buffer, "STOP") = 1 Then

                sortie.chaine = cm0
                newvar.etat = 1
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "OSTOP") = 1 Then

                sortie.chaine = cm1
                newvar.etat = 1
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If


       
       
            If InStr(buffer, "ROTABL") = 1 Then

                chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

                If InStr(chaine1, "AAXIS") > 0 Then
                    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

                    If InStr(chaine1, ",") > 0 Then
                        chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                    Else
                        chaine2 = chaine1
                    End If

                    newvar.rotdx = Val(chaine2)
                End If

                If InStr(chaine1, "CAXIS") > 0 Then
           
                    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

                    If InStr(chaine1, ",") > 0 Then
                        chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                    Else
                        chaine2 = chaine1
                    End If

                    newvar.rotex = Val(chaine2)
                    newvar.ptf.ex = newvar.rotex
                       
                End If

                newvar.etat = 0
                       
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If




            If InStr(buffer, "MOVETO") = 1 Then
       
                Call word_moveto(buffer, newvar, oldvar, sortie)

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If



            If InStr(buffer, "DELAY") = 1 Then
       
                chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                sortie.chaine = "G4X" + chaine(Val(chaine1))
                newvar.etat = 1
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If
       
       

            If InStr(buffer, "ORIGIN") = 1 Then
       
                Call word_origin(buffer, newvar, oldvar, sortie)
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If


            If InStr(buffer, "CYCLE/OFF") = 1 Then
       
                newvar.g.g(1) = 1E+100
                oldvar.g.g(1) = 1E+100
                newvar.cycle.Gs = 999
                sortie.chaine = numN + cg80
                oldvar.ptf.cx = newvar.cycle.Zaf
                newvar.etat = 1
           
            End If


            If InStr(buffer, "LINTOL") = 1 Then
       
                If InStr(buffer, "OFF") > 0 Then
                    newvar.lintol = 0
                Else
                    newvar.lintol = Val(Mid(buffer, InStr(buffer, "/") + 1))
                End If
           
                newvar.etat = 0
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "CYCLE/BRKCHP") = 1 Or InStr(buffer, "CYCLE/INVERS") = 1 Or _
                InStr(buffer, "CYCLE/LOCK") = 1 Or InStr(buffer, "CYCLE/DRILL") = 1 Or _
                InStr(buffer, "CYCLE/FACE") = 1 Or InStr(buffer, "CYCLE/DEEP") = 1 Or _
                InStr(buffer, "CYCLE/TAP") = 1 Or InStr(buffer, "CYCLE/BORE") = 1 Or _
                InStr(buffer, "CYCLE/REAM") = 1 Or InStr(buffer, "CYCLE/STEP") = 1 Or _
                InStr(buffer, "CYCLE/MANUAL") = 1 Or InStr(buffer, "CYCLE/THRU") = 1 Then
           
                oldvar.cycle.Gs = 999
                Call word_cycle(buffer, newvar)
                newvar.outil.Forigin = newvar.outil.f
                oldvar.outil.f = -1
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If





            If InStr(buffer, "CATMAT") = 1 Then
       
                Call word_catmat(buffer, newvar)
           
                If newvar.g682auto = 1 Then
                    newvar.g682x = newvar.rotb.mat(1, 4) + newvar.rota.mat(1, 4)
                    newvar.g682y = newvar.rotb.mat(2, 4) + newvar.rota.mat(2, 4)
                    newvar.g682z = newvar.rotb.mat(3, 4) + newvar.rota.mat(3, 4)
                    oldvar.ptf.dx = 1E+100
                    oldvar.ptf.ex = 1E+100
                End If
           
                newvar.etat = 0
           
            End If


   

   
            If sortie.cetat = 2 And boucle = 1 Then
           
'                MsgBox ("Fold0 " + Str(oldvar.outil.Forigin) + "  Fnew0 " + Str(newvar.outil.Forigin))
         
                newvar = sortie.imanew1
                oldvar = sortie.imaold1
                newvar.etat = 1
'                MsgBox ("Fold1 " + Str(oldvar.outil.Forigin) + "  Fnew1 " + Str(newvar.outil.Forigin))
               
                Call spcircle(oldvar, newvar, sortie)
                boucle = -1
                sortie.cetat = 0
               
            End If






            If newvar.etat = 1 Then
           
                If fichier_sortie_etat <> -1 Then
           
                    If Len(sortie.Erreur) > 0 Then
                        Print #Fichier0, sortie.Erreur
                    End If
           
                    If Len(sortie.chaine) > 0 Then
                        Print #Fichier0, sortie.chaine
                    End If
           
                    sortie.chaine = ""
                    sortie.Erreur = ""
                   
                Else
                    Close #fichier_entree
                    MsgBox ("PARTNO non défini !")
                    Exit Sub
                End If

            End If


        End If
       
       
       
        If passage = 1 Then
            boucle = 1
            passage = 0
        End If
       

    Loop


    Close #fichier_entree
       
   
    sortie.chaine = numN + cstarr0 + vbLf
   
    If numeroBloc > 0 Then
        sortie.chaine = sortie.chaine + numN + finligne1 + vbLf
    Else
        sortie.chaine = sortie.chaine + cstn + "9999" + finligne1 + vbLf
    End If
    sortie.chaine = sortie.chaine + numN + finligne2 + vbLf
    sortie.chaine = sortie.chaine + numN + finligne3 + vbLf
    If liste_outils(1) <> newvar.outil.tc Then
        sortie.chaine = sortie.chaine + numN + cstt + Mid(Str(10000 + _
        liste_outils(1)), 3) + cm6 + vbLf
    End If
    sortie.chaine = sortie.chaine + numN + finligne4 + vbLf + "%" + vbLf
   
       
    Print #Fichier0, sortie.chaine
   
   
    Close #Fichier0

    pp_saisie.Label1.Caption = "fin traitement"



End Sub




bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty ajouter

Message par bruno18100 Dim 3 Mar 2013 - 1:50

bloc 3:

Code:



Private Sub word_loadtl(buffer As String, varnew As varclass, oldvar As varclass, sortie As sortieclass)


    Dim chaine1 As String
    Dim num1 As Integer
    Dim chaine2, tc As String
         

    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
    If InStr(chaine1, ",") > 0 Then
        chaine1 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        varnew.outil.tc = Val(chaine1)
    Else
        varnew.outil.tc = Val(chaine1)
    End If


    sortie.chaine = ""


    If varnew.outil.tc <> oldvar.outil.tc Then

        If oldvar.outil.tc = 1E+100 Then
            sortie.chaine = sortie.chaine & numN + debutligne1 & vbLf
            sortie.chaine = sortie.chaine & numN + debutligne2 & vbLf
            sortie.chaine = sortie.chaine & numN + debutligne3 & vbLf
        End If
                   
        If oldvar.g682m = 68.2 Then
            sortie.chaine = numN + cg69 & vbLf
            If varnew.high_etat = 1 Then
                sortie.chaine = sortie.chaine + numN + cg51q0 + vbLf
            End If
        End If
        If numeroBloc > 0 Then
            sortie.chaine = sortie.chaine & numN
        Else
            sortie.chaine = sortie.chaine & cstn
            chaine1 = Str(10000 + varnew.outil.tc)
            sortie.chaine = sortie.chaine + Mid(chaine1, 3)
        End If
        sortie.chaine = sortie.chaine & retourChangtOutil & vbLf

        sortie.chaine = sortie.chaine & numN + cm1 & vbLf & numN + cstt
        tc = Str(10000 + varnew.outil.tc)
        tc = Mid(tc, 3)
        sortie.chaine = sortie.chaine + tc & cm6
        If varnew.outil.tc <> varnew.outil.ts Then
            chaine1 = Str(varnew.outil.ts + 10000)
            chaine1 = Mid(chaine1, 3)
            sortie.chaine = sortie.chaine & vbLf & numN + cstt & chaine1
        End If

       
        oldvar = varnew


        varnew.ptf.ax = 1E+100
        varnew.ptf.bx = 1E+100
        varnew.ptf.cx = 1E+100
        varnew.ptf.dx = 0
        varnew.g682m = 69

        varnew.g.g(1) = 1E+100
        varnew.outil.s = -10
        varnew.outil.rot = 3
        varnew.outil.h = varnew.outil.tc
        varnew.outil.corrh = 43
        varnew.outil.d = varnew.outil.tc
       


               
        oldvar.outil.tc = varnew.outil.tc
        oldvar.outil.ts = varnew.outil.ts
        oldvar.outil.h = 1E+100
        oldvar.outil.d = 1E+100
        oldvar.outil.s = 0
        oldvar.outil.arr = 0
        oldvar.cycle.Zaf = 1E+100
        oldvar.g.g(1) = 1E+100
        oldvar.g.g(2) = 1E+100
        oldvar.g.g(3) = 1E+100
        oldvar.g.g(5) = 9999
        oldvar.ptf.ax = 1E+100
        oldvar.ptf.bx = 1E+100
        oldvar.ptf.cx = 1E+100
        oldvar.ptf.dx = 1E+100
        oldvar.ptf.ex = 1E+100
        oldvar.cldx = 1
        oldvar.clex = 1
        oldvar.g682m = 69
    End If

    If varnew.g682auto = 1 Then
        varnew.g682m = 68.2
    End If
    oldvar.outil.f = -1
    If varnew.defaultex <> 1E+100 Then
        oldvar.ptf.ex = 1E+100
    End If

    varnew.etat = 1


End Sub








Private Function chaine(ByVal d As Double) As String
               
    Dim s0 As String
    s0 = ""
    Dim A As Double
    A = d

    If Abs(A) < 0.001 Then
        A = 0
    End If

       
               
    s0 = Str(FormatNumber(A, 3))
               
    If A >= 0 Then
        s0 = Mid(s0, 2)
    End If
               
    If InStr(s0, ".") = 0 Then
        s0 = s0 + "."
    End If
               
       
               
             
 
    chaine = s0

End Function






Private Sub word_goto(buffer As String, newvar As varclass, oldvar As varclass, sortie As sortieclass)

    Dim chaine1 As String
    Dim chaine2 As String
    Dim chaineX As String
    Dim chaineY As String
    Dim chaineZ As String
    Dim chaineI As String
    Dim chaineJ As String
    Dim chaineK As String
       
       
    Dim ptd As pointdebut
    Dim ptf As pointfinal
       

    chaine2 = Mid(buffer, InStr(buffer, "/") + 1)
    chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.x = Val(chaineX)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.y = Val(chaineY)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineZ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.z = Val(chaineZ)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineI = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.i = Val(chaineI)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineJ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.j = Val(chaineJ)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    If InStr(chaine2, "PT") > 0 Then
        chaineK = Mid(chaine2, 1, InStr(chaine2, "PT") - 1)
    Else
        chaineK = chaine2
    End If
    ptd.k = Val(chaineK)




    ptf = CalculPointFinal(ptd, newvar, oldvar)
                 
                 
    If Val(chaine(ptf.ax)) = Val(chaine(oldvar.ptf.ax)) _
        And Val(chaine(ptf.bx)) = Val(chaine(oldvar.ptf.bx)) _
        And Val(chaine(ptf.cx)) = Val(chaine(oldvar.ptf.cx)) _
        And Val(chaine(ptf.dx)) = Val(chaine(oldvar.ptf.dx)) _
        And Val(chaine(ptf.ex)) = Val(chaine(oldvar.ptf.ex)) Then
       
'            MsgBox ("nul")
           
       
    Else

                 
        If sortie.cetat = 1 Then
            sortie.cetat = 2
        Else
               
            newvar.ptf = ptf
            newvar.ptd = ptd
            newvar.rotdx = 1E+100
            newvar.rotex = 1E+100


            If (newvar.g.g(1) <> 0) And (newvar.g.g(1) <> 73) And (newvar.g.g(1) <> 74) And (newvar.g.g(1) <> 76) And _
                (newvar.g.g(1) <> 81) And (newvar.g.g(1) <> 82) And (newvar.g.g(1) <> 83) And (newvar.g.g(1) <> 84) And _
                (newvar.g.g(1) <> 85) And (newvar.g.g(1) <> 86) And (newvar.g.g(1) <> 87) And (newvar.g.g(1) <> 88) And _
                (newvar.g.g(1) <> 89) Then
                   
                newvar.g.g(1) = 1
                   
            End If
                 
       
            If newvar.lintol > 0 And newvar.g.g(1) = 1 And oldvar.ptf.ax <> 1E+100 And oldvar.ptf.bx <> 1E+100 And _
                oldvar.ptf.cx <> 1E+100 Then
               
                Call linearisation(oldvar, newvar, sortie)
                   
            End If


            Call format_sortie(oldvar, newvar, sortie)
       
                 
                 
            If newvar.g.g(1) = 0 Then
               
                var1 = oldvar.g.g(5)
                var2 = oldvar.outil.f
               
                oldvar = newvar
                   
                oldvar.cycle.P = -1
                oldvar.cycle.Q = -1
                oldvar.g.g(5) = var1
                oldvar.outil.f = var2
                       
                newvar.g.g(1) = 1E+100
                       
            Else
                 
                oldvar = newvar
                 
            End If
                 
            newvar.etat = 1
               
        End If
           
    End If
       
       
       
End Sub





Private Function angle(ByVal i As Double, ByVal j As Double) As Double
    Dim i0 As Double
    Dim j0 As Double
    Dim angle_Renamed As Double
    angle_Renamed = 0
    Dim angleR As Double


    If i = 0 Then
        If j > 0 Then
            angle_Renamed = (pi / 2)
        End If
        If j < 0 Then
            angle_Renamed = 0 - (pi / 2)
        End If
        If j = 0 Then
            angle_Renamed = 0
        End If
    End If

    If i > 0 Then
        If j >= 0 Then
            If j <= i Then
                angle_Renamed = Atn(j / i)
            End If
            If j > i Then
                angle_Renamed = (pi / 2) - Atn(i / j)
            End If
        End If

        If j < 0 Then
            j0 = j * (0 - 1)
            If j0 <= i Then
                angle_Renamed = 0 - Atn(j0 / i)
            End If
            If j0 > i Then
                angle_Renamed = 0 - (pi / 2) + Atn(i / j0)
            End If
        End If
    End If

    If i < 0 Then
        i0 = i * (0 - 1)

        If j >= 0 Then
            If j <= i0 Then
                angle_Renamed = pi - Atn(j / i0)
            End If
            If j > i0 Then
                angle_Renamed = (pi / 2) + Atn(i0 / j)
            End If
        End If

        If j < 0 Then
            j0 = j * (0 - 1)
            If j0 <= i0 Then
                angle_Renamed = 0 - pi + Atn(j0 / i0)
            End If
            If j0 > i0 Then
                angle_Renamed = 0 - (pi / 2) - Atn(i0 / j0)
            End If
        End If
    End If

    angleR = angle_Renamed * (180 / pi)



    angle = angleR

End Function





Private Function CalculPointFinal(ptd As pointdebut, varnew As varclass, varold As varclass) As pointfinal

    Dim r4axe1 As Double
    Dim r5axe1 As Double
    Dim tab1(6, 3) As Double
    Dim axy As Double
    Dim ay5z5 As Double
    Dim rij As Double
    Dim x5f As Double
    Dim y5f As Double
    Dim z5f As Double
    Dim ry5z5 As Double
    Dim rxy As Double
    Dim xf1 As Double
    Dim yf1 As Double
    Dim zf1 As Double
    Dim a0 As Double, A1 As Double
    s1 = 0
    Dim a2 As Double
    s2 = 0
    Dim ar As Double, j1 As Double, y1 As Double, ry1k As Double
    Dim rpypz, apypz, raxbx, aaxbx As Double
    Dim etat As Integer
    etat = 0
    Dim i1 As Integer
    i1 = 0
    Dim i2 As Integer
    i2 = 0


    Dim ptf As pointfinal
       
    x0 = varnew.rotb.mat(1, 1) * ptd.x + varnew.rotb.mat(1, 2) * ptd.y + varnew.rotb.mat(1, 3) * ptd.z + varnew.rotb.mat(1, 4)
    y0 = varnew.rotb.mat(2, 1) * ptd.x + varnew.rotb.mat(2, 2) * ptd.y + varnew.rotb.mat(2, 3) * ptd.z + varnew.rotb.mat(2, 4)
    z0 = varnew.rotb.mat(3, 1) * ptd.x + varnew.rotb.mat(3, 2) * ptd.y + varnew.rotb.mat(3, 3) * ptd.z + varnew.rotb.mat(3, 4)
    i0 = varnew.rotb.mat(1, 1) * ptd.i + varnew.rotb.mat(1, 2) * ptd.j + varnew.rotb.mat(1, 3) * ptd.k
    j0 = varnew.rotb.mat(2, 1) * ptd.i + varnew.rotb.mat(2, 2) * ptd.j + varnew.rotb.mat(2, 3) * ptd.k
    k0 = varnew.rotb.mat(3, 1) * ptd.i + varnew.rotb.mat(3, 2) * ptd.j + varnew.rotb.mat(3, 3) * ptd.k
       
    x0 = x0 + varnew.rota.mat(1, 4) - varnew.g682x
    y0 = y0 + varnew.rota.mat(2, 4) - varnew.g682y
    z0 = z0 + varnew.rota.mat(3, 4) - varnew.g682z
       
       
    x = varnew.rota.mat(1, 1) * x0 + varnew.rota.mat(1, 2) * y0 + varnew.rota.mat(1, 3) * z0
    y = varnew.rota.mat(2, 1) * x0 + varnew.rota.mat(2, 2) * y0 + varnew.rota.mat(2, 3) * z0
    z = varnew.rota.mat(3, 1) * x0 + varnew.rota.mat(3, 2) * y0 + varnew.rota.mat(3, 3) * z0
    i = varnew.rota.mat(1, 1) * i0 + varnew.rota.mat(1, 2) * j0 + varnew.rota.mat(1, 3) * k0
    j = varnew.rota.mat(2, 1) * i0 + varnew.rota.mat(2, 2) * j0 + varnew.rota.mat(2, 3) * k0
    k = varnew.rota.mat(3, 1) * i0 + varnew.rota.mat(3, 2) * j0 + varnew.rota.mat(3, 3) * k0
               


    r5axe1 = angle(i, j)


    rij = Sqr((i * i) + (j * j))
       

    r4axe1 = angle(k, rij)


    If (r4axe1 <> 0) Then
        r5axe1 = 90 - r5axe1
    End If


    If r4axe1 = 0 Then
        r5axe1 = varnew.ptf.ex

        If ((varnew.defaultex <> 1E+100) And (varold.ptf.ex = 1E+100)) Or ((varnew.defaultex <> 1E+100) And (varold.ptf.dx <> 0)) Then
            r5axe1 = varnew.defaultex
            etat = 1
        End If


        If varnew.rotex <> 1E+100 Then
            r5axe1 = varnew.rotex
            etat = 1
        End If


    End If





    tab1(1, 2) = varnew.ptf.dx
    tab1(1, 3) = varnew.ptf.ex
    tab1(2, 2) = r4axe1
    tab1(2, 3) = r5axe1
    tab1(2, 1) = Abs(tab1(2, 2) - tab1(1, 2)) + Abs(tab1(2, 3) - tab1(1, 3))
    tab1(3, 2) = r4axe1
    tab1(3, 3) = r5axe1
    tab1(3, 1) = Abs(tab1(3, 2) - tab1(1, 2)) + Abs(tab1(3, 3) - tab1(1, 3))
    tab1(4, 2) = 0 - r4axe1
    tab1(4, 3) = r5axe1 - 180
    tab1(4, 1) = Abs(tab1(4, 2) - tab1(1, 2)) + Abs(tab1(4, 3) - tab1(1, 3))
    tab1(5, 2) = 0 - r4axe1
    tab1(5, 3) = r5axe1 + 180
    tab1(5, 1) = Abs(tab1(5, 2) - tab1(1, 2)) + Abs(tab1(5, 3) - tab1(1, 3))

    i2 = 5

    If (tab1(4, 2) < -30) Or (r4axe1 = 0) Then
        i2 = 2
    End If

    tab1(6, 2) = tab1(2, 2)
    tab1(6, 3) = tab1(2, 3)

    i1 = 2

    Do While i1 <= i2
        If tab1(2, 1) > tab1(i1, 1) Then
            tab1(6, 1) = tab1(i1, 1)
            tab1(6, 2) = tab1(i1, 2)
            tab1(6, 3) = tab1(i1, 3)
        End If
        i1 = i1 + 1
    Loop



    r4axe1 = tab1(6, 2)
    r5axe1 = tab1(6, 3)


    Do While (Abs(r5axe1 - varnew.ptf.ex) > 180) And (etat = 0)
        If varnew.ptf.ex <= 0 Then
            If r5axe1 < varnew.ptf.ex Then
                r5axe1 = r5axe1 + 360
            Else
                r5axe1 = r5axe1 - 360
            End If
        End If
        If varnew.ptf.ex > 0 Then
            If r5axe1 < varnew.ptf.ex Then
                r5axe1 = r5axe1 + 360
            Else
                r5axe1 = r5axe1 - 360
            End If
        End If
    Loop


    rxy = Sqr(((x) * (x)) + ((y) * (y)))

    axy = angle((x), (y))

    x5f = rxy * Cos((axy + r5axe1) * pi / 180)
    y5f = rxy * Sin((axy + r5axe1) * pi / 180)
    z5f = z


    ry5z5 = Sqr((y5f * y5f) + (z5f * z5f))
    ay5z5 = angle(z5f, y5f)

    rpypz = Sqr((varnew.py * varnew.py) + (varnew.pz * varnew.pz))
    apypz = angle(varnew.pz, varnew.py)


    yf1 = ((ry5z5) * Sin((ay5z5 - r4axe1) * pi / 180)) + newvar.py - (rpypz * Sin((apypz - r4axe1) * pi / 180))
    xf1 = x5f
    zf1 = ((ry5z5) * Cos((ay5z5 - r4axe1) * pi / 180)) + newvar.pz - (rpypz * Cos((apypz - r4axe1) * pi / 180))


    ptf.ax = xf1
    ptf.bx = yf1
    ptf.cx = zf1
    ptf.dx = r4axe1
    ptf.ex = r5axe1

    If varnew.g434etat = 1 Then
        ptf.ax = x
        ptf.bx = y
        ptf.cx = z
    End If
       

    CalculPointFinal = ptf

End Function







Private Sub calculavance(oldvar As varclass, varnew As varclass, parg5 As String, sfed As String)

    parg5 = ""

    If (varnew.outil.couple = 1) Or (varnew.outil.couple = 2) Then
   
        y = Sqr((varnew.ptc.ix * varnew.ptc.ix) + (varnew.ptc.jx * varnew.ptc.jx))

        If varnew.outil.corrd = 41 Then
            If varnew.g.g(1) = 3 Then
                varnew.outil.f = varnew.outil.Forigin * y / (y + (varnew.outil.dia / 2))
                If CInt(Fix(varnew.outil.f)) = 0 Then
                    varnew.outil.f = 1
                End If
            End If
            If varnew.g.g(1) = 2 Then
                z = y - (varnew.outil.dia / 2)
                If z = 0 Then
                    varnew.outil.f = varnew.outil.Forigin * 2
                Else
                    varnew.outil.f = varnew.outil.Forigin * y / (y - (varnew.outil.dia / 2))
                    If varnew.outil.f > (varnew.outil.Forigin * 2) Then
                        varnew.outil.f = varnew.outil.Forigin * 2
                    End If
                End If
                If varnew.outil.couple = 2 Then
                    varnew.outil.f = varnew.outil.Forigin
                End If
            End If
        End If
       
        If varnew.outil.corrd = 42 Then
            If varnew.g.g(1) = 3 Then
                z = y - (varnew.outil.dia / 2)
                If z = 0 Then
                    varnew.outil.f = varnew.outil.Forigin * 2
                Else
                    varnew.outil.f = varnew.outil.Forigin * y / (y - (varnew.outil.dia / 2))
                    If varnew.outil.f > (varnew.outil.Forigin * 2) Then
                        varnew.outil.f = varnew.outil.Forigin * 2
                    End If
                End If

                If varnew.outil.couple = 2 Then
                    varnew.outil.f = varnew.outil.Forigin
                End If
            End If
            If varnew.g.g(1) = 2 Then
                varnew.outil.f = varnew.outil.Forigin * y / (y + (varnew.outil.dia / 2))
                If CInt(Fix(varnew.outil.f)) = 0 Then
                    varnew.outil.f = 1
                End If
            End If
        End If
       
        If varnew.outil.corrd = 40 Or varnew.g.g(1) = 1 Then
            varnew.outil.f = varnew.outil.Forigin
        End If
       
    End If



    If varnew.outil.couple = 0 Then
        varnew.outil.f = varnew.outil.Forigin
    End If



    If (varnew.finvers = 1) And (varnew.g.g(1) = 1) Then

        var1 = Val(chaine(Sqr((varnew.ptd.x - oldvar.ptd.x) * (varnew.ptd.x - oldvar.ptd.x)) _
        + ((varnew.ptd.y - oldvar.ptd.y) * (varnew.ptd.y - oldvar.ptd.y)) _
        + ((varnew.ptd.z - oldvar.ptd.z) * (varnew.ptd.z - oldvar.ptd.z))))
                       
        If var1 = 0 Then
            A = Abs(Val(chaine((varnew.ptf.ex - oldvar.ptf.ex))))
            R = Val(chaine(Sqr((varnew.ptd.x * varnew.ptd.x) + (varnew.ptd.y * varnew.ptd.y))))
            If A > 0 Then
                If R > 0 Then
                    varnew.outil.f = varnew.outil.Forigin / (R * (A / 180 * pi))
                    varnew.g.g(5) = 93
                Else
                    varnew.outil.f = varnew.outil.Forigin
                    varnew.g.g(5) = 94
                End If
            End If
           
        Else
       
            If varnew.lintol = 0 Then
                A = Abs(Val(chaine((varnew.ptf.ex - oldvar.ptf.ex))))
                R1 = Val(chaine(Sqr((oldvar.ptd.x * oldvar.ptd.x) + (oldvar.ptd.y * oldvar.ptd.y))))
                R2 = Val(chaine(Sqr((varnew.ptd.x * varnew.ptd.x) + (varnew.ptd.y * varnew.ptd.y))))
                If A > 0 And Val(chaine((varnew.ptf.dx - oldvar.ptf.dx))) = 0 Then
                    If R1 = R2 And R1 > 0 Then
                        varnew.outil.f = varnew.outil.Forigin / Sqr(((R1 * (A / 180 * pi)) * (R1 * (A / 180 * pi))) _
                        + ((varnew.ptd.z - oldvar.ptd.z) * (varnew.ptd.z - oldvar.ptd.z)))
                        varnew.g.g(5) = 93
                    Else
                        varnew.outil.f = varnew.outil.Forigin
                        varnew.g.g(5) = 94
                    End If
                Else
                    varnew.outil.f = varnew.outil.Forigin
                    varnew.g.g(5) = 94
                End If
            Else
                If (Abs(Val(chaine((varnew.ptf.dx - oldvar.ptf.dx)))) + _
                Abs(Val(chaine((varnew.ptf.ex - oldvar.ptf.ex))))) > 0 Then
                   
                    varnew.outil.f = varnew.outil.Forigin / var1
                    varnew.g.g(5) = 93
                Else
                    varnew.outil.f = varnew.outil.Forigin
                    varnew.g.g(5) = 94
                End If
            End If
        End If
       
    End If


    If varnew.g.g(5) <> oldvar.g.g(5) Then
        If varnew.g.g(5) = 94 Then
            parg5 = cg94
        Else
            parg5 = cg93
        End If
    End If
   
    If CLng(varnew.outil.f) < Fmini Then
        varnew.outil.f = Fmini
    End If
   
    If CLng(varnew.outil.f) > Fmaxi Then
        varnew.outil.f = Fmaxi
    End If
   

    If CLng(varnew.outil.f) <> CLng(oldvar.outil.f) Then
        sfed = cavance + Mid(Str(CLng(varnew.outil.f)), 2)
    Else
        sfed = ""
    End If


    If (varnew.g.g(5) = 93) And (varnew.g.g(1) = 1) Then
        If varnew.outil.f <> oldvar.outil.f Then
            sfed = cavance & chaine(varnew.outil.f)
        Else
            sfed = ""
        End If
    End If



End Sub








Private Sub linearisation(oldvar As varclass, newvar As varclass, sortie As sortieclass)

    Dim var1 As varclass
    Dim var2 As varclass
    Dim pA As pointdebut
    Dim pB As pointdebut
    Dim p1 As pointdebut
    Dim pfA As pointfinal
    Dim pfB As pointfinal
    Dim pf1 As pointfinal
    Dim pf2 As pointfinal
    Dim pf3 As pointfinal
    Dim pr1 As pointfinal
    Dim p01 As pointfinal
    Dim p01r As pointfinal
    Dim E1, AA, AB, BA, BB, A1, B1, C1 As Double
    Dim linetat As Integer

    oldvar.rota = newvar.rota
    oldvar.rotb = newvar.rotb
    var1 = newvar
    var2 = newvar
    pB = newvar.ptd
    linetat = 1
    i1 = 0

    While linetat > 0 And i1 < 1000

        pA = oldvar.ptd
        pfA = oldvar.ptf
        pfB = CalculPointFinal(pB, oldvar, oldvar)
 
        p1.x = pA.x + ((pB.x - pA.x) / 2)
        p1.y = pA.y + ((pB.y - pA.y) / 2)
        p1.z = pA.z + ((pB.z - pA.z) / 2)
   
        AA = 90 - pfA.ex
        BA = 90 - pfB.ex
        AB = pfA.dx
        BB = pfB.dx
   
   
        A1 = AA + ((BA - AA) / 2)
        B1 = AB + ((BB - AB) / 2)
   
        p1.i = Sin(B1 * pi / 180) * Cos(A1 * pi / 180)
        p1.j = Sin(B1 * pi / 180) * Sin(A1 * pi / 180)
        p1.k = Cos(B1 * pi / 180)
 
        pf1 = CalculPointFinal(p1, oldvar, oldvar)


        pr1.ax = pfA.ax + ((pfB.ax - pfA.ax) / 2)
        pr1.bx = pfA.bx + ((pfB.bx - pfA.bx) / 2)
        pr1.cx = pfA.cx + ((pfB.cx - pfA.cx) / 2)
   
   
        E1 = Sqr(((pr1.ax - pf1.ax) * (pr1.ax - pf1.ax)) + ((pr1.bx - pf1.bx) * (pr1.bx - pf1.bx)) _
        + ((pr1.cx - pf1.cx) * (pr1.cx - pf1.cx)))
        E1 = Val(chaine(E1))
   
   
        If E1 <= newvar.lintol Then
       
            If Val(chaine(pfB.ax)) = Val(chaine(newvar.ptf.ax)) And _
            Val(chaine(pfB.bx)) = Val(chaine(newvar.ptf.bx)) And _
            Val(chaine(pfB.cx)) = Val(chaine(newvar.ptf.cx)) And _
            Val(chaine(pfB.dx)) = Val(chaine(newvar.ptf.dx)) And _
            Val(chaine(pfB.ex)) = Val(chaine(newvar.ptf.ex)) Then
                linetat = 0
           
            Else
                   
                var1.ptd = pB
                var1.ptf = pfB
                Call format_sortie(oldvar, var1, sortie)
                oldvar = var1
                pB = newvar.ptd
               
            End If
        Else
            pB = p1
        End If
       
        i1 = i1 + 1
    Wend


End Sub




bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty ajouter

Message par bruno18100 Dim 3 Mar 2013 - 1:53

bloc 4:

Code:



Private Sub format_sortie(oldvar As varclass, varnew As varclass, sortie As sortieclass)


    Dim ch1 As String
    ch1 = ""
    Dim varptf As pointfinal
         

    Dim parg1 As String
    Dim parg2 As String
    Dim parg3 As String, parg4 As String
    parg4 = ""
    Dim parg5 As String
    parg5 = ""
    Dim sarr As String
    sarr = ""

    Dim tc As String
    Dim ax As String
    Dim bx As String
    Dim cx As String
    Dim dx As String
    Dim ex As String
    Dim xx As String
    Dim yx As String
    Dim zx As String
    Dim ix As String
    Dim jx As String
    Dim tc2 As String
    Dim ssrot As String
    Dim sh As String
    Dim scorrh As String
    Dim sfed As String
    Dim sd As String
    Dim scorrd As String
    Dim sab As String
    Dim sde As String
    Dim scx1 As String
    Dim scx2 As String
    Dim sGs As String
    Dim sZp As String
    Dim sZr As String
    Dim sQ, sP As String
    Dim scldx1 As String
    Dim scldx2 As String
    Dim sclex1 As String
    Dim sclex2 As String
    Dim sg682 As String
    Dim sg51on As String
    Dim sg51off As String
    sg682 = ""
    Dim sg682f As String
    sg682f = ""
    Dim y As Double
    Dim z As Double
    Dim tcn As Double
    Dim ncx1 As Double
    Dim ncx2 As Double



    If varnew.outil.s <> oldvar.outil.s Then
   
        ssrot = cvitesse + Mid(Str(varnew.outil.s), 2)
         
        Select Case varnew.outil.rot
            Case 3
                ssrot = ssrot + cm3
            Case 4
                ssrot = ssrot + cm4
            Case 5
                ssrot = cm5
        End Select
         
    Else
        ssrot = ""
    End If



    If (varnew.outil.h <> oldvar.outil.h) Or (varnew.g.g(4) <> oldvar.g.g(4)) Then
   
        sh = csth + Mid(Str(varnew.outil.h), 2)

        Select Case varnew.outil.corrh
            Case 43
                scorrh = cg43
            Case 43.4
                scorrh = cg434
            Case 49
                scorrh = cg49
        End Select
         
    Else
        sh = ""
        scorrh = ""
    End If

       
       
    If varnew.outil.corrd <> oldvar.outil.corrd Then
   
        If varnew.outil.corrd <> 40 Then
            sd = cstd + Mid(Str(varnew.outil.d), 2)
        Else
            sd = ""
        End If
         
        Select Case varnew.outil.corrd
            Case 41
                scorrd = cg41
            Case 42
                scorrd = cg42
            Case 40
                scorrd = cg40
        End Select
         
    Else
        sd = ""
        scorrd = ""
    End If

       
       
       
       
       
    If varnew.outil.arr <> oldvar.outil.arr Then
   
          sarr = newvar.outil.code_arr(newvar.outil.arr)
         
    Else
        sarr = ""
    End If




    If varnew.g.g(1) <> oldvar.g.g(1) Then
                   
    Select Case varnew.g.g(1)
        Case 0
            parg1 = cg0
        Case 1
            parg1 = cg1
        Case 2
            parg1 = cg2
        Case 3
            parg1 = cg3
        Case 73
            parg1 = cg73
        Case 74
            parg1 = cg74
        Case 76
            parg1 = cg76
        Case 81
            parg1 = cg81
        Case 82
            parg1 = cg82
        Case 83
            parg1 = cg83
        Case 84
            parg1 = cg84
        Case 85
            parg1 = cg85
        Case 86
            parg1 = cg86
        Case 87
            parg1 = cg87
        Case 88
            parg1 = cg88
        Case 89
            parg1 = cg89
        End Select

    Else
        parg1 = ""
    End If



    If varnew.g.g(2) <> oldvar.g.g(2) Then
       
        If varnew.g.g(2) >= 101 And varnew.g.g(2) <= 148 Then
            parg2 = cg541p + Mid(Str(varnew.g.g(2) - 100), 2)
        Else
       
            Select Case varnew.g.g(2)
            Case 52
                parg2 = cg52
            Case 53
                parg2 = cg53
            Case 54
                parg2 = cg54
            Case 55
                parg2 = cg55
            Case 56
                parg2 = cg56
            Case 57
                parg2 = cg57
            Case 58
                parg2 = cg58
            Case 59
                parg2 = cg59
            End Select
           
        End If
       
    Else
        parg2 = ""
    End If
         
       
       
    If varnew.g.g(3) <> oldvar.g.g(3) Then
   
        parg3 = cg90
       
    Else
        parg3 = ""
    End If



    If varnew.g.g(4) <> oldvar.g.g(4) Then
         
        Select Case varnew.g.g(4)
            Case 43.4
                parg4 = cg434
            Case 49
                parg4 = cg49
        End Select
         
    Else
        parg4 = ""
    End If


       
       
    If varnew.g.g(5) <> oldvar.g.g(5) Then
         
        Select Case varnew.g.g(5)
            Case 93
                parg5 = cg93
            Case 94
                parg5 = cg94
        End Select
         
    Else
        parg5 = ""
    End If



    y = Val(chaine(varnew.ptf.ax))
    z = Val(chaine(oldvar.ptf.ax))

    If Abs(varnew.ptf.ax) > 999999.999 Then
        sortie.Erreur = sortie.Erreur & vbLf & "M00( DEPASSEMENT COORDONNEE X )"
    End If


    If (y <> z) Or (varnew.g434etat = 1) Then
        ax = cstx + chaine(varnew.ptf.ax)
    Else
        ax = ""
    End If

    y = Val(chaine(varnew.ptf.bx))
    z = Val(chaine(oldvar.ptf.bx))

    If Abs(varnew.ptf.bx) > 999999.999 Then
        sortie.Erreur = sortie.Erreur & vbLf & "M00( DEPASSEMENT COORDONNEE Y )"
    End If

    If (y <> z) Or (varnew.g434etat = 1) Then
        bx = csty + chaine(varnew.ptf.bx)
    Else
        bx = ""
    End If

    y = Val(chaine(varnew.ptf.cx))
    z = Val(chaine(oldvar.ptf.cx))
         
    If Abs(varnew.ptf.cx) > 999999.999 Then
        sortie.Erreur = sortie.Erreur & vbLf & "M00( DEPASSEMENT COORDONNEE Z )"
    End If

    If (y <> z) Or (varnew.g434etat = 1) Then
        cx = cstz + chaine(varnew.ptf.cx)
    Else
        cx = ""
    End If

    If Abs(varnew.ptc.ix) > 999999.999 Then
        sortie.Erreur = sortie.Erreur & vbLf & "M00( DEPASSEMENT COORDONNEE I )"
    End If


    ix = csti + chaine(varnew.ptc.ix)


    If Abs(varnew.ptc.jx) > 999999.999 Then
        sortie.Erreur = sortie.Erreur & vbLf & "M00( DEPASSEMENT COORDONNEE J )"
    End If

    jx = cstj + chaine(varnew.ptc.jx)


    y = Val(chaine(varnew.ptf.dx))
    z = Val(chaine(oldvar.ptf.dx))

    If Abs(varnew.ptf.dx) > 999999.999 Then
        sortie.Erreur = sortie.Erreur & vbLf & "M00( DEPASSEMENT COORDONNEE A )" & vbLf
    End If


    If (y <> z) Or (varnew.g434etat = 1) Then
        dx = csta + chaine(varnew.ptf.dx)
    Else
        dx = ""
    End If

    y = Val(chaine(varnew.ptf.ex))
    z = Val(chaine(oldvar.ptf.ex))

    If Abs(varnew.ptf.ex) > 999999.999 Then
        sortie.Erreur = sortie.Erreur & vbLf & "M00( DEPASSEMENT COORDONNEE C )" & vbLf
    End If

    If (y <> z) Or (varnew.g434etat = 1) Then
        ex = cstc + chaine(varnew.ptf.ex)
    Else
        ex = ""
    End If


    scldx1 = ""
    scldx2 = ""
    sclex1 = ""
    sclex2 = ""



    If InStr(dx, csta) > 0 Then
   
        If varnew.cldx = 0 Then
            If oldvar.cldx = 1 Then
                scldx1 = caunclamp
            Else
                scldx1 = ""
            End If
            scldx2 = ""
        Else
            If oldvar.cldx = 1 Then
                scldx1 = caunclamp
            Else
                scldx1 = ""
            End If
            scldx2 = caclamp
        End If

    End If




    If InStr(ex, cstc) > 0 Then
         
        If varnew.clex = 0 Then
            If oldvar.clex = 1 Then
                sclex1 = ccunclamp
            Else
                sclex1 = ""
            End If
            sclex2 = ""
        Else
            If oldvar.clex = 1 Then
                sclex1 = ccunclamp
            Else
                sclex1 = ""
            End If
            sclex2 = ccclamp
        End If

    End If


    sg682f = ""

    ch1 = dx + ex
         
    sg51on = ""
    sg51off = ""
         
         



    If (Len(ch1) > 0) And (varnew.g682auto = 1) Then
   
        x = varnew.rota.mat(1, 1) * varnew.g682x + varnew.rota.mat(1, 2) * varnew.g682y + varnew.rota.mat(1, 3) * varnew.g682z
        y = varnew.rota.mat(2, 1) * varnew.g682x + varnew.rota.mat(2, 2) * varnew.g682y + varnew.rota.mat(2, 3) * varnew.g682z
        z = varnew.rota.mat(3, 1) * varnew.g682x + varnew.rota.mat(3, 2) * varnew.g682y + varnew.rota.mat(3, 3) * varnew.g682z
         
        If varnew.high_etat = 1 Then
            sg51off = numN + cg51q0
            sg51on = numN + cg51q1r + Mid(Str(varnew.high), 2)
        End If
       
        If Val(chaine(varnew.ptf.dx)) = 0 And Val(chaine(varnew.ptf.ex)) = 0 Then
            chaine1 = numN + cg682 + cstx & chaine(x) & csty & chaine(y) _
            & cstz & chaine(z) & "I90.J0.K-90." & vbLf & numN + cg531
            If Len(sg51on) > 1 Then
                sg682 = sg51on + vbLf + chaine1
            Else
                sg682 = chaine1
            End If
        Else
            chaine1 = numN + cg682 + cstx & chaine(x) & csty & chaine(y) _
            & cstz & chaine(z) & csti & chaine(varnew.ptf.ex) _
            & cstj & chaine(varnew.ptf.dx) & "K0" & vbLf & numN + cg531
            If Len(sg51on) > 1 Then
                sg682 = sg51on + vbLf + chaine1
            Else
                sg682 = chaine1
            End If
        End If
       
        If oldvar.g682m = 68.2 Then
            If Len(sg51off) > 1 Then
                sg682f = numN + cg69 + vbLf + sg51off
            Else
                sg682f = numN + cg69
            End If
        End If
       
    End If



    Call calculavance(oldvar, varnew, parg5, sfed)
   




    If ((varnew.g.g(1) = 0) Or (varnew.g.g(1) = 80)) And (varnew.g434etat = 0) Then


        If sarr <> "" Then
          sortie.chaine = sortie.chaine + numN + sarr + vbLf
        End If

        scxnew = chaine(varnew.ptf.cx)
        ncxnew = Val(scxnew)

        scxold = chaine(oldvar.ptf.cx)
        ncxold = Val(scxold)

        sab = ax
        sab = sab + bx
        sab = sab + ssrot
        sde = dx + ex


        If ncxold > ncxnew Then
            If Len(sg682f) > 1 Then
                sortie.chaine = sortie.chaine + sg682f + vbLf
            End If
            If Len(scldx1) > 1 Then
                sortie.chaine = sortie.chaine + numN + scldx1 + vbLf
            End If
            If Len(sclex1) > 1 Then
                sortie.chaine = sortie.chaine + numN + sclex1 + vbLf
            End If
            If Len(sde) > 1 Then
                sortie.chaine = sortie.chaine + numN + parg1 + parg2 + parg3 + sde + vbLf
            End If
            If Len(sg682) > 1 Then
                sortie.chaine = sortie.chaine + sg682 + vbLf
            End If
            If Len(scldx2) > 1 Then
                sortie.chaine = sortie.chaine + numN + scldx2 + vbLf
            End If
            If Len(sclex2) > 1 Then
                sortie.chaine = sortie.chaine + numN + sclex2 + vbLf
            End If
            If Len(sab) > 1 Then
                If Len(sde) > 1 Then
                    sortie.chaine = sortie.chaine + numN + sab + vbLf
                Else
                    sortie.chaine = sortie.chaine + numN + parg1 + parg2 + parg3 + sab + vbLf
                End If
            End If
            sortie.chaine = sortie.chaine + numN + scorrh
            sortie.chaine = sortie.chaine + cx
            sortie.chaine = sortie.chaine + sh
        End If



        If ncxnew > ncxold Then
            sortie.chaine = sortie.chaine + numN + parg1 + parg2 + parg3
            sortie.chaine = sortie.chaine + scorrh
            sortie.chaine = sortie.chaine + cx
            sortie.chaine = sortie.chaine + sh
            If Len(sg682f) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + sg682f
            End If
            If Len(scldx1) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + numN + scldx1
            End If
            If Len(sclex1) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + numN + sclex1
            End If
            If Len(sde) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + numN + sde
            End If
            If Len(sg682) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + sg682
            End If
            If Len(scldx2) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + numN + scldx2
            End If
            If Len(sclex2) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + numN + sclex2
            End If
            If Len(sab) > 1 Then
                sortie.chaine = sortie.chaine + vbLf + numN + sab
            End If
        End If



        If ncxnew = ncxold Then
            If Len(sg682f) > 1 Then
                sortie.chaine = sortie.chaine + sg682f + vbLf
            End If
            If Len(scldx1) > 1 Then
                sortie.chaine = sortie.chaine + numN + scldx1 + vbLf
            End If
            If Len(sclex1) > 1 Then
                sortie.chaine = sortie.chaine + numN + sclex1 + vbLf
            End If
            If Len(sde) > 1 Then
                sortie.chaine = sortie.chaine + numN + parg1 + parg2 + parg3 + sde + vbLf
            End If
            If Len(sg682) > 1 Then
                sortie.chaine = sortie.chaine + sg682 + vbLf
            End If
            If Len(scldx2) > 1 Then
                sortie.chaine = sortie.chaine + numN + scldx2 + vbLf
            End If
            If Len(sclex2) > 1 Then
                sortie.chaine = sortie.chaine + numN + sclex2 + vbLf
            End If
            If Len(sab) > 1 Then
                If Len(sde) > 1 Then
                    sortie.chaine = sortie.chaine + numN + sab
                Else
                    sortie.chaine = sortie.chaine + numN + parg1 + parg2 + parg3 + sab
                End If
            End If
        End If
       
    End If




    If (varnew.g.g(1) = 0) And (varnew.g434etat = 1) Then

        If Len(ssrot) > 1 Then
            sortie.chaine = sortie.chaine + numN + ssrot + vbLf
        End If
        If Len(scldx1) > 1 Then
            sortie.chaine = sortie.chaine + numN + scldx1 + vbLf
        End If
        If Len(sclex1) > 1 Then
            sortie.chaine = sortie.chaine + numN + sclex1 + vbLf
        End If
        sortie.chaine = sortie.chaine + numN + parg1 + parg3 + parg4
        sortie.chaine = sortie.chaine + ax
        sortie.chaine = sortie.chaine + bx
        sortie.chaine = sortie.chaine + cx
        sortie.chaine = sortie.chaine + dx
        sortie.chaine = sortie.chaine + ex
        sortie.chaine = sortie.chaine + sh
        sortie.chaine = sortie.chaine + sd
        If Len(scldx2) > 1 Then
            sortie.chaine = sortie.chaine + vbLf + numN + scldx2
        End If
        If Len(sclex2) > 1 Then
            sortie.chaine = sortie.chaine + vbLf + numN + sclex2
        End If
                         
    End If




    If (varnew.g.g(1) = 1) And (varnew.g434etat = 1) Then

        If Len(ssrot) > 0 Then
            sortie.chaine = sortie.chaine + numN + ssrot + vbLf
        End If
                         
        If Len(scldx1) > 0 Then
            sortie.chaine = sortie.chaine + numN + scldx1 + vbLf
        End If
        If Len(sclex1) > 1 Then
            sortie.chaine = sortie.chaine + numN + sclex1 + vbLf
        End If
        sortie.chaine = sortie.chaine + numN + parg1 + parg3 + parg4
        sortie.chaine = sortie.chaine + ax
        sortie.chaine = sortie.chaine + bx
        sortie.chaine = sortie.chaine + cx
        sortie.chaine = sortie.chaine + dx
        sortie.chaine = sortie.chaine + ex
        sortie.chaine = sortie.chaine + sh
        sortie.chaine = sortie.chaine + sd
        sortie.chaine = sortie.chaine + sfed
        If Len(scldx2) > 0 Then
            sortie.chaine = sortie.chaine + vbLf + numN + scldx2
        End If
        If Len(sclex2) > 0 Then
            sortie.chaine = sortie.chaine + vbLf + numN + sclex2
        End If
                                 
    End If





    If (varnew.g.g(1) = 1) And (varnew.g434etat = 0) Then
       
        If Len(sortie.chaine) > 0 Then
            sortie.chaine = sortie.chaine + vbLf
        End If
        If Len(ssrot) > 0 Then
            sortie.chaine = sortie.chaine + numN + ssrot + vbLf
        End If
        If Len(scldx1) > 0 Then
            sortie.chaine = sortie.chaine + numN + scldx1 + vbLf
        End If
        If Len(sclex1) > 0 Then
            sortie.chaine = sortie.chaine + numN + sclex1 + vbLf
        End If
        sortie.chaine = sortie.chaine + numN + parg1 + parg2 + parg3 + parg5
        sortie.chaine = sortie.chaine + scorrd
        sortie.chaine = sortie.chaine + ax
        sortie.chaine = sortie.chaine + bx
        sortie.chaine = sortie.chaine + cx
        sortie.chaine = sortie.chaine + dx
        sortie.chaine = sortie.chaine + ex
        sortie.chaine = sortie.chaine + sd
        sortie.chaine = sortie.chaine + sfed
        If Len(scldx2) > 0 Then
            sortie.chaine = sortie.chaine + vbLf + numN + scldx2
        End If
        If Len(sclex2) > 0 Then
            sortie.chaine = sortie.chaine + vbLf + numN + sclex2
        End If

    End If





    If varnew.g.g(1) = 2 Or varnew.g.g(1) = 3 Then

        If varnew.etat = 1 Then
                 
            If Len(sortie.chaine) > 0 Then
                sortie.chaine = sortie.chaine + vbLf
            End If
            If Len(ssrot) > 2 Then
                sortie.chaine = sortie.chaine + numN + ssrot + vbLf
            End If
            sortie.chaine = sortie.chaine + numN + parg1 + parg3 + parg4 + parg5
            sortie.chaine = sortie.chaine + ax
            sortie.chaine = sortie.chaine + bx
            sortie.chaine = sortie.chaine + cx
            sortie.chaine = sortie.chaine + ix
            sortie.chaine = sortie.chaine + jx
            sortie.chaine = sortie.chaine + sfed
        End If

    End If
       
         




         
    If (varnew.g.g(1) = 73) Or (varnew.g.g(1) = 74) Or (varnew.g.g(1) = 76) Or (varnew.g.g(1) = 81) Or (varnew.g.g(1) = 82) Or (varnew.g.g(1) = 83) Or (varnew.g.g(1) = 84) Or (varnew.g.g(1) = 85) Or (varnew.g.g(1) = 86) Or (varnew.g.g(1) = 87) Or (varnew.g.g(1) = 88) Or (varnew.g.g(1) = 89) Then
         
        varnew.cycle.Zaf = Val(chaine(varnew.ptf.cx + varnew.cycle.Za))
       
         
        If Val(chaine(varnew.cycle.Zaf)) <> Val(chaine(oldvar.cycle.Zaf)) Then
           
            If Val(chaine(oldvar.ptf.cx)) <> Val(chaine(varnew.cycle.Zaf)) Then
                oldvar.ptf.cx = oldvar.cycle.Zaf
            End If
            var1 = varnew.g.g(1)
            varptf = varnew.ptf
            If oldvar.g.g(1) <> 0 And oldvar.g.g(1) <> 1 And oldvar.g.g(1) <> 1E+100 Then
                sortie.chaine = sortie.chaine + numN + cg80 + vbLf
            End If
            varnew.g.g(1) = 0
            varnew.ptf.cx = varnew.cycle.Zaf
            Call format_sortie(oldvar, varnew, sortie)
            oldvar.ptf = varnew.ptf
            varnew.g.g(1) = var1
            oldvar.g.g(1) = 1E+100
            varnew.ptf = varptf
            oldvar.cycle.Gs = 1E+100
            oldvar.cycle.Zaf = varnew.cycle.Zaf
            Call format_sortie(oldvar, varnew, sortie)
               
        Else
         
            yx = chaine(varnew.ptf.cx + varnew.cycle.Zp)
            zx = chaine(oldvar.ptf.cx + oldvar.cycle.Zp)
            y = Val(yx)
            z = Val(zx)

            If y <> z Or Len(parg1) > 0 Then
                sZp = cstz
                sZp = sZp + yx
            Else
                sZp = ""
            End If

            yx = chaine(varnew.ptf.cx + varnew.cycle.Zr)
            zx = chaine(oldvar.ptf.cx + oldvar.cycle.Zr)
            y = Val(yx)
            z = Val(zx)

            If y <> z Or Len(parg1) > 0 Then
                sZr = cst_r
                sZr = sZr + yx
            Else
                sZr = ""
            End If


            sQ = ""

            If (varnew.g.g(1) = 73) Or (varnew.g.g(1) = 76) Or (varnew.g.g(1) = 83) Then

                yx = chaine(varnew.cycle.Q)
                zx = chaine(oldvar.cycle.Q)
                y = Val(yx)
                z = Val(zx)

                If y <> z Or Len(parg1) > 0 Then
                    sQ = cstq
                    sQ = sQ + yx
                End If
               
            End If
               
               
            sP = ""

            If (varnew.g.g(1) = 82) Or (varnew.g.g(1) = 89) Or (varnew.g.g(1) = 88) Then

                yx = chaine(varnew.cycle.P)
                zx = chaine(oldvar.cycle.P)
                y = Val(yx)
                z = Val(zx)

                If y <> z Or Len(parg1) > 0 Then
                    sQ = cstp
                    sQ = sQ + yx
                End If
                   
            End If


            If varnew.cycle.Gs <> oldvar.cycle.Gs Then
       
                Select Case varnew.cycle.Gs
                    Case 98
                        sGs = cg98
                    Case 99
                        sGs = cg99
                End Select
            Else
                sGs = ""
            End If
       
            If Len(sortie.chaine) > 0 Then
                sortie.chaine = sortie.chaine + vbLf
            End If
           
         
            If Len(scldx1) > 0 Then
                sortie.chaine = sortie.chaine + numN + scldx1 + vbLf
            End If
            sortie.chaine = sortie.chaine + numN + parg1 + parg5
            sortie.chaine = sortie.chaine + sGs
            sortie.chaine = sortie.chaine + ax
            sortie.chaine = sortie.chaine + bx
            sortie.chaine = sortie.chaine + dx
            sortie.chaine = sortie.chaine + sZp
            sortie.chaine = sortie.chaine + sQ
            sortie.chaine = sortie.chaine + sP
            sortie.chaine = sortie.chaine + sZr
            sortie.chaine = sortie.chaine + sfed
            If Len(scldx2) > 0 Then
                sortie.chaine = sortie.chaine + scldx2
            End If

        End If

    End If


    If (InStr(sortie.chaine, parg1) > 0) And (Len(sortie.chaine) = (Len(parg1) + 1)) Then
        sortie.chaine = ""
    End If

       
End Sub





bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty ajouter

Message par bruno18100 Dim 3 Mar 2013 - 1:54

bloc 5:

Code:



Private Sub extract_indirv(ByVal buffer As String, varnew As varclass, oldvar As varclass)
               
               
    Dim Pindirv As pointdebut
    Dim chaine1 As String
    Dim chaineI As String
    Dim chaineJ As String
    Dim chaineK As String


    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
    chaineI = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
    Pindirv.x = Val(chaineI) + varnew.ptd.x

    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
    chaineJ = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
    Pindirv.y = Val(chaineJ) + varnew.ptd.y

    chaineK = Mid(chaine1, InStr(chaine1, ",") + 1)
    Pindirv.z = Val(chaineK) + varnew.ptd.z

    Pindirv.i = varnew.ptd.i
    Pindirv.j = varnew.ptd.j
    Pindirv.k = varnew.ptd.k


    varnew.ptfa = CalculPointFinal(Pindirv, varnew, oldvar)

       
End Sub






Private Sub words_circle_cylndr(buffer As String, oldvar As varclass, varnew As varclass, sortie As sortieclass)


    Dim ptindirv As pointfinal
    Dim ptd As pointdebut
    Dim ptf As pointfinal
    Dim cercle As pointfinalcercle
    Dim chaine1 As String
    Dim chaine2 As String
    Dim chaineX As String
    Dim chaineY As String
    Dim chaineZ As String
    Dim saxc As String
    Dim saxd As String
    Dim sbxc As String
    Dim sbxd As String
    Dim A As Double
    Dim API As Double
    Dim APC As Double
    Dim AA As Double
    Dim AB As Double
    Dim ac As Double
   

    cercle.debut = varnew.ptf
                 
    ptindirv = varnew.ptfa
                 
    ptd = varnew.ptd
               
 


    If InStr(buffer, "CIRCLE") > 0 Then
               
        chaine1 = Mid(buffer, InStr(buffer, "CIRCLE/") + 7)
        chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.x = Val(chaineX)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.y = Val(chaineY)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineZ = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.z = Val(chaineZ)

        ptf = CalculPointFinal(ptd, varnew, oldvar)

        cercle.axc = ptf.ax
        cercle.bxc = ptf.bx
                       


        chaine1 = Mid(chaine1, InStr(chaine1, "LINE/") + 5)
                   
        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

        chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.x = Val(chaineX)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.y = Val(chaineY)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineZ = Mid(chaine1, 1, InStr(chaine1, ")") - 1)
        ptd.z = Val(chaineZ)

        cercle.fin = CalculPointFinal(ptd, varnew, oldvar)
                       

    Else
               
        chaine1 = Mid(buffer, InStr(buffer, "CYLNDR/") + 7)
        chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.x = Val(chaineX)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.y = Val(chaineY)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineZ = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.z = Val(chaineZ)

        ptf = CalculPointFinal(ptd, varnew, oldvar)

        cercle.axc = ptf.ax
        cercle.bxc = ptf.bx


        chaine1 = Mid(chaine1, InStr(chaine1, "VECTOR/") + 7)
        chaine1 = Mid(chaine1, InStr(chaine1, "POINT/") + 6)
        chaine1 = Mid(chaine1, InStr(chaine1, "POINT/") + 6)

        chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.x = Val(chaineX)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        ptd.y = Val(chaineY)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineZ = Mid(chaine1, 1, InStr(chaine1, ")") - 1)
        ptd.z = Val(chaineZ)

        cercle.fin = CalculPointFinal(ptd, varnew, oldvar)

    End If

    varnew.ptd = ptd
       

    API = angle((ptindirv.ax - cercle.debut.ax), (ptindirv.bx - cercle.debut.bx))
    APC = angle((cercle.axc - cercle.debut.ax), (cercle.bxc - cercle.debut.bx))

    A = APC - API
                       
    If A > 180 Then
        A = A - 360
    End If
   
    If A < -180 Then
        A = A + 360
    End If
                       

    If A > 0 Then
        cercle.g = 3
    Else
        cercle.g = 2
    End If





    AA = angle((cercle.axc - cercle.debut.ax), (cercle.bxc - cercle.debut.bx))
    AB = angle((cercle.axc - cercle.fin.ax), (cercle.bxc - cercle.fin.bx))
   
    If (cercle.g = 3) And (AB < AA) Then
        AB = 360 + AB
    End If
    If (cercle.g = 2) And (AB > AA) Then
        AB = AB - 360
    End If
    ac = AB - AA
    If ac < 0 Then
        ac = 0 - ac
    End If
                               
    If Val(chaine(cercle.fin.ax)) = Val(chaine(cercle.debut.ax)) _
        And Val(chaine(cercle.fin.bx)) = Val(chaine(cercle.debut.bx)) Then
        ac = 360
    End If
                               
                               
    PasCourant = 0
    If varnew.ptc.at = 0 Then
        PasPrecedent = 0
    Else
        PasPrecedent = Val(chaine((varnew.ptc.fin.cx - varnew.ptc.debut.cx) / varnew.ptc.at * 360))
    End If
                               


    If cercle.g = oldvar.g.g(1) And sortie.cetat = 1 Then
        If (Val(chaine(cercle.axc)) = Val(chaine(varnew.ptc.axc))) _
            And (Val(chaine(cercle.bxc)) = Val(chaine(varnew.ptc.bxc))) _
            And PasPrecedent = PasCourant Then
           
            varnew.ptc.fin = cercle.fin
            varnew.ptc.at = varnew.ptc.at + ac

        Else
            varnew.etat = 1
       
            Call spcircle(oldvar, varnew, sortie)
       
            varnew.ptc = cercle
            varnew.ptc.at = ac
           
        End If
    Else
        If (oldvar.g.g(1) = 2 Or oldvar.g.g(1) = 3) And sortie.cetat = 1 Then
       
            varnew.etat = 1
           
            Call spcircle(oldvar, varnew, sortie)
           
        End If
       
            varnew.ptc = cercle
            varnew.ptc.at = ac
            varnew.g.g(1) = varnew.ptc.g
            varnew.g.g(99) = oldvar.g.g(1)
           
    End If


    varnew.etat = 0
    varnew.ptf = cercle.fin
    oldvar.g.g(1) = varnew.g.g(1)
    oldvar.ptf = varnew.ptf
    oldvar.outil.Forigin = varnew.outil.Forigin
   
 
    sortie.imanew1 = varnew
    sortie.imaold1 = oldvar
    sortie.cetat = 1

   
 
 End Sub






Private Sub spcircle(oldvar As varclass, varnew As varclass, sortie As sortieclass)

           
    If varnew.g.g(99) <> oldvar.g.g(1) Then
        oldvar.g.g(1) = 1E+100
    End If
           
    atotal = varnew.ptc.at
    cxf = varnew.ptc.fin.cx - varnew.ptc.debut.cx
           
    Do While varnew.ptc.at >= 360
        varnew.ptc.at = varnew.ptc.at - 360
        varnew.ptc.ix = varnew.ptc.axc - varnew.ptc.debut.ax
        varnew.ptc.jx = varnew.ptc.bxc - varnew.ptc.debut.bx
        varnew.ptf.ax = varnew.ptc.debut.ax
        varnew.ptf.bx = varnew.ptc.debut.bx
                   
        varnew.ptf.cx = varnew.ptc.fin.cx - ((cxf / atotal) * varnew.ptc.at)
                   
        varnew.g.g(1) = varnew.ptc.g

        oldvar.ptf.ax = 1E+100
        oldvar.ptf.bx = 1E+100
        oldvar.ptc.ix = 1E+100
        oldvar.ptc.jx = 1E+100
        oldvar.ptf.cx = varnew.ptc.debut.cx

        Call format_sortie(oldvar, varnew, sortie)
               
        oldvar = varnew
               
        varnew.ptc.debut = varnew.ptf
                   
    Loop
           
           
    If varnew.ptc.at > 0 And varnew.ptc.at < 360 Then
        varnew.ptc.at = 0
           
        varnew.ptf = varnew.ptc.fin
                   
        varnew.ptc.ix = varnew.ptc.axc - varnew.ptc.debut.ax
        varnew.ptc.jx = varnew.ptc.bxc - varnew.ptc.debut.bx
        varnew.g.g(1) = varnew.ptc.g
               
        oldvar.ptf.ax = 1E+100
        oldvar.ptf.bx = 1E+100
        oldvar.ptc.ix = 1E+100
        oldvar.ptc.jx = 1E+100
        oldvar.ptf.cx = varnew.ptc.debut.cx
               
        Call format_sortie(oldvar, varnew, sortie)
               
        oldvar = varnew
           
    End If
                               
                               
    varnew.g.g(99) = varnew.g.g(1)
           

End Sub





Private Sub word_helical(buffer As String, oldvar As varclass, varnew As varclass, sortie As sortieclass)

    Dim ptindirv As pointfinal
    Dim ptd As pointdebut
    Dim ptf As pointfinal
    Dim cercle As pointfinalcercle
    Dim chaine1 As String
    Dim chaine2 As String
    Dim chaineX As String
    Dim chaineY As String
    Dim chaineZ As String
    Dim A As Double
    Dim API As Double
    Dim APC As Double
    Dim AA As Double
    Dim AB As Double
    Dim ac As Double
    Dim PasCourant As Double
    Dim PasPrecedent As Double

    cercle.debut = varnew.ptf
                 
    ptindirv = varnew.ptfa
                 
    ptd = varnew.ptd
 

    chaine2 = Mid(buffer, InStr(buffer, "HELICAL/") + 9)
    chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.x = Val(chaineX)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.y = Val(chaineY)
     
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineZ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.z = Val(chaineZ)
 
    ptf = CalculPointFinal(ptd, varnew, oldvar)
               
    cercle.axc = ptf.ax
    cercle.bxc = ptf.bx
 
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.x = Val(chaineX) + varnew.ptd.x

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.y = Val(chaineY) + varnew.ptd.y

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineZ = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.z = Val(chaineZ) + varnew.ptd.z

 
    ptindirv = CalculPointFinal(ptd, varnew, oldvar)

                 
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
                 
    ac = Val(Mid(chaine2, 1, InStr(chaine2, ",") - 1))
                 
                   

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)

                 
    chaineX = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.x = Val(chaineX)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineY = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    ptd.y = Val(chaineY)

    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    chaineZ = chaine2
    ptd.z = Val(chaineZ)
                 
    cercle.fin = CalculPointFinal(ptd, varnew, oldvar)


    varnew.ptd = ptd

    API = angle((ptindirv.ax - cercle.debut.ax), (ptindirv.bx - cercle.debut.bx))
    APC = angle((cercle.axc - cercle.debut.ax), (cercle.bxc - cercle.debut.bx))

    A = APC - API
                       
    If A > 180 Then
        A = A - 360
    End If
   
    If A < -180 Then
        A = A + 360
    End If
                       
    If A > 0 Then
        cercle.g = 3
    Else
        cercle.g = 2
    End If

   
    PasCourant = Val(chaine((cercle.fin.cx - cercle.debut.cx) / ac * 360))
    If varnew.ptc.at = 0 Then
        PasPrecedent = 0
    Else
        PasPrecedent = Val(chaine((varnew.ptc.fin.cx - varnew.ptc.debut.cx) / varnew.ptc.at * 360))
    End If


    If cercle.g = oldvar.g.g(1) And sortie.cetat = 1 Then
        If (Val(chaine(cercle.axc)) = Val(chaine(varnew.ptc.axc))) _
            And (Val(chaine(cercle.bxc)) = Val(chaine(varnew.ptc.bxc))) _
            And PasCourant = PasPrecedent Then
           
            varnew.ptc.fin = cercle.fin
            varnew.ptc.at = varnew.ptc.at + ac

        Else
            varnew.etat = 1
       
            Call spcircle(oldvar, varnew, sortie)
       
            varnew.ptc = cercle
            varnew.ptc.at = ac
           
        End If
    Else
        If (oldvar.g.g(1) = 2 Or oldvar.g.g(1) = 3) And sortie.cetat = 1 Then
       
            varnew.etat = 1
           
            Call spcircle(oldvar, varnew, sortie)
           
        End If
           
            varnew.ptc = cercle
            varnew.ptc.at = ac
            varnew.g.g(1) = varnew.ptc.g
            varnew.g.g(99) = oldvar.g.g(1)
           
    End If


    varnew.etat = 0
    varnew.ptf = cercle.fin
    oldvar.g.g(1) = varnew.g.g(1)
    oldvar.ptf = varnew.ptf
    oldvar.outil.Forigin = varnew.outil.Forigin
 
    sortie.imanew1 = varnew
    sortie.imaold1 = oldvar
    sortie.cetat = 1

       
End Sub









Private Sub word_spindl(ByVal buffer As String, oldvar As varclass, newvar As varclass, sortie As sortieclass)
    Dim chaine1 As String
    Dim chaine2 As String
                 
    oldvar.outil.s = newvar.outil.s
    oldvar.outil.rot = newvar.outil.rot

    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)


    If InStr(buffer, "OFF") = 0 And InStr(buffer, "LOCK") = 0 And InStr(buffer, "ON") = 0 And InStr(buffer, "OUT") = 0 Then
        If InStr(chaine1, ",") > 0 Then
            chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
        Else
            chaine2 = chaine1
        End If
        newvar.outil.s = Val(chaine2)

        If InStr(buffer, "SFM") > 0 Then
            newvar.outil.s = 1000 * newvar.outil.s / (pi * newvar.outil.dia)
        End If
       
        newvar.outil.s = CLng(newvar.outil.s)
       
        If newvar.outil.s < Smini Then
            newvar.outil.s = Smini
        End If
       
        If newvar.outil.s > Smaxi Then
            newvar.outil.s = Smaxi
        End If
       
        If InStr(buffer, "CCLW") > 0 Then
            newvar.outil.rot = 4
        End If
        If InStr(buffer, ",CLW") > 0 Then
            newvar.outil.rot = 3
        End If
    End If
           
    newvar.etat = 0

    If InStr(buffer, "OFF") > 0 Then
        sortie.chaine = "M5"
        newvar.etat = 1
    End If

    If InStr(buffer, "LOCK") > 0 Then
        sortie.chaine = "M19"
        newvar.etat = 1
    End If

    If InStr(buffer, "ON") > 0 Then
        oldvar.outil.s = -1
        oldvar.outil.rot = -1
        newvar.etat = 0
    End If
   
    If InStr(buffer, "OUT") > 0 Then
        sortie.chaine = "S" + Mid(Str(newvar.outil.s), 2) + "M" + Mid(Str(newvar.outil.rot), 2)
        newvar.etat = 1
    End If
 
End Sub







Private Sub word_fedrat(buffer As String, varnew As varclass, oldvar As varclass, sortie As sortieclass)
    Dim chaine2 As String

    If InStr(buffer, "INVERS") > 0 Then
        If InStr(buffer, "ON") > 0 Then
            varnew.finvers = 1
            varnew.g.g(5) = 93
        Else
            varnew.finvers = 0
            varnew.g.g(5) = 94
        End If
    Else
        chaine2 = Mid(buffer, InStr(buffer, "/") + 1, InStr(buffer, ","))
        varnew.outil.Forigin = Val(chaine2)
        varnew.outil.f = varnew.outil.Forigin
        If InStr(buffer, "MMPR") > 0 Then
            varnew.outil.Forigin = varnew.outil.s * varnew.outil.Forigin
            varnew.outil.f = varnew.outil.Forigin
        End If
    End If
               
    newvar.etat = 0
       
End Sub



 
Private Sub extract_cutcom(ByVal buffer As String, varnew As varclass)
    Dim retour As varclass

    retour = varnew

    If InStr(buffer, "LEFT") > 0 Then
        retour.outil.corrd = 41
    End If

    If InStr(buffer, "RIGHT") > 0 Then
        retour.outil.corrd = 42
    End If

    If InStr(buffer, "OFF") > 0 Then
        retour.outil.corrd = 40
    End If


    varnew = retour
   
End Sub




Private Sub word_cycle(buffer As String, newvar As varclass)

    Dim retour As varclass
    Dim chaine2 As String
    Dim chaine3 As String
    Dim var1 As Double
       
    retour = newvar
       
       
       
    If InStr(buffer, "CYCLE/BRKCHP") > 0 Then
        retour.g.g(1) = 73
    End If

    If InStr(buffer, "CYCLE/INVERS") > 0 Then
        retour.g.g(1) = 74
    End If
           
    If InStr(buffer, "CYCLE/LOCK") > 0 Then
        retour.g.g(1) = 76
    End If
           
    If InStr(buffer, "CYCLE/DRILL") > 0 Then
        retour.g.g(1) = 81
    End If

    If InStr(buffer, "CYCLE/FACE") > 0 Then
        retour.g.g(1) = 82
    End If

    If InStr(buffer, "CYCLE/DEEP") > 0 Then
        retour.g.g(1) = 83
    End If
         
    If InStr(buffer, "CYCLE/TAP") > 0 Then
        retour.g.g(1) = 84
    End If
         
    If InStr(buffer, "CYCLE/BORE") > 0 Then
        retour.g.g(1) = 85
    End If
         
    If InStr(buffer, "CYCLE/REAM") > 0 Then
        retour.g.g(1) = 86
    End If
         
    If InStr(buffer, "CYCLE/STEP") > 0 Then
        retour.g.g(1) = 87
    End If
         
    If InStr(buffer, "CYCLE/MANUAL") > 0 Then
        retour.g.g(1) = 88
    End If
         
    If InStr(buffer, "CYCLE/THRU") > 0 Then
        retour.g.g(1) = 89
    End If
       
    chaine2 = Mid(buffer, InStr(buffer, ",") + 1)
    chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    retour.cycle.Zp = Val(chaine3)
         
    If InStr(buffer, "CYCLE/BRKCHP") > 0 Or InStr(buffer, "CYCLE/LOCK") > 0 Or InStr(buffer, "CYCLE/DEEP") > 0 Then
        chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
        chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
        retour.cycle.Q = Val(chaine3)
    End If

    If InStr(chaine2, "MMPM") > 0 Then
        chaine2 = Mid(chaine2, InStr(chaine2, "MMPM") + 5)
        chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
        retour.outil.f = Val(chaine3)
    Else
        chaine2 = Mid(chaine2, InStr(chaine2, "MMPR") + 5)
        chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
        retour.outil.f = Val(chaine3) * retour.outil.s
    End If
    chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
    If InStr(chaine2, ",") > 0 Then
        chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
    Else
        chaine3 = chaine2
    End If
    retour.cycle.Zr = Val(chaine3)

    If InStr(buffer, "CYCLE/FACE") > 0 Or InStr(buffer, "CYCLE/MANUAL") > 0 Or InStr(buffer, "CYCLE/THRU") > 0 Then
        chaine2 = Mid(chaine2, InStr(chaine2, "DWELLV") + 7)
        chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
        var1 = Val(chaine3)
        If var1 = 0 Then
            retour.cycle.P = 0
        End If
        If var1 = 1 Then
            chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
            chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
            retour.cycle.P = (Val(chaine3) / retour.outil.s) * 60
        End If
        If var1 = 2 Then
            chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
            chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
            chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
            retour.cycle.P = Val(chaine3)
        End If
    End If

    If InStr(chaine2, "POSZ") > 0 Then
        chaine2 = Mid(chaine2, InStr(chaine2, "POSZ") + 5)
        If InStr(chaine2, ",") > 0 Then
            chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
        Else
            chaine3 = chaine2
        End If
        retour.cycle.Za = Val(chaine3)
        If retour.cycle.Za <= retour.cycle.Zr Then
            retour.cycle.Za = retour.cycle.Zr
            retour.cycle.Gs = 99
        Else
            retour.cycle.Gs = 98
        End If
    Else
        retour.cycle.Za = retour.cycle.Zr
        retour.cycle.Gs = 99
    End If
         
    If retour.cycle.Za = 0 Then
        oldvar.ptf.cx = 1E+100
    End If
           

         
    retour.etat = 0

    newvar = retour
   

End Sub


 
Private Sub word_pivotz(buffer As String, newvar As varclass)
       
    Dim chaine1 As String
    Dim chaine2 As String
    Dim chaineX As String
    Dim chaineY As String
    Dim chaineZ As String


    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

    chaine2 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
    If Val(chaine2) = 2 Then

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineX = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        newvar.px = Val(chaineX)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineY = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
        newvar.py = Val(chaineY)

        chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        chaineZ = chaine1
        newvar.pz = Val(chaineZ)
    Else
        newvar.px = 0
        newvar.py = 0
        newvar.pz = 0
    End If
         

    sortie.chaine = ""
    newvar.etat = 0


End Sub





Private Sub word_origin(buffer As String, newvar As varclass, oldvar As varclass, sortie As sortieclass)
    Dim retour As varclass
    Dim chaine1 As String
    Dim chaine2 As String
    Dim chaine3 As String

    retour = newvar
    retour.xdec = 1E+100
    retour.ydec = 1E+100
    retour.zdec = 1E+100

    chaine2 = Mid(buffer, InStr(buffer, "/") + 1)

    If InStr(chaine2, "TYPE") > 0 Then
        chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
        If InStr(chaine2, ",") > 0 Then
            chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
        Else
            chaine3 = chaine2
        End If
        If Val(chaine3) >= 0 And Val(chaine3) <= 6 Then
            retour.g.g(2) = 53 + Val(chaine3)
        End If
        If Val(chaine3) >= 101 And Val(chaine3) <> 148 Then
            retour.g.g(2) = Val(chaine3)
        End If
               
    Else
        If InStr(chaine2, ",") > 0 Then
            chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
        Else
            chaine3 = chaine2
        End If
        retour.xdec = Val(chaine3)

        If InStr(chaine2, ",") > 0 Then
            chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
            If InStr(chaine2, ",") > 0 Then
                chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
            Else
                chaine3 = chaine2
            End If
            retour.ydec = Val(chaine3)
        End If
        If InStr(chaine2, ",") > 0 Then
            chaine2 = Mid(chaine2, InStr(chaine2, ",") + 1)
            If InStr(chaine2, ",") > 0 Then
                chaine3 = Mid(chaine2, 1, InStr(chaine2, ",") - 1)
            Else
                chaine3 = chaine2
            End If
            retour.zdec = Val(chaine3)
        End If

    End If


    newvar = retour
       

    newvar.etat = 0
    If (newvar.xdec <> 1E+100) And (newvar.ydec <> 1E+100) And (newvar.zdec <> 1E+100) Then
        sortie.chaine = cg52 + cstx + chaine(newvar.xdec) + csty + chaine(newvar.ydec) + cstz + chaine(newvar.zdec)
        newvar.etat = 1
    End If

    If (InStr(buffer, "OUT") > 0) And (newvar.g.g(2) <> 1E+100) Then
        If newvar.g.g(2) >= 53 And newvar.g.g(2) <= 59 Then
            sortie.chaine = "G" + Mid(Str(newvar.g.g(2)), 2)
        End If
        If newvar.g.g(2) >= 101 And newvar.g.g(2) <= 148 Then
            sortie.chaine = cg541p + Mid(Str(newvar.g.g(2) - 100), 2)
        End If
                   
        oldvar.g.g(2) = newvar.g.g(2)
        newvar.etat = 1
    End If

End Sub




Private Sub word_moveto(buffer As String, newvar As varclass, oldvar As varclass, sortie As sortieclass)


    Dim chaine1 As String
       

    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

    If InStr(chaine1, "START") > 0 Then
        If InStr(chaine1, "OFF") > 0 Then
            newvar.defaultex = 1E+100
        Else

            If InStr(chaine1, "CAXIS") > 0 Then
                If newvar.rotex <> 1E+100 Then

                    newvar.defaultex = newvar.rotex
                Else
                    newvar.defaultex = 0
                End If
            End If
        End If
        newvar.etat = 0


    End If


    If InStr(buffer, "OUT") > 0 Then
        If InStr(buffer, "AAXIS") > 0 Then

            oldvar.ptf.dx = 1E+100

            If newvar.rotdx <> 1E+100 Then

                newvar.ptf.dx = newvar.rotdx
            End If
        End If

        If InStr(buffer, "CAXIS") > 0 Then

            If newvar.rotex <> 1E+100 Then

                newvar.ptf.ex = newvar.rotex
            End If
        End If

        If InStr(chaine1, "XAXIS") > 0 Then

            oldvar.ptf.ax = 1E+100

        End If

        If InStr(chaine1, "YAXIS") > 0 Then

            oldvar.ptf.bx = 1E+100

        End If

        If InStr(chaine1, "ZAXIS") > 0 Then

            oldvar.ptf.cx = 1E+100

        End If


        If (newvar.g.g(1) <> 0) And (newvar.g.g(1) <> 73) And (newvar.g.g(1) <> 74) And (newvar.g.g(1) <> 76) And (newvar.g.g(1) <> 81) And (newvar.g.g(1) <> 82) And (newvar.g.g(1) <> 83) And (newvar.g.g(1) <> 84) And (newvar.g.g(1) <> 85) And (newvar.g.g(1) <> 86) And (newvar.g.g(1) <> 87) And (newvar.g.g(1) <> 88) And (newvar.g.g(1) <> 80) Then
            newvar.g.g(1) = 1
        End If
        oldvar.g.g(1) = 1E+100

        Call format_sortie(oldvar, newvar, sortie)
                       
        oldvar.ptf = newvar.ptf
        oldvar.outil.tc = newvar.outil.tc
        oldvar.outil.arr = newvar.outil.arr
        oldvar.g.g(1) = newvar.g.g(1)
        oldvar.g.g(2) = newvar.g.g(2)
        oldvar.g.g(3) = newvar.g.g(3)
        oldvar.g.g(4) = newvar.g.g(4)
        newvar.etat = 1
    End If


    If (InStr(buffer, "START") = 0) And (InStr(buffer, "OUT") = 0) Then
        If InStr(chaine1, "XAXIS") > 0 Then

            oldvar.ptf.ax = 1E+100

        End If
        If InStr(chaine1, "YAXIS") > 0 Then

            oldvar.ptf.bx = 1E+100

        End If
        If InStr(chaine1, "ZAXIS") > 0 Then

            oldvar.ptf.cx = 1E+100

        End If

        If InStr(chaine1, "AAXIS") > 0 Then

            oldvar.ptf.dx = 1E+100

        End If
        If InStr(chaine1, "CAXIS") > 0 Then

            oldvar.ptf.ex = 2E+120

        End If
        oldvar.g.g(1) = 1E+100
        newvar.etat = 0
    End If


End Sub




Private Sub word_catmat(buffer As String, newvar As varclass)

    Dim mat1(1 To 3, 1 To 4) As Double
    Dim mat2(1 To 3, 1 To 3) As Double
    Dim i1 As Integer
    Dim j1 As Integer
    Dim chaine1 As String
    Dim chaine2 As String
    Dim A1 As Double
    Dim a2 As Double
    Dim B1 As Double
    Dim b2 As Double
    Dim C1 As Double
    Dim c2 As Double


    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

    For i1 = 1 To 3
        For j1 = 1 To 3
            chaine2 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
            mat1(i1, j1) = Val(chaine2)
            chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)
        Next
    Next


    chaine2 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
    mat1(1, 4) = Val(chaine2)
    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

    chaine2 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
    mat1(2, 4) = Val(chaine2)
    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

    chaine2 = Mid(chaine1, 1, InStr(chaine1, ",") - 1)
    mat1(3, 4) = Val(chaine2)


    For i1 = 1 To 3
        For j1 = 1 To 3
            newvar.rotb.mat(i1, j1) = mat1(i1, j1)
        Next
    Next

    newvar.rotb.mat(1, 4) = mat1(1, 4)
    newvar.rotb.mat(2, 4) = mat1(2, 4)
    newvar.rotb.mat(3, 4) = mat1(3, 4)





    If newvar.rotetat = 0 Then

        detA = (mat1(1, 1) * mat1(2, 2) * mat1(3, 3)) + (mat1(1, 2) * mat1(2, 3) * mat1(3, 1)) + (mat1(1, 3) * mat1(2, 1) * mat1(3, 2))
        detA = detA - (mat1(1, 3) * mat1(2, 2) * mat1(3, 1)) - (mat1(2, 3) * mat1(3, 2) * mat1(1, 1)) - (mat1(3, 3) * mat1(1, 2) * mat1(2, 1))

        If detA <> 0 Then
            dam1 = 1 / detA

            mat2(1, 1) = dam1 * ((mat1(2, 2) * mat1(3, 3)) - (mat1(2, 3) * mat1(3, 2)))
            mat2(1, 2) = dam1 * ((mat1(1, 3) * mat1(3, 2)) - (mat1(1, 2) * mat1(3, 3)))
            mat2(1, 3) = dam1 * ((mat1(1, 2) * mat1(2, 3)) - (mat1(1, 3) * mat1(2, 2)))

            mat2(2, 1) = dam1 * ((mat1(2, 3) * mat1(3, 1)) - (mat1(2, 1) * mat1(3, 3)))
            mat2(2, 2) = dam1 * ((mat1(1, 1) * mat1(3, 3)) - (mat1(1, 3) * mat1(3, 1)))
            mat2(2, 3) = dam1 * ((mat1(1, 3) * mat1(2, 1)) - (mat1(1, 1) * mat1(2, 3)))

            mat2(3, 1) = dam1 * ((mat1(2, 1) * mat1(3, 2)) - (mat1(2, 2) * mat1(3, 1)))
            mat2(3, 2) = dam1 * ((mat1(1, 2) * mat1(3, 1)) - (mat1(1, 1) * mat1(3, 2)))
            mat2(3, 3) = dam1 * ((mat1(1, 1) * mat1(2, 2)) - (mat1(1, 2) * mat1(2, 1)))
        Else
            MsgBox ("Determinant matrice est nul Exclamation!  erreur ! ")
            Exit Sub
        End If

        For i1 = 1 To 3
            For j1 = 1 To 3
                newvar.rota.mat(i1, j1) = mat2(i1, j1)
            Next
        Next
        newvar.rota.mat(1, 4) = -mat1(1, 4)
        newvar.rota.mat(2, 4) = -mat1(2, 4)
        newvar.rota.mat(3, 4) = -mat1(3, 4)
        newvar.rotetat = 1
   
    End If

'MsgBox (Str(mat1(1, 1)) + "  " + Str(mat1(1, 2)) + "  " + Str(mat1(1, 3)) + vbLf _
'+ Str(mat1(2, 1)) + "  " + Str(mat1(2, 2)) + "  " + Str(mat1(2, 3)) + vbLf _
'+ Str(mat1(3, 1)) + "  " + Str(mat1(3, 2)) + "  " + Str(mat1(3, 3)))



End Sub







Private Function Asin(x As Double) As Double

    If x = 1 Then

        Asin = pi / 2
   
        ElseIf x = -1 Then

            Asin = -pi / 2
       
    Else
   
        Asin = Atn(x / Sqr(-x * x + 1))
       
    End If


End Function







Private Function Atan2(y As Double, x As Double) As Double


    If x > 0 Then

        Atan2 = Atn(y / x)

        ElseIf x < 0 Then

            Atan2 = Sgn(y) * (pi - Atn(Abs(y / x)))

            ElseIf y = 0 Then

                Atan2 = 0

    Else

        Atan2 = Sgn(y) * pi / 2

    End If


End Function




bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty c'est la fin de la macro

Message par bruno18100 Dim 3 Mar 2013 - 2:09

mémorisez

essai:

sous catia, executer PostPro_5AX,

traitez le fichier aptsource suivant:

Code:

$$ -----------------------------------------------------------------
$$    Généré le lundi 25 juin 2012 05:56:24
$$    CATIA APT VERSION 1.0
$$ -----------------------------------------------------------------
$$ Programme de fabrication.1
$$  PROG1
$$*CATIA0
$$ Programme de fabrication.1
$$    0.76604    -0.64279    0.00000  -92.09450
$$    0.63302    0.75441    -0.17365  -107.48403
$$    0.11162    0.13302    0.98481    0.00000
CATMAT/    0.76604,  -0.64279,    0.00000,    0.63302,    0.75441,  -$
0.17365,    0.11162,    0.13302,    0.98481,  -92.09450, -107.48403,  $
 0.00000,Programme de fabrication.1
$$ PARTNO Programme de fabrication.1
$$ PROGRAM. PROG1
$$ MACHINE. 5-axes.1
$$ CATPROCESS. essai2.CATProcess
$$ CATPRODUCT. Produit1
$$ OPERATION NAME : Instruction post-processeur.1
$$  Début de génération de: Instruction post-processeur.1
PARTNO 0100
PPRINT ESSAI1
PIVOTZ/2,0,0,0
$$  Fin de génération de: Instruction post-processeur.1
$$ OPERATION NAME : Changement outil.2
$$  Début de génération de: Changement outil.2
MULTAX/ON
FROM  /    0.00000,    0.00000,  500.00000, 0.000000, 0.000000, 1.000000
$$ TOOLCHANGEBEGINNING
CUTTER/ 20.000000,  2.000000,  8.000000,  2.000000,  0.000000,$
        0.000000, 60.000000
COOLNT/OFF
PPRINT T1 FRAISE D20
LOADTL/1
COOLNT/FLOOD
RAPID
$$ TOOLCHANGEEND
$$  Fin de génération de: Changement outil.2
$$ OPERATION NAME : CONTOURNAGE HELICOIDAL
$$  Début de génération de: CONTOURNAGE HELICOIDAL
SPINDL/  70.0000,RPM,CLW
RAPID
GOTO  /  46.32161,  86.31842,  135.40446, 0.111619, 0.133022, 0.984808
RAPID
GOTO  /  35.15972,  73.01620,  36.92369, 0.111619, 0.133022, 0.984808
FEDRAT/ 1000.0000,MMPM
CUTCOM/LEFT
$$ START CUTCOM PLANAR XT,YT,ZT,I,J,K
GOTO  /  33.26066,  70.75298,  37.44463, 0.111619, 0.133022, 0.984808
INTOL /    0.00200
OUTTOL/    0.00000
PSIS/(PLANE/(POINT/  39.59088,  78.29705,  35.70815),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.76604,  -0.64279,    0.00000
TLON,GOFWD/(CYLNDR/  39.59088,  78.29705,  35.70815,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  39.59088,  78.29705,  35.70815),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  39.59088,  78.29705,  35.70815),$
      (POINT/  47.25132,  71.86917,  35.70815))
GOTO  /  96.47894,  130.53636,  21.26533, 0.111619, 0.133022, 0.984808
HELICAL/  104.13938,  124.10848,  21.26533,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  103.16180,  133.97363,  19.94930
GOTO  /  120.86002,  135.40720,  17.53385, 0.111619, 0.133022, 0.984808
HELICAL/  121.82724,  125.52970,  18.75842,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  128.14702,  133.06133,  16.92985
GOTO  /  222.83356,  53.27687,  15.48306, 0.111619, 0.133022, 0.984808
HELICAL/  182.14666,    4.78811,  26.64413,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  175.55324,  -58.75223,  33.99868
GOTO  /  175.55324,  -58.75223,  33.99868, 0.111619, 0.133022, 0.984808
HELICAL/  168.29765, -130.76060,  44.54752,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  122.80066,  -73.58503,  41.29827
GOTO  /  122.80066,  -73.58503,  41.29827, 0.111619, 0.133022, 0.984808
HELICAL/  104.64779,  -50.69906,  40.26442,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  86.44693,  -73.10493,  44.87838
GOTO  /  -1.43400,  -1.95356,  43.86589, 0.111619, 0.133022, 0.984808
HELICAL/    4.77500,    5.69063,  42.12962,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -2.90645,  12.09346,  41.94424
GOTO  /  46.32116,  70.76065,  27.50142, 0.111619, 0.133022, 0.984808
GOTO  /  95.54878,  129.42784,  13.05860, 0.111619, 0.133022, 0.984808
HELICAL/  103.20922,  122.99996,  13.05860,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  102.23164,  132.86511,  11.74257
GOTO  /  119.92987,  134.29868,    9.32712, 0.111619, 0.133022, 0.984808
HELICAL/  120.89708,  124.42118,  10.55169,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  127.21687,  131.95281,    8.72312
GOTO  /  221.90340,  52.16835,    7.27633, 0.111619, 0.133022, 0.984808
HELICAL/  181.21650,    3.67959,  18.43740,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  174.62308,  -59.86075,  25.79195
GOTO  /  174.62308,  -59.86075,  25.79195, 0.111619, 0.133022, 0.984808
HELICAL/  167.36749, -131.86912,  36.34079,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  121.87050,  -74.69355,  33.09154
GOTO  /  121.87050,  -74.69355,  33.09154, 0.111619, 0.133022, 0.984808
HELICAL/  103.71763,  -51.80757,  32.05769,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  85.51678,  -74.21344,  36.67165
GOTO  /  -2.36415,  -3.06208,  35.65916, 0.111619, 0.133022, 0.984808
HELICAL/    3.84485,    4.58211,  33.92289,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -3.83661,  10.98495,  33.73751
GOTO  /  45.39101,  69.65213,  19.29469, 0.111619, 0.133022, 0.984808
GOTO  /  94.61862,  128.31932,    4.85187, 0.111619, 0.133022, 0.984808
HELICAL/  102.27907,  121.89145,    4.85187,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  101.30149,  131.75659,    3.53584
GOTO  /  118.99971,  133.19016,    1.12039, 0.111619, 0.133022, 0.984808
HELICAL/  119.96692,  123.31267,    2.34496,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  126.28671,  130.84429,    0.51639
GOTO  /  220.97324,  51.05984,  -0.93040, 0.111619, 0.133022, 0.984808
HELICAL/  180.28634,    2.57108,  10.23067,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  173.69292,  -60.96927,  17.58522
GOTO  /  173.69292,  -60.96927,  17.58522, 0.111619, 0.133022, 0.984808
HELICAL/  166.43733, -132.97764,  28.13405,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  120.94034,  -75.80207,  24.88481
GOTO  /  120.94034,  -75.80207,  24.88481, 0.111619, 0.133022, 0.984808
HELICAL/  102.78747,  -52.91609,  23.85096,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  84.58662,  -75.32196,  28.46492
GOTO  /  -3.29431,  -4.17060,  27.45242, 0.111619, 0.133022, 0.984808
HELICAL/    2.91469,    3.47359,  25.71616,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -4.76677,    9.87643,  25.53078
GOTO  /  44.46085,  68.54362,  11.08796, 0.111619, 0.133022, 0.984808
GOTO  /  93.68847,  127.21080,  -3.35486, 0.111619, 0.133022, 0.984808
HELICAL/  101.34891,  120.78293,  -3.35486,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  100.37133,  130.64807,  -4.67089
GOTO  /  118.06955,  132.08164,  -7.08634, 0.111619, 0.133022, 0.984808
HELICAL/  119.03677,  122.20415,  -5.86177,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  125.35655,  129.73577,  -7.69034
GOTO  /  220.04309,  49.95132,  -9.13713, 0.111619, 0.133022, 0.984808
HELICAL/  179.35619,    1.46256,    2.02394,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  172.76277,  -62.07779,    9.37849
GOTO  /  172.76277,  -62.07779,    9.37849, 0.111619, 0.133022, 0.984808
HELICAL/  165.50717, -134.08616,  19.92732,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  120.01018,  -76.91059,  16.67808
GOTO  /  120.01018,  -76.91059,  16.67808, 0.111619, 0.133022, 0.984808
HELICAL/  101.85731,  -54.02461,  15.64423,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  83.65646,  -76.43048,  20.25819
GOTO  /  -4.22447,  -5.27912,  19.24569, 0.111619, 0.133022, 0.984808
HELICAL/    1.98453,    2.36507,  17.50943,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -5.69692,    8.76791,  17.32404
GOTO  /  43.53069,  67.43510,    2.88122, 0.111619, 0.133022, 0.984808
GOTO  /  92.75831,  126.10229,  -11.56160, 0.111619, 0.133022, 0.984808
HELICAL/  100.41875,  119.67441,  -11.56160,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  99.44117,  129.53955,  -12.87762
GOTO  /  117.13939,  130.97312,  -15.29308, 0.111619, 0.133022, 0.984808
HELICAL/  118.10661,  121.09563,  -14.06851,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  124.42639,  128.62726,  -15.89707
GOTO  /  219.11293,  48.84280,  -17.34386, 0.111619, 0.133022, 0.984808
HELICAL/  178.42603,    0.35404,  -6.18279,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  171.83261,  -63.18630,    1.17176
GOTO  /  171.83261,  -63.18630,    1.17176, 0.111619, 0.133022, 0.984808
HELICAL/  164.57702, -135.19468,  11.72059,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  119.08003,  -78.01911,    8.47135
GOTO  /  119.08003,  -78.01911,    8.47135, 0.111619, 0.133022, 0.984808
HELICAL/  100.92716,  -55.13313,    7.43750,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  82.72630,  -77.53900,  12.05146
GOTO  /  -5.15463,  -6.38764,  11.03896, 0.111619, 0.133022, 0.984808
HELICAL/    1.05437,    1.25655,    9.30269,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -6.62708,    7.65939,    9.11731
GOTO  /  42.60053,  66.32658,  -5.32551, 0.111619, 0.133022, 0.984808
GOTO  /  91.82815,  124.99377,  -19.76833, 0.111619, 0.133022, 0.984808
HELICAL/  99.48859,  118.56589,  -19.76833,$
    0.63302,    0.75441,  -0.17365,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  44.84588,    0.09287,$
    0.12457,$
  98.51101,  128.43103,  -21.08435
GOTO  /  116.20924,  129.86461,  -23.49981, 0.111619, 0.133022, 0.984808
HELICAL/  117.17645,  119.98711,  -22.27524,$
    0.98903,    0.08158,  -0.12312,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  45.15412,    0.09351,$
    0.12543,$
  123.49624,  127.51874,  -24.10380
GOTO  /  218.18277,  47.73428,  -25.55059, 0.111619, 0.133022, 0.984808
HELICAL/  177.49587,  -0.75448,  -14.38952,$
    0.76604,  -0.64279,    0.00000,$
    0.11162,    0.13302,    0.98481,$
    4.79164,  64.27405,  146.16060,    1.94541,$
    0.40600,$
  170.90245,  -64.29482,  -7.03497
GOTO  /  170.90245,  -64.29482,  -7.03497, 0.111619, 0.133022, 0.984808
HELICAL/  163.64686, -136.30319,    3.51386,$
  -0.98879,    0.11380,    0.09670,$
    0.11162,    0.13302,    0.98481,$
    5.45242,  73.13773,  44.40792,    0.67259,$
    0.12336,$
  118.14987,  -79.12762,    0.26461
GOTO  /  118.14987,  -79.12762,    0.26461, 0.111619, 0.133022, 0.984808
HELICAL/  99.99700,  -56.24165,  -0.76923,$
  -0.77579,  -0.60766,    0.17001,$
    0.11162,    0.13302,    0.98481,$
    2.17906,  29.22950,  77.34647,    0.46817,$
    0.21485,$
  81.79615,  -78.64752,    3.84473
GOTO  /  -6.08478,  -7.49616,    2.83223, 0.111619, 0.133022, 0.984808
HELICAL/    0.12422,    0.14804,    1.09596,$
  -0.77590,    0.63085,    0.00273,$
    0.11162,    0.13302,    0.98481,$
    0.74550,  10.00000,  90.90086,    0.18824,$
    0.25250,$
  -7.55724,    6.55087,    0.91058
GOTO  /  41.67038,  65.21806,  -13.53224, 0.111619, 0.133022, 0.984808
GOTO  /  91.00120,  124.00824,  -27.06448, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  98.66164,  117.58037,  -27.06448),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.63302,    0.75441,  -0.17365
TLON,GOFWD/(CYLNDR/  98.66164,  117.58037,  -27.06448,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  98.66164,  117.58037,  -27.06448),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  98.66164,  117.58037,  -27.06448),$
      (POINT/  97.69443,  127.45786,  -28.28905))
GOTO  /  115.41638,  128.91972,  -30.49513, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  116.38360,  119.04222,  -29.27056),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.98903,    0.08158,  -0.12312
TLON,GOFWD/(CYLNDR/  116.38360,  119.04222,  -29.27056,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  116.38360,  119.04222,  -29.27056),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  116.38360,  119.04222,  -29.27056),$
      (POINT/  122.71382,  126.58629,  -31.00704))
GOTO  /  217.56433,  46.99725,  -31.00704, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  176.87743,  -1.49150,  -19.84597),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.76604,  -0.64279,    0.00000
TLON,GOFWD/(CYLNDR/  176.87743,  -1.49150,  -19.84597,$
      0.11162,    0.13302,    0.98481,  64.27405),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  176.87743,  -1.49150,  -19.84597),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  176.87743,  -1.49150,  -19.84597),$
      (POINT/  170.50116,  -64.77306,  -10.57556))
PSIS/(PLANE/(POINT/  163.24557, -136.78144,  -0.02673),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/  -0.98879,    0.11380,    0.09670
TLON,GOFWD/(CYLNDR/  163.24557, -136.78144,  -0.02673,$
      0.11162,    0.13302,    0.98481,  73.13773),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  163.24557, -136.78144,  -0.02673),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  163.24557, -136.78144,  -0.02673),$
      (POINT/  117.82365,  -79.51640,  -2.61360))
PSIS/(PLANE/(POINT/  99.67078,  -56.63042,  -3.64745),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/  -0.77579,  -0.60766,    0.17001
TLON,GOFWD/(CYLNDR/  99.67078,  -56.63042,  -3.64745,$
      0.11162,    0.13302,    0.98481,  29.22950),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  99.67078,  -56.63042,  -3.64745),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  99.67078,  -56.63042,  -3.64745),$
      (POINT/  81.52218,  -78.97401,    1.42757))
GOTO  /  -6.20900,  -7.64419,    1.73627, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/    0.00000,    0.00000,    0.00000),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/  -0.77590,    0.63085,    0.00273
TLON,GOFWD/(CYLNDR/    0.00000,    0.00000,    0.00000,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/    0.00000,    0.00000,    0.00000),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/    0.00000,    0.00000,    0.00000),$
      (POINT/  -7.66044,    6.42788,    0.00000))
GOTO  /  41.67038,  65.21806,  -13.53224, 0.111619, 0.133022, 0.984808
PSIS/(PLANE/(POINT/  34.00993,  71.64594,  -13.53224),PERPTO,$
            (VECTOR/ 0.111619, 0.133022, 0.984808))
INDIRV/    0.63302,    0.75441,  -0.17365
TLON,GOFWD/(CYLNDR/  34.00993,  71.64594,  -13.53224,$
      0.11162,    0.13302,    0.98481,  10.00000),ON,$
  (PLANE/PERPTO,$
      (PLANE/(POINT/  34.00993,  71.64594,  -13.53224),PERPTO,$
      (VECTOR/ 0.111619, 0.133022, 0.984808)),$
      (POINT/  34.00993,  71.64594,  -13.53224),$
      (POINT/  40.34016,  79.19000,  -15.26872))
CUTCOM/OFF
$$ END CUTCOM PLANAR XT,YT,ZT,I,J,K
GOTO  /  38.44109,  76.92678,  -14.74778, 0.111619, 0.133022, 0.984808
RAPID
GOTO  /  55.18392,  96.88012,  132.97339, 0.111619, 0.133022, 0.984808
$$  Fin de génération de: CONTOURNAGE HELICOIDAL
$$ OPERATION NAME : Changement outil.3
$$  Début de génération de: Changement outil.3
$$ TOOLCHANGEBEGINNING
CUTTER/ 10.000000,  0.000000,  5.000000,  2.886751, 30.000000,$
        0.000000, 50.000000
COOLNT/OFF
PPRINT T2 FORET D 10
LOADTL/3
COOLNT/FLOOD
RAPID
$$ TOOLCHANGEEND
$$  Fin de génération de: Changement outil.3
$$ OPERATION NAME : PERCAGE
$$  Début de génération de: PERCAGE
SPINDL/ 2000.0000,RPM,CLW
RAPID
GOTO  /  202.22595,  18.52789,  127.90633, 0.111619, 0.133022, 0.984808
RAPID
GOTO  /  191.06406,    5.22567,  29.42555, 0.111619, 0.133022, 0.984808
CYCLE/DEEP,  -30.000000,  10.000000,MMPM,  300.000000,    1.000000,POS$
Z,    0.000000
GOTO  /  190.95244,    5.09265,  28.44074, 0.111619, 0.133022, 0.984808
CYCLE/OFF
RAPID
GOTO  /  202.22595,  18.52789,  127.90633, 0.111619, 0.133022, 0.984808
$$  Fin de génération de: PERCAGE


vous devez avoir le résultat suivant:

Code:

%O0100
( ESSAI1)
( T1 FRAISE D20)
N10 G0 G40 G49 G80 G90 M9
N15 G52 X0. Y0. Z0.
N20 (------------)
N25 G53 G90 G0 Z0. H0
N30 M1
N35 T0001 M6
N40 T0003
N45 M8
N50 M79
N55 M11
N60 G0 G54 G90 A10. C40.
N65 M78
N70 M10
N75 X-20. Y70.929 S70 M3
N80 G43 Z150. H1
N85 Z50.
N90 G1 G94 G41 Y67.929 D1 F1000
N95 G3 X-10. Y77.929 I0. J10.
N100 G1 Y155.858 Z49.075
N105 G2 X-7.09 Y162.91 Z48.982 I10. J0.
N110 G1 X5.546 Y175.614 Z48.77
N115 G2 X12.636 Y178.562 Z48.676 I7.09 J-7.052
N120 G1 X136.454 Y178.563 Z47.207
N125 G2 X172.247 Y60.902 Z45.262 I0. J-64.274
N130 G3 X141.37 Y15.051 Z44.589 I40.728 J-60.748
N135 G2 X113.213 Y-8.221 Z44.121 I-28.617 J5.954
N140 G1 X.157 Y-9.999 Z42.78
N145 G2 X-10. Y0. Z42.591 I-.157 J9.999
N150 G1 Y77.929 Z41.667
N155 Y155.858 Z40.742
N160 G2 X-7.09 Y162.91 Z40.649 I10. J0.
N165 G1 X5.546 Y175.614 Z40.437
N170 G2 X12.636 Y178.562 Z40.343 I7.09 J-7.052
N175 G1 X136.454 Y178.563 Z38.874
N180 G2 X172.247 Y60.902 Z36.929 I0. J-64.274
N185 G3 X141.37 Y15.051 Z36.256 I40.728 J-60.748
N190 G2 X113.213 Y-8.221 Z35.788 I-28.617 J5.954
N195 G1 X.157 Y-9.999 Z34.446
N200 G2 X-10. Y0. Z34.258 I-.157 J9.999
N205 G1 Y77.929 Z33.333
N210 Y155.858 Z32.409
N215 G2 X-7.09 Y162.91 Z32.316 I10. J0.
N220 G1 X5.546 Y175.614 Z32.103
N225 G2 X12.636 Y178.562 Z32.01 I7.09 J-7.052
N230 G1 X136.454 Y178.563 Z30.541
N235 G2 X172.247 Y60.902 Z28.595 I0. J-64.274
N240 G3 X141.37 Y15.051 Z27.923 I40.728 J-60.748
N245 G2 X113.213 Y-8.221 Z27.454 I-28.617 J5.954
N250 G1 X.157 Y-9.999 Z26.113
N255 G2 X-10. Y0. Z25.925 I-.157 J9.999
N260 G1 Y77.929 Z25.
N265 Y155.858 Z24.075
N270 G2 X-7.09 Y162.91 Z23.982 I10. J0.
N275 G1 X5.546 Y175.614 Z23.77
N280 G2 X12.636 Y178.562 Z23.676 I7.09 J-7.052
N285 G1 X136.454 Y178.563 Z22.207
N290 G2 X172.247 Y60.902 Z20.262 I0. J-64.274
N295 G3 X141.37 Y15.051 Z19.589 I40.728 J-60.748
N300 G2 X113.213 Y-8.221 Z19.121 I-28.617 J5.954
N305 G1 X.157 Y-9.999 Z17.78
N310 G2 X-10. Y0. Z17.591 I-.157 J9.999
N315 G1 Y77.929 Z16.667
N320 Y155.858 Z15.742
N325 G2 X-7.09 Y162.91 Z15.649 I10. J0.
N330 G1 X5.546 Y175.614 Z15.437
N335 G2 X12.636 Y178.562 Z15.343 I7.09 J-7.052
N340 G1 X136.454 Y178.563 Z13.874
N345 G2 X172.247 Y60.902 Z11.929 I0. J-64.274
N350 G3 X141.37 Y15.051 Z11.256 I40.728 J-60.748
N355 G2 X113.213 Y-8.221 Z10.788 I-28.617 J5.954
N360 G1 X.157 Y-9.999 Z9.446
N365 G2 X-10. Y0. Z9.258 I-.157 J9.999
N370 G1 Y77.929 Z8.333
N375 Y155.858 Z7.409
N380 G2 X-7.09 Y162.91 Z7.316 I10. J0.
N385 G1 X5.546 Y175.614 Z7.103
N390 G2 X12.636 Y178.562 Z7.01 I7.09 J-7.052
N395 G1 X136.454 Y178.563 Z5.541
N400 G2 X172.247 Y60.902 Z3.595 I0. J-64.274
N405 G3 X141.37 Y15.051 Z2.923 I40.728 J-60.748
N410 G2 X113.213 Y-8.221 Z2.454 I-28.617 J5.954
N415 G1 X.157 Y-9.999 Z1.113
N420 G2 X-10. Y0. Z.925 I-.157 J9.999
N425 G1 Y77.929 Z0.
N430 Y155.858
N435 G2 X-7.09 Y162.91 I10. J0.
N440 G1 X5.546 Y175.614
N445 G2 X12.636 Y178.562 I7.09 J-7.052
N450 G1 X136.454 Y178.563
N455 G2 X172.247 Y60.902 I0. J-64.274
N460 G3 X141.37 Y15.051 I40.728 J-60.748
N465 G2 X113.213 Y-8.221 I-28.617 J5.954
N470 G1 X.157 Y-9.999
N475 G2 X-10. Y0. I-.157 J9.999
N480 G1 Y77.929
N485 G3 X-20. Y87.929 I-10. J0.
N490 G1 G40 Y84.929
N495 G0 Z150.
( T2 FORET D 10)
N500 G53 G90 G0 Z0. H0
N505 M1
N510 T0003 M6
N515 T0001
N520 M8
N525 M79
N530 M11
N535 G0 G54 G90 A10. C40.
N540 M78
N545 M10
N550 X143.004 Y119.781 S2000 M3
N555 G43 Z151. H3
N560 Z51.
N565 G83 G94 G99 Z20. Q10. R51. F300
N570 G80
N575 G0 Z151.
N580 M9
N585 G53 G90 G0 Z0. H0
N590 M5
N595 G53 G90 G0 X0. Y0.
N600 T0001 M6
N605 M30
%





si c'est le cas, le PP fonctionne au premier abord,

tenez moi au courant, svp !

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty ce que j'attends

Message par bruno18100 Dim 3 Mar 2013 - 10:26

bonjours,

si vous avez réussi a faire fonctionner le post processeur avec l'exemple,

je me propose, si ça intéresse, d'indiquer la méthode de configuration catia
pour générer un fichier aptsource compatible.

ensuite, j'attendrais vos résultats de tests sur simulateur machine fanuc pour discuter.

voilà.

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty post processeur simplifie (sans interface graphique a creer)

Message par bruno18100 Mer 24 Avr 2013 - 0:43

bonjour,

ceci est valable pour catia V5 et V6:

dans Outils > Macro > Macros..., ensuite "Creer" le module "PostPro_5AX"

copier-coller le code suivant:
Code:

Const urlaptsource As String = "C:\Users\user\Documents\pp5axesV2\prismatique.aptsource"

Sub CATMain()
               
If PresenceFichier(urlaptsource) = False Then
    MsgBox ("Fichier non trouvé !")
    Exit Sub
End If
               
pp5axes (urlaptsource)

End Sub


"Creer" ensuite le module "Module_PP_5AX",
copier-coller le "bloc 1" (voir messages precedent)
copier-coller le "bloc 2" suivant:

Code:


Sub pp5axes(ByVal urlaptsource As String)


    MsgBox ("debut traitement")
               
               
    Dim newvar0 As varclass
    Dim oldvar0 As varclass
           

    Dim ch0 As String
    Dim path As String
    path = ""
    Dim nom_de_fichier As String
                           


    ch0 = urlaptsource
               
    Do While InStr(ch0, Chr(92)) > 0
   
        path = path + Mid(ch0, 1, InStr(ch0, Chr(92)))
        ch0 = Mid(ch0, InStr(ch0, Chr(92)) + 1)

    Loop

 
    nom_de_fichier = Mid(ch0, 1, InStr(ch0, ".") - 1)


    Dim fichier_sortie As String
   
    Dim fichier_sortie_principal As String
   
   
    Dim fichier_sortie_etat As Integer
    fichier_sortie_etat = -1

 

    Dim fichier_sortie2 As Integer
    fichier_sortie2 = FreeFile

         
    numeroBloc = 5
    increment = 5
       

    oldvar.g.g(1) = 1E+100
    oldvar.g.g(2) = 1E+100
    oldvar.g.g(3) = 1E+100
    oldvar.g.g(5) = 9999
    oldvar.ptf.ax = 1E+100
    oldvar.ptf.bx = 1E+100
    oldvar.ptf.cx = 1E+100
    oldvar.ptf.dx = 1E+100
    oldvar.ptf.ex = 0
    oldvar.outil.tc = 1E+100
    oldvar.outil.arr = 0
    oldvar.outil.s = 1E+100
    oldvar.outil.rot = 1E+100
    oldvar.outil.corrd = 40
    oldvar.cycle.Zaf = 1E+100
    oldvar.ptc.ac = 1E+100
    oldvar.ptc.bc = 1E+100
    oldvar.ptc.at = 0
    oldvar.cycle.Gs = 1E+100
    oldvar.plunge = 0
    oldvar.cldx = 1
    oldvar.clex = 1
    oldvar.g682m = 69

    newvar.px = 0
    newvar.py = 0
    newvar.pz = 0
       
    newvar.g.g(1) = 1E+100
    newvar.g.g(2) = 54
    newvar.g.g(3) = 90
    newvar.g.g(5) = 94
    newvar.ptf.dx = 0
    newvar.ptf.ex = 0
    newvar.outil.arr = 0
    newvar.outil.code_arr(0) = cstarr0
    newvar.outil.code_arr(1) = cstarr1
    newvar.outil.code_arr(2) = cstarr2
    newvar.outil.code_arr(3) = cstarr3
    newvar.outil.code_arr(4) = cstarr4
    newvar.outil.s = 1E+100
    newvar.outil.f = 10000000000#
    newvar.outil.rot = 1E+100
    newvar.outil.couple = 0
    newvar.outil.corrd = 40
    newvar.cycle.Zaf = 1E+100
    newvar.ptc.at = 0
    newvar.plunge = 0
    newvar.cldx = 1
    newvar.clex = 1
    newvar.rotdx = 1E+100
    newvar.rotex = 1E+100
    newvar.defaultex = 1E+100
    newvar.g682auto = 0
    newvar.g682m = 69
    newvar.g682x = 0
    newvar.g682y = 0
    newvar.g682z = 0
    newvar.g434etat = 0
    newvar.lintol = 0
    newvar.rotetat = 0
       
    sortie.cetat = 0
       

    Dim ptd As pointdebut
    Dim ptf As pointfinal
    Dim ptfa As pointfinal
       
    sortie.chaine = ""
    sortie.Erreur = ""



    Dim saisie As String
    Dim buffer As String
    Dim buffer2 As String
    Dim chaine1 As String
    Dim chaine2 As String
    Dim cle1 As String
    Dim concat As Integer
    Dim compteur As Double
    Dim num1 As Integer
    Dim i_outil_suivant As Integer
    Dim at As Double
    Dim az As Double
    Dim var1 As Double
    Dim var2 As Double
    Dim var3 As Double
    Dim ch1 As String
    Dim total As Long
    total = 0
       

    newvar.etat = 0

    Dim liste_outils(1999) As Long
    Dim i1 As Integer
    i1 = 1

 
 
    Dim fichier_entree0 As Integer
    fichier_entree0 = FreeFile
 
    Open urlaptsource For Input As fichier_entree0
       
       
       
    Do While Not EOF(fichier_entree0)
           
           
        Line Input #fichier_entree0, saisie

        total = total + 1
        chaine1 = saisie
               
               
        If InStr(chaine1, "LOADTL") = 1 Then
       
            chaine1 = Mid(saisie, InStr(saisie, "/") + 1)
           
            If InStr(chaine1, ",") > 0 Then
                chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
            Else
                chaine2 = chaine1
            End If
           
            liste_outils(i1) = CLng(Fix(Val(chaine2)))

            If (i1 > 1) And (liste_outils(i1) = liste_outils(i1 - 1)) Then
                i1 = i1 - 1
            End If

            i1 = i1 + 1
        End If

    Loop

    liste_outils(i1) = liste_outils(1)

    Close #fichier_entree0

       
       
    i_outil_suivant = 2
    Dim ligne As Long
    ligne = 0
    concat = 0
    boucle = 1
    passage = 0
       
     
       
       
       
    Dim fichier_entree As Integer
    fichier_entree = FreeFile
 
    Open urlaptsource For Input As #fichier_entree
       
       
       
       
    Do While Not EOF(fichier_entree)
       
       
        If boucle = 1 Then
            Line Input #fichier_entree, saisie
        Else
            saisie = buffer
            passage = 1
        End If



        compteur = compteur + 1
       
        If CLng(compteur / 100) <> ligne Then
            ligne = CLng(compteur / 100)
'            pp_saisie.Label1.Caption = Str(ligne * 100) + "  lignes traitees sur " + Str(total)
'            DoEvents
        End If
       


        If InStr(saisie, "$$") > 0 Then
            saisie = "rien"
            newvar.etat = 0
        Else
            buffer2 = saisie
        End If
       

        num1 = Len(saisie)
       


        If InStr(saisie, "$") > 0 Then
            If concat = 0 Then
                buffer = Mid(saisie, 1, InStr(saisie, "$") - 1)
                concat = 1
            Else
                buffer = buffer + Mid(saisie, 1, InStr(saisie, "$") - 1)
            End If
        Else
            If concat = 0 Then
                buffer = saisie
            Else
                buffer = buffer + saisie
                concat = 0
            End If
        End If
     
       


        If concat = 0 Then

            newvar.etat = 0
       
            If InStr(buffer, "PARTNO") = 1 Then
       
                ch0 = UCase(Mid(buffer, 8))
                fichier_sortie_principal = ""
               
                For i1 = 1 To Len(ch0)
                    num1 = Asc(Mid(ch0, i1, 1))
                    If num1 >= 48 And num1 <= 57 Then
                        fichier_sortie_principal = fichier_sortie_principal + Chr(num1)
                    End If
                Next
               
                If Val(fichier_sortie_principal) = 0 Or Val(fichier_sortie_principal) > 9999 Then
                    fichier_sortie_principal = "0001"
                    MsgBox ("PARTNO incorrect, sortie renommée en 0001 ")
                End If
               
                sortie.chaine = "%O" + Mid(Str(Val(fichier_sortie_principal) + 10000), 3)
                fichier_sortie = fichier_sortie_principal
                newvar.etat = 1
                 
                If PresenceFichier(path + fichier_sortie + ".tap") <> False Then
                    Set fs = CreateObject("Scripting.FileSystemObject")
                    Set f = fs.GetFile(path + fichier_sortie + ".tap")
                    f.Delete
                End If

                Dim Fichier0 As Long
   
                Fichier0 = FreeFile
                Open path + fichier_sortie + ".tap" For Append As #Fichier0
   
                MsgBox (fichier_sortie + ".tap")
'                DoEvents
               
                fichier_sortie_etat = 0
               
            End If





            If InStr(buffer, "SEQNO") = 1 Then
                If InStr(buffer, "OFF") > 0 Then
                    numeroBloc = -1
                Else
                    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                    numeroBloc = Abs(Val(Mid(chaine1, 1, InStr(chaine1, ",") - 1)))
                    chaine1 = Mid(chaine1, InStr(chaine1, "INCR,") + 5)
                    increment = Abs(Val(chaine1))
                End If
            End If
           


            If InStr(buffer, "PPRINT") = 1 Then
       
                chaine1 = Mid(buffer, 7)
                chaine1 = StrConv(chaine1, vbUpperCase)
                chaine2 = "("
                chaine2 = chaine2 + chaine1
                chaine2 = chaine2 & ")"
                sortie.chaine = chaine2
                newvar.etat = 1
                 
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If

            End If



            If InStr(buffer, "INSERT") = 1 Then
       
                chaine2 = Mid(buffer, 8)
                chaine2 = chaine2
                sortie.chaine = chaine2
                newvar.etat = 1

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If



            If InStr(buffer, "PIVOTZ") = 1 Then
       
                If InStr(buffer, "OFF") > 0 Or InStr(buffer, "AUTO") > 0 Then
                Else
                    Call word_pivotz(buffer, newvar)
                    oldvar.px = newvar.px
                    oldvar.py = newvar.py
                    oldvar.pz = newvar.pz
                End If
           
            End If





            If InStr(buffer, "DEFSUB") = 1 Then
       
                If fichier_sortie_etat = 0 Then
               
                    chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                    chaine2 = Str(10000 + Val(chaine1))
                    chaine2 = Mid(chaine2, 3)
                    fichier_sortie = fichier_sortie_principal & "S" & chaine2
 
                    If PresenceFichier(path + fichier_sortie + ".tap") <> False Then
                        Set fs = CreateObject("Scripting.FileSystemObject")
                        Set f = fs.GetFile(path + fichier_sortie + ".tap")
                        f.Delete
                    End If

                    Close #Fichier0
                   
                    Fichier0 = FreeFile
                    Open path + fichier_sortie + ".tap" For Append As #Fichier0
   
                    pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                    DoEvents
 
                    sortie.chaine = "%O" & chaine2
                    newvar.etat = 1
                    fichier_sortie_etat = 1
                End If
               
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If



            If InStr(buffer, "ENDSUB") = 1 Then
       
                If fichier_sortie_etat = 1 Then
                    newvar.etat = 0
                    Print #Fichier0, numN + " M99" + vbLf + "%" + vbLf
                    Close #Fichier0
                   
                    fichier_sortie_etat = 0
                    fichier_sortie = fichier_sortie_principal
                   
                    Fichier0 = FreeFile
                    Open path + fichier_sortie + ".tap" For Append As #Fichier0
                   
                    pp_saisie.Label2.Caption = fichier_sortie + ".tap"
                    DoEvents
               
                End If
               
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If



            If InStr(buffer, "CALSUB") = 1 Then
       
                chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                chaine2 = Str(10000 + Val(chaine1))
                chaine2 = Mid(chaine2, 3)

                sortie.chaine = numN + " M98 P" & chaine2
                newvar.etat = 1

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If






            If InStr(buffer, "CLAMP") = 1 Then
           
                If InStr(buffer, "1") > 0 Then
                    If InStr(buffer, "OFF") > 0 Then
                        newvar.cldx = 0
                    Else
                        newvar.cldx = 1
                    End If
                Else
                    If InStr(buffer, "2") > 0 Then
                        If InStr(buffer, "OFF") > 0 Then
                            newvar.clex = 0
                        Else
                            newvar.clex = 1
                        End If
                    Else
                        If InStr(buffer, "OFF") > 0 Then
                            newvar.cldx = 0
                            newvar.clex = 0
                        Else
                            newvar.cldx = 1
                            newvar.clex = 1
                        End If
                    End If
                End If
               
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If






            If InStr(buffer, "CUTTER") = 1 Then
           
                newvar.outil.dia = Val(Mid(buffer, InStr(buffer, "/") + 1, InStr(buffer, ",")))
                newvar.etat = 0

            End If





            If InStr(buffer, "LOADTL") = 1 Then
       
                newvar.outil.ts = liste_outils(i_outil_suivant)
                Call word_loadtl(buffer, newvar, oldvar, sortie)
                i_outil_suivant = i_outil_suivant + 1
                 
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "COOLNT") = 1 Then
       
                If InStr(buffer, "FLOOD") > 0 Then
                        newvar.outil.arr = 1
                End If
               
                If InStr(buffer, "MIST") > 0 Then
                    If InStr(buffer, ",1") > 0 Or InStr(buffer, ",") = 0 Then
                        newvar.outil.arr = 2
                    End If
                    If InStr(buffer, ",2") > 0 Then
                        newvar.outil.arr = 3
                    End If
                    If InStr(buffer, ",3") > 0 Then
                        newvar.outil.arr = 4
                    End If
                End If
               
                If InStr(buffer, "OFF") > 0 Then
                    newvar.outil.arr = 0
                   
                    If newvar.outil.arr <> oldvar.outil.arr Then
                        sortie.chaine = cm9
                    Else
                        sortie.chaine = ""
                    End If
                   
                    newvar.etat = 1
                Else
                    newvar.etat = 0
                End If
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "SPINDL") = 1 Then
       
                Call word_spindl(buffer, oldvar, newvar, sortie)
                 
                If sortie.cetat = 1 And newvar.outil.s <> oldvar.outil.s Then
                    sortie.cetat = 2
                End If
       
            End If




            If InStr(buffer, "COUPLE") = 1 Then
       
                If InStr(buffer, "ON") > 0 Then
           
                    If InStr(buffer, "1") > 0 Then
                        newvar.outil.couple = 1
                    Else
                        newvar.outil.couple = 2
                    End If
               
                Else
           
                    newvar.outil.couple = 0
               
                End If
               
                newvar.etat = 0
                   
                If sortie.cetat = 1 And newvar.outil.couple <> oldvar.outil.couple Then
                    sortie.cetat = 2
                End If

            End If




            If InStr(buffer, "FEDRAT") = 1 Then
       
                Call word_fedrat(buffer, newvar, oldvar, sortie)
               
 '              MsgBox ("fedrat  " + Str(newvar.outil.Forigin))
               
               
                If sortie.cetat = 1 And newvar.outil.Forigin <> oldvar.outil.Forigin Then
                    sortie.cetat = 2
                End If
                   
            End If






            If InStr(buffer, "RAPID") = 1 Then
       
                If newvar.g.g(1) <> 80 Then
                    newvar.g.g(1) = 0
                End If
           
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If




            If InStr(buffer, "CUTCOM") = 1 Then
       
                Call extract_cutcom(buffer, newvar)
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If
       
       


            If InStr(buffer, "GOTO") = 1 Then
               
                Call word_goto(buffer, newvar, oldvar, sortie)
           
            End If





            If InStr(buffer, "INDIRV") > 0 Then
       
                Call extract_indirv(buffer, newvar, oldvar)
                newvar.etat = 0

            End If






            If InStr(buffer, "CIRCLE") > 0 Or InStr(buffer, "CYLNDR") > 0 Then
       
                If sortie.cetat = 10 Then
                    sortie.cetat = 2
                Else
                    Call words_circle_cylndr(buffer, oldvar, newvar, sortie)
                End If
               
            End If





            If InStr(buffer, "HELICAL") > 0 Then
       
                If sortie.cetat = 10 Then
                    sortie.cetat = 2
                Else
                    Call word_helical(buffer, oldvar, newvar, sortie)
                End If
           
            End If




            If InStr(buffer, "MODE") = 1 Then
           
                If InStr(buffer, "HIGH") > 0 Then
                    If InStr(buffer, "OFF") > 0 Then
                        newvar.high = 0
                        If newvar.high_etat = 1 Then
                            newvar.etat = 0
                        Else
                            sortie.chaine = cg51q0
                            newvar.etat = 1
                        End If
                    Else
                        ch1 = Mid(buffer, InStr(buffer, ",") + 1)
                        If InStr(ch1, ",") > 0 Then
                            ch1 = Mid(ch1, 1, InStr(ch1, ",") - 1)
                        End If
                        newvar.high = Val(ch1)
                        If InStr(buffer, "START") > 0 Then
                            newvar.high_etat = 1
                            newvar.etat = 0
                        Else
                            newvar.high_etat = 0
                        End If
                        If newvar.high >= 1 And newvar.high <= 10 And newvar.high_etat = 0 Then
                            sortie.chaine = cg51q1r + Mid(Str(newvar.high), 2)
                            newvar.etat = 1
                        End If
                    End If
                End If
               
                If InStr(buffer, "XYZ") = 0 And InStr(buffer, "HIGH") = 0 Then
                    If InStr(buffer, "OFF") > 0 Then
                        sortie.chaine = "G49G53Z0"
                        newvar.g434etat = 0
                        newvar.etat = 1
                    End If
                    If InStr(buffer, "ON") > 0 Then
                        newvar.g.g(4) = 43.4
                        oldvar.g.g(4) = 1E+100
                        oldvar.g.g(1) = 1E+100
                        oldvar.g.g(3) = 1E+100
                        oldvar.outil.f = 100000000
                        newvar.g434etat = 1
                        newvar.etat = 0
                    End If
                End If
       
            End If





            If InStr(buffer, "REVERS") = 1 Then
       
                If InStr(buffer, "OFF") > 0 Then
                    newvar.g682auto = 0
                    newvar.g682m = 69
                    newvar.g682x = 0
                    newvar.g682y = 0
                    newvar.g682z = 0
                    sortie.chaine = "G69"
                    oldvar.g682m = 69
                    newvar.etat = 1
                Else
                    newvar.g682auto = 1
                    newvar.g682m = 68.2
                    newvar.etat = 0
                End If
               
            End If




            If InStr(buffer, "TOOLNO") = 1 Then
       
                If InStr(buffer, "RADIUS") > 0 Then
                    newvar.outil.d = CInt(Fix(Val(Mid(buffer, InStr(buffer, ",") + 1))))
                Else
                    newvar.outil.h = CInt(Fix(Val(Mid(buffer, InStr(buffer, "/") + 1))))
                    oldvar.outil.corrh = -1
                End If
               
                newvar.etat = 0

            End If




            If InStr(buffer, "STOP") = 1 Then

                sortie.chaine = cm0
                newvar.etat = 1
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "OSTOP") = 1 Then

                sortie.chaine = cm1
                newvar.etat = 1
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If


       
       
            If InStr(buffer, "ROTABL") = 1 Then

                chaine1 = Mid(buffer, InStr(buffer, "/") + 1)

                If InStr(chaine1, "AAXIS") > 0 Then
                    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

                    If InStr(chaine1, ",") > 0 Then
                        chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                    Else
                        chaine2 = chaine1
                    End If

                    newvar.rotdx = Val(chaine2)
                End If

                If InStr(chaine1, "CAXIS") > 0 Then
           
                    chaine1 = Mid(chaine1, InStr(chaine1, ",") + 1)

                    If InStr(chaine1, ",") > 0 Then
                        chaine2 = Mid(chaine1, 1, InStr(chaine1, ","))
                    Else
                        chaine2 = chaine1
                    End If

                    newvar.rotex = Val(chaine2)
                    newvar.ptf.ex = newvar.rotex
                       
                End If

                newvar.etat = 0
                       
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
               
            End If




            If InStr(buffer, "MOVETO") = 1 Then
       
                Call word_moveto(buffer, newvar, oldvar, sortie)

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If



            If InStr(buffer, "DELAY") = 1 Then
       
                chaine1 = Mid(buffer, InStr(buffer, "/") + 1)
                sortie.chaine = "G4X" + chaine(Val(chaine1))
                newvar.etat = 1
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If
       
       

            If InStr(buffer, "ORIGIN") = 1 Then
       
                Call word_origin(buffer, newvar, oldvar, sortie)
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If


            If InStr(buffer, "CYCLE/OFF") = 1 Then
       
                newvar.g.g(1) = 1E+100
                oldvar.g.g(1) = 1E+100
                newvar.cycle.Gs = 999
                sortie.chaine = numN + cg80
                oldvar.ptf.cx = newvar.cycle.Zaf
                newvar.etat = 1
           
            End If


            If InStr(buffer, "LINTOL") = 1 Then
       
                If InStr(buffer, "OFF") > 0 Then
                    newvar.lintol = 0
                Else
                    newvar.lintol = Val(Mid(buffer, InStr(buffer, "/") + 1))
                End If
           
                newvar.etat = 0
           
                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If




            If InStr(buffer, "CYCLE/BRKCHP") = 1 Or InStr(buffer, "CYCLE/INVERS") = 1 Or _
                InStr(buffer, "CYCLE/LOCK") = 1 Or InStr(buffer, "CYCLE/DRILL") = 1 Or _
                InStr(buffer, "CYCLE/FACE") = 1 Or InStr(buffer, "CYCLE/DEEP") = 1 Or _
                InStr(buffer, "CYCLE/TAP") = 1 Or InStr(buffer, "CYCLE/BORE") = 1 Or _
                InStr(buffer, "CYCLE/REAM") = 1 Or InStr(buffer, "CYCLE/STEP") = 1 Or _
                InStr(buffer, "CYCLE/MANUAL") = 1 Or InStr(buffer, "CYCLE/THRU") = 1 Then
           
                oldvar.cycle.Gs = 999
                Call word_cycle(buffer, newvar)
                newvar.outil.Forigin = newvar.outil.f
                oldvar.outil.f = -1
                newvar.etat = 0

                If sortie.cetat = 1 Then
                    sortie.cetat = 2
                End If
           
            End If





            If InStr(buffer, "CATMAT") = 1 Then
       
                Call word_catmat(buffer, newvar)
           
                If newvar.g682auto = 1 Then
                    newvar.g682x = newvar.rotb.mat(1, 4) + newvar.rota.mat(1, 4)
                    newvar.g682y = newvar.rotb.mat(2, 4) + newvar.rota.mat(2, 4)
                    newvar.g682z = newvar.rotb.mat(3, 4) + newvar.rota.mat(3, 4)
                    oldvar.ptf.dx = 1E+100
                    oldvar.ptf.ex = 1E+100
                End If
           
                newvar.etat = 0
           
            End If


   

   
            If sortie.cetat = 2 And boucle = 1 Then
           
'                MsgBox ("Fold0 " + Str(oldvar.outil.Forigin) + "  Fnew0 " + Str(newvar.outil.Forigin))
         
                newvar = sortie.imanew1
                oldvar = sortie.imaold1
                newvar.etat = 1
'                MsgBox ("Fold1 " + Str(oldvar.outil.Forigin) + "  Fnew1 " + Str(newvar.outil.Forigin))
               
                Call spcircle(oldvar, newvar, sortie)
                boucle = -1
                sortie.cetat = 0
               
            End If






            If newvar.etat = 1 Then
           
                If fichier_sortie_etat <> -1 Then
           
                    If Len(sortie.Erreur) > 0 Then
                        Print #Fichier0, sortie.Erreur
                    End If
           
                    If Len(sortie.chaine) > 0 Then
                        Print #Fichier0, sortie.chaine
                    End If
           
                    sortie.chaine = ""
                    sortie.Erreur = ""
                   
                Else
                    Close #fichier_entree
                    MsgBox ("PARTNO non défini !")
                    Exit Sub
                End If

            End If


        End If
       
       
       
        If passage = 1 Then
            boucle = 1
            passage = 0
        End If
       

    Loop


    Close #fichier_entree
       
   
    sortie.chaine = numN + cstarr0 + vbLf
   
    If numeroBloc > 0 Then
        sortie.chaine = sortie.chaine + numN + finligne1 + vbLf
    Else
        sortie.chaine = sortie.chaine + cstn + "9999" + finligne1 + vbLf
    End If
    sortie.chaine = sortie.chaine + numN + finligne2 + vbLf
    sortie.chaine = sortie.chaine + numN + finligne3 + vbLf
    If liste_outils(1) <> newvar.outil.tc Then
        sortie.chaine = sortie.chaine + numN + cstt + Mid(Str(10000 + _
        liste_outils(1)), 3) + cm6 + vbLf
    End If
    sortie.chaine = sortie.chaine + numN + finligne4 + vbLf + "%" + vbLf
   
       
    Print #Fichier0, sortie.chaine
   
   
    Close #Fichier0

    MsgBox ("fin traitement")



End Sub


copier-coller les blocs "bloc 3", "bloc 4", et "bloc 5"

voila

bruno18100
actif
actif

Messages : 39
Date d'inscription : 25/06/2012
Localisation : vierzon

Revenir en haut Aller en bas

essai post-processeur 5 axes table-table broche verticale   -  fanuc Empty Re: essai post-processeur 5 axes table-table broche verticale - fanuc

Message par Contenu sponsorisé


Contenu sponsorisé


Revenir en haut Aller en bas

Page 1 sur 2 1, 2  Suivant

Revenir en haut

- Sujets similaires

 
Permission de ce forum:
Vous ne pouvez pas répondre aux sujets dans ce forum