4e57c75e |
1 | // Created by: Peter KURNEV |
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 | |
19 | |
20 | #include <BOPTest.ixx> |
21 | #include <stdio.h> |
22 | |
23 | #include <Draw_Interpretor.hxx> |
24 | #include <DBRep.hxx> |
25 | // |
26 | #include <TopoDS_Iterator.hxx> |
27 | #include <TopoDS_Shape.hxx> |
28 | // |
29 | #include <TopTools_ListOfShape.hxx> |
30 | // |
31 | #include <BOPTest_Objects.hxx> |
32 | |
33 | static Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer , const char** ); |
34 | static Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer , const char** ); |
35 | static Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer , const char** ); |
36 | static Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer , const char** ); |
37 | static Standard_Integer baddcompound(Draw_Interpretor& , Standard_Integer , const char** ); |
38 | // |
39 | //======================================================================= |
40 | //function :ObjCommands |
41 | //purpose : |
42 | //======================================================================= |
43 | void BOPTest::ObjCommands(Draw_Interpretor& theCommands) |
44 | { |
45 | static Standard_Boolean done = Standard_False; |
46 | if (done) return; |
47 | done = Standard_True; |
48 | // Chapter's name |
49 | const char* g = "BOP commands"; |
50 | // Commands |
51 | theCommands.Add("baddobjects" , "baddobjects s1 s2 ..." , __FILE__, baddobjects, g); |
52 | theCommands.Add("bclearobjects" , "bclearobjects" , __FILE__, bclearobjects, g); |
53 | theCommands.Add("baddtools" , "baddtools s1 s2 ..." , __FILE__, baddtools, g); |
54 | theCommands.Add("bcleartools" , "bcleartools" , __FILE__, bcleartools, g); |
55 | theCommands.Add("baddcompound" , "baddcompound c" , __FILE__, baddcompound, g); |
56 | } |
57 | //======================================================================= |
58 | //function : baddcompound |
59 | //purpose : |
60 | //======================================================================= |
61 | Standard_Integer baddcompound (Draw_Interpretor& , Standard_Integer n, const char** a) |
62 | { |
63 | if (n<2) { |
64 | printf(" Use baddcompound c\n"); |
65 | return 0; |
66 | } |
67 | // |
68 | TopoDS_Iterator aIt; |
69 | TopoDS_Shape aS; |
70 | // |
71 | aS=DBRep::Get(a[1]); |
72 | // |
73 | BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes(); |
74 | aIt.Initialize(aS); |
75 | for (; aIt.More(); aIt.Next()) { |
76 | const TopoDS_Shape& aSx=aIt.Value(); |
77 | aLS.Append(aSx); |
78 | } |
79 | // |
80 | return 0; |
81 | } |
82 | // |
83 | //======================================================================= |
84 | //function :baddobjects |
85 | //purpose : |
86 | //======================================================================= |
87 | Standard_Integer baddobjects (Draw_Interpretor& , Standard_Integer n, const char** a) |
88 | { |
89 | if (n<2) { |
90 | printf(" Use baddobjects s1 s2 ...\n"); |
91 | return 0; |
92 | } |
93 | // |
94 | Standard_Integer i; |
95 | TopoDS_Shape aS; |
96 | // |
97 | BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes(); |
98 | for (i = 1; i < n; ++i) { |
99 | aS=DBRep::Get(a[i]); |
100 | aLS.Append(aS); |
101 | } |
102 | // |
103 | return 0; |
104 | } |
105 | //======================================================================= |
106 | //function : bclearobjects |
107 | //purpose : |
108 | //======================================================================= |
109 | Standard_Integer bclearobjects (Draw_Interpretor& , Standard_Integer n, const char** ) |
110 | { |
111 | if (n!=1) { |
112 | printf(" Use bclearobjects\n"); |
113 | return 0; |
114 | } |
115 | BOPCol_ListOfShape& aLS=BOPTest_Objects::Shapes(); |
116 | aLS.Clear(); |
117 | // |
118 | return 0; |
119 | } |
120 | //======================================================================= |
121 | //function : baddtools |
122 | //purpose : |
123 | //======================================================================= |
124 | Standard_Integer baddtools (Draw_Interpretor& , Standard_Integer n, const char** a) |
125 | { |
126 | if (n<2) { |
127 | printf(" Use baddtools s1 s2 ...\n"); |
128 | return 0; |
129 | } |
130 | // |
131 | Standard_Integer i; |
132 | TopoDS_Shape aS; |
133 | // |
134 | BOPCol_ListOfShape& aLS=BOPTest_Objects::Tools(); |
135 | for (i = 1; i < n; ++i) { |
136 | aS=DBRep::Get(a[i]); |
137 | aLS.Append(aS); |
138 | } |
139 | // |
140 | return 0; |
141 | } |
142 | //======================================================================= |
143 | //function : bcleartools |
144 | //purpose : |
145 | //======================================================================= |
146 | Standard_Integer bcleartools (Draw_Interpretor& , Standard_Integer n, const char** ) |
147 | { |
148 | if (n!=1) { |
149 | printf(" Use bcleartools\n"); |
150 | return 0; |
151 | } |
152 | BOPCol_ListOfShape& aLS=BOPTest_Objects::Tools(); |
153 | aLS.Clear(); |
154 | // |
155 | return 0; |
156 | } |