0022792: Globally defined symbol PI conflicts with VTK definition (Intel compiler)
[occt.git] / src / ViewerTest / ViewerTest_RelationCommands.cxx
CommitLineData
7fd59977 1// File: ViewerTest_CstAndDimension.cxx
2// Created: Thu Nov 12 15:00:17 1998
3// Author: Robert COUBLANC
4// <rob@robox.paris1.matra-dtv.fr>
5
6
7#include <ViewerTest.hxx>
8#ifdef HAVE_CONFIG_H
9# include <config.h>
10#endif
11
12#include <AIS_InteractiveContext.hxx>
13#include <string.h>
14#include <Draw_Interpretor.hxx>
15#include <Draw.hxx>
16#include <Draw_Appli.hxx>
17#include <DBRep.hxx>
18
19
20#include <TCollection_AsciiString.hxx>
21#include <V3d_Viewer.hxx>
22#include <V3d_View.hxx>
23#include <V3d.hxx>
24
25#include <AIS_InteractiveContext.hxx>
26#include <AIS_Shape.hxx>
27#include <AIS_Point.hxx>
28#include <AIS_DisplayMode.hxx>
29#include <TColStd_MapOfInteger.hxx>
30#include <AIS_MapOfInteractive.hxx>
31#include <ViewerTest_DoubleMapOfInteractiveAndName.hxx>
32#include <ViewerTest_DoubleMapIteratorOfDoubleMapOfInteractiveAndName.hxx>
33#include <ViewerTest_EventManager.hxx>
34
35#include <TopoDS_Solid.hxx>
36#include <BRepTools.hxx>
37#include <BRep_Builder.hxx>
38#include <TopAbs_ShapeEnum.hxx>
39
40#include <TopoDS.hxx>
41#include <BRep_Tool.hxx>
42
43#include <TopAbs.hxx>
44#include <TopExp.hxx>
45#include <TopoDS_Vertex.hxx>
46#include <TopoDS_Face.hxx>
47
48#include <Draw_Window.hxx>
49#include <AIS_ListIteratorOfListOfInteractive.hxx>
50#include <AIS_ListOfInteractive.hxx>
51#include <AIS_DisplayMode.hxx>
52#include <ElSLib.hxx>
53#include <Geom_CartesianPoint.hxx>
54#include <StdSelect.hxx>
55
56
57extern ViewerTest_DoubleMapOfInteractiveAndName& GetMapOfAIS();
58extern int ViewerMainLoop(Standard_Integer argc, const char** argv);
59extern Handle(AIS_InteractiveContext)& TheAISContext ();
60
61
62#include <Geom_Plane.hxx>
63#include <gp_Pln.hxx>
64#include <AIS_AngleDimension.hxx>
65#include <TCollection_ExtendedString.hxx>
66#include <GC_MakePlane.hxx>
67#include <IntAna_IntConicQuad.hxx>
68#include <Select3D_Projector.hxx>
69#include <Precision.hxx>
70#include <IntAna_Quadric.hxx>
71
72#ifdef HAVE_STRINGS_H
73# include <strings.h>
74#endif
75
76
77
78#define VertexMask 0x01
79#define EdgeMask 0x02
80#define FaceMask 0x04
81
82
83static Standard_Boolean ComputeIntersection(const gp_Lin& L,const gp_Pln& ThePl, gp_Pnt& TheInter)
84{
85 static IntAna_Quadric TheQuad;
86 TheQuad.SetQuadric(ThePl);
87 static IntAna_IntConicQuad QQ;
88 QQ.Perform(L,TheQuad);
89 if(QQ.IsDone()){
90 if(QQ.NbPoints()>0){
91 TheInter = QQ.Point(1);
92 return Standard_True;
93 }
94 }
95 return Standard_False;
96}
97
98//=======================================================================
99//function : Get3DPointAtMousePosition
100//purpose : calcul du point 3D correspondant a la position souris dans le plan de
101// la vue...
102//=======================================================================
103static gp_Pnt Get3DPointAtMousePosition(){
104 Handle(V3d_View) aview = ViewerTest::CurrentView();
105 static Select3D_Projector prj;
106 prj.SetView(aview);
107
108 // le plan de la vue...
109 Standard_Real xv,yv,zv;
110 aview->Proj(xv,yv,zv);
111 Standard_Real xat,yat,zat;
112 aview->At(xat,yat,zat);
113 gp_Pln ThePl(gp_Pnt(xat,yat,zat),gp_Dir(xv,yv,zv));
114 Standard_Integer xpix,ypix;
115 Standard_Real x,y;
116 ViewerTest::GetMousePosition(xpix,ypix);
117 aview->Convert(xpix,ypix,x,y); // espace reel 2D de la vue...
118 gp_Lin L = prj.Shoot(x,y);
119 gp_Pnt P(0.,0.,0.);
120
121 ComputeIntersection(L,ThePl,P);
122 return P;
123}
124
125
126
127//=======================================================================
128//function : ComputeNewPlaneForDim
129//purpose :
130//=======================================================================
131static void ComputeNewPlaneForDim(const Handle(AIS_Relation)& R,
132 gp_Pln& ,
133 gp_Pnt& )
134{
135// 0 COMPOUND,
136// 1 COMPSOLID,
137// 2 SOLID,
138// 3 SHELL,
139// 4 FACE,
140// 5 WIRE,
141// 6 EDGE,
142// 7 VERTEX,
143// 8 SHAPE
144 TopoDS_Shape S1 = R->FirstShape();
145 TopoDS_Shape S2 = R->SecondShape();
146 TopAbs_ShapeEnum Typ1 = S1.ShapeType();
147 TopAbs_ShapeEnum Typ2 = S2.ShapeType();
148
149 gp_Pnt thepoint [3];
150 thepoint[0] = Get3DPointAtMousePosition();
151
152 // on met l'objet le plus petit en 1...
153 if((Standard_Integer)Typ2>(Standard_Integer)Typ1){
154
155 TopoDS_Shape tmpS = S1;
156 TopAbs_ShapeEnum tmpT = Typ1;
157 S1= S2;
158 Typ1 = Typ2;
159 S2= tmpS;
160 Typ2 = tmpT;
161 }
162/*
163 switch (Typ1){
164 case TopAbs_VERTEX:{
165 thepoint[0] = BRep_Tool::Pnt(S1);
166 if(Typ2==TopAbs_VERTEX)
167 thepoint[1] = BRep_Tool::Pnt(S2);
168 else if(Typ2==TopAbs_EDGE){
169 TopoDS_Vertex Va,Vb;
170 TopExp::Vertices(S2,Va,Vb);
171 thepoint[1] = BRep_Tool::Pnt(Va);
172 }
173 else if(Typ2==TopAbs_FACE){
174 }
175 break;
176 }
177 case TopAbs_EDGE:
178 }
179*/
180}
181
182
183//=======================================================================
184//function : VAngleDimBuilder
185//purpose :
186//=======================================================================
187static int VAngleDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
188{
189 Standard_Integer myCurrentIndex;
190
191 if (argc!=2) {di<<" vangledim error."<<"\n";return 1;}
192 TheAISContext()->CloseAllContexts();
193 TheAISContext()->OpenLocalContext();
194 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
195 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
196 di<<" Select two edges coplanar or not."<<"\n";
197 Standard_Integer argcc = 5;
198 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
199 const char **argvv = (const char **) buff;
200 while (ViewerMainLoop( argcc, argvv) ) { }
201
202 TopoDS_Shape ShapeA;
203 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
204 ShapeA = TheAISContext()->SelectedShape();
205 }
206 // Si ShapeA est un Edge.
207 if (ShapeA.ShapeType()== TopAbs_EDGE ) {
208
209 // Boucle d'attente waitpick.
210 Standard_Integer argccc = 5;
211 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
212 const char **argvvv = (const char **) bufff;
213 while (ViewerMainLoop( argccc, argvvv) ) { }
214 // fin de la boucle
215
216 TopoDS_Shape ShapeB;
217 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
218 ShapeB = TheAISContext()->SelectedShape();
219 }
220 // ShapeB doit etre un Edge
221 if (ShapeB.ShapeType()!= TopAbs_EDGE ) {
222 di<<" vangledim error: you shoud have selected an edge."<<"\n";return 1;
223 }
224
225 // on recupere les vertexes de edgeA
226 TopoDS_Vertex Va,Vb;
227 TopExp::Vertices(TopoDS::Edge(ShapeA),Va ,Vb );
228 // Recuperation des points.
229 gp_Pnt A=BRep_Tool::Pnt(Va);
230 gp_Pnt B=BRep_Tool::Pnt(Vb);
231 gp_Pnt C(A.X()+5 ,A.Y()+5 ,A.Z()+5 );
232
233
234 // Construction du plane. Methode pas orthodoxe!
235 GC_MakePlane MkPlane(A ,B ,C );
236 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
237
238 // Construction du texte.
239 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString( 90 ) );
240
241 // Fermeture du context local.
242 TheAISContext()->CloseLocalContext(myCurrentIndex);
243
244 // Construction de l'AIS dimension
c6541a0c 245 Handle (AIS_AngleDimension) myAISDim= new AIS_AngleDimension (TopoDS::Edge(ShapeA) ,TopoDS::Edge(ShapeB) ,theGeomPlane ,M_PI/2.0 ,TheMessage_Str );
7fd59977 246 GetMapOfAIS().Bind (myAISDim,argv[1]);
247 TheAISContext()->Display(myAISDim );
248
249 }
250else {
251 di<<" vangledim error: you must select 2 edges."<<"\n";return 1;
252}
253
254
255 return 0;
256}
257
258//==============================================================================
259//function : VDiameterDim
260//purpose : Display the diameter dimension of a face or an edge.
261//Draw arg : vdiameterdim Name
262//==============================================================================
263#include <AIS_DiameterDimension.hxx>
264#include <TCollection_ExtendedString.hxx>
265#include <BRepAdaptor_Curve.hxx>
266#include <gp_Circ.hxx>
267
268
269static int VDiameterDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
270{
271 // Declarations
272 Standard_Integer myCurrentIndex;
273 Standard_Real theRadius;
274
275 // Verification
276 if (argc!=2) {di<<" vdiameterdim error"<<"\n";return 1;}
277 // Fermeture des contextes locaux
278 TheAISContext()->CloseAllContexts();
279 // Ouverture d'un contexte local et recuperation de son index.
280 TheAISContext()->OpenLocalContext();
281 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
282
283 // On active les modes de selections Edges et Faces.
284 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
285 di<<" Select an circled edge."<<"\n";
286
287 // Boucle d'attente waitpick.
288 Standard_Integer argcc = 5;
289 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
290 const char **argvv = (const char **) buff;
291 while (ViewerMainLoop( argcc, argvv) ) { }
292 // fin de la boucle
293
294 TopoDS_Shape ShapeA;
295 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
296 ShapeA = TheAISContext()->SelectedShape();
297 }
298 if (ShapeA.ShapeType()==TopAbs_EDGE ) {
299
300 // Recuperation du rayon
301 BRepAdaptor_Curve theCurve(TopoDS::Edge(ShapeA));
302 if (theCurve.GetType()!=GeomAbs_Circle ) {di<<"vdiameterdim error: the edge is not a circular one."<<"\n";return 1;}
303 else {
304 gp_Circ theGpCircle=theCurve.Circle();
305 theRadius=2.*theGpCircle.Radius();
306 }
307
308 // Construction du texte.
309 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theRadius ) );
310 // Construction de L'AIS_AngleDimension.
311 TheAISContext()->CloseLocalContext(myCurrentIndex);
312
313 Handle (AIS_DiameterDimension) myDiamDim= new AIS_DiameterDimension(ShapeA ,theRadius ,TheMessage_Str );
314 GetMapOfAIS().Bind (myDiamDim,argv[1]);
315 TheAISContext()->Display(myDiamDim );
316
317 }
318
319 else {
320 di<<" vdiameterdim error: the selection of a face or an edge was expected."<<"\n";return 1;
321 }
322
323 return 0;
324
325}
326
327
328//==============================================================================
329// Fonction vconcentric
330// ----------------- Uniquement par selection dans le viewer.
331//==============================================================================
332
333//==============================================================================
334//function : VConcentric
335//purpose : Display the concentric relation between two surfaces.
336//Draw arg : vconcentric Name
337//==============================================================================
338#include <AIS_ConcentricRelation.hxx>
339#include <Geom_Plane.hxx>
340#include <gp_Pln.hxx>
341#include <GC_MakePlane.hxx>
342#include <BRepAdaptor_Curve.hxx>
343#include <TopExp_Explorer.hxx>
344
345
346static int VConcentricBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
347{
348 // Declarations
349 Standard_Integer myCurrentIndex;
350
351 // Verification
352 if (argc!=2) {di<<"vconcentric error."<<"\n";return 1;}
353 // Fermeture des contextes locaux
354 TheAISContext()->CloseAllContexts();
355 // Ouverture d'un contexte local et recuperation de son index.
356 TheAISContext()->OpenLocalContext();
357 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
358
359 // On active les modes de selections Edges et Faces.
360 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
361 di<<" Select a circled edge."<<"\n";
362
363 // Boucle d'attente waitpick.
364 Standard_Integer argcc = 5;
365 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
366 const char **argvv = (const char **) buff;
367 while (ViewerMainLoop( argcc, argvv) ) { }
368 // fin de la boucle
369
370 TopoDS_Shape ShapeA;
371 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
372 ShapeA = TheAISContext()->SelectedShape();
373 }
374 // ShapeA est un edge
375 // ==================
376 if (ShapeA.ShapeType()==TopAbs_EDGE ) {
377 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4) );
378 di<<" Select an edge."<<"\n";
379
380 // Boucle d'attente waitpick.
381 Standard_Integer argccc = 5;
382 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
383 const char **argvvv = (const char **) bufff;
384 while (ViewerMainLoop( argccc, argvvv) ) { }
385 // fin de la boucle
386
387 TopoDS_Shape ShapeB;
388 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
389 ShapeB = TheAISContext()->SelectedShape();
390 }
391 if (ShapeB.ShapeType()!=TopAbs_EDGE ) {
392 di<<" vconcentric error: select an edge."<<"\n";return 1;
393 }
394
395 // Construction du plane.
396 // On recupere le centre du cercle A.
397 BRepAdaptor_Curve theCurveA(TopoDS::Edge(ShapeA) );
398 gp_Circ theCircleA=theCurveA.Circle();
399 gp_Pnt theCenterA=theCircleA.Location();
400 // On recupere deux points sur le cercle A
401 gp_Pnt B= theCurveA.Value(0.25);
402 gp_Pnt C= theCurveA.Value(0.75);
403 // Construction du plane.
404 GC_MakePlane MkPlane(theCenterA ,B ,C );
405 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
406
407 // Fermeture du context local
408 TheAISContext()->CloseLocalContext(myCurrentIndex);
409
410 Handle (AIS_ConcentricRelation) myConcentry= new AIS_ConcentricRelation(ShapeA, ShapeB, theGeomPlane );
411 TheAISContext()->Display(myConcentry );
412 GetMapOfAIS().Bind (myConcentry,argv[1]);
413 }
414
415
416 else {
417 di<<" vconcentric error: the selection of a face or an edge was expected."<<"\n";return 1;
418 }
419
420 return 0;
421
422
423
424
425}
426
427//==============================================================================
428//function : VEqualDistRelation
429//purpose :
430//Draw arg : vdiameterdim Name DiameterValue
431//==============================================================================
432#include <AIS_EqualDistanceRelation.hxx>
433#include <BRepExtrema_ExtCC.hxx>
434#include <GC_MakePlane.hxx>
435
436
437static int VEqualDistRelation(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
438{
439 // Declarations
440 Standard_Integer myCurrentIndex;
441
442 // Verification
443 if (argc!=2) {di<<" vequaldistrelation error: no arguments allowed."<<"\n";return 1;}
444
445 // Fermeture des contextes locaux
446 TheAISContext()->CloseAllContexts();
447
448 // Ouverture d'un contexte local et recuperation de son index.
449 TheAISContext()->OpenLocalContext();
450 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
451
452 // On active les modes de selections Edges et Vertexes.
453 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
454 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
455 di<<" Select an edge or a vertex"<<"\n";
456
457 // Boucle d'attente waitpick.
458 Standard_Integer argc1 = 5;
459 const char *buf1[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
460 const char **argv1 = (const char **) buf1;
461 while (ViewerMainLoop( argc1, argv1) ) { }
462 // fin de la boucle
463
464 TopoDS_Shape ShapeA;
465 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
466 ShapeA = TheAISContext()->SelectedShape();
467 }
468
469 di<<" Select an edge or a vertex"<<"\n";
470 // Boucle d'attente waitpick.
471 Standard_Integer argc2 = 5;
472 const char *buf2[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
473 const char **argv2 = (const char **) buf2;
474 while (ViewerMainLoop( argc2, argv2) ) { }
475 // fin de la boucle
476
477 TopoDS_Shape ShapeB;
478 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
479 ShapeB = TheAISContext()->SelectedShape();
480 }
481
482 // Verification des resultats.
483 if (ShapeA.ShapeType()==TopAbs_EDGE && ShapeB.ShapeType()==TopAbs_EDGE ) {
484 // A et B sont des edges ils doivent etre paralleles
485 BRepExtrema_ExtCC myDeltaEdge (TopoDS::Edge(ShapeA) ,TopoDS::Edge(ShapeB) );
486 // on verifie qu'ils sont pas paralleles.
487 if (!myDeltaEdge.IsParallel() ) {di<<"vequaldist error: non parallel edges."<<"\n";return 1; }
488
489 }
490
491
492 di<<" Select an edge or a vertex"<<"\n";
493 // Boucle d'attente waitpick.
494 Standard_Integer argc3 = 5;
495 const char *buf3[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
496 const char **argv3 = (const char **) buf3;
497 while (ViewerMainLoop( argc3, argv3) ) { }
498 // fin de la boucle
499
500 TopoDS_Shape ShapeC;
501 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
502 ShapeC = TheAISContext()->SelectedShape();
503 }
504
505 di<<" Select an edge or a vertex"<<"\n";
506 // Boucle d'attente waitpick.
507 Standard_Integer argc4 = 5;
508 const char *buf4[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
509 const char **argv4 = (const char **) buf4;
510 while (ViewerMainLoop( argc4, argv4) ) { }
511 // fin de la boucle
512
513 TopoDS_Shape ShapeD;
514 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
515 ShapeD = TheAISContext()->SelectedShape();
516 }
517 // Verification des resultats.
518 if (ShapeC.ShapeType()==TopAbs_EDGE && ShapeD.ShapeType()==TopAbs_EDGE ) {
519 // C et D sont des edges ils doivent etre paralleles
520 BRepExtrema_ExtCC myDeltaEdge2 (TopoDS::Edge(ShapeC) ,TopoDS::Edge(ShapeD) );
521 // on verifie qu'ils sont pas paralleles.
522 if (!myDeltaEdge2.IsParallel() ) {di<<"vequaldist error: non parallel edges."<<"\n";return 1; }
523
524 }
525
526 // Creation du plan porteur de la contrainte.Methode lourde!
527 gp_Pnt A,B,C;
528 if (ShapeA.ShapeType()==TopAbs_EDGE) {
529 // A est un edge
530 TopoDS_Vertex Va,Vb;
531 TopExp::Vertices (TopoDS::Edge(ShapeA) ,Va ,Vb );
532 A=BRep_Tool::Pnt(Va);
533 B=BRep_Tool::Pnt(Vb);
534
535 if (ShapeB.ShapeType()==TopAbs_EDGE) {
536 // B est un edge aussi
537 TopoDS_Vertex Vc,Vd;
538 TopExp::Vertices (TopoDS::Edge(ShapeB) ,Vc ,Vd );
539 // besoin que de 1 point.
540 C=BRep_Tool::Pnt(Vc);
541
542 }
543 else {
544 // B est un vertex
545 C=BRep_Tool::Pnt(TopoDS::Vertex(ShapeB) );
546 }
547 }
548 else {
549 // A est un vertex
550 A=BRep_Tool::Pnt(TopoDS::Vertex(ShapeA) );
551
552 if (ShapeB.ShapeType()==TopAbs_EDGE ) {
553 // B est un edge
554 TopoDS_Vertex Vb,Vc;
555 TopExp::Vertices (TopoDS::Edge(ShapeB) ,Vb ,Vc );
556 // besoin que de 2 points.
557 B=BRep_Tool::Pnt(Vb);
558 C=BRep_Tool::Pnt(Vc);
559
560 }
561 else {
562 // B est un vertex
563 B=BRep_Tool::Pnt(TopoDS::Vertex(ShapeB) );
564 C.SetX(B.X()+5.);
565 C.SetY(B.Y()+5.);
566 C.SetZ(B.Z()+5.);
567
568 }
569 }
570
571 // Fermeture du context local.
572 TheAISContext()->CloseLocalContext(myCurrentIndex);
573
574 // construction du plane
575 GC_MakePlane MkPlane(A ,B ,C );
576 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
577
578 // Construction de l'AIS_EqualDistanceRelation
579 Handle (AIS_EqualDistanceRelation ) myRelation= new AIS_EqualDistanceRelation (ShapeA, ShapeB, ShapeC ,ShapeD , theGeomPlane );
580 TheAISContext()->Display(myRelation );
581 GetMapOfAIS().Bind (myRelation,argv[1]);
582
583
584
585 return 0;
586
587}
588
589//==============================================================================
590//function : VEqualRadiusRelation
591//purpose :
592//Draw arg : vdiameterdim Name DiameterValue
593//==============================================================================
594#include <AIS_EqualRadiusRelation.hxx>
595#include <GC_MakePlane.hxx>
596#include <BRepAdaptor_Curve.hxx>
597
598
599static int VEqualRadiusRelation(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
600{
601 // Declarations
602 Standard_Integer myCurrentIndex;
603
604 // Verification
605 if (argc!=2) {di<<" vequalrad error: no arguments allowed."<<"\n";return 1;}
606
607 // Fermeture des contextes locaux
608 TheAISContext()->CloseAllContexts();
609
610 // Ouverture d'un contexte local et recuperation de son index.
611 TheAISContext()->OpenLocalContext();
612 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
613
614 // On active les modes de selections Edges.
615 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
616 di<<" Select an circled edge "<<"\n";
617
618 // Boucle d'attente waitpick.
619 Standard_Integer argc1 = 5;
620 const char *buf1[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
621 const char **argv1 = (const char **) buf1;
622 while (ViewerMainLoop( argc1, argv1) ) { }
623 // fin de la boucle
624
625 TopoDS_Shape ShapeA;
626 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
627 ShapeA = TheAISContext()->SelectedShape();
628 }
629
630 di<<" Select the last circled edge."<<"\n";
631 // Boucle d'attente waitpick.
632 Standard_Integer argc2 = 5;
633 const char *buf2[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
634 const char **argv2 = (const char **) buf2;
635 while (ViewerMainLoop( argc2, argv2) ) { }
636 // fin de la boucle
637
638 TopoDS_Shape ShapeB;
639 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
640 ShapeB = TheAISContext()->SelectedShape();
641 }
642 // creation du plan qui contient la contrainte.
643 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
644 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
645 BRepAdaptor_Curve theCurveA(EdgeA);
646 // On recupere 3 points A,B,C de la curve.
647 gp_Pnt A=theCurveA.Value(0.1);
648 gp_Pnt B=theCurveA.Value(0.5);
649 gp_Pnt C=theCurveA.Value(0.9);
650
651 // fermeture du contexte local.
652 TheAISContext()->CloseLocalContext(myCurrentIndex);
653
654 // Creation du plane.
655 GC_MakePlane MkPlane (A ,B ,C );
656 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
657 // Construction de l'AIS_EqualRadiusRelation
658 Handle (AIS_EqualRadiusRelation ) myRelation= new AIS_EqualRadiusRelation (EdgeA,EdgeB, theGeomPlane );
659 TheAISContext()->Display(myRelation );
660 GetMapOfAIS().Bind (myRelation,argv[1]);
661
662 return 0;
663
664}
665
666
667//==============================================================================
668//function : VFixRelation
669//purpose :
670//Draw arg : vdiameterdim Name DiameterValue
671//==============================================================================
672#include <AIS_FixRelation.hxx>
673#include <GC_MakePlane.hxx>
674#include <BRepAdaptor_Curve.hxx>
675
676static int VFixRelation(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
677{
678 // Declarations
679 Standard_Integer myCurrentIndex;
680
681 // Verification
682 if (argc!=2) {di<<" vfix error: no arguments allowed."<<"\n";return 1;}
683
684 // Fermeture des contextes locaux
685 TheAISContext()->CloseAllContexts();
686
687 // Ouverture d'un contexte local et recuperation de son index.
688 TheAISContext()->OpenLocalContext();
689 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
690
691 // On active les modes de selections edge.
692 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
693 di<<" Select an edge. "<<"\n";
694
695 // Boucle d'attente waitpick.
696 Standard_Integer argc1 = 5;
697 const char *buf1[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
698 const char **argv1 = (const char **) buf1;
699 while (ViewerMainLoop( argc1, argv1) ) { }
700 // fin de la boucle
701
702 TopoDS_Shape ShapeA;
703 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
704 ShapeA = TheAISContext()->SelectedShape();
705 }
706
707 // creation du plan qui contient la contrainte.
708 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
709 BRepAdaptor_Curve theCurveA(EdgeA);
710 // On recupere 3 points A,B,C de la curve.
711 gp_Pnt A=theCurveA.Value(0.1);
712 gp_Pnt B=theCurveA.Value(0.5);
713 gp_Pnt D=theCurveA.Value(0.9);
714 gp_Pnt C(B.X()+5,B.Y()+5,B.Z()+5);
715
716 // fermeture du contexte local.
717 TheAISContext()->CloseLocalContext(myCurrentIndex);
718
719 // Creation du plane.
720 GC_MakePlane MkPlane (A ,D ,C );
721 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
722 // Construction de l'AIS_EqualRadiusRelation
723 Handle (AIS_FixRelation) myRelation= new AIS_FixRelation (EdgeA,theGeomPlane );
724 TheAISContext()->Display(myRelation );
725 GetMapOfAIS().Bind (myRelation,argv[1]);
726
727
728 return 0;
729
730}
731
732//==============================================================================
733//function : VIdenticRelation
734//purpose :
735//Draw arg : vdiameterdim Name DiameterValue
736//==============================================================================
737#include <AIS_IdenticRelation.hxx>
738#include <BRepAdaptor_Curve.hxx>
739#include <TopExp_Explorer.hxx>
740
741
742static int VIdenticRelation(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
743{
744 // Declarations
745 Standard_Integer myCurrentIndex;
746
747 // Verification
748 if (argc!=2) {di<<" videntity error: no arguments allowed."<<"\n";return 1;}
749
750 // Fermeture des contextes locaux
751 TheAISContext()->CloseAllContexts();
752
753 // Ouverture d'un contexte local et recuperation de son index.
754 TheAISContext()->OpenLocalContext();
755 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
756
757 // On active les modes de selections vertex et face.
758 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
759 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
760 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
761 di<<" Select an edge, a face or a vertex. "<<"\n";
762
763 // Boucle d'attente waitpick.
764 Standard_Integer argc1 = 5;
765 const char *buf1[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
766 const char **argv1 = (const char **) buf1;
767 while (ViewerMainLoop( argc1, argv1) ) { }
768 // fin de la boucle
769
770 TopoDS_Shape ShapeA;
771 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
772 ShapeA = TheAISContext()->SelectedShape();
773 }
774
775 di<<" Select an edge, a face or a vertex. "<<"\n";
776 // Boucle d'attente waitpick.
777 Standard_Integer argc2 = 5;
778 const char *buf2[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
779 const char **argv2 = (const char **) buf2;
780 while (ViewerMainLoop( argc2, argv2) ) { }
781 // fin de la boucle
782
783 TopoDS_Shape ShapeB;
784 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
785 ShapeB = TheAISContext()->SelectedShape();
786 }
787
788 // Recuperation de points pour construir le Geom_Plnae.
789 gp_Pnt A,B,C;
790 if (ShapeA.ShapeType()==TopAbs_EDGE) {
791 // A est un edge; on peut supposer qu'il sera element d'une face ou possesseur d'un vertex ou identic a un autre edge.
792 // on recupere deux points sur l'edge (il peut etre rectiligne)
793 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
794 BRepAdaptor_Curve theCurveA(EdgeA);
795 // Creation des 3 points.
796 A=theCurveA.Value(0.1);
797 B=theCurveA.Value(0.9);
798 C.SetX(B.X()+5.);
799 C.SetY(B.Y()+5.);
800 C.SetZ(B.Z()+5.);
801 }
802 else if (ShapeA.ShapeType()==TopAbs_VERTEX ) {
803 // SahpeA est un Vertex
804 // On va utiliser ShapeB
805 if (ShapeB.ShapeType()==TopAbs_EDGE) {
806 // B est un edge
807 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
808 BRepAdaptor_Curve theCurveB(EdgeB);
809 // Creation des 3 points.
810 A=theCurveB.Value(0.1);
811 B=theCurveB.Value(0.9);
812 C.SetX(B.X()+5.);
813 C.SetY(B.Y()+5.);
814 C.SetZ(B.Z()+5.);
815
816 }
817 else if (ShapeB.ShapeType()==TopAbs_FACE ) {
818 // Shape B est une face
819 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
820 // On recupere 1 edge de FaceB(la face n'a pas forcement de vertex) (l'element A est forcement dans B).
821 TopExp_Explorer FaceExp(FaceB,TopAbs_EDGE);
822 TopoDS_Edge EdgeFromB=TopoDS::Edge(FaceExp.Current() );
823 // On recupere les 3 points de l'edge de face B
824 BRepAdaptor_Curve theCurveB(EdgeFromB);
825 // On recupere 3 points A,B,C de la curve.
826 A=theCurveB.Value(0.1);
827 B=theCurveB.Value(0.5);
828 C=theCurveB.Value(0.9);
829
830 }
831 else {
832 // B ets un vetex aussi
833 A=BRep_Tool::Pnt(TopoDS::Vertex(ShapeA) );
834 B=BRep_Tool::Pnt(TopoDS::Vertex(ShapeB) );
835 C.SetX(B.X()+5.);
836 C.SetY(B.Y()+5.);
837 C.SetZ(B.Z()+5.);
838
839 }
840
841 }
842 else {
843 // A est une face.
844 TopoDS_Face FaceA=TopoDS::Face(ShapeA);
845 // On recupere 1 edge de FaceA
846 TopExp_Explorer FaceExp(FaceA,TopAbs_EDGE);
847 TopoDS_Edge EdgeFromA=TopoDS::Edge(FaceExp.Current() );
848 // On recupere les 3 points de l'edge
849 BRepAdaptor_Curve theCurveA(EdgeFromA);
850 // On recupere 3 points A,B,C de la curve.
851 A=theCurveA.Value(0.1);
852 B=theCurveA.Value(0.5);
853 C=theCurveA.Value(0.9);
854
855 }
856
857 // Fermeture du context local.
858 TheAISContext()->CloseLocalContext(myCurrentIndex);
859 // On construit le plane
860 GC_MakePlane MkPlane (A ,B ,C );
861 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
862
863 // Construction de l'AIS_IdenticRelation
864 Handle ( AIS_IdenticRelation ) myRelation= new AIS_IdenticRelation (ShapeA ,ShapeB, theGeomPlane );
865 TheAISContext()->Display(myRelation );
866 GetMapOfAIS().Bind (myRelation,argv[1]);
867
868
869
870 return 0;
871
872}
873//==============================================================================
874//function : VLengthDimension
875//purpose : Display the diameter dimension of a face or an edge.
876//Draw arg : vdiameterdim Name DiameterValue
877//==============================================================================
878#include <AIS_LengthDimension.hxx>
879#include <BRepExtrema_ExtCC.hxx>
880#include <BRepExtrema_ExtPC.hxx>
881#include <BRepExtrema_ExtCF.hxx>
882#include <BRepExtrema_ExtPF.hxx>
883#include <BRepExtrema_ExtFF.hxx>
884#include <TCollection_ExtendedString.hxx>
885#include <BRepExtrema_DistShapeShape.hxx>
886#include <GC_MakePlane.hxx>
887#include <TopExp_Explorer.hxx>
888#include <BRepBuilderAPI_MakeVertex.hxx>
889static int VLenghtDimension(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
890{
891 // Declarations
892 Standard_Integer myCurrentIndex;
893 Standard_Real theDist;
894
895 // Verification
896 if (argc!=2) {di<<" videntity error: no arguments allowed."<<"\n";return 1;}
897
898 // Fermeture des contextes locaux
899 TheAISContext()->CloseAllContexts();
900
901 // Ouverture d'un contexte local et recuperation de son index.
902 myCurrentIndex = TheAISContext()->OpenLocalContext();
903 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
904 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
905 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
906 di<<" Select an edge, a face or a vertex. "<<"\n";
907
908 // Boucle d'attente waitpick.
909 Standard_Integer argc1 = 5;
910 const char *buf1[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
911 const char **argv1 = (const char **) buf1;
912 while (ViewerMainLoop( argc1, argv1) ) { }
913
914 // fin de la boucle
915 TopoDS_Shape ShapeA;
916 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
917 ShapeA = TheAISContext()->SelectedShape();
918 }
919 di<<" Select an edge, a face or a vertex. "<<"\n";
920 // Boucle d'attente waitpick.
921 Standard_Integer argc2 = 5;
922 const char *buf2[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
923 const char **argv2 = (const char **) buf2;
924 while (ViewerMainLoop( argc2, argv2) ) { }
925 // fin de la boucle
926
927 TopoDS_Shape ShapeB;
928 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
929 ShapeB = TheAISContext()->SelectedShape();
930 }
931 // ShapeA est un edge.
932 // ===================
933 if (ShapeA.ShapeType()==TopAbs_EDGE ) {
934 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
935
936 // Si ShapeB est un edge
937 if (ShapeB.ShapeType()==TopAbs_EDGE ) {
938 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
939 BRepExtrema_ExtCC myDeltaEdge (EdgeA ,EdgeB );
940 // on verifie qu'ils ne sont pas paralleles.
941 if (!myDeltaEdge.IsParallel() ) {di<<"vlenghtdim error: non parallel edges."<<"\n";return 1; }
942
943 // On saisit la distance et on l'arrondit!
944 theDist=Round (sqrt(myDeltaEdge.SquareDistance(1))*10. )/10.;
945
946 // On recupere 3 Points des edges pour construire un plane.
947 TopoDS_Vertex Va,Vb,Vc,Vd;
948 TopExp::Vertices(EdgeA,Va,Vb);
949 TopExp::Vertices(EdgeB,Vc,Vd);
950 gp_Pnt A=BRep_Tool::Pnt(Va);
951 gp_Pnt B=BRep_Tool::Pnt(Vb);
952 gp_Pnt C=BRep_Tool::Pnt(Vc);
953
954 // Creation du Plane contenant la relation.
955 GC_MakePlane MkPlane(A,B,C);
956 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
957
958 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
959
960 // On ferme le contexte local.
961 TheAISContext()->CloseLocalContext(myCurrentIndex);
962
963 // on construit l'AISLenghtDimension.
964 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeA,EdgeB,theGeomPlane,theDist,TheMessage_Str );
965 TheAISContext()->Display(myLenghtDim );
966 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
967 }
968
969 // Si ShapeB est un vertex.
970 else if (ShapeB.ShapeType()==TopAbs_VERTEX ) {
971
972 TopoDS_Vertex VertexB=TopoDS::Vertex(ShapeB);
973 BRepExtrema_ExtPC myDeltaEdgeVertex (VertexB ,EdgeA );
974
975 // On saisit la distance et on l'arrondit!
976 theDist=Round (sqrt (myDeltaEdgeVertex.SquareDistance(1))*10. )/10.;
977
978 // On recupere 2 Points de EdgeA pour construire un plane.
979 TopoDS_Vertex Va,Vb;
980 TopExp::Vertices(EdgeA,Va,Vb);
981 gp_Pnt A=BRep_Tool::Pnt(Va);
982 gp_Pnt B=BRep_Tool::Pnt(Vb);
983 gp_Pnt C=BRep_Tool::Pnt(VertexB);
984
985 GC_MakePlane MkPlane(A,B,C);
986 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
987
988 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
989 TheAISContext()->CloseLocalContext(myCurrentIndex);
990 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeA,VertexB,theGeomPlane,theDist,TheMessage_Str );
991 TheAISContext()->Display(myLenghtDim );
992 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
993
994
995 }
996
997 // Si ShapeB est une Face
998 else {
999
1000 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
1001 BRepExtrema_ExtCF myDeltaEdgeFace (EdgeA,FaceB );
1002 // On verifie que l'edge est bien parallele a la face.
1003 if (!myDeltaEdgeFace.IsParallel() ) {di<<"vdistdim error: the edge isn't parallel to the face;can't compute the distance. "<<"\n";return 1; }
1004
1005 // On saisit la distance et on l'arrondit!
1006 theDist=Round (sqrt (myDeltaEdgeFace.SquareDistance(1))*10. )/10.;
1007
1008 // Construction du texte.
1009 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
1010
1011 // on construit l'AISLenghtDimension.
1012 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceB,EdgeA,theDist,TheMessage_Str );
1013 TheAISContext()->Display(myLenghtDim );
1014 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
1015
1016 }
1017
1018 }
1019
1020 // ShapeA est un vertex
1021 // ====================
1022 if (ShapeA.ShapeType()==TopAbs_VERTEX ) {
1023 TopoDS_Vertex VertexA=TopoDS::Vertex(ShapeA);
1024
1025 // Si ShapeB est un edge.
1026 if (ShapeB.ShapeType()==TopAbs_EDGE ) {
1027 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
1028 BRepExtrema_ExtPC myDeltaEdgeVertex (VertexA ,EdgeB );
1029 // On saisit la distance et on l'arrondit!
1030 theDist=Round (sqrt (myDeltaEdgeVertex.SquareDistance(1))*10. )/10.;
1031
1032 // On recupere 2 Points de EdgeB pour construire un plane.
1033 TopoDS_Vertex Va,Vb;
1034 TopExp::Vertices(EdgeB,Va,Vb);
1035 gp_Pnt A=BRep_Tool::Pnt(Va);
1036 gp_Pnt B=BRep_Tool::Pnt(Vb);
1037 gp_Pnt C=BRep_Tool::Pnt(VertexA);
1038
1039 // Creation du Plane contenant la relation.
1040 GC_MakePlane MkPlane(A,B,C);
1041 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1042
1043 // Fermeture du contexte local.
1044 TheAISContext()->CloseLocalContext(myCurrentIndex);
1045 // Construction du texte.
1046 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
1047
1048 // on construit l'AISLenghtDimension.
1049 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (EdgeB,VertexA,theGeomPlane,theDist,TheMessage_Str );
1050 TheAISContext()->Display(myLenghtDim );
1051 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
1052
1053 }
1054
1055 // Si ShapeB est un vertex.
1056 else if (ShapeB.ShapeType()==TopAbs_VERTEX ) {
1057 TopoDS_Vertex VertexB=TopoDS::Vertex(ShapeB);
1058 BRepExtrema_DistShapeShape myDeltaVertexVertex (VertexA ,VertexB );
1059 // On saisit la distance et on l'arrondit!
1060 theDist=Round (myDeltaVertexVertex.Value()*10. )/10.;
1061
1062 // Les deux premiers points.
1063 gp_Pnt A=BRep_Tool::Pnt(VertexA);
1064 gp_Pnt B=BRep_Tool::Pnt(VertexB);
1065 gp_Pnt C(B.X()+10,B.Y()+10,B.Z()+10);
1066
1067 GC_MakePlane MkPlane(A,B,C);
1068 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1069
1070 // Fermeture du contexte local.
1071 TheAISContext()->CloseLocalContext(myCurrentIndex);
1072 // Construction du texte.
1073 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
1074
1075 // on construit l'AISLenghtDimension.
1076 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexA,VertexB,theGeomPlane,theDist,TheMessage_Str );
1077 TheAISContext()->Display(myLenghtDim );
1078 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
1079
1080
1081
1082
1083 }
1084
1085 // Si ShapeB est une Face
1086 else {
1087
1088 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
1089 BRepExtrema_ExtPF myDeltaVertexFace (VertexA ,FaceB );
1090 // On saisit la distance et on l'arrondit!
1091 theDist=Round (sqrt (myDeltaVertexFace.SquareDistance(1))*10. )/10.;
1092
1093 // Premier point.
1094 gp_Pnt A=BRep_Tool::Pnt(VertexA);
1095
1096 // On recupere 1 edge de FaceB.
1097 TopExp_Explorer FaceExp(FaceB,TopAbs_EDGE);
1098 TopoDS_Edge EdFromB=TopoDS::Edge(FaceExp.Current() );
1099 // On recupere les deux vertexes extremites de l'edge de face B
1100 TopoDS_Vertex Vb,Vc;
1101 TopExp::Vertices(EdFromB,Vb,Vc);
1102#ifdef DEB
1103 gp_Pnt B=
1104#endif
1105 BRep_Tool::Pnt(Vb);
1106 gp_Pnt C=BRep_Tool::Pnt(Vc);
1107
1108 // On projette le point B sur la Face car il
1109 // n'existe pas de constructeurs AIS_LD PointFace
1110 // on est donc oblige de creer un nouveau TopoDS_Vertex.
1111 gp_Pnt theProjA=myDeltaVertexFace.Point(1);
1112 BRepBuilderAPI_MakeVertex theVertexMaker(theProjA);
1113 TopoDS_Vertex VertexAproj=theVertexMaker.Vertex();
1114 // Creation du Plane contenant la relation.
1115 GC_MakePlane MkPlane(A,theProjA,C);
1116 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1117
1118 // Fermeture du contexte local.
1119 TheAISContext()->CloseLocalContext(myCurrentIndex);
1120 // Construction du texte.
1121 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
1122
1123 // on construit l'AISLenghtDimension.
1124 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexA,VertexAproj,theGeomPlane,theDist,TheMessage_Str );
1125 TheAISContext()->Display(myLenghtDim );
1126 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
1127
1128 }
1129
1130
1131
1132 }
1133
1134 // ShapeA est une Face
1135 // ===================
1136 else {
1137 TopoDS_Face FaceA=TopoDS::Face(ShapeA);
1138 // Si ShapeB est un edge.
1139 if (ShapeB.ShapeType()==TopAbs_EDGE ) {
1140 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
1141 BRepExtrema_ExtCF myDeltaEdgeFace (EdgeB,FaceA );
1142 // On verifie que l'edge est bien parallele a la face.
1143 if (!myDeltaEdgeFace.IsParallel() ) {di<<"vdistdim error: the edge isn't parallel to the face;can't compute the distance. "<<"\n";return 1; }
1144
1145 // On saisit la distance et on l'arrondit!
1146 theDist=Round (sqrt (myDeltaEdgeFace.SquareDistance(1))*10. )/10.;
1147
1148 // Construction du texte.
1149 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
1150
1151 // on construit l'AISLenghtDimension.
1152 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceA,EdgeB,theDist,TheMessage_Str );
1153 TheAISContext()->Display(myLenghtDim );
1154 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
1155
1156 }
1157
1158 // Si ShapeB est un vertex.
1159 else if (ShapeB.ShapeType()==TopAbs_VERTEX ) {
1160
1161 TopoDS_Vertex VertexB=TopoDS::Vertex(ShapeB);
1162 BRepExtrema_ExtPF myDeltaVertexFace (VertexB ,FaceA );
1163 // On saisit la distance et on l'arrondit!
1164 theDist=Round (sqrt (myDeltaVertexFace.SquareDistance(1))*10. )/10.;
1165
1166 // Premier point.
1167 gp_Pnt B=BRep_Tool::Pnt(VertexB);
1168
1169 // On recupere 1 edge de FaceA.
1170 TopExp_Explorer FaceExp(FaceA,TopAbs_EDGE);
1171 TopoDS_Edge EdFromA=TopoDS::Edge(FaceExp.Current() );
1172 // On recupere les deux vertexes extremites de l'edge de face A
1173 TopoDS_Vertex Va,Vc;
1174 TopExp::Vertices(EdFromA,Va,Vc);
1175 gp_Pnt A=BRep_Tool::Pnt(Va);
1176#ifdef DEB
1177 gp_Pnt C=
1178#endif
1179 BRep_Tool::Pnt(Vc);
1180
1181 // On projette le point B sur la Face car il
1182 // n'existe pas de constructeurs AIS_LD PointFace
1183 // on est donc oblige de creer un nouveau TopoDS_Vertex.
1184 gp_Pnt theProjB=myDeltaVertexFace.Point(1);
1185 BRepBuilderAPI_MakeVertex theVertexMaker(theProjB);
1186 TopoDS_Vertex VertexBproj=theVertexMaker.Vertex();
1187 // Creation du Plane contenant la relation.
1188 GC_MakePlane MkPlane(A,B,theProjB);
1189 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1190
1191 // Fermeture du contexte local.
1192 TheAISContext()->CloseLocalContext(myCurrentIndex);
1193 // Construction du texte.
1194 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
1195
1196 // on construit l'AISLenghtDimension mais en utilisant le constructeur Vertex Vertex.
1197 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (VertexB,VertexBproj,theGeomPlane,theDist,TheMessage_Str );
1198 TheAISContext()->Display(myLenghtDim );
1199 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
1200
1201 }
1202
1203 // Si ShapeB est une Face
1204 else {
1205
1206 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
1207 BRepExtrema_ExtFF myDeltaFaceFace (FaceA ,FaceB );
1208 // On verifie que les deux faces sont bien parelles.
1209 if (!myDeltaFaceFace.IsParallel() ) {di<<"vdistdim error: the faces are not parallel. "<<"\n";return 1; }
1210
1211 // On saisit la distance et on l'arrondit!
1212 theDist=Round (sqrt (myDeltaFaceFace.SquareDistance(1))*10. )/10.;
1213 // Fermeture du contexte local.
1214 TheAISContext()->CloseLocalContext(myCurrentIndex);
1215 // Construction du texte.
1216 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("d=")+TCollection_ExtendedString(theDist ) );
1217
1218 // on construit l'AISLenghtDimension.
1219 Handle(AIS_LengthDimension ) myLenghtDim=new AIS_LengthDimension (FaceA,FaceB,theDist,TheMessage_Str );
1220 TheAISContext()->Display(myLenghtDim );
1221 GetMapOfAIS().Bind (myLenghtDim ,argv[1]);
1222
1223 }
1224
1225 }
1226
1227
1228
1229 return 0;
1230
1231}
1232
1233
1234//==============================================================================
1235//function : VRadiusDim
1236//purpose : Display the radius dimension of a face or an edge.
1237//Draw arg : vradiusdim Name
1238//==============================================================================
1239#include <AIS_RadiusDimension.hxx>
1240#include <TCollection_ExtendedString.hxx>
1241#include <BRepAdaptor_Curve.hxx>
1242#include <gp_Circ.hxx>
1243
1244
1245static int VRadiusDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1246{
1247 // Declarations
1248 Standard_Integer myCurrentIndex;
1249 Standard_Real theRadius;
1250
1251 // Verification
1252 if (argc!=2) {di<<" vradiusdim error"<<"\n";return 1;}
1253
1254 // Fermeture des contextes locaux
1255 TheAISContext()->CloseAllContexts();
1256
1257 // Ouverture d'un contexte local et recuperation de son index.
1258 TheAISContext()->OpenLocalContext();
1259 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
1260
1261 // On active les modes de selections Edges et Faces.
1262 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
1263 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
1264 di<<" Select an circled edge or face."<<"\n";
1265
1266 // Boucle d'attente waitpick.
1267 Standard_Integer argcc = 5;
1268 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1269 const char **argvv = (const char **) buff;
1270 while (ViewerMainLoop( argcc, argvv) ) { }
1271 // fin de la boucle
1272
1273 TopoDS_Shape ShapeA;
1274 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1275 ShapeA = TheAISContext()->SelectedShape();
1276 }
1277
1278 // Shape A est un edge.
1279 if (ShapeA.ShapeType()==TopAbs_EDGE ) {
1280
1281 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
1282 // Recuperation du rayon
1283 BRepAdaptor_Curve theCurve(TopoDS::Edge(ShapeA));
1284 if (theCurve.GetType()!=GeomAbs_Circle ) {di<<"vradiusdim error: the edge is not a circular one."<<"\n";return 1;}
1285 else {
1286 gp_Circ theGpCircle=theCurve.Circle();
1287 theRadius=theGpCircle.Radius();
1288 // On arrondit le rayon
1289 theRadius=Round (theRadius*10. )/10.;
1290 }
1291
1292 // Construction du texte.
1293 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("r=")+TCollection_ExtendedString(theRadius ) );
1294
1295 // Fermeture du contexte.
1296 TheAISContext()->CloseLocalContext(myCurrentIndex);
1297
1298 // Construction de L'AIS_RadiusDimension.
1299 Handle (AIS_RadiusDimension) myRadDim= new AIS_RadiusDimension(ShapeA ,theRadius ,TheMessage_Str );
1300 GetMapOfAIS().Bind (myRadDim,argv[1]);
1301 TheAISContext()->Display(myRadDim );
1302
1303
1304 }
1305
1306 // Shape A est une face
1307 else if (ShapeA.ShapeType()==TopAbs_FACE ) {
1308
1309 // on recupere un edge de la face.
1310 TopoDS_Face FaceA=TopoDS::Face(ShapeA);
1311 // on explore.
1312 TopExp_Explorer FaceExp(FaceA,TopAbs_EDGE);
1313 TopoDS_Edge EdgeFromA=TopoDS::Edge(FaceExp.Current() );
1314
1315 // Recuperation du rayon
1316 BRepAdaptor_Curve theCurve(EdgeFromA );
1317 if (theCurve.GetType()!=GeomAbs_Circle ) {di<<"vradiusdim error: the face is not a circular one."<<"\n";return 1;}
1318 else {
1319 gp_Circ theGpCircle=theCurve.Circle();
1320 theRadius=theGpCircle.Radius();
1321 // On arrondit le rayon
1322 theRadius=Round (theRadius*10. )/10.;
1323 }
1324
1325 // Construction du texte.
1326 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("r=")+TCollection_ExtendedString(theRadius ) );
1327
1328 // Fermeture du contexte.
1329 TheAISContext()->CloseLocalContext(myCurrentIndex);
1330
1331 // Construction de L'AIS_RadiusDimension.
1332 Handle (AIS_RadiusDimension) myRadDim= new AIS_RadiusDimension(ShapeA ,theRadius ,TheMessage_Str );
1333 //Handle (AIS_MinRadiusDimension) myRadDim= new AIS_MinRadiusDimension(EdgeFromA ,theRadius ,TheMessage_Str );
1334 GetMapOfAIS().Bind (myRadDim,argv[1]);
1335 TheAISContext()->Display(myRadDim );
1336
1337
1338 }
1339
1340 else {
1341 di<<" vradiusdim error: the selection of a face or an edge was expected."<<"\n";return 1;
1342 }
1343
1344 return 0;
1345
1346}
1347
1348
1349
1350//==============================================================================
1351//function : VOffsetDim
1352//purpose : Display the offset dimension
1353//Draw arg : voffsetdim Name
1354//==============================================================================
1355#include <AIS_OffsetDimension.hxx>
1356#include <TCollection_ExtendedString.hxx>
1357#include <BRepExtrema_ExtFF.hxx>
1358
1359
1360static int VOffsetDimBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1361{
1362 // Declarations
1363 Standard_Integer myCurrentIndex;
1364 Standard_Real theDist;
1365
1366 // Verification
1367 if (argc!=2) {di<<" voffsetdim error"<<"\n";return 1;}
1368
1369 // Fermeture des contextes locaux
1370 TheAISContext()->CloseAllContexts();
1371
1372 // Ouverture d'un contexte local et recuperation de son index.
1373 TheAISContext()->OpenLocalContext();
1374 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
1375
1376 // On active les modes de selections Faces.
1377 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
1378 di<<" Select a face."<<"\n";
1379
1380 // Boucle d'attente waitpick.
1381 Standard_Integer argcc = 5;
1382 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1383 const char **argvv = (const char **) buff;
1384 while (ViewerMainLoop( argcc, argvv) ) { }
1385 // fin de la boucle
1386
1387 TopoDS_Shape ShapeA;
1388 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1389 ShapeA = TheAISContext()->SelectedShape();
1390 }
1391
1392 di<<" Select a face."<<"\n";
1393 // Boucle d'attente waitpick.
1394 Standard_Integer argccc = 5;
1395 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1396 const char **argvvv = (const char **) bufff;
1397 while (ViewerMainLoop( argccc, argvvv) ) { }
1398 // fin de la boucle
1399
1400 TopoDS_Shape ShapeB;
1401 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1402 ShapeB = TheAISContext()->SelectedShape();
1403 }
1404
1405
1406 // Shape A et B est une face
1407 if (ShapeA.ShapeType()==TopAbs_FACE && ShapeB.ShapeType()==TopAbs_FACE ) {
1408
1409 TopoDS_Face FaceA=TopoDS::Face(ShapeA);
1410 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
1411
1412 BRepExtrema_ExtFF myDeltaFaceFace (FaceA ,FaceB );
1413 // On verifie que les deux faces sont bien parelles.
1414 if (!myDeltaFaceFace.IsParallel() ) {di<<"vdistdim error: the faces are not parallel. "<<"\n";return 1; }
1415
1416 // On saisit la distance et on l'arrondit!
1417 theDist=Round (sqrt (myDeltaFaceFace.SquareDistance(1))*10. )/10.;
1418 // Fermeture du contexte local.
1419 TheAISContext()->CloseLocalContext(myCurrentIndex);
1420 // Construction du texte.
1421 TCollection_ExtendedString TheMessage_Str(TCollection_ExtendedString("offset=")+TCollection_ExtendedString(theDist ) );
1422
1423 // on construit l'AIS_OffsetDimension
1424 Handle(AIS_OffsetDimension) myOffsetDim=new AIS_OffsetDimension (FaceA,FaceB,theDist,TheMessage_Str );
1425 TheAISContext()->Display(myOffsetDim );
1426 GetMapOfAIS().Bind (myOffsetDim ,argv[1]);
1427
1428
1429
1430 }
1431
1432 else {
1433 di<<" voffsetdim error: the selection of a face was expected."<<"\n";return 1;
1434 }
1435
1436 return 0;
1437
1438}
1439
1440
1441
1442
1443//==============================================================================
1444//function : VParallel
1445//purpose : Display the parallel relation
1446//Draw arg : vparallel Name
1447//==============================================================================
1448#include <AIS_ParallelRelation.hxx>
1449#include <TCollection_ExtendedString.hxx>
1450#include <BRepExtrema_ExtFF.hxx>
1451#include <BRepExtrema_ExtCC.hxx>
1452#include <GC_MakePlane.hxx>
1453#include <BRepAdaptor_Curve.hxx>
1454#include <TopExp_Explorer.hxx>
1455
1456
1457static int VParallelBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1458{
1459 // Declarations
1460 Standard_Integer myCurrentIndex;
1461
1462 // Verification
1463 if (argc!=2) {di<<" vparallel error"<<"\n";return 1;}
1464
1465 // Fermeture des contextes locaux
1466 TheAISContext()->CloseAllContexts();
1467
1468 // Ouverture d'un contexte local et recuperation de son index.
1469 TheAISContext()->OpenLocalContext();
1470 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
1471
1472 // On active les modes de selections Edges.
1473 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
1474 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
1475 di<<" Select an edge or a face "<<"\n";
1476
1477 // Boucle d'attente waitpick.
1478 Standard_Integer argcc = 5;
1479 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1480 const char **argvv = (const char **) buff;
1481 while (ViewerMainLoop( argcc, argvv) ) { }
1482 // fin de la boucle
1483
1484 TopoDS_Shape ShapeA;
1485 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1486 ShapeA = TheAISContext()->SelectedShape();
1487 }
1488
1489 // SahpeA est un edge.
1490 // ===================
1491 if (ShapeA.ShapeType()==TopAbs_EDGE ) {
1492
1493 // desactivation du mode face
1494 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4) );
1495 di<<" Select a second edge"<<"\n";
1496 // Boucle d'attente waitpick.
1497 Standard_Integer argccc = 5;
1498 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1499 const char **argvvv = (const char **) bufff;
1500 while (ViewerMainLoop( argccc, argvvv) ) { }
1501 // fin de la boucle
1502
1503 TopoDS_Shape ShapeB;
1504 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1505 ShapeB = TheAISContext()->SelectedShape();
1506 }
1507
1508 // recuperation des edges.
1509 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
1510 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
1511 BRepExtrema_ExtCC myDeltaEdge (EdgeA ,EdgeB );
1512 // on verifie qu'ils ne sont pas paralleles.
1513 if (!myDeltaEdge.IsParallel() ) {di<<"vparallel error: non parallel edges."<<"\n";return 1; }
1514
1515
1516 // On recupere les vertexes extremites des edge A et B.
1517 BRepAdaptor_Curve theCurveA(EdgeA);
1518 BRepAdaptor_Curve theCurveB(EdgeB);
1519 // On recupere 3 points A,B,C des curves.
1520 gp_Pnt A=theCurveA.Value(0.1);
1521 gp_Pnt B=theCurveA.Value(0.9);
1522 gp_Pnt C=theCurveB.Value(0.5);
1523
1524 // Construction du Geom_Plane
1525 GC_MakePlane MkPlane(A,B,C);
1526 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1527 // Fermeture du contexte local.
1528 TheAISContext()->CloseLocalContext(myCurrentIndex);
1529 // Construction de l'AIS_ParallelRelation
1530 Handle(AIS_ParallelRelation) myParaRelation= new AIS_ParallelRelation(EdgeA ,EdgeB ,theGeomPlane );
1531 TheAISContext()->Display(myParaRelation );
1532 GetMapOfAIS().Bind (myParaRelation ,argv[1]);
1533
1534
1535 }
1536
1537 // Shape A est une face
1538 // ====================
1539 else {
1540
1541 // desactivation du mode edge
1542 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(2) );
1543 di<<" Select a second edge"<<"\n";
1544 // Boucle d'attente waitpick.
1545 Standard_Integer argccc = 5;
1546 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1547 const char **argvvv = (const char **) bufff;
1548 while (ViewerMainLoop( argccc, argvvv) ) { }
1549 // fin de la boucle
1550
1551 TopoDS_Shape ShapeB;
1552 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1553 ShapeB = TheAISContext()->SelectedShape();
1554 }
1555
1556 TopoDS_Face FaceA=TopoDS::Face(ShapeA);
1557 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
1558
1559 BRepExtrema_ExtFF myDeltaFaceFace (FaceA ,FaceB );
1560 // On verifie que les deux faces sont bien parelles.
1561 if (!myDeltaFaceFace.IsParallel() ) {di<<"vdistdim error: the faces are not parallel. "<<"\n";return 1; }
1562
1563 // recuperation des edges des faces.
1564 TopExp_Explorer FaceExpA(FaceA,TopAbs_EDGE);
1565 TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
1566
1567 TopoDS_Edge EdgeA=TopoDS::Edge(FaceExpA.Current() );
1568 TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
1569
1570 // On recupere les vertexes extremites des edge A et B.
1571 BRepAdaptor_Curve theCurveA(EdgeA);
1572 BRepAdaptor_Curve theCurveB(EdgeB);
1573 // On recupere 3 points A,B,C des curves.
1574 gp_Pnt A=theCurveA.Value(0.1);
1575 gp_Pnt B=theCurveA.Value(0.9);
1576 gp_Pnt C=theCurveB.Value(0.5);
1577
1578 // Construction du Geom_Plane
1579 GC_MakePlane MkPlane(A,B,C);
1580 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1581 // Fermeture du contexte local.
1582 TheAISContext()->CloseLocalContext(myCurrentIndex);
1583 // Construction de l'AIS_ParallelRelation
1584 Handle(AIS_ParallelRelation) myParaRelation= new AIS_ParallelRelation(FaceA ,FaceB ,theGeomPlane );
1585 TheAISContext()->Display(myParaRelation );
1586 GetMapOfAIS().Bind (myParaRelation ,argv[1]);
1587
1588
1589
1590 }
1591
1592
1593 return 0;
1594
1595}
1596
1597
1598
1599
1600//==============================================================================
1601//function : VPerpendicularRelation
1602//purpose : Display the Perpendicular Relation
1603//Draw arg : vperpendicular Name
1604//==============================================================================
1605#include <AIS_PerpendicularRelation.hxx>
1606#include <TCollection_ExtendedString.hxx>
1607#include <GC_MakePlane.hxx>
1608#include <BRepAdaptor_Curve.hxx>
1609#include <TopExp_Explorer.hxx>
1610
1611
1612
1613static int VPerpendicularBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1614{
1615 // Declarations
1616 Standard_Integer myCurrentIndex;
1617
1618 // Verification
1619 if (argc!=2) {di<<" vortho error"<<"\n";return 1;}
1620
1621 // Fermeture des contextes locaux
1622 TheAISContext()->CloseAllContexts();
1623
1624 // Ouverture d'un contexte local et recuperation de son index.
1625 TheAISContext()->OpenLocalContext();
1626 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
1627
1628 // On active les modes de selections Edges.
1629 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
1630 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
1631 di<<" Select an edge or a face "<<"\n";
1632
1633 // Boucle d'attente waitpick.
1634 Standard_Integer argcc = 5;
1635 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1636 const char **argvv = (const char **) buff;
1637 while (ViewerMainLoop( argcc, argvv) ) { }
1638 // fin de la boucle
1639
1640 TopoDS_Shape ShapeA;
1641 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1642 ShapeA = TheAISContext()->SelectedShape();
1643 }
1644
1645 // ShapeA est un edge.
1646 // ===================
1647 if (ShapeA.ShapeType()==TopAbs_EDGE ) {
1648
1649 // desactivation du mode face
1650 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4) );
1651 di<<" Select a second edge"<<"\n";
1652 // Boucle d'attente waitpick.
1653 Standard_Integer argccc = 5;
1654 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1655 const char **argvvv = (const char **) bufff;
1656 while (ViewerMainLoop( argccc, argvvv) ) { }
1657 // fin de la boucle
1658
1659 TopoDS_Shape ShapeB;
1660 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1661 ShapeB = TheAISContext()->SelectedShape();
1662 }
1663
1664 // recuperation des edges.
1665 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
1666 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
1667
1668 // On recupere les curves
1669 BRepAdaptor_Curve theCurveA(EdgeA);
1670 BRepAdaptor_Curve theCurveB(EdgeB);
1671 // on verifie si les edges sont orthogonaux.
1672 //gp_Lin theLineA=theCurveA.Line();
1673 //gp_Lin theLineB=theCurveB.Line();
c6541a0c 1674 //if (abs(theLineA.Angle(theLineB) ) != M_PI/2 ) {cout<<"vperpendicular error: Edges are not othogonals."<<endl;return 1;}
7fd59977 1675
1676 // On recupere 3 points A,B,C des curves.
1677 gp_Pnt A=theCurveA.Value(0.1);
1678 gp_Pnt B=theCurveA.Value(0.9);
1679 gp_Pnt C=theCurveB.Value(0.5);
1680 // Construction du Geom_Plane
1681 GC_MakePlane MkPlane(A,B,C);
1682 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1683 // Fermeture du contexte local.
1684 TheAISContext()->CloseLocalContext(myCurrentIndex);
1685 // Construction de l'AIS_ParallelRelation
1686 Handle(AIS_PerpendicularRelation) myOrthoRelation= new AIS_PerpendicularRelation (EdgeA ,EdgeB ,theGeomPlane );
1687 TheAISContext()->Display(myOrthoRelation );
1688 GetMapOfAIS().Bind (myOrthoRelation ,argv[1]);
1689
1690
1691 }
1692
1693 // Shape A est une face
1694 // ====================
1695 else {
1696
1697 // desactivation du mode edge
1698 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(2) );
1699 di<<" Select a second edge"<<"\n";
1700 // Boucle d'attente waitpick.
1701 Standard_Integer argccc = 5;
1702 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1703 const char **argvvv = (const char **) bufff;
1704 while (ViewerMainLoop( argccc, argvvv) ) { }
1705 // fin de la boucle
1706
1707 TopoDS_Shape ShapeB;
1708 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1709 ShapeB = TheAISContext()->SelectedShape();
1710 }
1711
1712 // pas de verification d'orthogonalite.
1713 TopoDS_Face FaceA=TopoDS::Face(ShapeA);
1714 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
1715
1716 // recuperation des edges des faces.
1717 TopExp_Explorer FaceExpA(FaceA,TopAbs_EDGE);
1718 TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
1719
1720 TopoDS_Edge EdgeA=TopoDS::Edge(FaceExpA.Current() );
1721 TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
1722
1723 // On recupere les vertexes extremites des edge A et B.
1724 BRepAdaptor_Curve theCurveA(EdgeA);
1725 BRepAdaptor_Curve theCurveB(EdgeB);
1726 // On recupere 3 points A,B,C des curves.
1727 gp_Pnt A=theCurveA.Value(0.1);
1728 gp_Pnt B=theCurveA.Value(0.9);
1729 gp_Pnt C=theCurveB.Value(0.5);
1730 // Construction du Geom_Plane
1731 GC_MakePlane MkPlane(A,B,C);
1732 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1733 // Fermeture du contexte local.
1734 TheAISContext()->CloseLocalContext(myCurrentIndex);
1735 // Construction de l'AIS_PerpendicularRelation
1736 Handle(AIS_PerpendicularRelation) myOrthoRelation= new AIS_PerpendicularRelation(FaceA ,FaceB );
1737 TheAISContext()->Display(myOrthoRelation );
1738 GetMapOfAIS().Bind (myOrthoRelation ,argv[1]);
1739
1740
1741
1742 }
1743
1744
1745 return 0;
1746
1747}
1748
1749
1750//==============================================================================
1751//function : VTangentRelation
1752//purpose : Display the tangent Relation
1753//Draw arg : vtangent Name
1754//==============================================================================
1755#include <AIS_TangentRelation.hxx>
1756
1757
1758static int VTangentBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1759{
1760 // Declarations
1761 Standard_Integer myCurrentIndex;
1762
1763 // Verification
1764 if (argc!=2) {di<<" vtangent error"<<"\n";return 1;}
1765
1766 // Fermeture des contextes locaux
1767 TheAISContext()->CloseAllContexts();
1768
1769 // Ouverture d'un contexte local et recuperation de son index.
1770 TheAISContext()->OpenLocalContext();
1771 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
1772
1773 // On active les modes de selections Edges.
1774 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
1775 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(4) );
1776 di<<" Select two coplanar edges(First the circular edge then the tangent edge) or two faces "<<"\n";
1777
1778 // Boucle d'attente waitpick.
1779 Standard_Integer argcc = 5;
1780 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1781 const char **argvv = (const char **) buff;
1782 while (ViewerMainLoop( argcc, argvv) ) { }
1783 // fin de la boucle
1784
1785 TopoDS_Shape ShapeA;
1786 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1787 ShapeA = TheAISContext()->SelectedShape();
1788 }
1789
1790 // ShapeA est un edge.
1791 // ===================
1792 if (ShapeA.ShapeType()==TopAbs_EDGE ) {
1793
1794 // desactivation du mode face
1795 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(4) );
1796 di<<" Select a second edge"<<"\n";
1797 // Boucle d'attente waitpick.
1798 Standard_Integer argccc = 5;
1799 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1800 const char **argvvv = (const char **) bufff;
1801 while (ViewerMainLoop( argccc, argvvv) ) { }
1802 // fin de la boucle
1803
1804 TopoDS_Shape ShapeB;
1805 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1806 ShapeB = TheAISContext()->SelectedShape();
1807 }
1808
1809 // recuperation des edges.
1810 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
1811 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
1812
1813 // On recupere les curves
1814 BRepAdaptor_Curve theCurveA(EdgeA);
1815 BRepAdaptor_Curve theCurveB(EdgeB);
1816
1817 // On recupere 3 points A,B,C des curves.
1818 gp_Pnt A=theCurveA.Value(0.1);
1819 gp_Pnt B=theCurveA.Value(0.9);
1820 gp_Pnt C=theCurveB.Value(0.5);
1821
1822 // Construction du Geom_Plane
1823 GC_MakePlane MkPlane(A,B,C);
1824 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1825 // Fermeture du contexte local.
1826 TheAISContext()->CloseLocalContext(myCurrentIndex);
1827 // Construction de l'AIS_TangentRelation
1828 Handle(AIS_TangentRelation) myTanRelation= new AIS_TangentRelation (EdgeA ,EdgeB ,theGeomPlane );
1829 TheAISContext()->Display(myTanRelation );
1830 GetMapOfAIS().Bind (myTanRelation ,argv[1]);
1831
1832
1833 }
1834
1835 // Shape A est une face
1836 // ====================
1837 else {
1838
1839 // desactivation du mode edge
1840 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(2) );
1841 di<<" Select a second edge"<<"\n";
1842 // Boucle d'attente waitpick.
1843 Standard_Integer argccc = 5;
1844 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1845 const char **argvvv = (const char **) bufff;
1846 while (ViewerMainLoop( argccc, argvvv) ) { }
1847 // fin de la boucle
1848
1849 TopoDS_Shape ShapeB;
1850 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1851 ShapeB = TheAISContext()->SelectedShape();
1852 }
1853
1854 TopoDS_Face FaceA=TopoDS::Face(ShapeA);
1855 TopoDS_Face FaceB=TopoDS::Face(ShapeB);
1856
1857 // recuperation des edges des faces.
1858 TopExp_Explorer FaceExpA(FaceA,TopAbs_EDGE);
1859 TopExp_Explorer FaceExpB(FaceB,TopAbs_EDGE);
1860
1861 TopoDS_Edge EdgeA=TopoDS::Edge(FaceExpA.Current() );
1862 TopoDS_Edge EdgeB=TopoDS::Edge(FaceExpB.Current() );
1863
1864 // On recupere les vertexes extremites des edge A et B.
1865 BRepAdaptor_Curve theCurveA(EdgeA);
1866 BRepAdaptor_Curve theCurveB(EdgeB);
1867 // On recupere 3 points A,B,C des curves.
1868 gp_Pnt A=theCurveA.Value(0.1);
1869 gp_Pnt B=theCurveA.Value(0.9);
1870 gp_Pnt C=theCurveB.Value(0.5);
1871
1872 // Construction du Geom_Plane
1873 GC_MakePlane MkPlane(A,B,C);
1874 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1875 // Fermeture du contexte local.
1876 TheAISContext()->CloseLocalContext(myCurrentIndex);
1877 // Construction de l'AIS_PerpendicularRelation
1878 Handle(AIS_TangentRelation) myTanRelation= new AIS_TangentRelation(FaceA ,FaceB,theGeomPlane );
1879 TheAISContext()->Display(myTanRelation );
1880 GetMapOfAIS().Bind (myTanRelation ,argv[1]);
1881
1882
1883
1884 }
1885
1886
1887 return 0;
1888
1889}
1890
1891//==============================================================================
1892//function : VSymetricalRelation
1893//purpose : Display the Symetrical Relation
1894//Draw arg : vsymetric Name
1895//==============================================================================
1896#include <AIS_SymmetricRelation.hxx>
1897
1898
1899static int VSymmetricBuilder(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1900{
1901 // Declarations
1902 Standard_Integer myCurrentIndex;
1903
1904 // Verification
1905 if (argc!=2) {di<<" vSymmetric error"<<"\n";return 1;}
1906
1907 // Fermeture des contextes locaux
1908 TheAISContext()->CloseAllContexts();
1909
1910 // Ouverture d'un contexte local et recuperation de son index.
1911 TheAISContext()->OpenLocalContext();
1912 myCurrentIndex=TheAISContext()->IndexOfCurrentLocal();
1913
1914 // On active les modes de selections
1915 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
1916 di<<" Select an edge:the axis of symetry "<<"\n";
1917
1918 // Boucle d'attente waitpick.
1919 Standard_Integer argcc = 5;
1920 const char *buff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1921 const char **argvv = (const char **) buff;
1922 while (ViewerMainLoop( argcc, argvv) ) { }
1923 // fin de la boucle
1924
1925 TopoDS_Shape ShapeA;
1926 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1927 ShapeA = TheAISContext()->SelectedShape();
1928 }
1929 // recuperation des edges.
1930 TopoDS_Edge EdgeA=TopoDS::Edge(ShapeA);
1931
1932 // On active les modes de selections
1933 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(2) );
1934 TheAISContext()->ActivateStandardMode (AIS_Shape::SelectionType(1) );
1935 di<<" Select two edges or two vertices. "<<"\n";
1936
1937 // Boucle d'attente waitpick.
1938 Standard_Integer argcc2 = 5;
1939// const char *buff2[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1940 const char **argvv2 = (const char **) buff;
1941 while (ViewerMainLoop( argcc2, argvv2) ) { }
1942 // fin de la boucle
1943
1944 TopoDS_Shape ShapeB;
1945 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1946 ShapeB = TheAISContext()->SelectedShape();
1947 }
1948
1949
1950
1951
1952
1953 // ShapeB est un edge.
1954 // ===================
1955 if (ShapeB.ShapeType()==TopAbs_EDGE ) {
1956
1957 // desactivation du mode vertex
1958 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(1) );
1959 di<<" Select a second edge"<<"\n";
1960 // Boucle d'attente waitpick.
1961 Standard_Integer argccc = 5;
1962 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
1963 const char **argvvv = (const char **) bufff;
1964 while (ViewerMainLoop( argccc, argvvv) ) { }
1965 // fin de la boucle
1966
1967 TopoDS_Shape ShapeC;
1968 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
1969 ShapeC = TheAISContext()->SelectedShape();
1970 }
1971
1972 // recuperation des edges.
1973 TopoDS_Edge EdgeB=TopoDS::Edge(ShapeB);
1974 TopoDS_Edge EdgeC=TopoDS::Edge(ShapeC);
1975 // on verifie que les edges sont paralleles
1976 BRepExtrema_ExtCC myDeltaEdgeAB (EdgeA ,EdgeB );
1977 BRepExtrema_ExtCC myDeltaEdgeAC (EdgeA ,EdgeC );
1978 // on verifie qu'ils sont paralleles.
1979 if (!myDeltaEdgeAB.IsParallel() ) {di<<"vsymetric error: non parallel edges."<<"\n";return 1; }
1980 if (!myDeltaEdgeAC.IsParallel() ) {di<<"vsymetric error: non parallel edges."<<"\n";return 1; }
1981 // on recupere les vertexs
1982 TopoDS_Vertex Va,Vb,Vc,Vd;
1983 TopExp::Vertices(EdgeB,Va,Vb );
1984 TopExp::Vertices(EdgeC,Vc,Vd );
1985 gp_Pnt A=BRep_Tool::Pnt(Va);
1986 gp_Pnt B=BRep_Tool::Pnt(Vc);
1987 gp_Pnt C = Get3DPointAtMousePosition();
1988
1989 // gp_Pnt C=BRep_Tool::Pnt(Vc);
1990 // Construction du Geom_Plane
1991 GC_MakePlane MkPlane(A,B,C);
1992 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
1993 // Fermeture du contexte local.
1994 TheAISContext()->CloseLocalContext(myCurrentIndex);
1995 // Construction de l'AIS_SymmetricRelation
1996 Handle(AIS_SymmetricRelation) mySymRelation= new AIS_SymmetricRelation (EdgeA ,EdgeB ,EdgeC, theGeomPlane );
1997 TheAISContext()->Display(mySymRelation );
1998 GetMapOfAIS().Bind (mySymRelation ,argv[1]);
1999
2000
2001 }
2002
2003 // Shape B est un vertex
2004 // =====================
2005 else {
2006
2007 // desactivation du mode edge
2008 TheAISContext()->DeactivateStandardMode (AIS_Shape::SelectionType(2) );
2009 di<<" Select a second edge"<<"\n";
2010 // Boucle d'attente waitpick.
2011 Standard_Integer argccc = 5;
2012 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
2013 const char **argvvv = (const char **) bufff;
2014 while (ViewerMainLoop( argccc, argvvv) ) { }
2015 // fin de la boucle
2016
2017 TopoDS_Shape ShapeC;
2018 for(TheAISContext()->InitSelected() ;TheAISContext()->MoreSelected() ;TheAISContext()->NextSelected() ) {
2019 ShapeC = TheAISContext()->SelectedShape();
2020 }
2021
2022 // recuperation des Vertex
2023 TopoDS_Vertex VertexB=TopoDS::Vertex(ShapeB);
2024 TopoDS_Vertex VertexC=TopoDS::Vertex(ShapeC);
2025 // transfo en gp_Pnt
2026 gp_Pnt B=BRep_Tool::Pnt(VertexB);
2027 gp_Pnt C=BRep_Tool::Pnt(VertexC);
2028
2029 // on recupere les vertexes de l'axe de sym
2030 TopoDS_Vertex Va,Vb;
2031 TopExp::Vertices(EdgeA,Va,Vb );
2032 gp_Pnt A=BRep_Tool::Pnt(Va);
2033 // Construction du Geom_Plane
2034 GC_MakePlane MkPlane(A,B,C);
2035 Handle(Geom_Plane) theGeomPlane=MkPlane.Value();
2036 // Fermeture du contexte local.
2037 TheAISContext()->CloseLocalContext(myCurrentIndex);
2038 // Construction de l'AIS_SymmetricRelation
2039 Handle(AIS_SymmetricRelation) mySymRelation= new AIS_SymmetricRelation (EdgeA ,VertexB ,VertexC, theGeomPlane );
2040 TheAISContext()->Display(mySymRelation );
2041 GetMapOfAIS().Bind (mySymRelation ,argv[1]);
2042
2043
2044
2045 }
2046
2047
2048 return 0;
2049
2050}
2051//=======================================================================
2052//function : VMoveDim
2053//purpose :
2054//=======================================================================
2055static int VMoveDim(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
2056{
2057 if(argc>2) return 1;
2058
2059 const Handle(V3d_View) aview = ViewerTest::CurrentView();
2060 Handle(AIS_InteractiveObject) pickedobj;
2061 if(argc==1){
2062 pickedobj = TheAISContext()->FirstCurrentObject();
2063 if(pickedobj.IsNull() || pickedobj->Type()!=AIS_KOI_Relation)
2064 pickedobj = ViewerTest::PickObject(AIS_KOI_Relation);
2065 }
2066 else{
2067 // reperage dans le viewer...
2068 if(!strcasecmp(argv[1],".")){
2069 pickedobj = ViewerTest::PickObject(AIS_KOI_Relation);
2070
2071 }
2072 else if(GetMapOfAIS().IsBound2(argv[1]))
2073 pickedobj = Handle(AIS_InteractiveObject)::DownCast
2074 (GetMapOfAIS().Find2(argv[1]));
2075 }
2076
2077 if(pickedobj.IsNull()){
2078 di<<"Bad Type Object"<<"\n";
2079 return 1 ;}
2080
2081 if(pickedobj->Type() != AIS_KOI_Relation)
2082 return 1;
2083 Standard_Integer argccc = 5;
2084
2085 const char *bufff[] = { "VPick", "X", "VPickY","VPickZ", "VPickShape" };
2086 const char **argvvv = (const char **) bufff;
2087
2088 Handle(AIS_Relation) R = *((Handle(AIS_Relation)*)&pickedobj);
2089 Handle(Geom_Plane) ThePl;
2090// Standard_Real x,y,z,xv,yv,zv;
2091 Standard_Real x,y,xv,yv,zv;
2092 static Standard_Real last_xv(0),last_yv(0),last_zv(0);
2093 Standard_Integer xpix,ypix;
2094// Standard_Boolean SameAsLast(Standard_False);
2095 Select3D_Projector prj(aview);
2096
2097
2098 while (ViewerMainLoop( argccc, argvvv) ) {
2099 //....... la ligne de tir
2100 ViewerTest::GetMousePosition(xpix,ypix);
2101 aview->Convert(xpix,ypix,x,y); // espace reel 2D de la vue...
2102 gp_Lin L = prj.Shoot(x,y);
2103
2104
2105
2106 // ....... le plan de la vue...
2107 aview->Proj(xv,yv,zv);
2108 static Standard_Boolean haschanged(Standard_False);
2109 if(Abs(last_xv-xv)>Precision::Confusion() ||
2110 Abs(last_yv-yv)>Precision::Confusion() ||
2111 Abs(last_zv-zv)>Precision::Confusion() ){
2112 last_xv = xv;
2113 last_yv = yv;
2114 last_zv = zv;
2115 Standard_Real xat,yat,zat;
2116 aview->At(xat,yat,zat);
2117 ThePl = new Geom_Plane(gp_Pnt(xat,yat,zat),gp_Dir(xv,yv,zv));
2118 haschanged = Standard_True;
2119 di <<"changement de plan"<<"\n";
2120 }
2121
2122 //
2123// Standard_Integer xpix,ypix;
2124// Standard_Real x,y;
2125 gp_Pnt GoodPoint;
2126 if(haschanged){
2127 gp_Pln NewPlane;;
2128 ComputeNewPlaneForDim(R,NewPlane,GoodPoint);
2129 haschanged = Standard_False;
2130 }
2131 else{
2132 if(ComputeIntersection(L,ThePl->Pln(),GoodPoint)){
2133 R->SetPosition(GoodPoint);
2134 }
2135 TheAISContext()->Redisplay(R);
2136 }
2137 }
2138
2139 return 0;
2140}
2141//=======================================================================
2142//function : RelationsCommands
2143//purpose :
2144//=======================================================================
2145
2146
2147void ViewerTest::RelationCommands(Draw_Interpretor& theCommands)
2148{
2149 const char *group = "AISRelations";
2150
2151
2152 theCommands.Add("vangledim",
2153 "vangledim Name:Selection in the viewer only ",
2154 __FILE__,VAngleDimBuilder,group);
2155
2156 theCommands.Add("vdiameterdim",
2157 "vdiameterdim Name : Selection in the viewer only ",
2158 __FILE__,VDiameterDimBuilder,group);
2159
2160 theCommands.Add("vconcentric",
2161 "vconcentric Name : Selection in the viewer only ",
2162 __FILE__,VConcentricBuilder,group);
2163
2164 theCommands.Add("vequaldist",
2165 "vequaldist Name Selection in the viewer only ",
2166 __FILE__,VEqualDistRelation ,group);
2167
2168 theCommands.Add("vequalrad",
2169 "vequalrad Name Selection in the viewer only ",
2170 __FILE__,VEqualRadiusRelation ,group);
2171
2172 theCommands.Add("vfix",
2173 "vfix Name Selection in the viewer only ",
2174 __FILE__,VFixRelation ,group);
2175
2176 theCommands.Add("videntity",
2177 "videntity Name Selection in the viewer only ",
2178 __FILE__,VIdenticRelation ,group);
2179
2180 theCommands.Add("vdistdim",
2181 "vdistdim Name Selection in the viewer only ",
2182 __FILE__,VLenghtDimension ,group);
2183
2184 theCommands.Add("vradiusdim",
2185 "vradiusdim Name Selection in the viewer only ",
2186 __FILE__,VRadiusDimBuilder ,group);
2187
2188 theCommands.Add("voffsetdim",
2189 "voffsetdim Name Selection in the viewer only ",
2190 __FILE__,VOffsetDimBuilder ,group);
2191
2192 theCommands.Add("vparallel",
2193 "vparallel Name Selection in the viewer only ",
2194 __FILE__,VParallelBuilder ,group);
2195
2196 theCommands.Add("vortho",
2197 "vortho Name Selection in the viewer only ",
2198 __FILE__,VPerpendicularBuilder ,group);
2199
2200 theCommands.Add("vtangent",
2201 "vtangent Name Selection in the viewer only ",
2202 __FILE__,VTangentBuilder ,group);
2203
2204
2205 theCommands.Add("vsymetric",
2206 "vsymetric Name Selection in the viewer only ",
2207 __FILE__,VSymmetricBuilder ,group);
2208
2209 theCommands.Add("vmovedim",
2210 "vmovedim [name] : move Mouse in the viewer; click MB1 to stop motion...",
2211 __FILE__,VMoveDim,group);
2212
2213}