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_highNameMakePerfilL(char *name, real a, real t, real h);
00055
00056 void MSD_execNameMakePerfilL(void)
00057 {
00058 char name[30];
00059 float a, t, h;
00060
00061 while (4 != sscanf(restbuf, "%s %f %f %f", name, &a, &t, &h))
00062 {
00063 printf("ROV.perfilL nome a t h\n");
00064 if (!lineins("? "))
00065 {
00066 return;
00067 }
00068 }
00069 MSD_highNameMakePerfilL(name, a, t, h);
00070 }
00071
00072 void MSD_highNameMakePerfilL(char *name, real a, 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_RovPerfilL, 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, t, t, 0.0) == ERROR)
00103 {
00104 flag = 0;
00105 }
00106 if (MSD_highMEV(sn, 1, 4, 5, t, a, 0.0) == ERROR)
00107 {
00108 flag = 0;
00109 }
00110 if (MSD_highMEV(sn, 1, 5, 6, 0.0, a, 0.0) == ERROR)
00111 {
00112 flag = 0;
00113 }
00114 if (MSD_highMEF(sn, 1, 6, 1, 2) == ERROR)
00115 {
00116 flag = 0;
00117 }
00118 if (flag == 1)
00119 {
00120 MSD_lowFaceEq(FacFLOut(MSD_getFace(optr, 1)), normal);
00121 face = dot(normal, vec) > 0.0 ? 1 : 2;
00122 if (MSD_lowMakeSweep(MSD_getFace(optr, face), 0.0, 0.0, h) == ERROR)
00123 {
00124 flag = 0;
00125 }
00126 if (flag == 1)
00127 {
00128 MSD_lowSetNormal(optr, TRUE);
00129 MSD_lowSetEdgeAngle(optr);
00130 MSD_lowSetInfo(optr);
00131 }
00132 }
00133 if (flag == 0)
00134 {
00135 MSD_lowHardRemove(optr);
00136 }
00137 if (flag == 1)
00138 {
00139 MSD_lowAddEulerOp(optr, HARDREM, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00140 }
00141 Gdoinversion = GOld;
00142
00143 if (flag == 1)
00144 {
00145 strcpy(SolName(optr), name);
00146 SolType(optr) = SOLIDO_TIPO_BARRA;
00147 SolGeometria(optr) = BARRA_GEOM_PERFIL_L;
00148 SolFronteira(optr) = FRONTEIRA_CV;
00149 SolParam1(optr) = a;
00150 SolParam2(optr) = t;
00151 SolParam3(optr) = h;
00152 makevec(SolPrincDir(optr), 0.0, 0.0, 1.0, 0.0);
00153 }
00154
00155 if (flag == 0)
00156 {
00157 return;
00158 }
00159 GOld = Gdoinversion;
00160 Gdoinversion = FALSE;
00161 sn = MSD_getMaxSolidId();
00162 if ((pptr = MSD_lowMVSF(sn, 1, 1, 1, 0.0, 0.0, 0.0)) == SNIL)
00163 {
00164 flag = 0;
00165 }
00166 if (MSD_highMEV(sn, 1, 1, 2, a, 0.0, 0.0) == ERROR)
00167 {
00168 flag = 0;
00169 }
00170 if (MSD_highMEV(sn, 1, 2, 3, a, t, 0.0) == ERROR)
00171 {
00172 flag = 0;
00173 }
00174 if (MSD_highMEV(sn, 1, 3, 4, t, t, 0.0) == ERROR)
00175 {
00176 flag = 0;
00177 }
00178 if (MSD_highMEV(sn, 1, 4, 5, t, a, 0.0) == ERROR)
00179 {
00180 flag = 0;
00181 }
00182 if (MSD_highMEV(sn, 1, 5, 6, 0.0, a, 0.0) == ERROR)
00183 {
00184 flag = 0;
00185 }
00186 if (MSD_highMEF(sn, 1, 6, 1, 2) == ERROR)
00187 {
00188 flag = 0;
00189 }
00190 if (flag == 1)
00191 {
00192 MSD_lowSetNormal(pptr, TRUE);
00193 MSD_lowSetEdgeAngle(pptr);
00194 MSD_lowSetInfo(pptr);
00195 SolPerfil(optr) = sn;
00196 strcpy(SolName(pptr), "PerPerfilL");
00197 }
00198 if (flag == 0)
00199 {
00200 MSD_lowHardRemove(pptr);
00201 }
00202 if (flag == 1)
00203 {
00204 MSD_lowAddEulerOp(pptr, HARDREM, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00205 }
00206 Gdoinversion = GOld;
00207 }