Commit | Line | Data |
---|---|---|
b311480e | 1 | // Copyright (c) 1998-1999 Matra Datavision |
2 | // Copyright (c) 1999-2012 OPEN CASCADE SAS | |
3 | // | |
4 | // The content of this file is subject to the Open CASCADE Technology Public | |
5 | // License Version 6.5 (the "License"). You may not use the content of this file | |
6 | // except in compliance with the License. Please obtain a copy of the License | |
7 | // at http://www.opencascade.org and read it completely before using this file. | |
8 | // | |
9 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its | |
10 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. | |
11 | // | |
12 | // The Original Code and all software distributed under the License is | |
13 | // distributed on an "AS IS" basis, without warranty of any kind, and the | |
14 | // Initial Developer hereby disclaims all such warranties, including without | |
15 | // limitation, any warranties of merchantability, fitness for a particular | |
16 | // purpose or non-infringement. Please see the License for the specific terms | |
17 | // and conditions governing the rights and limitations under the License. | |
18 | ||
7fd59977 | 19 | |
20 | ||
0d969553 | 21 | // model of main program Draw |
7fd59977 | 22 | |
23 | #include <Draw.hxx> | |
24 | #include <Draw_Appli.hxx> | |
25 | ||
0d969553 | 26 | // main passes main to Draw |
7fd59977 | 27 | |
28 | main(int argc, char** argv) | |
29 | { | |
30 | Draw_Appli(argc,argv); | |
31 | } | |
32 | ||
33 | //******************************* | |
34 | // | |
0d969553 Y |
35 | // Remove unused includes |
36 | // to avoid overloading the link | |
7fd59977 | 37 | // |
38 | //******************************** | |
39 | ||
40 | #include <GeometryTest.hxx> | |
41 | ||
0d969553 | 42 | // only is one makes the topology |
7fd59977 | 43 | #include <BRepTest.hxx> |
44 | ||
0d969553 | 45 | // for the commands using topology |
7fd59977 | 46 | #include <DBRep.hxx> |
47 | ||
48 | ||
0d969553 | 49 | // example of user command |
7fd59977 | 50 | |
51 | static Standard_Integer macommande (Draw_Interpretor& di, | |
52 | Standard_Integer n, char** a) | |
53 | { | |
0d969553 | 54 | if (n < 2) return 1; // error if not enough arguments |
7fd59977 | 55 | |
56 | TopoDS_Shape S = DBRep::Get(a[1]); | |
57 | if (S.IsNull()) { | |
0d969553 | 58 | cout << a[1] << " is not a shape" << endl; |
7fd59977 | 59 | return 1; |
60 | } | |
61 | ||
0d969553 | 62 | // .... do what you like with S ..... |
7fd59977 | 63 | |
0d969553 | 64 | //... to return a chain to TCL, place it in di |
7fd59977 | 65 | |
66 | di << a[1]; | |
67 | ||
68 | return 0; | |
69 | } | |
70 | ||
71 | ||
0d969553 | 72 | // definition of commands |
7fd59977 | 73 | |
74 | void Draw_InitAppli(Draw_Interpretor& theCommands) | |
75 | { | |
76 | Draw::Commands(theCommands); | |
77 | ||
78 | // geometry | |
0d969553 | 79 | GeometryTest::AllCommands(theCommands); // see GeometryTest.cdl for details |
7fd59977 | 80 | |
0d969553 Y |
81 | // for the topology |
82 | BRepTest::AllCommands(theCommands); // see BRepTest.cdl for details | |
7fd59977 | 83 | |
84 | ||
0d969553 | 85 | // user commands |
7fd59977 | 86 | |
0d969553 | 87 | theCommands.Add("macommande","macommande and its help",macommande); |
7fd59977 | 88 | } |