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 "disdispl.h"
00051 #include "hiegroup.h"
00052
00053 #ifdef __Extended_Version
00054 void MSD_execNameMoveAxis(void)
00055 {
00056 char aname[30];
00057 float x, y, z;
00058
00059 while (4 != sscanf(restbuf, "%s %f %f %f", aname, &x, &y, &z))
00060 {
00061 printf("MoveAxis: axis dx dy dz\n");
00062 if (!lineins("? "))
00063 {
00064 return;
00065 }
00066 }
00067 MSD_highNameMoveAxis(aname, x, y, z);
00068 }
00069
00070 #endif
00071
00072 int MSD_highNameMoveAxis(char *name, real x, real y, real z)
00073 {
00074 int an;
00075
00076 if ((an = MSD_getAxisIdFromName(name)) == -1)
00077 {
00078 fprintf(stderr, MEN_NaoEncontrouAxisNome,
00079 NAM_MoveAxis, name);
00080 return(ERROR);
00081 }
00082 return(MSD_highMoveAxis(an, x, y, z));
00083 }
00084
00085 #ifdef __Extended_Version
00086 void MSD_execMoveAxis(void)
00087 {
00088 float x, y, z;
00089 int an;
00090
00091 while (4 != sscanf(restbuf, "%d %f %f %f", &an, &x, &y, &z))
00092 {
00093 printf("MoveAxis: an desl\n");
00094 if (!lineins("? "))
00095 {
00096 return;
00097 }
00098 }
00099 MSD_highMoveAxis(an, x, y, z);
00100 }
00101
00102 #endif
00103
00104 int MSD_highMoveAxis(int an, real x, real y, real z)
00105 {
00106 APTYPE aptr;
00107 vector vec;
00108
00109 if ((aptr = MSD_getAxis(an)) == ANIL)
00110 {
00111 fprintf(stderr, MEN_NaoEncontrouAxisId,
00112 NAM_MoveAxis, an);
00113 return(ERROR);
00114 }
00115 makevec(vec, x, y, z, 1.0);
00116 return(MSD_lowMoveAxis(aptr, vec));
00117 }
00118
00119 int MSD_lowMoveAxis(APTYPE aptr, vector vec)
00120 {
00121 Id an;
00122
00123 if (AxsMode(aptr) == AxisOfTranslation)
00124 {
00125 return(SUCCESS);
00126 }
00127 if (Gdoinversion)
00128 {
00129 an = AxsAxisNo(aptr);
00130 MSD_lowAddEulerOp(SNIL, MOVAXIS, an, 0, 0, 0, 0, 0, 0, 0,
00131 -vec[0], -vec[1], -vec[2], 1.0);
00132 }
00133 vecplus(AxsCenter(aptr), vec, AxsCenter(aptr));
00134 return(SUCCESS);
00135 }
00136
00137 int MSD_execStructMoveAxis(EulerOp *op)
00138 {
00139 Id an;
00140 real fd1, fd2, fd3;
00141
00142 an = op->ip1;
00143 fd1 = op->fp1;
00144 fd2 = op->fp2;
00145 fd3 = op->fp3;
00146 return(MSD_highMoveAxis(an, fd1, fd2, fd3));
00147 }
00148
00149 void MSD_printStructMoveAxis(FILE *f, EulerOp *op)
00150 {
00151 Id sid, ip1;
00152 real fd1, fd2, fd3, fd4;
00153
00154 sid = op->solidno;
00155 ip1 = op->ip1;
00156 fd1 = op->fp1;
00157 fd2 = op->fp2;
00158 fd3 = op->fp3;
00159 fd4 = op->fp4;
00160 fprintf(f, "movaxs %d %d %f %f %f %f\n", sid, ip1, fd1, fd2, fd3, fd4);
00161 }
00162
00163 int MSD_readStructMoveAxis(FILE *f, EulerOp *op)
00164 {
00165 int solidno, ip1;
00166 real fd1, fd2, fd3, fd4;
00167
00168 if (fscanf(f, "%d %d %f %f %f\n", &solidno, &ip1,
00169 &fd1, &fd2, &fd3, &fd4) != 6)
00170 {
00171 return(ERROR);
00172 }
00173 op->solidno = solidno;
00174 op->ip1 = ip1;
00175 op->ip2 = 0;
00176 op->ip3 = 0;
00177 op->ip4 = 0;
00178 op->ip5 = 0;
00179 op->ip6 = 0;
00180 op->ip7 = 0;
00181 op->ip8 = 0;
00182 op->fp1 = fd1;
00183 op->fp2 = fd2;
00184 op->fp3 = fd3;
00185 op->fp4 = fd4;
00186 return(SUCCESS);
00187 }
00188
00189 int MSD_modifyStructMoveAxis(EulerOp *op)
00190 {
00191 int axisno;
00192
00193 axisno = MSD_lowCheckTranslatorTable(op->ip1, AXIS);
00194 op->ip1 = axisno;
00195 return(SUCCESS);
00196 }