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 "lowsolid.h"
00046 #include "eulerops.h"
00047 #include "curvgeom.h"
00048 #include "mancommd.h"
00049
00050 #ifdef __curved_env__
00051
00052 #ifdef __Extended_Version
00053 void MSD_execNewCurvePolyline(void)
00054 {
00055 int tag, sn;
00056 char sname[20];
00057 float x, y, z;
00058
00059 while (5 != sscanf(restbuf, "%d %s %f %f %f", &tag, sname, &x, &y, &z))
00060 {
00061 printf("NEWPOLYLINE: CTag Sname x y z\n");
00062 if (!lineins("? "))
00063 {
00064 return;
00065 }
00066 }
00067 if ((sn = MSD_getSolidIdFromName(sname)) == ERROR)
00068 {
00069 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_NewPolyLine, sname);
00070 return;
00071 }
00072 MSD_highNewCurvePolylineWithPoint(tag, sn, x, y, z);
00073 }
00074
00075 #endif
00076
00077 int MSD_highNewCurvePolylineWithPoint(Id tag, Id sn, real x, real y, real z)
00078 {
00079 CURVE *tagcp;
00080 SPTYPE s;
00081
00082 if ((s = MSD_getSolid(sn)) == SNIL)
00083 {
00084 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_NewPolyLine, sn);
00085 return(ERROR);
00086 }
00087 if ((tagcp = MSD_lowNewCurvePolyline(s, tag)) == (CURVE *)NIL)
00088 {
00089 return(ERROR);
00090 }
00091 MSD_lowAddPointToCurve(s, tagcp, x, y, z);
00092 return(SUCCESS);
00093 }
00094
00095 int MSD_highNewCurvePolyline(Id sn, Id tag)
00096 {
00097 SPTYPE s;
00098
00099 if ((s = MSD_getSolid(sn)) == SNIL)
00100 {
00101 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_NewPolyLine, sn);
00102 return(ERROR);
00103 }
00104 if (MSD_lowNewCurvePolyline(s, tag) == (CURVE *)NIL)
00105 {
00106 return(ERROR);
00107 }
00108 return(SUCCESS);
00109 }
00110
00111 CURVE *MSD_lowNewCurvePolyline(SPTYPE s, Id tag)
00112 {
00113 CURVE *pol;
00114
00115 if ((pol = MSD_lowNewCurve(CURVE1, s)) == (CURVE *)NIL)
00116 {
00117 fprintf(stderr, MEN_NaoPossuiMemoria, NAM_NewPolyLine);
00118 return((CURVE *)NIL);
00119 }
00120 pol->tagno = tag;
00121 pol->lpnt = (LPOINT *)NIL;
00122 if (Gdoinversion)
00123 {
00124 MSD_lowAddEulerOp(s, KILLPOLY, tag, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00125 }
00126 if (Gdodirect)
00127 {
00128 MSD_lowAddEulerOpRedo(s, NEWPOLY, tag, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00129 }
00130 return(pol);
00131 }
00132
00133 int MSD_execStructNEWPOLY(EulerOp *op)
00134 {
00135 return(MSD_highNewCurvePolyline(op->ip1, op->solidno));
00136 }
00137
00138 void MSD_printStructNEWPOLY(FILE *f, EulerOp *op)
00139 {
00140 Id ids, id1, id2;
00141 int com;
00142
00143 ids = op->solidno;
00144 id1 = op->ip1;
00145 id2 = op->ip2;
00146 com = op->CommandCount;
00147 fprintf(f, "newpoly %d %d %d %d\n", ids, com, id1, id2);
00148 }
00149
00150 int MSD_readStructNEWPOLY(FILE *f, EulerOp *op)
00151 {
00152 int solidno, ip1, ip2, com;
00153
00154 if (fscanf(f, "%d %d %d %d\n", &solidno, &com, &ip1, &ip2) != 4)
00155 {
00156 return(ERROR);
00157 }
00158 op->solidno = solidno;
00159 op->CommandCount = com;
00160 op->ip1 = ip1;
00161 op->ip2 = ip2;
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 = 0.0;
00169 op->fp2 = 0.0;
00170 op->fp3 = 0.0;
00171 op->fp4 = 0.0;
00172 return(SUCCESS);
00173 }
00174
00175 int MSD_modifyStructNEWPOLY(EulerOp *op)
00176 {
00177 return(SUCCESS);
00178 }
00179
00180 #endif