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_execRemovePointFromCurve(void)
00057 {
00058 int tag, sn;
00059 char sname[20];
00060
00061 while (2 != sscanf(restbuf, "%d %s", &tag, sname))
00062 {
00063 printf("REMLPOINT: CTag Sname\n");
00064 if (!lineins("? "))
00065 {
00066 ;
00067 }
00068 return;
00069 }
00070
00071 if ((sn = MSD_getSolidIdFromName(sname)) == ERROR)
00072 {
00073 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_RemLPoint, sname);
00074 return;
00075 }
00076
00077 MSD_highRemovePointFromCurve(tag, sn);
00078 }
00079
00080 #endif
00081
00082 int MSD_highRemovePointFromCurve(Id sn, Id tag)
00083 {
00084 SPTYPE s;
00085 CURVE *curv;
00086
00087 if ((s = MSD_getSolid(sn)) == SNIL)
00088 {
00089 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_RemLPoint);
00090 return(ERROR);
00091 }
00092 if ((curv = MSD_getCurve(s, tag)) == (CURVE *)NIL)
00093 {
00094 fprintf(stderr, MEN_NaoEncontrouTag, NAM_RemLPoint, tag, sn);
00095 return(ERROR);
00096 }
00097 if ((curv->lpnt = MSD_lowRemovePointFromCurve(s, curv)) == (LPOINT *)NIL)
00098 {
00099 return(ERROR);
00100 }
00101 return(SUCCESS);
00102 }
00103
00104 LPOINT *MSD_lowRemovePointFromCurve(SPTYPE s, CURVE *curv)
00105 {
00106 LPOINT *p = curv->lpnt;
00107
00108 if (Gdoinversion)
00109 {
00110 MSD_lowAddEulerOp(s, ADDLPOINT, curv->tagno, 0, 0, 0, 0, 0, 0, 0, p->pnt[0], p->pnt[1], p->pnt[2], 0.0);
00111 }
00112 if (Gdodirect)
00113 {
00114 MSD_lowAddEulerOpRedo(s, REMLPOINT, curv->tagno, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00115 }
00116
00117 curv->lpnt = p->pnxt;
00118 free((char *)p);
00119 return(curv->lpnt);
00120 }
00121
00122 int MSD_execStructREMLPOINT(EulerOp *op)
00123 {
00124 return(MSD_highRemovePointFromCurve(op->solidno, op->ip1));
00125 }
00126
00127 void MSD_printStructREMLPOINT(FILE *f, EulerOp *op)
00128 {
00129 int ip1, ip2, com;
00130
00131 ip1 = op->solidno;
00132 ip2 = op->ip1;
00133 com = op->CommandCount;
00134 fprintf(f, "remlpoint %d %d %d\n", ip1, com, ip2);
00135 }
00136
00137 int MSD_readStructREMLPOINT(FILE *f, EulerOp *op)
00138 {
00139 int solidno, ip1, com;
00140
00141 if (fscanf(f, "%d %d %d", &solidno, &com, &ip1) != 3)
00142 {
00143 return(ERROR);
00144 }
00145 op->solidno = solidno;
00146 op->CommandCount = com;
00147 op->ip1 = ip1;
00148 op->ip2 = 0;
00149 op->ip3 = 0;
00150 op->ip4 = 0;
00151 op->ip5 = 0;
00152 op->ip6 = 0;
00153 op->ip7 = 0;
00154 op->ip8 = 0;
00155 op->fp1 = 0.0;
00156 op->fp2 = 0.0;
00157 op->fp3 = 0.0;
00158 op->fp4 = 0.0;
00159 return(SUCCESS);
00160 }
00161
00162 int MSD_modifyStructREMLPOINT(EulerOp *op)
00163 {
00164 return(SUCCESS);
00165 }
00166
00167 #endif