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 "mensagem.h"
00043 #include "memvirtu.h"
00044 #include "lowparam.h"
00045 #include "lowmacro.h"
00046 #include "lowsolid.h"
00047 #include "eulerops.h"
00048 #include "vectorop.h"
00049 #include "mancommd.h"
00050 #include "curvgeom.h"
00051
00052 #ifdef __curved_env__
00053
00054 #ifdef __Extended_Version
00055 void MSD_execKillCurvePolyline(void)
00056 {
00057 int tag, sn;
00058 char sname[20];
00059
00060 while (2 != sscanf(restbuf, "%s %d", sname, &tag))
00061 {
00062 printf("KILLPOLYLINE: sname tag \n");
00063 if (!lineins("? "))
00064 {
00065 return;
00066 }
00067 }
00068 if ((sn = MSD_getSolidIdFromName(sname)) == (ERROR))
00069 {
00070 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_KillPolyLine, sname);
00071 return;
00072 }
00073 MSD_highKillCurvePolyline(sn, tag);
00074 }
00075
00076 #endif
00077
00078 int MSD_highKillCurvePolyline(Id sn, Id tag)
00079 {
00080 SPTYPE s;
00081 CURVE *curv;
00082
00083 if ((s = MSD_getSolid(sn)) == SNIL)
00084 {
00085 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_KillPolyLine, sn);
00086 return(ERROR);
00087 }
00088 if ((curv = MSD_getCurve(s, tag)) == (CURVE *)NIL)
00089 {
00090 fprintf(stderr, MEN_NaoEncontrouTag, NAM_KillPolyLine, tag, sn);
00091 return(ERROR);
00092 }
00093 MSD_lowKillCurvePolyline(s, curv);
00094 return(SUCCESS);
00095 }
00096
00097 int MSD_lowKillCurvePolyline(SPTYPE s, CURVE *c)
00098 {
00099 int Gdodirectsave;
00100
00101 assert(c != (CURVE *)NIL);
00102 assert(s != SNIL);
00103
00104 if (--c->times_used == 0)
00105 {
00106 if (Gdoinversion)
00107 {
00108 MSD_lowAddEulerOp(s, NEWPOLY, c->tagno, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00109 }
00110 if (Gdodirect)
00111 {
00112 MSD_lowAddEulerOpRedo(s, KILLPOLY, c->tagno, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00113 }
00114
00115 Gdodirectsave = Gdodirect;
00116 Gdodirect = FALSE;
00117 while (c->lpnt)
00118 {
00119 MSD_lowRemovePointFromCurve(s, c);
00120 }
00121 Gdodirect = Gdodirectsave;
00122 MSD_lowCurveDeleteElement(c, s);
00123 }
00124 return(SUCCESS);
00125 }
00126
00127 int MSD_execStructKILLPOLY(EulerOp *op)
00128 {
00129 return(MSD_highKillCurvePolyline(op->ip1, op->solidno));
00130 }
00131
00132 void MSD_printStructKILLPOLY(FILE *f, EulerOp *op)
00133 {
00134 Id ids, id1, id2, com;
00135
00136 ids = op->solidno;
00137 id1 = op->ip1;
00138 id2 = op->ip2;
00139 com = op->CommandCount;
00140 fprintf(f, "killpoly %d %d %d %d\n", ids, com, id1, id2);
00141 }
00142
00143 int MSD_readStructKILLPOLY(FILE *f, EulerOp *op)
00144 {
00145 int solidno, ip1, ip2, com;
00146
00147 if (fscanf(f, "%d %d %d %d\n", &solidno, &com, &ip1, &ip2) != 4)
00148 {
00149 return(ERROR);
00150 }
00151 op->solidno = solidno;
00152 op->CommandCount = com;
00153 op->ip1 = ip1;
00154 op->ip2 = ip2;
00155 op->ip3 = 0;
00156 op->ip4 = 0;
00157 op->ip5 = 0;
00158 op->ip6 = 0;
00159 op->fp1 = 0.0;
00160 op->fp2 = 0.0;
00161 op->fp3 = 0.0;
00162 op->fp4 = 0.0;
00163 return(SUCCESS);
00164 }
00165
00166 int MSD_modifyStructKILLPOLY(EulerOp *op)
00167 {
00168 return(SUCCESS);
00169 }
00170
00171 #endif