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 <string.h>
00043 #ifndef __UNIX_
00044 #include <stdlib.h>
00045 #endif
00046 #include "mensagem.h"
00047 #include "memvirtu.h"
00048 #include "lowparam.h"
00049 #include "lowmacro.h"
00050 #include "lowsolid.h"
00051 #include "eulerops.h"
00052 #include "genfunc_.h"
00053 #include "curvgeom.h"
00054 #include "mancommd.h"
00055
00056 #ifdef __Extended_Version
00057 void MSD_execNome(void)
00058 {
00059 int s, cod, op;
00060 char nome[13];
00061
00062 while (4 != sscanf(restbuf, "%d %d %d %s", &s, &op, &cod, nome))
00063 {
00064 printf("nome: Sid nome cod \n");
00065 if (!lineins("? "))
00066 {
00067 return;
00068 }
00069 }
00070 MSD_highName(s, nome, cod);
00071 }
00072
00073 #endif
00074
00075 int MSD_highName(Id sn, char *nome, int cod)
00076 {
00077 SPTYPE s;
00078 GPTYPE g;
00079 APTYPE a;
00080
00081 if (cod == SOLID)
00082 {
00083 if ((s = MSD_getSolid(sn)) == SNIL)
00084 {
00085 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_Name, sn);
00086 return(ERROR);
00087 }
00088 MSD_lowSolidName(s, nome);
00089 }
00090 if (cod == GROUP)
00091 {
00092 if ((g = MSD_getGroup(sn)) == GNIL)
00093 {
00094 fprintf(stderr, MEN_NaoEncontrouGroupId, NAM_Name, sn);
00095 return(ERROR);
00096 }
00097 MSD_lowGroupName(g, nome);
00098 }
00099 if (cod == AXIS)
00100 {
00101 if ((a = MSD_getAxis(sn)) == ANIL)
00102 {
00103 fprintf(stderr, MEN_NaoEncontrouAxisId, NAM_Name, sn);
00104 return(ERROR);
00105 }
00106 MSD_lowAxisName(a, nome);
00107 }
00108 return(SUCCESS);
00109 }
00110
00111 void MSD_lowSolidName(SPTYPE s, char *nome)
00112 {
00113 int sid;
00114 char name[13];
00115
00116 sid = SolSolidNo(s);
00117 if (Gdoinversion)
00118 {
00119 strcpy(name, SolName(s));
00120 MSD_lowAddEulerOp(s, NAME, sid, -1, name[6], name[7],
00121 name[8], name[9],
00122 name[10], name[11], 0.0, 0.0, 0.0, 0.0);
00123 MSD_lowAddEulerOp(s, NAME, sid, SOLID, name[0], name[1],
00124 name[2], name[3],
00125 name[4], name[5], 0.0, 0.0, 0.0, 0.0);
00126 }
00127 if (Gdodirect)
00128 {
00129 MSD_lowAddEulerOpRedo(s, NAME, sid, -1, nome[6], nome[7],
00130 nome[8], nome[9],
00131 nome[10], nome[11], 0.0, 0.0, 0.0, 0.0);
00132 MSD_lowAddEulerOpRedo(s, NAME, sid, SOLID, nome[0], nome[1],
00133 nome[2], nome[3],
00134 nome[4], nome[5], 0.0, 0.0, 0.0, 0.0);
00135 }
00136
00137 strcpy(SolName(s), nome);
00138 }
00139
00140 void MSD_lowGroupName(GPTYPE g, char *nome)
00141 {
00142 int gid;
00143 char name[13];
00144
00145 gid = GrpGroupNo(g);
00146 if (Gdoinversion)
00147 {
00148 strcpy(name, GrpName(g));
00149 MSD_lowAddEulerOp(SNIL, NAME, gid, -1, name[6], name[7],
00150 name[8], name[9],
00151 name[10], name[11], 0.0, 0.0, 0.0, 0.0);
00152 MSD_lowAddEulerOp(SNIL, NAME, gid, GROUP, name[0], name[1],
00153 name[2], name[3],
00154 name[4], name[5], 0.0, 0.0, 0.0, 0.0);
00155 }
00156 if (Gdodirect)
00157 {
00158 MSD_lowAddEulerOpRedo(SNIL, NAME, gid, -1, nome[6], nome[7],
00159 nome[8], nome[9],
00160 nome[10], nome[11], 0.0, 0.0, 0.0, 0.0);
00161 MSD_lowAddEulerOpRedo(SNIL, NAME, gid, GROUP, nome[0], nome[1],
00162 nome[2], nome[3],
00163 nome[4], nome[5], 0.0, 0.0, 0.0, 0.0);
00164 }
00165 strcpy(GrpName(g), nome);
00166 }
00167
00168 void MSD_lowAxisName(APTYPE a, char *nome)
00169 {
00170 int aid;
00171 char name[13];
00172
00173 if (Gdoinversion)
00174 {
00175 aid = AxsAxisNo(a);
00176 strcpy(name, AxsName(a));
00177 MSD_lowAddEulerOp(SNIL, NAME, aid, -1, name[6], name[7],
00178 name[8], name[9],
00179 name[10], name[11], 0.0, 0.0, 0.0, 0.0);
00180 MSD_lowAddEulerOp(SNIL, NAME, aid, AXIS, name[0], name[1],
00181 name[2], name[3],
00182 name[4], name[5], 0.0, 0.0, 0.0, 0.0);
00183 }
00184 if (Gdodirect)
00185 {
00186 MSD_lowAddEulerOpRedo(SNIL, NAME, aid, -1, nome[6], nome[7],
00187 nome[8], nome[9],
00188 nome[10], nome[11], 0.0, 0.0, 0.0, 0.0);
00189 MSD_lowAddEulerOpRedo(SNIL, NAME, aid, AXIS, nome[0], nome[1],
00190 nome[2], nome[3],
00191 nome[4], nome[5], 0.0, 0.0, 0.0, 0.0);
00192 }
00193 strcpy(AxsName(a), nome);
00194 }
00195
00196 int MSD_execStructName(EulerOp *op)
00197 {
00198 char nome[13];
00199 PEulerOp eop;
00200
00201 if (op->ip2 == -1)
00202 {
00203 return(TRUE);
00204 }
00205 nome[0] = (char)op->ip3;
00206 nome[1] = (char)op->ip4;
00207 nome[2] = (char)op->ip5;
00208 nome[3] = (char)op->ip6;
00209 nome[4] = (char)op->ip7;
00210 nome[5] = (char)op->ip8;
00211
00212 #ifndef __VIRTUAL_MEM
00213 eop = op;
00214 #else
00215 eop = op->pp;
00216 #endif
00217 EulerOpNext(eop);
00218 nome[6] = (char)EulerIp3(eop);
00219 nome[7] = (char)EulerIp4(eop);
00220 nome[8] = (char)EulerIp5(eop);
00221 nome[9] = (char)EulerIp6(eop);
00222 nome[10] = (char)EulerIp7(eop);
00223 nome[11] = (char)EulerIp8(eop);
00224 nome[12] = '\0';
00225 return(MSD_highName(op->ip1, nome, op->ip2));
00226 }
00227
00228 void MSD_printStructName(FILE *f, EulerOp *op)
00229 {
00230 static char nome[13];
00231 static Id id2, id1;
00232 int com;
00233
00234 id1 = op->ip1;
00235 if (op->ip2 != -1)
00236 {
00237 id2 = op->ip2;
00238 nome[0] = op->ip3;
00239 nome[1] = op->ip4;
00240 nome[2] = op->ip5;
00241 nome[3] = op->ip6;
00242 nome[4] = op->ip7;
00243 nome[5] = op->ip8;
00244 }
00245 else
00246 {
00247 nome[6] = op->ip3;
00248 nome[7] = op->ip4;
00249 nome[8] = op->ip5;
00250 nome[9] = op->ip6;
00251 nome[10] = op->ip7;
00252 nome[11] = op->ip8;
00253 nome[12] = '\0';
00254 com = op->CommandCount;
00255 fprintf(f, "name %d %d %d %s\n", id1, com, id2, nome);
00256 }
00257 }
00258
00259 int MSD_readStructName(FILE *f, EulerOp *op)
00260 {
00261 Id ip1, ip2;
00262 char nome[13];
00263 int com;
00264
00265 if (fscanf(f, "%d %d %d %s\n", &ip1, &com, &ip2, nome) != 4)
00266 {
00267 return(ERROR);
00268 }
00269 op->solidno = op->ip1 = ip1;
00270 op->CommandCount = com;
00271 op->ip2 = ip2;
00272 op->ip3 = nome[0];
00273 op->ip4 = nome[1];
00274 op->ip5 = nome[2];
00275 op->ip6 = nome[3];
00276 op->ip7 = nome[4];
00277 op->ip8 = nome[5];
00278 return(SUCCESS);
00279 }
00280
00281 int MSD_modifyStructName(EulerOp *op)
00282 {
00283 int solidno;
00284
00285 if (op->ip2 == SOLID)
00286 {
00287 solidno = MSD_lowCheckTranslatorTable(op->ip1, SOLID);
00288 op->solidno = op->ip1 = solidno;
00289 }
00290 if (op->ip2 == GROUP)
00291 {
00292 solidno = MSD_lowCheckTranslatorTable(op->ip1, GROUP);
00293 op->ip1 = solidno;
00294 }
00295 if (op->ip2 == AXIS)
00296 {
00297 solidno = MSD_lowCheckTranslatorTable(op->ip1, AXIS);
00298 op->ip1 = solidno;
00299 }
00300 return(SUCCESS);
00301 }