00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041 #include <stdio.h>
00042 #include "mensagem.h"
00043 #include "memvirtu.h"
00044 #include "lowparam.h"
00045 #include "lowmacro.h"
00046 #include "lowsolid.h"
00047 #include "vectorop.h"
00048 #include "eulerops.h"
00049 #include "mancommd.h"
00050 #include "hiegroup.h"
00051
00052 #ifdef __Extended_Version
00053 void MSD_execNameAssociaGroupAxis(void)
00054 {
00055 char sname[30], aname[30];
00056
00057 while (2 != sscanf(restbuf, "%s %s", sname, aname))
00058 {
00059 printf("AssAxisGroup: grupo axis\n");
00060 if (!lineins("? "))
00061 {
00062 return;
00063 }
00064 }
00065 MSD_highNameAssociaGroupAxis(sname, aname);
00066 }
00067
00068 #endif
00069
00070 int MSD_highNameAssociaGroupAxis(char *name1, char *name2)
00071 {
00072 int sn, an;
00073
00074 if ((sn = MSD_getGroupIdFromName(name1)) == -1)
00075 {
00076 fprintf(stderr, MEN_NaoEncontrouGroupNome, NAM_AssociaAxisGroup, name1);
00077 return(ERROR);
00078 }
00079 if ((an = MSD_getAxisIdFromName(name2)) == -1)
00080 {
00081 fprintf(stderr, MEN_NaoEncontrouAxisNome, NAM_AssociaAxisGroup, name2);
00082 return(ERROR);
00083 }
00084 return(MSD_highAssociaGroupAxis(sn, an));
00085 }
00086
00087 #ifdef __Extended_Version
00088 void MSD_execAssociaGroupAxis(void)
00089 {
00090 int sn, an;
00091
00092 while (2 != sscanf(restbuf, "%d %d", &sn, &an))
00093 {
00094 printf("AssAxisGroup: gn an\n");
00095 if (!lineins("? "))
00096 {
00097 return;
00098 }
00099 }
00100 MSD_highAssociaGroupAxis(sn, an);
00101 }
00102
00103 #endif
00104
00105 int MSD_highAssociaGroupAxis(int sn, int an)
00106 {
00107 GPTYPE gptr;
00108 APTYPE aptr;
00109
00110 if (((gptr = MSD_getGroup(sn)) == GNIL) && (sn != -1))
00111 {
00112 fprintf(stderr, MEN_NaoEncontrouGroupId, NAM_AssociaAxisGroup, sn);
00113 return(ERROR);
00114 }
00115 if (((aptr = MSD_getAxis(sn)) == ANIL) && (an != -1))
00116 {
00117 fprintf(stderr, MEN_NaoEncontrouAxisId, NAM_AssociaAxisGroup, an);
00118 return(ERROR);
00119 }
00120 if ((sn == -1) && (an == -1))
00121 {
00122 fprintf(stderr, MEN_PonteirosNulos, NAM_AssociaAxisGroup);
00123 return(ERROR);
00124 }
00125 return(MSD_lowAssociaGroupAxis(aptr, gptr));
00126 }
00127
00128 int MSD_lowAssociaGroupAxis(APTYPE aptr, GPTYPE gptr)
00129 {
00130 Id code, gn, an;
00131
00132 if (Gdoinversion)
00133 {
00134
00135
00136
00137
00138 code = gn = -1;
00139 if (aptr != ANIL)
00140 {
00141 an = AxsAxisNo(aptr);
00142 if (AxsType(aptr) == GROUP)
00143 {
00144 gn = GrpGroupNo(AxsAGroup(aptr));
00145 code = AxisGroup;
00146 }
00147 if (AxsType(aptr) == SOLID)
00148 {
00149 gn = SolSolidNo(AxsASolid(aptr));
00150 code = AxisSolid;
00151 }
00152 MSD_lowAddEulerOp(SNIL, ASSOCIATE, code, an, gn, 0, 0, 0, 0, 0,
00153 0.0, 0.0, 0.0, 0.0);
00154 }
00155
00156
00157
00158
00159
00160 code = -1;
00161 an = gn = -1;
00162 if (gptr != GNIL)
00163 {
00164 if (GrpGAxs(gptr) != ANIL)
00165 {
00166 gn = GrpGroupNo(gptr);
00167 an = AxsAxisNo(GrpGAxs(gptr));
00168 code = AxisGroup;
00169 }
00170 MSD_lowAddEulerOp(SNIL, ASSOCIATE, code, an, gn, 0, 0, 0, 0, 0,
00171 0.0, 0.0, 0.0, 0.0);
00172 }
00173 }
00174
00175
00176
00177
00178 if (aptr != ANIL)
00179 {
00180 if (AxsType(aptr) == SOLID)
00181 {
00182 SolOAxs(AxsASolid(aptr)) = ANIL;
00183 }
00184 if (AxsType(aptr) == GROUP)
00185 {
00186 GrpGAxs(AxsAGroup(aptr)) = ANIL;
00187 }
00188 AxsType(aptr) = GROUP;
00189 AxsAGroup(aptr) = gptr;
00190 }
00191
00192
00193
00194
00195 if (gptr != GNIL)
00196 {
00197 if (GrpGAxs(gptr) != ANIL)
00198 {
00199 AxsAGroup(GrpGAxs(gptr)) = GNIL;
00200 }
00201 GrpGAxs(gptr) = aptr;
00202 }
00203 return(SUCCESS);
00204 }