1 |
|
1 |
/*****************************************************************
|
2 |
|
|
|
3 |
|
|
acis_charge.c Type:Func
|
4 |
|
|
|
5 |
|
|
chargement d un modele ACIS
|
6 |
|
|
|
7 |
|
|
Date de creation : Tue Nov 26 09:46:38 1996
|
8 |
|
|
|
9 |
|
|
Derniere version : Tue Aug 5 13:51:04 1997
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
Vincent FRANCOIS
|
19 |
|
|
|
20 |
|
|
*****************************************************************/
|
21 |
|
|
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
|
|
/**************************/
|
27 |
|
|
/* include */
|
28 |
|
|
#include <stdio.h>
|
29 |
|
|
#include <string.h>
|
30 |
|
|
#include <stdlib.h>
|
31 |
|
|
#include "const.h"
|
32 |
|
|
#include "struct.h"
|
33 |
|
|
#include "memoire.h"
|
34 |
|
|
#include "prototype.h"
|
35 |
|
|
|
36 |
|
|
/**************************/
|
37 |
|
|
/* variables globales */
|
38 |
|
|
extern struct s_acis *acis;
|
39 |
|
|
extern struct environnement env;
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
/**************************/
|
44 |
|
|
/* programme principal */
|
45 |
|
|
|
46 |
|
|
void acis_charge(void)
|
47 |
|
|
{
|
48 |
|
|
FILE *fic;
|
49 |
|
|
char mess[500],type_entite[100],c,string1[20],string2[20],string3[20];
|
50 |
|
|
int i,num=0,num2;
|
51 |
|
|
struct s_body *body;
|
52 |
|
|
struct s_attrib *attrib;
|
53 |
|
|
struct s_lump *lump;
|
54 |
|
|
struct s_shell *shell;
|
55 |
|
|
struct s_face *face;
|
56 |
|
|
struct s_loop *loop;
|
57 |
|
|
struct s_subshell *subshell;
|
58 |
|
|
struct s_wire *wire;
|
59 |
|
|
struct s_coedge *coedge;
|
60 |
|
|
struct s_edge *edge;
|
61 |
|
|
struct s_vertex *vertex;
|
62 |
|
|
struct s_cone *cone;
|
63 |
|
|
struct s_ellipse *ellipse;
|
64 |
|
|
struct s_pcurve *pcurve;
|
65 |
|
|
struct s_plane *plane;
|
66 |
|
|
struct s_point *point;
|
67 |
|
|
struct s_straight *straight;
|
68 |
|
|
struct s_transform *transform;
|
69 |
|
|
int n1,n2,n3,n4,n5,n6,n7;
|
70 |
|
|
float f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13;
|
71 |
|
|
char message[255];
|
72 |
|
|
|
73 |
|
|
/* premiere etape construction des pointeurs */
|
74 |
|
|
fic=fopen(env.fich,"rt");
|
75 |
|
|
if (fic==NULL)
|
76 |
|
|
{
|
77 |
|
|
aff_text("\n");
|
78 |
|
|
aff_text("\n");
|
79 |
|
|
aff_text(ACIS_ERREUR);
|
80 |
|
|
aff_text("\n");
|
81 |
|
|
aff_text("\n");
|
82 |
|
|
abort();
|
83 |
|
|
}
|
84 |
|
|
while (num<100)
|
85 |
|
|
{
|
86 |
|
|
fgets(mess,500,fic);
|
87 |
|
|
sscanf(mess,"%d",&num);
|
88 |
|
|
}
|
89 |
|
|
sscanf(mess,"%d %d",&env.version,&num);
|
90 |
|
|
if (num==0)
|
91 |
|
|
{
|
92 |
|
|
while (feof(fic)==0)
|
93 |
|
|
{
|
94 |
|
|
fgets(mess,500,fic);
|
95 |
|
|
num++;
|
96 |
|
|
if ((mess[0]=='e') ||(mess[0]=='E'))
|
97 |
|
|
if ((mess[1]=='n') ||(mess[0]=='N'))
|
98 |
|
|
if ((mess[2]=='d') ||(mess[0]=='D'))
|
99 |
|
|
num--;
|
100 |
|
|
}
|
101 |
|
|
fclose(fic);
|
102 |
|
|
fic=fopen(env.fich,"rt");
|
103 |
|
|
num2=0;
|
104 |
|
|
while (num2<100)
|
105 |
|
|
{
|
106 |
|
|
fgets(mess,500,fic);
|
107 |
|
|
sscanf(mess,"%d",&num2);
|
108 |
|
|
}
|
109 |
|
|
}
|
110 |
|
|
sprintf(message,ACIS_LECTURE,env.version,env.fich);
|
111 |
|
|
aff_text(message);
|
112 |
|
|
sprintf(message,ACIS_LEC_RES,num);
|
113 |
|
|
aff_text(message);
|
114 |
|
|
acis->entity=(void **)calloc(num,sizeof(void *));
|
115 |
|
|
acis->type_entite=(text)calloc(num,sizeof(ligne));
|
116 |
|
|
acis->nb_entity=num;
|
117 |
|
|
for (i=0;i<acis->nb_entity;i++)
|
118 |
|
|
{
|
119 |
|
|
fgets(mess,500,fic);
|
120 |
|
|
sscanf(mess,"%s",type_entite);
|
121 |
|
|
num=strlen(type_entite);
|
122 |
|
|
if (num>6)
|
123 |
|
|
{
|
124 |
|
|
if (type_entite[num-1]=='b')
|
125 |
|
|
if (type_entite[num-2]=='i')
|
126 |
|
|
if (type_entite[num-3]=='r')
|
127 |
|
|
if (type_entite[num-4]=='t')
|
128 |
|
|
if (type_entite[num-5]=='t')
|
129 |
|
|
if (type_entite[num-6]=='a')
|
130 |
|
|
strcpy(type_entite,"attrib");
|
131 |
|
|
}
|
132 |
|
|
if (strcmp(type_entite,"body")==0)
|
133 |
|
|
{
|
134 |
|
|
NEW_ENTITE(body,body,acis->);
|
135 |
|
|
acis->entity[i]=(void *)body;
|
136 |
|
|
}
|
137 |
|
|
else if (strcmp(type_entite,"attrib")==0)
|
138 |
|
|
{
|
139 |
|
|
NEW_ENTITE(attrib,attrib,acis->);
|
140 |
|
|
acis->entity[i]=(void *)attrib;
|
141 |
|
|
}
|
142 |
|
|
else if (strcmp(type_entite,"lump")==0)
|
143 |
|
|
{
|
144 |
|
|
NEW_ENTITE(lump,lump,acis->);
|
145 |
|
|
acis->entity[i]=(void *)lump;
|
146 |
|
|
}
|
147 |
|
|
else if (strcmp(type_entite,"shell")==0)
|
148 |
|
|
{
|
149 |
|
|
NEW_ENTITE(shell,shell,acis->);
|
150 |
|
|
acis->entity[i]=(void *)shell;
|
151 |
|
|
}
|
152 |
|
|
else if (strcmp(type_entite,"face")==0)
|
153 |
|
|
{
|
154 |
|
|
NEW_ENTITE(face,face,acis->);
|
155 |
|
|
acis->entity[i]=(void *)face;
|
156 |
|
|
face->num_face=acis->nb_face-1;
|
157 |
|
|
}
|
158 |
|
|
else if (strcmp(type_entite,"loop")==0)
|
159 |
|
|
{
|
160 |
|
|
NEW_ENTITE(loop,loop,acis->);
|
161 |
|
|
acis->entity[i]=(void *)loop;
|
162 |
|
|
}
|
163 |
|
|
else if (strcmp(type_entite,"subshell")==0)
|
164 |
|
|
{
|
165 |
|
|
NEW_ENTITE(subshell,subshell,acis->);
|
166 |
|
|
acis->entity[i]=(void *)subshell;
|
167 |
|
|
}
|
168 |
|
|
else if (strcmp(type_entite,"wire")==0)
|
169 |
|
|
{
|
170 |
|
|
NEW_ENTITE(wire,wire,acis->);
|
171 |
|
|
acis->entity[i]=(void *)wire;
|
172 |
|
|
}
|
173 |
|
|
else if (strcmp(type_entite,"coedge")==0)
|
174 |
|
|
{
|
175 |
|
|
NEW_ENTITE(coedge,coedge,acis->);
|
176 |
|
|
acis->entity[i]=(void *)coedge;
|
177 |
|
|
}
|
178 |
|
|
else if (strcmp(type_entite,"edge")==0)
|
179 |
|
|
{
|
180 |
|
|
NEW_ENTITE(edge,edge,acis->);
|
181 |
|
|
acis->entity[i]=(void *)edge;
|
182 |
|
|
edge->num_edge=acis->nb_edge-1;
|
183 |
|
|
}
|
184 |
|
|
else if (strcmp(type_entite,"vertex")==0)
|
185 |
|
|
{
|
186 |
|
|
NEW_ENTITE(vertex,vertex,acis->);
|
187 |
|
|
acis->entity[i]=(void *)vertex;
|
188 |
|
|
}
|
189 |
|
|
else if (strcmp(type_entite,"cone-surface")==0)
|
190 |
|
|
{
|
191 |
|
|
NEW_ENTITE(cone,cone,acis->);
|
192 |
|
|
acis->entity[i]=(void *)cone;
|
193 |
|
|
}
|
194 |
|
|
else if (strcmp(type_entite,"ellipse-curve")==0)
|
195 |
|
|
{
|
196 |
|
|
NEW_ENTITE(ellipse,ellipse,acis->);
|
197 |
|
|
acis->entity[i]=(void *)ellipse;
|
198 |
|
|
}
|
199 |
|
|
else if (strcmp(type_entite,"pcurve")==0)
|
200 |
|
|
{
|
201 |
|
|
NEW_ENTITE(pcurve,pcurve,acis->);
|
202 |
|
|
acis->entity[i]=(void *)pcurve;
|
203 |
|
|
}
|
204 |
|
|
else if (strcmp(type_entite,"plane-surface")==0)
|
205 |
|
|
{
|
206 |
|
|
NEW_ENTITE(plane,plane,acis->);
|
207 |
|
|
acis->entity[i]=(void *)plane;
|
208 |
|
|
}
|
209 |
|
|
else if (strcmp(type_entite,"point")==0)
|
210 |
|
|
{
|
211 |
|
|
NEW_ENTITE(point,point,acis->);
|
212 |
|
|
acis->entity[i]=(void *)point;
|
213 |
|
|
}
|
214 |
|
|
else if (strcmp(type_entite,"straight-curve")==0)
|
215 |
|
|
{
|
216 |
|
|
NEW_ENTITE(straight,straight,acis->);
|
217 |
|
|
acis->entity[i]=(void *)straight;
|
218 |
|
|
}
|
219 |
|
|
else if (strcmp(type_entite,"transform")==0)
|
220 |
|
|
{
|
221 |
|
|
NEW_ENTITE(transform,transform,acis->);
|
222 |
|
|
acis->entity[i]=(void *)transform;
|
223 |
|
|
}
|
224 |
|
|
|
225 |
|
|
else
|
226 |
|
|
{
|
227 |
|
|
if (i==0) i=(-1);
|
228 |
|
|
else
|
229 |
|
|
{
|
230 |
|
|
sprintf(message,ACIS_WARNING,type_entite,i);
|
231 |
|
|
aff_text(message);
|
232 |
|
|
}
|
233 |
|
|
}
|
234 |
|
|
}
|
235 |
|
|
fclose(fic);
|
236 |
|
|
/* deuxieme etape remplissage des structures */
|
237 |
|
|
fic=fopen(env.fich,"rt");
|
238 |
|
|
if (fic==NULL)
|
239 |
|
|
{
|
240 |
|
|
aff_text("\n");
|
241 |
|
|
aff_text("\n");
|
242 |
|
|
aff_text(ACIS_ERREUR);
|
243 |
|
|
aff_text("\n");
|
244 |
|
|
aff_text("\n");
|
245 |
|
|
abort();
|
246 |
|
|
}
|
247 |
|
|
while (num<100)
|
248 |
|
|
{
|
249 |
|
|
fgets(mess,500,fic);
|
250 |
|
|
sscanf(mess,"%d",&num);
|
251 |
|
|
}
|
252 |
|
|
for (i=0;i<acis->nb_entity;i++)
|
253 |
|
|
{
|
254 |
|
|
fgets(mess,500,fic);
|
255 |
|
|
for (num=0;num<(int)strlen(mess);num++)
|
256 |
|
|
if (mess[num]=='I') mess[num]=' ';
|
257 |
|
|
sscanf(mess,"%s",type_entite);
|
258 |
|
|
num=strlen(type_entite);
|
259 |
|
|
if (num>6)
|
260 |
|
|
{
|
261 |
|
|
if (type_entite[num-1]=='b')
|
262 |
|
|
if (type_entite[num-2]=='i')
|
263 |
|
|
if (type_entite[num-3]=='r')
|
264 |
|
|
if (type_entite[num-4]=='t')
|
265 |
|
|
if (type_entite[num-5]=='t')
|
266 |
|
|
if (type_entite[num-6]=='a')
|
267 |
|
|
strcpy(type_entite,"attrib");
|
268 |
|
|
}
|
269 |
|
|
acis->type_entite[i]=(ligne)calloc(20,sizeof(char));
|
270 |
|
|
strcpy(acis->type_entite[i],type_entite);
|
271 |
|
|
if (strcmp(type_entite,"body")==0)
|
272 |
|
|
{
|
273 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
274 |
|
|
body=(struct s_body *)acis->entity[i];
|
275 |
|
|
if (n1!=-1) body->attrib=(struct s_attrib *)acis->entity[n1];
|
276 |
|
|
else body->attrib=NULL;
|
277 |
|
|
if (n2!=-1) body->first_lump=(struct s_lump *)acis->entity[n2];
|
278 |
|
|
else body->first_lump=NULL;
|
279 |
|
|
if (n3!=-1) body->first_wire=(struct s_wire *)acis->entity[n3];
|
280 |
|
|
else body->first_wire=NULL;
|
281 |
|
|
if (n4!=-1) body->transform=(struct s_transform *)acis->entity[n4];
|
282 |
|
|
else body->transform=NULL;
|
283 |
|
|
}
|
284 |
|
|
else if (strcmp(type_entite,"attrib")==0)
|
285 |
|
|
{
|
286 |
|
|
attrib->num=i;
|
287 |
|
|
}
|
288 |
|
|
else if (strcmp(type_entite,"lump")==0)
|
289 |
|
|
{
|
290 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
291 |
|
|
lump=(struct s_lump *)acis->entity[i];
|
292 |
|
|
if (n1!=-1) lump->attrib=(struct s_attrib *)acis->entity[n1];
|
293 |
|
|
else lump->attrib=NULL;
|
294 |
|
|
if (n2!=-1) lump->next_lump=(struct s_lump *)acis->entity[n2];
|
295 |
|
|
else lump->next_lump=NULL;
|
296 |
|
|
if (n3!=-1) lump->first_shell=(struct s_shell *)acis->entity[n3];
|
297 |
|
|
else lump->first_shell=NULL;
|
298 |
|
|
if (n4!=-1) lump->body=(struct s_body *)acis->entity[n4];
|
299 |
|
|
else lump->body=NULL;
|
300 |
|
|
lump->num=i;
|
301 |
|
|
}
|
302 |
|
|
else if (strcmp(type_entite,"shell")==0)
|
303 |
|
|
{
|
304 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5);
|
305 |
|
|
shell=(struct s_shell *)acis->entity[i];
|
306 |
|
|
if (n1!=-1) shell->attrib=(struct s_attrib *)acis->entity[n1];
|
307 |
|
|
else shell->attrib=NULL;
|
308 |
|
|
if (n2!=-1) shell->next_shell=(struct s_shell *)acis->entity[n2];
|
309 |
|
|
else shell->next_shell=NULL;
|
310 |
|
|
if (n3!=-1) shell->first_subshell=(struct s_subshell *)acis->entity[n3];
|
311 |
|
|
else shell->first_subshell=NULL;
|
312 |
|
|
if (n4!=-1) shell->first_face=(struct s_face *)acis->entity[n4];
|
313 |
|
|
else shell->first_face=NULL;
|
314 |
|
|
if (n5!=-1) shell->owning_lump=(struct s_lump *)acis->entity[n5];
|
315 |
|
|
else shell->owning_lump=NULL;
|
316 |
|
|
shell->num=i;
|
317 |
|
|
}
|
318 |
|
|
else if (strcmp(type_entite,"face")==0)
|
319 |
|
|
{
|
320 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %c%d %s %s %s",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&c,&n6,string1,string2,string3);
|
321 |
|
|
face=(struct s_face *)acis->entity[i];
|
322 |
|
|
if (n1!=-1) face->attrib=(struct s_attrib *)acis->entity[n1];
|
323 |
|
|
else face->attrib=NULL;
|
324 |
|
|
if (n2!=-1) face->next_face=(struct s_face *)acis->entity[n2];
|
325 |
|
|
else face->next_face=NULL;
|
326 |
|
|
if (n3!=-1) face->first_loop=(struct s_loop *)acis->entity[n3];
|
327 |
|
|
else face->first_loop=NULL;
|
328 |
|
|
if (n4!=-1) face->owning_shell=(struct s_shell *)acis->entity[n4];
|
329 |
|
|
else face->owning_shell=NULL;
|
330 |
|
|
if (n5!=-1) face->owning_subshell=(struct s_subshell *)acis->entity[n5];
|
331 |
|
|
else face->owning_subshell=NULL;
|
332 |
|
|
face->surface=n6;
|
333 |
|
|
if (strcmp(string1,"forward")==0) face->sense=FORWARD; else face->sense=REVERSED;
|
334 |
|
|
if (strcmp(string2,"single")==0) face->simple=DOUBLE; else face->simple=DOUBLE;
|
335 |
|
|
if (strcmp(string3,"out")==0) face->ext=IS_OUT; else face->ext=IS_IN;
|
336 |
|
|
face->num=i;
|
337 |
|
|
face->rap_face=(int *)calloc(acis->nb_face,sizeof(int));
|
338 |
|
|
ERREUR_ALLOC(face->rap_face);
|
339 |
|
|
}
|
340 |
|
|
else if (strcmp(type_entite,"loop")==0)
|
341 |
|
|
{
|
342 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
343 |
|
|
loop=(struct s_loop *)acis->entity[i];
|
344 |
|
|
if (n1!=-1) loop->attrib=(struct s_attrib *)acis->entity[n1];
|
345 |
|
|
else loop->attrib=NULL;
|
346 |
|
|
if (n2!=-1) loop->next_loop=(struct s_loop *)acis->entity[n2];
|
347 |
|
|
else loop->next_loop=NULL;
|
348 |
|
|
if (n3!=-1) loop->first_coedge=(struct s_coedge *)acis->entity[n3];
|
349 |
|
|
else loop->first_coedge=NULL;
|
350 |
|
|
if (n4!=-1) loop->owning_face=(struct s_face *)acis->entity[n4];
|
351 |
|
|
else loop->owning_face=NULL;
|
352 |
|
|
loop->num=i;
|
353 |
|
|
}
|
354 |
|
|
else if (strcmp(type_entite,"subshell")==0)
|
355 |
|
|
{
|
356 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&c,&n6);
|
357 |
|
|
subshell=(struct s_subshell *)acis->entity[i];
|
358 |
|
|
if (n1!=-1) subshell->attrib=(struct s_attrib *)acis->entity[n1];
|
359 |
|
|
else subshell->attrib=NULL;
|
360 |
|
|
if (n2!=-1) subshell->parent_subshell=(struct s_subshell *)acis->entity[n2];
|
361 |
|
|
else subshell->parent_subshell=NULL;
|
362 |
|
|
if (n3!=-1) subshell->next_subshell=(struct s_subshell *)acis->entity[n3];
|
363 |
|
|
else subshell->next_subshell=NULL;
|
364 |
|
|
if (n4!=-1) subshell->first_subshell=(struct s_subshell *)acis->entity[n4];
|
365 |
|
|
else subshell->first_subshell=NULL;
|
366 |
|
|
if (n5!=-1) subshell->first_face=(struct s_face *)acis->entity[n5];
|
367 |
|
|
else subshell->first_face=NULL;
|
368 |
|
|
if (n6!=-1) subshell->first_wire=(struct s_wire *)acis->entity[n6];
|
369 |
|
|
else subshell->first_wire=NULL;
|
370 |
|
|
subshell->num=i;
|
371 |
|
|
}
|
372 |
|
|
else if (strcmp(type_entite,"wire")==0)
|
373 |
|
|
{
|
374 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4);
|
375 |
|
|
wire=(struct s_wire *)acis->entity[i];
|
376 |
|
|
if (n1!=-1) wire->attrib=(struct s_attrib *)acis->entity[n1];
|
377 |
|
|
else wire->attrib=NULL;
|
378 |
|
|
if (n2!=-1) wire->next_wire=(struct s_wire *)acis->entity[n2];
|
379 |
|
|
else wire->next_wire=NULL;
|
380 |
|
|
if (n3!=-1) wire->first_coedge=(struct s_coedge *)acis->entity[n3];
|
381 |
|
|
else wire->first_coedge=NULL;
|
382 |
|
|
if (n4!=-1) wire->owning=(void *)acis->entity[n1];
|
383 |
|
|
else wire->owning=NULL;
|
384 |
|
|
wire->num=i;
|
385 |
|
|
}
|
386 |
|
|
else if (strcmp(type_entite,"coedge")==0)
|
387 |
|
|
{
|
388 |
|
|
if (env.version<200)
|
389 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&num,&c,&n6,&c,&n7);
|
390 |
|
|
else sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %s %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,string1,&c,&n6,&c,&n7);
|
391 |
|
|
|
392 |
|
|
coedge=(struct s_coedge *)acis->entity[i];
|
393 |
|
|
if (n1!=-1) coedge->attrib=(struct s_attrib *)acis->entity[n1];
|
394 |
|
|
else coedge->attrib=NULL;
|
395 |
|
|
if (n2!=-1) coedge->next_coedge=(struct s_coedge *)acis->entity[n2];
|
396 |
|
|
else coedge->next_coedge=NULL;
|
397 |
|
|
if (n3!=-1) coedge->previous_coedge=(struct s_coedge *)acis->entity[n3];
|
398 |
|
|
else coedge->previous_coedge=NULL;
|
399 |
|
|
if (n4!=-1) coedge->partner_coedge=(struct s_coedge *)acis->entity[n4];
|
400 |
|
|
else coedge->partner_coedge=NULL;
|
401 |
|
|
if (n5!=-1) coedge->edge=(struct s_edge *)acis->entity[n5];
|
402 |
|
|
else coedge->edge=NULL;
|
403 |
|
|
if (env.version<200) coedge->sense=num;
|
404 |
|
|
else
|
405 |
|
|
if (strcmp(string1,"forward")==0) coedge->sense=FORWARD; else coedge->sense=REVERSED;
|
406 |
|
|
if (n6!=-1) coedge->owning_loop=(struct s_loop *)acis->entity[n6];
|
407 |
|
|
else coedge->owning_loop=NULL;
|
408 |
|
|
if (n7!=-1) coedge->pcurve=(struct s_pcurve *)acis->entity[n7];
|
409 |
|
|
else coedge->pcurve=NULL;
|
410 |
|
|
coedge->num=i;
|
411 |
|
|
}
|
412 |
|
|
else if (strcmp(type_entite,"edge")==0)
|
413 |
|
|
{
|
414 |
|
|
if (env.version<200)
|
415 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %d",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,&num);
|
416 |
|
|
else if (env.version<500)
|
417 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d %c%d %c%d %s",type_entite,&c,&n1,&c,&n2,&c,&n3,&c,&n4,&c,&n5,string1);
|
418 |
|
|
else sscanf(mess,"%s %c%d %c%d %f %c%d %f %c%d %c%d %s",type_entite,&c,&n1,&c,&n2,&f1,&c,&n3,&f2,&c,&n4,&c,&n5,string1);
|
419 |
|
|
edge=(struct s_edge *)acis->entity[i];
|
420 |
|
|
if (n1!=-1) edge->attrib=(struct s_attrib *)acis->entity[n1];
|
421 |
|
|
else edge->attrib=NULL;
|
422 |
|
|
if (n2!=-1) edge->start_vertex=(struct s_vertex *)acis->entity[n2];
|
423 |
|
|
else edge->start_vertex=NULL;
|
424 |
|
|
if (n3!=-1) edge->end_vertex=(struct s_vertex *)acis->entity[n3];
|
425 |
|
|
else edge->end_vertex=NULL;
|
426 |
|
|
if (n4!=-1) edge->owning_coedge=(struct s_coedge *)acis->entity[n4];
|
427 |
|
|
else edge->owning_coedge=NULL;
|
428 |
|
|
edge->curve=n5;
|
429 |
|
|
if (env.version<200) edge->sense=num;
|
430 |
|
|
else
|
431 |
|
|
if (strcmp(string1,"forward")==0) edge->sense=FORWARD; else edge->sense=REVERSED;
|
432 |
|
|
edge->num=i;
|
433 |
|
|
NEW_POINTEUR(n6,edge,edge->start_vertex->);
|
434 |
|
|
edge->start_vertex->edge[n6]=edge;
|
435 |
|
|
NEW_POINTEUR(n6,edge,edge->end_vertex->);
|
436 |
|
|
edge->end_vertex->edge[n6]=edge;
|
437 |
|
|
edge->rap_edge=(int *)calloc(acis->nb_edge,sizeof(int));
|
438 |
|
|
ERREUR_ALLOC(edge->rap_edge);
|
439 |
|
|
}
|
440 |
|
|
else if (strcmp(type_entite,"vertex")==0)
|
441 |
|
|
{
|
442 |
|
|
sscanf(mess,"%s %c%d %c%d %c%d",type_entite,&c,&n1,&c,&n2,&c,&n3);
|
443 |
|
|
vertex=(struct s_vertex *)acis->entity[i];
|
444 |
|
|
if (n1!=-1) vertex->attrib=(struct s_attrib *)acis->entity[n1];
|
445 |
|
|
else vertex->attrib=NULL;
|
446 |
|
|
if (n2!=-1) vertex->owning_edge=(struct s_edge *)acis->entity[n2];
|
447 |
|
|
else vertex->owning_edge=NULL;
|
448 |
|
|
if (n3!=-1) vertex->point=(struct s_point *)acis->entity[n3];
|
449 |
|
|
else vertex->point=NULL;
|
450 |
|
|
vertex->num=i;
|
451 |
|
|
}
|
452 |
|
|
else if (strcmp(type_entite,"cone-surface")==0)
|
453 |
|
|
{
|
454 |
|
|
sscanf(mess,"%s %c%d %f %f %f %f %f %f %f %f %f %f %f %f",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9,&f10,&f11,&f12);
|
455 |
|
|
cone=(struct s_cone *)acis->entity[i];
|
456 |
|
|
if (n1!=-1) cone->attrib=(struct s_attrib *)acis->entity[n1];
|
457 |
|
|
else cone->attrib=NULL;
|
458 |
|
|
cone->center[0]=f1;
|
459 |
|
|
cone->center[1]=f2;
|
460 |
|
|
cone->center[2]=f3;
|
461 |
|
|
cone->normal[0]=f4;
|
462 |
|
|
cone->normal[1]=f5;
|
463 |
|
|
cone->normal[2]=f6;
|
464 |
|
|
cone->major[0]=f7;
|
465 |
|
|
cone->major[1]=f8;
|
466 |
|
|
cone->major[2]=f9;
|
467 |
|
|
cone->ratio=f10;
|
468 |
|
|
cone->cosalph=f12;
|
469 |
|
|
cone->sinalph=f11;
|
470 |
|
|
//cone->u_rev=n2;
|
471 |
|
|
cone->num=i;
|
472 |
|
|
}
|
473 |
|
|
else if (strcmp(type_entite,"ellipse-curve")==0)
|
474 |
|
|
{
|
475 |
|
|
sscanf(mess,"%s %c%d %f %f %f %f %f %f %f %f %f %f",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9,&f10);
|
476 |
|
|
ellipse=(struct s_ellipse *)acis->entity[i];
|
477 |
|
|
if (n1!=-1) ellipse->attrib=(struct s_attrib *)acis->entity[n1];
|
478 |
|
|
else ellipse->attrib=NULL;
|
479 |
|
|
ellipse->center[0]=f1;
|
480 |
|
|
ellipse->center[1]=f2;
|
481 |
|
|
ellipse->center[2]=f3;
|
482 |
|
|
ellipse->normal[0]=f4;
|
483 |
|
|
ellipse->normal[1]=f5;
|
484 |
|
|
ellipse->normal[2]=f6;
|
485 |
|
|
ellipse->major[0]=f7;
|
486 |
|
|
ellipse->major[1]=f8;
|
487 |
|
|
ellipse->major[2]=f9;
|
488 |
|
|
ellipse->ratio=f10;
|
489 |
|
|
ellipse->num=i;
|
490 |
|
|
}
|
491 |
|
|
else if (strcmp(type_entite,"pcurve")==0)
|
492 |
|
|
{
|
493 |
|
|
pcurve->num=i;
|
494 |
|
|
}
|
495 |
|
|
else if (strcmp(type_entite,"plane-surface")==0)
|
496 |
|
|
{
|
497 |
|
|
sscanf(mess,"%s %c%d %f %f %f %f %f %f %f %f %f",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9);
|
498 |
|
|
plane=(struct s_plane *)acis->entity[i];
|
499 |
|
|
if (n1!=-1) plane->attrib=(struct s_attrib *)acis->entity[n1];
|
500 |
|
|
else plane->attrib=NULL;
|
501 |
|
|
plane->root[0]=f1;
|
502 |
|
|
plane->root[1]=f2;
|
503 |
|
|
plane->root[2]=f3;
|
504 |
|
|
plane->normal[0]=f4;
|
505 |
|
|
plane->normal[1]=f5;
|
506 |
|
|
plane->normal[2]=f6;
|
507 |
|
|
plane->num=i;
|
508 |
|
|
plane->u_deriv[0]=f7;
|
509 |
|
|
plane->u_deriv[1]=f8;
|
510 |
|
|
plane->u_deriv[2]=f9;
|
511 |
|
|
// plane->v_rev=n2;
|
512 |
|
|
}
|
513 |
|
|
else if (strcmp(type_entite,"point")==0)
|
514 |
|
|
{
|
515 |
|
|
sscanf(mess,"%s %c%d %f %f %f",type_entite,&c,&n1,&f1,&f2,&f3);
|
516 |
|
|
point=(struct s_point *)acis->entity[i];
|
517 |
|
|
if (n1!=-1) point->attrib=(struct s_attrib *)acis->entity[n1];
|
518 |
|
|
else point->attrib=NULL;
|
519 |
|
|
point->coord[0]=f1;
|
520 |
|
|
point->coord[1]=f2;
|
521 |
|
|
point->coord[2]=f3;
|
522 |
|
|
point->num=i;
|
523 |
|
|
}
|
524 |
|
|
else if (strcmp(type_entite,"straight-curve")==0)
|
525 |
|
|
{
|
526 |
|
|
sscanf(mess,"%s %c%d %f %f %f %f %f %f ",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6);
|
527 |
|
|
straight=(struct s_straight *)acis->entity[i];
|
528 |
|
|
if (n1!=-1) straight->attrib=(struct s_attrib *)acis->entity[n1];
|
529 |
|
|
else straight->attrib=NULL;
|
530 |
|
|
straight->root[0]=f1;
|
531 |
|
|
straight->root[1]=f2;
|
532 |
|
|
straight->root[2]=f3;
|
533 |
|
|
straight->dir[0]=f4;
|
534 |
|
|
straight->dir[1]=f5;
|
535 |
|
|
straight->dir[2]=f6;
|
536 |
|
|
straight->num=i;
|
537 |
|
|
}
|
538 |
|
|
else if (strcmp(type_entite,"transform")==0)
|
539 |
|
|
{
|
540 |
|
|
sscanf(mess,"%s %c%d %f %f %f %f %f %f %f %f %f %f %f %f %f %d %d %d",type_entite,&c,&n1,&f1,&f2,&f3,&f4,&f5,&f6,&f7,&f8,&f9,&f10,&f11,&f12,&f13,&n2,&n3,&n4);
|
541 |
|
|
transform=(struct s_transform *)acis->entity[i];
|
542 |
|
|
if (n1!=-1) transform->attrib=(struct s_attrib *)acis->entity[n1];
|
543 |
|
|
else transform->attrib=NULL;
|
544 |
|
|
transform->rotation[0][0]=f1;
|
545 |
|
|
transform->rotation[0][1]=f2;
|
546 |
|
|
transform->rotation[0][2]=f3;
|
547 |
|
|
transform->rotation[1][0]=f4;
|
548 |
|
|
transform->rotation[1][1]=f5;
|
549 |
|
|
transform->rotation[1][2]=f6;
|
550 |
|
|
transform->rotation[2][0]=f7;
|
551 |
|
|
transform->rotation[2][1]=f8;
|
552 |
|
|
transform->rotation[2][2]=f9;
|
553 |
|
|
transform->trans[0]=f10;
|
554 |
|
|
transform->trans[1]=f11;
|
555 |
|
|
transform->trans[2]=f12;
|
556 |
|
|
transform->scaling_factor=f13;
|
557 |
|
|
transform->rotate=n2;
|
558 |
|
|
transform->reflection=n3;
|
559 |
|
|
transform->shear=n4;
|
560 |
|
|
transform->num=i;
|
561 |
|
|
}
|
562 |
|
|
else if (i==0) i=(-1);
|
563 |
|
|
}
|
564 |
|
|
}
|