1 // Created on: 1997-04-15
2 // Created by: Joelle CHAUVET
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #include <GeomliteTest.hxx>
18 #include <DrawTrSurf.hxx>
20 #include <Draw_Interpretor.hxx>
21 #include <Draw_Appli.hxx>
22 #include <Draw_Display.hxx>
24 #include <Precision.hxx>
25 #include <GeomLib.hxx>
29 //#define strcasecmp strcmp Already defined
33 //=======================================================================
34 //function : extendcurve
36 //=======================================================================
38 static Standard_Integer extendcurve (Draw_Interpretor& di, Standard_Integer n, const char** a)
42 Handle(Geom_BoundedCurve) GB =
43 Handle(Geom_BoundedCurve)::DownCast(DrawTrSurf::GetCurve(a[1]));
45 di << "extendcurve needs a Bounded curve";
50 if ( !DrawTrSurf::GetPoint(a[2],P)) return 1;
51 Standard_Boolean apres = Standard_True;
53 if (strcmp(a[4], "B") == 0) {
54 apres = Standard_False ;
57 Standard_Integer cont=Draw::Atoi(a[3]);
58 GeomLib::ExtendCurveToPoint(GB,P,cont,apres);
59 DrawTrSurf::Set(a[1],GB);
63 //=======================================================================
64 //function : extendsurf
66 //=======================================================================
68 static Standard_Integer extendsurf (Draw_Interpretor& di, Standard_Integer n, const char** a)
72 Handle(Geom_BoundedSurface) GB =
73 Handle(Geom_BoundedSurface)::DownCast(DrawTrSurf::GetSurface(a[1]));
75 di << "extendsurf needs a Bounded surface";
78 Standard_Real chord=Draw::Atof(a[2]);
79 Standard_Integer cont=Draw::Atoi(a[3]);
80 Standard_Boolean enU = Standard_True, apres = Standard_True;
82 if (strcmp(a[4], "V") == 0) {
83 enU = Standard_False ;
85 if (strcmp(a[4], "B") == 0) {
86 apres = Standard_False ;
90 if (strcmp(a[5], "B") == 0) {
91 apres = Standard_False ;
96 GeomLib::ExtendSurfByLength(GB,chord,cont,enU,apres);
97 DrawTrSurf::Set(a[1],GB);
103 //=======================================================================
104 //function : samerange
106 //=======================================================================
108 static Standard_Integer samerange (Draw_Interpretor& /*di*/, Standard_Integer n, const char** a)
111 Handle(Geom2d_Curve) C = DrawTrSurf::GetCurve2d(a[2]);
112 Handle(Geom2d_Curve) Res;
113 Standard_Real f, l, rf, rl;
114 f = Draw::Atof(a[3]);
115 l = Draw::Atof(a[4]);
116 rf = Draw::Atof(a[5]);
117 rl = Draw::Atof(a[6]);
119 GeomLib::SameRange(Precision::PConfusion(), C,
122 DrawTrSurf::Set(a[1],Res);
128 //=======================================================================
129 //function : ModificationCommands
131 //=======================================================================
134 void GeomliteTest::ModificationCommands(Draw_Interpretor& theCommands)
136 static Standard_Boolean loaded = Standard_False;
138 loaded = Standard_True;
140 DrawTrSurf::BasicCommands(theCommands);
144 g = "GEOMETRY Curves and Surfaces modification";
147 theCommands.Add("extendcurve",
148 "extendcurve name point cont [A(fter)/B(efore)]",
153 theCommands.Add("extendsurf",
154 "extendsurf name length cont [U/V] [A(fter)/B(efore)]",
159 theCommands.Add("chgrange",
160 "chgrange newname curve2d first last RequestedFirst RequestedLast ]",