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 #include "mensagem.h"
00044 #include "memvirtu.h"
00045 #include "lowparam.h"
00046 #include "lowmacro.h"
00047 #include "lowsolid.h"
00048 #include "vectorop.h"
00049 #include "eulerops.h"
00050 #include "mancommd.h"
00051 #include "hiegroup.h"
00052
00053 #ifdef __Extended_Version
00054 void MSD_execNameCreateAxisTranslation(void)
00055 {
00056 char name[30];
00057 float x, y, z;
00058
00059 while (4 != sscanf(restbuf, "%s %f %f %f", name, &x, &y, &z))
00060 {
00061 printf("crtaxstrn: nome x y z\n");
00062 if (!lineins("? "))
00063 {
00064 return;
00065 }
00066 }
00067 MSD_highNameCreateAxisTranslation(name, x, y, z);
00068 }
00069
00070 #endif
00071
00072 int MSD_highNameCreateAxisTranslation(char *name, real x, real y, real z)
00073 {
00074 APTYPE aptr;
00075 int an;
00076
00077 if (MSD_getAxisIdFromName(name) != -1)
00078 {
00079 fprintf(stderr, MEN_AxisJaExiste,
00080 NAM_CreateAxisOfTranslation, name);
00081 return(ERROR);
00082 }
00083 if ((an = MSD_highCreateAxisTranslation(x, y, z)) != -1)
00084 {
00085 aptr = MSD_getAxis(an);
00086 strcpy(AxsName(aptr), name);
00087 return(SUCCESS);
00088 }
00089 return(ERROR);
00090 }
00091
00092 #ifdef __Extended_Version
00093 void MSD_execCreateAxisTranslation(void)
00094 {
00095 float x, y, z;
00096
00097 while (3 != sscanf(restbuf, "%f %f %f", &x, &y, &z))
00098 {
00099 printf("crtaxstrn: an x y z\n");
00100 if (!lineins("? "))
00101 {
00102 return;
00103 }
00104 }
00105 printf("Id = %d\n", MSD_highCreateAxisTranslation(x, y, z));
00106 }
00107
00108 #endif
00109
00110 int MSD_highCreateAxisTranslation(real x, real y, real z)
00111 {
00112 vector vec;
00113 Id an;
00114
00115 makevec(vec, x, y, z, 1.0);
00116 an = MSD_getMaxAxisId();
00117 return(MSD_lowCreateAxisTranslation(an, vec) == ERROR ? -1 : an);
00118 }
00119
00120 int MSD_middleCreateAxisTranslation(int an, real x, real y, real z)
00121 {
00122 vector vec;
00123
00124 makevec(vec, x, y, z, 1.0);
00125 return(MSD_lowCreateAxisTranslation(an, vec));
00126 }
00127
00128 int MSD_lowCreateAxisTranslation(int an, vector vec)
00129 {
00130 APTYPE aptr;
00131
00132 if ((aptr = (APTYPE)MSD_lowNewElement(AXIS, NNIL)) == ANIL)
00133 {
00134 fprintf(stderr, MEN_NaoPossuiMemoria, NAM_CreateAxisOfTranslation);
00135 return(ERROR);
00136 }
00137 AxsAxisNo(aptr) = an;
00138 AxsMode(aptr) = AxisOfTranslation;
00139 veccopy(AxsVector(aptr), vec);
00140
00141 if (Gdoinversion)
00142 {
00143 MSD_lowAddEulerOp(SNIL, REMAXS, an, 0, 0, 0, 0, 0, 0, 0,
00144 0.0, 0.0, 0.0, 0.0);
00145 }
00146 return(SUCCESS);
00147 }
00148
00149 int MSD_execStructCrtAxsTranslation(EulerOp *op)
00150 {
00151 Id an;
00152 real fd1, fd2, fd3;
00153
00154 an = op->ip1;
00155 fd1 = op->fp1;
00156 fd2 = op->fp2;
00157 fd3 = op->fp3;
00158 return(MSD_middleCreateAxisTranslation(an, fd1, fd2, fd3));
00159 }
00160
00161 void MSD_printStructCrtAxsTranslation(FILE *f, EulerOp *op)
00162 {
00163 Id sid, ip1;
00164 real fd1, fd2, fd3, fd4;
00165
00166 sid = op->solidno;
00167 ip1 = op->ip1;
00168 fd1 = op->fp1;
00169 fd2 = op->fp2;
00170 fd3 = op->fp3;
00171 fd4 = op->fp4;
00172 fprintf(f, "crtaxstrs %d %d %f %f %f %f\n", sid, ip1, fd1, fd2, fd3, fd4);
00173 }
00174
00175 int MSD_readStructCrtAxsTranslation(FILE *f, EulerOp *op)
00176 {
00177 int solidno, ip1;
00178 real fd1, fd2, fd3, fd4;
00179
00180 if (fscanf(f, "%d %d %f %f %f\n", &solidno, &ip1,
00181 &fd1, &fd2, &fd3, &fd4) != 6)
00182 {
00183 return(ERROR);
00184 }
00185 op->solidno = solidno;
00186 op->ip1 = ip1;
00187 op->ip2 = 0;
00188 op->ip3 = 0;
00189 op->ip4 = 0;
00190 op->ip5 = 0;
00191 op->ip6 = 0;
00192 op->ip7 = 0;
00193 op->ip8 = 0;
00194 op->fp1 = fd1;
00195 op->fp2 = fd2;
00196 op->fp3 = fd3;
00197 op->fp4 = fd4;
00198 return(SUCCESS);
00199 }
00200
00201 int MSD_modifyStructCrtAxsTranslation(EulerOp *op)
00202 {
00203 int axisno;
00204
00205 axisno = MSD_lowCheckTranslatorTable(op->ip1, AXIS);
00206 op->ip1 = axisno;
00207 return(SUCCESS);
00208 }