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 <malloc.h>
00043 #include "mensagem.h"
00044 #include "memvirtu.h"
00045 #include "lowparam.h"
00046 #include "lowmacro.h"
00047 #include "curvgeom.h"
00048 #include "lowsolid.h"
00049 #include "mancommd.h"
00050 #include "vectorop.h"
00051 #include "eulerops.h"
00052
00053 #ifdef __curved_env__
00054
00055 #ifdef __Extended_Version
00056 void MSD_execAddPointToCurve(void)
00057 {
00058 int tag, sn;
00059 char sname[20];
00060 float x, y, z;
00061
00062 while (5 != sscanf(restbuf, "%d %s %f %f %f", &tag, sname, &x, &y, &z))
00063 {
00064 printf("ADDLPOINT: CTag Sname x y z\n");
00065 if (!lineins("? "))
00066 {
00067 ;
00068 }
00069 return;
00070 }
00071
00072 if ((sn = MSD_getSolidIdFromName(sname)) == ERROR)
00073 {
00074 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_AddLPoint, sname);
00075 return;
00076 }
00077
00078 MSD_highAddPointToCurve(sn, tag, x, y, z);
00079 }
00080
00081 #endif
00082
00083 int MSD_highAddPointToCurve(Id sn, Id tag, real x, real y, real z)
00084 {
00085 SPTYPE s;
00086 CURVE *curv;
00087
00088 if ((s = MSD_getSolid(sn)) == SNIL)
00089 {
00090 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_AddLPoint);
00091 return(ERROR);
00092 }
00093 if ((curv = MSD_getCurve(s, tag)) == (CURVE *)NIL)
00094 {
00095 fprintf(stderr, MEN_NaoEncontrouTag, NAM_AddLPoint, tag, sn);
00096 return(ERROR);
00097 }
00098 if ((curv->lpnt = MSD_lowAddPointToCurve(s, curv, x, y, z)) == (LPOINT *)NIL)
00099 {
00100 return(ERROR);
00101 }
00102 return(SUCCESS);
00103 }
00104
00105 LPOINT *MSD_lowAddPointToCurve(SPTYPE s, CURVE *curv, real x, real y, real z)
00106 {
00107 LPOINT *p;
00108 LPOINT *pstart = curv->lpnt;
00109
00110 if (Gdoinversion)
00111 {
00112 MSD_lowAddEulerOp(s, REMLPOINT, curv->tagno, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00113 }
00114 if (Gdodirect)
00115 {
00116 MSD_lowAddEulerOpRedo(s, ADDLPOINT, curv->tagno, 0, 0, 0, 0, 0, 0, 0, 0.0, x, y, z);
00117 }
00118
00119 if ((p = (LPOINT *)malloc(sizeof(LPOINT))) == (LPOINT *)NIL)
00120 {
00121 fprintf(stderr, MEN_NaoPossuiMemoria, NAM_AddLPoint);
00122 return((LPOINT *)NIL);
00123 }
00124 makevec(p->pnt, x, y, z, 0.0);
00125 p->pnxt = pstart;
00126 curv->lpnt = p;
00127 return(p);
00128 }
00129
00130 int MSD_execStructADDLPOINT(EulerOp *op)
00131 {
00132 return(MSD_highAddPointToCurve(op->solidno, op->ip1, op->fp1, op->fp2, op->fp3));
00133 }
00134
00135 void MSD_printStructADDLPOINT(FILE *f, EulerOp *op)
00136 {
00137 int ip1, ip2, com;
00138 real fp1, fp2, fp3;
00139
00140 ip1 = op->solidno;
00141 ip2 = op->ip1;
00142 fp1 = op->fp1;
00143 fp2 = op->fp2;
00144 fp3 = op->fp3;
00145 com = op->CommandCount;
00146 fprintf(f, "addlpoint %d %d %d %f %f %f\n", ip1, com, ip2, fp1, fp2, fp3);
00147 }
00148
00149 int MSD_readStructADDLPOINT(FILE *f, EulerOp *op)
00150 {
00151 int solidno, ip1, com;
00152 float fp1, fp2, fp3;
00153
00154 if (fscanf(f, "%d %d %d %f %f %f", &solidno, &com, &ip1, &fp1, &fp2, &fp3) != 6)
00155 {
00156 return(ERROR);
00157 }
00158 op->solidno = solidno;
00159 op->CommandCount = com;
00160 op->ip1 = ip1;
00161 op->ip2 = 0;
00162 op->ip3 = 0;
00163 op->ip4 = 0;
00164 op->ip5 = 0;
00165 op->ip6 = 0;
00166 op->ip7 = 0;
00167 op->ip8 = 0;
00168 op->fp1 = fp1;
00169 op->fp2 = fp2;
00170 op->fp3 = fp3;
00171 op->fp4 = 0.0;
00172 return(SUCCESS);
00173 }
00174
00175 int MSD_modifyStructADDLPOINT(EulerOp *op)
00176 {
00177 return(SUCCESS);
00178 }
00179
00180 #endif