11 #include "GmshConfig.h"
19 #include <TopoDS_Shape.hxx>
20 #include <TopoDS_Vertex.hxx>
21 #include <TopoDS_Edge.hxx>
22 #include <TopoDS_Wire.hxx>
23 #include <TopoDS_Face.hxx>
24 #include <TopoDS_Shell.hxx>
25 #include <TopoDS_Solid.hxx>
26 #include <TopoDS_Compound.hxx>
27 #include <TopTools_IndexedMapOfShape.hxx>
28 #include <TopTools_DataMapOfShapeInteger.hxx>
29 #include <TopTools_DataMapOfIntegerShape.hxx>
31 class BRepSweep_Prism;
32 class BRepSweep_Revol;
33 class BRepBuilderAPI_Transform;
34 class BRepBuilderAPI_GTransform;
35 class OCCAttributesRTree;
50 TopTools_IndexedMapOfShape _vmap, _emap, _wmap, _fmap, _shmap, _somap;
53 TopTools_DataMapOfShapeInteger _vertexTag, _edgeTag, _faceTag, _solidTag;
54 TopTools_DataMapOfIntegerShape _tagVertex, _tagEdge, _tagFace, _tagSolid;
58 TopTools_DataMapOfShapeInteger _wireTag, _shellTag;
59 TopTools_DataMapOfIntegerShape _tagWire, _tagShell;
63 std::set<std::pair<int, int> > _toRemove;
67 std::set<std::pair<int, int> > _toPreserve;
70 OCCAttributesRTree *_attributes;
74 int _getFuzzyTag(
int dim,
const TopoDS_Shape &s);
77 void _recomputeMaxTag(
int dim);
80 void _bind(
const TopoDS_Vertex &vertex,
int tag,
bool recursive =
false);
81 void _bind(
const TopoDS_Edge &edge,
int tag,
bool recursive =
false);
82 void _bind(
const TopoDS_Wire &wire,
int tag,
bool recursive =
false);
83 void _bind(
const TopoDS_Face &face,
int tag,
bool recursive =
false);
84 void _bind(
const TopoDS_Shell &shell,
int tag,
bool recursive =
false);
85 void _bind(
const TopoDS_Solid &solid,
int tag,
bool recursive =
false);
86 void _bind(TopoDS_Shape shape,
int dim,
int tag,
bool recursive =
false);
87 void _unbind(
const TopoDS_Vertex &vertex,
int tag,
bool recursive =
false);
88 void _unbind(
const TopoDS_Edge &edge,
int tag,
bool recursive =
false);
89 void _unbind(
const TopoDS_Wire &wire,
int tag,
bool recursive =
false);
90 void _unbind(
const TopoDS_Face &face,
int tag,
bool recursive =
false);
91 void _unbind(
const TopoDS_Shell &shell,
int tag,
bool recursive =
false);
92 void _unbind(
const TopoDS_Solid &solid,
int tag,
bool recursive =
false);
93 void _unbind(TopoDS_Shape shape,
int dim,
int tag,
bool recursive =
false);
94 void _unbindWithoutChecks(TopoDS_Shape shape);
102 void _multiBind(
const TopoDS_Shape &shape,
int tag,
103 std::vector<std::pair<int, int> > &outDimTags,
104 bool returnHighestDimOnly,
bool recursive =
false,
105 bool returnNewOnly =
false);
108 bool _isBound(
int dim,
int tag);
111 bool _isBound(
int dim,
const TopoDS_Shape &shape);
114 TopoDS_Shape _find(
int dim,
int tag);
117 int _find(
int dim,
const TopoDS_Shape &shape);
123 void _getAllDimTags(std::vector<std::pair<int, int> > &dimTags,
int dim = 99);
126 void _addShapeToMaps(
const TopoDS_Shape &shape);
129 void _healShape(TopoDS_Shape &myshape,
double tolerance,
bool fixDegenerated,
130 bool fixSmallEdges,
bool fixSmallFaces,
bool sewFaces,
131 bool makeSolids,
double scaling = 0.0);
134 bool _transform(
const std::vector<std::pair<int, int> > &inDimTags,
135 BRepBuilderAPI_Transform *tfo,
136 BRepBuilderAPI_GTransform *gtfo);
139 bool _addBSpline(
int &tag,
const std::vector<int> &pointTags,
int mode,
140 const int degree = -1,
141 const std::vector<double> &weights = std::vector<double>(),
142 const std::vector<double> &knots = std::vector<double>(),
143 const std::vector<int> &multiplicities = std::vector<int>(),
144 const std::vector<SVector3> &tangents = std::vector<SVector3>());
147 bool _extrudePerDim(
int mode,
int inDim,
const std::vector<int> &inTags,
148 double x,
double y,
double z,
double dx,
double dy,
149 double dz,
double ax,
double ay,
double az,
double angle,
151 std::vector<std::pair<int, int> > &outDimTags,
153 bool _extrude(
int mode,
const std::vector<std::pair<int, int> > &inDimTags,
154 double x,
double y,
double z,
double dx,
double dy,
double dz,
155 double ax,
double ay,
double az,
double angle,
int wireTag,
156 std::vector<std::pair<int, int> > &outDimTags,
157 ExtrudeParams *e =
nullptr,
const std::string &trihedron =
"");
160 bool _fillet(
int mode,
const std::vector<int> &volumeTags,
161 const std::vector<int> &curveTags,
162 const std::vector<int> &surfaceTags,
163 const std::vector<double> ¶m,
164 std::vector<std::pair<int, int> > &outDimTags,
168 void _setExtrudedAttributes(
const TopoDS_Compound &
c, BRepSweep_Prism *p,
170 double y,
double z,
double dx,
double dy,
171 double dz,
double ax,
double ay,
double az,
173 void _copyExtrudedAttributes(TopoDS_Edge edge,
GEdge *ge);
174 void _copyExtrudedAttributes(TopoDS_Face face,
GFace *gf);
175 void _copyExtrudedAttributes(TopoDS_Solid solid,
GRegion *gr);
178 bool _getBoundingBox(
const TopoDS_Shape &s,
double &xmin,
double &ymin,
179 double &zmin,
double &xmax,
double &ymax,
double &zmax);
182 bool _makeSTL(
const TopoDS_Shape &s, std::vector<SPoint3> &vertices,
183 std::vector<SVector3> &normals, std::vector<int> &triangles);
201 bool addVertex(
int &tag,
double x,
double y,
double z,
202 double meshSize =
MAX_LC);
203 bool addLine(
int &tag,
int startTag,
int endTag);
204 bool addLine(
int &tag,
const std::vector<int> &pointTags);
205 bool addCircleArc(
int &tag,
int startTag,
int centerTag,
int endTag);
206 bool addCircle(
int &tag,
double x,
double y,
double z,
double r,
207 double angle1,
double angle2,
208 const std::vector<double> &N = std::vector<double>(),
209 const std::vector<double> &V = std::vector<double>());
210 bool addEllipseArc(
int &tag,
int startTag,
int centerTag,
int majorTag,
212 bool addEllipse(
int &tag,
double x,
double y,
double z,
double r1,
double r2,
213 double angle1,
double angle2,
214 const std::vector<double> &N = std::vector<double>(),
215 const std::vector<double> &V = std::vector<double>());
216 bool addSpline(
int &tag,
const std::vector<int> &pointTags,
217 const std::vector<SVector3> &tangents = std::vector<SVector3>());
218 bool addBezier(
int &tag,
const std::vector<int> &pointTags);
219 bool addBSpline(
int &tag,
const std::vector<int> &pointTags,
220 const int degree = -1,
221 const std::vector<double> &weights = std::vector<double>(),
222 const std::vector<double> &knots = std::vector<double>(),
223 const std::vector<int> &multiplicities = std::vector<int>());
224 bool addWire(
int &tag,
const std::vector<int> &curveTags,
bool checkClosed);
225 bool addCurveLoop(
int &tag,
const std::vector<int> &curveTags);
226 bool addRectangle(
int &tag,
double x,
double y,
double z,
double dx,
227 double dy,
double roundedRadius = 0.);
228 bool addDisk(
int &tag,
double xc,
double yc,
double zc,
double rx,
double ry,
229 const std::vector<double> &N = std::vector<double>(),
230 const std::vector<double> &V = std::vector<double>());
233 int &tag,
int wireTag,
234 const std::vector<int> &pointTags = std::vector<int>(),
235 const std::vector<int> &surfaceTags = std::vector<int>(),
236 const std::vector<int> &surfaceContinuity = std::vector<int>(),
237 const int degree = 2,
const int numPointsOnCurves = 15,
238 const int numIter = 2,
const bool anisotropic =
false,
239 const double tol2d = 0.00001,
const double tol3d = 0.0001,
240 const double tolAng = 0.01,
const double tolCurv = 0.1,
241 const int maxDegree = 8,
const int maxSegments = 9);
245 const int numPointsU,
const int degreeU,
246 const int degreeV,
const std::vector<double> &weights,
247 const std::vector<double> &knotsU,
248 const std::vector<double> &knotsV,
249 const std::vector<int> &multiplicitiesU,
250 const std::vector<int> &multiplicitiesV,
251 const std::vector<int> &wireTags = std::vector<int>(),
254 const int numPointsU,
255 const std::vector<int> &wireTags = std::vector<int>(),
258 const std::vector<int> &wireTags,
bool wire3D);
259 bool addSurfaceLoop(
int &tag,
const std::vector<int> &surfaceTags,
261 bool addVolume(
int &tag,
const std::vector<int> &shellTags);
262 bool addSphere(
int &tag,
double xc,
double yc,
double zc,
double radius,
263 double angle1,
double angle2,
double angle3);
264 bool addBox(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
266 bool addCylinder(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
267 double dz,
double r,
double angle);
268 bool addCone(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
269 double dz,
double r1,
double r2,
double angle);
270 bool addWedge(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
271 double dz,
double ltx,
272 const std::vector<double> &N = std::vector<double>());
273 bool addTorus(
int &tag,
double x,
double y,
double z,
double r1,
double r2,
275 const std::vector<double> &N = std::vector<double>());
279 bool makeSolid,
bool makeRuled,
280 std::vector<std::pair<int, int> > &outDimTags,
281 int maxDegree = -1,
const std::string &continuity =
"",
282 const std::string ¶metrization =
"",
283 bool smoothing =
false);
285 const std::vector<int> &excludeFaceTags,
double offset,
286 std::vector<std::pair<int, int> > &outDimTags);
289 bool extrude(
const std::vector<std::pair<int, int> > &inDimTags,
double dx,
290 double dy,
double dz,
291 std::vector<std::pair<int, int> > &outDimTags,
293 bool revolve(
const std::vector<std::pair<int, int> > &inDimTags,
double x,
294 double y,
double z,
double ax,
double ay,
double az,
295 double angle, std::vector<std::pair<int, int> > &outDimTags,
297 bool addPipe(
const std::vector<std::pair<int, int> > &inDimTags,
int wireTag,
298 std::vector<std::pair<int, int> > &outDimTags,
299 const std::string &trihedron =
"");
302 bool fillet(
const std::vector<int> &volumeTags,
303 const std::vector<int> &curveTags,
304 const std::vector<double> &radii,
305 std::vector<std::pair<int, int> > &outDimTags,
bool removeVolume);
308 bool chamfer(
const std::vector<int> &volumeTags,
309 const std::vector<int> &curveTags,
310 const std::vector<int> &surfaceTags,
311 const std::vector<double> &distances,
312 std::vector<std::pair<int, int> > &outDimTags,
318 const std::vector<std::pair<int, int> > &objectDimTags,
319 const std::vector<std::pair<int, int> > &toolDimTags,
320 std::vector<std::pair<int, int> > &outDimTags,
321 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
322 bool removeObject,
bool removeTool);
324 booleanUnion(
int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
325 const std::vector<std::pair<int, int> > &toolDimTags,
326 std::vector<std::pair<int, int> > &outDimTags,
327 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
328 bool removeObject,
bool removeTool);
330 int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
331 const std::vector<std::pair<int, int> > &toolDimTags,
332 std::vector<std::pair<int, int> > &outDimTags,
333 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
334 bool removeObject,
bool removeTool);
336 int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
337 const std::vector<std::pair<int, int> > &toolDimTags,
338 std::vector<std::pair<int, int> > &outDimTags,
339 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
340 bool removeObject,
bool removeTool);
342 int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
343 const std::vector<std::pair<int, int> > &toolDimTags,
344 std::vector<std::pair<int, int> > &outDimTags,
345 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
346 bool removeObject,
bool removeTool);
353 bool translate(
const std::vector<std::pair<int, int> > &inDimTags,
double dx,
354 double dy,
double dz);
355 bool rotate(
const std::vector<std::pair<int, int> > &inDimTags,
double x,
356 double y,
double z,
double ax,
double ay,
double az,
358 bool dilate(
const std::vector<std::pair<int, int> > &inDimTags,
double x,
359 double y,
double z,
double a,
double b,
double c);
360 bool symmetry(
const std::vector<std::pair<int, int> > &inDimTags,
double a,
361 double b,
double c,
double d);
362 bool affine(
const std::vector<std::pair<int, int> > &inDimTags,
363 const std::vector<double> &mat);
366 bool copy(
const std::vector<std::pair<int, int> > &inDimTags,
367 std::vector<std::pair<int, int> > &outDimTags);
368 bool remove(
int dim,
int tag,
bool recursive =
false);
369 bool remove(
const std::vector<std::pair<int, int> > &dimTags,
370 bool recursive =
false);
373 bool importShapes(
const std::string &fileName,
bool highestDimOnly,
374 std::vector<std::pair<int, int> > &outDimTags,
375 const std::string &format =
"");
378 bool importShapes(
const TopoDS_Shape *shape,
bool highestDimOnly,
379 std::vector<std::pair<int, int> > &outDimTags);
382 bool healShapes(
const std::vector<std::pair<int, int> > &inDimTags,
383 std::vector<std::pair<int, int> > &outDimTags,
384 double tolerance,
bool fixDegenerated,
bool fixSmallEdges,
385 bool fixSmallFaces,
bool sewFaces,
bool makeSolids);
388 bool convertToNURBS(
const std::vector<std::pair<int, int> > &dimTags);
398 const std::string &format =
"",
bool onlyVisible =
false);
401 bool getEntities(std::vector<std::pair<int, int> > &dimTags,
int dim);
402 bool getVertex(
int tag,
double &x,
double &y,
double &
z);
404 double &zmin,
double &xmax,
double &ymax,
double &zmax);
406 double xmax,
double ymax,
double zmax,
407 std::vector<std::pair<int, int> > &dimTags,
409 bool getCurveLoops(
int surfaceTag, std::vector<int> &curveLoopTags,
410 std::vector<std::vector<int> > &curveTags);
412 std::vector<std::vector<int> > &surfaceTags);
413 bool getMass(
int dim,
int tag,
double &mass);
418 double &x1,
double &y1,
double &z1,
419 double &x2,
double &y2,
double &z2);
420 GVertex *getVertexForOCCShape(
GModel *model,
const TopoDS_Vertex &toFind);
421 GEdge *getEdgeForOCCShape(
GModel *model,
const TopoDS_Edge &toFind);
422 GFace *getFaceForOCCShape(
GModel *model,
const TopoDS_Face &toFind);
423 GRegion *getRegionForOCCShape(
GModel *model,
const TopoDS_Solid &toFind);
426 bool makeFaceSTL(
const TopoDS_Face &s, std::vector<SPoint2> &vertices_uv,
427 std::vector<int> &triangles);
428 bool makeFaceSTL(
const TopoDS_Face &s, std::vector<SPoint2> &vertices_uv,
429 std::vector<SPoint3> &vertices,
430 std::vector<SVector3> &normals, std::vector<int> &triangles);
431 bool makeFaceSTL(
const TopoDS_Face &s, std::vector<SPoint3> &vertices,
432 std::vector<SVector3> &normals, std::vector<int> &triangles);
433 bool makeEdgeSTLFromFace(
const TopoDS_Edge &
c,
const TopoDS_Face &s,
434 std::vector<SPoint3> *vertices);
436 double roundedRadius, std::vector<SPoint3> &vertices,
437 std::vector<SVector3> &normals,
438 std::vector<int> &triangles);
439 bool makeDiskSTL(
double xc,
double yc,
double zc,
double rx,
double ry,
440 std::vector<SPoint3> &vertices,
441 std::vector<SVector3> &normals, std::vector<int> &triangles);
442 bool makeSphereSTL(
double xc,
double yc,
double zc,
double radius,
443 double angle1,
double angle2,
double angle3,
444 std::vector<SPoint3> &vertices,
445 std::vector<SVector3> &normals,
446 std::vector<int> &triangles);
447 bool makeBoxSTL(
double x,
double y,
double z,
double dx,
double dy,
double dz,
448 std::vector<SPoint3> &vertices,
449 std::vector<SVector3> &normals, std::vector<int> &triangles);
451 double dz,
double r,
double angle,
452 std::vector<SPoint3> &vertices,
453 std::vector<SVector3> &normals,
454 std::vector<int> &triangles);
455 bool makeConeSTL(
double x,
double y,
double z,
double dx,
double dy,
456 double dz,
double r1,
double r2,
double angle,
457 std::vector<SPoint3> &vertices,
458 std::vector<SVector3> &normals, std::vector<int> &triangles);
459 bool makeWedgeSTL(
double x,
double y,
double z,
double dx,
double dy,
460 double dz,
double ltx, std::vector<SPoint3> &vertices,
461 std::vector<SVector3> &normals,
462 std::vector<int> &triangles);
463 bool makeTorusSTL(
double x,
double y,
double z,
double r1,
double r2,
464 double angle, std::vector<SPoint3> &vertices,
465 std::vector<SVector3> &normals,
466 std::vector<int> &triangles);
475 Msg::Error(
"Gmsh requires OpenCASCADE to %s", what.c_str());
489 return _error(
"add vertex");
491 bool addLine(
int &tag,
int startTag,
int endTag)
493 return _error(
"add line");
495 bool addLine(
int &tag,
const std::vector<int> &pointTags)
497 return _error(
"add line");
501 return _error(
"add circle arc");
503 bool addCircle(
int &tag,
double x,
double y,
double z,
double r,
504 double angle1,
double angle2,
505 const std::vector<double> &N = std::vector<double>(),
506 const std::vector<double> &V = std::vector<double>())
508 return _error(
"add circle");
513 return _error(
"add ellipse arc");
515 bool addEllipse(
int &tag,
double x,
double y,
double z,
double r1,
double r2,
516 double angle1,
double angle2,
517 const std::vector<double> &N = std::vector<double>(),
518 const std::vector<double> &V = std::vector<double>())
520 return _error(
"add ellipse");
522 bool addSpline(
int &tag,
const std::vector<int> &pointTags,
523 const std::vector<SVector3> &tangents = std::vector<SVector3>())
525 return _error(
"add spline");
527 bool addBezier(
int &tag,
const std::vector<int> &pointTags)
529 return _error(
"add Bezier");
532 const int degree = -1,
533 const std::vector<double> &weights = std::vector<double>(),
534 const std::vector<double> &knots = std::vector<double>(),
535 const std::vector<int> &multiplicities = std::vector<int>())
537 return _error(
"add BSpline");
539 bool addWire(
int &tag,
const std::vector<int> &curveTags,
bool closed)
541 return _error(
"add wire");
545 return _error(
"add curve loop");
548 double dy,
double roundedRadius = 0.)
550 return _error(
"add rectangle");
552 bool addDisk(
int &tag,
double xc,
double yc,
double zc,
double rx,
double ry,
553 const std::vector<double> &N = std::vector<double>(),
554 const std::vector<double> &V = std::vector<double>())
556 return _error(
"add disk");
560 return _error(
"add plane surface");
563 int &tag,
int wireTag,
564 const std::vector<int> &pointTags = std::vector<int>(),
565 const std::vector<int> &surfaceTags = std::vector<int>(),
566 const std::vector<int> &surfaceContinuity = std::vector<int>(),
567 const int degree = 2,
const int numPointsOnCurves = 15,
568 const int numIter = 2,
const bool anisotropic =
false,
569 const double tol2d = 0.00001,
const double tol3d = 0.0001,
570 const double tolAng = 0.01,
const double tolCurv = 0.1,
571 const int maxDegree = 8,
const int maxSegments = 9)
573 return _error(
"add surface filling");
577 return _error(
"add BSpline filling");
581 return _error(
"add Bezier filling");
584 const int numPointsU,
const int degreeU,
585 const int degreeV,
const std::vector<double> &weights,
586 const std::vector<double> &knotsU,
587 const std::vector<double> &knotsV,
588 const std::vector<int> &multiplicitiesU,
589 const std::vector<int> &multiplicitiesV,
590 const std::vector<int> &wireTags = std::vector<int>(),
593 return _error(
"add BSpline surface");
596 const int numPointsU,
597 const std::vector<int> &wireTags = std::vector<int>(),
600 return _error(
"add Bezier surface");
603 const std::vector<int> &wireTags,
bool wire3D)
605 return _error(
"add trimmed surface");
610 return _error(
"add surface loop");
612 bool addVolume(
int &tag,
const std::vector<int> &shellTags)
614 return _error(
"add volume");
616 bool addSphere(
int &tag,
double xc,
double yc,
double zc,
double radius,
617 double angle1,
double angle2,
double angle3)
619 return _error(
"add sphere");
621 bool addBox(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
626 bool addCylinder(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
627 double dz,
double r,
double angle)
629 return _error(
"add cylinder");
631 bool addCone(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
632 double dz,
double r1,
double r2,
double angle)
634 return _error(
"add cone");
636 bool addWedge(
int &tag,
double x,
double y,
double z,
double dx,
double dy,
637 double dz,
double ltx,
638 const std::vector<double> &N = std::vector<double>())
640 return _error(
"add wedge");
642 bool addTorus(
int &tag,
double x,
double y,
double z,
double r1,
double r2,
644 const std::vector<double> &N = std::vector<double>())
646 return _error(
"add torus");
649 bool makeSolid,
bool makeRuled,
650 std::vector<std::pair<int, int> > &outDimTags,
651 int maxDegree = -1,
const std::string &continuity =
"",
652 const std::string ¶metrization =
"",
653 bool smoothing =
false)
655 return _error(
"add thrusection");
658 const std::vector<int> &excludeFaceTags,
double offset,
659 std::vector<std::pair<int, int> > &outDimTags)
661 return _error(
"add thick solid");
663 bool extrude(
const std::vector<std::pair<int, int> > &inDimTags,
double dx,
664 double dy,
double dz,
665 std::vector<std::pair<int, int> > &outDimTags,
670 bool revolve(
const std::vector<std::pair<int, int> > &inDimTags,
double x,
671 double y,
double z,
double ax,
double ay,
double az,
672 double angle, std::vector<std::pair<int, int> > &outDimTags,
677 bool addPipe(
const std::vector<std::pair<int, int> > &inDimTags,
int wireTag,
678 std::vector<std::pair<int, int> > &outDimTags,
679 const std::string &trihedron =
"")
681 return _error(
"add pipe");
683 bool fillet(
const std::vector<int> &volumeTags,
684 const std::vector<int> &curveTags,
685 const std::vector<double> &radii,
686 std::vector<std::pair<int, int> > &outDimTags,
bool removeVolume)
688 return _error(
"create fillet");
690 bool chamfer(
const std::vector<int> &volumeTags,
691 const std::vector<int> &curveTags,
692 const std::vector<int> &surfaceTags,
693 const std::vector<double> &distances,
694 std::vector<std::pair<int, int> > &outDimTags,
bool removeVolume)
696 return _error(
"create chamfer");
700 const std::vector<std::pair<int, int> > &objectDimTags,
701 const std::vector<std::pair<int, int> > &toolDimTags,
702 std::vector<std::pair<int, int> > &outDimTags,
703 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
704 bool removeObject,
bool removeTool)
706 return _error(
"apply boolean operator");
709 booleanUnion(
int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
710 const std::vector<std::pair<int, int> > &toolDimTags,
711 std::vector<std::pair<int, int> > &outDimTags,
712 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
713 bool removeObject,
bool removeTool)
715 return _error(
"apply boolean union");
718 int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
719 const std::vector<std::pair<int, int> > &toolDimTags,
720 std::vector<std::pair<int, int> > &outDimTags,
721 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
722 bool removeObject,
bool removeTool)
724 return _error(
"apply boolean intersection");
727 int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
728 const std::vector<std::pair<int, int> > &toolDimTags,
729 std::vector<std::pair<int, int> > &outDimTags,
730 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
731 bool removeObject,
bool removeTool)
733 return _error(
"apply boolean difference");
736 int tag,
const std::vector<std::pair<int, int> > &objectDimTags,
737 const std::vector<std::pair<int, int> > &toolDimTags,
738 std::vector<std::pair<int, int> > &outDimTags,
739 std::vector<std::vector<std::pair<int, int> > > &outDimTagsMap,
740 bool removeObject,
bool removeTool)
742 return _error(
"apply boolean fragments");
747 return _error(
"merge vertices");
749 bool translate(
const std::vector<std::pair<int, int> > &inDimTags,
double dx,
750 double dy,
double dz)
752 return _error(
"apply translation");
754 bool rotate(
const std::vector<std::pair<int, int> > &inDimTags,
double x,
755 double y,
double z,
double ax,
double ay,
double az,
double angle)
757 return _error(
"apply rotation");
759 bool dilate(
const std::vector<std::pair<int, int> > &inDimTags,
double x,
760 double y,
double z,
double a,
double b,
double c)
762 return _error(
"apply dilatation");
764 bool symmetry(
const std::vector<std::pair<int, int> > &inDimTags,
double a,
765 double b,
double c,
double d)
767 return _error(
"apply symmetry");
769 bool affine(
const std::vector<std::pair<int, int> > &inDimTags,
770 const std::vector<double> &mat)
772 return _error(
"apply affine transform");
774 bool copy(
const std::vector<std::pair<int, int> > &inDimTags,
775 std::vector<std::pair<int, int> > &outDimTags)
777 return _error(
"copy shape");
779 bool remove(
int dim,
int tag,
bool recursive =
false) {
return false; }
780 bool remove(
const std::vector<std::pair<int, int> > &dimTags,
781 bool recursive =
false)
786 std::vector<std::pair<int, int> > &outDimTags,
787 const std::string &format =
"")
789 return _error(
"import shape");
791 bool healShapes(
const std::vector<std::pair<int, int> > &inDimTags,
792 std::vector<std::pair<int, int> > &outDimTags,
793 double tolerance,
bool fixDegenerated,
bool fixSmallEdges,
794 bool fixSmallFaces,
bool sewFaces,
bool makeSolids)
796 return _error(
"heal shapes");
800 return _error(
"convert to NURBS");
805 const std::string &format =
"",
bool onlyVisible =
false)
807 return _error(
"export shape");
809 bool getEntities(std::vector<std::pair<int, int> > &dimTags,
int dim)
813 bool getVertex(
int tag,
double &x,
double &y,
double &
z) {
return false; }
815 double &zmin,
double &xmax,
double &ymax,
double &zmax)
820 double xmax,
double ymax,
double zmax,
821 std::vector<std::pair<int, int> > &dimTags,
827 std::vector<std::vector<int> > &curveTags)
832 std::vector<std::vector<int> > &surfaceTags)
836 bool getMass(
int dim,
int tag,
double &mass) {
return false; }
847 double &x1,
double &y1,
double &z1,
848 double &x2,
double &y2,
double &z2)
853 double roundedRadius, std::vector<SPoint3> &vertices,
854 std::vector<SVector3> &normals,
855 std::vector<int> &triangles)
859 bool makeDiskSTL(
double xc,
double yc,
double zc,
double rx,
double ry,
860 std::vector<SPoint3> &vertices,
861 std::vector<SVector3> &normals, std::vector<int> &triangles)
866 double angle1,
double angle2,
double angle3,
867 std::vector<SPoint3> &vertices,
868 std::vector<SVector3> &normals,
869 std::vector<int> &triangles)
873 bool makeBoxSTL(
double x,
double y,
double z,
double dx,
double dy,
double dz,
874 std::vector<SPoint3> &vertices,
875 std::vector<SVector3> &normals, std::vector<int> &triangles)
880 double dz,
double r,
double angle,
881 std::vector<SPoint3> &vertices,
882 std::vector<SVector3> &normals,
883 std::vector<int> &triangles)
888 double dz,
double r1,
double r2,
double angle,
889 std::vector<SPoint3> &vertices,
890 std::vector<SVector3> &normals, std::vector<int> &triangles)
895 double dz,
double ltx, std::vector<SPoint3> &vertices,
896 std::vector<SVector3> &normals, std::vector<int> &triangles)
901 double angle, std::vector<SPoint3> &vertices,
902 std::vector<SVector3> &normals, std::vector<int> &triangles)