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 <math.h>
00043 #include <string.h>
00044 #include "mensagem.h"
00045 #include "memvirtu.h"
00046 #include "lowparam.h"
00047 #include "lowsolid.h"
00048 #include "eulerops.h"
00049 #include "vectorop.h"
00050 #include "mancommd.h"
00051 #include "shpshape.h"
00052 #include "basrov__.h"
00053
00054 void MSD_highNameMakePerfilI(char *name, real a, real b, real t, real h);
00055
00056 void MSD_execNameMakePerfilI(void)
00057 {
00058 char name[30];
00059 float a, b, t, h;
00060
00061 while (5 != sscanf(restbuf, "%s %f %f %f %f", name, &a, &b, &t, &h))
00062 {
00063 printf("ROV.perfilI nome a b t h\n");
00064 if (!lineins("? "))
00065 {
00066 return;
00067 }
00068 }
00069 MSD_highNameMakePerfilI(name, a, b, t, h);
00070 }
00071
00072 void MSD_highNameMakePerfilI(char *name, real a, real b, real t, real h)
00073 {
00074 SPTYPE optr;
00075 SPTYPE pptr;
00076 int flag = 1, GOld;
00077 Id sn, face;
00078 vector normal;
00079 static vector vec = { 0.0, 0.0, 1.0, 0.0 };
00080
00081 if (MSD_getSolidIdFromName(name) != -1)
00082 {
00083 fprintf(stderr, MEN_SolidoJaExiste, NAM_RovPerfilI, name);
00084 return;
00085 }
00086
00087 GOld = Gdoinversion;
00088 Gdoinversion = FALSE;
00089 sn = MSD_getMaxSolidId();
00090 if ((optr = MSD_lowMVSF(sn, 1, 1, 1, 0.0, 0.0, 0.0)) == SNIL)
00091 {
00092 flag = 0;
00093 }
00094 if (MSD_highMEV(sn, 1, 1, 2, a, 0.0, 0.0) == ERROR)
00095 {
00096 flag = 0;
00097 }
00098 if (MSD_highMEV(sn, 1, 2, 3, a, t, 0.0) == ERROR)
00099 {
00100 flag = 0;
00101 }
00102 if (MSD_highMEV(sn, 1, 3, 4, 0.5 * (a + t), t, 0.0) == ERROR)
00103 {
00104 flag = 0;
00105 }
00106 if (MSD_highMEV(sn, 1, 4, 5, 0.5 * (a + t), b + t, 0.0) == ERROR)
00107 {
00108 flag = 0;
00109 }
00110 if (MSD_highMEV(sn, 1, 5, 6, a, b + t, 0.0) == ERROR)
00111 {
00112 flag = 0;
00113 }
00114 if (MSD_highMEV(sn, 1, 6, 7, a, b + 2 * t, 0.0) == ERROR)
00115 {
00116 flag = 0;
00117 }
00118 if (MSD_highMEV(sn, 1, 7, 8, 0.0, b + 2 * t, 0.0) == ERROR)
00119 {
00120 flag = 0;
00121 }
00122 if (MSD_highMEV(sn, 1, 8, 9, 0.0, b + t, 0.0) == ERROR)
00123 {
00124 flag = 0;
00125 }
00126 if (MSD_highMEV(sn, 1, 9, 10, 0.5 * (a - t), b + t, 0.0) == ERROR)
00127 {
00128 flag = 0;
00129 }
00130 if (MSD_highMEV(sn, 1, 10, 11, 0.5 * (a - t), t, 0.0) == ERROR)
00131 {
00132 flag = 0;
00133 }
00134 if (MSD_highMEV(sn, 1, 11, 12, 0.0, t, 0.0) == ERROR)
00135 {
00136 flag = 0;
00137 }
00138 if (MSD_highMEF(sn, 1, 12, 1, 2) == ERROR)
00139 {
00140 flag = 0;
00141 }
00142 if (flag == 1)
00143 {
00144 MSD_lowFaceEq(FacFLOut(MSD_getFace(optr, 1)), normal);
00145 face = dot(normal, vec) > 0.0 ? 1 : 2;
00146 if (MSD_lowMakeSweep(MSD_getFace(optr, face), 0.0, 0.0, h) == ERROR)
00147 {
00148 flag = 0;
00149 }
00150 if (flag == 1)
00151 {
00152 MSD_lowSetNormal(optr, TRUE);
00153 MSD_lowSetEdgeAngle(optr);
00154 MSD_lowSetInfo(optr);
00155 }
00156 }
00157 if (flag == 0)
00158 {
00159 MSD_lowHardRemove(optr);
00160 }
00161 if (flag == 1)
00162 {
00163 MSD_lowAddEulerOp(optr, HARDREM, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00164 }
00165 Gdoinversion = GOld;
00166
00167 if (flag == 1)
00168 {
00169 strcpy(SolName(optr), name);
00170 SolType(optr) = SOLIDO_TIPO_BARRA;
00171 SolGeometria(optr) = BARRA_GEOM_PERFIL_I;
00172 SolFronteira(optr) = FRONTEIRA_CV;
00173 SolParam1(optr) = a;
00174 SolParam2(optr) = b;
00175 SolParam3(optr) = t;
00176 SolParam4(optr) = h;
00177 makevec(SolPrincDir(optr), 0.0, 0.0, 1.0, 0.0);
00178 }
00179
00180 if (flag == 0)
00181 {
00182 return;
00183 }
00184 GOld = Gdoinversion;
00185 Gdoinversion = FALSE;
00186 sn = MSD_getMaxSolidId();
00187 if ((pptr = MSD_lowMVSF(sn, 1, 1, 1, 0.0, 0.0, 0.0)) == SNIL)
00188 {
00189 flag = 0;
00190 }
00191 if (MSD_highMEV(sn, 1, 1, 2, a, 0.0, 0.0) == ERROR)
00192 {
00193 flag = 0;
00194 }
00195 if (MSD_highMEV(sn, 1, 2, 3, a, t, 0.0) == ERROR)
00196 {
00197 flag = 0;
00198 }
00199 if (MSD_highMEV(sn, 1, 3, 4, 0.5 * (a + t), t, 0.0) == ERROR)
00200 {
00201 flag = 0;
00202 }
00203 if (MSD_highMEV(sn, 1, 4, 5, 0.5 * (a + t), b + t, 0.0) == ERROR)
00204 {
00205 flag = 0;
00206 }
00207 if (MSD_highMEV(sn, 1, 5, 6, a, b + t, 0.0) == ERROR)
00208 {
00209 flag = 0;
00210 }
00211 if (MSD_highMEV(sn, 1, 6, 7, a, b + 2 * t, 0.0) == ERROR)
00212 {
00213 flag = 0;
00214 }
00215 if (MSD_highMEV(sn, 1, 7, 8, 0.0, b + 2 * t, 0.0) == ERROR)
00216 {
00217 flag = 0;
00218 }
00219 if (MSD_highMEV(sn, 1, 8, 9, 0.0, b + t, 0.0) == ERROR)
00220 {
00221 flag = 0;
00222 }
00223 if (MSD_highMEV(sn, 1, 9, 10, 0.5 * (a - t), b + t, 0.0) == ERROR)
00224 {
00225 flag = 0;
00226 }
00227 if (MSD_highMEV(sn, 1, 10, 11, 0.5 * (a - t), t, 0.0) == ERROR)
00228 {
00229 flag = 0;
00230 }
00231 if (MSD_highMEV(sn, 1, 11, 12, 0.0, t, 0.0) == ERROR)
00232 {
00233 flag = 0;
00234 }
00235 if (MSD_highMEF(sn, 1, 12, 1, 2) == ERROR)
00236 {
00237 flag = 0;
00238 }
00239 if (flag == 1)
00240 {
00241 MSD_lowSetNormal(pptr, TRUE);
00242 MSD_lowSetEdgeAngle(pptr);
00243 MSD_lowSetInfo(pptr);
00244 SolPerfil(optr) = sn;
00245 strcpy(SolName(pptr), "PerPerfilI");
00246 }
00247 if (flag == 0)
00248 {
00249 MSD_lowHardRemove(pptr);
00250 }
00251 if (flag == 1)
00252 {
00253 MSD_lowAddEulerOp(pptr, HARDREM, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00254 }
00255 Gdoinversion = GOld;
00256 }