1 // File: GeomliteTest_ModificationCommands.cxx
2 // Created: Thu Apr 15 12:00 1997
3 // Author: Joelle CHAUVET
6 #include <GeomliteTest.hxx>
7 #include <DrawTrSurf.hxx>
9 #include <Draw_Interpretor.hxx>
10 #include <Draw_Appli.hxx>
11 #include <Draw_Display.hxx>
13 #include <Precision.hxx>
14 #include <GeomLib.hxx>
18 //#define strcasecmp strcmp Already defined
22 //=======================================================================
23 //function : extendcurve
25 //=======================================================================
27 static Standard_Integer extendcurve (Draw_Interpretor& di, Standard_Integer n, const char** a)
31 Handle(Geom_BoundedCurve) GB =
32 Handle(Geom_BoundedCurve)::DownCast(DrawTrSurf::GetCurve(a[1]));
34 di << "extendcurve needs a Bounded curve";
39 if ( !DrawTrSurf::GetPoint(a[2],P)) return 1;
40 Standard_Boolean apres = Standard_True;
42 if (strcmp(a[4], "B") == 0) {
43 apres = Standard_False ;
46 Standard_Integer cont=atoi(a[3]);
47 GeomLib::ExtendCurveToPoint(GB,P,cont,apres);
48 DrawTrSurf::Set(a[1],GB);
52 //=======================================================================
53 //function : extendsurf
55 //=======================================================================
57 static Standard_Integer extendsurf (Draw_Interpretor& di, Standard_Integer n, const char** a)
61 Handle(Geom_BoundedSurface) GB =
62 Handle(Geom_BoundedSurface)::DownCast(DrawTrSurf::GetSurface(a[1]));
64 di << "extendsurf needs a Bounded surface";
67 Standard_Real chord=atof(a[2]);
68 Standard_Integer cont=atoi(a[3]);
69 Standard_Boolean enU = Standard_True, apres = Standard_True;
71 if (strcmp(a[4], "V") == 0) {
72 enU = Standard_False ;
74 if (strcmp(a[4], "B") == 0) {
75 apres = Standard_False ;
79 if (strcmp(a[5], "B") == 0) {
80 apres = Standard_False ;
85 GeomLib::ExtendSurfByLength(GB,chord,cont,enU,apres);
86 DrawTrSurf::Set(a[1],GB);
92 //=======================================================================
93 //function : samerange
95 //=======================================================================
97 static Standard_Integer samerange (Draw_Interpretor& di, Standard_Integer n, const char** a)
100 Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[2]);
101 Handle(Geom2d_Curve) Res;
102 Standard_Real f, l, rf, rl;
108 GeomLib::SameRange(Precision::PConfusion(), C,
111 DrawTrSurf::Set(a[1],Res);
117 //=======================================================================
118 //function : ModificationCommands
120 //=======================================================================
123 void GeomliteTest::ModificationCommands(Draw_Interpretor& theCommands)
125 static Standard_Boolean loaded = Standard_False;
127 loaded = Standard_True;
129 DrawTrSurf::BasicCommands(theCommands);
133 g = "GEOMETRY Curves and Surfaces modification";
136 theCommands.Add("extendcurve",
137 "extendcurve name point cont [A(fter)/B(efore)]",
142 theCommands.Add("extendsurf",
143 "extendsurf name length cont [U/V] [A(fter)/B(efore)]",
148 theCommands.Add("chgrange",
149 "chgrange newname curve2d first last RequestedFirst RequestedLast ]",