forked from VB6Hobbyst7/cgx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pickFunktions.c
7825 lines (7262 loc) · 242 KB
/
pickFunktions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/* -------------------------------------------------------------------- */
/* CALCULIX */
/* - GRAPHICAL INTERFACE - */
/* */
/* A 3-dimensional pre- and post-processor for finite elements */
/* Copyright (C) 1996 Klaus Wittig */
/* */
/* This program is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU General Public License as */
/* published by the Free Software Foundation; version 2 of */
/* the License. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* -------------------------------------------------------------------- */
/*
TO DO:
- replace line_ with line_i in qsplitLine() and delete line_() in defineEntity and rename line_i to line_ in all functions.
- extend hitUndo()
- not finalized:
qmshOperator=0;
*/
#define TEST 0 /* debugging */
#include <cgx.h>
#define DPICK_BUFFER 10000
#define MAX_BUF 100
extern int width_ini, height_ini; /* Grafik-Fensterbreite/hoehe */
extern int width_menu, height_menu;
extern int w0, w1, activWindow;
extern int width_w0, height_w0;
extern int width_w1, height_w1;
extern int MouseMode; /* status maustasten */
extern double dtx, dty, drx, dry, drz, ds; /* Verschiebungen */
extern GLdouble R[4][4]; /* Rotationsmatrix */
extern char surfFlag; /* zeichne nur Oberflaechenelemente (1), sonst (0)*/
extern char modelEdgeFlag; /* zeichne mit Modell-Ecken (1), sonst (0)*/
extern char drawMode; /* protokoliert drawFunktion (drawLoad,Light,Animate,set)*/
extern char frameFlag; /* mit (1) oder ohne Rahmen um das Grafikfenster */
extern char pickFlag;
extern char graphFlag;
extern char sequenceFlag; /* 1: play a sequence of LC */
extern char vectorFlag;
extern double dx ,dy; /* Mauskoordinaten */
extern double centerPnt[3]; /* Rotationszentrum */
extern int centerNode; /* Nr of center Node, 0:no centernode */
extern double gtol; /* geometry tolerance for merging */
extern int ddiv;
extern int animList;
extern int lcase_animList;
extern double aspectRatio_w1; /* width_w1/height_w1 */
extern Scale scale[1];
extern Summen anz[1];
extern Nodes *node;
extern Elements *e_enqire;
extern Datasets *lcase;
extern Faces *face;
extern Texts *ntext;
extern Alias *alias;
extern Sets *set;
extern Shapes *shape;
extern Psets *pset;
extern Points *point;
extern Lines *line;
extern Lcmb *lcmb;
extern Gsur *surf;
extern Gbod *body;
extern Nurbl *nurbl;
extern Nurbs *nurbs;
extern SumGeo anzGeo[1];
extern SumAsci sumAsci[1];
extern double *colNr;
extern char datin[MAX_LINE_LENGTH]; /* Input-data-file */
/* global variables for picking */
extern char pickfunc[MAX_LINE_LENGTH]; /* pickfunc either "qenq" "qadd" "qrem" .. */
char hidefunc[MAX_LINE_LENGTH]; /* hidefunc stores the original commando if a qfunction was started inside another qfunction */
extern char mode[2]; /* pickmode */
char hidemode[2]; /* hidemode stores the original pickmode */
extern GLdouble dx_cur, dy_cur; /* pick-cursor Area */
extern double backgrndcol_rgb[4];
extern char buffer[MAX_LINE_LENGTH]; /* common string-buffer */
extern char printFlag; /* printf 1:on 0:off */
extern int cur_entity; /* aktive entity (component) */
extern char v_dim; /* 1: scalar plot, 2: a 2D vector plot, 3: a 3D vectorplot, 4: a 3D vectorplot with signed vals */
extern int entity_v[6]; /* components of a vector-entity */
extern int cur_lc;
extern char addDispFlag; /* 0: original node-coordinates, 1: node-coordinates+displacements */
extern double v[4]; /* drehkorrekturen fuer centerPkt */
extern GLdouble dR[4][4]; /* dR= R-Rmem fuer center */
extern GLdouble Rmem[4][4];
extern double dtx, dty, dtz;
int anz_threads=1;
int qmshOperator=0; /* operator for qdiv in qmsh 0|'*'|'/' */
int qbiaFlag=0; /* for qmsh, 1:switch from qlin to qbia */
int qdisFlag=0; /* for qdis */
int intersectFlag=0; /* for qint, qfill */
double qaddTol=-1; /* for qadd, angle tolerance for set completition of adjacent faces */
double filletRadius=-1; /* for qfill */
int shp_pindx=0; /* for qshp */
static GLint hits; /* number of picked items, must be global because of glutKeyboardFunc(defineDiv) */
GLuint *selectBuf=NULL; /* buffer which holds the picked items, must be global because of glutKeyboardFunc(defineDiv) */
extern SpecialSet specialset[1];
extern int setall; /* setNr of the default set "all" */
int pick_zmin; /* kleinster z-wert der gepickten items */
int setNrbuf; /* buffer for pick() */
int setNrdiv=-1; /* subset of buffer for qmsh(), stores only directly selected lines for defineDiv() */
int qmshbuf; /* additional entity buffer for qmsh in pick() */
int *pickdata; /* Zwischenspeicher fuer pickdaten */
double pickbuf; /* kurzzeitbuffer */
int pick_buffer; /* groesse von pickdata */
int qnorCounter=0; /* counts number of selected points for qnor() */
int qcutCounter=0; /* counts number of selected nodes for qcut() */
int qaliCounter=0; /* counts number of selected nodes for qali() */
int xbuf, ybuf; /* mauskoordinaten */
int *selem=NULL; /* buffer for qflp, points to surfs */
int entitybuf=-1; /* saves the index of the last created entity for undo */
char keybuf=0; /* saves the type of the last selection */
int set_highl=-1; /* set which stores actual entity */
int pntNr=-1; /* selected point */
int lineNr=-1; /* selected line */
int surfNr=-1; /* selected surf, surface as a target for the point-projection */
int nurbsNr=-1; /* selected Nurbs, used for all touched surfs (s,g) */
int shapeNr=-1; /* selected Shape, used for all touched surfs (s,g) */
int bodyNr=-1; /* selected body */
/* values for movePoint() */
int movedp=-1, pntnr=-1, pnt_undo=-1, moveFlag=0;
#define MAX_LINES 100
int qspl_i, qspl_indx[MAX_LINES]; /* buffer for already splitted lines (qspl) */
GLuint GLubuf[2];
/* qcut, cut */
#define CUTS 20
typedef struct {
int anz_n;
double npre[CUTS][6];
int nnew[CUTS];
} CutParam;
extern Qcut_nodes *qcut_nod;
/* the copied node-sets which have to be filled with values from new loaded Datasets */
extern CopiedNodeSets copiedNodeSets[1];
/* shape buffer */
Shapes shapebuf;
/* threading */
int glob_cutElement=0;
sem_t sem_cute;
extern sem_t sem_n;
int hitAction( GLuint *name, char *type, int x, int y )
{
/* name[0]== entity type of picked name */
/* name[1]== picked name(Nr) */
/* type[0] == requested entity type */
/* type[1] == often gkey in pick() */
char buf[MAX_LINE_LENGTH], printbuf[MAX_LINE_LENGTH];
int i,j,k,p,l;
int bias_fbd, index;
static int p_qnor[3], cpFlag=0, shFlag=0;
static double v_qdis[4][3], v_val;
double v0[3], v1[3], da,dax,day,daz, r1,r2,rm,lcir;
int matchFlag, lin[2]={0,0};
/* highlight the entity if its not qdel or qrem ,qtxt */
if((compare(pickfunc, "qdel", 4) != 4)&&(compare(pickfunc, "qrem", 4) != 4)&&(compare(pickfunc, "qtxt", 4) != 4))
{
buf[0]=name[0];
buf[1]='\0';
seta(set_highl, buf, name[1] );
}
//printf("type %c %c\n", type[0],type[1]);
entitybuf=name[1];
keybuf=name[0];
if (name[0] == 'e')
{
printf ("%d t:%d n: ", name[1], e_enqire[name[1]].type);
if(e_enqire[name[1]].type==1) k=8;
else if(e_enqire[name[1]].type==2) k=6;
else if(e_enqire[name[1]].type==3) k=4;
else if(e_enqire[name[1]].type==4) k=20;
else if(e_enqire[name[1]].type==5) k=15;
else if(e_enqire[name[1]].type==6) k=10;
else if(e_enqire[name[1]].type==7) k=3;
else if(e_enqire[name[1]].type==8) k=6;
else if(e_enqire[name[1]].type==9) k=4;
else if(e_enqire[name[1]].type==10) k=8;
else if(e_enqire[name[1]].type==11) k=2;
else if(e_enqire[name[1]].type==12) k=3;
else k=0;
for (j=0; j<k; j++) printf("%d ",e_enqire[name[1]].nod[j]);
printf("\n");
if (compare(pickfunc, "qenq", 4) == 4)
{
sprintf(printbuf, " in set=");
index=2;
for(i=1; i<anz->sets; i++)
if(!set[i].type)
{
set[i].index=index++;
if((set[i].name!=(char *)NULL)&&(set[i].name[0]!='-')&&( getIndex(&set[i].elem,set[i].anz_e,name[1]) >-1))
sprintf(&printbuf[strlen(printbuf)],"%s(%d),",set[i].name,set[i].index);
}
sprintf(&printbuf[strlen(printbuf)],"\n"); if(strlen(printbuf)>12) printf("%s", printbuf);
}
else if (compare(pickfunc, "qdel", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qadd", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qmsh", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qrem", 4) == 4) setr( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qflp", 4) == 4) flip( type, name[1]);
}
else if (name[0] == 'f')
{
printf ("%d e:%d s:%d n= ", name[1], face[name[1]].elem_nr, face[name[1]].nr+1 );
if(face[name[1]].type==7) k=3;
else if(face[name[1]].type==8) k=6;
else if(face[name[1]].type==9) k=4;
else if(face[name[1]].type==10) k=8;
else if(face[name[1]].type==11) k=2;
else if(face[name[1]].type==12) k=3;
else k=0;
for (j=0; j<k; j++) printf("%d ",face[name[1]].nod[j]);
printf("\n");
if (compare(pickfunc, "qenq", 4) == 4)
{
sprintf(printbuf, " in set=");
index=2;
for(i=1; i<anz->sets; i++)
if(!set[i].type)
{
set[i].index=index++;
if((set[i].name!=(char *)NULL)&&(set[i].name[0]!='-')&&( getIndex(&set[i].face,set[i].anz_f,name[1]) >-1))
{
sprintf(&printbuf[strlen(printbuf)],"%s(%d)",set[i].name,set[i].index);
/* is a contact surface referenced ? */
if(set[i].anz_se)
{
sprintf(&printbuf[strlen(printbuf)],"->[ ");
for(j=0; j<set[i].anz_se; j++)
sprintf(&printbuf[strlen(printbuf)],"%s(%d) ",set[set[i].set[j]].name,set[set[i].set[j]].index);
sprintf(&printbuf[strlen(printbuf)],"]");
}
sprintf(&printbuf[strlen(printbuf)],",");
}
}
sprintf(&printbuf[strlen(printbuf)],"\n"); if(strlen(printbuf)>12) printf("%s", printbuf);
}
else if (compare(pickfunc, "qdel", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qadd", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qrem", 4) == 4) setr( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qdis", 4) == 4)
{
delSet(specialset->impc);
setNrbuf=pre_seta( specialset->impc, "i", 0);
if(setNrbuf<0) { errMsg(" ERROR: could not create set for qdis\n"); return; }
seta( setNrbuf, type, name[1]);
/* complete the set by all connected faces which do not violate the tolerance */
qaddTol=QADDTOL;
completeFacesByTolerance(set_highl, setNrbuf, qaddTol);
}
}
else if (name[0] == 'h')
{
printf ("%s p1=%s p2=%s p3=%s\n", shape[name[1]].name, point[shape[name[1]].p[0]].name, point[shape[name[1]].p[1]].name, point[shape[name[1]].p[2]].name );
if (compare(pickfunc, "qenq", 4) == 4)
{
sprintf(printbuf, " in set=");
index=2;
for(i=1; i<anz->sets; i++)
if(!set[i].type)
{
set[i].index=index++;
if((set[i].name!=(char *)NULL)&&(set[i].name[0]!='-')&&( getIndex(&set[i].shp,set[i].anz_sh,name[1]) >-1))
sprintf(&printbuf[strlen(printbuf)],"%s(%d),",set[i].name,set[i].index);
}
sprintf(&printbuf[strlen(printbuf)],"\n"); if(strlen(printbuf)>12) printf("%s", printbuf);
}
else if (compare(pickfunc, "qdel", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qadd", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qrem", 4) == 4) setr( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qsur", 4) == 4)
{
/* if a a default surf is known apply the shape */
if(surfNr>-1)
{
surf[surfNr].sh=name[1];
shape_refSurf(surf[surfNr].sh, surfNr);
/* if it was prepared for illumination, change the interior def of the selected surf */
if(surf[surfNr].pgn!=NULL)
{
free(surf[surfNr].pgn); surf[surfNr].pgn=NULL; surf[surfNr].npgn=0;
/* create the interior */
repSurf(surfNr,1);
}
printf(" Interiour of surf:%s changed to shape:%s\n", surf[surfNr].name, shape[name[1]].name);
}
else
{
printf(" Active Shape:%s\n", shape[name[1]].name);
shapeNr=name[1];
}
}
else if (compare(pickfunc, "qshp", 4) == 4)
{
printf(" Active Shape:%s\n", shape[name[1]].name);
shapeNr=name[1];
nurbsNr=-1;
}
}
else if (name[0] == 't')
{
if(type[1]=='d') ntext[name[1]].node_nr=0;
if(type[1]=='p') moveText(name[1], x, y);
if(type[1]=='b') { ntext[name[1]].tx= -1; }
if(type[1]=='n') { ntext[name[1]].nFlag=!ntext[name[1]].nFlag; }
if(type[1]=='v') { ntext[name[1]].vFlag=!ntext[name[1]].vFlag; }
if(type[1]=='t') { ntext[name[1]].tFlag=!ntext[name[1]].tFlag; }
if(type[1]=='s') { ntext[name[1]].pFlag=!ntext[name[1]].pFlag; }
if(type[1]=='f')
{
ntext[name[1]].fFlag++;
if(ntext[name[1]].fFlag>2) ntext[name[1]].fFlag=0;
}
}
else if ((name[0] == 'n')&& (node[name[1]].pflag!=1))
{
if(!anz->l) printf ("%d xyz= %lf %lf %lf\n", name[1],
(node[name[1]].nx* scale->w+scale->x),
(node[name[1]].ny* scale->w+scale->y),
(node[name[1]].nz* scale->w+scale->z) );
else
{
if(sequenceFlag) rm=lcase[lcase_animList].dat[animList][name[1]];
else rm=lcase[cur_lc].dat[cur_entity][name[1]];
printf ("%d v= %e ", name[1], rm);
/* search linked values (iexist=2) */
if(sequenceFlag)
{
for(i=0; i<lcase[lcase_animList].ncomps; i++)
if((i!=animList)&&(lcase[lcase_animList].iexist[i]==2)) printf ("%s:%5.4e ",lcase[lcase_animList].compName[i],lcase[lcase_animList].dat[i][name[1]]);
}
else
{
for(i=0; i<lcase[cur_lc].ncomps; i++)
if((i!=cur_entity)&&(lcase[cur_lc].iexist[i]==2)) printf ("%s:%5.4e ",lcase[cur_lc].compName[i],lcase[cur_lc].dat[i][name[1]]);
}
printf (" xyz= %lf %lf %lf ",
(node[name[1]].nx* scale->w+scale->x),
(node[name[1]].ny* scale->w+scale->y),
(node[name[1]].nz* scale->w+scale->z) );
}
v0[0]=0.;
v0[1]=node[name[1]].ny* scale->w+scale->y;
v0[2]=node[name[1]].nz* scale->w+scale->z;
v1[0]=0.; v1[1]=1.; v1[2]=0.;
dax=v_angle(v0,v1);
v0[0]=node[name[1]].nx* scale->w+scale->x;
v0[1]=0.;
v0[2]=node[name[1]].nz* scale->w+scale->z;
v1[0]=0.; v1[1]=0.; v1[2]=1.;
day=v_angle(v0,v1);
v0[0]=node[name[1]].nx* scale->w+scale->x;
v0[1]=node[name[1]].ny* scale->w+scale->y;
v0[2]=0.;
v1[0]=1.; v1[1]=0.; v1[2]=0.;
daz=v_angle(v0,v1);
v0[0]=node[name[1]].nx* scale->w+scale->x;
v0[1]=node[name[1]].ny* scale->w+scale->y;
v0[2]=node[name[1]].nz* scale->w+scale->z;
printf("axyz= %lf %lf %lf rxyz= %lf %lf %lf\n",
dax*180./PI,day*180./PI,daz*180./PI,
sqrt(v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v0[0]*v0[0]+v0[2]*v0[2]),
sqrt(v0[0]*v0[0]+v0[1]*v0[1]) );
if (compare(pickfunc, "qenq", 4) == 4)
{
sprintf(printbuf, " in set=");
index=2;
for(i=1; i<anz->sets; i++)
if(!set[i].type)
{
set[i].index=index++;
if((set[i].name!=(char *)NULL)&&(set[i].name[0]!='-')&&( getIndex(&set[i].node,set[i].anz_n,name[1]) >-1))
{
sprintf(&printbuf[strlen(printbuf)],"%s(%d)",set[i].name,set[i].index);
/* is a contact surface referenced ? */
if(set[i].anz_se)
{
sprintf(&printbuf[strlen(printbuf)],"->[ ");
for(j=0; j<set[i].anz_se; j++)
sprintf(&printbuf[strlen(printbuf)],"%s(%d) ",set[set[i].set[j]].name,set[set[i].set[j]].index);
sprintf(&printbuf[strlen(printbuf)],"]");
}
sprintf(&printbuf[strlen(printbuf)],",");
}
}
sprintf(&printbuf[strlen(printbuf)],"\n"); if(strlen(printbuf)>12) printf("%s", printbuf);
}
else if (compare(pickfunc, "qdis", 4) == 4)
{
if( type[1] == 'h') /* plane */
{
cpFlag++;
v_qdis[cpFlag][0]=node[name[1]].nx* scale->w+scale->x;
v_qdis[cpFlag][1]=node[name[1]].ny* scale->w+scale->y;
v_qdis[cpFlag][2]=node[name[1]].nz* scale->w+scale->z;
if(cpFlag==3) { type[1]=0; cpFlag=0; shFlag++; }
}
else if( type[1] == 'c') /* set centerpnt */
{
type[1]=0;
cpFlag=1;
v_qdis[2][0]=node[name[1]].nx* scale->w+scale->x;
v_qdis[2][1]=node[name[1]].ny* scale->w+scale->y;
v_qdis[2][2]=node[name[1]].nz* scale->w+scale->z;
}
else if(qdisFlag>0)
{
qdisFlag=0;
shFlag=0;
v_qdis[1][0]=node[name[1]].nx* scale->w+scale->x;
v_qdis[1][1]=node[name[1]].ny* scale->w+scale->y;
v_qdis[1][2]=node[name[1]].nz* scale->w+scale->z;
if(cpFlag==1)
{
cpFlag=0;
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]-v_qdis[2][i]; v1[i]=v_qdis[1][i]-v_qdis[2][i]; }
da=v_angle(v0,v1);
r1=v_betrag(v0);
r2=v_betrag(v1);
rm=(r1+r2)*.5;
lcir=2.*rm*da;
printf(" lcir:%lf da:%lf dr:%lf r1:%lf r2:%lf\n", lcir, da*180./PI, r2-r1, r1, r2 );
}
else
{
da=v_angle(v_qdis[0],v_qdis[1]);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
v0[0]=v1[0]=0.;
dax=v_angle(v0,v1);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
v0[1]=v1[1]=0.;
day=v_angle(v0,v1);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
v0[2]=v1[2]=0.;
daz=v_angle(v0,v1);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
if(!anz->l)
{
printf("dist:%lf dxyz: %lf %lf %lf da:%lf daxyz: %lf %lf %lf dr:%lf drxyz: %lf %lf %lf\n",
sqrt((v_qdis[1][0]-v_qdis[0][0])*(v_qdis[1][0]-v_qdis[0][0])+
(v_qdis[1][1]-v_qdis[0][1])*(v_qdis[1][1]-v_qdis[0][1])+
(v_qdis[1][2]-v_qdis[0][2])*(v_qdis[1][2]-v_qdis[0][2])),
v_qdis[1][0]-v_qdis[0][0],v_qdis[1][1]-v_qdis[0][1],v_qdis[1][2]-v_qdis[0][2],
da*180./PI,dax*180./PI,day*180./PI,daz*180./PI,
sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2])-sqrt(v0[0]*v0[0]+v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v1[1]*v1[1]+v1[2]*v1[2])-sqrt(v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v1[0]*v1[0]+v1[2]*v1[2])-sqrt(v0[0]*v0[0]+v0[2]*v0[2]),
sqrt(v1[0]*v1[0]+v1[1]*v1[1])-sqrt(v0[0]*v0[0]+v0[1]*v0[1]) );
}
else
{
printf("dist:%lf dv:%lf dxyz: %lf %lf %lf da:%lf daxyz: %lf %lf %lf dr:%lf drxyz: %lf %lf %lf\n",
sqrt((v_qdis[1][0]-v_qdis[0][0])*(v_qdis[1][0]-v_qdis[0][0])+
(v_qdis[1][1]-v_qdis[0][1])*(v_qdis[1][1]-v_qdis[0][1])+
(v_qdis[1][2]-v_qdis[0][2])*(v_qdis[1][2]-v_qdis[0][2])),
lcase[cur_lc].dat[cur_entity][name[1]]-v_val,
v_qdis[1][0]-v_qdis[0][0],v_qdis[1][1]-v_qdis[0][1],v_qdis[1][2]-v_qdis[0][2],
da*180./PI,dax*180./PI,day*180./PI,daz*180./PI,
sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2])-sqrt(v0[0]*v0[0]+v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v1[1]*v1[1]+v1[2]*v1[2])-sqrt(v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v1[0]*v1[0]+v1[2]*v1[2])-sqrt(v0[0]*v0[0]+v0[2]*v0[2]),
sqrt(v1[0]*v1[0]+v1[1]*v1[1])-sqrt(v0[0]*v0[0]+v0[1]*v0[1]) );
}
}
}
else
{
if(qaddTol>-1) // distance of that node to a set of surfaces or faces
{
qaddTol=-1;
sprintf(buffer,"%d",name[1]);
delSet(specialset->mpc);
pre_seta( specialset->mpc, "n", buffer);
sprintf(buffer,"dist %s %s nor",specialset->mpc,specialset->impc);
pre_proj(buffer);
//delSet(specialset->mpc);
//delSet(specialset->impc);
}
else
{
qdisFlag=2; shFlag++;
if(anz->l) v_val=lcase[cur_lc].dat[cur_entity][name[1]];
v_qdis[0][0]=node[name[1]].nx* scale->w+scale->x;
v_qdis[0][1]=node[name[1]].ny* scale->w+scale->y;
v_qdis[0][2]=node[name[1]].nz* scale->w+scale->z;
}
}
if(shFlag==2) // calc the normal dist of v_qdis[0] to the shape v_qdis[1] v_qdis[2] v_qdis[3]
{
qdisFlag=0;
shFlag=0;
printf("normal dist:%lf\n",normdist(&v_qdis[0][0],&v_qdis[1][0],&v_qdis[2][0],&v_qdis[3][0]));
}
}
else if (compare(pickfunc, "qcnt", 4) == 4)
{
centerNode=name[1];
center( node[name[1]].nx, node[name[1]].ny, node[name[1]].nz);
dx_cur=PICK_LENGTH; dy_cur=PICK_LENGTH;
glutSetWindow( w1);
/* Keyboardfunktion wiederherstellen (von pick()) */
pickFlag=0;
free(selectBuf); selectBuf=NULL;
glutKeyboardFunc ( Keyboard );
glutSetWindow( activWindow );
}
else if (compare(pickfunc, "qdel", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qadd", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qrem", 4) == 4) { if(set[setNrbuf].type) seqr( setNrbuf, type, name[1]); else setr( setNrbuf, type, name[1]); }
else if (compare(pickfunc, "qmsh", 4) == 4) entitybuf=createElem(name[1]);
else if (compare(pickfunc, "qnod", 4) == 4) moveNode(name[1], x, y);
else if (compare(pickfunc, "qpnt", 4) == 4) movePoint(name, x, y);
else if (compare(pickfunc, "qali", 4) == 4) pre_align( name[1], 0 );
else if (compare(pickfunc, "qcut", 4) == 4) pre_cut( name[1], type[1] );
else if (compare(pickfunc, "qtxt", 4) == 4) moveText(createText(name[1], -1, 0 ), x, y );
else if (compare(pickfunc, "qshp", 4) == 4)
{
/* create point on node */
p= getNewName( buf, "p" );
printf(" create point:%s %lf %lf %lf\n", buf, node[name[1]].nx, node[name[1]].ny, node[name[1]].nz );
p=pnt( buf, node[name[1]].nx, node[name[1]].ny, node[name[1]].nz, 0 );
shapebuf.p[shp_pindx++]=p;
printf(" %d pnt picked\n",shp_pindx);
if(shp_pindx>6)
{
shp_pindx=0;
}
}
}
else if (name[0] == 'p')
{
printf ("%s xyz= %lf %lf %lf ", point[name[1]].name,
(point[name[1]].px* scale->w+scale->x),
(point[name[1]].py* scale->w+scale->y),
(point[name[1]].pz* scale->w+scale->z) );
v0[0]=0.;
v0[1]=point[name[1]].py* scale->w+scale->y;
v0[2]=point[name[1]].pz* scale->w+scale->z;
v1[0]=0.; v1[1]=1.; v1[2]=0.;
dax=v_angle(v0,v1);
v0[0]=point[name[1]].px* scale->w+scale->x;
v0[1]=0.;
v0[2]=point[name[1]].pz* scale->w+scale->z;
v1[0]=0.; v1[1]=0.; v1[2]=1.;
day=v_angle(v0,v1);
v0[0]=point[name[1]].px* scale->w+scale->x;
v0[1]=point[name[1]].py* scale->w+scale->y;
v0[2]=0.;
v1[0]=1.; v1[1]=0.; v1[2]=0.;
daz=v_angle(v0,v1);
v0[0]=point[name[1]].px* scale->w+scale->x;
v0[1]=point[name[1]].py* scale->w+scale->y;
v0[2]=point[name[1]].pz* scale->w+scale->z;
printf("axyz= %lf %lf %lf rxyz= %lf %lf %lf\n",
dax*180./PI,day*180./PI,daz*180./PI,
sqrt(v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v0[0]*v0[0]+v0[2]*v0[2]),
sqrt(v0[0]*v0[0]+v0[1]*v0[1]) );
if (compare(pickfunc, "qenq", 4) == 4)
{
sprintf(printbuf, " in set=");
index=2;
for(i=1; i<anz->sets; i++)
if(!set[i].type)
{
set[i].index=index++;
if((set[i].name!=(char *)NULL)&&(set[i].name[0]!='-')&&( getIndex(&set[i].pnt,set[i].anz_p,name[1]) >-1))
sprintf(&printbuf[strlen(printbuf)],"%s(%d),", set[i].name,set[i].index);
}
sprintf(&printbuf[strlen(printbuf)],"\n"); if(strlen(printbuf)>12) printf("%s", printbuf);
}
else if (compare(pickfunc, "qnor", 4) == 4)
{
if(qnorCounter==2)
{
p_qnor[0]=name[1];
qnorCounter=0;
getNewName(buffer,"l");
if((i=normalLine(buffer, p_qnor, pickbuf))<0)
{ printf("qnor: could not create new line\n"); }
else { printf(" create line:%s with new end-point %s\n", buffer, point[i].name ); }
}
else p_qnor[++qnorCounter]=name[1];
}
else if (compare(pickfunc, "qdis", 4) == 4)
{
if( type[1] == 'h') /* plane */
{
cpFlag++;
v_qdis[cpFlag][0]=point[name[1]].px* scale->w+scale->x;
v_qdis[cpFlag][1]=point[name[1]].py* scale->w+scale->y;
v_qdis[cpFlag][2]=point[name[1]].pz* scale->w+scale->z;
if(cpFlag==3) { type[1]=0; cpFlag=0; shFlag++; }
}
else if( type[1] == 'c') /* set centerpnt */
{
type[1] =0;
cpFlag=1;
v_qdis[2][0]=point[name[1]].px* scale->w+scale->x;
v_qdis[2][1]=point[name[1]].py* scale->w+scale->y;
v_qdis[2][2]=point[name[1]].pz* scale->w+scale->z;
}
else if(qdisFlag>0)
{
qdisFlag=0;
shFlag=0;
v_qdis[1][0]=point[name[1]].px* scale->w+scale->x;
v_qdis[1][1]=point[name[1]].py* scale->w+scale->y;
v_qdis[1][2]=point[name[1]].pz* scale->w+scale->z;
if(cpFlag==1)
{
cpFlag=0;
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]-v_qdis[2][i]; v1[i]=v_qdis[1][i]-v_qdis[2][i]; }
da=v_angle(v0,v1);
r1=v_betrag(v0);
r2=v_betrag(v1);
rm=(r1+r2)*.5;
lcir=2.*rm*da;
printf(" lcir:%lf da:%lf dr:%lf r1:%lf r2:%lf\n", lcir, da*180./PI, r2-r1, r1, r2 );
}
else
{
da=v_angle(v_qdis[0],v_qdis[1]);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
v0[0]=v1[0]=0.;
dax=v_angle(v0,v1);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
v0[1]=v1[1]=0.;
day=v_angle(v0,v1);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
v0[2]=v1[2]=0.;
daz=v_angle(v0,v1);
for(i=0; i<3; i++) { v0[i]=v_qdis[0][i]; v1[i]=v_qdis[1][i]; }
printf("dist= %lf dxyz= %lf %lf %lf da= %lf daxyz= %lf %lf %lf dr=%lf drxyz= %lf %lf %lf\n",
sqrt((v_qdis[1][0]-v_qdis[0][0])*(v_qdis[1][0]-v_qdis[0][0])+
(v_qdis[1][1]-v_qdis[0][1])*(v_qdis[1][1]-v_qdis[0][1])+
(v_qdis[1][2]-v_qdis[0][2])*(v_qdis[1][2]-v_qdis[0][2])),
v_qdis[1][0]-v_qdis[0][0],v_qdis[1][1]-v_qdis[0][1],v_qdis[1][2]-v_qdis[0][2],
da*180./PI, dax*180./PI, day*180./PI, daz*180./PI,
sqrt(v1[0]*v1[0]+v1[1]*v1[1]+v1[2]*v1[2])-sqrt(v0[0]*v0[0]+v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v1[1]*v1[1]+v1[2]*v1[2])-sqrt(v0[1]*v0[1]+v0[2]*v0[2]),
sqrt(v1[0]*v1[0]+v1[2]*v1[2])-sqrt(v0[0]*v0[0]+v0[2]*v0[2]),
sqrt(v1[0]*v1[0]+v1[1]*v1[1])-sqrt(v0[0]*v0[0]+v0[1]*v0[1]) );
}
}
else
{
if(qaddTol>-1) // distance of that node to a set of surfaces or faces
{
qaddTol=-1;
delSet(specialset->mpc);
pre_seta( specialset->mpc, "p", point[name[1]].name);
sprintf(buffer,"dist %s %s nor",specialset->mpc,specialset->impc);
pre_proj(buffer);
//delSet(specialset->mpc);
//delSet(specialset->impc);
}
else
{
qdisFlag=1; shFlag++;
v_qdis[0][0]=point[name[1]].px* scale->w+scale->x;
v_qdis[0][1]=point[name[1]].py* scale->w+scale->y;
v_qdis[0][2]=point[name[1]].pz* scale->w+scale->z;
}
}
if(shFlag==2) // calc the normal dist of v_qdis[0] to the shape v_qdis[1] v_qdis[2] v_qdis[3]
{
qdisFlag=0;
shFlag=0;
printf("normal dist:%lf\n",normdist(&v_qdis[0][0],&v_qdis[1][0],&v_qdis[2][0],&v_qdis[3][0]));
}
}
else if (compare(pickfunc, "qlin", 4) == 4)
{
if( type[1] == 'b') entitybuf=createLine( point[name[1]].name, 0 ); /* start line */
if( type[1] == 'g') entitybuf=createLine( point[name[1]].name, 1 ); /* end line */
if( type[1] == 'c') entitybuf=createLine( point[name[1]].name, 2 ); /* add centerpnt */
if( type[1] == 'm') entitybuf=createLine( point[name[1]].name, 3 ); /* midpnt, create centerpnt */
if( type[1] == 't') entitybuf=createLine( point[name[1]].name, 4 ); /* seq, create set */
if( type[1] == 'p') entitybuf=createLine( point[name[1]].name, 5 ); /* change length of line (displace) */
}
else if (compare(pickfunc, "qcnt", 4) == 4)
{
center( point[name[1]].px, point[name[1]].py, point[name[1]].pz);
dx_cur=PICK_LENGTH; dy_cur=PICK_LENGTH;
glutSetWindow( w1);
/* Keyboardfunktion wiederherstellen (von pick()) */
pickFlag=0;
free(selectBuf); selectBuf=NULL;
glutKeyboardFunc ( Keyboard );
glutSetWindow( activWindow );
}
else if (compare(pickfunc, "qdel", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qadd", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qrem", 4) == 4) { if(set[setNrbuf].type) seqr( setNrbuf, type, name[1]); else setr( setNrbuf, type, name[1]); }
else if (compare(pickfunc, "qpnt", 4) == 4)
{
if((surfNr>-1)||(nurbsNr>-1)||(shapeNr>-1)) /* move points to a surface */
seta( setNrbuf, type, name[1]);
else movePoint(name, x, y);
}
else if (compare(pickfunc, "qali", 4) == 4) pre_align( name[1], 1 );
else if (compare(pickfunc, "qcut", 4) == 4) pre_cut( name[1], type[1] );
else if (compare(pickfunc, "qshp", 4) == 4)
{
shapebuf.p[shp_pindx++]=name[1];
printf(" %d pnt picked\n",shp_pindx);
if(shp_pindx>6)
{
shp_pindx=0;
}
}
}
else if (name[0] == 'l')
{
if (line[name[1]].name == (char *)NULL) return(0);
if (compare(pickfunc, "qenq", 4) == 4)
{
if(type[1]=='c')
{
/* lcmb must be identified and added */
for(i=0; i<anzGeo->c; i++)
{
if( lcmb[i].name != (char *)NULL )
{
for(j=0; j<lcmb[i].nl; j++) if(lcmb[i].l[j]==name[1])
{
printf (" lcmb:%s ", lcmb[i].name );
for (k=0; k<lcmb[i].nl; k++)
{
printf (" %1c %s", lcmb[i].o[k], line[lcmb[i].l[k]].name );
}
printf (" \n");
}
}
}
return(1);
}
}
else if (compare(pickfunc, "qadd", 4) == 4)
{
if(type[1]=='c')
{
/* lcmb must be identified and added */
for(i=0; i<anzGeo->c; i++)
{
if( lcmb[i].name != (char *)NULL )
{
for(j=0; j<lcmb[i].nl; j++) if(lcmb[i].l[j]==name[1])
{
printf (" lcmb:%s ", lcmb[i].name );
for (k=0; k<lcmb[i].nl; k++)
{
printf (" %1c %s", lcmb[i].o[k], line[lcmb[i].l[k]].name );
seta( setNrbuf, "l",lcmb[i].l[k] );
}
printf (" \n");
seta( setNrbuf, "c", i);
}
}
}
return(1);
}
else seta( setNrbuf, type, name[1]);
}
else if (compare(pickfunc, "qdel", 4) == 4)
{
if(type[1]=='c')
{
/* lcmb must be identified and added */
for(i=0; i<anzGeo->c; i++)
{
if( lcmb[i].name != (char *)NULL )
{
for(j=0; j<lcmb[i].nl; j++) if(lcmb[i].l[j]==name[1])
{
printf (" lcmb:%s ", lcmb[i].name );
seta( setNrbuf, "c", i);
}
}
}
return(1);
}
else seta( setNrbuf, type, name[1]);
}
else if (compare(pickfunc, "qrem", 4) == 4)
{
if(type[1]=='c')
{
/* lcmb must be identified and added */
for(i=0; i<anzGeo->c; i++)
{
if( lcmb[i].name != (char *)NULL )
{
for(j=0; j<lcmb[i].nl; j++) if(lcmb[i].l[j]==name[1])
{
printf (" lcmb:%s ", lcmb[i].name );
for (k=0; k<lcmb[i].nl; k++)
{
printf (" %1c %s", lcmb[i].o[k], line[lcmb[i].l[k]].name );
setr( setNrbuf, "l",lcmb[i].l[k] );
}
printf (" \n");
setr( setNrbuf, "c", i);
}
}
}
return(1);
}
else setr( setNrbuf, type, name[1]);
}
else if ((compare(pickfunc, "qbia", 4) == 4)&&(line[name[1]].div>1))
{
if(type[3]=='c')
line[name[1]].bias=1./line[name[1]].bias;
else
{
if(line[name[1]].bias<1.)
line[name[1]].bias = 1./pow((double)pickbuf, (1./((double)line[name[1]].div-1.)));
else
line[name[1]].bias = pow((double)pickbuf, (1./((double)line[name[1]].div-1.)));
}
repLine(name[1]);
}
else if (compare(pickfunc, "qdiv", 4) == 4)
{
if((line[name[1]].bias!=1.)&&(pickbuf>1))
{
bias_fbd=getBias_fbd(name[1], line);
// printf(" bias_fbd:%d\n", bias_fbd);
// code from splitBiasDiv()
bias_fbd*=10;
/* in the fbd-format-definition bias is defined as bias(a)=(elem_length(last)/elem_length(first)) */
/* therefore a re-calculation is necessary because in cgx the definition is: */
/* bias(b) = (elem_length(n+1)/elem_length(n)) => bias(a)= bias(b)**(div-1) */
if(pickbuf>1)
{
if(bias_fbd<0) line[name[1]].bias= 1./pow(((double)bias_fbd*-.1), (1./((double)pickbuf-1.)));
else line[name[1]].bias= pow(((double)bias_fbd*.1), (1./((double)pickbuf-1.)));
}
else line[name[1]].bias=1.;
}
else if(pickbuf==1) line[name[1]].bias=1.;
if(pickbuf>0) line[name[1]].div=pickbuf;
repLine(name[1]);
}
bias_fbd=getBias_fbd(name[1], line);
if (line[name[1]].typ=='a')
printf ("%s p1:%s p2:%s pc:%s div:%d bias:%d bias_el:%lf\n"
, line[name[1]].name, point[line[name[1]].p1].name, point[line[name[1]].p2].name
, point[line[name[1]].trk].name, line[name[1]].div, bias_fbd, line[name[1]].bias );
else if (line[name[1]].typ=='s')
printf ("%s p1:%s p2:%s set:%s div:%d bias:%d bias_el:%lf\n"
, line[name[1]].name, point[line[name[1]].p1].name, point[line[name[1]].p2].name
, set[line[name[1]].trk].name, line[name[1]].div, bias_fbd, line[name[1]].bias );
else if (line[name[1]].typ==' ')
printf ("%s p1:%s p2:%s div:%d bias:%d bias_el:%lf\n"
, line[name[1]].name, point[line[name[1]].p1].name, point[line[name[1]].p2].name
, line[name[1]].div, bias_fbd, line[name[1]].bias );
if (compare(pickfunc, "qenq", 4) == 4)
{
sprintf(printbuf, " in set=");
index=2;
for(i=1; i<anz->sets; i++)
if(!set[i].type)
{
set[i].index=index++;
if((set[i].name!=(char *)NULL)&&(set[i].name[0]!='-')&&( getIndex(&set[i].line,set[i].anz_l,name[1]) >-1))
sprintf(&printbuf[strlen(printbuf)],"%s(%d),",set[i].name,set[i].index);
}
sprintf(&printbuf[strlen(printbuf)],"\n"); if(strlen(printbuf)>12) printf("%s", printbuf);
}
else if (compare(pickfunc, "qmsh", 4) == 4) seta( setNrbuf, type, name[1]);
else if (compare(pickfunc, "qint", 4) == 4)
{
if(intersect( name[1])==0) for (j=0; j<set[setall].anz_l; j++) repLine(set[setall].line[j]);
}
else if (compare(pickfunc, "qfil", 4) == 4)
{
if(createFillet( name[1], filletRadius)==0) for (j=0; j<set[setall].anz_l; j++) repLine(set[setall].line[j]);
}
else if (compare(pickfunc, "qseq", 4) == 4) seta( setNrbuf, type, name[1]);
else if ((compare(pickfunc, "qspl", 4) == 4)||((compare(pickfunc, "qlin", 4) == 4)&&(type[1]=='s') ))
{
for(j=0; j<qspl_i; j++) if(qspl_indx[j]==name[1]) return(0);
if (qspl_i<MAX_LINES) qspl_indx[qspl_i]=name[1];
else { printf(" ERROR in hitAction(), to much lines picked. Increase MAX_LINES\n"); return(0); }
qspl_i++;
k= qsplitLine( name[1], x, y );
if(k>-1) seta( setNrbuf, "p", k);
if(set[setNrbuf].anz_p>1)
{
sprintf( buffer,"p %s %lf", set[setNrbuf].name, gtol);
pre_merge( buffer);
}
}
else if (compare(pickfunc, "qsur", 4) == 4)
{
if(type[1]=='l') pickstack(name[1]);
else strcpy(type, line[name[1]].name);
}
else if ((compare(pickfunc, "qlin", 4) == 4)&&(type[1]=='e') )
{
if(entitybuf==name[1]) entitybuf=lineNr;
if(entitybuf<0) return(0);
if(entitybuf==name[1]) return(0);
printf ("try to replace line %s by %s\n", line[name[1]].name, line[entitybuf].name);
if(name[1] !=entitybuf)
{
/* versuche eine linie direkt auszutauschten */
if((line[name[1]].p1==line[entitybuf].p1)&&(line[name[1]].p2==line[entitybuf].p2))
{
line[entitybuf].div=line[name[1]].div;
/* check lcmbs for the line[i] */
for (j=0; j<anzGeo->c; j++)
{
for (k=0; k<lcmb[j].nl; k++)
{
if (lcmb[j].l[k] == name[1])
{
lcmb[j].l[k]=entitybuf;
printf ("replace %s in lcmb %s by %s\n", line[name[1]].name, lcmb[j].name, line[entitybuf].name);
}
}
}
/* check surfs for the line[i] */
for (j=0; j<anzGeo->s; j++)
{
for (k=0; k<surf[j].nl; k++)
{
if ((surf[j].l[k] == name[1])&&(surf[j].typ[k]=='l'))
{
surf[j].l[k]=entitybuf;
printf ("replace %s in surf %s by %s\n", line[name[1]].name, surf[j].name, line[entitybuf].name);
}