OpenCascade.js
API ReferenceModelingAlgorithmsTKShHealing

ShapeUpgrade

OCCT package ShapeUpgrade: ShapeUpgrade, ShapeUpgrade_ClosedEdgeDivide, ShapeUpgrade_ClosedFaceDivide, ShapeUpgrade_ConvertCurve2dToBezier, and 29 more…

ShapeUpgrade

This package provides tools for splitting and converting shapes by some criteria. It provides modifications of the kind when one topological object can be converted or split in to several ones. In particular this package contains high level API classes which perform: converting geometry of shapes up to given continuity, splitting revolutions by U to segments less than given value, converting to beziers, splitting closed faces.

Constructors(1)

Static methods(2)

  • C0BSplineToSequenceOfC1BSplineCurve(BS: Geom_BSplineCurve): { returnValue: boolean; seqBS: NCollection_HSequence_handle_Geom_BoundedCurve; [Symbol.dispose](): void }

    Unifies same domain faces and edges of specified shape.

    Parameters (1)
    • BS
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • seqBS: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • Converts C0 B-Spline curve into sequence of C1 B-Spline curves. This method splits B-Spline at the knots with multiplicities equal to degree, i.e. unlike method GeomConvert::C0BSplineToArrayOfC1BSplineCurve this one does not use any tolerance and therefore does not change the geometry of B-Spline. Returns True if C0 B-Spline was successfully split, else returns False (if BS is C1 B-Spline).

    Parameters (1)
    • BS
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • seqBS: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.

ShapeUpgrade_ClosedFaceDivide

Divides a Face with one or more seam edge to avoid closed faces. Splitting is performed by U and V direction. The number of resulting faces can be defined by user.

Constructors(2)

Static methods(2)

Instance methods(4)

  • SplitSurface(theArea?: number): boolean

    Performs splitting of surface and computes the shell from source face.

    Parameters (1)
    • theArea
  • SetNbSplitPoints(num: number): void

    Sets the number of cutting lines by which closed face will be split. The resulting faces will be num+1.

    Parameters (1)
    • num
  • Returns the number of splitting points.

ShapeUpgrade_ConvertCurve2dToBezier

converts/splits a 2d curve to a list of beziers

Constructors(1)

Static methods(2)

Instance methods(4)

  • Compute(): void

    Converts curve into a list of beziers, and stores the splitting parameters on original curve.

  • Build(Segment: boolean): void

    Splits a list of beziers computed by Compute method according the split values and splitting parameters.

    Parameters (1)
    • Segment
  • Returns the list of split parameters in original curve parametrisation.

ShapeUpgrade_ConvertCurve3dToBezier

converts/splits a 3d curve of any type to a list of beziers

Constructors(1)

Static methods(2)

Instance methods(10)

ShapeUpgrade_ConvertSurfaceToBezierBasis

Converts a plane, bspline surface, surface of revolution, surface of extrusion, offset surface to grid of bezier basis surface ( bezier surface, surface of revolution based on bezier curve, offset surface based on any previous type).

Constructors(1)

Static methods(2)

Instance methods(12)

ShapeUpgrade_EdgeDivide

Constructors(1)

Static methods(2)

Instance methods(12)

ShapeUpgrade_FaceDivide

Divides a Face (both edges in the wires, by splitting curves and pcurves, and the face itself, by splitting supporting surface) according to splitting criteria.

  • The domain of the face to divide is defined by the PCurves of the wires on the Face.
  • all the PCurves are supposed to be defined (in the parametric space of the supporting surface).
    The result is available after the call to the Build method. It is a Shell containing all the resulting Faces.
    All the modifications made during splitting are recorded in the external context (ShapeBuild_ReShape).

Constructors(2)

Static methods(2)

Instance methods(12)

  • Init(F: TopoDS_Face): void

    Initialize by a Face.

    Parameters (1)
    • F
  • SetSurfaceSegmentMode(Segment: boolean): void

    Purpose sets mode for trimming (segment) surface by wire UV bounds.

    Parameters (1)
    • Segment
  • Perform(theArea?: number): boolean

    Performs splitting and computes the resulting shell The context is used to keep track of former splittings in order to keep sharings. It is updated according to modifications made. The optional argument <theArea> is used to initialize the tool for splitting surface in the case of splitting into N parts where N is user-defined.

    Parameters (1)
    • theArea
  • SplitSurface(theArea?: number): boolean

    Performs splitting of surface and computes the shell from source face. The optional argument <theArea> is used to initialize the tool for splitting surface in the case of splitting into N parts where N is user-defined.

    Parameters (1)
    • theArea
  • SplitCurves(): boolean

    Performs splitting of curves of all the edges in the shape and divides these edges.

  • Gives the resulting Shell, or Face, or Null shape if not done.

  • Status(status: ShapeExtend_Status): boolean

    Queries the status of last call to Perform OK : no splitting was done (or no call to Perform) DONE1: some edges were split DONE2: surface was split DONE3: surface was modified without splitting FAIL1: some fails encountered during splitting wires FAIL2: face cannot be split.

    Parameters (1)
    • status
  • Sets the tool for splitting surfaces.

    Parameters (1)
    • splitSurfaceTool
  • Sets the tool for dividing edges on Face.

    Parameters (1)
    • wireDivideTool
  • Returns the tool for splitting surfaces. This tool must be already initialized.

  • Returns the tool for dividing edges on Face. This tool must be already initialized.

ShapeUpgrade_FaceDivideArea

Divides face by max area criterium.

Constructors(2)

Static methods(2)

Instance methods(6)

  • Perform(theArea?: number): boolean

    Performs splitting and computes the resulting shell The context is used to keep track of former splittings.

    Parameters (1)
    • theArea
  • MaxArea(): number

    Set max area allowed for faces.

  • NbParts(): number

    Set number of parts expected.

  • SetNumbersUVSplits(theNbUsplits: number, theNbVsplits: number): void

    Set fixed numbers of splits in U and V directions. Only for "Splitting By Numbers" mode.

    Parameters (2)
    • theNbUsplits
    • theNbVsplits
  • SetSplittingByNumber(theIsSplittingByNumber: boolean): void

    Set splitting mode If the mode is "splitting by number", the face is splitted approximately into <myNbParts> parts, the parts are similar to squares in 2D.

    Parameters (1)
    • theIsSplittingByNumber

ShapeUpgrade_FixSmallCurves

Constructors(1)

Static methods(2)

Instance methods(6)

ShapeUpgrade_RemoveInternalWires

Removes all internal wires having area less than specified min area.

Constructors(2)

Static methods(2)

Instance methods(10)

  • Init(theShape: TopoDS_Shape): void

    Initialize by a Shape.

    Parameters (1)
    • theShape
  • Perform(): boolean

    Removes all internal wires having area less than area specified as minimal allowed area.

  • If specified sequence of shape contains - 1.wires then these wires will be removed if they have area less than allowed min area. 2.faces than internal wires from these faces will be removed if they have area less than allowed min area.

    Parameters (1)
    • theSeqShapes
  • Get result shape.

  • MinArea(): number

    Set min area allowed for holes( all holes having area less than mi area will be removed).

  • RemoveFaceMode(): boolean

    Set mode which manage removing faces which have outer wires consisting only from edges belonginig to removed internal wires. By default it is equal to true.

  • Returns sequence of removed faces.

  • Returns sequence of removed faces.

  • Status(theStatus: ShapeExtend_Status): boolean

    Queries status of last call to Perform() : OK - nothing was done :DONE1 - internal wires were removed :DONE2 - small faces were removed. :FAIL1 - initial shape is not specified :FAIL2 - specified sub-shape is not belonged to inotial shape.

    Parameters (1)
    • theStatus

ShapeUpgrade_RemoveLocations

Removes all locations sub-shapes of specified shape.

Constructors(1)

Static methods(2)

Instance methods(7)

ShapeUpgrade_ShapeConvertToBezier

API class for performing conversion of 3D, 2D curves to bezier curves and surfaces to bezier based surfaces ( bezier surface, surface of revolution based on bezier curve, offset surface based on any previous type).

Constructors(2)

Instance methods(21)

ShapeUpgrade_ShapeDivide

Divides a all faces in shell with given criteria Shell.

Constructors(2)

Instance methods(15)

  • Init(S: TopoDS_Shape): void

    Initialize by a Shape.

    Parameters (1)
    • S
  • SetPrecision(Prec: number): void

    Defines the spatial precision used for splitting.

    Parameters (1)
    • Prec
  • SetMaxTolerance(maxtol: number): void

    Sets maximal allowed tolerance.

    Parameters (1)
    • maxtol
  • SetMinTolerance(mintol: number): void

    Sets minimal allowed tolerance.

    Parameters (1)
    • mintol
  • SetSurfaceSegmentMode(Segment: boolean): void

    Purpose sets mode for trimming (segment) surface by wire UV bounds.

    Parameters (1)
    • Segment
  • Perform(newContext?: boolean): boolean

    Performs splitting and computes the resulting shape If newContext is True (default), the internal context will be cleared at start, else previous substitutions will be acting.

    Parameters (1)
    • newContext
  • Gives the resulting Shape, or Null shape if not done.

  • Returns context with all the modifications made during last call(s) to Perform() recorded.

  • Sets context with recorded modifications to be applied during next call(s) to Perform(shape,false).

    Parameters (1)
    • context
  • Sets message registrator.

    Parameters (1)
    • msgreg
  • Returns message registrator.

  • SendMsg(shape: TopoDS_Shape, message: Message_Msg, gravity?: Message_Gravity): void

    Sends a message to be attached to the shape. Calls corresponding message of message registrator.

    Parameters (3)
    • shape
    • message
    • gravity
  • Status(status: ShapeExtend_Status): boolean

    Queries the status of last call to Perform OK : no splitting was done (or no call to Perform) DONE1: some edges were split DONE2: surface was split FAIL1: some errors occurred.

    Parameters (1)
    • status
  • Sets the tool for splitting faces.

    Parameters (1)
    • splitFaceTool
  • SetEdgeMode(aEdgeMode: number): void

    Sets mode for splitting 3d curves from edges. 0 - only curve 3d from free edges. 1 - only curve 3d from shared edges. 2 - all curve 3d.

    Parameters (1)
    • aEdgeMode

ShapeUpgrade_ShapeDivideAngle

Splits all surfaces of revolution, cylindrical, toroidal, conical, spherical surfaces in the given shape so that each resulting segment covers not more than defined number of degrees (to segments less than 90).

Constructors(2)

Instance methods(3)

  • InitTool(MaxAngle: number): void

    Resets tool for splitting face with given angle.

    Parameters (1)
    • MaxAngle
  • SetMaxAngle(MaxAngle: number): void

    Set maximal angle (calls InitTool).

    Parameters (1)
    • MaxAngle
  • MaxAngle(): number

    Returns maximal angle.

ShapeUpgrade_ShapeDivideArea

Divides faces from specified shape by max area criterium.

Constructors(2)

Instance methods(4)

  • MaxArea(): number

    Set max area allowed for faces.

  • NbParts(): number

    Set number of parts expected for the case of splitting by number.

  • SetNumbersUVSplits(theNbUsplits: number, theNbVsplits: number): void

    Set fixed numbers of splits in U and V directions. Only for "Splitting By Numbers" mode.

    Parameters (2)
    • theNbUsplits
    • theNbVsplits
  • SetSplittingByNumber(theIsSplittingByNumber: boolean): void

    Set splitting mode If the mode is "splitting by number", the face is splitted approximately into <myNbParts> parts, the parts are similar to squares in 2D.

    Parameters (1)
    • theIsSplittingByNumber

ShapeUpgrade_ShapeDivideContinuity

API Tool for converting shapes with C0 geometry into C1 ones.

Constructors(2)

Instance methods(5)

  • SetTolerance(Tol: number): void

    Sets tolerance.

    Parameters (1)
    • Tol
  • SetTolerance2d(Tol: number): void

    Sets tolerance.

    Parameters (1)
    • Tol
  • Defines a criterion of continuity for the boundary (all the Wires).
    The possible values are C0, G1, C1, G2, C2, C3, CN The default is C1 to respect the Cas.Cade Shape Validity. G1 and G2 are not authorized.

    Parameters (1)
    • Criterion
  • Defines a criterion of continuity for the boundary (all the pcurves of Wires).
    The possible values are C0, G1, C1, G2, C2, C3, CN The default is C1 to respect the Cas.Cade Shape Validity. G1 and G2 are not authorized.

    Parameters (1)
    • Criterion
  • Defines a criterion of continuity for the boundary (all the Wires).
    The possible values are C0, G1, C1, G2, C2, C3, CN The default is C1 to respect the Cas.Cade Shape Validity. G1 and G2 are not authorized.

    Parameters (1)
    • Criterion

ShapeUpgrade_ShellSewing

This class provides a tool for applying sewing algorithm from BRepBuilderAPI: it takes a shape, calls sewing for each shell, and then replaces sewed shells with use of ShapeBuild_ReShape.

Constructors(1)

Instance methods(1)

  • ApplySewing(shape: TopoDS_Shape, tol?: number): TopoDS_Shape

    Builds a new shape from a former one, by calling Sewing from BRepBuilderAPI. Rebuilt solids are oriented to be "not infinite".
    If <tol> is not given (i.e. value 0. by default), it is computed as the mean tolerance recorded in <shape>
    If no shell has been sewed, this method returns the input shape

    Parameters (2)
    • shape
    • tol

ShapeUpgrade_SplitCurve

Splits a curve with a criterion.

Constructors(1)

Static methods(2)

Instance methods(8)

  • Init(First: number, Last: number): void

    Initializes with curve first and last parameters.

    Parameters (2)
    • First
    • Last
  • Sets the parameters where splitting has to be done.

    Parameters (1)
    • SplitValues
  • Build(Segment: boolean): void

    If Segment is True, the result is composed with segments of the curve bounded by the SplitValues. If Segment is False, the result is composed with trimmed Curves all based on the same complete curve.

    Parameters (1)
    • Segment
  • returns all the splitting values including the First and Last parameters of the input curve Merges input split values and new ones into myGlobalKnots

  • Compute(): void

    Calculates points for correction/splitting of the curve.

  • Perform(Segment?: boolean): void

    Performs correction/splitting of the curve. First defines splitting values by method Compute(), then calls method Build().

    Parameters (1)
    • Segment
  • Status(status: ShapeExtend_Status): boolean

    Returns the status OK - no splitting is needed DONE1 - splitting required and gives more than one segment DONE2 - splitting is required, but gives only one segment (initial) DONE3 - geometric form of the curve or parametrisation is modified.

    Parameters (1)
    • status

ShapeUpgrade_SplitCurve2d

Splits a 2d curve with a criterion.

Constructors(1)

Static methods(2)

Instance methods(6)

  • Init(C: Geom2d_Curve): void

    Initializes with pcurve with its first and last parameters.

    Parameters (1)
    • C
  • Init(C: Geom2d_Curve, First: number, Last: number): void

    Initializes with pcurve with its parameters.

    Parameters (3)
    • C
    • First
    • Last
  • Init(First: number, Last: number): void

    Initializes with pcurve with its first and last parameters.

    Parameters (2)
    • First
    • Last
  • Build(Segment: boolean): void

    If Segment is True, the result is composed with segments of the curve bounded by the SplitValues. If Segment is False, the result is composed with trimmed Curves all based on the same complete curve.

    Parameters (1)
    • Segment

ShapeUpgrade_SplitCurve2dContinuity

Corrects/splits a 2d curve with a continuity criterion. Tolerance is used to correct the curve at a knot that respects geometrically the criterion, in order to reduce the multiplicity of the knot.

Constructors(1)

Static methods(2)

Instance methods(4)

ShapeUpgrade_SplitCurve3d

Splits a 3d curve with a criterion.

Constructors(1)

Static methods(2)

Instance methods(6)

  • Init(C: Geom_Curve): void

    Initializes with curve with its first and last parameters.

    Parameters (1)
    • C
  • Init(C: Geom_Curve, First: number, Last: number): void

    Initializes with curve with its parameters.

    Parameters (3)
    • C
    • First
    • Last
  • Init(First: number, Last: number): void

    Initializes with curve with its first and last parameters.

    Parameters (2)
    • First
    • Last
  • Build(Segment: boolean): void

    If Segment is True, the result is composed with segments of the curve bounded by the SplitValues. If Segment is False, the result is composed with trimmed Curves all based on the same complete curve.

    Parameters (1)
    • Segment

ShapeUpgrade_SplitCurve3dContinuity

Corrects/splits a 2d curve with a continuity criterion. Tolerance is used to correct the curve at a knot that respects geometrically the criterion, in order to reduce the multiplicity of the knot.

Constructors(1)

Static methods(2)

Instance methods(5)

ShapeUpgrade_SplitSurface

Splits a Surface with a criterion.

Constructors(1)

Static methods(2)

Instance methods(12)

  • Init(S: Geom_Surface): void

    Initializes with single supporting surface.

    Parameters (1)
    • S
  • Init(S: Geom_Surface, UFirst: number, ULast: number, VFirst: number, VLast: number, theArea: number): void

    Initializes with single supporting surface with bounding parameters.

    Parameters (6)
    • S
    • UFirst
    • ULast
    • VFirst
    • VLast
    • theArea
  • Sets U parameters where splitting has to be done.

    Parameters (1)
    • UValues
  • Sets V parameters where splitting has to be done.

    Parameters (1)
    • VValues
  • Build(Segment: boolean): void

    Performs splitting of the supporting surface. If resulting surface is B-Spline and Segment is True, the result is composed with segments of the surface bounded by the U and V SplitValues (method Geom_BSplineSurface::Segment is used). If Segment is False, the result is composed with Geom_RectangularTrimmedSurface all based on the same complete surface. Fields myNbResultingRow and myNbResultingCol must be set to specify the size of resulting grid of surfaces.

    Parameters (1)
    • Segment
  • Compute(Segment?: boolean): void

    Calculates points for correction/splitting of the surface.

    Parameters (1)
    • Segment
  • Perform(Segment?: boolean): void

    Performs correction/splitting of the surface. First defines splitting values by method Compute(), then calls method Build().

    Parameters (1)
    • Segment
  • returns all the U splitting values including the First and Last parameters of the input surface

  • returns all the splitting V values including the First and Last parameters of the input surface

  • Status(status: ShapeExtend_Status): boolean

    Returns the status OK - no splitting is needed DONE1 - splitting required and gives more than one patch DONE2 - splitting is required, but gives only single patch (initial) DONE3 - geometric form of the surface or parametrisation is modified.

    Parameters (1)
    • status
  • Returns obtained surfaces after splitting as CompositeSurface.

ShapeUpgrade_SplitSurfaceAngle

Splits a surfaces of revolution, cylindrical, toroidal, conical, spherical so that each resulting segment covers not more than defined number of degrees.

Constructors(1)

Static methods(2)

Instance methods(4)

  • SetMaxAngle(MaxAngle: number): void

    Set maximal angle.

    Parameters (1)
    • MaxAngle
  • MaxAngle(): number

    Returns maximal angle.

  • Compute(Segment: boolean): void

    Performs splitting of the supporting surface(s). First defines splitting values, then calls inherited method.

    Parameters (1)
    • Segment

ShapeUpgrade_SplitSurfaceArea

Split surface in the parametric space in according specified number of splits on the.

Constructors(1)

Static methods(2)

Instance methods(5)

  • NbParts(): number

    Set number of split for surfaces.

  • SetSplittingIntoSquares(theIsSplittingIntoSquares: boolean): void

    Set splitting mode If the mode is "splitting into squares", the face is splitted approximately into <myNbParts> parts, the parts are similar to squares in 2D.

    Parameters (1)
    • theIsSplittingIntoSquares
  • SetNumbersUVSplits(theNbUsplits: number, theNbVsplits: number): void

    Set fixed numbers of splits in U and V directions. Only for "Splitting Into Squares" mode.

    Parameters (2)
    • theNbUsplits
    • theNbVsplits
  • Compute(Segment?: boolean): void

    Calculates points for correction/splitting of the surface.

    Parameters (1)
    • Segment

ShapeUpgrade_SplitSurfaceContinuity

Splits a Surface with a continuity criterion. At the present moment C1 criterion is used only. This tool works with tolerance. If C0 surface can be corrected at a knot with given tolerance then the surface is corrected, otherwise it is spltted at that knot.

Constructors(1)

Static methods(2)

Instance methods(4)

ShapeUpgrade_Tool

Tool is a root class for splitting classes Provides context for recording changes, basic precision value and limit (minimal and maximal) values for tolerances.

Constructors(1)

Static methods(2)

Instance methods(11)

ShapeUpgrade_UnifySameDomain

This tool tries to unify faces and edges of the shape which lie on the same geometry. Faces/edges are considering as 'same-domain' if a group of neighbouring faces/edges are lying on coincident surfaces/curves.
In this case these faces/edges can be unified into one face/edge. ShapeUpgrade_UnifySameDomain is initialized by a shape and the next optional parameters: UnifyFaces - tries to unify all possible faces UnifyEdges - tries to unify all possible edges ConcatBSplines - if this flag is set to true then all neighbouring edges, which lay on BSpline or Bezier curves with C1 continuity on their common vertices, will be merged into one common edge.
The input shape can be of any type containing faces or edges - compsolid, solid, shell, wire, compound of any kind of shapes. The algorithm preserves the structure of compsolids, solids, shells and wires. E.g., if two shells have a common edge and the faces sharing this edge lie on the same surface the algorithm will not unify these faces, otherwise the structure of shells would be broken. However, if such faces belong to different compounds of faces they will be unified.
The output result of the tool is the unified shape.
All the modifications of initial shape are recorded during unifying. Methods History are intended to:

  • set a place holder for the history of modifications of sub-shapes of the initial shape;
  • get the collected history. The algorithm provides a place holder for the history and collects the history by default. To avoid collecting of the history the place holder should be set to null handle.

Constructors(2)

Static methods(2)

Instance methods(11)

  • Initialize(aShape: TopoDS_Shape, UnifyEdges?: boolean, UnifyFaces?: boolean, ConcatBSplines?: boolean): void

    Initializes with a shape and necessary flags. It does not perform unification. If you intend to nullify the History place holder do it after initialization.

    Parameters (4)
    • aShape
    • UnifyEdges
    • UnifyFaces
    • ConcatBSplines
  • AllowInternalEdges(theValue: boolean): void

    Sets the flag defining whether it is allowed to create internal edges inside merged faces in the case of non-manifold topology. Without this flag merging through multi connected edge is forbidden. Default value is false.

    Parameters (1)
    • theValue
  • KeepShape(theShape: TopoDS_Shape): void

    Sets the shape for avoid merging of the faces/edges. This shape can be vertex or edge. If the shape is a vertex it forbids merging of connected edges. If the shape is a edge it forbids merging of connected faces. This method can be called several times to keep several shapes.

    Parameters (1)
    • theShape
  • Sets the map of shapes for avoid merging of the faces/edges. It allows passing a ready to use map instead of calling many times the method KeepShape.

    Parameters (1)
    • theShapes
  • SetSafeInputMode(theValue: boolean): void

    Sets the flag defining the behavior of the algorithm regarding modification of input shape. If this flag is equal to True then the input (original) shape can't be modified during modification process. Default value is true.

    Parameters (1)
    • theValue
  • SetLinearTolerance(theValue: number): void

    Sets the linear tolerance. It plays the role of chord error when taking decision about merging of shapes. Default value is Precision::Confusion().

    Parameters (1)
    • theValue
  • SetAngularTolerance(theValue: number): void

    Sets the angular tolerance. If two shapes form a connection angle greater than this value they will not be merged. Default value is Precision::Angular().

    Parameters (1)
    • theValue
  • Build(): void

    Performs unification and builds the resulting shape.

  • Gives the resulting shape.

  • Returns the history of the processed shapes.

ShapeUpgrade_WireDivide

Divides edges in the wire lying on the face or free wires or free edges with a criterion. Splits 3D curve and pcurve(s) of the edge on the face. Other pcurves which may be associated with the edge are simply copied. If 3D curve is split then pcurve on the face is split as well, and vice-versa. Input shape is not modified. The modifications made are recorded in external context (ShapeBuild_ReShape). This tool is applied to all edges before splitting them in order to keep sharing.

Constructors(1)

Static methods(2)

Instance methods(20)