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 "curvgeom.h"
00047 #include "mancommd.h"
00048 #include "eulerops.h"
00049
00050 #ifdef __curved_env__
00051
00052 #ifdef __Extended_Version
00053 void MSD_execNewCurveLine(void)
00054 {
00055 int tag, sn;
00056 char sname[20];
00057
00058 while (2 != sscanf(restbuf, "%d %s", &tag, sname))
00059 {
00060 printf("NEW_LINE: CTag Sname\n");
00061 if (!lineins("? "))
00062 {
00063 return;
00064 }
00065 }
00066 if ((sn = MSD_getSolidIdFromName(sname)) == ERROR)
00067 {
00068 fprintf(stderr, MEN_NaoEncontrouSolidNome, NAM_NewLine, sname);
00069 return;
00070 }
00071 MSD_highNewCurveLine(sn, tag);
00072 }
00073
00074 #endif
00075
00076 int MSD_highNewCurveLine(Id sn, Id tag)
00077 {
00078 SPTYPE s;
00079
00080 if ((s = MSD_getSolid(sn)) == SNIL)
00081 {
00082 fprintf(stderr, MEN_NaoEncontrouSolido, NAM_NewLine, sn);
00083 return(ERROR);
00084 }
00085 if (MSD_lowNewCurveLine(s, tag) == (CURVE *)NIL)
00086 {
00087 return(ERROR);
00088 }
00089 return(SUCCESS);
00090 }
00091
00092 CURVE *MSD_lowNewCurveLine(SPTYPE s, Id tag)
00093 {
00094 CURVE *curv;
00095
00096 if ((curv = MSD_lowNewCurve(LINE1, s)) == (CURVE *)NIL)
00097 {
00098 fprintf(stderr, MEN_NaoPossuiMemoria, NAM_NewLine);
00099 return((CURVE *)NIL);
00100 }
00101 curv->tagno = tag;
00102 curv->lpnt = (LPOINT *)NIL;
00103 if (Gdoinversion)
00104 {
00105 MSD_lowAddEulerOp(s, KILLLINE, tag, 0, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0);
00106 }
00107 if (Gdodirect)
00108 {
00109 MSD_lowAddEulerOpRedo(s, NEWLINE, tag, 0, 0, 0, 0, 0, 0, 0, 0.0, 0.0, 0.0, 0.0);
00110 }
00111 return(curv);
00112 }
00113
00114 int MSD_execStructNEWLINE(EulerOp *op)
00115 {
00116 return(MSD_highNewCurveLine(op->ip1, op->solidno));
00117 }
00118
00119 void MSD_printStructNEWLINE(FILE *f, EulerOp *op)
00120 {
00121 Id ids, id1, id2;
00122 int com;
00123
00124 ids = op->solidno;
00125 id1 = op->ip1;
00126 id2 = op->ip2;
00127 com = op->CommandCount;
00128 fprintf(f, "newline %d %d %d %d\n", ids, com, id1, id2);
00129 }
00130
00131 int MSD_readStructNEWLINE(FILE *f, EulerOp *op)
00132 {
00133 int solidno, ip1, ip2, com;
00134
00135 if (fscanf(f, "%d %d %d %d\n", &solidno, &com, &ip1, &ip2) != 4)
00136 {
00137 return(ERROR);
00138 }
00139 op->solidno = solidno;
00140 op->CommandCount = com;
00141 op->ip1 = ip1;
00142 op->ip2 = ip2;
00143 op->ip3 = 0;
00144 op->ip4 = 0;
00145 op->ip5 = 0;
00146 op->ip6 = 0;
00147 op->ip7 = 0;
00148 op->ip8 = 0;
00149 op->fp1 = 0.0;
00150 op->fp2 = 0.0;
00151 op->fp3 = 0.0;
00152 op->fp4 = 0.0;
00153 return(SUCCESS);
00154 }
00155
00156 int MSD_modifyStructNEWLINE(EulerOp *op)
00157 {
00158 return(SUCCESS);
00159 }
00160
00161 #endif