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_execNameAssociaSolidAxis(void)
00054 {
00055 char sname[30], aname[30];
00056
00057 while (2 != sscanf(restbuf, "%s %s", sname, aname))
00058 {
00059 printf("AssAxisSolid: solido axis\n");
00060 if (!lineins("? "))
00061 {
00062 return;
00063 }
00064 }
00065 MSD_highNameAssociaSolidAxis(sname, aname);
00066 }
00067
00068 #endif
00069
00070 int MSD_highNameAssociaSolidAxis(char *name1, char *name2)
00071 {
00072 int sn, an;
00073
00074 if ((sn = MSD_getSolidIdFromName(name1)) == -1)
00075 {
00076 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_AssociaAxisSolid, name1);
00077 return(ERROR);
00078 }
00079 if ((an = MSD_getAxisIdFromName(name2)) == -1)
00080 {
00081 fprintf(stderr, MEN_NaoEncontrouAxisNome, NAM_AssociaAxisSolid, name2);
00082 return(ERROR);
00083 }
00084 return(MSD_highAssociaSolidAxis(sn, an));
00085 }
00086
00087 #ifdef __Extended_Version
00088 void MSD_execAssociaSolidAxis(void)
00089 {
00090 int sn, an;
00091
00092 while (2 != sscanf(restbuf, "%d %d", &sn, &an))
00093 {
00094 printf("AssAxisSolid: sn an\n");
00095 if (!lineins("? "))
00096 {
00097 return;
00098 }
00099 }
00100 MSD_highAssociaSolidAxis(sn, an);
00101 }
00102
00103 #endif
00104
00105 int MSD_highAssociaSolidAxis(int sn, int an)
00106 {
00107 SPTYPE optr;
00108 APTYPE aptr;
00109
00110 if (((optr = MSD_getSolid(sn)) == SNIL) && (sn != -1))
00111 {
00112 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_AssociaAxisSolid, sn);
00113 return(ERROR);
00114 }
00115 if (((aptr = MSD_getAxis(sn)) == ANIL) && (an != -1))
00116 {
00117 fprintf(stderr, MEN_NaoEncontrouAxisId, NAM_AssociaAxisSolid, an);
00118 return(ERROR);
00119 }
00120 if ((sn == -1) && (an == -1))
00121 {
00122 fprintf(stderr, MEN_PonteirosNulos, NAM_AssociaAxisSolid);
00123 return(ERROR);
00124 }
00125 return(MSD_lowAssociaSolidAxis(aptr, optr));
00126 }
00127
00128 int MSD_lowAssociaSolidAxis(APTYPE aptr, SPTYPE optr)
00129 {
00130 Id code, sn, an;
00131
00132 if (Gdoinversion)
00133 {
00134
00135
00136
00137
00138 an = AxsAxisNo(aptr);
00139 code = sn = -1;
00140 if (aptr != ANIL)
00141 {
00142 if (AxsType(aptr) == GROUP)
00143 {
00144 sn = GrpGroupNo(AxsAGroup(aptr));
00145 code = AxisGroup;
00146 }
00147 if (AxsType(aptr) == SOLID)
00148 {
00149 sn = SolSolidNo(AxsASolid(aptr));
00150 code = AxisSolid;
00151 }
00152 MSD_lowAddEulerOp(SNIL, ASSOCIATE, code, an, sn, 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 = sn = -1;
00162 if (optr != SNIL)
00163 {
00164 if (SolOAxs(optr) != ANIL)
00165 {
00166 sn = SolSolidNo(optr);
00167 an = AxsAxisNo(SolOAxs(optr));
00168 code = AxisSolid;
00169 }
00170 MSD_lowAddEulerOp(SNIL, ASSOCIATE, code, an, sn, 0, 0, 0, 0, 0,
00171 0.0, 0.0, 0.0, 0.0);
00172 }
00173 }
00174
00175 if (aptr != ANIL)
00176 {
00177 if (AxsType(aptr) == SOLID)
00178 {
00179 SolOAxs(AxsASolid(aptr)) = ANIL;
00180 }
00181 if (AxsType(aptr) == GROUP)
00182 {
00183 GrpGAxs(AxsAGroup(aptr)) = ANIL;
00184 }
00185 AxsType(aptr) = SOLID;
00186 AxsASolid(aptr) = optr;
00187 }
00188
00189 if (optr != SNIL)
00190 {
00191 if (SolOAxs(optr) != ANIL)
00192 {
00193 AxsASolid(SolOAxs(optr)) = SNIL;
00194 }
00195 SolOAxs(optr) = aptr;
00196 }
00197 return(SUCCESS);
00198 }
00199
00200 int MSD_execStructAssociate(EulerOp *op)
00201 {
00202 Id code, an, sn;
00203
00204 code = op->ip1;
00205 an = op->ip2;
00206 sn = op->ip3;
00207 switch (code)
00208 {
00209 case AxisSolid:
00210 return(MSD_highAssociaSolidAxis(an, sn));
00211
00212 case AxisGroup:
00213 return(MSD_highAssociaGroupAxis(an, sn));
00214
00215 case GroupSolid:
00216 return(MSD_highAssociaGroupSolid(an, sn));
00217
00218 case GroupGroup:
00219 return(MSD_highAssociaGroupGroup(an, sn));
00220
00221 case - 1:
00222 return(SUCCESS);
00223
00224 default:
00225 return(ERROR);
00226 }
00227 }
00228
00229 void MSD_printStructAssociate(FILE *f, EulerOp *op)
00230 {
00231 Id sid, id1, id2, id3;
00232
00233 sid = op->solidno;
00234 id1 = op->ip1;
00235 id2 = op->ip2;
00236 id3 = op->ip3;
00237 fprintf(f, "associate %d %d %d %d\n", sid, id1, id2, id3);
00238 }
00239
00240 int MSD_readStructAssociate(FILE *f, EulerOp *op)
00241 {
00242 int solidno, ip1, ip2, ip3;
00243
00244 if (fscanf(f, "%d %d %d %d\n", &solidno, &ip1, &ip2, &ip3) != 4)
00245 {
00246 return(ERROR);
00247 }
00248 op->solidno = solidno;
00249 op->ip1 = ip1;
00250 op->ip2 = ip2;
00251 op->ip3 = ip3;
00252 op->ip4 = 0;
00253 op->ip5 = 0;
00254 op->ip6 = 0;
00255 op->ip7 = 0;
00256 op->ip8 = 0;
00257 op->fp1 = 0.0;
00258 op->fp2 = 0.0;
00259 op->fp3 = 0.0;
00260 op->fp4 = 0.0;
00261 return(SUCCESS);
00262 }
00263
00264 int MSD_modifyStructAssociate(EulerOp *op)
00265 {
00266 Id code, an, sn;
00267
00268 code = op->ip1;
00269 an = op->ip2;
00270 sn = op->ip3;
00271 switch (code)
00272 {
00273 case AxisSolid:
00274 an = MSD_lowCheckTranslatorTable(an, AXIS);
00275 sn = MSD_lowCheckTranslatorTable(sn, SOLID);
00276 break;
00277
00278 case AxisGroup:
00279 an = MSD_lowCheckTranslatorTable(an, AXIS);
00280 sn = MSD_lowCheckTranslatorTable(sn, GROUP);
00281 break;
00282
00283 case GroupSolid:
00284 an = MSD_lowCheckTranslatorTable(an, GROUP);
00285 sn = MSD_lowCheckTranslatorTable(sn, SOLID);
00286 break;
00287
00288 case GroupGroup:
00289 an = MSD_lowCheckTranslatorTable(an, GROUP);
00290 sn = MSD_lowCheckTranslatorTable(sn, GROUP);
00291 break;
00292 }
00293 op->ip2 = an;
00294 op->ip3 = sn;
00295 return(SUCCESS);
00296 }