0031682: Visualization - Prs3d_ShadingAspect::SetTransparency() has no effect with...
[occt.git] / src / SWDRAW / SWDRAW_ShapeUpgrade.cxx
CommitLineData
b311480e 1// Created on: 1999-03-09
2// Created by: data exchange team
3// Copyright (c) 1999-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 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
973c2be1 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.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
b311480e 16
7fd59977 17//gka,rln 30.04.99 S4137: new commands for testing ShapeDivide added, some removed
18//abv,pdn 05.05.99 S4174: new commands for testing ShapeDivide added, some removed
19//pdn,gka 10.06.99 S4189: command DT_ShapeConvertRev added
20
42cf5bc1 21#include <BRep_Tool.hxx>
20aa0d3f 22#include <BRep_Builder.hxx>
42cf5bc1 23#include <BRepBuilderAPI.hxx>
24#include <BRepBuilderAPI_Transform.hxx>
4f7d41ea 25#include <BRepTest_Objects.hxx>
42cf5bc1 26#include <BRepTools.hxx>
3e6a4cd0 27#include <BRepTools_ReShape.hxx>
7fd59977 28#include <DBRep.hxx>
42cf5bc1 29#include <Draw.hxx>
7fd59977 30#include <Draw_Interpretor.hxx>
31#include <DrawTrSurf.hxx>
42cf5bc1 32#include <Geom2d_Curve.hxx>
33#include <Geom2d_OffsetCurve.hxx>
7fd59977 34#include <Geom_Curve.hxx>
42cf5bc1 35#include <Geom_OffsetCurve.hxx>
7fd59977 36#include <Geom_Plane.hxx>
42cf5bc1 37#include <Geom_RectangularTrimmedSurface.hxx>
7fd59977 38#include <Geom_Surface.hxx>
42cf5bc1 39#include <Precision.hxx>
40#include <ShapeBuild_ReShape.hxx>
41#include <ShapeCustom.hxx>
42#include <ShapeExtend_CompositeSurface.hxx>
43#include <ShapeFix.hxx>
44#include <ShapeFix_ComposeShell.hxx>
45#include <ShapeUpgrade.hxx>
46#include <ShapeUpgrade_RemoveInternalWires.hxx>
47#include <ShapeUpgrade_RemoveLocations.hxx>
48#include <ShapeUpgrade_ShapeConvertToBezier.hxx>
49#include <ShapeUpgrade_ShapeDivideAngle.hxx>
50#include <ShapeUpgrade_ShapeDivideArea.hxx>
51#include <ShapeUpgrade_ShapeDivideClosed.hxx>
52#include <ShapeUpgrade_ShapeDivideContinuity.hxx>
53#include <ShapeUpgrade_SplitCurve2dContinuity.hxx>
54#include <ShapeUpgrade_SplitCurve3dContinuity.hxx>
55#include <ShapeUpgrade_SplitSurfaceContinuity.hxx>
56#include <ShapeUpgrade_UnifySameDomain.hxx>
57#include <SWDRAW.hxx>
58#include <SWDRAW_ShapeUpgrade.hxx>
59#include <TColGeom2d_HArray1OfCurve.hxx>
7fd59977 60#include <TColGeom_HArray1OfCurve.hxx>
61#include <TColGeom_HArray2OfSurface.hxx>
62#include <TColStd_Array1OfReal.hxx>
63#include <TColStd_HArray1OfReal.hxx>
64#include <TColStd_HSequenceOfReal.hxx>
42cf5bc1 65#include <TopExp_Explorer.hxx>
7fd59977 66#include <TopoDS.hxx>
42cf5bc1 67#include <TopoDS_Compound.hxx>
7fd59977 68#include <TopoDS_Edge.hxx>
69#include <TopoDS_Face.hxx>
42cf5bc1 70#include <TopoDS_Iterator.hxx>
7fd59977 71#include <TopoDS_Shape.hxx>
72#include <TopoDS_Shell.hxx>
73#include <TopoDS_Wire.hxx>
7fd59977 74
fe1a6e4e 75#include <stdio.h>
42cf5bc1 76//#include <SWDRAW_ShapeUpgrade.hxx>
77//#include <ShapeUpgrade_SupportModification.hxx>
7fd59977 78//#include <ShapeExtend_WireData.hxx>
79//#include <ShapeAnalysis_Shell.hxx>
80//#include <ShapeAnalysis_WireOrder.hxx>
81//#include <ShapeAnalysis_Wire.hxx>
82//#include <ShapeUpgrade_ShellSewing.hxx>
7fd59977 83// the plane (equation z=0) shared by PlaneDividedFaceContinuity and PlaneGridShell
84//static Handle(Geom_Plane) ThePlane= new Geom_Plane(0,0,1,0);
7fd59977 85//=======================================================================
86//function : DT_ShapeDivide
87//purpose :
88//=======================================================================
7fd59977 89static Standard_Integer DT_ShapeDivide (Draw_Interpretor& di,
90 Standard_Integer n, const char** a)
91{
92 // DT_ShapeDivide result Shape Tol
93 // a[1]= result
94 // a[2]= input Face/Surface
95 // a[3] si n>3= Wire/Face
96 // a[n-1]= Tolerance
97
98 if (n<3) {
586db386 99 di << "bad number of arguments\n";
7fd59977 100 return 1;
101 }
102
103 // try to read a shape:
104 TopoDS_Shape inputShape=DBRep::Get(a[2]);
105 if (inputShape.IsNull()) {
586db386 106 di << "Unknown shape\n";
7fd59977 107 return 1;
108 }
109 // a[2] is a shape. managing:
110 // DT_ShapeDivide result Face Tol
111
112 // giving a face is available only in the constructor:
113 // we make the whole and quit.
114 ShapeUpgrade_ShapeDivideContinuity tool(inputShape);
115
116 // tolerance is optional
117 if (n==4) {
91322f44 118 Standard_Real Tol=Draw::Atof(a[3]);
7fd59977 119 tool.SetTolerance(Tol);
120 }
121
122 // theTool.SetGlobalCriterion(GeomAbs_C1);
123 tool.Perform();
124 TopoDS_Shape res = tool.Result();
125
586db386 126 if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
127 if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
128 if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
129 if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
130 if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
131 if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
132 if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
133 if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
134 if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
135 if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
136 if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
137 if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
138 if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
139 if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
140 if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
141 if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
142 if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
7fd59977 143
144 // fixes
145
146 ShapeFix::SameParameter ( res, Standard_False );
147
148 DBRep::Set(a[1],res);
149 return 0;
150}
151
152static Standard_Integer DT_ShapeConvertRev (Draw_Interpretor& di,
153 Standard_Integer n, const char** a)
154{
155 if (n<5) {
586db386 156 di << "bad number of arguments\n";
7fd59977 157 return 1;
158 }
159
160 // try to read a shape:
161 TopoDS_Shape inputShape=DBRep::Get(a[2]);
162 if (inputShape.IsNull()) {
586db386 163 di << "Unknown shape\n";
7fd59977 164 return 1;
165 }
166
91322f44 167 Standard_Integer c2d = Draw::Atoi(a[3]);
168 Standard_Integer c3d = Draw::Atoi(a[4]);
7fd59977 169 TopoDS_Shape revsh = ShapeCustom::ConvertToRevolution (inputShape);
586db386 170 if (revsh.IsNull()) { di<<"NO RESULT\n"; return 1; }
171 else if (revsh == inputShape) { di<<"No modif\n";}
172 else di<<"ConvertToRevolution -> Result : \n";
7fd59977 173
174 ShapeUpgrade_ShapeConvertToBezier tool(revsh);
175 tool.SetSurfaceConversion(Standard_True);
176 if(c2d)
177 tool.Set2dConversion(Standard_True);
178 if(c3d) {
179 tool.Set3dConversion(Standard_True);
180 if(n > 5)
181 tool.Set3dLineConversion(Standard_False);
182 if(n > 6)
183 tool.Set3dCircleConversion(Standard_False);
184 if(n > 7)
185 tool.Set3dConicConversion(Standard_False);
186 }
187 tool.Perform();
188 TopoDS_Shape res = tool.Result();
189
586db386 190 if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
191 if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
192 if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
193 if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
194 if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
195 if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
196 if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
197 if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
198 if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
199 if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
200 if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
201 if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
202 if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
203 if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
204 if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
205 if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
206 if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
7fd59977 207
208 // fixes
209
210 ShapeFix::SameParameter ( res, Standard_False );
211
212 DBRep::Set(a[1],res);
213 return 0;
214}
215
216
217/*
218 if (!inputShape.IsNull()) {
219 // a[2] is a shape. managing:
220 // DT_ShapeDivide result Face Tol
221
222 TopoDS_Face inputFace = TopoDS::Face(inputShape);
223 if (inputFace.IsNull()) {
586db386 224 di << a[2] << " is not a face\n";
7fd59977 225 return 1;
226 }
227
228 // giving a face is available only in the constructor:
229 // we make the whole and quit.
230 ShapeUpgrade_ShapeDivideContinuity theTool(inputFace);
231
232 // tolerance is optional
233 if (n==4) {
91322f44 234 Standard_Real Tol=Draw::Atof(a[n-1]);
7fd59977 235 theTool.SetTolerance(Tol);
236 }
237
238 theTool.SetGlobalCriterion(GeomAbs_C1);
239 theTool.Build();
240 if (!theTool.IsDone()) {
241 ShapeUpgrade_Error theError=theTool.Error();
242 di << "Not done: error=";
243 if (theError==ShapeUpgrade_Done)
586db386 244 di << "Done\n";
7fd59977 245 else if (theError==ShapeUpgrade_NotDone)
586db386 246 di << "NotDone\n";
7fd59977 247 else if (theError==ShapeUpgrade_EmptyShell)
586db386 248 di << "EmptyShell\n";
7fd59977 249 else if (theError==ShapeUpgrade_InvalidCriterion)
586db386 250 di << "InvalidCriterion\n";
7fd59977 251 else if (theError==ShapeUpgrade_InvalidGridSurface)
586db386 252 di << "InvalidGridSurface\n";
7fd59977 253 else if (theError==ShapeUpgrade_DegeneratedEdge)
586db386 254 di << "DegeneratedEdge\n";
7fd59977 255 else if (theError==ShapeUpgrade_NoSurface)
586db386 256 di << "NoSurface\n";
7fd59977 257 else if (theError==ShapeUpgrade_NoTolerance)
586db386 258 di << "NoTolerance\n";
7fd59977 259 return 1;
260 }
261 TopoDS_Shell res = theTool.Shell();
262 DBRep::Set(a[1],res);
263
264 return 0;
265 }
266 else {
267 // not a face: we can use the empty consturctor.
268 ShapeUpgrade_ShapeDivideContinuity theTool;
91322f44 269 Standard_Real Tol=Draw::Atof(a[n-1]);
7fd59977 270 theTool.SetTolerance(Tol);
271 theTool.SetGlobalCriterion(GeomAbs_C1);
272
273 // try to read a surface:
274 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
275 if (! GS.IsNull()) {
276 // a[2] is a surface. managing the configurations:
277 // DT_ShapeDivide result Surface Tol
278 // DT_ShapeDivide result Surface Face Tol
279 // DT_ShapeDivide result Surface Wire Surf Tol
280
281 theTool.SetSupport(GS);
282
283 // try to read a Wire or a Face:
284 if (n>=5) {
285 TopoDS_Shape inputBoundary=DBRep::Get(a[3]);
286 if (inputBoundary.IsNull()) {
586db386 287 di << "Invalid Boundary\n";
7fd59977 288 return 1;
289 }
290 TopoDS_Wire WireBoundary = TopoDS::Wire(inputBoundary);
291 if (!WireBoundary.IsNull()) {
292 // DT_ShapeDivide result Surface Wire Surf Tol
293 Handle(Geom_Surface) WireSupport = DrawTrSurf::GetSurface(a[4]);
294 if (WireSupport.IsNull()) {
586db386 295 di << "Invalid Surface supporting the Wire\n";
7fd59977 296 return 1;
297 }
298 theTool.SetBoundary(WireBoundary, WireSupport);
299 }
300 else {
301 TopoDS_Face FaceBoundary = TopoDS::Face(inputBoundary);
302 // DT_ShapeDivide result Surface Face Tol
303 theTool.SetBoundary(FaceBoundary);
304 }
305 }
306 }
307 else {
308 // it must be a grid: managing the configurations:
309 // DT_ShapeDivide result NbU NbV {Surf_u_v...} Tol
310 // DT_ShapeDivide result NbU NbV {Surf_u_v...} Face Tol
311 // DT_ShapeDivide result NbU NbV {Surf_u_v...} Wire Surf Tol
312 if (n<6) {
586db386 313 di << "bad number of arguments for grid input\n";
7fd59977 314 return 1;
315 }
316 // number of surf:
91322f44 317 Standard_Integer NbU=Draw::Atoi(a[2]);
318 Standard_Integer NbV=Draw::Atoi(a[3]);
7fd59977 319 if (n < 4+NbU*NbV+1) {
586db386 320 di << "bad number of arguments\n";
7fd59977 321 return 1;
322 }
323
324 Handle(TColGeom_HArray2OfSurface)
325 TheGridSurf= new TColGeom_HArray2OfSurface(1,NbU,1,NbV);
326
327 for (Standard_Integer iu=1; iu<=NbU; iu++) {
328 for (Standard_Integer jv=1; jv<=NbV; jv++) {
329 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[4+(iu-1)*NbV+jv-1]);
330 TheGridSurf->SetValue(iu,jv,GS);
331 }
332 }
333 theTool.SetSupport(TheGridSurf,Tol);
334
335 // try to read a Wire or a Face:
336 if (n>=6+NbU*NbV) {
337 TopoDS_Shape inputBoundary=DBRep::Get(a[4+NbU*NbV]);
338 if (inputBoundary.IsNull()) {
586db386 339 di << "Invalid Boundary\n";
7fd59977 340 return 1;
341 }
342 TopoDS_Wire WireBoundary = TopoDS::Wire(inputBoundary);
343 if (!WireBoundary.IsNull()) {
344 // DT_ShapeDivide result Surface Wire Surf Tol
345 Handle(Geom_Surface) WireSupport = DrawTrSurf::GetSurface(a[4+NbU*NbV+1]);
346 if (WireSupport.IsNull()) {
586db386 347 di << "Invalid Surface supporting the Wire\n";
7fd59977 348 return 1;
349 }
350 theTool.SetBoundary(WireBoundary, WireSupport);
351 }
352 else {
353 TopoDS_Face FaceBoundary = TopoDS::Face(inputBoundary);
354 // DT_ShapeDivide result Surface Face Tol
355 theTool.SetBoundary(FaceBoundary);
356 }
357 }
358 }
359
360 theTool.Build();
361 if (!theTool.IsDone()) {
362 ShapeUpgrade_Error theError=theTool.Error();
363 di << "Not done: error=";
364 if (theError==ShapeUpgrade_Done)
586db386 365 di << "Done\n";
7fd59977 366 else if (theError==ShapeUpgrade_NotDone)
586db386 367 di << "NotDone\n";
7fd59977 368 else if (theError==ShapeUpgrade_EmptyShell)
586db386 369 di << "EmptyShell\n";
7fd59977 370 else if (theError==ShapeUpgrade_InvalidCriterion)
586db386 371 di << "InvalidCriterion\n";
7fd59977 372 else if (theError==ShapeUpgrade_InvalidGridSurface)
586db386 373 di << "InvalidGridSurface\n";
7fd59977 374 else if (theError==ShapeUpgrade_DegeneratedEdge)
586db386 375 di << "DegeneratedEdge\n";
7fd59977 376 else if (theError==ShapeUpgrade_NoSurface)
586db386 377 di << "NoSurface\n";
7fd59977 378 else if (theError==ShapeUpgrade_NoTolerance)
586db386 379 di << "NoTolerance\n";
7fd59977 380 return 1;
381 }
382
383 TopoDS_Shell res = theTool.Shell();
384 DBRep::Set(a[1],res);
385
386 return 0;
387 }
388}
389*/
390static Standard_Integer DT_ShapeConvert (Draw_Interpretor& di,
391 Standard_Integer n, const char** a)
392{
393 if (n<5) {
586db386 394 di << "bad number of arguments\n";
7fd59977 395 return 1;
396 }
397
398 // try to read a shape:
399 TopoDS_Shape inputShape=DBRep::Get(a[2]);
400 if (inputShape.IsNull()) {
586db386 401 di << "Unknown shape\n";
7fd59977 402 return 1;
403 }
404
91322f44 405 Standard_Integer c2d = Draw::Atoi(a[3]);
406 Standard_Integer c3d = Draw::Atoi(a[4]);
7fd59977 407
408 ShapeUpgrade_ShapeConvertToBezier tool(inputShape);
409 tool.SetSurfaceConversion(Standard_True);
410 if(c2d)
411 tool.Set2dConversion(Standard_True);
412 if(c3d)
413 tool.Set3dConversion(Standard_True);
414 tool.Perform();
415 TopoDS_Shape res = tool.Result();
416
586db386 417 if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
418 if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
419 if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
420 if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
421 if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
422 if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
423 if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
424 if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
425 if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
426 if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
427 if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
428 if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
429 if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
430 if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
431 if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
432 if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
433 if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
7fd59977 434
435 // fixes
436
437 ShapeFix::SameParameter ( res, Standard_False );
438
439 DBRep::Set(a[1],res);
440 return 0;
441}
442static Standard_Integer DT_SplitAngle(Draw_Interpretor& di,
443 Standard_Integer n, const char** a)
444{
445 if (n<3) {
586db386 446 di << "bad number of arguments\n";
7fd59977 447 return 1;
448 }
449
450 TopoDS_Shape inputShape=DBRep::Get(a[2]);
451 if (inputShape.IsNull()) {
586db386 452 di << "Unknown shape\n";
7fd59977 453 return 1;
454 }
455
456 Standard_Real maxangle = 95;
457 if ( n >3 ) {
91322f44 458 maxangle = Draw::Atof ( a[3] );
7fd59977 459 if ( maxangle <1 ) maxangle = 1;
460 }
461
982a90fc 462 ShapeUpgrade_ShapeDivideAngle tool(maxangle * M_PI/180,inputShape);
7fd59977 463 tool.Perform();
464 TopoDS_Shape res = tool.Result();
465
586db386 466 if ( tool.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
467 if ( tool.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
468 if ( tool.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
469 if ( tool.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
470 if ( tool.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
471 if ( tool.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
472 if ( tool.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
473 if ( tool.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
474 if ( tool.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
475 if ( tool.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
476 if ( tool.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
477 if ( tool.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
478 if ( tool.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
479 if ( tool.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
480 if ( tool.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
481 if ( tool.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
482 if ( tool.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
7fd59977 483
484 // fixes
485
486 ShapeFix::SameParameter ( res, Standard_False );
487
488 DBRep::Set(a[1],res);
489 return 0;
490}
491
492/*
493//=======================================================================
494//function : DT_PlaneDividedFace
495//purpose : Transfer into a plane with boundary divided
496//
497//
498//=======================================================================
499static Standard_Integer DT_PlaneDividedFace (Draw_Interpretor& di,
500 Standard_Integer n, const char** a)
501
502{
503 // a[1]= result
504 // a[2]= input Face
505 // a[3]= Tolerance
506
507 if (n !=4) {
586db386 508 di << "bad number of arguments\n";
7fd59977 509 return 1;
510 }
511
91322f44 512 Standard_Real Tol=Draw::Atof(a[3]);
7fd59977 513 TopoDS_Shape inputShape=DBRep::Get(a[2]);
514 TopoDS_Face inputFace = TopoDS::Face(inputShape);
515 if (inputFace.IsNull()) {
586db386 516 di << a[2] << " is not a face\n";
7fd59977 517 return 1;
518 }
519
520 ShapeUpgrade_PlaneDividedFace theTool(ThePlane);
521 theTool.Init(inputFace);
522 //theTool.SetBoundaryCriterion(GeomAbs_C1);
523 //theTool.SetTolerance(Tol);
524 theTool.Build();
525 if (!theTool.IsDone()) {
586db386 526 di << "Not done\n";
7fd59977 527 return 1;
528 }
529
530 TopoDS_Face res = theTool.Face();
531 DBRep::Set(a[1],res);
532
533 Standard_Real the2d3dFactor=theTool.Get2d3dFactor();
534 di << "2d3dFactor="<<the2d3dFactor<< "\n";
535 return 0;
536}
537
538//=======================================================================
539//function : DT_PlaneGridShell
540//purpose : Create a Plane Grid Shell from U and V knots
541//
542//
543//=======================================================================
544static Standard_Integer DT_PlaneGridShell (Draw_Interpretor& di,
545 Standard_Integer n, const char** a)
546
547{
548
549 if (n < 4) return 1;
550 // a[1]= result
551 // a[2]= NbU >=2
552 // a[3]= NbV >=2
553 // a[4..]= {UKnots}
554 // a[4+NbU...] = {VKnots}
555 // a[4+NbU+NbV+1] = Tol
556
557 // number of knots:
91322f44 558 Standard_Integer NbU=Draw::Atoi(a[2]);
559 Standard_Integer NbV=Draw::Atoi(a[3]);
7fd59977 560 if (n != 4+NbU+NbV+1) {
586db386 561 di << "bad number of arguments\n";
7fd59977 562 return 1;
563 }
564
565 TColStd_Array1OfReal TheUKnots(1,NbU);
566 TColStd_Array1OfReal TheVKnots(1,NbV);
567
568 for (Standard_Integer ii=1; ii<=NbU; ii++) {
91322f44 569 TheUKnots(ii)=Draw::Atof(a[4+ii-1]);
7fd59977 570 }
571 for (ii=1; ii<=NbV; ii++) {
91322f44 572 TheVKnots(ii)=Draw::Atof(a[4+NbU+ii-1]);
7fd59977 573 }
574
91322f44 575 Standard_Real Tol=Draw::Atof(a[4+NbU+NbV]);
7fd59977 576
577 ShapeUpgrade_PlaneGridShell TheGrid(ThePlane,TheUKnots,TheVKnots,Tol);
578
579 TopoDS_Shell res = TheGrid.Shell();
580 DBRep::Set(a[1],res);
581
582 return 0;
583}
584
585//=======================================================================
586//function : DT_PlaneFaceCommon
587//purpose : Common between a plane Face and a Shell whose all Faces are
588// laying in the same plane
589//
590//
591//=======================================================================
592static Standard_Integer DT_PlaneFaceCommon (Draw_Interpretor& di,
593 Standard_Integer n, const char** a)
594
595{
596 // a[1]= result
597 // a[2]= input Face
598 // a[3]= input Shell
599
600 if (n !=4) {
586db386 601 di << "bad number of arguments\n";
7fd59977 602 return 1;
603 }
604
605 TopoDS_Shape inputShape= DBRep::Get(a[2]);
606 TopoDS_Face inputFace = TopoDS::Face(inputShape);
607 if (inputFace.IsNull()) {
586db386 608 di << a[2] << " is not a face\n";
7fd59977 609 return 1;
610 }
611
612 inputShape = DBRep::Get(a[3]);
613 TopoDS_Shell inputShell = TopoDS::Shell(inputShape);
614 if (inputShell.IsNull()) {
586db386 615 di << a[3] << " is not a shell\n";
7fd59977 616 return 1;
617 }
618
619 ShapeUpgrade_PlaneFaceCommon theTool;
620 theTool.Init(inputFace,inputShell);
621
622 TopoDS_Shell res = theTool.Shell();
623 DBRep::Set(a[1],res);
624
625 return 0;
626}*/
627
628//=======================================================================
629//function : DT_SplitCurve
630//purpose : Splits the curve with C1 criterion
631//
632//
633//=======================================================================
634static Standard_Integer DT_SplitCurve (Draw_Interpretor& di,
635 Standard_Integer n, const char** a)
636
637{
638 // a[1]= input curve. This name is used with a suffix to name the output curves
639 // a[2]= Tolerance
640
641 if (n < 3) {
586db386 642 di << "bad number of arguments\n";
7fd59977 643 return 1;
644 }
645
91322f44 646 Standard_Real Tol=Draw::Atof(a[2]);
7fd59977 647 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(a[1]);
648 if ( GC.IsNull()) return 1;
91322f44 649 Standard_Integer Split = Draw::Atoi(a[3]);
7fd59977 650 Handle(ShapeUpgrade_SplitCurve3dContinuity) theTool = new ShapeUpgrade_SplitCurve3dContinuity;
651 theTool->Init(GC);
652 theTool->SetTolerance (Tol);
653 theTool->SetCriterion (GeomAbs_C1);
654 if(Split == 1) {
655 Handle(TColStd_HSequenceOfReal) spval = new TColStd_HSequenceOfReal;
656 for(Standard_Integer i = 1; i<=5; i++) spval->Append(i);
657 theTool->SetSplitValues(spval);
658 }
659 theTool->Perform (Standard_True);
660 Handle(TColGeom_HArray1OfCurve) theCurves= theTool->GetCurves();
661 Standard_Integer NbC=theCurves->Length();
662 for (Standard_Integer icurv=1; icurv<=NbC; icurv++) {
663 char name[100];
91322f44 664 Sprintf(name,"%s%s%d",a[1],"_",icurv);
7fd59977 665 char* newname = name;
666 DrawTrSurf::Set(newname, theCurves->Value(icurv));
667 di.AppendElement(newname);
668 }
669 return 0;
670}
671
672
673//=======================================================================
674//function : DT_SplitCurve2d
675//purpose : Splits the curve with C1 criterion
676//
677//
678//=======================================================================
679static Standard_Integer DT_SplitCurve2d (Draw_Interpretor& di,
680 Standard_Integer n, const char** a)
681
682{
683 // a[1]= input 2d curve. This name is used with a suffix to name the output curves
684 // a[2]= Tolerance
685
686 if (n < 3) {
586db386 687 di << "bad number of arguments\n";
7fd59977 688 return 1;
689 }
690
91322f44 691 Standard_Real Tol=Draw::Atof(a[2]);
7fd59977 692 Handle(Geom2d_Curve) GC = DrawTrSurf::GetCurve2d(a[1]);
693 if ( GC.IsNull()) return 1;
91322f44 694 Standard_Integer Split = Draw::Atoi(a[3]);
7fd59977 695 Handle(ShapeUpgrade_SplitCurve2dContinuity) theTool = new ShapeUpgrade_SplitCurve2dContinuity;
696 theTool->Init(GC);
697 theTool->SetTolerance (Tol);
698 theTool->SetCriterion (GeomAbs_C1);
699 if(Split == 1) {
700 Handle(TColStd_HSequenceOfReal) spval = new TColStd_HSequenceOfReal;
701 for(Standard_Integer i = 1; i<=5; i++) spval->Append(i);
702 theTool->SetSplitValues(spval);
703 }
704 theTool->Perform (Standard_True);
705 Handle(TColGeom2d_HArray1OfCurve) theCurves= theTool->GetCurves();
706 Standard_Integer NbC=theCurves->Length();
707 for (Standard_Integer icurv=1; icurv<=NbC; icurv++) {
708 char name[100];
91322f44 709 Sprintf(name,"%s%s%d",a[1],"_",icurv);
7fd59977 710 char* newname = name;
711 DrawTrSurf::Set(newname, theCurves->Value(icurv));
712 di.AppendElement(newname);
713 }
714 return 0;
715}
716
717
718//=======================================================================
719//function : DT_SplitSurface
720//purpose : Splits the surface with C1 criterion
721//
722//
723//=======================================================================
724/*
725static Standard_Integer DT_SplitWire (Draw_Interpretor& di,
726 Standard_Integer n, const char** a)
727{
728
729 if (n <3) {
586db386 730 di << "bad number of arguments\n";
7fd59977 731 return 1;
732 }
733
734 TopoDS_Face source = TopoDS::Face(DBRep::Get(a[2]));
735 if(source.IsNull()) {
586db386 736 di <<"Shape is not face\n";
7fd59977 737 return 1;
738 }
739 TopoDS_Iterator wi(source);
740 if(!wi.More()) {
586db386 741 di <<"Shape is face without wire\n";
7fd59977 742 return 1;
743 }
744
745 TopoDS_Wire wire = TopoDS::Wire(wi.Value());
746 Handle(ShapeUpgrade_WireDivideContinuity) tool = new ShapeUpgrade_WireDivideContinuity;
747 tool->Init(wire,source);
748 if(n >=4 ) {
91322f44 749 Standard_Real Tol=Draw::Atof(a[3]);
7fd59977 750 }
751 Handle(ShapeBuild_ReShape) context = new ShapeBuild_ReShape;
752 tool->Perform(context);
753 TopoDS_Wire result = tool->Wire();
754 DBRep::Set(a[1],result);
755 return 0;
756}
757*/
758/*
759static Standard_Integer DT_SplitFace (Draw_Interpretor& di,
760 Standard_Integer n, const char** a)
761{
762
763 if (n <3) {
586db386 764 di << "bad number of arguments\n";
7fd59977 765 return 1;
766 }
767
768 TopoDS_Face source = TopoDS::Face(DBRep::Get(a[2]));
769 if(source.IsNull()) {
586db386 770 di <<"Shape is not face\n";
7fd59977 771 return 1;
772 }
773 Handle(ShapeUpgrade_ShapeDivideContinuity) tool = new ShapeUpgrade_FaceDivideContinuity;
774 tool->Init(source);
775 if(n >=4 ) {
91322f44 776 Standard_Real Tol=Draw::Atof(a[3]);
7fd59977 777 tool->SetPrecision(Tol);
778 }
779
780 Handle(ShapeBuild_ReShape) context = new ShapeBuild_ReShape;
781 tool->Perform(context);
782 TopoDS_Shape result = tool->Result();
783
784
586db386 785 if ( tool->Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
786 if ( tool->Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
787 if ( tool->Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
788 if ( tool->Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
789 if ( tool->Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
790 if ( tool->Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
791 if ( tool->Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
792 if ( tool->Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
793 if ( tool->Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
794 if ( tool->Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
795 if ( tool->Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
796 if ( tool->Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
797 if ( tool->Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
798 if ( tool->Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
799 if ( tool->Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
800 if ( tool->Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
801 if ( tool->Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
7fd59977 802
803 // fixes
804
805 ShapeFix::SameParameter ( result, Standard_False );
806
807 DBRep::Set(a[1],result);
808 return 0;
809}
810*/
811
812static Standard_Integer DT_SplitSurface (Draw_Interpretor& di,
813 Standard_Integer n, const char** a)
814
815{
816 // a[1]= result (used with a suffix to name the output surfaces)
817 // a[2]= input surface.
818 // a[3]= Tolerance
819
820 // a[1]= result
821 // a[2]= nbU
822 // a[3]= nbV
823 // a[3+1]..a[3+nbU*nbV] = Input Surfaces
824 // a[4+nbU*nbV]= Tolerance
825
826 if (n <4) {
586db386 827 di << "bad number of arguments\n";
7fd59977 828 return 1;
829 }
830
831 Handle(ShapeUpgrade_SplitSurfaceContinuity) theTool = new ShapeUpgrade_SplitSurfaceContinuity;//S4137
832
91322f44 833 Standard_Real Tol=Draw::Atof(a[3]);
834 Standard_Integer Split = Draw::Atoi(a[4]);
7fd59977 835 theTool->SetTolerance(Tol);
836 theTool->SetCriterion(GeomAbs_C1);
837 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[2]);
838/*
839 if ( GS.IsNull()) {
840 // Case of composite grid surface
586db386 841 di << "composite surf\n";
91322f44 842 Standard_Integer nbU=Draw::Atoi(a[2]);
843 Standard_Integer nbV=Draw::Atoi(a[3]);
7fd59977 844 if (nbU==0 || nbV==0) return 1;
845 Handle(TColGeom_HArray2OfSurface)
846 theGrid= new TColGeom_HArray2OfSurface(1,nbU,1,nbV);
847 for (Standard_Integer iu=1; iu<=nbU; iu++) {
848 for (Standard_Integer iv=1; iv<=nbV; iv++) {
849 Handle(Geom_Surface) GS = DrawTrSurf::GetSurface(a[3+(iu-1)*nbV+iv]);
850 theGrid->SetValue(iu,iv,GS);
851 }
852 }
586db386 853 di << "appel a SplitSurface::Init\n";
7fd59977 854 theTool->Init(theGrid);
855 }
856 else {*/
857 // Case of single surface
586db386 858 di << "single surf\n";
7fd59977 859
586db386 860 di << "appel a SplitSurface::Init\n";
7fd59977 861 theTool->Init(GS);
862 if(Split ==1) {
863 Handle(TColStd_HSequenceOfReal) spval = new TColStd_HSequenceOfReal;
864 for(Standard_Integer i = 1; i<=5; i++) spval->Append(i);
865 theTool->SetUSplitValues(spval);
866 theTool->SetVSplitValues(spval);
867 }
868
586db386 869 di << "appel a SplitSurface::Build\n";
7fd59977 870 theTool->Build(Standard_True);
871
586db386 872 di << "appel a SplitSurface::GlobalU/VKnots\n";
7fd59977 873 Handle(ShapeExtend_CompositeSurface) Grid = theTool->ResSurfaces();
874 Handle(TColStd_HArray1OfReal) GlobalU=Grid->UJointValues();
875 Handle(TColStd_HArray1OfReal) GlobalV=Grid->VJointValues();
876 Standard_Integer nbGlU=GlobalU->Length();
877 Standard_Integer nbGlV=GlobalV->Length();
878 di << "nb GlobalU ; nb GlobalV="<<nbGlU<<" "<<nbGlV;
879 for (Standard_Integer iu=1; iu<=nbGlU; iu++)
880 di <<" "<< GlobalU->Value(iu);
881// di <<"\n";
882// di << "nb GlobalV="<<nbGlV;
883 for (Standard_Integer iv=1; iv<=nbGlV; iv++)
884 di <<" "<< GlobalV->Value(iv);
885 di <<"\n";
886
586db386 887di << "appel a Surfaces\n";
7fd59977 888 Handle(TColGeom_HArray2OfSurface) theSurfaces= Grid->Patches();
889
586db386 890di << "transfert resultat\n";
7fd59977 891 Standard_Integer NbRow=theSurfaces->ColLength();
892 Standard_Integer NbCol=theSurfaces->RowLength();
893 for (Standard_Integer irow=1; irow<=NbRow; irow++) {
894 for (Standard_Integer icol=1; icol<=NbCol; icol++) {
895 char name[100];
91322f44 896 Sprintf(name,"%s%s%d%s%d",a[1],"_",irow,"_",icol);
7fd59977 897 char* newname = name;
898 DrawTrSurf::Set(newname, theSurfaces->Value(irow, icol));
899 di.AppendElement(newname);
900 }
901 }
902 return 0;
903}
904
7fd59977 905//---------------gka
906//=======================================================================
907//function : offset2dcurve
908//purpose :
909//
910//=======================================================================
911static Standard_Integer offset2dcurve
912 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
913{
914 if (argc < 4) {
586db386 915 di<<"result + curve + offset\n";
7fd59977 916
917 return 1 /* Error */;
918 }
919// Standard_CString arg1 = argv[1];
920// Standard_CString arg2 = argv[2];
91322f44 921 Standard_Real Offset = Draw::Atof(argv[3]);
7fd59977 922 Handle(Geom2d_Curve) GC = DrawTrSurf::GetCurve2d(argv[2]);
923 if ( GC.IsNull()) return 1;
924 Handle(Geom2d_OffsetCurve) offcrv = new Geom2d_OffsetCurve(GC,Offset);
925 DrawTrSurf::Set(argv[1], offcrv);
926 return 0;
927}
928
929//=======================================================================
930//function : offsetcurve
931//purpose :
932//
933//=======================================================================
934static Standard_Integer offsetcurve
935 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
936{
937 if (argc < 5) {
586db386 938 di<<"result + curve + offset + Dir\n";
7fd59977 939
940 return 1 /* Error */;
941 }
942// Standard_CString arg1 = argv[1];
943// Standard_CString arg2 = argv[2];
91322f44 944 Standard_Real Offset = Draw::Atof(argv[3]);
7fd59977 945 Handle(Geom_Curve) GC = DrawTrSurf::GetCurve(argv[2]);
946 if ( GC.IsNull()) return 1;
947 gp_Pnt point;
948 DrawTrSurf::GetPoint(argv[4],point);
949 gp_Dir dir(point.XYZ());
950 Handle(Geom_OffsetCurve) offcrv = new Geom_OffsetCurve(GC,Offset,dir);
951 DrawTrSurf::Set(argv[1], offcrv);
952 return 0;
953}
954
955//=======================================================================
956//function : compose shell
957//purpose :
958//=======================================================================
959static Standard_Integer splitface
960 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
961{
962 if (argc < 5) {
586db386 963 di << "Split face: splitface result face [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]\n";
7fd59977 964 return 1;
965 }
966
967 TopoDS_Shape aLocalShape = DBRep::Get(argv[2]) ;
968 TopoDS_Face face = TopoDS::Face ( aLocalShape );
969 if ( face.IsNull() ) {
586db386 970 di << argv[2] << " is not Face\n";
7fd59977 971 return 1;
972 }
973
974 Handle(Geom_Surface) S = BRep_Tool::Surface ( face );
975 Standard_Real Uf, Ul, Vf, Vl;
976 BRepTools::UVBounds ( face, Uf, Ul, Vf, Vl );
977 Standard_Real Umin, Umax, Vmin, Vmax;
978 S->Bounds ( Umin, Umax, Vmin, Vmax );
979 if ( Uf < Umin && ! S->IsUPeriodic() ) Uf = Umin;
eafb234b 980 else if ( Uf > Umin ) {
7fd59977 981 if ( Precision::IsInfinite(Umin) ) Uf -= 100;
982 else Uf = Umin;
eafb234b 983 }
7fd59977 984 if ( Vf < Vmin && ! S->IsVPeriodic() ) Vf = Vmin;
eafb234b 985 else if ( Vf > Vmin ) {
7fd59977 986 if ( Precision::IsInfinite(Vmin) ) Vf -= 100;
987 else Vf = Vmin;
eafb234b 988 }
7fd59977 989 if ( Ul > Umax && ! S->IsUPeriodic() ) Ul = Umax;
eafb234b 990 else if ( Ul < Umax ) {
7fd59977 991 if ( Precision::IsInfinite(Umax) ) Ul += 100;
992 else Ul = Umax;
eafb234b 993 }
7fd59977 994 if ( Vl > Vmax && ! S->IsVPeriodic() ) Vl = Vmax;
eafb234b 995 else if ( Vl < Vmax ) {
7fd59977 996 if ( Precision::IsInfinite(Vmax) ) Vl += 100;
997 else Vl = Vmax;
eafb234b 998 }
7fd59977 999
1000 TColStd_SequenceOfReal uval;
1001 TColStd_SequenceOfReal vval;
1002
1003 Standard_Boolean byV = Standard_False;
1004 Standard_Integer i; // svv Jan11 2000 : porting on DEC
1005 for ( i=3; i < argc; i++ ) {
1006 if ( argv[i][0] == 'u' ) byV = Standard_False;
1007 else if ( argv[i][0] == 'v' ) byV = Standard_True;
1008 else {
91322f44 1009 Standard_Real val = Draw::Atof ( argv[i] );
7fd59977 1010 TColStd_SequenceOfReal &vals = ( byV ? vval : uval );
1011 if ( vals.Length() >0 && val - vals.Last() < Precision::PConfusion() ) {
586db386 1012 di << "Values should be sorted in increasing order; skipped\n";
7fd59977 1013 continue;
1014 }
1015 if ( ( byV && ( val < Vf+Precision::PConfusion() ||
1016 val > Vl-Precision::PConfusion() ) ) ||
1017 (!byV && ( val < Uf+Precision::PConfusion() ||
1018 val > Ul-Precision::PConfusion() ) ) ) {
586db386 1019 di << "Values should be inside range of surface; skipped\n";
7fd59977 1020 continue;
1021 }
1022 vals.Append ( val );
1023 }
1024 }
1025 if ( uval.Length() <1 && vval.Length() <1 ) {
586db386 1026 di << "No splitting defined\n";
7fd59977 1027 return 1;
1028 }
1029 if ( uval.Length() >0 ) {
1030 di << "Splitting by U: ";
1031 for ( Standard_Integer j=1; j <= uval.Length(); j++ ) {
04232180 1032 //std::cout << ( i >j ? ", " : "" ) << uval(j);
7fd59977 1033 if (i >j) {
1034 di << ", ";
1035 } else {
1036 di << "";
1037 }
1038 di << uval(j);
1039 }
1040 di << "\n";
1041 }
1042 if ( vval.Length() >0 ) {
1043 di << "Splitting by V: ";
1044 for ( Standard_Integer j=1; j <= vval.Length(); j++ ) {
04232180 1045 //std::cout << ( j >1 ? ", " : "" ) << vval(j);
7fd59977 1046 if (j >1) {
1047 di << ", ";
1048 } else {
1049 di << "";
1050 }
1051 di << vval(j);
1052 }
1053 di << "\n";
1054 }
1055
1056 Handle(TColGeom_HArray2OfSurface) AS = new TColGeom_HArray2OfSurface ( 1, uval.Length()+1,
1057 1, vval.Length()+1 );
1058 for ( i=0; i <= uval.Length(); i++ ) {
1059 Standard_Real umin = ( i ? uval(i) : Uf );
1060 Standard_Real umax = ( i < uval.Length() ? uval(i+1) : Ul );
1061 for ( Standard_Integer j=0; j <= vval.Length(); j++ ) {
1062 Standard_Real vmin = ( j ? vval(j) : Vf );
1063 Standard_Real vmax = ( j < vval.Length() ? vval(j+1) : Vl );
1064 Handle(Geom_RectangularTrimmedSurface) rect =
1065 new Geom_RectangularTrimmedSurface ( S, umin, umax, vmin, vmax );
1066 AS->SetValue ( i+1, j+1, rect );
1067 }
1068 }
1069
1070 Handle(ShapeExtend_CompositeSurface) Grid = new ShapeExtend_CompositeSurface;
586db386 1071 if ( ! Grid->Init ( AS ) ) di << "Grid badly connected!\n";
7fd59977 1072
1073 ShapeFix_ComposeShell SUCS;
1074 TopLoc_Location l;
1075 SUCS.Init ( Grid, l, face, Precision::Confusion() );
1076 Handle(ShapeBuild_ReShape) RS = new ShapeBuild_ReShape;
1077 SUCS.SetContext( RS );
1078 SUCS.Perform ();
1079
586db386 1080 if ( SUCS.Status ( ShapeExtend_OK ) ) di << "Status: OK\n";
1081 if ( SUCS.Status ( ShapeExtend_DONE1 ) ) di << "Status: DONE1\n";
1082 if ( SUCS.Status ( ShapeExtend_DONE2 ) ) di << "Status: DONE2\n";
1083 if ( SUCS.Status ( ShapeExtend_DONE3 ) ) di << "Status: DONE3\n";
1084 if ( SUCS.Status ( ShapeExtend_DONE4 ) ) di << "Status: DONE4\n";
1085 if ( SUCS.Status ( ShapeExtend_DONE5 ) ) di << "Status: DONE5\n";
1086 if ( SUCS.Status ( ShapeExtend_DONE6 ) ) di << "Status: DONE6\n";
1087 if ( SUCS.Status ( ShapeExtend_DONE7 ) ) di << "Status: DONE7\n";
1088 if ( SUCS.Status ( ShapeExtend_DONE8 ) ) di << "Status: DONE8\n";
1089 if ( SUCS.Status ( ShapeExtend_FAIL1 ) ) di << "Status: FAIL1\n";
1090 if ( SUCS.Status ( ShapeExtend_FAIL2 ) ) di << "Status: FAIL2\n";
1091 if ( SUCS.Status ( ShapeExtend_FAIL3 ) ) di << "Status: FAIL3\n";
1092 if ( SUCS.Status ( ShapeExtend_FAIL4 ) ) di << "Status: FAIL4\n";
1093 if ( SUCS.Status ( ShapeExtend_FAIL5 ) ) di << "Status: FAIL5\n";
1094 if ( SUCS.Status ( ShapeExtend_FAIL6 ) ) di << "Status: FAIL6\n";
1095 if ( SUCS.Status ( ShapeExtend_FAIL7 ) ) di << "Status: FAIL7\n";
1096 if ( SUCS.Status ( ShapeExtend_FAIL8 ) ) di << "Status: FAIL8\n";
7fd59977 1097
1098 TopoDS_Shape sh = SUCS.Result();
1099 ShapeFix::SameParameter ( sh, Standard_False );
1100 DBRep::Set ( argv[1], sh );
1101 return 0;
1102}
1103
1104static Standard_Integer converttobspline
1105 (Draw_Interpretor& di, Standard_Integer argc, const char** argv)
1106{
1107 if (argc<3) {
1108 di << "Use: " << argv[0] << " result shape [options=ero]\n";
1109 di << "where options is combination of letters indicating kinds of\n";
1110 di << "surfaces to be converted:\n";
1111 di << "e - extrusion\n";
1112 di << "r - revolution\n";
1113 di << "o - offset\n";
1114 di << "p - plane";
1115 return 1;
1116 }
1117 const char *options = ( argc > 3 ? argv[3] : "ero" );
1118
1119 TopoDS_Shape inputShape=DBRep::Get(argv[2]);
1120 if (inputShape.IsNull()) {
586db386 1121 di << "Unknown shape\n";
7fd59977 1122 return 1;
1123 }
1124 TopoDS_Shape revsh = ShapeCustom::ConvertToRevolution (inputShape);
1125 TopoDS_Shape res =
1126 ShapeCustom::ConvertToBSpline (revsh, strchr (options, 'e') != 0,
1127 strchr (options, 'r') != 0,
1128 strchr (options, 'o') != 0,
1129 strchr (options, 'p') != 0);
1130 ShapeFix::SameParameter ( res, Standard_False );
1131 DBRep::Set ( argv[1], res );
1132 return 0;
1133}
1134
1135
1136static Standard_Integer splitclosed (Draw_Interpretor& di,
1137 Standard_Integer argc,
1138 const char** argv)
1139{
1140 if (argc<3) {
586db386 1141 di << "bad number of arguments\n";
7fd59977 1142 return 1;
1143 }
1144
1145 TopoDS_Shape inputShape=DBRep::Get(argv[2]);
1146 if (inputShape.IsNull()) {
586db386 1147 di << "Unknown shape\n";
7fd59977 1148 return 1;
1149 }
1150
1151 ShapeUpgrade_ShapeDivideClosed tool (inputShape);
1152 tool.Perform();
1153 TopoDS_Shape res = tool.Result();
1154
1155 ShapeFix::SameParameter ( res, Standard_False );
1156 DBRep::Set ( argv[1], res );
1157 return 0;
1158}
1159
1160static Standard_Integer splitarea (Draw_Interpretor& di,
1161 Standard_Integer argc,
1162 const char** argv)
1163{
1164 if (argc<4) {
586db386 1165 di << "bad number of arguments\n";
7fd59977 1166 return 1;
1167 }
1168
1169 TopoDS_Shape inputShape=DBRep::Get(argv[2]);
1170 if (inputShape.IsNull()) {
586db386 1171 di << "Unknown shape\n";
7fd59977 1172 return 1;
1173 }
91322f44 1174 Standard_Real aMaxArea = Draw::Atof(argv[3]);
7fd59977 1175
1176
1177 ShapeUpgrade_ShapeDivideArea tool (inputShape);
1178 if(argc >4) {
91322f44 1179 Standard_Real prec = Draw::Atof(argv[4]);
7fd59977 1180 tool.SetPrecision(prec);
1181 }
1182 tool.MaxArea() = aMaxArea;
1183 tool.Perform();
1184 TopoDS_Shape res = tool.Result();
1185
1186 ShapeFix::SameParameter ( res, Standard_False );
1187 DBRep::Set ( argv[1], res );
1188 return 0;
1189}
1190
1191static Standard_Integer removeinternalwires (Draw_Interpretor& di,
1192 Standard_Integer argc,
1193 const char** argv)
1194{
1195 if (argc<4) {
586db386 1196 di << "bad number of arguments\n";
7fd59977 1197 return 1;
1198 }
91322f44 1199 Standard_Real aMinArea = Draw::Atof(argv[2]);
7fd59977 1200 TopoDS_Shape inputShape=DBRep::Get(argv[3]);
1201 if (inputShape.IsNull()) {
586db386 1202 di << "Unknown shape\n";
7fd59977 1203 return 1;
1204 }
1205 Handle(ShapeUpgrade_RemoveInternalWires) aTool;
1206 TopTools_SequenceOfShape aSeqShapes;
1207 if(inputShape.ShapeType() < TopAbs_WIRE)
1208 aTool = new ShapeUpgrade_RemoveInternalWires(inputShape);
1209 else {
586db386 1210 di<<"Invalid type of first shape: should be FACE,SHELL,SOLID or COMPOUND\n";
7fd59977 1211 return 1;
1212 }
1213
1214 Standard_Integer k = 4;
1215 Standard_Boolean isShape = Standard_True;
1216 Standard_Boolean aModeRemoveFaces =Standard_True;
1217
1218
1219 for( ; k < argc; k++) {
1220 if(isShape) {
1221 TopoDS_Shape aShape=DBRep::Get(argv[k]);
1222 isShape = !aShape.IsNull();
1223 if(isShape) {
1224 if(aShape.ShapeType() == TopAbs_FACE || aShape.ShapeType() == TopAbs_WIRE)
1225 aSeqShapes.Append(aShape);
1226 }
1227 }
1228 if(!isShape)
91322f44 1229 aModeRemoveFaces = (Draw::Atoi(argv[k]) == 1);
7fd59977 1230 }
1231
1232 aTool->MinArea() = aMinArea;
1233 aTool->RemoveFaceMode() = aModeRemoveFaces;
1234 if(aSeqShapes.Length())
1235 aTool->Perform(aSeqShapes);
1236 else
1237 aTool->Perform();
1238 if(aTool->Status(ShapeExtend_FAIL1))
586db386 1239 di<<"Initial shape has invalid type\n";
7fd59977 1240 else if(aTool->Status(ShapeExtend_FAIL2))
586db386 1241 di<<"Specified sub-shape is not belonged to whole shape\n";
7fd59977 1242 if(aTool->Status(ShapeExtend_DONE1)) {
1243 const TopTools_SequenceOfShape& aRemovedWires =aTool->RemovedWires();
586db386 1244 di<<aRemovedWires.Length()<<" internal wires were removed\n";
7fd59977 1245
1246 }
1247 if(aTool->Status(ShapeExtend_DONE2)) {
1248 const TopTools_SequenceOfShape& aRemovedFaces =aTool->RemovedFaces();
586db386 1249 di<<aRemovedFaces.Length()<<" small faces were removed\n";
7fd59977 1250
1251 }
1252 TopoDS_Shape res = aTool->GetResult();
1253
1254
1255 DBRep::Set ( argv[1], res );
1256 return 0;
1257}
1258
982a90fc
G
1259static Standard_Integer removeloc (Draw_Interpretor& di,
1260 Standard_Integer argc,
1261 const char** argv)
1262{
1263 if (argc<3) {
15b2583e 1264 di << "bad number of arguments. Should be: removeloc res shape [remove_level(see ShapeEnum)]\n";
982a90fc
G
1265 return 1;
1266 }
1267
1268 TopoDS_Shape aShape = DBRep::Get(argv[2]);
1269 if(aShape.IsNull())
1270 return 1;
1271 ShapeUpgrade_RemoveLocations aRemLoc;
15b2583e 1272 if (argc > 3)
1273 aRemLoc.SetRemoveLevel((TopAbs_ShapeEnum)Draw::Atoi(argv[3]));
982a90fc
G
1274 aRemLoc.Remove(aShape);
1275 TopoDS_Shape aNewShape = aRemLoc.GetResult();
1276
1277 DBRep::Set(argv[1],aNewShape);
1278 return 0;
1279}
2277323d 1280
f7d70540 1281static ShapeUpgrade_UnifySameDomain& Unifier() {
1282 static ShapeUpgrade_UnifySameDomain sUnifier;
1283 return sUnifier;
1284}
1285
2277323d 1286//=======================================================================
1287// unifysamedom
1288//=======================================================================
f7d70540 1289static Standard_Integer unifysamedom(Draw_Interpretor& di, Standard_Integer n, const char** a)
2277323d 1290{
2ba9eb30 1291 if (n < 3)
f7d70540 1292 {
632175c3 1293 di << "Use unifysamedom result shape [s1 s2 ...] [-f] [-e] [-nosafe] [+b] [+i] [-t val] [-a val]\n";
fe1a6e4e 1294 di << "options:\n";
9ed6494b 1295 di << "s1 s2 ... to keep the given edges during unification of faces\n";
2ba9eb30 1296 di << "-f to switch off 'unify-faces' mode \n";
1297 di << "-e to switch off 'unify-edges' mode\n";
632175c3 1298 di << "-nosafe to switch off 'safe input shape' mode\n";
2ba9eb30 1299 di << "+b to switch on 'concat bspline' mode\n";
1300 di << "+i to switch on 'allow internal edges' mode\n";
1301 di << "-t val to set linear tolerance\n";
948fe6ca 1302 di << "-a val to set angular tolerance (in degrees)\n";
f7d70540 1303 di << "'unify-faces' and 'unify-edges' modes are switched on by default";
2277323d 1304 return 1;
f7d70540 1305 }
2277323d 1306
1307 TopoDS_Shape aShape = DBRep::Get(a[2]);
1308 if (aShape.IsNull())
1309 return 1;
1310
f7d70540 1311 // default values
1312 Standard_Boolean anUFaces = Standard_True;
1313 Standard_Boolean anUEdges = Standard_True;
1314 Standard_Boolean anConBS = Standard_False;
fe1a6e4e 1315 Standard_Boolean isAllowInternal = Standard_False;
632175c3 1316 Standard_Boolean isSafeInputMode = Standard_True;
2ba9eb30 1317 Standard_Real aLinTol = Precision::Confusion();
1318 Standard_Real aAngTol = Precision::Angular();
9ed6494b 1319 TopoDS_Shape aKeepShape;
1320 TopTools_MapOfShape aMapOfShapes;
f7d70540 1321
1322 if (n > 3)
1323 for ( int i = 3; i < n; i++ )
1324 {
9ed6494b 1325 aKeepShape = DBRep::Get(a[i]);
1326 if (!aKeepShape.IsNull()) {
1327 aMapOfShapes.Add(aKeepShape);
1328 }
1329 else {
1330 if ( !strcmp(a[i], "-f"))
1331 anUFaces = Standard_False;
1332 else if (!strcmp(a[i], "-e"))
1333 anUEdges = Standard_False;
632175c3 1334 else if (!strcmp(a[i], "-nosafe"))
1335 isSafeInputMode = Standard_False;
9ed6494b 1336 else if (!strcmp(a[i], "+b"))
1337 anConBS = Standard_True;
1338 else if (!strcmp(a[i], "+i"))
1339 isAllowInternal = Standard_True;
1340 else if (!strcmp(a[i], "-t") || !strcmp(a[i], "-a"))
2ba9eb30 1341 {
9ed6494b 1342 if (++i < n)
1343 {
948fe6ca 1344 if (a[i-1][1] == 't')
1345 aLinTol = Draw::Atof(a[i]);
1346 else
1347 aAngTol = Draw::Atof(a[i]) * (M_PI / 180.0);
9ed6494b 1348 }
1349 else
1350 {
1351 di << "value expected after " << a[i-1];
1352 return 1;
1353 }
2ba9eb30 1354 }
1355 }
f7d70540 1356 }
1357
1358 Unifier().Initialize(aShape, anUEdges, anUFaces, anConBS);
9ed6494b 1359 Unifier().KeepShapes(aMapOfShapes);
632175c3 1360 Unifier().SetSafeInputMode(isSafeInputMode);
fe1a6e4e 1361 Unifier().AllowInternalEdges(isAllowInternal);
2ba9eb30 1362 Unifier().SetLinearTolerance(aLinTol);
1363 Unifier().SetAngularTolerance(aAngTol);
f7d70540 1364 Unifier().Build();
1365 TopoDS_Shape Result = Unifier().Shape();
2277323d 1366
948fe6ca 1367 if (BRepTest_Objects::IsHistoryNeeded())
1368 BRepTest_Objects::SetHistory(Unifier().History());
20aa0d3f 1369
4f7d41ea 1370 DBRep::Set(a[1], Result);
20aa0d3f 1371 return 0;
1372}
f7d70540 1373
982a90fc
G
1374static Standard_Integer copytranslate(Draw_Interpretor& di,
1375 Standard_Integer argc,
1376 const char** argv)
1377{
1378 if (argc<6) {
15b2583e 1379 di << "bad number of arguments. Should be: copytranslate res shape dx dy dz\n";
982a90fc
G
1380 return 1;
1381 }
1382 TopoDS_Shape aShape = DBRep::Get(argv[2]);
1383 if(aShape.IsNull())
1384 return 1;
91322f44 1385 Standard_Real aDx = Draw::Atof(argv[3]);
1386 Standard_Real aDy = Draw::Atof(argv[4]);
1387 Standard_Real aDz = Draw::Atof(argv[5]);
982a90fc
G
1388 gp_Trsf aTrsf;
1389 aTrsf.SetTranslation(gp_Vec(aDx, aDy, aDz));
1390 BRepBuilderAPI_Transform builderTransform(aTrsf);
1391 builderTransform.Perform (aShape, true);
1392 TopoDS_Shape aNewShape = builderTransform.Shape();
1393 DBRep::Set(argv[1],aNewShape);
1394 return 0;
1395
1396}
1397
9b1d4e7f 1398static Standard_Integer reshape(Draw_Interpretor& /*theDI*/,
1399 Standard_Integer theArgc,
1400 const char** theArgv)
3e6a4cd0 1401{
9b1d4e7f 1402 if ( theArgc < 4 )
3e6a4cd0 1403 {
04232180 1404 std::cout << "Error: wrong number of arguments. Type 'help " << theArgv[0] << "'\n";
3e6a4cd0 1405 return 1;
1406 }
1407
9b1d4e7f 1408 TopoDS_Shape aSource = DBRep::Get(theArgv[2]);
1409 if ( aSource.IsNull() )
3e6a4cd0 1410 {
04232180 1411 std::cout << "Error: source shape ('" << theArgv[2] << "') is null\n";
3e6a4cd0 1412 return 1;
1413 }
1414
9b1d4e7f 1415 Handle(BRepTools_ReShape) aReShaper = new BRepTools_ReShape;
3e6a4cd0 1416
e837b3a2 1417 TopAbs_ShapeEnum aShapeLevel = TopAbs_SHAPE;
1418
3e6a4cd0 1419 // Record the requested modifications
9b1d4e7f 1420 for ( Standard_Integer i = 3; i < theArgc; ++i )
3e6a4cd0 1421 {
9b1d4e7f 1422 Standard_CString anArg = theArgv[i];
1423 TCollection_AsciiString anOpt(anArg);
1424 anOpt.LowerCase();
3e6a4cd0 1425
9b1d4e7f 1426 if ( anOpt == "-replace" )
3e6a4cd0 1427 {
9b1d4e7f 1428 if ( theArgc - i < 3 )
3e6a4cd0 1429 {
04232180 1430 std::cout << "Error: not enough arguments for replacement\n";
3e6a4cd0 1431 return 1;
1432 }
1433
9b1d4e7f 1434 TopoDS_Shape aWhat = DBRep::Get(theArgv[++i]);
1435 if ( aWhat.IsNull() )
3e6a4cd0 1436 {
04232180 1437 std::cout << "Error: argument shape ('" << theArgv[i] << "') is null\n";
3e6a4cd0 1438 return 1;
1439 }
1440
9b1d4e7f 1441 TopoDS_Shape aWith = DBRep::Get(theArgv[++i]);
1442 if ( aWith.IsNull() )
3e6a4cd0 1443 {
04232180 1444 std::cout << "Error: replacement shape ('" << theArgv[i] << "') is null\n";
3e6a4cd0 1445 return 1;
1446 }
1447
9b1d4e7f 1448 aReShaper->Replace(aWhat, aWith);
3e6a4cd0 1449 }
9b1d4e7f 1450 else if ( anOpt == "-remove" )
3e6a4cd0 1451 {
9b1d4e7f 1452 if ( theArgc - i < 2 )
3e6a4cd0 1453 {
04232180 1454 std::cout << "Error: not enough arguments for removal\n";
3e6a4cd0 1455 return 1;
1456 }
1457
9b1d4e7f 1458 TopoDS_Shape aWhat = DBRep::Get(theArgv[++i]);
1459 if ( aWhat.IsNull() )
3e6a4cd0 1460 {
04232180 1461 std::cout << "Error: shape to remove ('" << theArgv[i] << "') is null\n";
3e6a4cd0 1462 return 1;
1463 }
1464
9b1d4e7f 1465 aReShaper->Remove(aWhat);
1466 }
e837b3a2 1467 else if (anOpt == "-until")
1468 {
1469 if (theArgc - i < 2)
1470 {
1471 std::cout << "Error: not enough arguments for level specification\n";
1472 return 1;
1473 }
1474
1475 Standard_CString aLevelCStr = theArgv[++i];
1476 TCollection_AsciiString aLevelStr(aLevelCStr);
1477 aLevelStr.LowerCase();
1478 if (aLevelStr == "compound" ||
1479 aLevelStr == "cd")
1480 aShapeLevel = TopAbs_COMPOUND;
1481 else if (aLevelStr == "compsolid" ||
1482 aLevelStr == "c")
1483 aShapeLevel = TopAbs_COMPSOLID;
1484 else if (aLevelStr == "solid" ||
1485 aLevelStr == "so")
1486 aShapeLevel = TopAbs_SOLID;
1487 else if (aLevelStr == "shell" ||
1488 aLevelStr == "sh")
1489 aShapeLevel = TopAbs_SHELL;
1490 else if (aLevelStr == "face" ||
1491 aLevelStr == "f")
1492 aShapeLevel = TopAbs_FACE;
1493 else if (aLevelStr == "wire" ||
1494 aLevelStr == "w")
1495 aShapeLevel = TopAbs_WIRE;
1496 else if (aLevelStr == "edge" ||
1497 aLevelStr == "e")
1498 aShapeLevel = TopAbs_EDGE;
1499 else if (aLevelStr == "vertex" ||
1500 aLevelStr == "v")
1501 aShapeLevel = TopAbs_VERTEX;
1502 else if (aLevelStr == "shape" ||
1503 aLevelStr == "s")
1504 aShapeLevel = TopAbs_SHAPE;
1505 else
1506 {
1507 std::cout << "Error: unknown shape type '" << theArgv[i] << "'\n";
1508 return 1;
1509 }
1510 }
9b1d4e7f 1511 else
1512 {
04232180 1513 std::cout << "Error: invalid syntax at " << anOpt << "\n" ;
9b1d4e7f 1514 return 1;
3e6a4cd0 1515 }
1516 }
1517
1518 // Apply all the recorded modifications
e837b3a2 1519 TopoDS_Shape aResult = aReShaper->Apply(aSource, aShapeLevel);
9b1d4e7f 1520 if ( aResult.IsNull() )
3e6a4cd0 1521 {
04232180 1522 std::cout << "Error: result shape is null\n";
3e6a4cd0 1523 return 1;
1524 }
1525
9b1d4e7f 1526 DBRep::Set(theArgv[1], aResult);
3e6a4cd0 1527 return 0;
1528}
1529
7fd59977 1530//=======================================================================
1531//function : InitCommands
1532//purpose :
1533//=======================================================================
1534
1535 void SWDRAW_ShapeUpgrade::InitCommands(Draw_Interpretor& theCommands)
1536{
1537 static Standard_Integer initactor = 0;
c48e2889 1538 if (initactor)
1539 {
1540 return;
1541 }
1542 initactor = 1;
7fd59977 1543
1544 Standard_CString g = SWDRAW::GroupName(); // "Tests of DivideTool";
1545
1546 theCommands.Add("DT_ShapeDivide",
1547 "DT_ShapeDivide Result Shape Tol: Divides shape with C1 Criterion",
1548 __FILE__,
1549 DT_ShapeDivide,g);
1550
1551 theCommands.Add("DT_SplitAngle",
1552 "DT_SplitAngle Result Shape [MaxAngle=95]: Divides revolved surfaces on segments less MaxAngle deg",
1553 __FILE__,
1554 DT_SplitAngle,g);
1555
1556 theCommands.Add("DT_ShapeConvert",
1557 "DT_ShapeConvert Result Shape convert2d convert3d: Converts curves to beziers",
1558 __FILE__,
1559 DT_ShapeConvert,g);
1560
1561 theCommands.Add("DT_ShapeConvertRev",
1562 "DT_ShapeConvert Result Shape convert2d convert3d: Converts curves to beziers",
1563 __FILE__,
1564 DT_ShapeConvertRev,g);
1565/* theCommands.Add("DT_PlaneDividedFace",
1566 "DT_PlaneDividedFace Result Face Tol: Transfer into a plane with boundary divided",
1567 __FILE__,
1568 DT_PlaneDividedFace,g);
1569
1570 theCommands.Add("DT_PlaneGridShell",
1571 "DT_PlaneGridShell Result NbU NbV {UKnots} {VKnots} Tol : Create a plane grid Shell",
1572 __FILE__,
1573 DT_PlaneGridShell,g);
1574
1575 theCommands.Add("DT_PlaneFaceCommon",
1576 "DT_PlaneFaceCommon Result Face Shell: Common between a plane Face and a Shell",
1577 __FILE__,
1578 DT_PlaneFaceCommon,g);*/
1579
1580 theCommands.Add("DT_SplitCurve2d",
1581 "DT_SplitCurve2d Curve Tol: Splits the curve with C1 criterion",
1582 __FILE__,
1583 DT_SplitCurve2d,g);
1584
1585 theCommands.Add("DT_SplitCurve",
1586 "DT_SplitCurve Curve Tol: Splits the curve with C1 criterion",
1587 __FILE__,
1588 DT_SplitCurve,g);
1589
1590 theCommands.Add("DT_SplitSurface",
1591 "DT_SplitSurface Result Surface/GridSurf Tol: Splits the surface with C1 criterion",
1592 __FILE__,
1593 DT_SplitSurface,g);
1594
1595 /*theCommands.Add("DT_SupportModification",
1596 "DT_SupportModification Result Shell Surface 2d3dFactor: Surface will support all the faces",
1597 __FILE__,
1598 DT_SupportModification,g);*/
1599
1600// theCommands.Add("DT_SpltWire","DT_SpltWire Result Wire Tol",
1601// __FILE__,DT_SplitWire,g);
1602
1603// theCommands.Add("DT_SplitFace", "DT_SplitFace Result Face Tol",
1604// __FILE__, DT_SplitFace,g);
1605
1606// theCommands.Add("DT_Debug", "DT_Debug 0/1 : activation/desactivation of the debug messages",
1607// __FILE__, DT_Debug,g);
1608// theCommands.Add ("shellsolid","option[a-b-c-f] shape result",
1609// __FILE__,shellsolid,g);
1610 theCommands.Add ("offset2dcurve","result curve offset",
1611 __FILE__,offset2dcurve,g);
1612
1613 theCommands.Add ("offsetcurve","result curve offset dir",
1614 __FILE__,offsetcurve,g);
1615
1616 theCommands.Add ("splitface","result face [u usplit1 usplit2...] [v vsplit1 vsplit2 ...]",
1617 __FILE__,splitface,g);
1618
1619 theCommands.Add ("DT_ToBspl","result shape [options=erop]",
1620 __FILE__,converttobspline,g);
1621 theCommands.Add ("DT_ClosedSplit","result shape",
1622 __FILE__,splitclosed,g);
1623 theCommands.Add ("DT_SplitByArea","result shape maxarea [preci]",
1624 __FILE__,splitarea,g);
1625
1626 theCommands.Add ("RemoveIntWires","result minarea wholeshape [faces or wires] [moderemoveface ]",
1627 __FILE__,removeinternalwires,g);
982a90fc 1628
15b2583e 1629 theCommands.Add ("removeloc","result shape [remove_level(see ShapeEnum)]",__FILE__,removeloc,g);
2277323d 1630
1631 theCommands.Add ("unifysamedom",
632175c3 1632 "unifysamedom result shape [s1 s2 ...] [-f] [-e] [-nosafe] [+b] [+i] [-t val] [-a val]",
1633 __FILE__,unifysamedom,g);
20aa0d3f 1634
982a90fc 1635 theCommands.Add ("copytranslate","result shape dx dy dz",__FILE__,copytranslate,g);
3e6a4cd0 1636
1637 theCommands.Add ("reshape",
e837b3a2 1638 "\n reshape : result shape [-replace what with] [-remove what] [-until level]"
3e6a4cd0 1639 "\n Basic utility for topological modification: "
1640 "\n '-replace what with' Replaces 'what' sub-shape with 'with' sub-shape"
1641 "\n '-remove what' Removes 'what' sub-shape"
e837b3a2 1642 "\n Requests '-replace' and '-remove' can be repeated many times."
1643 "\n '-until level' specifies level until which shape for replcement/removal"
1644 "\n will be searched.",
3e6a4cd0 1645 __FILE__, reshape, g);
7fd59977 1646}