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_highNameMakePerfilT(char *name, real a, real b, real t, real h);
00055
00056 void MSD_execNameMakePerfilT(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.perfilT nome a b t h\n");
00064 if (!lineins("? "))
00065 {
00066 return;
00067 }
00068 }
00069 MSD_highNameMakePerfilT(name, a, b, t, h);
00070 }
00071
00072 void MSD_highNameMakePerfilT(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_RovPerfilT, 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, 0.5 * (a - t), b + t, 0.0) == ERROR)
00111 {
00112 flag = 0;
00113 }
00114 if (MSD_highMEV(sn, 1, 6, 7, 0.5 * (a - t), t, 0.0) == ERROR)
00115 {
00116 flag = 0;
00117 }
00118 if (MSD_highMEV(sn, 1, 7, 8, 0.0, t, 0.0) == ERROR)
00119 {
00120 flag = 0;
00121 }
00122 if (MSD_highMEF(sn, 1, 8, 1, 2) == ERROR)
00123 {
00124 flag = 0;
00125 }
00126 if (flag == 1)
00127 {
00128 MSD_lowFaceEq(FacFLOut(MSD_getFace(optr, 1)), normal);
00129 face = dot(normal, vec) > 0.0 ? 1 : 2;
00130 if (MSD_lowMakeSweep(MSD_getFace(optr, face), 0.0, 0.0, h) == ERROR)
00131 {
00132 flag = 0;
00133 }
00134 if (flag == 1)
00135 {
00136 MSD_lowSetNormal(optr, TRUE);
00137 MSD_lowSetEdgeAngle(optr);
00138 MSD_lowSetInfo(optr);
00139 }
00140 }
00141 if (flag == 0)
00142 {
00143 MSD_lowHardRemove(optr);
00144 }
00145 if (flag == 1)
00146 {
00147 MSD_lowAddEulerOp(optr, HARDREM, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00148 }
00149 Gdoinversion = GOld;
00150
00151 if (flag == 1)
00152 {
00153 strcpy(SolName(optr), name);
00154 SolType(optr) = SOLIDO_TIPO_BARRA;
00155 SolGeometria(optr) = BARRA_GEOM_PERFIL_T;
00156 SolFronteira(optr) = FRONTEIRA_CV;
00157 SolParam1(optr) = a;
00158 SolParam2(optr) = b;
00159 SolParam3(optr) = t;
00160 SolParam4(optr) = h;
00161 makevec(SolPrincDir(optr), 0.0, 0.0, 1.0, 0.0);
00162 }
00163
00164 if (flag == 0)
00165 {
00166 return;
00167 }
00168 GOld = Gdoinversion;
00169 Gdoinversion = FALSE;
00170 sn = MSD_getMaxSolidId();
00171 if ((pptr = MSD_lowMVSF(sn, 1, 1, 1, 0.0, 0.0, 0.0)) == SNIL)
00172 {
00173 flag = 0;
00174 }
00175 if (MSD_highMEV(sn, 1, 1, 2, a, 0.0, 0.0) == ERROR)
00176 {
00177 flag = 0;
00178 }
00179 if (MSD_highMEV(sn, 1, 2, 3, a, t, 0.0) == ERROR)
00180 {
00181 flag = 0;
00182 }
00183 if (MSD_highMEV(sn, 1, 3, 4, 0.5 * (a + t), t, 0.0) == ERROR)
00184 {
00185 flag = 0;
00186 }
00187 if (MSD_highMEV(sn, 1, 4, 5, 0.5 * (a + t), b + t, 0.0) == ERROR)
00188 {
00189 flag = 0;
00190 }
00191 if (MSD_highMEV(sn, 1, 5, 6, 0.5 * (a - t), b + t, 0.0) == ERROR)
00192 {
00193 flag = 0;
00194 }
00195 if (MSD_highMEV(sn, 1, 6, 7, 0.5 * (a - t), t, 0.0) == ERROR)
00196 {
00197 flag = 0;
00198 }
00199 if (MSD_highMEV(sn, 1, 7, 8, 0.0, t, 0.0) == ERROR)
00200 {
00201 flag = 0;
00202 }
00203 if (MSD_highMEF(sn, 1, 8, 1, 2) == ERROR)
00204 {
00205 flag = 0;
00206 }
00207 if (flag == 1)
00208 {
00209 MSD_lowSetNormal(pptr, TRUE);
00210 MSD_lowSetEdgeAngle(pptr);
00211 MSD_lowSetInfo(pptr);
00212 SolPerfil(optr) = sn;
00213 strcpy(SolName(pptr), "PerPerfilT");
00214 }
00215 if (flag == 0)
00216 {
00217 MSD_lowHardRemove(pptr);
00218 }
00219 if (flag == 1)
00220 {
00221 MSD_lowAddEulerOp(pptr, HARDREM, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00222 }
00223 Gdoinversion = GOld;
00224 }