OCCT3D About OCCT
Open CASCADE Technology Reference Manual 8.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions
BRepGraph_Copy Class Reference

Graph-to-graph deep copy. More...

#include <BRepGraph_Copy.hxx>

Public Types

enum class  GeomPolicy { Copy , Share , Drop }
 Policy for handling geometry handles (Geom_Curve, Geom_Surface, Geom2d_Curve). More...
 
enum class  MeshPolicy { Copy , Share , Drop }
 Policy for handling mesh data (Poly_Triangulation, Poly_Polygon3D, Poly_PolygonOnTriangulation). More...
 
enum class  CachePolicy { Drop , CopyFresh }
 Policy for handling transient runtime cache services. More...
 

Public Member Functions

 BRepGraph_Copy ()=delete
 

Static Public Member Functions

static bool Perform (const BRepGraph &theSourceGraph, BRepGraph &theTargetGraph, GeomPolicy theGeomPolicy=GeomPolicy::Copy, MeshPolicy theMeshPolicy=MeshPolicy::Copy, CachePolicy theCachePolicy=CachePolicy::Drop)
 Copy the entire source graph into the target graph.
 
static BRepGraph_NodeId CopyNode (const BRepGraph &theSourceGraph, BRepGraph &theTargetGraph, const BRepGraph_NodeId theNodeId, GeomPolicy theGeomPolicy=GeomPolicy::Copy, MeshPolicy theMeshPolicy=MeshPolicy::Copy, CachePolicy theCachePolicy=CachePolicy::Drop)
 Copy a single node sub-graph of any kind (Face, Shell, Solid, Wire, Edge, Vertex, etc.). The target graph receives the specified node and all entities it references.
 

Detailed Description

Graph-to-graph deep copy.

Produces a new BRepGraph from an existing one in a single bottom-up pass, avoiding the 5-7 traversals of BRepTools_Modifier used by BRepBuilderAPI_Copy.

Two copy modes:

Geometry and mesh policies are controlled by the GeomPolicy and MeshPolicy enums.

Note
Check the return value for success: Perform returns bool, CopyNode returns the mapped root NodeId (invalid on failure).

Typical usage

aGraph.Shapes().Add(myShape);
TopoDS_Shape aShape = aCopy.Shapes().Shape();
static bool Perform(const BRepGraph &theSourceGraph, BRepGraph &theTargetGraph, GeomPolicy theGeomPolicy=GeomPolicy::Copy, MeshPolicy theMeshPolicy=MeshPolicy::Copy, CachePolicy theCachePolicy=CachePolicy::Drop)
Copy the entire source graph into the target graph.
Topology-geometry graph over TopoDS / BRep.
Definition BRepGraph.hxx:122
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142
Describes a shape which.
Definition TopoDS_Shape.hxx:41

Member Enumeration Documentation

◆ CachePolicy

Policy for handling transient runtime cache services.

Enumerator
Drop 

Do not copy runtime cache services or entries.

CopyFresh 

Copy fresh, remappable runtime cache entries.

◆ GeomPolicy

Policy for handling geometry handles (Geom_Curve, Geom_Surface, Geom2d_Curve).

Enumerator
Copy 

Deep-clone geometry handles; result is fully independent.

Share 

Reuse source geometry handles; only topology is duplicated.

Drop 

Pure topology: edges carry no curves, faces carry no surfaces.

◆ MeshPolicy

Policy for handling mesh data (Poly_Triangulation, Poly_Polygon3D, Poly_PolygonOnTriangulation).

Enumerator
Copy 

Deep-clone mesh data; independent result.

Share 

Reuse source mesh handle references; no cloning.

Drop 

Discard all mesh data on copied entities.

Constructor & Destructor Documentation

◆ BRepGraph_Copy()

BRepGraph_Copy::BRepGraph_Copy ( )
delete

Member Function Documentation

◆ CopyNode()

static BRepGraph_NodeId BRepGraph_Copy::CopyNode ( const BRepGraph & theSourceGraph,
BRepGraph & theTargetGraph,
const BRepGraph_NodeId theNodeId,
GeomPolicy theGeomPolicy = GeomPolicy::Copy,
MeshPolicy theMeshPolicy = MeshPolicy::Copy,
CachePolicy theCachePolicy = CachePolicy::Drop )
static

Copy a single node sub-graph of any kind (Face, Shell, Solid, Wire, Edge, Vertex, etc.). The target graph receives the specified node and all entities it references.

External copy (theSourceGraph != theTargetGraph): New entities are appended to theTargetGraph. Entities already present in theTargetGraph are reused (not duplicated).

Self-copy (theSourceGraph == theTargetGraph): The specified sub-graph is duplicated with new entity IDs within the same graph. Shared dependencies (vertices, edges referenced from outside the sub-graph) are preserved as-is.

Parameters
[in]theSourceGrapha pre-built BRepGraph
[in,out]theTargetGraphdestination graph (may already contain data)
[in]theNodeIdnode identifier (any kind)
[in]theGeomPolicygeometry handle policy (default: Copy)
[in]theMeshPolicymesh data policy (default: Copy)
Returns
the mapped root NodeId in theTargetGraph, or invalid NodeId on failure

◆ Perform()

static bool BRepGraph_Copy::Perform ( const BRepGraph & theSourceGraph,
BRepGraph & theTargetGraph,
GeomPolicy theGeomPolicy = GeomPolicy::Copy,
MeshPolicy theMeshPolicy = MeshPolicy::Copy,
CachePolicy theCachePolicy = CachePolicy::Drop )
static

Copy the entire source graph into the target graph.

Self-copy (theSourceGraph == theTargetGraph): Identity no-op, returns true immediately.

External copy to empty target (theTargetGraph.IsEmpty()): Uses identity-mapped fast path (old index == new index).

External copy to non-empty target: Uses explicit mapping; IDs in theTargetGraph will differ from theSourceGraph. Entities from theSourceGraph are appended to theTargetGraph.

Parameters
[in]theSourceGrapha pre-built BRepGraph (must not be empty)
[in,out]theTargetGraphdestination graph (may already contain data)
[in]theGeomPolicygeometry handle policy (default: Copy)
[in]theMeshPolicymesh data policy (default: Copy)
Returns
true on success, false on failure (empty source)

The documentation for this class was generated from the following file: