Commit | Line | Data |
---|---|---|
b311480e | 1 | // Created on: 1994-12-13 |
2 | // Created by: Jacques GOUSSARD | |
3 | // Copyright (c) 1994-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. | |
7fd59977 | 16 | |
17 | #include <Standard_Stream.hxx> | |
18 | #include <Standard_Macro.hxx> | |
19 | ||
20 | #include <BRepTest.hxx> | |
21 | ||
22 | #include <DBRep.hxx> | |
23 | #include <Draw_Appli.hxx> | |
24 | #include <Draw_Interpretor.hxx> | |
25 | #include <Draw_Box.hxx> | |
26 | ||
27 | #include <BRepBuilderAPI.hxx> | |
28 | #include <BRepBuilderAPI_FindPlane.hxx> | |
29 | #include <BRepBuilderAPI_Copy.hxx> | |
30 | #include <BRepBuilderAPI_Transform.hxx> | |
31 | #include <BRepBuilderAPI_GTransform.hxx> | |
32 | #include <BRepBuilderAPI_NurbsConvert.hxx> | |
33 | #include <gp_Ax2.hxx> | |
34 | #include <gp_Mat.hxx> | |
35 | #include <gp_GTrsf.hxx> | |
36 | #include <BRepOffsetAPI_NormalProjection.hxx> | |
37 | #include <BRepLib.hxx> | |
38 | #include <BRep_Builder.hxx> | |
39 | #include <BRepBndLib.hxx> | |
40 | #include <Bnd_Box.hxx> | |
41 | #include <TopExp_Explorer.hxx> | |
42 | #include <TopoDS.hxx> | |
43 | #include <BRepTools_WireExplorer.hxx> | |
44 | ||
45 | #include <GCPnts_QuasiUniformAbscissa.hxx> | |
46 | #include <Geom2dAdaptor_Curve.hxx> | |
47 | #include <GeomAdaptor_Curve.hxx> | |
48 | #include <ProjLib_ComputeApproxOnPolarSurface.hxx> | |
49 | #include <DrawTrSurf.hxx> | |
c04c30b3 | 50 | #include <Geom_Plane.hxx> |
7fd59977 | 51 | |
52 | #include <Draw_Segment3D.hxx> | |
53 | #include <Draw_Marker3D.hxx> | |
54 | #include <Draw_MarkerShape.hxx> | |
55 | ||
7fd59977 | 56 | #include <stdio.h> |
57 | ||
58 | Standard_IMPORT Draw_Viewer dout; | |
59 | ||
60 | ||
61 | ||
62 | //======================================================================= | |
63 | // addpcurve | |
64 | //======================================================================= | |
65 | ||
66 | static Standard_Integer addpcurve(Draw_Interpretor& , Standard_Integer n, const char** a) | |
67 | { | |
68 | if(n < 4) return 1; | |
69 | TopoDS_Shape E = DBRep::Get(a[1]); | |
70 | if (E.IsNull()) return 1; | |
71 | Handle(Geom2d_Curve) PC = DrawTrSurf::GetCurve2d(a[2]); | |
72 | TopoDS_Shape F = DBRep::Get(a[3]); | |
73 | Standard_Real tol = 1.e-7; | |
74 | if (n > 4) { | |
91322f44 | 75 | tol = Draw::Atof(a[4]); |
7fd59977 | 76 | } |
77 | BRep_Builder BB; | |
78 | BB.UpdateEdge(TopoDS::Edge(E), PC, TopoDS::Face(F),tol); | |
79 | DBRep::Set(a[1], E); | |
80 | return 0; | |
81 | } | |
82 | ||
83 | ||
84 | //======================================================================= | |
85 | // transform | |
86 | //======================================================================= | |
87 | ||
867acdec | 88 | static Standard_Integer transform(Draw_Interpretor& ,Standard_Integer n,const char** a) |
7fd59977 | 89 | { |
90 | if (n <= 1) return 1; | |
91 | ||
92 | gp_Trsf T; | |
93 | Standard_Integer last = n; | |
513d3443 | 94 | const char* aName = a[0]; |
7fd59977 | 95 | |
513d3443 | 96 | Standard_Boolean isBasic = Standard_False; |
7fd59977 | 97 | |
513d3443 | 98 | if (!strcmp(aName,"reset")) { |
99 | } | |
100 | else { | |
101 | isBasic = (aName[0] == 'b'); | |
102 | aName++; | |
103 | ||
104 | if (!strcmp(aName,"move")) { | |
105 | if (n < 3) return 1; | |
106 | TopoDS_Shape SL = DBRep::Get(a[n-1]); | |
107 | if (SL.IsNull()) return 0; | |
108 | T = SL.Location().Transformation(); | |
109 | last = n-1; | |
110 | } | |
111 | else if (!strcmp(aName,"translate")) { | |
112 | if (n < 5) return 1; | |
113 | T.SetTranslation(gp_Vec(Draw::Atof(a[n-3]),Draw::Atof(a[n-2]),Draw::Atof(a[n-1]))); | |
114 | last = n-3; | |
115 | } | |
116 | else if (!strcmp(aName,"rotate")) { | |
117 | if (n < 9) return 1; | |
118 | T.SetRotation(gp_Ax1(gp_Pnt(Draw::Atof(a[n-7]),Draw::Atof(a[n-6]),Draw::Atof(a[n-5])), | |
119 | gp_Vec(Draw::Atof(a[n-4]),Draw::Atof(a[n-3]),Draw::Atof(a[n-2]))), | |
120 | Draw::Atof(a[n-1])* (M_PI / 180.0)); | |
121 | last = n-7; | |
122 | } | |
123 | else if (!strcmp(aName,"mirror")) { | |
124 | if (n < 8) return 1; | |
125 | T.SetMirror(gp_Ax2(gp_Pnt(Draw::Atof(a[n-6]),Draw::Atof(a[n-5]),Draw::Atof(a[n-4])), | |
126 | gp_Vec(Draw::Atof(a[n-3]),Draw::Atof(a[n-2]),Draw::Atof(a[n-1])))); | |
127 | last = n-6; | |
128 | } | |
129 | else if (!strcmp(aName,"scale")) { | |
130 | if (n < 6) return 1; | |
131 | T.SetScale(gp_Pnt(Draw::Atof(a[n-4]),Draw::Atof(a[n-3]),Draw::Atof(a[n-2])),Draw::Atof(a[n-1])); | |
132 | last = n-4; | |
133 | } | |
7fd59977 | 134 | } |
135 | ||
513d3443 | 136 | if (T.Form() == gp_Identity || isBasic) { |
137 | TopLoc_Location L(T); | |
7fd59977 | 138 | for (Standard_Integer i = 1; i < last; i++) { |
139 | TopoDS_Shape S = DBRep::Get(a[i]); | |
513d3443 | 140 | if (S.IsNull()) |
af65fb19 | 141 | { |
142 | std::cerr << "Error: " << a[i] << " is not a valid shape\n"; | |
143 | return 1; | |
144 | } | |
513d3443 | 145 | else |
146 | DBRep::Set(a[i],S.Located(L)); | |
7fd59977 | 147 | } |
148 | } | |
149 | else { | |
150 | BRepBuilderAPI_Transform trf(T); | |
151 | for (Standard_Integer i = 1; i < last; i++) { | |
152 | TopoDS_Shape S = DBRep::Get(a[i]); | |
153 | if (S.IsNull()) { | |
af65fb19 | 154 | std::cerr << "Error: " << a[i] << " is not a valid shape\n"; |
155 | return 1; | |
7fd59977 | 156 | } |
157 | else { | |
513d3443 | 158 | trf.Perform(S); |
159 | if (!trf.IsDone()) | |
160 | return 1; | |
161 | DBRep::Set(a[i],trf.Shape()); | |
7fd59977 | 162 | } |
163 | } | |
164 | } | |
165 | return 0; | |
166 | } | |
167 | ||
7fd59977 | 168 | ///======================================================================= |
169 | // gtransform | |
170 | //======================================================================= | |
171 | ||
172 | static Standard_Integer deform(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
173 | { | |
174 | if (n <= 1) return 1; | |
175 | ||
176 | Standard_Integer last = n; | |
177 | ||
178 | gp_Trsf T; | |
179 | gp_GTrsf GT(T); | |
180 | ||
91322f44 | 181 | // gp_Mat rot(Draw::Atof(a[last-3]),0,0,0,Draw::Atof(a[last-2]),0,0,0,Draw::Atof(a[last-1])); |
182 | gp_Mat rot(Draw::Atof(a[3]),0,0,0,Draw::Atof(a[4]),0,0,0,Draw::Atof(a[5])); | |
7fd59977 | 183 | GT.SetVectorialPart(rot); |
184 | last -= 3; | |
185 | BRepBuilderAPI_GTransform gtrf(GT); | |
186 | BRepBuilderAPI_NurbsConvert nbscv; | |
187 | // for (Standard_Integer i = 1; i < last; i++) { | |
188 | // TopoDS_Shape S = DBRep::Get(a[i]); | |
189 | TopoDS_Shape S = DBRep::Get(a[2]); | |
190 | if (S.IsNull()) { | |
191 | //cout << a[2] << " is not a valid shape" << endl; | |
586db386 | 192 | di << a[2] << " is not a valid shape\n"; |
7fd59977 | 193 | } |
194 | else { | |
195 | gtrf.Perform(S); | |
196 | if (gtrf.IsDone()){ | |
197 | DBRep::Set(a[1],gtrf.Shape()); | |
198 | } | |
199 | else { | |
200 | return 1; | |
201 | } | |
202 | } | |
203 | ||
204 | return 0; | |
205 | } | |
206 | ||
207 | //======================================================================= | |
208 | // tcopy | |
209 | //======================================================================= | |
210 | ||
211 | static Standard_Integer tcopy(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
212 | { | |
213 | Standard_Boolean copyGeom = Standard_True; | |
55e738d2 | 214 | Standard_Boolean copyMesh = Standard_False; |
7fd59977 | 215 | Standard_Integer iFirst = 1; // index of first shape argument |
216 | ||
55e738d2 | 217 | if (n > 1) |
7fd59977 | 218 | { |
55e738d2 | 219 | for (Standard_Integer i = 1; i <= 2; i++) |
220 | { | |
221 | if (a[i][0] != '-') | |
222 | break; | |
223 | if (a[i][1] == 'n') | |
224 | { | |
225 | copyGeom = Standard_False; | |
226 | iFirst++; | |
227 | } | |
228 | else if (a[i][1] == 'm') | |
229 | { | |
230 | copyMesh = Standard_True; | |
231 | iFirst++; | |
232 | } | |
233 | } | |
7fd59977 | 234 | } |
235 | ||
236 | if (n < 3 || (n - iFirst) % 2) { | |
55e738d2 | 237 | cout << "Use: " << a[0] << " [-n(ogeom)] [-m(esh)] shape1 copy1 [shape2 copy2 [...]]" << endl; |
238 | cout << "Option -n forbids copying of geometry (it will be shared)" << endl; | |
239 | cout << "Option -m forces copying of mesh (disabled by default)" << endl; | |
7fd59977 | 240 | return 1; |
241 | } | |
242 | ||
243 | BRepBuilderAPI_Copy cop; | |
244 | Standard_Integer nbPairs = (n - iFirst) / 2; | |
245 | for (Standard_Integer i=0; i < nbPairs; i++) { | |
55e738d2 | 246 | cop.Perform(DBRep::Get(a[i+iFirst]), copyGeom, copyMesh); |
7fd59977 | 247 | DBRep::Set(a[i+iFirst+1],cop.Shape()); |
248 | di << a[i+iFirst+1] << " "; | |
249 | } | |
250 | return 0; | |
251 | } | |
252 | ||
253 | ||
254 | //======================================================================= | |
255 | // NurbsConvert | |
256 | //======================================================================= | |
257 | ||
258 | static Standard_Integer nurbsconvert(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
259 | { | |
260 | if (n < 3) return 1; | |
261 | if ((n-1)%2 != 0) return 1; | |
262 | BRepBuilderAPI_NurbsConvert nbscv; | |
263 | for (Standard_Integer i=0; i<(n-1)/2; i++) { | |
264 | TopoDS_Shape S = DBRep::Get(a[2*i+2]); | |
265 | if (S.IsNull()) { | |
266 | //cout << a[2*i+2] << " is not a valid shape" << endl; | |
586db386 | 267 | di << a[2*i+2] << " is not a valid shape\n"; |
7fd59977 | 268 | } |
269 | else { | |
270 | nbscv.Perform(S); | |
271 | if (nbscv.IsDone()){ | |
272 | DBRep::Set(a[2*i+1],nbscv.Shape()); | |
273 | } | |
274 | else { | |
275 | return 1; | |
276 | } | |
277 | } | |
278 | } | |
279 | ||
280 | return 0; | |
281 | ||
282 | } | |
283 | ||
284 | //======================================================================= | |
285 | // make a 3D edge curve | |
286 | //======================================================================= | |
287 | ||
288 | static Standard_Integer mkedgecurve (Draw_Interpretor& ,Standard_Integer n,const char** a) | |
289 | { | |
290 | ||
7fd59977 | 291 | if (n < 3) return 1; |
91322f44 | 292 | Standard_Real Tolerance = Draw::Atof(a[2]) ; |
7fd59977 | 293 | |
294 | TopoDS_Shape S = DBRep::Get(a[1]); | |
295 | ||
296 | if (S.IsNull()) return 1; | |
297 | ||
7fd59977 | 298 | BRepLib::BuildCurves3d(S, |
299 | Tolerance) ; | |
300 | return 0 ; | |
301 | } | |
302 | ||
303 | //======================================================================= | |
304 | // sameparameter | |
305 | //======================================================================= | |
306 | ||
307 | static Standard_Integer sameparameter(Draw_Interpretor& ,Standard_Integer n,const char** a) | |
308 | { | |
309 | if (n < 2) return 1; | |
310 | Standard_Real tol = 1.e-7; | |
311 | TopoDS_Shape S = DBRep::Get(a[1]); | |
312 | if (S.IsNull()) return 1; | |
313 | Standard_Boolean force = !strcmp(a[0],"fsameparameter"); | |
91322f44 | 314 | if (n == 3) tol = Draw::Atof(a[2]); |
7fd59977 | 315 | |
316 | BRepLib::SameParameter(S,tol,force); | |
317 | ||
318 | DBRep::Set(a[1],S); | |
319 | return 0; | |
320 | } | |
321 | //======================================================================= | |
322 | //function : updatetol | |
323 | //purpose : | |
324 | //======================================================================= | |
325 | static Standard_Integer updatetol(Draw_Interpretor& ,Standard_Integer n,const char** a) | |
326 | { | |
327 | if (n < 2) return 1; | |
328 | ||
329 | TopoDS_Shape S = DBRep::Get(a[1]); | |
330 | if (S.IsNull()) return 1; | |
331 | ||
332 | if (n==2) BRepLib::UpdateTolerances(S); | |
333 | else BRepLib::UpdateTolerances(S,Standard_True); | |
334 | DBRep::Set(a[1],S); | |
335 | return 0; | |
336 | ||
337 | } | |
338 | ||
339 | //======================================================================= | |
340 | //function : OrienSolid | |
341 | //purpose : | |
342 | //======================================================================= | |
343 | static Standard_Integer orientsolid(Draw_Interpretor& ,Standard_Integer n,const char** a) | |
344 | { | |
345 | if (n < 2) return 1; | |
346 | ||
347 | TopoDS_Shape S = DBRep::Get(a[1]); | |
348 | if (S.IsNull()) return 1; | |
349 | if (S.ShapeType()!=TopAbs_SOLID) return 1; | |
350 | ||
351 | BRepLib::OrientClosedSolid(TopoDS::Solid(S)); | |
352 | ||
353 | DBRep::Set(a[1],S); | |
354 | return 0; | |
355 | ||
356 | } | |
357 | ||
358 | //======================================================================= | |
359 | //function : boundingstr | |
360 | //purpose : | |
361 | //======================================================================= | |
362 | static Standard_Integer boundingstr(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
363 | { | |
364 | if (n < 2) return 1; | |
365 | TopoDS_Shape S = DBRep::Get(a[1]); | |
366 | if (S.IsNull()) return 1; | |
367 | Bnd_Box B; | |
368 | BRepBndLib::Add(S,B); | |
369 | Standard_Real axmin,aymin,azmin,axmax,aymax,azmax; | |
370 | B.Get(axmin,aymin,azmin,axmax,aymax,azmax); | |
371 | di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax; | |
372 | if (n >= 8) { | |
373 | Draw::Set(a[2],axmin) ; | |
374 | Draw::Set(a[3],aymin) ; | |
375 | Draw::Set(a[4],azmin) ; | |
376 | Draw::Set(a[5],axmax) ; | |
377 | Draw::Set(a[6],aymax) ; | |
378 | Draw::Set(a[7],azmax) ; | |
379 | } | |
380 | return 0; | |
381 | } | |
382 | ||
9f6931fb | 383 | //======================================================================= |
384 | //function : getcoords | |
385 | //purpose : | |
386 | //======================================================================= | |
387 | static Standard_Integer getcoords(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
388 | { | |
389 | if(n < 2) | |
390 | return 1; | |
391 | ||
392 | for (Standard_Integer i = 1; i < n; i++) | |
393 | { | |
394 | const TopoDS_Shape aShape = DBRep::Get (a[i]); | |
395 | ||
396 | if (aShape.IsNull()) | |
397 | continue; | |
398 | ||
399 | if (aShape.ShapeType() == TopAbs_VERTEX) | |
400 | { | |
401 | const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape); | |
402 | gp_Pnt aPnt = BRep_Tool::Pnt(aVertex); | |
403 | ||
404 | di << a[i] << " (x,y,z) : " << aPnt.X() << " " << aPnt.Y() << " " << aPnt.Z() << "\n"; | |
405 | } | |
406 | } | |
407 | ||
408 | return 0; | |
409 | } | |
410 | ||
7fd59977 | 411 | //======================================================================= |
412 | //function : bounding | |
413 | //purpose : | |
414 | //======================================================================= | |
415 | static Standard_Integer bounding(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
416 | { | |
417 | if (n < 2) return 1; | |
418 | Standard_Real axmin,aymin,azmin,axmax,aymax,azmax; | |
419 | Bnd_Box B; Handle(Draw_Box) DB; | |
420 | ||
421 | if (n == 2) { | |
422 | TopoDS_Shape S = DBRep::Get(a[1]); | |
423 | if (S.IsNull()) return 1; | |
424 | BRepBndLib::Add(S,B); | |
425 | B.Get(axmin,aymin,azmin,axmax,aymax,azmax); | |
426 | DB = new Draw_Box(gp_Pnt(axmin,aymin,azmin),gp_Pnt(axmax,aymax,azmax),Draw_orange); | |
427 | dout<<DB; | |
428 | di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax; | |
429 | } | |
430 | else if (n == 7) { | |
91322f44 | 431 | axmin=Draw::Atof(a[1]); |
432 | aymin=Draw::Atof(a[2]); | |
433 | azmin=Draw::Atof(a[3]); | |
434 | axmax=Draw::Atof(a[4]); | |
435 | aymax=Draw::Atof(a[5]); | |
436 | azmax=Draw::Atof(a[6]); | |
7fd59977 | 437 | DB = new Draw_Box(gp_Pnt(axmin,aymin,azmin),gp_Pnt(axmax,aymax,azmax),Draw_orange); |
438 | dout<<DB; | |
439 | } | |
440 | return 0; | |
441 | } | |
442 | //======================================================================= | |
3ba87fdb | 443 | //function : optbounding |
444 | //purpose : | |
445 | //======================================================================= | |
446 | static Standard_Integer optbounding(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
447 | { | |
448 | if (n < 2) | |
449 | { | |
450 | di << "Usage: optbounding shape [usetri [usetol]]\n"; | |
451 | di << "usetri and usetol can be 0 or 1, by default usetri = 1, usetol = 0\n"; | |
452 | return 1; | |
453 | } | |
454 | Standard_Real axmin,aymin,azmin,axmax,aymax,azmax; | |
455 | Bnd_Box B; Handle(Draw_Box) DB; | |
456 | ||
457 | TopoDS_Shape S = DBRep::Get(a[1]); | |
458 | if (S.IsNull()) | |
459 | { | |
460 | di << "Null shape\n"; | |
461 | return 1; | |
462 | } | |
463 | Standard_Boolean useTri = Standard_True; | |
464 | Standard_Boolean useTol = Standard_False; | |
465 | if(n > 2 ) | |
466 | { | |
467 | Standard_Integer ii = atoi(a[2]); | |
468 | useTri = ii > 0; | |
469 | } | |
470 | if(n > 3 ) | |
471 | { | |
472 | Standard_Integer ii = atoi(a[3]); | |
473 | useTol = ii > 0; | |
474 | } | |
475 | BRepBndLib::AddOptimal(S, B, useTri, useTol); | |
476 | B.Get(axmin, aymin, azmin, axmax, aymax, azmax); | |
477 | DB = new Draw_Box(gp_Pnt(axmin,aymin,azmin),gp_Pnt(axmax,aymax,azmax),Draw_vert); | |
478 | dout<<DB; | |
479 | di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax; | |
480 | return 0; | |
481 | } | |
482 | //======================================================================= | |
483 | //function : gbounding | |
484 | //purpose : | |
485 | //======================================================================= | |
486 | #include <GeomAdaptor_Surface.hxx> | |
487 | #include <BndLib_AddSurface.hxx> | |
488 | #include <BndLib_Add3dCurve.hxx> | |
489 | static Standard_Integer gbounding(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
490 | { | |
491 | if (n < 2) | |
492 | { | |
493 | di << "Usage: gbounding surf/curve \n"; | |
494 | return 1; | |
495 | } | |
496 | Standard_Real axmin,aymin,azmin,axmax,aymax,azmax; | |
497 | Bnd_Box B; Handle(Draw_Box) DB; | |
498 | ||
499 | if (n == 2) { | |
500 | Handle(Geom_Curve) C; | |
501 | Handle(Geom_Surface) S; | |
502 | S = DrawTrSurf::GetSurface(a[1]); | |
503 | if (S.IsNull()) | |
504 | { | |
505 | C = DrawTrSurf::GetCurve(a[1]); | |
506 | } | |
507 | if(!S.IsNull()) | |
508 | { | |
509 | GeomAdaptor_Surface aGAS(S); | |
510 | BndLib_AddSurface::AddOptimal(aGAS, Precision::Confusion(), B); | |
511 | } | |
512 | else if(!C.IsNull()) | |
513 | { | |
514 | GeomAdaptor_Curve aGAC(C); | |
515 | BndLib_Add3dCurve::AddOptimal(aGAC, Precision::Confusion(), B); | |
516 | } | |
517 | else | |
518 | { | |
519 | di << "Wrong argument \n"; | |
520 | return 1; | |
521 | } | |
522 | B.Get(axmin,aymin,azmin,axmax,aymax,azmax); | |
523 | DB = new Draw_Box(gp_Pnt(axmin,aymin,azmin),gp_Pnt(axmax,aymax,azmax),Draw_vert); | |
524 | dout<<DB; | |
525 | di << axmin<<" "<< aymin<<" "<< azmin<<" "<< axmax<<" "<< aymax<<" "<< azmax; | |
526 | } | |
527 | return 0; | |
528 | }//======================================================================= | |
7fd59977 | 529 | //function : findplane |
530 | //purpose : | |
531 | //======================================================================= | |
532 | static Standard_Integer findplane(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
533 | { | |
534 | if (n < 3) return 1; | |
535 | TopoDS_Shape S = DBRep::Get(a[1]); | |
536 | if (S.IsNull()) return 1; | |
537 | Standard_Real tolerance = 1.0e-5 ; | |
538 | BRepBuilderAPI_FindPlane a_plane_finder(S, | |
539 | tolerance) ; | |
540 | if (a_plane_finder.Found()) { | |
541 | //cout << " a plane is found " ; | |
542 | di << " a plane is found \n"; | |
543a9964 | 543 | const Handle(Geom_Geometry)& aSurf = a_plane_finder.Plane(); // to avoid ambiguity |
544 | DrawTrSurf::Set(a[2],aSurf) ; | |
7fd59977 | 545 | } |
546 | return 0 ; | |
547 | } | |
548 | //======================================================================= | |
549 | //function : precision | |
550 | //purpose : | |
551 | //======================================================================= | |
552 | ||
553 | static Standard_Integer precision(Draw_Interpretor& di,Standard_Integer n,const char** a) | |
554 | { | |
555 | n--; | |
556 | ||
557 | if ( n == 0) { | |
558 | //cout << " Current Precision = " << BRepBuilderAPI::Precision() << endl; | |
559 | di << " Current Precision = " << BRepBuilderAPI::Precision() << "\n"; | |
560 | } | |
561 | else { | |
91322f44 | 562 | BRepBuilderAPI::Precision(Draw::Atof(a[1])); |
7fd59977 | 563 | } |
564 | return 0; | |
565 | } | |
566 | ||
567 | ||
568 | //======================================================================= | |
569 | //function : reperage shape (Int lin Shape) + pointe double click + maxtol | |
570 | //purpose : | |
571 | //======================================================================= | |
572 | #include <IntCurvesFace_ShapeIntersector.hxx> | |
573 | #include <gp_Lin.hxx> | |
574 | ||
575 | static Standard_Integer reperageshape(Draw_Interpretor& di, Standard_Integer narg , const char** a) | |
576 | { | |
577 | Standard_Integer details=0; | |
578 | if(narg<2) return 1; | |
579 | if(narg==3) details=1; | |
580 | const char *id1 = a[1]; | |
581 | TopoDS_Shape TheShape1 = DBRep::Get(id1); | |
582 | ||
583 | //cout << "Pick positions with button "<<endl; | |
586db386 | 584 | di << "Pick positions with button \n"; |
7fd59977 | 585 | Standard_Integer id,X,Y,b; |
586 | gp_Trsf T; | |
587 | gp_Pnt P1,P2; | |
588 | dout.Select(id,X,Y,b); | |
589 | ||
590 | dout.GetTrsf(id,T); | |
591 | T.Invert(); | |
592 | Standard_Real z = dout.Zoom(id); | |
593 | P2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z, 0.0); | |
594 | P2.Transform(T); | |
595 | P1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,-1.0); | |
596 | P1.Transform(T); | |
597 | ||
598 | ||
599 | gp_Ax1 Axe(P1,gp_Vec(P1,P2)); | |
600 | IntCurvesFace_ShapeIntersector Inter; | |
601 | Inter.Load(TheShape1,1e-7); | |
602 | ||
603 | Inter.Perform(Axe,-RealLast(),RealLast()); | |
604 | ||
605 | //cout<<"\n --> "; | |
606 | di <<"\n --> "; | |
607 | if(Inter.NbPnt()) { | |
608 | for(Standard_Integer i=1; i<=Inter.NbPnt(); i++) { | |
609 | Standard_Integer numface=1; | |
610 | TopExp_Explorer ExF; | |
611 | for(ExF.Init(TheShape1,TopAbs_FACE); | |
612 | ExF.More(); | |
613 | ExF.Next(),numface++) { | |
614 | TopoDS_Face Face=TopoDS::Face(ExF.Current()); | |
615 | if(Face.IsEqual(Inter.Face(i))) { | |
616 | //cout<<" "<<a[1]<<"_"<<numface; | |
617 | di<<" "<<a[1]<<"_"<<numface; | |
618 | continue; | |
619 | } | |
620 | } | |
621 | const gp_Pnt& P = Inter.Pnt(i); | |
622 | Standard_Real PMin = Inter.WParameter(i); | |
623 | if(details) { | |
624 | //cout<<" w:"<<PMin<<endl; | |
625 | di<<" w:"<<PMin<< "\n"; | |
626 | } | |
627 | if(Inter.Transition(i) == IntCurveSurface_In) { | |
628 | if(Inter.State(i) == TopAbs_IN) { | |
629 | Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_Square, Draw_rouge,2); | |
630 | dout << p; dout.Flush(); | |
631 | } | |
632 | else if(Inter.State(i) == TopAbs_ON) { | |
633 | Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_Square, Draw_vert,2); | |
634 | dout << p; dout.Flush(); | |
635 | } | |
636 | } | |
637 | else { | |
638 | if(Inter.Transition(i) == IntCurveSurface_Out) { | |
639 | if(Inter.State(i) == TopAbs_IN) { | |
640 | Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_X, Draw_rouge,2); | |
641 | dout << p; dout.Flush(); | |
642 | } | |
643 | else if(Inter.State(i) == TopAbs_ON) { | |
644 | Handle(Draw_Marker3D) p = new Draw_Marker3D(P, Draw_X, Draw_vert,2); | |
645 | dout << p; dout.Flush(); | |
646 | } | |
647 | } | |
648 | } | |
649 | } | |
650 | } | |
651 | //cout<<endl; | |
652 | di << "\n"; | |
653 | return(0); | |
654 | } | |
655 | ||
656 | ||
657 | static Standard_Integer maxtolerance(Draw_Interpretor& theCommands, | |
658 | Standard_Integer n, const char** a) { | |
659 | if(n<2) return(1); | |
660 | TopoDS_Shape TheShape = DBRep::Get(a[1]); | |
661 | if(TheShape.IsNull()) return(1); | |
662 | ||
663 | Standard_Real T,TMF,TME,TMV,TmF,TmE,TmV; | |
664 | Standard_Integer nbF,nbE,nbV; | |
665 | TMF=TME=TMV=-RealLast(); | |
666 | TmF=TmE=TmV=RealLast(); | |
581971fe | 667 | |
668 | TopTools_MapOfShape mapS; | |
669 | mapS.Clear(); | |
7fd59977 | 670 | |
581971fe | 671 | for(TopExp_Explorer ex(TheShape,TopAbs_FACE); |
672 | ex.More(); | |
673 | ex.Next()) { | |
674 | TopoDS_Face Face=TopoDS::Face(ex.Current()); | |
7fd59977 | 675 | T=BRep_Tool::Tolerance(Face); |
676 | if(T>TMF) TMF=T; | |
677 | if(T<TmF) TmF=T; | |
581971fe | 678 | mapS.Add(Face); |
7fd59977 | 679 | } |
581971fe | 680 | |
681 | nbF = mapS.Extent(); | |
682 | mapS.Clear(); | |
683 | ||
684 | for(TopExp_Explorer ex(TheShape,TopAbs_EDGE); | |
685 | ex.More(); | |
686 | ex.Next()) { | |
687 | TopoDS_Edge Edge=TopoDS::Edge(ex.Current()); | |
7fd59977 | 688 | T=BRep_Tool::Tolerance(Edge); |
689 | if(T>TME) TME=T; | |
690 | if(T<TmE) TmE=T; | |
581971fe | 691 | mapS.Add(Edge); |
7fd59977 | 692 | } |
581971fe | 693 | |
694 | nbE = mapS.Extent(); | |
695 | mapS.Clear(); | |
696 | ||
697 | for(TopExp_Explorer ex(TheShape,TopAbs_VERTEX); | |
698 | ex.More(); | |
699 | ex.Next()) { | |
700 | TopoDS_Vertex Vertex=TopoDS::Vertex(ex.Current()); | |
7fd59977 | 701 | T=BRep_Tool::Tolerance(Vertex); |
702 | if(T>TMV) TMV=T; | |
703 | if(T<TmV) TmV=T; | |
581971fe | 704 | mapS.Add(Vertex); |
7fd59977 | 705 | } |
7fd59977 | 706 | |
581971fe | 707 | nbV = mapS.Extent(); |
708 | ||
7fd59977 | 709 | Standard_SStream sss; |
710 | sss << "\n## Tolerances on the shape " << a[1] << " (nbFaces:" << nbF | |
711 | << " nbEdges:" << nbE << " nbVtx:" << nbV << ")\n" ; | |
712 | sss.precision(5); | |
713 | sss.setf(ios::scientific); | |
714 | if(TmF<=TMF) sss << "\n Face : Min " << setw(8) << TmF <<" Max " << setw(8) << TMF << " \n "; | |
715 | if(TmE<=TME) sss << "\n Edge : Min " << setw(8) << TmE <<" Max " << setw(8) << TME << " \n "; | |
716 | if(TmV<=TMV) sss << "\n Vertex : Min " << setw(8) << TmV <<" Max " << setw(8) << TMV << " \n "; | |
717 | theCommands << sss; | |
57c28b61 | 718 | |
581971fe | 719 | return 0; |
7fd59977 | 720 | } |
721 | ||
722 | ||
723 | static Standard_Integer vecdc(Draw_Interpretor& di,Standard_Integer ,const char** ) { | |
724 | //cout << "Pick positions with button "<<endl; | |
586db386 | 725 | di << "Pick positions with button \n"; |
7fd59977 | 726 | |
727 | Standard_Integer id,X,Y,b; | |
728 | gp_Trsf T; | |
729 | gp_Pnt P1,P2,PP1,PP2; | |
730 | ||
731 | //----------------------------------------------------------- | |
732 | dout.Select(id,X,Y,b); dout.GetTrsf(id,T); | |
733 | T.Invert(); | |
734 | Standard_Real z = dout.Zoom(id); | |
735 | P1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0); | |
736 | P1.Transform(T); | |
737 | ||
738 | dout.Select(id,X,Y,b); dout.GetTrsf(id,T); | |
739 | T.Invert(); z = dout.Zoom(id); | |
740 | ||
741 | P2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0); | |
742 | P2.Transform(T); | |
743 | Standard_Real xa,ya,za; | |
744 | if(Abs(P1.X())>Abs(P2.X())) xa = P1.X(); else xa = P2.X(); | |
745 | if(Abs(P1.Y())>Abs(P2.Y())) ya = P1.Y(); else ya = P2.Y(); | |
746 | if(Abs(P1.Z())>Abs(P2.Z())) za = P1.Z(); else za = P2.Z(); | |
747 | P1.SetCoord(xa,ya,za); | |
748 | Handle(Draw_Marker3D) D0 = new Draw_Marker3D(gp_Pnt(P1.X(), | |
749 | P1.Y(), | |
750 | P1.Z()), | |
751 | Draw_Square,Draw_blanc,1); | |
752 | ||
753 | dout << D0; | |
754 | dout.Flush(); | |
755 | //----------------------------------------------------------- | |
756 | dout.Select(id,X,Y,b); | |
757 | dout.GetTrsf(id,T); | |
758 | T.Invert(); | |
759 | z = dout.Zoom(id); | |
760 | PP1.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0); | |
761 | PP1.Transform(T); | |
762 | dout.Select(id,X,Y,b); | |
763 | dout.GetTrsf(id,T); | |
764 | T.Invert(); | |
765 | z = dout.Zoom(id); | |
766 | PP2.SetCoord((Standard_Real)X /z,(Standard_Real)Y /z,0.0); | |
767 | PP2.Transform(T); | |
768 | if(Abs(PP1.X())>Abs(PP2.X())) xa = PP1.X(); else xa = PP2.X(); | |
769 | if(Abs(PP1.Y())>Abs(PP2.Y())) ya = PP1.Y(); else ya = PP2.Y(); | |
770 | if(Abs(PP1.Z())>Abs(PP2.Z())) za = PP1.Z(); else za = PP2.Z(); | |
771 | PP1.SetCoord(xa,ya,za); | |
772 | Handle(Draw_Segment3D) d = new Draw_Segment3D(P1,PP1,Draw_blanc); | |
773 | dout << d; | |
774 | dout.Flush(); | |
775 | //cout<<"\nttran "<<PP1.X()-P1.X()<<" "<<PP1.Y()-P1.Y()<<" "<<PP1.Z()-P1.Z()<<endl; | |
776 | di <<"\nttran "<<PP1.X()-P1.X()<<" "<<PP1.Y()-P1.Y()<<" "<<PP1.Z()-P1.Z()<< "\n"; | |
777 | ||
778 | static Standard_Integer nboxvecdp=0; | |
779 | //cout<<"\nbox b"<<++nboxvecdp<<" "<<Min(P1.X(),PP1.X())<<" "<<Min(P1.Y(),PP1.Y())<<" "<<Min(PP1.Z(),P1.Z()); | |
780 | //cout<<" "<<Abs(PP1.X()-P1.X())<<" "<<Abs(PP1.Y()-P1.Y())<<" "<<Abs(PP1.Z()-P1.Z())<<endl; | |
781 | ||
782 | //cout<<"\nDistance :"<<sqrt( (PP1.X()-P1.X())*(PP1.X()-P1.X()) | |
783 | // +(PP1.Y()-P1.Y())*(PP1.Y()-P1.Y()) | |
784 | // +(PP1.Z()-P1.Z())*(PP1.Z()-P1.Z()))<<endl; | |
785 | ||
786 | di <<"\nbox b"<<++nboxvecdp<<" "<<Min(P1.X(),PP1.X())<<" "<<Min(P1.Y(),PP1.Y())<<" "<<Min(PP1.Z(),P1.Z()); | |
787 | di <<" "<<Abs(PP1.X()-P1.X())<<" "<<Abs(PP1.Y()-P1.Y())<<" "<<Abs(PP1.Z()-P1.Z())<< "\n"; | |
788 | ||
789 | di <<"\nDistance :"<<sqrt( (PP1.X()-P1.X())*(PP1.X()-P1.X()) | |
790 | +(PP1.Y()-P1.Y())*(PP1.Y()-P1.Y()) | |
791 | +(PP1.Z()-P1.Z())*(PP1.Z()-P1.Z()))<< "\n"; | |
792 | return(0); | |
793 | } | |
794 | //======================================================================= | |
795 | // nproject | |
796 | //======================================================================= | |
797 | ||
798 | #include <TopTools_SequenceOfShape.hxx> | |
799 | static Standard_Integer nproject(Draw_Interpretor& di, Standard_Integer n, const char** a) | |
800 | { | |
801 | if ( n < 4) return 1; | |
802 | TopoDS_Shape InpShape; | |
803 | Standard_Integer arg = 2, i; | |
804 | TopTools_SequenceOfShape Args; | |
805 | ||
806 | Standard_Real Tol = 1.e-4; | |
807 | Standard_Real Tol2d; | |
808 | Standard_Real MaxDistance = 1.e-3; | |
809 | GeomAbs_Shape Continuity = GeomAbs_C2; | |
810 | Standard_Integer MaxDeg = 14; | |
811 | Standard_Integer MaxSeg = 16; | |
812 | ||
813 | while((n > arg) && !(InpShape = DBRep::Get(a[arg])).IsNull()){ | |
814 | Args.Append(InpShape); | |
815 | arg++; | |
816 | } | |
817 | if(Args.Length() < 2) return 1; | |
818 | ||
819 | BRepOffsetAPI_NormalProjection OrtProj(Args.Last()); | |
820 | ||
821 | for(i = 1; i < Args.Length(); i++) | |
822 | OrtProj.Add(Args(i)); | |
823 | ||
824 | if(n > arg) | |
825 | if (!strcmp(a[arg],"-g")) { | |
826 | OrtProj.SetLimit(Standard_False); | |
827 | arg++; | |
828 | } | |
829 | ||
830 | if(n > arg) | |
831 | if (!strcmp(a[arg],"-d")) { | |
832 | arg++; | |
833 | if(n > arg) | |
91322f44 | 834 | MaxDistance = Draw::Atof(a[arg++]); |
7fd59977 | 835 | OrtProj.SetMaxDistance(MaxDistance); |
836 | } | |
837 | if(n > arg) { | |
91322f44 | 838 | Tol = Max(Draw::Atof(a[arg++]),1.e-10); |
7fd59977 | 839 | } |
840 | ||
841 | if(n > arg) { | |
91322f44 | 842 | if (Draw::Atoi(a[arg]) == 0) Continuity = GeomAbs_C0; |
843 | else if (Draw::Atoi(a[arg]) == 1) Continuity = GeomAbs_C1; | |
7fd59977 | 844 | arg++; |
845 | } | |
846 | ||
847 | ||
848 | if(n > arg) { | |
91322f44 | 849 | MaxDeg = Draw::Atoi(a[arg++]); |
7fd59977 | 850 | if (MaxDeg<1 || MaxDeg>14) MaxDeg = 14; |
851 | } | |
852 | ||
91322f44 | 853 | if(n > arg) MaxSeg = Draw::Atoi(a[arg]); |
7fd59977 | 854 | |
855 | Tol2d = Pow(Tol, 2./3); | |
856 | ||
857 | OrtProj.SetParams(Tol, Tol2d, Continuity, MaxDeg, MaxSeg); | |
858 | OrtProj.Build(); | |
859 | TopTools_ListOfShape Wire; | |
860 | Standard_Boolean IsWire=OrtProj.BuildWire(Wire); | |
861 | if (IsWire) { | |
862 | //cout << " BuildWire OK " << endl; | |
586db386 | 863 | di << " BuildWire OK \n"; |
7fd59977 | 864 | } |
865 | DBRep::Set(a[1], OrtProj.Shape()); | |
866 | return 0; | |
867 | } | |
868 | ||
869 | //========================================================================== | |
870 | //function : wexplo | |
0d969553 | 871 | // exploration of a wire |
7fd59977 | 872 | //========================================================================== |
873 | static Standard_Integer wexplo (Draw_Interpretor&, | |
874 | Standard_Integer argc, const char** argv) | |
875 | { | |
876 | char name[100]; | |
877 | if (argc < 2) return 1; | |
878 | ||
879 | TopoDS_Shape C1 = DBRep::Get (argv[1],TopAbs_WIRE); | |
880 | TopoDS_Shape C2 ; | |
881 | ||
882 | if (argc > 2) C2 = DBRep::Get (argv[2],TopAbs_FACE); | |
883 | ||
884 | if (C1.IsNull()) return 1; | |
885 | ||
886 | BRepTools_WireExplorer we; | |
887 | if (C2.IsNull()) we.Init(TopoDS::Wire(C1)); | |
888 | else we.Init(TopoDS::Wire(C1),TopoDS::Face(C2)); | |
889 | ||
890 | Standard_Integer k = 1; | |
891 | while (we.More()) { | |
892 | TopoDS_Edge E = we.Current(); | |
91322f44 | 893 | Sprintf(name,"WEDGE_%d",k); |
7fd59977 | 894 | DBRep::Set(name,E); |
895 | we.Next(); | |
896 | k++; | |
897 | } | |
898 | ||
899 | return 0; | |
900 | } | |
901 | ||
35e08fe8 | 902 | static Standard_Integer scalexyz(Draw_Interpretor& /*di*/, Standard_Integer n, const char** a) |
86eff19e J |
903 | { |
904 | if (n < 6) return 1; | |
7fd59977 | 905 | |
86eff19e J |
906 | TopoDS_Shape aShapeBase = DBRep::Get(a[2]); |
907 | if (aShapeBase.IsNull()) return 1; | |
908 | ||
91322f44 | 909 | Standard_Real aFactorX = Draw::Atof(a[3]); |
910 | Standard_Real aFactorY = Draw::Atof(a[4]); | |
911 | Standard_Real aFactorZ = Draw::Atof(a[5]); | |
86eff19e J |
912 | |
913 | gp_GTrsf aGTrsf; | |
914 | gp_Mat rot (aFactorX, 0, 0, | |
915 | 0, aFactorY, 0, | |
916 | 0, 0, aFactorZ); | |
917 | aGTrsf.SetVectorialPart(rot); | |
918 | BRepBuilderAPI_GTransform aBRepGTrsf (aShapeBase, aGTrsf, Standard_False); | |
919 | if (!aBRepGTrsf.IsDone()) | |
920 | Standard_ConstructionError::Raise("Scaling not done"); | |
921 | TopoDS_Shape Result = aBRepGTrsf.Shape(); | |
922 | ||
923 | DBRep::Set(a[1], Result); | |
924 | return 0; | |
925 | } | |
7fd59977 | 926 | |
927 | void BRepTest::BasicCommands(Draw_Interpretor& theCommands) | |
928 | { | |
929 | static Standard_Boolean done = Standard_False; | |
930 | if (done) return; | |
931 | done = Standard_True; | |
932 | ||
933 | DBRep::BasicCommands(theCommands); | |
934 | ||
935 | const char* g = "TOPOLOGY Basic shape commands"; | |
936 | ||
937 | theCommands.Add("addpcurve", | |
938 | "addpcurve edge 2dcurve face [tol (default 1.e-7)]", | |
939 | __FILE__, | |
940 | addpcurve,g); | |
941 | ||
942 | theCommands.Add("reset", | |
513d3443 | 943 | "reset name1 name2 ..., remove location", |
7fd59977 | 944 | __FILE__, |
945 | transform,g); | |
946 | ||
947 | theCommands.Add("tmove", | |
513d3443 | 948 | "tmove name1 name2 ... name, set location from name", |
7fd59977 | 949 | __FILE__, |
950 | transform,g); | |
951 | ||
952 | theCommands.Add("ttranslate", | |
513d3443 | 953 | "ttranslate name1 name2 ... dx dy dz", |
7fd59977 | 954 | __FILE__, |
955 | transform,g); | |
956 | ||
513d3443 | 957 | theCommands.Add("trotate", |
958 | "trotate name1 name2 ... x y z dx dy dz angle", | |
7fd59977 | 959 | __FILE__, |
960 | transform,g); | |
961 | ||
962 | theCommands.Add("tmirror", | |
963 | "tmirror name x y z dx dy dz", | |
964 | __FILE__, | |
965 | transform,g); | |
966 | ||
967 | theCommands.Add("tscale", | |
513d3443 | 968 | "tscale name x y z scale", |
7fd59977 | 969 | __FILE__, |
970 | transform,g); | |
971 | ||
972 | theCommands.Add("tcopy", | |
55e738d2 | 973 | "tcopy [-n(ogeom)] [-m(esh)] name1 result1 [name2 result2 ...]", |
7fd59977 | 974 | __FILE__, |
975 | tcopy,g); | |
976 | ||
513d3443 | 977 | theCommands.Add("bmove", |
978 | "bmove name1 name2 ... name, set location from name", | |
979 | __FILE__, | |
980 | transform,g); | |
981 | ||
982 | theCommands.Add("btranslate", | |
983 | "btranslate name1 name2 ... dx dy dz", | |
984 | __FILE__, | |
985 | transform,g); | |
986 | ||
987 | theCommands.Add("brotate", | |
988 | "brotate name1 name2 ... x y z dx dy dz angle", | |
989 | __FILE__, | |
990 | transform,g); | |
991 | ||
992 | theCommands.Add("bmirror", | |
993 | "bmirror name x y z dx dy dz", | |
994 | __FILE__, | |
995 | transform,g); | |
996 | ||
997 | theCommands.Add("bscale", | |
998 | "bscale name x y z scale", | |
999 | __FILE__, | |
1000 | transform,g); | |
1001 | ||
7fd59977 | 1002 | theCommands.Add("precision", |
1003 | "precision [preci]", | |
1004 | __FILE__, | |
1005 | precision,g); | |
1006 | ||
1007 | theCommands.Add("mkedgecurve", | |
1008 | "mkedgecurve name tolerance", | |
1009 | __FILE__, | |
1010 | mkedgecurve,g); | |
1011 | ||
1012 | theCommands.Add("fsameparameter", | |
0d969553 | 1013 | "fsameparameter shapename [tol (default 1.e-7)], \nforce sameparameter on all edges of the shape", |
7fd59977 | 1014 | __FILE__, |
1015 | sameparameter,g); | |
1016 | ||
1017 | theCommands.Add("sameparameter", | |
1018 | "sameparameter shapename [tol (default 1.e-7)]", | |
1019 | __FILE__, | |
1020 | sameparameter,g); | |
1021 | ||
1022 | theCommands.Add("updatetolerance", | |
1023 | "updatetolerance myShape [param] \n if [param] is absent - not verify of face tolerance, else - perform it", | |
1024 | __FILE__, | |
1025 | updatetol,g); | |
1026 | ||
1027 | theCommands.Add("solidorientation", | |
1028 | "orientsolid myClosedSolid", | |
1029 | __FILE__, | |
1030 | orientsolid,g); | |
1031 | ||
9f6931fb | 1032 | theCommands.Add("getcoords", |
1033 | "getcoords vertex1 vertex 2... ; shows coords of input vertices", | |
1034 | __FILE__, | |
1035 | getcoords,g); | |
1036 | ||
7fd59977 | 1037 | theCommands.Add("bounding", |
1038 | "bounding shape [ xmin ymin zmin xmax ymax zmax] ; draw bounds", | |
1039 | __FILE__, | |
1040 | bounding,g); | |
1041 | ||
3ba87fdb | 1042 | theCommands.Add("optbounding", |
1043 | "optbounding shape [usetri (0/1) [usetol (0/1)]] ; ", | |
1044 | __FILE__, | |
1045 | optbounding,g); | |
1046 | // | |
1047 | theCommands.Add("gbounding", | |
1048 | "gbounding curve/surf ", | |
1049 | __FILE__, | |
1050 | gbounding,g); | |
1051 | ||
7fd59977 | 1052 | theCommands.Add("boundingstr", |
1053 | "boundingstr shape [ xmin ymin zmin xmax ymax zmax] ; print bounding box", | |
1054 | __FILE__, | |
1055 | boundingstr,g); | |
1056 | ||
1057 | theCommands.Add("nurbsconvert", | |
1058 | "nurbsconvert result name [result name]", | |
1059 | __FILE__, | |
1060 | nurbsconvert,g); | |
1061 | ||
1062 | theCommands.Add("deform", | |
1063 | "deform newname name CoeffX CoeffY CoeffZ", | |
1064 | __FILE__, | |
1065 | deform,g); | |
1066 | ||
1067 | theCommands.Add("findplane", | |
1068 | "findplane name planename ", | |
1069 | __FILE__, | |
1070 | findplane,g) ; | |
1071 | ||
1072 | theCommands.Add("maxtolerance", | |
1073 | "maxtolerance shape ", | |
1074 | __FILE__, | |
1075 | maxtolerance,g) ; | |
1076 | ||
1077 | theCommands.Add("reperageshape", | |
1078 | "reperage shape -> list of shape (result of interstion shape , line)", | |
1079 | __FILE__, | |
1080 | reperageshape,g) ; | |
1081 | ||
1082 | theCommands.Add("vecdc", | |
1083 | "vecdc + Pointe double click ", | |
1084 | __FILE__, | |
1085 | vecdc,g) ; | |
1086 | ||
1087 | theCommands.Add("nproject","nproject pj e1 e2 e3 ... surf -g -d [dmax] [Tol [continuity [maxdeg [maxseg]]]", | |
1088 | __FILE__, | |
1089 | nproject,g); | |
1090 | ||
1091 | theCommands.Add("wexplo","wexplo wire [face] create WEDGE_i", | |
1092 | __FILE__, | |
1093 | wexplo,g); | |
86eff19e J |
1094 | |
1095 | theCommands.Add("scalexyz", | |
1096 | "scalexyz res shape factor_x factor_y factor_z", | |
1097 | __FILE__, | |
1098 | scalexyz, g); | |
7fd59977 | 1099 | } |