OpenLexocad  28.0
ShapeTool.h
Go to the documentation of this file.
1 #pragma once
2 
3 
4 #include <Base/Color.h>
5 #include <functional>
6 #include <Geom/Bnd_box.h>
7 #include <Geom/Precision.h>
8 #include <Topo/Clash.h>
11 #include <Topo/ToolOutcome.h>
12 #include <Topo/Types.h>
13 
14 
15 namespace Base { struct Double; }
16 namespace Base { struct Int; }
17 namespace Core { class DocObject; }
18 namespace Geom { class Ax2; }
19 namespace Geom { class Dir; }
20 namespace Geom { class GTrsf; }
21 namespace Geom { class Pln; }
22 namespace Geom { class Vec; }
23 
24 
25 class TopoDS_Shape;
26 class ENTITY;
27 class BODY;
28 class CA_Ray;
29 
30 namespace Base
31 {
32 class GlobalAttachment;
33 class AbstractWriter;
34 } // namespace Base
35 
36 namespace Acis
37 {
38 class AcisHelper;
39 class AcisBrepGeometryAdaptor;
40 class PolyToAcisConverter;
41 } // namespace Acis
42 
43 namespace Mesh
44 {
45 class OmfMeshTool;
46 }
47 
48 namespace Mesher
49 {
50 class EdgeData;
51 class ShapeTesselator;
52 class ShapeTesselator_OCC;
53 class EdgeData_OCC;
54 } // namespace Mesher
55 
56 namespace MesherAcis
57 {
58 class ShapeTesselator_Acis;
59 class TriangleData_Acis;
60 class EdgeData_Acis;
61 class facet_body_thread_worker;
62 } // namespace MesherAcis
63 
64 namespace Core
65 {
66 class CoreDocument;
67 }
68 
69 namespace App
70 {
71 class SubElement;
72 class Element;
73 } // namespace App
74 
75 class CA_Detail;
76 class CA_Snap;
77 
78 typedef std::vector<Geom::Pnt> PNTS;
79 
80 namespace Topo
81 {
82 class SkinningOptions;
83 class SweepingOptions;
84 class VisibleEdge;
85 class ThreadPool;
86 class Cdwk_SAT_Attributes;
87 class ShapeInfo;
88 class SimplifyOptions;
89 class RayHit;
90 typedef std::vector<RayHit> RayHitVector;
97 class LX_TOPO_EXPORT ShapeTool
98 {
99 public:
100  ShapeTool(void);
101  virtual ~ShapeTool(void);
102 
103  friend class Mesher::EdgeData;
104  friend class Mesher::EdgeData_OCC;
105  friend class Mesher::ShapeTesselator;
106  friend class Mesher::ShapeTesselator_OCC;
107  friend class MesherAcis::ShapeTesselator_Acis;
108  friend class MesherAcis::TriangleData_Acis;
109  friend class MesherAcis::EdgeData_Acis;
110  friend class MesherAcis::facet_body_thread_worker;
111  friend class Mesh::OmfMeshTool;
112  friend class Acis::AcisHelper;
113  friend class Acis::AcisBrepGeometryAdaptor;
114  friend class Acis::PolyToAcisConverter;
115 
117  // //
118  // --------------------- BEGIN API --------------------- //
119  // //
120  // ATTENTION: DO NOT CHANGE ANY SIGNATURES IN THE API ! //
121  // //
123 
125  {
126  NO_HINT,
127  BEAM_HINT,
128  COLUMN_HINT,
129  DOOR_HINT,
130  MEMBER_HINT,
131  PLATE_HINT,
132  SLAB_HINT,
133  WALL_HINT,
134  WINDOW_HINT
135  };
136 
138  static pShape makeShape(pVertex vertex);
140  static pShape makeShape(pEdge edge);
142  static pShape makeShape(pWire wire, double precision = Geom::Precision::linear_Resolution());
144  static pShape makeShape(pFace face);
146  static pShape makeShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
148  static pShape makeShape(BODY* aBody);
150  static pShape makeLazyFacetedBrepShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
154  static pShape makeInventorMeshShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
156  static pShape makeOMFMeshShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
158  static pIndexedMesh makeIndexedMesh(pConstBrepData data, std::vector<PNTS>& defectPolygons, bool createEdges = false);
160  static pIndexedMesh makeIndexedMesh(pConstShape input, bool createEdges = false);
162  static pShape makeAcisShape(pShape input);
164  static bool createBrepData(pConstShape input, pBrepData data);
166  static void makeShapeAsync(pConstBrepData data, std::function<void(pShape newShape, std::vector<PNTS> defectPolygons)> onShapeMadeCB);
168  static pShape makeShape(const std::vector<int>& model, const std::vector<Geom::Pnt>& vertices, std::vector<PNTS>& defectPolygons);
170  static pShape makeShape(const std::vector<Base::Int>& model, const std::vector<Geom::Pnt>& vertices, std::vector<PNTS>& defectPolygons);
172  static void makeShapeAsync(const std::vector<int>& model,
173  const std::vector<Geom::Pnt>& vertices,
174  std::function<void(pShape newShape, std::vector<PNTS> defectPolygons)> onShapeMadeCB);
176  static bool makeShapes_parallel(const std::vector<pConstBrepData>& breps, std::map<pConstBrepData, pShape>& shapes);
177 
180  static pShape makeShape(const std::vector<pFace>& faces, double precision = Geom::Precision::linear_Resolution());
182  static pShape makeFaceSet(const std::vector<pFace>& faces);
187  static pShape makeCompound(const std::vector<pConstShape>& shapes);
189  static pShape makeShape(Core::DocObject* curve, double startParam = 0, double endParam = 0);
190 
203 
212 
217 
219  static std::vector<int> getIndexesFromFaces(pConstTopologicalItem item, const std::vector<pConstFace> faces);
220 
229 
231  static std::vector<pConstShell> getShells(pConstTopologicalItem item);
233  static std::vector<pConstFace> getFaces(pConstTopologicalItem item);
235  static std::vector<pFace> getFacesAsCopy(pConstTopologicalItem item);
237  static std::vector<pConstWire> getWires(pConstTopologicalItem item);
239  static std::vector<pConstEdge> getEdges(pConstTopologicalItem item);
241  static std::vector<VisibleEdge> getEdges_visible(std::vector<pConstShape> shapes,
242  const Geom::Pnt& cam_position,
243  const Geom::Pnt& cam_target,
244  bool cam_perspective = true);
246  static std::vector<pConstVertex> getVertices(pConstTopologicalItem item);
248  static std::vector<int> getAdjacentFaceIndicesFromVertexIndex(pConstTopologicalItem item, int vertexIdx);
250  static std::vector<pConstFace> getAdjacentFacesFromEdge(pConstTopologicalItem item, pConstEdge edge);
252  static std::vector<int> getEdgeIndicesFromFace(pConstTopologicalItem item, int faceIndex);
254  static std::vector<int> getVertexIndicesFromWire(pConstTopologicalItem item, int wireIdx);
256  static std::vector<int> getWireIndicesFromFace(pConstTopologicalItem item, int faceIdx);
258  static void getVerticesAsPoints(pConstTopologicalItem item, std::vector<Geom::Pnt>& vertices);
265  static bool calculateLocalAxes(pConstShape shape, Geom::Ax2& localAxes);
267  static bool calculateDetail(pConstShape shape, CA_Detail& detail, const CA_Snap& snap);
269  static pSolid cast2Solid(pShape shape);
273  static pMesh cast2Mesh(pShape shape);
281  static double getVolume(pConstTopologicalItem item);
283  static bool getCentroid(pConstShape shape, Geom::Pnt& centroid);
285  static void setNeedMassUpdate(pConstShape shape, bool on);
289  static bool write(pConstShape shape, std::ostream& writer);
291  static bool write(pConstShape shape, Base::AbstractWriter& writer);
293  static bool write(const std::string& format, pConstShape shape, const Base::String& fileName);
295  static bool write(const std::string& format, std::vector<pConstShape> shapes, const Base::String& fileName);
298  static bool writeAcisFile(std::vector<pConstShape> shapes,
299  const Base::String& fileName,
300  bool isText,
301  int major_version = -1,
302  int minor_version = -1,
303  double scale = 1.);
306  static bool appendAcisFile(std::vector<pConstShape> shapes,
307  const Base::String& fileName,
308  bool isText,
309  int major_version = -1,
310  int minor_version = -1,
311  double scale = 1.);
313  static bool canWriteAs(const std::string& format, pConstShape shape);
315  static std::string getWriteFormat(pConstShape shape);
317  static pShape read(const std::string& format, std::istream& reader);
319  static pShape read(const std::string& format, const std::string& data, float version);
321  /*DEPRECATED("Pass fileName as Base::String.") */ static pShape read(const std::string& format, const std::string& fileName);
323  static pShape read(const std::string& format, const Base::String& fileName);
324 
327  static bool intersectBBoxes(pConstShape shape1, pConstShape shape2);
328  static pShape cut(pConstShape base, pConstShape tool, bool* ok = 0);
329  static pShape cut(pConstShape base, const std::vector<pConstShape> tools, bool* ok = 0);
330  static pShape fuse(pConstShape base, pConstShape tool, bool* ok = 0);
331  static pShape common(pConstShape base, pConstShape tool, bool* ok = 0);
332  static pShape section(pConstShape base, pConstShape tool, bool* ok = 0);
333  static pShape s_cut(pConstShape base, pConstShape tool);
335  static pShape cutWithPlane(pConstShape aBlank, const Geom::Pln& aPlane, bool* ok = 0);
336  static pShape splitByPlane(pConstShape aBlank, const Geom::Pln& aPlane, bool* ok = 0);
338 
340  static pShape transformed(pConstShape base, const Geom::Trsf& t);
342  static pShape moved(pConstShape base, const Geom::XYZ& move);
344  static pShape scaled(pConstShape base, const Geom::XYZ& scale);
347  static bool isNull(pConstShape shape);
348 
350  static bool isValid(pConstShape shape, int checkLevel = 30);
352  static bool isValid(pConstWire wire, int checkLevel = 30);
354  static bool isValid(pConstFace face, int checkLevel = 30);
356  static bool isValid(pConstVertex vertex, int checkLevel = 30);
358  static bool isValid(pConstEdge edge, int checkLevel = 30);
366  static void getAxesOrientedSurfaces(pConstShape shape, double& XYSurface, double& XZSurface, double& YZSurface);
368  double& verticalFaceSurface,
369  std::vector<double>& verticalFaceSurfaces,
370  double& verticalLargestFaceSurface,
371  double& horizontalFaceSurface);
374  Base::Double& verticalFaceSurface,
375  std::vector<double>& verticalFaceSurfaces,
376  Base::Double& verticalLargestFaceSurface,
377  Base::Double& horizontalFaceSurface);
379  static double getAreaFromTop(pConstShape shape, pMesh* areFromTopMesh = nullptr);
380  // Returns area of the largest face of the shape
381  static double getLargestFaceArea(pConstShape shape);
382  // Returns normal of the largest face of the shape
385  static pShape copy(pConstShape shape, bool deepCopy = true);
387  static App::Element* makeDbgElementFromShape(Core::CoreDocument* doc, pConstShape shape, const Base::Color& color = Base::Color(204, 204, 204));
389  static App::SubElement* makeDbgSubElementFromShape(Core::CoreDocument* doc,
390  pConstShape shape,
391  const Base::Color& color = Base::Color(204, 204, 204));
396  static bool isFaceted(pConstTopologicalItem shape);
398  static bool hasVoids(pConstTopologicalItem shape);
402  static bool convertToPolygonalFaces(pConstShape shape, std::vector<pFace>& polyFaces, bool precise = false);
404  static bool hasNurbsFace(pConstShape shape);
406  static bool hasTriangulation(pConstShape shape);
413  static bool hasFaces(pConstShape shape, bool& allSubShapesHaveFaces);
415  static std::vector<pShape> getShapesFromAcisFile(const Base::String& fileName, double scaleFactor = 1., std::function<int(int)> callback = 0);
417  static pShape importBrep(Base::String filename);
419  static pShape extrudedWire(pConstWire wire, const Geom::Dir& extrudedDirection, double depth, double precision);
421  static pShape thickenSheets(pConstShape shape, double thickness, bool doubleSided /* = false*/, Base::String& errorInfo);
423  static pShape deformed(pConstShape shape, const Geom::GTrsf& t, const Geom::Pnt& p);
425  static pShape mirrored(pConstShape shape, const Geom::Ax2& ax);
427  static Topo::ToolOutcome clash(pConstShape shape1, pConstShape shape2, bool& hasClash);
430  pConstShape shape2,
431  Topo::BodyClashType& clashType,
442  static bool isShell(pConstShape shape);
444  static bool isOpenShell(pConstShape shape);
446  static bool isClosedShell(pConstShape shape);
448  static bool isClosedSolid(pConstShape shape);
450  static bool isWire(pConstShape shape);
452  static bool isCompound(pConstShape shape);
454  static bool isMesh(pConstShape shape);
456  static bool isVertex(pConstShape shape);
458  static bool isExtrudedAreaSolid(pConstShape aShape,
459  Geom::Ax2& aPosition,
460  double& aLength,
461  pConstFace& aProfile,
462  BuildingElementHintEnum aHint = BuildingElementHintEnum::NO_HINT);
464  static bool isCylinder(pConstShape shape, Geom::Ax2& position, double& length, double& radius);
465 
467  static bool getAttributeInteger(pConstTopologicalItem shape, const Base::String& name, int& value);
469  static bool setAttributeInteger(pConstTopologicalItem shape, const Base::String& name, int value);
471  static bool removeAttribute(pConstTopologicalItem shape, const Base::String& name);
475  static bool setAttributeString(pConstTopologicalItem shape, const Base::String& name, const Base::String&);
484 
486  static bool cleanupShape(pShape shape);
487 
488  static bool hasSliverFaces(pConstShape shape);
489  static pShape removedSliverFaces(pConstShape shape, double aTolerance = -1);
490 
492  static bool imprint(pShape base, pShape tool);
493 
495  static Topo::ToolOutcome rayPick(const std::vector<pConstTopologicalItem>& targets, const CA_Ray& ray, Topo::RayHitVector& found);
499  static bool getColorRGB(pConstShape shape, int& r, int& g, int& b);
500 
501  template <class _InputIterator, class _Function>
502  static void do_parallel(_InputIterator first, _InputIterator last, _Function fn)
503  {
504  while (first != last)
505  {
506  fn(*first);
507  ++first;
508  }
509  }
510 
511  static pShape skinning(Base::String& errorInfo,
512  const Topo::SkinningOptions& skinOptions,
513  const double& precision = Geom::Precision::linear_Resolution());
514  static pShape sweeping(Base::String& errorInfo, const Topo::SweepingOptions& sweepOptions);
515 
517  static double getModelingTolerance();
519  static void transformShape2LocalSpaceOfElement(App::Element* elem, pShape shape);
520  static bool hasPolyHedral();
521  static bool getModelFromPolyHedral(pShape shape, std::vector<int>& model, std::vector<Geom::Pnt>& vertices);
522  static pShape makePolyHedral(const std::vector<int>& model,
523  const std::vector<Geom::Pnt>& vertices,
524  bool checkShape,
525  std::vector<std::vector<Geom::Pnt> >& defectPolygons);
526  static bool is_polyhedral_body(BODY const* iBody);
527 
529  // //
530  // ---------------------- END API ---------------------- //
531  // //
533 
534 #ifndef LXAPI // INTERFACES BELOW ARE -NOT- PART OF THE LEXOCAD API
535 
536  static std::vector<Geom::Pnt> getIntersectionPoints(pConstShape shape, const std::vector<pConstShape> shapes);
537  static std::vector<Geom::Pnt> getAllIntersectionPoints(const std::vector<pConstShape> shapes);
538  static void getAllIntersectionPointsIn2DMode(const std::vector<pConstShape>& shapes,
539  const Geom::Pnt& pnt,
540  const double& distance,
541  std::vector<Geom::Pnt>& intersectionPoints);
542  static void getAllIntersectionPointsWithLineIn2DMode(const std::vector<pConstShape>& shapes,
543  const Geom::Pnt& linePnt1,
544  const Geom::Pnt& linePnt2,
545  std::vector<Geom::Pnt>& intersectionPoints);
546  // convenience method
548  const Geom::Pnt& linePnt1,
549  const Geom::Pnt& linePnt2,
550  std::vector<Geom::Pnt>& intersectionPoints);
551 
553  static pShape createSheet(pConstShape shape, bool doubleSided);
554  static std::vector<pShape> splitLumps(pConstShape shape);
556  static bool makeShapes(const std::vector<pFace>& faces, std::vector<pShape>& shapes, double precision = Geom::Precision::linear_Resolution());
557 
559  static Topo::ToolOutcome createElementFromShape(Core::CoreDocument* doc, pConstShape shape, App::Element*& newElement, App::Element* sample = 0);
560  static size_t getShapeCount();
561  static void shapeCountInc();
562  static void shapeCountDec();
565  static pShape simplifyShape(pConstShape shape, const SimplifyOptions& opts);
566  static pShape offsetShape(pConstShape shape, double offset);
567  static void debugShape(pConstShape shape, int checkLevel, ShapeInfo& info);
568  static bool isManifold(pConstShape shape);
569  static bool restoreGlobalAttachment(Base::GlobalAttachment* gAtta, std::istream*, uint64_t streamsize, const Base::String& entryName);
571  static std::vector<int> getFaceIndexesByPointOnFace(pConstTopologicalItem shape, const Geom::Pnt& p);
572 
574  std::map<int, Geom::Vec> aDirectionsToSortBy,
575  std::map<int, std::vector<pConstFace> >& aFacesListMap,
576  float aMaxAngleRad = 0.75);
578  static bool getTopoDS_Shape(pConstTopologicalItem shape, TopoDS_Shape& topoShape);
579 
580  static bool getEntityAttribute_Int(ENTITY* ent, int& v);
581  static bool setEntityAttribute_Int(ENTITY* ent, int v);
583 
584  static bool hasOnlyLineWires(pConstShape shape);
585 
588  static void __setOCCShapeTool__(Topo::ShapeTool* tool) { _occTool = tool; }
590  static void __setAcisShapeTool__(Topo::ShapeTool* tool) { _acisTool = tool; }
592  static void __setDefaultShapeTool__(Topo::ShapeTool* tool) { _defaultTool = tool; }
594  static void __setInventorShapeTool__(Topo::ShapeTool* tool) { _inventorTool = tool; }
596  static void __setOMFShapeTool__(Topo::ShapeTool* tool) { _omfTool = tool; }
598  static void __setAcisMeshShapeTool__(Topo::ShapeTool* tool) { _acisMeshShapeTool = tool; }
600  static pConstShape getFirstShape_Helper(App::Element* elem);
601 
602 
603 
604 protected:
606  static ENTITY* getAcisEntity(pConstTopologicalItem item);
607 
608  virtual pShape _makeShape(pVertex vertex);
609  virtual pShape _makeShape(pEdge edge);
610  virtual pShape _makeShape(pWire wire, double precision);
611  virtual pShape _makeShape(pFace face);
612  virtual pShape _makeShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
613  virtual pShape _makeShape(BODY* aBody);
614  virtual pShape _makeLazyFacetedBrepShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
615  virtual pShape _makeInventorMeshShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
616  virtual pShape _makeInventorMeshShape(pIndexedMesh p);
617  virtual pIndexedMesh _makeIndexedMesh(pConstBrepData data, std::vector<PNTS>& defectPolygons, bool createEdges = false);
618  virtual pIndexedMesh _makeIndexedMesh(pConstShape input, bool createEdges = false);
619  virtual pShape _makeOMFMeshShape(pConstBrepData data, std::vector<PNTS>& defectPolygons);
620  virtual pShape _makeAcisShape(pShape input);
621  virtual bool _createBrepData(pConstShape input, pBrepData data);
622  virtual pShape _makeShape(const std::vector<pFace>& faces, double tolerance);
623  virtual bool _makeShapes(const std::vector<pFace>& faces, std::vector<pShape>& shapes, double precision);
624  virtual pShape _makeShape(const std::vector<int>& model,
625  const std::vector<Geom::Pnt>& vertices,
626  std::vector<std::vector<Geom::Pnt> >& defectPolygons);
627  virtual bool _makeShapes_parallel(const std::vector<pConstBrepData>& breps, std::map<pConstBrepData, pShape>& shapes);
628  virtual pShape _makeFaceSet(const std::vector<pFace>& faces);
629  virtual pShape _makeFaceSet(pConstBrepData data);
630  virtual pShape _makeCompound(const std::vector<pConstShape>& shapes);
631  virtual int _getFaceCount(pConstTopologicalItem item);
632  virtual int _getWireCount(pConstTopologicalItem item);
633  virtual int _getEdgeCount(pConstTopologicalItem item);
634  virtual int _getVertexCount(pConstTopologicalItem item);
635  virtual int _getLumpsCount(pConstTopologicalItem item);
636  virtual int _getPolygonCount(pConstTopologicalItem item, Topo::ShapeTessellationQuality quality);
637  virtual pShape _makeShape(Core::DocObject* curve, double startParam, double endParam);
638 
639  virtual pConstFace _getFaceByIndex(pConstTopologicalItem item, int idx);
640  virtual pConstWire _getWireByIndex(pConstTopologicalItem item, int idx);
641  virtual pConstEdge _getEdgeByIndex(pConstTopologicalItem item, int idx);
642  virtual pConstVertex _getVertexByIndex(pConstTopologicalItem item, int idx);
643 
644  virtual std::vector<pConstFace> _getFaces(pConstTopologicalItem item);
645  virtual std::vector<pConstWire> _getWires(pConstTopologicalItem item);
646  virtual std::vector<pConstEdge> _getEdges(pConstTopologicalItem item);
647  virtual std::vector<pConstEdge> _getAllEdges(pConstTopologicalItem item);
648  virtual std::vector<pConstVertex> _getVertices(pConstTopologicalItem item);
649 
650 
651  virtual int _getIndexFromFace(pConstTopologicalItem item, pConstFace face);
652  virtual std::vector<int> _getIndexesFromFaces(pConstTopologicalItem item, const std::vector<pConstFace> faces);
653  virtual int _getIndexFromWire(pConstTopologicalItem item, pConstWire wire);
654  virtual int _getIndexFromEdge(pConstTopologicalItem item, pConstEdge edge);
655  virtual int _getIndexFromVertex(pConstTopologicalItem item, const Geom::Pnt& v);
656  virtual int _getIndexFromVertex(pConstTopologicalItem item, pConstVertex vtx);
657 
658  virtual std::vector<int> _getAdjacentFaceIndicesFromVertexIndex(pConstTopologicalItem item, int vertexIdx);
659  virtual std::vector<pConstFace> _getAdjacentFacesFromEdge(pConstTopologicalItem item, pConstEdge edge);
660  virtual void _getVerticesAsPoints(pConstTopologicalItem item, std::vector<Geom::Pnt>& vertices);
661  virtual Geom::Bnd_Box _getBoundingBox(pConstTopologicalItem item);
662 
663  virtual Geom::Trsf _getTransform(pConstShape shape);
664  virtual bool _calculateDetail(pConstShape shape, CA_Detail& detail, const CA_Snap& snap);
665 
666  virtual pSolid _cast2Solid(pShape shape);
667  virtual pCompound _cast2Compound(pShape shape);
668  virtual pMesh _cast2Mesh(pShape shape);
669  virtual pConstSolid _cast2ConstSolid(pConstShape shape);
670  virtual pConstCompound _cast2ConstCompound(pConstShape shape);
671  virtual pConstMesh _cast2ConstMesh(pConstShape shape);
672 
673  virtual double _getVolume(pConstTopologicalItem item);
674  virtual double _getSurfaceArea(pConstTopologicalItem item);
675  virtual bool _getCentroid(pConstShape shape, Geom::Pnt& centroid);
676  virtual void _setNeedMassUpdate(pConstShape shape, bool on);
677  virtual void _updateShapeTransform(pConstShape shape, const Geom::Trsf& transform);
678  virtual bool _write(pConstShape shape, std::ostream& writer);
679  virtual bool _write(pConstShape shape, Base::AbstractWriter& writer);
680 
681  virtual std::string _getWriteFormat(pConstShape shape);
682 
683  virtual bool _write(const std::string& format, pConstShape shape, const Base::String& fileName);
684  virtual bool _write(const std::string& format, std::vector<pConstShape> shapes, const Base::String& fileName);
685  virtual bool _writeAcisFile(std::vector<pConstShape> shapes,
686  const Base::String& fileName,
687  bool isText,
688  int major_version,
689  int minor_version,
690  double scale);
691  virtual bool _appendAcisFile(std::vector<pConstShape> shapes,
692  const Base::String& fileName,
693  bool isText,
694  int major_version,
695  int minor_version,
696  double scale);
697  virtual bool _canWriteAs(const std::string& format, pConstShape shape);
698  virtual bool _intersectBBoxes(pConstShape shape1, pConstShape shape2);
699 
700  virtual pShape _cut(pConstShape base, pConstShape tool, bool* ok);
701  virtual pShape _cut(pConstShape base, const std::vector<pConstShape> tools, bool* ok);
702  virtual pShape _fuse(pConstShape base, pConstShape tool, bool* ok);
703  virtual bool _imprint(pShape base, pShape tool);
704  virtual pShape _common(pConstShape base, pConstShape tool, bool* ok);
705  virtual pShape _section(pConstShape base, pConstShape tool, bool* ok);
706  virtual pShape _s_cut(pConstShape base, pConstShape tool);
707  virtual pShape _s_common(pConstShape base, pConstShape tool);
708  virtual pShape _cutWithPlane(pConstShape aBlank, const Geom::Pln& aPlane, bool* ok = 0);
709  virtual pShape _splitByPlane(pConstShape aBlank, const Geom::Pln& aPlane, bool* ok = 0);
710 
711  virtual pShape _transformed(pConstShape base, const Geom::Trsf& t);
712  virtual pShape _moved(pConstShape base, const Geom::XYZ& xyz);
713  virtual pShape _scaled(pConstShape base, const Geom::XYZ& scale);
714  virtual bool _isValid(pConstShape shape, int checkLevel);
715  virtual bool _isValid(pConstFace face, int checkLevel);
716  virtual bool _isValid(pConstWire wire, int checkLevel);
717  virtual bool _isValid(pConstVertex vertex, int checkLevel);
718  virtual bool _isValid(pConstEdge edge, int checkLevel);
719  virtual bool _isValid(pShape shape, int checkLevel);
720  virtual bool _isValid(pFace face, int checkLevel);
721  virtual bool _isValid(pWire wire, int checkLevel);
722  virtual bool _isValid(pVertex vertex, int checkLevel);
723  virtual bool _isValid(pEdge edge, int checkLevel);
724  virtual bool _isValidInCadwork3d(pConstTopologicalItem shape);
725  virtual bool _isEqual(pConstTopologicalItem item1, pConstTopologicalItem item2);
726  virtual bool _cleanupShape(pShape shape);
727 
728  virtual Topo::GeometricInformation _getGeometricInformation(pConstTopologicalItem shape);
729  virtual void _getAxesOrientedSurfaces(pConstShape shape, double& XYSurface, double& XZSurface, double& YZSurface);
730  virtual void _getVerticalAndHorizontalFaceAreas(pConstShape shape,
731  double& verticalFaceSurface,
732  std::vector<double>& verticalFaceSurfaces,
733  double& verticalLargestFaceSurface,
734  double& horizontalFaceSurface);
735  virtual double _getAreaFromTop(pConstShape shape, pMesh* areaFromTopMesh);
736  virtual pShape _copy(pConstShape shape, bool deepCopy);
737  virtual App::Element* _makeDbgElementFromShape(Core::CoreDocument* doc, pConstShape shape, const Base::Color& color);
738  virtual App::SubElement* _makeDbgSubElementFromShape(Core::CoreDocument* doc, pConstShape shape, const Base::Color& color);
739  virtual bool _getTopoDS_Shape(pConstTopologicalItem shape, TopoDS_Shape& topoShape);
740  virtual bool _isFaceted(pConstTopologicalItem shape);
741  virtual bool _hasVoids(pConstTopologicalItem shape);
742  virtual pShape _mergePlanarFaces(pConstShape shape);
743  virtual bool _convertToPolygonalFaces(pConstShape shape, std::vector<pFace>& polyFaces, bool precise = false);
744 
745  virtual pShape _extrudedWire(pConstWire wire, const Geom::Dir& extrudedDirection, double depth, double precision);
746  virtual std::vector<Geom::Pnt> _getIntersectionPoints(pConstShape shape, const std::vector<pConstShape> shapes);
747  virtual std::vector<Geom::Pnt> _getAllIntersectionPoints(const std::vector<pConstShape> shapes);
748  virtual bool _hasTriangulation(pConstShape shape);
749  virtual pShape _createShell(pConstShape shape);
750  virtual pShape _createSheet(pConstShape shape, bool doubleSided);
751 
752  virtual std::vector<pShape> _splitLumps(pConstShape shape);
753 
754  virtual bool _hasFaces(pConstShape shape, bool& allSubShapesHaveFaces);
755  virtual bool _isNull(pConstShape shape);
756  virtual pShape _deformed(pConstShape shape, const Geom::GTrsf& t, const Geom::Pnt& p);
757  virtual std::vector<pShape> _getShapesFromAcisFile(const Base::String& fileName, double scaleFactor = 1., std::function<int(int)> callback = 0);
758  virtual pShape _importBrep(const Base::String& filename);
759  virtual pShape _mirrored(pConstShape shape, const Geom::Ax2& ax);
760  virtual Topo::ToolOutcome _clash(pConstShape shape1, pConstShape shape2, bool& hasClash);
761  virtual Topo::ToolOutcome _clashBodies(pConstShape shape1,
762  pConstShape shape2,
763  Topo::BodyClashType& clashType,
765  virtual std::vector<VisibleEdge> _getEdges_visible(std::vector<pConstShape> shapes,
766  const Geom::Pnt& cam_position,
767  const Geom::Pnt& cam_target,
768  bool cam_perspective = true);
769  virtual Topo::ToolOutcome _createElementFromShape(Core::CoreDocument* doc,
770  pConstShape shape,
771  App::Element*& newElement,
772  App::Element* sample = 0);
773  virtual bool _getAttributeInteger(pConstTopologicalItem shape, const Base::String& name, int& value);
774  virtual bool _setAttributeInteger(pConstTopologicalItem shape, const Base::String& name, int value);
775  virtual bool _removeAttribute(pConstTopologicalItem shape, const Base::String& name);
776  virtual Topo::ToolOutcome _rayPick(const std::vector<pConstTopologicalItem>& targets, const CA_Ray& ray, Topo::RayHitVector& found);
777  virtual void _removeFaceting(pConstTopologicalItem item);
778  virtual bool _getColorRGB(pConstShape shape, int& r, int& g, int& b);
779  virtual pShape _simplifyShape(pConstShape shape, const SimplifyOptions& opts);
780  virtual pShape _offsetShape(pConstShape shape, double offset);
781  virtual pShape _thickenSheets(pConstShape shape, double thickness, bool doubleSided, Base::String& errorInfo);
782 
783  virtual pShape _skinning(Base::String& errorInfo, const Topo::SkinningOptions&, const double&)
784  {
785  errorInfo = L"Not implemented";
786  return nullptr;
787  }
788  virtual pShape _sweeping(Base::String& errorInfo, const Topo::SweepingOptions&)
789  {
790  errorInfo = L"Not implemented";
791  return nullptr;
792  }
793 
794  virtual double _getModelingTolerance();
795  virtual void _debugShape(pConstShape shape, int checkLevel, Topo::ShapeInfo& info);
796  virtual bool _isManifold(pConstShape shape);
797  virtual bool _restoreGlobalAttachment(Base::GlobalAttachment* gAtta, std::istream*, uint64_t streamsize, const Base::String& entryName);
798 
799  virtual bool _getAttributeString(pConstTopologicalItem shape, const Base::String& name, Base::String&);
800  virtual bool _setAttributeString(pConstTopologicalItem shape, const Base::String& name, const Base::String&);
801  // Don't copy attribute at Copy/Slip/Merge
802  virtual bool _setAttributeStringNonCopy(pConstTopologicalItem shape, const Base::String& name, const Base::String&);
803  virtual size_t _getAttributeCount(pConstTopologicalItem shape);
804  virtual int _getFaceIndexByPointOnFace(pConstTopologicalItem shape, const Geom::Pnt& p);
805  virtual std::vector<int> _getFaceIndexesByPointOnFace(pConstTopologicalItem shape, const Geom::Pnt& p);
806 
807  virtual Topo::ThreadPool* _getThreadPool();
808  virtual bool _setCdwkSATAttributes(pConstShape shape, const Topo::Cdwk_SAT_Attributes& att);
809  virtual void _releaseCdwkSATAttributes(pConstShape shape) {}
810  virtual void _transformShape2LocalSpaceOfElement(App::Element* elem, pShape shape);
811  virtual pShape _removedSliverFaces(pConstShape aShape, double aTolerance);
812  virtual bool _hasSliverFaces(pConstShape shape);
813 
814  virtual bool _hasPolyHedral();
815  virtual bool _getModelFromPolyHedral(pShape shape, std::vector<int>& model, std::vector<Geom::Pnt>& vertices);
816  virtual pShape _makePolyHedral(const std::vector<int>& model,
817  const std::vector<Geom::Pnt>& vertices,
818  bool checkShape,
819  std::vector<std::vector<Geom::Pnt> >& defectPolygons);
820  virtual bool _is_polyhedral_body(BODY const* iBody);
821 
822  virtual bool _getEntityAttribute_Int(ENTITY* ent, int& v);
823  virtual bool _setEntityAttribute_Int(ENTITY* ent, int v);
824 
825 
826 
827 #endif
828 private:
829  static bool _hasSameShapeTool(pConstTopologicalItem shape1, pConstTopologicalItem shape2);
830  static Topo::ShapeTool* getShapeTool(pConstTopologicalItem item);
831 
832  static Topo::ShapeTool* _acisTool;
833  static Topo::ShapeTool* _occTool;
834  static Topo::ShapeTool* _defaultTool;
835  static Topo::ShapeTool* _inventorTool;
836  static Topo::ShapeTool* _omfTool;
837  static Topo::ShapeTool* _acisMeshShapeTool;
838 
839  static size_t _shapeCount;
841 };
842 
843 
844 
845 } // namespace Topo
pConstShell
std::shared_ptr< Topo::Shell const > pConstShell
Definition: Types.h:69
Topo::ShapeTool::setNeedMassUpdate
static void setNeedMassUpdate(pConstShape shape, bool on)
Topo::ShapeTool::makeShapeAsync
static void makeShapeAsync(pConstBrepData data, std::function< void(pShape newShape, std::vector< PNTS > defectPolygons)> onShapeMadeCB)
Makes a shape from BrepData.
pConstVertex
std::shared_ptr< Topo::Vertex const > pConstVertex
Definition: Types.h:74
Topo::ShapeTool::isSingleEdge
static pConstEdge isSingleEdge(pConstShape shape)
Checks if the shape consists of one single wire with one edge and no faces. Returns the edge or nullp...
Topo::ShapeTool::getFacesAsCopy
static std::vector< pFace > getFacesAsCopy(pConstTopologicalItem item)
Returns the faces of the shape as Copy.
Topo::ShapeTool::isVertex
static bool isVertex(pConstShape shape)
Checks if the shape is a vertex.
Topo::ShapeTool::hasFaces
static bool hasFaces(pConstShape shape, bool &allSubShapesHaveFaces)
Topo::ShapeTool::BuildingElementHintEnum
BuildingElementHintEnum
Definition: ShapeTool.h:125
Topo::ShapeTool::clashBodies
static Topo::ToolOutcome clashBodies(pConstShape shape1, pConstShape shape2, Topo::BodyClashType &clashType, Topo::ClashMode clashMode=Topo::ClashMode::CLASH_CLASSIFY_BODIES)
Perform a real clash of two shapes and report the way in which these shapes clash.
Topo::ShapeTool::getModelFromPolyHedral
static bool getModelFromPolyHedral(pShape shape, std::vector< int > &model, std::vector< Geom::Pnt > &vertices)
Topo::ShapeTool::cast2Mesh
static pMesh cast2Mesh(pShape shape)
Casts a shape to a mesh. Returns nullptr if cast is not possible.
Geom::Bnd_Box
Definition: Bnd_Box.h:67
Base::Color
Definition: Color.h:39
Topo::ShapeTool::getShapesFromAcisFile
static std::vector< pShape > getShapesFromAcisFile(const Base::String &fileName, double scaleFactor=1., std::function< int(int)> callback=0)
Reads in a SAT file and converts each ACIS BODY into a pShape.
Topo::ShapeTool::isExtrudedAreaSolid
static bool isExtrudedAreaSolid(pConstShape aShape, Geom::Ax2 &aPosition, double &aLength, pConstFace &aProfile, BuildingElementHintEnum aHint=BuildingElementHintEnum::NO_HINT)
Checks if shape is an ExtrudedAreaSolid and returns the parameters.
Topo::ShapeTool::getPolygonCount
static int getPolygonCount(pConstTopologicalItem item, Topo::ShapeTessellationQuality quality)
Returns number of polygons in a shape.
Topo::ShapeTool::getCentroid
static bool getCentroid(pConstShape shape, Geom::Pnt &centroid)
Computes the center of gravity of a shape. Returns false in case of error.
Topo::ShapeTool::cut
static pShape cut(pConstShape base, const std::vector< pConstShape > tools, bool *ok=0)
Topo::ShapeTool::rayPick
static Topo::ToolOutcome rayPick(const std::vector< pConstTopologicalItem > &targets, const CA_Ray &ray, Topo::RayHitVector &found)
Make a RayPick.
Topo::ShapeTool::createBrepData
static bool createBrepData(pConstShape input, pBrepData data)
Create BrepData.
Core::CoreDocument
Definition: CoreDocument.h:269
Topo::ShapeTool::ShapeTool
ShapeTool(void)
Topo::ShapeTool::isValid
static bool isValid(pConstEdge edge, int checkLevel=30)
Checks if the shape is valid. Check level can be between 10 (fast, but not profound) and 70 (slow and...
Topo::ShapeTool::mergePlanarFaces
static pShape mergePlanarFaces(pConstShape shape)
Returns a new shape where all planar faces of 'shape' are merged.
Topo::ShapeTool::removedSliverFaces
static pShape removedSliverFaces(pConstShape shape, double aTolerance=-1)
Topo::ShapeTool::isValid
static bool isValid(pConstShape shape, int checkLevel=30)
Checks if the shape is valid. Check level can be between 10 (fast, but not profound) and 70 (slow and...
Topo::ShapeTool::isManifold
static bool isManifold(pConstShape shape)
Topo::ShapeTool::getEdgeIndicesFromFace
static std::vector< int > getEdgeIndicesFromFace(pConstTopologicalItem item, int faceIndex)
Returns edge indices of the face with index 'faceIndex'.
Topo::ShapeTool::removeAttribute
static bool removeAttribute(pConstTopologicalItem shape, const Base::String &name)
Remove Attribute from Shape.
Base::transform
void transform(Container container, OutputIt out, BinaryFunction function)
Definition: Algorithms.h:30
Topo::ToolOutcome
Definition: ToolOutcome.h:6
Topo::ShapeTool::shapeCountDec
static void shapeCountDec()
Topo::ShapeTool::makeAcisShape
static pShape makeAcisShape(pShape input)
Make Acis-Shape.
Topo::ShapeTool::convertToPolygonalFaces
static bool convertToPolygonalFaces(pConstShape shape, std::vector< pFace > &polyFaces, bool precise=false)
Converts an advanced BRep (with NURBS) into a faceted BRep.
Precision.h
Topo::ShapeTool::makeFaceSet
static pShape makeFaceSet(const std::vector< pFace > &faces)
Makes a shape from a vector of pFaces. The faces are not stitched together and may be unconnected.
Topo::ShapeTool::getVertexCount
static int getVertexCount(pConstTopologicalItem item)
Returns the number of vertices in the shape.
Topo::ShapeTool::cast2Solid
static pSolid cast2Solid(pShape shape)
Casts a shape to a solid. Returns nullptr if cast is not possible.
Topo::ShapeTool::copy
static pShape copy(pConstShape shape, bool deepCopy=true)
Makes a copy of the shape.
Topo::ShapeTool::getTopoDS_Shape
static bool getTopoDS_Shape(pConstTopologicalItem shape, TopoDS_Shape &topoShape)
Gets the TopoDS_Shape of 'shape'. Returns 'true' on success, 'false' if shape has no TopoDS_Shape or ...
Topo::ShapeTool::getSurfaceArea
static double getSurfaceArea(pConstTopologicalItem item)
GeometricInformation.h
Topo::ShapeTool::getEdges
static std::vector< pConstEdge > getEdges(pConstTopologicalItem item)
Returns the edges of the shape.
Topo::ShapeInfo
Definition: ShapeInfo.h:7
Topo::ShapeTool::getWireCount
static int getWireCount(pConstTopologicalItem item)
Returns the number of wires in the shape.
Topo::ShapeTool::common
static pShape common(pConstShape base, pConstShape tool, bool *ok=0)
pConstSolid
std::shared_ptr< Topo::Solid const > pConstSolid
Definition: Types.h:68
Topo::ShapeTool::isEqual
static bool isEqual(pConstTopologicalItem shape1, pConstTopologicalItem shape2)
Checks if TopologicalItems are equal. Two items are equal if they have the same underlying pointer.
Topo::ShapeTool::makeInventorMeshShape
static pShape makeInventorMeshShape(pConstBrepData data, std::vector< PNTS > &defectPolygons)
Makes a mesh-shape from BrepData.
Topo::ShapeTool::getEdges_visible
static std::vector< VisibleEdge > getEdges_visible(std::vector< pConstShape > shapes, const Geom::Pnt &cam_position, const Geom::Pnt &cam_target, bool cam_perspective=true)
Returns the visible edges of the shape.
Topo::ShapeTool::clash
static Topo::ToolOutcome clash(pConstShape shape1, pConstShape shape2, bool &hasClash)
Performs a clash of two shapes and reports if they touch one another.
Topo::ShapeTool::deformed
static pShape deformed(pConstShape shape, const Geom::GTrsf &t, const Geom::Pnt &p)
Returns a deformed shape, based on a base point and a transformation.
Topo::ShapeTool::makeIndexedMesh
static pIndexedMesh makeIndexedMesh(pConstShape input, bool createEdges=false)
Makes a indexed-Mesh from shape.
Topo::ShapeTool::getVertices
static std::vector< pConstVertex > getVertices(pConstTopologicalItem item)
Returns the vertices of the shape.
Topo::ShapeTool::isCylinder
static bool isCylinder(pConstShape shape, Geom::Ax2 &position, double &length, double &radius)
Checks if shape is a cylinder and returns the parameters.
Topo::ShapeTool::getAttributeInteger
static bool getAttributeInteger(pConstTopologicalItem shape, const Base::String &name, int &value)
Get Attribute from Shape.
Topo::ShapeTool::triangulationToMesh
static pMesh triangulationToMesh(pConstShape shape)
Topo::ShapeTool::write
static bool write(pConstShape shape, std::ostream &writer)
Writes a shape to ostream.
Topo::ShapeTool::getVerticalAndHorizontalFaceAreas
static void getVerticalAndHorizontalFaceAreas(pConstShape shape, double &verticalFaceSurface, std::vector< double > &verticalFaceSurfaces, double &verticalLargestFaceSurface, double &horizontalFaceSurface)
Topo::ShapeTool::cast2ConstSolid
static pConstSolid cast2ConstSolid(pConstShape shape)
Casts a shape to a solid. Returns nullptr if cast is not possible.
Topo::ShapeTool::getColorRGB
static bool getColorRGB(pConstShape shape, int &r, int &g, int &b)
Get RGB values associated with this shape. Useful if color is defined by an ACIS attribute when impor...
pConstWire
std::shared_ptr< Topo::Wire const > pConstWire
Definition: Types.h:71
Topo::ShapeTool::makeShape
static pShape makeShape(pWire wire, double precision=Geom::Precision::linear_Resolution())
Makes a shape from a single wire.
Topo::ShapeTool::shapeCountInc
static void shapeCountInc()
Topo::ShapeTool::getVolume
static double getVolume(pConstTopologicalItem item)
Returns the volume of a shape. Returns 0 if shape has no volume.
Topo::ShapeTool::getEntityAttribute_Int
static bool getEntityAttribute_Int(ENTITY *ent, int &v)
Topo::ShapeTool::getAttributeString
static bool getAttributeString(pConstTopologicalItem shape, const Base::String &name, Base::String &)
Get Attribute to Shape.
pBrepData
std::shared_ptr< Geom::BrepData > pBrepData
Definition: PropertyBrepData.h:5
Topo::ShapeTool::read
static pShape read(const std::string &format, std::istream &reader)
Reads a shape from istream in given format.
Topo::ShapeTool::createSheet
static pShape createSheet(pConstShape shape, bool doubleSided)
Topo::SkinningOptions
Definition: NurbsOptions.h:21
pFace
std::shared_ptr< Topo::Face > pFace
Definition: Types.h:53
Geom::XYZ
Definition: XYZ.h:44
Topo::ShapeTool::isWire
static bool isWire(pConstShape shape)
Checks if the shape is a wire.
Topo::ShapeTool::getIndexFromVertex
static int getIndexFromVertex(pConstTopologicalItem item, pConstVertex vtx)
Return the index of vertex 'vtx'. Returns -1 if vertex is not part of this shape.
Topo::ShapeTool::transformed
static pShape transformed(pConstShape base, const Geom::Trsf &t)
Creates a copy of the shape and transforms the copy.
Topo::ShapeTool::calculateLocalAxes
static bool calculateLocalAxes(pConstShape shape, Geom::Ax2 &localAxes)
Topo::ShapeTool::getFaces
static std::vector< pConstFace > getFaces(pConstTopologicalItem item)
Returns the faces of the shape.
pConstShape
std::shared_ptr< Topo::Shape const > pConstShape
Definition: Variant.h:65
Topo::ShapeTool::restoreGlobalAttachment
static bool restoreGlobalAttachment(Base::GlobalAttachment *gAtta, std::istream *, uint64_t streamsize, const Base::String &entryName)
Topo::ShapeTool::getEdgeCount
static int getEdgeCount(pConstTopologicalItem item)
Returns the number of edges in the shape.
Topo::ShapeTool::writeAcisFile
static bool writeAcisFile(std::vector< pConstShape > shapes, const Base::String &fileName, bool isText, int major_version=-1, int minor_version=-1, double scale=1.)
Topo::ShapeTool::s_common
static pShape s_common(pConstShape base, pConstShape tool)
Topo::ShapeTool::getLargestFaceNormal
static Geom::Dir getLargestFaceNormal(pConstShape shape)
Color.h
Topo::ShapeTool::~ShapeTool
virtual ~ShapeTool(void)
Topo::ClashMode::CLASH_CLASSIFY_BODIES
@ CLASH_CLASSIFY_BODIES
Geom::Dir
Definition: Dir.h:45
Topo::ShapeTool::getAllIntersectionPointsWithLineIn2DMode
static void getAllIntersectionPointsWithLineIn2DMode(const std::vector< pConstShape > &shapes, const Geom::Pnt &linePnt1, const Geom::Pnt &linePnt2, std::vector< Geom::Pnt > &intersectionPoints)
Topo::ShapeTool::getFaceCount
static int getFaceCount(pConstTopologicalItem item)
Returns the number of faces in the shape.
Topo::ShapeTool::getBoundingBox
static Geom::Bnd_Box getBoundingBox(pConstTopologicalItem item)
Returns the bounding box of the shape.
Topo::ShapeTool::hasOnlyLineWires
static bool hasOnlyLineWires(pConstShape shape)
Topo::GeometricInformation
Definition: GeometricInformation.h:7
Topo::ShapeTool::hasPolyHedral
static bool hasPolyHedral()
Topo::ShapeTool::isSingleWire
static pConstWire isSingleWire(pConstShape shape)
Checks if the shape consists of one single wire and no faces. Returns the wire or nullptr.
Topo::ShapeTool::getAllIntersectionPointsWithLineIn2DMode
static void getAllIntersectionPointsWithLineIn2DMode(pConstShape shape, const Geom::Pnt &linePnt1, const Geom::Pnt &linePnt2, std::vector< Geom::Pnt > &intersectionPoints)
Topo::ShapeTool::isMesh
static bool isMesh(pConstShape shape)
Checks if the shape is a mesh.
Topo::ShapeTool::is_polyhedral_body
static bool is_polyhedral_body(BODY const *iBody)
Topo::Cdwk_SAT_Attributes
Definition: ShapeAttributes.h:20
Topo::ShapeTool::makeOMFMeshShape
static pShape makeOMFMeshShape(pConstBrepData data, std::vector< PNTS > &defectPolygons)
Makes a mesh-shape from BrepData.
Topo::ShapeTool::getVertexIndicesFromWire
static std::vector< int > getVertexIndicesFromWire(pConstTopologicalItem item, int wireIdx)
Returns sorted vertex indices of the wire with index 'wireIdx'.
Topo::ShapeTool::makeShape
static pShape makeShape(BODY *aBody)
Makes a shape from Acis BODY.
Topo::ShapeTool::thickenSheets
static pShape thickenSheets(pConstShape shape, double thickness, bool doubleSided, Base::String &errorInfo)
Thickens a shape consisting of sheets. If input shape is not a single sided sheet the function tries ...
Topo::ShapeTool::getLumpsCount
static int getLumpsCount(pConstTopologicalItem item)
Returns the number of lumps in the shape.
Topo::ShapeTool::isOpenShell
static bool isOpenShell(pConstShape shape)
Checks if the shape is an open shell.
Core::DocObject
Definition: DocObject.h:54
pShape
std::shared_ptr< Topo::Shape > pShape
Definition: Variant.h:64
Topo::ShapeTool::makeDbgSubElementFromShape
static App::SubElement * makeDbgSubElementFromShape(Core::CoreDocument *doc, pConstShape shape, const Base::Color &color=Base::Color(204, 204, 204))
Returns a test element - for testing only!
Topo::ShapeTool::isValid
static bool isValid(pConstFace face, int checkLevel=30)
Checks if the shape is valid. Check level can be between 10 (fast, but not profound) and 70 (slow and...
pEdge
std::shared_ptr< Topo::Edge > pEdge
Definition: Types.h:55
Geom::GTrsf
Definition: GTrsf.h:49
Geom::Pln
Definition: Pln.h:52
Topo::ShapeTool::getFaceIndexesByPointOnFace
static std::vector< int > getFaceIndexesByPointOnFace(pConstTopologicalItem shape, const Geom::Pnt &p)
pWire
std::shared_ptr< Topo::Wire > pWire
Definition: Types.h:54
Topo::ShapeTool::getWireByIndex
static pConstWire getWireByIndex(pConstTopologicalItem item, int idx)
Returns the wire at index 'idx'. Returns nullptr if index is out of bounds.
Topo::ShapeTool::getThreadPool
static Topo::ThreadPool * getThreadPool()
pConstCompound
std::shared_ptr< Topo::Compound const > pConstCompound
Definition: Types.h:67
pCompound
std::shared_ptr< Topo::Compound > pCompound
Definition: Types.h:50
Topo::ShapeTool::makeShapes_parallel
static bool makeShapes_parallel(const std::vector< pConstBrepData > &breps, std::map< pConstBrepData, pShape > &shapes)
Makes shapes from BrepData in parallel.
Topo::ShapeTool::makeShape
static pShape makeShape(pConstBrepData data, std::vector< PNTS > &defectPolygons)
Makes a shape from BrepData.
Topo::ShapeTool::imprint
static bool imprint(pShape base, pShape tool)
Intersects two shapes and imprints the intersection graph on BOTH shapes (if a closed loop of edges i...
Topo::ShapeTool::getAllIntersectionPointsIn2DMode
static void getAllIntersectionPointsIn2DMode(const std::vector< pConstShape > &shapes, const Geom::Pnt &pnt, const double &distance, std::vector< Geom::Pnt > &intersectionPoints)
Topo::ShapeTool::sweeping
static pShape sweeping(Base::String &errorInfo, const Topo::SweepingOptions &sweepOptions)
pMesh
std::shared_ptr< Topo::MeshShape > pMesh
Definition: Types.h:49
pConstFace
std::shared_ptr< Topo::Face const > pConstFace
Definition: Types.h:70
Topo::ShapeTool::isFaceted
static bool isFaceted(pConstTopologicalItem shape)
Checks if the shape consists only of planar faces.
Topo::ShapeTool::makeShape
static pShape makeShape(const std::vector< pFace > &faces, double precision=Geom::Precision::linear_Resolution())
Topo::ShapeTool::isValidInCadwork3d
static bool isValidInCadwork3d(pConstTopologicalItem shape)
Checks if the shape is valid in cadwork3d. The checking level and type of checking are identical to t...
Topo::ShapeTool::offsetShape
static pShape offsetShape(pConstShape shape, double offset)
pSolid
std::shared_ptr< Topo::Solid > pSolid
Definition: Types.h:51
Topo::ShapeTool::makeShape
static pShape makeShape(pEdge edge)
Makes a shape from a single edge.
Topo::ShapeTessellationQuality
Definition: ShapeTessellationQuality.h:7
Topo::ShapeTool::setEntityAttribute_Int
static bool setEntityAttribute_Int(ENTITY *ent, int v)
ShapeTessellationQuality.h
Topo::ShapeTool::intersectBBoxes
static bool intersectBBoxes(pConstShape shape1, pConstShape shape2)
Core
Definition: Base.h:5
Topo::ShapeTool::setAttributeStringNonCopy
static bool setAttributeStringNonCopy(pConstTopologicalItem shape, const Base::String &name, const Base::String &)
Set Attribute to Shape, Don't copy attribute at Copy/Slip/Merge.
Topo::ShapeTool::createShell
static pShape createShell(pConstShape shape)
pVertex
std::shared_ptr< Topo::Vertex > pVertex
Definition: Types.h:57
MesherAcis
Definition: FaceTool.h:21
Topo::SweepingOptions
Definition: NurbsOptions.h:189
Topo::ShapeTool::makeShape
static pShape makeShape(pFace face)
Makes a shape from a single face.
Topo::ShapeTool::canWriteAs
static bool canWriteAs(const std::string &format, pConstShape shape)
Checks if shape can be written in given format.
Base::Double
Definition: Double.h:6
Geom::Pnt
Defines a non-persistent 3D Cartesian point.
Definition: Pnt.h:44
Topo::RayHitVector
std::vector< RayHit > RayHitVector
Definition: RayHit.h:45
Geom::Ax2
Definition: Ax2.h:66
Topo::ShapeTool::debugShape
static void debugShape(pConstShape shape, int checkLevel, ShapeInfo &info)
Topo::ShapeTool::makeShape
static pShape makeShape(const std::vector< int > &model, const std::vector< Geom::Pnt > &vertices, std::vector< PNTS > &defectPolygons)
Makes a shape from BrepData.
Topo::ShapeTool::hasTriangulation
static bool hasTriangulation(pConstShape shape)
Checks if the shape has a triangulation ( = the shape is tessellated )
Base::AbstractWriter
Definition: Writer.h:13
Topo::ShapeTool::splitByPlane
static pShape splitByPlane(pConstShape aBlank, const Geom::Pln &aPlane, bool *ok=0)
Topo::ShapeTool::makeIndexedMesh
static pIndexedMesh makeIndexedMesh(pConstBrepData data, std::vector< PNTS > &defectPolygons, bool createEdges=false)
Makes a indexed-Mesh from BrepData.
Topo::ShapeTool::makeCompound
static pShape makeCompound(const std::vector< pConstShape > &shapes)
Topo::ShapeTool::getAttributeCount
static size_t getAttributeCount(pConstTopologicalItem shape)
Get Attribute-Count.
Topo::ShapeTool::cast2Compound
static pCompound cast2Compound(pShape shape)
Casts a shape to a compound. Returns nullptr if cast is not possible.
Topo::ShapeTool::getFacesByMaxNormalToVectorAngle
static void getFacesByMaxNormalToVectorAngle(pConstShape aShape, std::map< int, Geom::Vec > aDirectionsToSortBy, std::map< int, std::vector< pConstFace > > &aFacesListMap, float aMaxAngleRad=0.75)
Topo::ShapeTool::isSingleFace
static pConstFace isSingleFace(pConstShape shape)
Checks if the shape consists of one single face. Returns the face or nullptr.
Topo::ShapeTool::getIndexesFromFaces
static std::vector< int > getIndexesFromFaces(pConstTopologicalItem item, const std::vector< pConstFace > faces)
Returns the indexes of the faces in this shape. Returns -1 if face is not part of this shape.
pIndexedMesh
std::shared_ptr< Geom::IndexedMesh > pIndexedMesh
Definition: IndexedMesh.h:59
Topo::BodyClashType
BodyClashType
Definition: Clash.h:6
Topo::SimplifyOptions
Definition: SimplifyOptions.h:7
Geom::distance
double distance(const Geom::Vec &v1, const Geom::Vec &v2)
Returns the distance between two points.
Definition: Vec.h:341
Topo::ShapeTool::cast2ConstMesh
static pConstMesh cast2ConstMesh(pConstShape shape)
Casts a shape to a mesh. Returns nullptr if cast is not possible.
Topo::ShapeTool::getVerticesAsPoints
static void getVerticesAsPoints(pConstTopologicalItem item, std::vector< Geom::Pnt > &vertices)
Returns the vertices of a shape as a vector of points.
Topo::ShapeTool::getIndexFromFace
static int getIndexFromFace(pConstTopologicalItem item, pConstFace face)
Returns the index of the face in this shape. Returns -1 if face is not part of this shape.
pConstBrepData
std::shared_ptr< const Geom::BrepData > pConstBrepData
Definition: BrepData.h:31
Topo::ShapeTool::getIndexFromVertex
static int getIndexFromVertex(pConstTopologicalItem item, const Geom::Pnt &v)
TODO -> This method is wrong since one gp_Pnt can correspond to more than one index.
pConstMesh
std::shared_ptr< Topo::MeshShape const > pConstMesh
Definition: Types.h:66
Topo::ShapeTool::setCdwkSATAttributes
static bool setCdwkSATAttributes(pConstShape shape, const Topo::Cdwk_SAT_Attributes &att)
Sets the cadwork SAT attributes.
Topo::ShapeTool::extrudedWire
static pShape extrudedWire(pConstWire wire, const Geom::Dir &extrudedDirection, double depth, double precision)
Extrudes a wire in the given extrudedDirection with the given depth. It returns nullptr on failure.
pConstEdge
std::shared_ptr< Topo::Edge const > pConstEdge
Definition: Types.h:72
Topo::ShapeTool::makeDbgElementFromShape
static App::Element * makeDbgElementFromShape(Core::CoreDocument *doc, pConstShape shape, const Base::Color &color=Base::Color(204, 204, 204))
Returns a test element - for testing only!
Topo::ShapeTool::hasSliverFaces
static bool hasSliverFaces(pConstShape shape)
Topo::ShapeTool::getShells
static std::vector< pConstShell > getShells(pConstTopologicalItem item)
Returns the shells of the shape.
Topo::ShapeTool::isNull
static bool isNull(pConstShape shape)
Checks if the shape is Null.
Topo
Definition: DbgInfo.h:17
Types.h
Topo::ShapeTool
Tools for creating, manipulating and querying Shapes.
Definition: ShapeTool.h:98
Topo::ShapeTool::getWires
static std::vector< pConstWire > getWires(pConstTopologicalItem item)
Returns the wires of the shape.
Topo::ShapeTool::calculateDetail
static bool calculateDetail(pConstShape shape, CA_Detail &detail, const CA_Snap &snap)
Topo::ShapeTool::getShapeCount
static size_t getShapeCount()
Topo::ShapeTool::makeInventorMeshShape
static pShape makeInventorMeshShape(pIndexedMesh)
Makes a mesh-shape from IndexedData.
Topo::ShapeTool::skinning
static pShape skinning(Base::String &errorInfo, const Topo::SkinningOptions &skinOptions, const double &precision=Geom::Precision::linear_Resolution())
Topo::ShapeTool::getEdgeByIndex
static pConstEdge getEdgeByIndex(pConstTopologicalItem item, int idx)
Returns the edge at index 'idx'. Returns nullptr if index is out of bounds.
Topo::ClashMode
ClashMode
Definition: Clash.h:18
Topo::ShapeTool::importBrep
static pShape importBrep(Base::String filename)
Read a Brep.
Topo::ShapeTool::getVertexByIndex
static pConstVertex getVertexByIndex(pConstTopologicalItem item, int idx)
Returns the vertex at index 'idx'. Returns nullptr if index is out of bounds.
Topo::ShapeTool::getAllIntersectionPoints
static std::vector< Geom::Pnt > getAllIntersectionPoints(const std::vector< pConstShape > shapes)
Topo::ShapeTool::makeFaceSet
static pShape makeFaceSet(pConstBrepData data)
Makes a shape from BrepData. The faces are not stitched together and may be unconnected....
Topo::ShapeTool::cut
static pShape cut(pConstShape base, pConstShape tool, bool *ok=0)
Topo::ShapeTool::setAttributeString
static bool setAttributeString(pConstTopologicalItem shape, const Base::String &name, const Base::String &)
Set Attribute to Shape.
Topo::ShapeTool::makeShape
static pShape makeShape(pVertex vertex)
Makes a shape from a single vertex.
Topo::ShapeTool::setAttributeInteger
static bool setAttributeInteger(pConstTopologicalItem shape, const Base::String &name, int value)
Set Attribute to Shape.
Topo::ShapeTool::getClosestVertexToPoint
static pConstVertex getClosestVertexToPoint(pConstTopologicalItem item, const Geom::Pnt &p)
Returns vertex of the shape that is closest to the given point (if there are more vertices in the sam...
Topo::ShapeTool::appendAcisFile
static bool appendAcisFile(std::vector< pConstShape > shapes, const Base::String &fileName, bool isText, int major_version=-1, int minor_version=-1, double scale=1.)
Topo::ShapeTool::cleanupShape
static bool cleanupShape(pShape shape)
Removes all unnecessary faces, wires, edges of the shape.
Topo::ShapeTool::getIndexFromShell
static int getIndexFromShell(pConstTopologicalItem item, pConstShell shell)
Returns the index of the shell in this shape. Returns -1 if shell is not part of this shape.
Topo::ShapeTool::fuse
static pShape fuse(pConstShape base, pConstShape tool, bool *ok=0)
Topo::ShapeTool::makeShapes
static bool makeShapes(const std::vector< pFace > &faces, std::vector< pShape > &shapes, double precision=Geom::Precision::linear_Resolution())
Makes an open or closed shapes from a vector of pFaces. The faces are stitched or sewn together withi...
Topo::ShapeTool::getIntersectionPoints
static std::vector< Geom::Pnt > getIntersectionPoints(pConstShape shape, const std::vector< pConstShape > shapes)
Topo::ShapeTool::removeFaceting
static void removeFaceting(pConstTopologicalItem item)
Removes the faceting ( the triangle/mesh data ) associated with this item.
Core::version
LX_CORE_EXPORT Version & version
Topo::ShapeTool::releaseCdwkSATAttributes
static void releaseCdwkSATAttributes(pConstShape shape)
Deletes the cadwork SAT attributes.
pConstTopologicalItem
std::shared_ptr< Topo::TopologicalItem const > pConstTopologicalItem
Definition: Types.h:63
Topo::ShapeTool::isValid
static bool isValid(pConstVertex vertex, int checkLevel=30)
Checks if the shape is valid. Check level can be between 10 (fast, but not profound) and 70 (slow and...
Topo::ShapeTool::splitLumps
static std::vector< pShape > splitLumps(pConstShape shape)
Topo::ShapeTool::hasVoids
static bool hasVoids(pConstTopologicalItem shape)
Checks if any of the faces in shape has voids.
Topo::ShapeTool::moved
static pShape moved(pConstShape base, const Geom::XYZ &move)
Convenience method: Creates a copy of the shape and moves the copy.
Topo::ShapeTool::s_cut
static pShape s_cut(pConstShape base, pConstShape tool)
Base::GlobalAttachment
Definition: GlobalAttachment.h:8
Topo::ShapeTool::cast2ConstCompound
static pConstCompound cast2ConstCompound(pConstShape shape)
Casts a shape to a compound. Returns nullptr if cast is not possible.
Topo::ShapeTool::getAdjacentFacesFromEdge
static std::vector< pConstFace > getAdjacentFacesFromEdge(pConstTopologicalItem item, pConstEdge edge)
Returns all adjacent faces of an edge in a shape.
Topo::ShapeTool::write
static bool write(const std::string &format, pConstShape shape, const Base::String &fileName)
Writes the shape in the give format.
Topo::ShapeTool::getAdjacentFaceIndicesFromVertexIndex
static std::vector< int > getAdjacentFaceIndicesFromVertexIndex(pConstTopologicalItem item, int vertexIdx)
Returns the indices of all faces that contain the vertex of index 'vertexIdx'.
Topo::ShapeTool::mirrored
static pShape mirrored(pConstShape shape, const Geom::Ax2 &ax)
Returns a mirrored shape.
Topo::ShapeTool::read
static pShape read(const std::string &format, const std::string &fileName)
Reads shape from fileName in given format.
Topo::ShapeTool::simplifyShape
static pShape simplifyShape(pConstShape shape, const SimplifyOptions &opts)
Topo::ShapeTool::getTransform
static Geom::Trsf getTransform(pConstShape shape)
Returns the transform of the shape.
Topo::ShapeTool::hasNurbsFace
static bool hasNurbsFace(pConstShape shape)
Returns true if at least one of the shape's faces is NURBS face (see Topo::FaceTool::isNurbs())
Geom::Trsf
Definition: Trsf.h:58
Topo::ShapeTool::getIndexFromWire
static int getIndexFromWire(pConstTopologicalItem item, pConstWire wire)
Returns the index of the wire in this shape. Returns -1 if wire is not part of this shape.
Topo::ShapeTool::makePolyHedral
static pShape makePolyHedral(const std::vector< int > &model, const std::vector< Geom::Pnt > &vertices, bool checkShape, std::vector< std::vector< Geom::Pnt > > &defectPolygons)
Base::String
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
Topo::ShapeTool::cutWithPlane
static pShape cutWithPlane(pConstShape aBlank, const Geom::Pln &aPlane, bool *ok=0)
Topo::ShapeTool::getVerticalAndHorizontalFaceAreas
static void getVerticalAndHorizontalFaceAreas(pConstShape shape, Base::Double &verticalFaceSurface, std::vector< double > &verticalFaceSurfaces, Base::Double &verticalLargestFaceSurface, Base::Double &horizontalFaceSurface)
Returns geometric information about the horizontal and vertical faces of the shape.
ToolOutcome.h
Topo::ShapeTool::makeShape
static pShape makeShape(Core::DocObject *curve, double startParam=0, double endParam=0)
Makes a shape from a curve. If the curve is bounded startParam and endParam can be omitted.
Topo::ShapeTool::getModelingTolerance
static double getModelingTolerance()
Returns the global resolution absolute.
Topo::ShapeTool::getAreaFromTop
static double getAreaFromTop(pConstShape shape, pMesh *areFromTopMesh=nullptr)
Returns area from top (?)
Topo::ShapeTool::getFaceByIndex
static pConstFace getFaceByIndex(pConstTopologicalItem item, int idx)
Returns the face at index 'idx'. Returns nullptr if index is out of bounds.
Topo::ShapeTool::read
static pShape read(const std::string &format, const std::string &data, float version)
Reads shape in given format from data.
Topo::ShapeTool::transformShape2LocalSpaceOfElement
static void transformShape2LocalSpaceOfElement(App::Element *elem, pShape shape)
Topo::ShapeTool::isClosedSolid
static bool isClosedSolid(pConstShape shape)
Checks if the shape is a closed solid.
PNTS
std::vector< Geom::Pnt > PNTS
Definition: ShapeTool.h:76
Topo::ShapeTool::getLargestFaceArea
static double getLargestFaceArea(pConstShape shape)
Topo::ShapeTool::makeShapeAsync
static void makeShapeAsync(const std::vector< int > &model, const std::vector< Geom::Pnt > &vertices, std::function< void(pShape newShape, std::vector< PNTS > defectPolygons)> onShapeMadeCB)
Makes a shape from BrepData.
Topo::ShapeTool::getBoundingBoxSizes
static bool getBoundingBoxSizes(pConstTopologicalItem item, Geom::XYZ &sizes)
Returns the sizes of the bounding box of the shape.
Topo::ShapeTool::isClosedShell
static bool isClosedShell(pConstShape shape)
Checks if the shape is a closed shell.
Topo::ThreadPool
Definition: ThreadTask.h:36
Topo::ShapeTool::isShell
static bool isShell(pConstShape shape)
Checks if the shape is an open or closed shell.
Topo::ShapeTool::scaled
static pShape scaled(pConstShape base, const Geom::XYZ &scale)
Creates a copy of the shape and scales the copy. The scale can be non-uniform.
Topo::ShapeTool::getIndexFromEdge
static int getIndexFromEdge(pConstTopologicalItem item, pConstEdge edge)
Returns the index of the edge in this shape. Returns -1 if edge is not part of this shape.
Clash.h
Geom::Precision::linear_Resolution
static constexpr double linear_Resolution()
Definition: Precision.h:23
Topo::ShapeTool::isValid
static bool isValid(pConstWire wire, int checkLevel=30)
Checks if the shape is valid. Check level can be between 10 (fast, but not profound) and 70 (slow and...
Topo::ShapeTool::read
static pShape read(const std::string &format, const Base::String &fileName)
Reads shape from fileName in given format.
Topo::ShapeTool::write
static bool write(pConstShape shape, Base::AbstractWriter &writer)
Writes a shape to ostream.
Topo::ShapeTool::do_parallel
static void do_parallel(_InputIterator first, _InputIterator last, _Function fn)
Definition: ShapeTool.h:502
Topo::ShapeTool::createElementFromShape
static Topo::ToolOutcome createElementFromShape(Core::CoreDocument *doc, pConstShape shape, App::Element *&newElement, App::Element *sample=0)
create a Element
Topo::ShapeTool::getWireIndicesFromFace
static std::vector< int > getWireIndicesFromFace(pConstTopologicalItem item, int faceIdx)
Returns wire indices of the face with index 'faceIdx'.
Topo::ShapeTool::write
static bool write(const std::string &format, std::vector< pConstShape > shapes, const Base::String &fileName)
Writes the shapes in the give format.
Topo::ShapeTool::getAxesOrientedSurfaces
static void getAxesOrientedSurfaces(pConstShape shape, double &XYSurface, double &XZSurface, double &YZSurface)
Returns geometric information about the horizontal and vertical faces of the shape.
Topo::ShapeTool::isCompound
static bool isCompound(pConstShape shape)
Checks if the shape consists of more than one sub-shape.
Topo::ShapeTool::getWriteFormat
static std::string getWriteFormat(pConstShape shape)
Returns the save format.
Topo::ShapeTool::isSingleVertex
static pConstVertex isSingleVertex(pConstShape shape)
Checks if the shape consists of one wire with a single vertex but no edges or faces....
Base
Definition: AbstractXMLReader.h:5
Topo::ShapeTool::getGeometricInformation
static Topo::GeometricInformation getGeometricInformation(pConstTopologicalItem item)
Returns geometric information about the item (like mass etc.)
Geom
Definition: PropertyContainer.h:33
Topo::ShapeTool::updateShapeTransform
static void updateShapeTransform(pConstShape shape, const Geom::Trsf &transform)
Update the transformation of the shape and its bounding box.
Topo::ShapeTool::makeShape
static pShape makeShape(const std::vector< Base::Int > &model, const std::vector< Geom::Pnt > &vertices, std::vector< PNTS > &defectPolygons)
Makes a shape from BrepData.
Topo::ShapeTool::getFaceIndexByPointOnFace
static int getFaceIndexByPointOnFace(pConstTopologicalItem shape, const Geom::Pnt &p)
Topo::ShapeTool::section
static pShape section(pConstShape base, pConstShape tool, bool *ok=0)
Topo::ShapeTool::makeLazyFacetedBrepShape
static pShape makeLazyFacetedBrepShape(pConstBrepData data, std::vector< PNTS > &defectPolygons)
Makes a shape from BrepData.