OpenCascade.js
API ReferenceModelingAlgorithmsTKShHealing

ShapeExtend

OCCT package ShapeExtend: ShapeExtend, ShapeExtend_BasicMsgRegistrator, ShapeExtend_ComplexCurve, ShapeExtend_CompositeSurface, and 5 more bound classes.

ShapeExtend

This package provides general tools and data structures common for other packages in SHAPEWORKS and extending CAS.CADE structures. The following items are provided by this package:

  • enumeration Status used for coding status flags in methods inside the SHAPEWORKS
  • enumeration Parametrisation used for setting global parametrisation on the composite surface
  • class CompositeSurface representing a composite surface made of a grid of surface patches
  • class WireData representing a wire in the form of ordered list of edges
  • class MsgRegistrator for attaching messages to the objects
  • tools for exploring the shapes
  • tools for creating new shapes

Constructors(1)

Static methods(3)

ShapeExtend_BasicMsgRegistrator

Abstract class that can be used for attaching messages to the objects (e.g. shapes). It is used by ShapeHealing algorithms to attach a message describing encountered case (e.g. removing small edge from a wire).
The methods of this class are empty and redefined, for instance, in the classes for Data Exchange processors for attaching messages to interface file entities or CAS.CADE shapes.

Constructors(1)

Static methods(2)

Instance methods(4)

ShapeExtend_ComplexCurve

Defines a curve which consists of several segments. Implements basic interface to it.

Static methods(2)

Instance methods(20)

  • NbCurves(): number

    Returns number of curves.

  • Curve(index: number): Geom_Curve

    Returns curve given by its index.

    Parameters (1)
    • index
  • LocateParameter(U: number, UOut: number): { returnValue: number; UOut: number }

    Returns number of the curve for the given parameter U and local parameter UOut for the found curve.

    Parameters (2)
    • U
    • UOut
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • UOut: updated value from the call.
  • LocalToGlobal(index: number, Ulocal: number): number

    Returns global parameter for the whole curve according to the segment and local parameter on it.

    Parameters (2)
    • index
    • Ulocal
  • Transform(T: gp_Trsf): void

    Applies transformation to each curve.

    Parameters (1)
    • T
  • ReversedParameter(U: number): number

    Returns 1 - U.

    Parameters (1)
    • U
  • FirstParameter(): number

    Returns 0.

  • LastParameter(): number

    Returns 1.

  • IsClosed(): boolean

    Returns True if the curve is closed.

  • IsPeriodic(): boolean

    Returns False.

  • Returns GeomAbs_C0.

  • IsCN(N: number): boolean

    Returns False if N > 0.

    Parameters (1)
    • N
  • EvalD0(U: number): gp_Pnt

    Returns point at parameter U. Finds appropriate curve and local parameter on it.

    Parameters (1)
    • U
  • EvalD1(U: number): Geom_Curve_ResD1

    Computes the point and first derivative at parameter U. Raises an exception if the curve continuity is not C1.

    Parameters (1)
    • U
  • EvalD2(U: number): Geom_Curve_ResD2

    Computes the point and first two derivatives at parameter U. Raises an exception if the curve continuity is not C2.

    Parameters (1)
    • U
  • EvalD3(U: number): Geom_Curve_ResD3

    Computes the point and first three derivatives at parameter U. Raises an exception if the curve continuity is not C3.

    Parameters (1)
    • U
  • EvalDN(U: number, N: number): gp_Vec

    Computes the Nth derivative at parameter U. Raises an exception if the curve continuity is not CN, or N < 1.

    Parameters (2)
    • U
    • N
  • GetScaleFactor(ind: number): number

    Returns scale factor for recomputing of deviatives.

    Parameters (1)
    • ind
  • CheckConnectivity(Preci: number): boolean

    Checks geometrical connectivity of the curves, including closure (sets fields myClosed).

    Parameters (1)
    • Preci

ShapeExtend_CompositeSurface

Composite surface is represented by a grid of surfaces (patches) connected geometrically. Patches may have different parametrisation ranges, but they should be parametrised in the same manner so that parameter of each patch (u,v) can be converted to global parameter on the whole surface (U,V) with help of linear transformation:
for any i,j-th patch U = Ui + ( u - uijmin ) * ( Ui+1 - Ui ) / ( uijmax - uijmin ) V = Vj + ( v - vijmin ) * ( Vj+1 - Vj ) / ( vijmax - vijmin )
where
[uijmin, uijmax] * [ vijmin, vijmax] - parametric range of i,j-th patch,
Ui (i=1,..,Nu+1), Vi (j=1,..,Nv+1) - values defining global parametrisation by U and V (correspond to points between patches and bounds, (Ui,Uj) corresponds to (uijmin,vijmin) on i,j-th patch) and to (u(i-1)(j-1)max,v(i-1)(j-1)max) on (i-1),(j-1)-th patch.
Geometrical connectivity is expressed via global parameters: Si,j [blocked] = Si+1,j [blocked] for any i, j, V Si,j [blocked] = Si,j+1 [blocked] for any i, j, U It is checked with Precision::Confusion() by default.
NOTE 1: This class is inherited from Geom_Surface in order to make it more easy to store and deal with it. However, it should not be passed to standard methods dealing with geometry since this type is not known to them. NOTE 2: Not all the inherited methods are implemented, and some are implemented not in the full form.

Constructors(3)

Static methods(2)

Instance methods(52)

  • Initializes by a grid of surfaces. All the Surfaces of the grid must have geometrical connectivity as stated above. If geometrical connectivity is not satisfied, method returns False. However, class is initialized even in that case.
    Last parameter defines how global parametrisation (joint values) will be computed: ShapeExtend_Natural: U1 = u11min, Ui+1 = Ui + (ui1max-ui1min), etc. ShapeExtend_Uniform: Ui = i-1, Vj = j-1 ShapeExtend_Unitary: Ui = (i-1)/Nu, Vi = (j-1)/Nv

    Parameters (2)
    • GridSurf
    • param
  • Initializes by a grid of surfaces with given global parametrisation defined by UJoints and VJoints arrays, each having length equal to number of patches in corresponding direction + 1. Global joint values should be sorted in increasing order. All the Surfaces of the grid must have geometrical connectivity as stated above. If geometrical connectivity is not satisfied, method returns False. However, class is initialized even in that case.

    Parameters (3)
    • GridSurf
    • UJoints
    • VJoints
  • NbUPatches(): number

    Returns number of patches in U direction.

  • NbVPatches(): number

    Returns number of patches in V direction.

  • Returns one surface patch that contains given point.

    Parameters (1)
    • pnt
  • Patch(i: number, j: number): Geom_Surface

    Returns one surface patch.

    Parameters (2)
    • i
    • j
  • Patch(U: number, V: number): Geom_Surface

    Returns one surface patch that contains given (global) parameters.

    Parameters (2)
    • U
    • V
  • Returns grid of surfaces.

  • Returns the array of U values corresponding to joint points between patches as well as to start and end points, which define global parametrisation of the surface.

  • Returns the array of V values corresponding to joint points between patches as well as to start and end points, which define global parametrisation of the surface.

  • UJointValue(i: number): number

    Returns i-th joint value in U direction (1-st is global Umin, (NbUPatches()+1)-th is global Umax on the composite surface).

    Parameters (1)
    • i
  • VJointValue(j: number): number

    Returns j-th joint value in V direction (1-st is global Vmin, (NbVPatches()+1)-th is global Vmax on the composite surface).

    Parameters (1)
    • j
  • Sets the array of U values corresponding to joint points, which define global parametrisation of the surface. Number of values in array should be equal to NbUPatches()+1. All the values should be sorted in increasing order. If this is not satisfied, does nothing and returns False.

    Parameters (1)
    • UJoints
  • Sets the array of V values corresponding to joint points, which define global parametrisation of the surface Number of values in array should be equal to NbVPatches()+1. All the values should be sorted in increasing order. If this is not satisfied, does nothing and returns False.

    Parameters (1)
    • VJoints
  • SetUFirstValue(UFirst: number): void

    Changes starting value for global U parametrisation (all other joint values are shifted accordingly).

    Parameters (1)
    • UFirst
  • SetVFirstValue(VFirst: number): void

    Changes starting value for global V parametrisation (all other joint values are shifted accordingly).

    Parameters (1)
    • VFirst
  • LocateUParameter(U: number): number

    Returns number of col that contains given (global) parameter.

    Parameters (1)
    • U
  • LocateVParameter(V: number): number

    Returns number of row that contains given (global) parameter.

    Parameters (1)
    • V
  • LocateUVPoint(pnt: gp_Pnt2d, i: number, j: number): { i: number; j: number }

    Returns number of row and col of surface that contains given point.

    Parameters (3)
    • pnt
    • i
    • j
    Returns

    A result object with fields:

    • i: updated value from the call.
    • j: updated value from the call.
  • ULocalToGlobal(i: number, j: number, u: number): number

    Converts local parameter u on patch i,j to global parameter U.

    Parameters (3)
    • i
    • j
    • u
  • VLocalToGlobal(i: number, j: number, v: number): number

    Converts local parameter v on patch i,j to global parameter V.

    Parameters (3)
    • i
    • j
    • v
  • LocalToGlobal(i: number, j: number, uv: gp_Pnt2d): gp_Pnt2d

    Converts local parameters uv on patch i,j to global parameters UV.

    Parameters (3)
    • i
    • j
    • uv
  • UGlobalToLocal(i: number, j: number, U: number): number

    Converts global parameter U to local parameter u on patch i,j.

    Parameters (3)
    • i
    • j
    • U
  • VGlobalToLocal(i: number, j: number, V: number): number

    Converts global parameter V to local parameter v on patch i,j.

    Parameters (3)
    • i
    • j
    • V
  • GlobalToLocal(i: number, j: number, UV: gp_Pnt2d): gp_Pnt2d

    Converts global parameters UV to local parameters uv on patch i,j.

    Parameters (3)
    • i
    • j
    • UV
  • GlobalToLocalTransformation(i: number, j: number, uFact: number, Trsf: gp_Trsf2d): { returnValue: boolean; uFact: number }

    Computes transformation operator and uFactor descrinbing affine transformation required to convert global parameters on composite surface to local parameters on patch (i,j): uv = ( uFactor, 1. ) X Trsf * UV; NOTE: Thus Trsf contains shift and scale by V, scale by U is stored in uFact. Returns True if transformation is not an identity.

    Parameters (4)
    • i
    • j
    • uFact
    • Trsf
      Mutated in place; read the updated value from this argument after the call.
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • uFact: updated value from the call.
  • Transform(T: gp_Trsf): void

    Applies transformation to all the patches.

    Parameters (1)
    • T
  • Returns a copy of the surface.

  • UReverse(): void

    NOT IMPLEMENTED (does nothing).

  • UReversedParameter(U: number): number

    Returns U.

    Parameters (1)
    • U
  • VReverse(): void

    NOT IMPLEMENTED (does nothing).

  • VReversedParameter(V: number): number

    Returns V.

    Parameters (1)
    • V
  • Bounds(U1: number, U2: number, V1: number, V2: number): { U1: number; U2: number; V1: number; V2: number }

    Returns the parametric bounds of grid.

    Parameters (4)
    • U1
    • U2
    • V1
    • V2
    Returns

    A result object with fields:

    • U1: updated value from the call.
    • U2: updated value from the call.
    • V1: updated value from the call.
    • V2: updated value from the call.
  • IsUClosed(): boolean

    Returns True if grid is closed in U direction (i.e. connected with Precision::Confusion).

  • IsVClosed(): boolean

    Returns True if grid is closed in V direction (i.e. connected with Precision::Confusion).

  • IsUPeriodic(): boolean

    Returns False.

  • IsVPeriodic(): boolean

    Returns False.

  • UIso(U: number): Geom_Curve

    NOT IMPLEMENTED (returns Null curve).

    Parameters (1)
    • U
  • VIso(V: number): Geom_Curve

    NOT IMPLEMENTED (returns Null curve).

    Parameters (1)
    • V
  • returns C0

  • IsCNu(N: number): boolean

    returns True if N <=0

    Parameters (1)
    • N
  • IsCNv(N: number): boolean

    returns True if N <=0

    Parameters (1)
    • N
  • EvalD0(U: number, V: number): gp_Pnt

    Computes the point of parameter U,V on the grid.

    Parameters (2)
    • U
    • V
  • EvalD1(U: number, V: number): Geom_Surface_ResD1

    Computes the point P and the first derivatives in the directions U and V at this point.

    Parameters (2)
    • U
    • V
  • EvalD2(U: number, V: number): Geom_Surface_ResD2

    Computes the point P, the first and the second derivatives in the directions U and V at this point.

    Parameters (2)
    • U
    • V
  • EvalD3(U: number, V: number): Geom_Surface_ResD3

    Computes the point P, the first,the second and the third derivatives in the directions U and V at this point.

    Parameters (2)
    • U
    • V
  • EvalDN(U: number, V: number, Nu: number, Nv: number): gp_Vec

    Computes the derivative of order Nu in the direction U and Nv in the direction V at the point P(U, V).

    Parameters (4)
    • U
    • V
    • Nu
    • Nv
  • Computes the point of parameter pnt on the grid.

    Parameters (1)
    • pnt
  • Value(U: number, V: number): gp_Pnt

    Computes the point of parameter pnt on the grid.

    Parameters (2)
    • U
    • V
  • Computes Joint values according to parameter.

    Parameters (1)
    • param
  • CheckConnectivity(prec: number): boolean

    Checks geometrical connectivity of the patches, including closedness (sets fields muUClosed and myVClosed).

    Parameters (1)
    • prec

ShapeExtend_Explorer

This class is intended to explore shapes and convert different representations (list, sequence, compound) of complex shapes. It provides tools for:

  • obtaining type of the shapes in context of TopoDS_Compound,
  • exploring shapes in context of TopoDS_Compound,
  • converting different representations of shapes (list, sequence, compound).

Constructors(1)

Instance methods(7)

ShapeExtend_MsgRegistrator

Attaches messages to the objects (generic Transient or shape). The objects of this class are transmitted to the Shape Healing algorithms so that they could collect messages occurred during processing.
Messages are added to the Maps (stored as a field) that can be used, for instance, by Data Exchange processors to attach those messages to initial file entities.

Constructors(1)

Static methods(2)

Instance methods(6)

ShapeExtend_Status

Properties(19)

ShapeExtend_WireData

This class provides a data structure necessary for work with the wire as with ordered list of edges, what is required for many algorithms. The advantage of this class is that it allows to work with wires which are not correct.
The object of the class ShapeExtend_WireData can be initialized by TopoDS_Wire, and converted back to TopoDS_Wire. An edge in the wire is defined by its rank number. Operations of accessing, adding and removing edge at the given rank number are provided.
On the whole wire, operations of circular permutation and reversing (both orientations of all edges and order of edges) are provided as well. This class also provides a method to check if the edge in the wire is a seam (if the wire lies on a face). This class is handled by reference. Such an approach gives the following advantages:

  1. Sharing the object of this class strongly optimizes the processes of analysis and fixing performed in parallel on the wire stored in the form of this class. Fixing tool (e.g. ShapeFix_Wire) fixes problems one by one using analyzing tool (e.g. ShapeAnalysis_Wire). Sharing allows not to reinitialize each time the analyzing tool with modified ShapeExtend_WireData what consumes certain time.
  2. No copying of contents. The object of ShapeExtend_WireData class has quite big size, returning it as a result of the function would cause additional copying of contents if this class were one handled by value. Moreover, this class is stored as a field in other classes which are they returned as results of functions, storing only a handle to ShapeExtend_WireData saves time and memory.

Constructors(2)

Static methods(2)

Instance methods(28)

  • Copies data from another WireData.

    Parameters (1)
    • other
  • Init(wire: TopoDS_Wire, chained: boolean, theManifoldMode: boolean): boolean

    Loads an already existing wire If <chained> is True (default), edges are added in the sequence as they are explored by TopoDS_Iterator Else, if <chained> is False, wire is explored by BRepTools_WireExplorer and it is guaranteed that edges will be sequentially connected. Remark : In the latter case it can happen that not all edges will be found (because of limitations of BRepTools_WireExplorer for disconnected wires and wires with seam edges).

    Parameters (3)
    • wire
    • chained
    • theManifoldMode
  • Clear(): void

    Clears data about Wire.

  • ComputeSeams(enforce?: boolean): void

    Computes the list of seam edges By default (direct call), computing is enforced For indirect call (from IsSeam) it is redone only if not yet already done or if the list of edges has changed Remark : A Seam Edge is an Edge present twice in the list, once as FORWARD and once as REVERSED Each sense has its own PCurve, the one for FORWARD must be set in first.

    Parameters (1)
    • enforce
  • SetLast(num: number): void

    Does a circular permutation in order to set <num>th edge last.

    Parameters (1)
    • num
  • When the wire contains at least one degenerated edge, sets it as last one Note : It is useful to process pcurves, for instance, while the pcurve of a DGNR may not be computed from its 3D part (there is none) it is computed after the other edges have been computed and chained.

  • Add(edge: TopoDS_Edge, atnum: number): void

    Adds an edge to a wire, being defined (not yet ended) This is the plain, basic, function to add an edge <num> = 0 (D): Appends at end <num> = 1: Preprends at start else, Insert before <num> Remark : Null Edge is simply ignored.

    Parameters (2)
    • edge
    • atnum
  • Add(wire: TopoDS_Wire, atnum: number): void

    Adds an entire wire, considered as a list of edges Remark : The wire is assumed to be ordered (TopoDS_Iterator is used).

    Parameters (2)
    • wire
    • atnum
  • Add(wire: ShapeExtend_WireData, atnum: number): void

    Adds a wire in the form of WireData.

    Parameters (2)
    • wire
    • atnum
  • Add(shape: TopoDS_Shape, atnum: number): void

    Adds an edge or a wire invoking corresponding method Add.

    Parameters (2)
    • shape
    • atnum
  • AddOriented(edge: TopoDS_Edge, mode: number): void

    Adds an edge to start or end of <me>, according to <mode> 0: at end, as direct 1: at end, as reversed 2: at start, as direct 3: at start, as reversed < 0: no adding.

    Parameters (2)
    • edge
    • mode
  • AddOriented(wire: TopoDS_Wire, mode: number): void

    Adds a wire to start or end of <me>, according to <mode> 0: at end, as direct 1: at end, as reversed 2: at start, as direct 3: at start, as reversed < 0: no adding.

    Parameters (2)
    • wire
    • mode
  • AddOriented(shape: TopoDS_Shape, mode: number): void

    Adds an edge or a wire invoking corresponding method AddOriented.

    Parameters (2)
    • shape
    • mode
  • Remove(num?: number): void

    Removes an Edge, given its rank. By default removes the last edge.

    Parameters (1)
    • num
  • Set(edge: TopoDS_Edge, num?: number): void

    Replaces an edge at the given rank number <num> with new one. Default is last edge (<num> = 0).

    Parameters (2)
    • edge
    • num
  • Reverse(): void

    Reverses the sense of the list and the orientation of each Edge This method should be called when either wire has no seam edges or face is not available.

  • Reverse(face: TopoDS_Face): void

    Reverses the sense of the list and the orientation of each Edge The face is necessary for swapping pcurves for seam edges (first pcurve corresponds to orientation FORWARD, and second to REVERSED; when edge is reversed, pcurves must be swapped) If face is NULL, no swapping is performed.

    Parameters (1)
    • face
  • NbEdges(): number

    Returns the count of currently recorded edges.

  • Returns the count of currently recorded non-manifold edges.

  • Returns <num>th nonmanifold Edge.

    Parameters (1)
    • num
  • Returns sequence of non-manifold edges This sequence can be not empty if wire data set in manifold mode but initial wire has INTERNAL orientation or contains INTERNAL edges.

  • ManifoldMode(): boolean

    Returns mode defining manifold wire data or not. If manifold that nonmanifold edges will not be not consider during operations(previous behaviour) and they will be added only in result wire else non-manifold edges will consider during operations.

  • Edge(num: number): TopoDS_Edge

    Returns <num>th Edge.

    Parameters (1)
    • num
  • Index(edge: TopoDS_Edge): number

    Returns the index of the edge If the edge is a seam the orientation is also checked Returns 0 if the edge is not found in the list.

    Parameters (1)
    • edge
  • IsSeam(num: number): boolean

    Tells if an Edge is seam (see ComputeSeams) An edge is considered as seam if it presents twice in the edge list, once as FORWARD and once as REVERSED.

    Parameters (1)
    • num
  • Makes TopoDS_Wire using BRep_Builder (just creates the TopoDS_Wire object and adds all edges into it). This method should be called when the wire is correct (for example, after successful fixes by ShapeFix_Wire) and adjacent edges share common vertices. In case if adjacent edges do not share the same vertices the resulting TopoDS_Wire will be invalid.

  • Makes TopoDS_Wire using BRepAPI_MakeWire. Class BRepAPI_MakeWire merges geometrically coincided vertices and can disturb correct order of edges in the wire. If this class fails, null shape is returned.