Open CASCADE Technology Reference Manual 8.0.2
Loading...
Searching...
No Matches
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:

  • External: source and target are different graphs. Target receives the copied data.
  • Self-copy: source and target are the same graph. The specified sub-graph is duplicated with new entity IDs; shared dependencies (geometry, vertices referenced from outside the sub-graph) are preserved.

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

BRepGraph aGraph;
aGraph.Shapes().Add(myShape);
BRepGraph aCopy;
BRepGraph_Copy::Perform(aGraph, aCopy);
TopoDS_Shape aShape = aCopy.Shapes().Shape();
TopoDS_Shape Shape(const BRepGraph_NodeId theNode) const
Return or reconstruct a TopoDS_Shape for a node. Prefer this route for repeated public queries....
Result Add(const TopoDS_Shape &theShape)
Ingest a TopoDS_Shape as a new root subgraph, wrapping the topology root in a Product.
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
ShapesView & Shapes()
Access cached and fresh shape reconstruction.
Describes a shape which.
Definition TopoDS_Shape.hxx:41

Member Enumeration Documentation

◆ CachePolicy

enum class BRepGraph_Copy::CachePolicy
strong

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

enum class BRepGraph_Copy::GeomPolicy
strong

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

enum class BRepGraph_Copy::MeshPolicy
strong

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()

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 )
staticnodiscard

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()

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: