OpenCascade.js
API ReferenceModelingAlgorithmsTKShHealing

ShapeFix

OCCT package ShapeFix: ShapeFix, ShapeFix_ComposeShell, ShapeFix_Edge, ShapeFix_EdgeConnect, and 17 more bound classes.

ShapeFix

This package provides algorithms for fixing problematic (violating Open CASCADE requirements) shapes. Tools from package ShapeAnalysis are used for detecting the problems. The detecting and fixing is done taking in account various criteria implemented in BRepCheck package. Each class of package ShapeFix deals with one certain type of shapes or with some family of problems.

Constructors(1)

Static methods(5)

  • SameParameter(shape: TopoDS_Shape, enforce: boolean, preci?: number, theProgress?: Message_ProgressRange, theMsgReg?: ShapeExtend_BasicMsgRegistrator): boolean

    Runs SameParameter from BRepLib with these adaptations : <enforce> forces computations, else they are made only on Edges with flag SameParameter false <preci>, if not precised, is taken for each EDge as its own Tolerance Returns True when done, False if an exception has been raised In case of exception anyway, as many edges as possible have been processed. The passed progress indicator allows user to consult the current progress stage and abort algorithm if needed.

    Parameters (5)
    • shape
    • enforce
    • preci
    • theProgress
    • theMsgReg
  • EncodeRegularity(shape: TopoDS_Shape, tolang?: number): void

    Runs EncodeRegularity from BRepLib taking into account shared components of assemblies, so that each component is processed only once.

    Parameters (2)
    • shape
    • tolang
  • RemoveSmallEdges(shape: TopoDS_Shape, Tolerance: number): { returnValue: TopoDS_Shape; context: ShapeBuild_ReShape; [Symbol.dispose](): void }

    Removes edges which are less than given tolerance from shape with help of ShapeFix_Wire::FixSmall().

    Parameters (2)
    • shape
      Mutated in place; read the updated value from this argument after the call.
    • Tolerance
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • context: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • FixVertexPosition(theshape: TopoDS_Shape, theTolerance: number, thecontext: ShapeBuild_ReShape): boolean

    Fix position of the vertices having tolerance more tnan specified one.;.

    Parameters (3)
    • theshape
      Mutated in place; read the updated value from this argument after the call.
    • theTolerance
    • thecontext
  • LeastEdgeSize(theshape: TopoDS_Shape): number

    Calculate size of least edge;.

    Parameters (1)
    • theshape
      Mutated in place; read the updated value from this argument after the call.

ShapeFix_ComposeShell

This class is intended to create a shell from the composite surface (grid of surfaces) and set of wires. It may be either division of the supporting surface of the face, or creating a shape corresponding to face on composite surface which is missing in CAS.CADE but exists in some other systems.
It splits (if necessary) original face to several ones by splitting lines which are joint lines on a supplied grid of surfaces (U- and V- isolines of the composite surface). There are two modes of work, which differ in the way of handling faces on periodic surfaces:

  • if ClosedMode is False (default), when splitting itself is done as if surface were not periodic. The periodicity of the underlying surface is taken into account by duplicating splitting lines in the periodic direction, as necessary to split all the wires (whole parametrical range of a face) In this mode, some regularization procedures are performed (indexation of split segments by patch numbers), and it is expected to be more reliable and robust in case of bad shapes
  • if ClosedMode is True, when everything on a periodic surfaces is considered as modulo period. This allows to deal with wires which are closed in 3d but not in 2d, with wires which may be shifted on several periods in 2d etc. However, this mode is less reliable since some regularizations do not work for it.
    The work is made basing on pcurves of the edges. These pcurves should already exist (for example, in the case of division of existing face), then they are taken as is. The existing pcurves should be assigned to one surface (face) for all edges, this surface (face) will be used only for accessing pcurves, and it may have any geometry.
    All the modifications are recorded in the context tool (ShapeBuild_ReShape).

Constructors(1)

Static methods(2)

Instance methods(8)

  • ClosedMode(): boolean

    Returns (modifiable) flag for special 'closed' mode which forces ComposeShell to consider all pcurves on closed surface as modulo period. This can reduce reliability, but allows to deal with wires closed in 3d but open in 2d (missing seam) Default is False.

  • Perform(): boolean

    Performs the work on already loaded data.

  • SplitEdges(): void

    Splits edges in the original shape by grid. This is a part of Perform() which does not produce any resulting shape; the only result is filled context where splittings are recorded.
    NOTE: If edge is split, it is replaced by wire, and order of edges in the wire corresponds to FORWARD orientation of the edge.

  • Returns resulting shell or face (or Null shape if not done).

  • Status(status: ShapeExtend_Status): boolean

    Queries status of last call to Perform() OK : nothing done (some kind of error) DONE1: splitting is done, at least one new face created DONE2: splitting is done, several new faces obtained FAIL1: misoriented wire encountered (handled) FAIL2: recoverable parity error FAIL3: edge with no pcurve on supporting face FAIL4: unrecoverable algorithm error (parity check).

    Parameters (1)
    • status
  • Sets tool for transfer parameters from 3d to 2d and vice versa.

    Parameters (1)
    • TransferParam
  • Gets tool for transfer parameters from 3d to 2d and vice versa.

ShapeFix_Edge

Fixing invalid edge. Geometrical and/or topological inconsistency:

  • no 3d curve or pcurve,
  • mismatching orientation of 3d curve and pcurve,
  • incorrect SameParameter flag (curve deviation is greater than edge tolerance),
  • not adjacent curves (3d or pcurve) to the vertices.

Constructors(1)

Static methods(2)

Instance methods(19)

  • Returns the projector used for recomputing missing pcurves Can be used for adjusting parameters of projector.

  • FixRemovePCurve(edge: TopoDS_Edge, face: TopoDS_Face): boolean
    Parameters (2)
    • edge
    • face
  • FixRemovePCurve(edge: TopoDS_Edge, surface: Geom_Surface, location: TopLoc_Location): boolean

    Removes the pcurve(s) of the edge if it does not match the vertices Check is done Use : It is to be called when pcurve of an edge can be wrong (e.g., after import from IGES) Returns: True, if does not match, removed (status DONE) False, (status OK) if matches or (status FAIL) if no pcurve, nothing done.

    Parameters (3)
    • edge
    • surface
    • location
  • Removes 3d curve of the edge if it does not match the vertices Returns: True, if does not match, removed (status DONE) False, (status OK) if matches or (status FAIL) if no 3d curve, nothing done.

    Parameters (1)
    • edge
  • FixAddPCurve(edge: TopoDS_Edge, face: TopoDS_Face, isSeam: boolean, prec: number): boolean

    See method below for information.

    Parameters (4)
    • edge
    • face
    • isSeam
    • prec
  • FixAddPCurve(edge: TopoDS_Edge, surface: Geom_Surface, location: TopLoc_Location, isSeam: boolean, prec: number): boolean

    See method below for information.

    Parameters (5)
    • edge
    • surface
    • location
    • isSeam
    • prec
  • FixAddPCurve(edge: TopoDS_Edge, face: TopoDS_Face, isSeam: boolean, surfana: ShapeAnalysis_Surface, prec: number): boolean

    See method below for information.

    Parameters (5)
    • edge
    • face
    • isSeam
    • surfana
    • prec
  • FixAddPCurve(edge: TopoDS_Edge, surface: Geom_Surface, location: TopLoc_Location, isSeam: boolean, surfana: ShapeAnalysis_Surface, prec: number): boolean

    Adds pcurve(s) of the edge if missing (by projecting 3d curve) Parameter isSeam indicates if the edge is a seam. The parameter <prec> defines the precision for calculations. If it is 0 (default), the tolerance of the edge is taken.
    Remark : This method is rather for internal use since it accepts parameter <surfana> for optimization of computations Use : It is to be called after FixRemovePCurve (if removed) or in any case when edge can have no pcurve Returns: True if pcurve was added, else False Status : OK : Pcurve exists FAIL1: No 3d curve FAIL2: fail during projecting DONE1: Pcurve was added DONE2: specific case of pcurve going through degenerated point on sphere encountered during projection (see class ShapeConstruct_ProjectCurveOnSurface for more info).

    Parameters (6)
    • edge
    • surface
    • location
    • isSeam
    • surfana
    • prec
  • FixAddCurve3d(edge: TopoDS_Edge): boolean

    Tries to build 3d curve of the edge if missing Use : It is to be called after FixRemoveCurve3d (if removed) or in any case when edge can have no 3d curve Returns: True if 3d curve was added, else False Status : OK : 3d curve exists FAIL1: BRepLib::BuildCurve3d() has failed DONE1: 3d curve was added.

    Parameters (1)
    • edge
  • Parameters (2)
    • edge
    • face
  • Increases the tolerances of the edge vertices to comprise the ends of 3d curve and pcurve on the given face (first method) or all pcurves stored in an edge (second one) Returns: True, if tolerances have been increased, otherwise False Status: OK : the original tolerances have not been changed DONE1: the tolerance of first vertex has been increased DONE2: the tolerance of last vertex has been increased.

    Parameters (1)
    • edge
  • FixReversed2d(edge: TopoDS_Edge, face: TopoDS_Face): boolean
    Parameters (2)
    • edge
    • face
  • FixReversed2d(edge: TopoDS_Edge, surface: Geom_Surface, location: TopLoc_Location): boolean

    Fixes edge if pcurve is directed opposite to 3d curve Check is done by call to the function ShapeAnalysis_Edge::CheckCurve3dWithPCurve() Warning: For seam edge this method will check and fix the pcurve in only one direction. Hence, it should be called twice for seam edge: once with edge orientation FORWARD and once with REVERSED. Returns: False if nothing done, True if reversed (status DONE) Status: OK - pcurve OK, nothing done FAIL1 - no pcurve FAIL2 - no 3d curve DONE1 - pcurve was reversed.

    Parameters (3)
    • edge
    • surface
    • location
  • FixSameParameter(edge: TopoDS_Edge, tolerance: number): boolean

    Tries to make edge SameParameter and sets corresponding tolerance and SameParameter flag. First, it makes edge same range if SameRange flag is not set.
    If flag SameParameter is set, this method calls the function ShapeAnalysis_Edge::CheckSameParameter() that calculates the maximal deviation of pcurves of the edge from its 3d curve. If deviation > tolerance, the tolerance of edge is increased to a value of deviation. If deviation < tolerance nothing happens.
    If flag SameParameter is not set, this method chooses the best variant (one that has minimal tolerance), either a. only after computing deviation (as above) or b. after calling standard procedure BRepLib::SameParameter and computing deviation (as above). If <tolerance> > 0, it is used as parameter for BRepLib::SameParameter, otherwise, tolerance of the edge is used.
    Use : Is to be called after all pcurves and 3d curve of the edge are correctly computed Remark : SameParameter flag is always set to True after this method Returns: True, if something done, else False Status : OK - edge was initially SameParameter, nothing is done FAIL1 - computation of deviation of pcurves from 3d curve has failed FAIL2 - BRepLib::SameParameter() has failed DONE1 - tolerance of the edge was increased DONE2 - flag SameParameter was set to True (only if BRepLib::SameParameter() did not set it) DONE3 - edge was modified by BRepLib::SameParameter() to SameParameter DONE4 - not used anymore DONE5 - if the edge resulting from BRepLib has been chosen, i.e. variant b. above (only for edges with not set SameParameter)

    Parameters (2)
    • edge
    • tolerance
  • FixSameParameter(edge: TopoDS_Edge, face: TopoDS_Face, tolerance: number): boolean

    Tries to make edge SameParameter and sets corresponding tolerance and SameParameter flag. First, it makes edge same range if SameRange flag is not set.
    If flag SameParameter is set, this method calls the function ShapeAnalysis_Edge::CheckSameParameter() that calculates the maximal deviation of pcurves of the edge from its 3d curve. If deviation > tolerance, the tolerance of edge is increased to a value of deviation. If deviation < tolerance nothing happens.
    If flag SameParameter is not set, this method chooses the best variant (one that has minimal tolerance), either a. only after computing deviation (as above) or b. after calling standard procedure BRepLib::SameParameter and computing deviation (as above). If <tolerance> > 0, it is used as parameter for BRepLib::SameParameter, otherwise, tolerance of the edge is used.
    Use : Is to be called after all pcurves and 3d curve of the edge are correctly computed Remark : SameParameter flag is always set to True after this method Returns: True, if something done, else False Status : OK - edge was initially SameParameter, nothing is done FAIL1 - computation of deviation of pcurves from 3d curve has failed FAIL2 - BRepLib::SameParameter() has failed DONE1 - tolerance of the edge was increased DONE2 - flag SameParameter was set to True (only if BRepLib::SameParameter() did not set it) DONE3 - edge was modified by BRepLib::SameParameter() to SameParameter DONE4 - not used anymore DONE5 - if the edge resulting from BRepLib has been chosen, i.e. variant b. above (only for edges with not set SameParameter)

    Parameters (3)
    • edge
    • face
    • tolerance
  • Status(status: ShapeExtend_Status): boolean

    Returns the status (in the form of True/False) of last Fix.

    Parameters (1)
    • status
  • Sets context.

    Parameters (1)
    • context
  • Returns context.

ShapeFix_EdgeConnect

Rebuilds edges to connect with new vertices, was moved from ShapeBuild. Makes vertices to be shared to connect edges, updates positions and tolerances for shared vertices. Accepts edges bounded by two vertices each.

Constructors(1)

Instance methods(4)

  • Add(aFirst: TopoDS_Edge, aSecond: TopoDS_Edge): void

    Adds information on connectivity between start vertex of second edge and end vertex of first edge, taking edges orientation into account.

    Parameters (2)
    • aFirst
    • aSecond
  • Add(aShape: TopoDS_Shape): void

    Adds connectivity information for the whole shape. Note: edges in wires must be well ordered Note: flag Closed should be set for closed wires.

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

    Builds shared vertices, updates their positions and tolerances.

  • Clear(): void

    Clears internal data structure.

ShapeFix_EdgeProjAux

Project 3D point (vertex) on pcurves to find Vertex Parameter on parametric representation of an edge.

Constructors(2)

Static methods(2)

Instance methods(8)

ShapeFix_Face

This operator allows to perform various fixes on face and its wires: fixes provided by ShapeFix_Wire, fixing orientation of wires, addition of natural bounds, fixing of missing seam edge, and detection and removal of null-area wires.

Constructors(2)

Static methods(2)

Instance methods(36)

  • ClearModes(): void

    Sets all modes to default.

  • Init(face: TopoDS_Face): void

    Loads a whole face already created, with its wires, sense and location.

    Parameters (1)
    • face
  • Init(surf: Geom_Surface, preci: number, fwd: boolean): void

    Starts the creation of the face By default it will be FORWARD, or REVERSED if <fwd> is False.

    Parameters (3)
    • surf
    • preci
    • fwd
  • Init(surf: ShapeAnalysis_Surface, preci: number, fwd: boolean): void

    Starts the creation of the face By default it will be FORWARD, or REVERSED if <fwd> is False.

    Parameters (3)
    • surf
    • preci
    • fwd
  • Sets message registrator.

    Parameters (1)
    • msgreg
  • SetPrecision(preci: number): void

    Sets basic precision value (also to FixWireTool).

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

    Sets minimal allowed tolerance (also to FixWireTool).

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

    Sets maximal allowed tolerance (also to FixWireTool).

    Parameters (1)
    • maxtol
  • FixWireMode(): number

    Returns (modifiable) the mode for applying fixes of ShapeFix_Wire, by default True.

  • Returns (modifiable) the fix orientation mode, by default True. If True, wires oriented to border limited square.

  • Returns (modifiable) the add natural bound mode. If true, natural boundary is added on faces that miss them. Default is False for faces with single wire (they are handled by FixOrientation in that case) and True for others.

  • Returns (modifiable) the fix missing seam mode, by default True. If True, tries to insert seam is missed.

  • Returns (modifiable) the fix small area wire mode, by default False. If True, drops small wires.

  • Returns (modifiable) the remove face with small area, by default False. If True, drops faces with small outer wires.

  • Returns (modifiable) the fix intersecting wires mode by default True.

  • Returns (modifiable) the fix loop wires mode by default True.

  • Returns (modifiable) the fix split face mode by default True.

  • Returns (modifiable) the auto-correct precision mode by default False.

  • Returns (modifiable) the activation flag for periodic degenerated fix. False by default.

  • Returns a face which corresponds to the current state Warning: The finally produced face may be another one ... but with the same support.

  • Returns resulting shape (Face or Shell if split) To be used instead of Face() if FixMissingSeam involved.

  • Add(wire: TopoDS_Wire): void

    Add a wire to current face using BRep_Builder. Wire is added without taking into account orientation of face (as if face were FORWARD).

    Parameters (1)
    • wire
  • Perform(theProgress?: Message_ProgressRange): boolean

    Performs all the fixes, depending on modes Function Status returns the status of last call to Perform() ShapeExtend_OK : face was OK, nothing done ShapeExtend_DONE1: some wires are fixed ShapeExtend_DONE2: orientation of wires fixed ShapeExtend_DONE3: missing seam added ShapeExtend_DONE4: small area wire removed ShapeExtend_DONE5: natural bounds added ShapeExtend_FAIL1: some fails during fixing wires ShapeExtend_FAIL2: cannot fix orientation of wires ShapeExtend_FAIL3: cannot add missing seam ShapeExtend_FAIL4: cannot remove small area wire.

    Parameters (1)
    • theProgress
  • FixOrientation(): boolean

    Fixes orientation of wires on the face It tries to make all wires lie outside all others (according to orientation) by reversing orientation of some of them. If face lying on sphere or torus has single wire and AddNaturalBoundMode is True, that wire is not reversed in any case (supposing that natural bound will be added). Returns True if wires were reversed.

  • Fixes orientation of wires on the face It tries to make all wires lie outside all others (according to orientation) by reversing orientation of some of them. If face lying on sphere or torus has single wire and AddNaturalBoundMode is True, that wire is not reversed in any case (supposing that natural bound will be added). Returns True if wires were reversed OutWires return information about out wires + list of internal wires for each (for performing split face).

    Parameters (1)
    • MapWires
      Mutated in place; read the updated value from this argument after the call.
  • Adds natural boundary on face if it is missing. Two cases are supported:

    • face has no wires
    • face lies on geometrically double-closed surface (sphere or torus) and none of wires is left-oriented Returns True if natural boundary was added
  • FixMissingSeam(): boolean

    Detects and fixes the special case when face on a closed surface is given by two wires closed in 3d but with gap in 2d. In that case it creates a new wire from the two, and adds a missing seam edge Returns True if missing seam was added.

  • FixSmallAreaWire(theIsRemoveSmallFace: boolean): boolean

    Detects wires with small area (that is less than 100*Precision::PConfusion(). Removes these wires if they are internal. Returns : True if at least one small wire removed, False if does nothing.

    Parameters (1)
    • theIsRemoveSmallFace
  • Detects if wire has a loop and fixes this situation by splitting on the few parts. if wire has a loops and it was split Status was set to value ShapeExtend_DONE6.

    Parameters (1)
    • aResWires
      Mutated in place; read the updated value from this argument after the call.
  • Detects and fixes the special case when face has more than one wire and this wires have intersection point.

  • If wire contains two coincidence edges it must be removed Queries on status after Perform().

  • Split face if there are more than one out wire using inrormation after FixOrientation().

    Parameters (1)
    • MapWires
  • Fixes topology for a specific case when face is composed by a single wire belting a periodic surface. In that case a degenerated edge is reconstructed in the degenerated pole of the surface. Initial wire gets consistent orientation. Must be used in couple and before FixMissingSeam routine.

  • Status(status: ShapeExtend_Status): boolean

    Returns the status of last call to Perform() ShapeExtend_OK : face was OK, nothing done ShapeExtend_DONE1: some wires are fixed ShapeExtend_DONE2: orientation of wires fixed ShapeExtend_DONE3: missing seam added ShapeExtend_DONE4: small area wire removed ShapeExtend_DONE5: natural bounds added ShapeExtend_DONE8: face may be splited ShapeExtend_FAIL1: some fails during fixing wires ShapeExtend_FAIL2: cannot fix orientation of wires ShapeExtend_FAIL3: cannot add missing seam ShapeExtend_FAIL4: cannot remove small area wire.

    Parameters (1)
    • status
  • Returns tool for fixing wires.

ShapeFix_FixSmallFace

Fixing face with small size.

Constructors(1)

Static methods(2)

Instance methods(16)

ShapeFix_FixSmallSolid

Fixing solids with small size.

Constructors(1)

Static methods(2)

Instance methods(6)

  • SetFixMode(theMode: number): void

    Set working mode for operator:

    • theMode = 0 use both WidthFactorThreshold and VolumeThreshold parameters
    • theMode = 1 use only WidthFactorThreshold parameter
    • theMode = 2 use only VolumeThreshold parameter
    Parameters (1)
    • theMode
  • SetVolumeThreshold(theThreshold?: number): void

    Set or clear volume threshold for small solids.

    Parameters (1)
    • theThreshold
  • SetWidthFactorThreshold(theThreshold?: number): void

    Set or clear width factor threshold for small solids.

    Parameters (1)
    • theThreshold
  • Remove small solids from the given shape.

    Parameters (2)
    • theShape
    • theContext
  • Merge small solids in the given shape to adjacent non-small ones.

    Parameters (2)
    • theShape
    • theContext

ShapeFix_FreeBounds

This class is intended to output free bounds of the shape (free bounds are the wires consisting of edges referenced by the only face). For building free bounds it uses ShapeAnalysis_FreeBounds class. This class complements it with the feature to reduce the number of open wires. This reduction is performed with help of connecting several adjacent open wires one to another what can lead to:

  1. making an open wire with greater length out of several open wires
  2. making closed wire out of several open wires
    The connecting open wires is performed with a user-given tolerance.
    When connecting several open wires into one wire their previous end vertices are replaced with new connecting vertices. After that all the edges in the shape sharing previous vertices inside the shape are updated with new vertices. Thus source shape can be modified.
    Since interface of this class is the same as one of ShapeAnalysis_FreeBounds refer to its CDL for details.

Constructors(3)

  • Empty constructor.

  • constructor(shape: TopoDS_Shape, closetoler: number, splitclosed: boolean, splitopen: boolean): ShapeFix_FreeBounds

    Builds actual free bounds of the <shape> and connects open wires with tolerance <closetoler>. <shape> should be a compound of shells.

    Parameters (4)
    • shape
    • closetoler
    • splitclosed
    • splitopen
  • constructor(shape: TopoDS_Shape, sewtoler: number, closetoler: number, splitclosed: boolean, splitopen: boolean): ShapeFix_FreeBounds

    Builds forecasting free bounds of the <shape> and connects open wires with tolerance <closetoler>. <shape> should be a compound of faces. Tolerance <closetoler> should be greater than tolerance <sewtoler> used for initializing sewing analyzer, otherwise connection of open wires is not performed.

    Parameters (5)
    • shape
    • sewtoler
    • closetoler
    • splitclosed
    • splitopen

Instance methods(3)

ShapeFix_IntersectionTool

Tool for fixing selfintersecting wire and intersecting wires.

Constructors(1)

Instance methods(5)

  • Returns context.

  • SplitEdge(edge: TopoDS_Edge, param: number, vert: TopoDS_Vertex, face: TopoDS_Face, newE1: TopoDS_Edge, newE2: TopoDS_Edge, preci: number): boolean

    Split edge on two new edges using new vertex "vert" and "param" - parameter for splitting The "face" is necessary for pcurves and using TransferParameterProj.

    Parameters (7)
    • edge
    • param
    • vert
    • face
    • newE1
      Mutated in place; read the updated value from this argument after the call.
    • newE2
      Mutated in place; read the updated value from this argument after the call.
    • preci
  • CutEdge(edge: TopoDS_Edge, pend: number, cut: number, face: TopoDS_Face, iscutline: boolean): { returnValue: boolean; iscutline: boolean }

    Cut edge by parameters pend and cut.

    Parameters (5)
    • edge
    • pend
    • cut
    • face
    • iscutline
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • iscutline: updated value from the call.
  • FixSelfIntersectWire(face: TopoDS_Face, NbSplit: number, NbCut: number, NbRemoved: number): { returnValue: boolean; sewd: ShapeExtend_WireData; NbSplit: number; NbCut: number; NbRemoved: number; [Symbol.dispose](): void }
    Parameters (4)
    • face
    • NbSplit
    • NbCut
    • NbRemoved
  • Parameters (1)
    • face

ShapeFix_Root

Root class for fixing operations Provides context for recording changes (optional), basic precision value and limit (minimal and maximal) values for tolerances, and message registrator.

Constructors(1)

Static methods(2)

Instance methods(19)

ShapeFix_Shape

Fixing shape in general.

Constructors(2)

Static methods(2)

Instance methods(21)

ShapeFix_ShapeTolerance

Modifies tolerances of sub-shapes (vertices, edges, faces).

Constructors(1)

Instance methods(2)

  • LimitTolerance(shape: TopoDS_Shape, tmin: number, tmax?: number, styp?: TopAbs_ShapeEnum): boolean

    Limits tolerances in a shape as follows : tmin = tmax -> as SetTolerance (forces) tmin = 0 -> maximum tolerance will be <tmax> tmax = 0 or not given (more generally, tmax < tmin) -> <tmax> ignored, minimum will be <tmin> else, maximum will be <max> and minimum will be <min> styp = VERTEX : only vertices are set styp = EDGE : only edges are set styp = FACE : only faces are set styp = WIRE : to have edges and their vertices set styp = other value : all (vertices,edges,faces) are set Returns True if at least one tolerance of the sub-shape has been modified.

    Parameters (4)
    • shape
    • tmin
    • tmax
    • styp
  • SetTolerance(shape: TopoDS_Shape, preci: number, styp?: TopAbs_ShapeEnum): void

    Sets (enforces) tolerances in a shape to the given value styp = VERTEX : only vertices are set styp = EDGE : only edges are set styp = FACE : only faces are set styp = WIRE : to have edges and their vertices set styp = other value : all (vertices,edges,faces) are set.

    Parameters (3)
    • shape
    • preci
    • styp

ShapeFix_Shell

Fixing orientation of faces in shell.

Constructors(2)

Static methods(2)

Instance methods(17)

  • Init(shell: TopoDS_Shell): void

    Initializes by shell.

    Parameters (1)
    • shell
  • Perform(theProgress?: Message_ProgressRange): boolean

    Iterates on subshapes and performs fixes (for each face calls ShapeFix_Face::Perform and then calls FixFaceOrientation). The passed progress indicator allows user to consult the current progress stage and abort algorithm if needed.

    Parameters (1)
    • theProgress
  • FixFaceOrientation(shell: TopoDS_Shell, isAccountMultiConex?: boolean, NonManifold?: boolean): boolean

    Fixes orientation of faces in shell. Changes orientation of face in the shell, if it is oriented opposite to neighbouring faces.
    If it is not possible to orient all faces in the shell (like in case of mebious band), this method orients only subset of faces. Other faces are stored in Error compound. Modes : isAccountMultiConex - mode for account cases of multiconnexity. If this mode is equal to true, separate shells will be created in the cases of multiconnexity.
    If this mode is equal to false, one shell will be created without account of multiconnexity.By default - true; NonManifold - mode for creation of non-manifold shells. If this mode is equal to true one non-manifold will be created from shell contains multishared edges. Else if this mode is equal to false only manifold shells will be created. By default - false.

    Parameters (3)
    • shell
    • isAccountMultiConex
    • NonManifold
  • Returns fixed shell (or subset of oriented faces).

  • In case of multiconnexity returns compound of fixed shells else returns one shell..

  • NbShells(): number

    Returns Number of obtainrd shells;.

  • Returns not oriented subset of faces.

  • Status(status: ShapeExtend_Status): boolean

    Returns the status of the last Fix.

    Parameters (1)
    • status
  • Returns tool for fixing faces.

  • Sets message registrator.

    Parameters (1)
    • msgreg
  • SetPrecision(preci: number): void

    Sets basic precision value (also to FixWireTool).

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

    Sets minimal allowed tolerance (also to FixWireTool).

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

    Sets maximal allowed tolerance (also to FixWireTool).

    Parameters (1)
    • maxtol
  • FixFaceMode(): number

    Returns (modifiable) the mode for applying fixes of ShapeFix_Face, by default True.

  • Returns (modifiable) the mode for applying FixFaceOrientation, by default True.

  • SetNonManifoldFlag(isNonManifold: boolean): void

    Sets NonManifold flag.

    Parameters (1)
    • isNonManifold

ShapeFix_Solid

Provides method to build a solid from a shells and orients them in order to have a valid solid with finite volume.

Constructors(2)

Static methods(2)

Instance methods(15)

ShapeFix_SplitTool

Tool for splitting and cutting edges; includes methods used in OverlappingTool and IntersectionTool.

Constructors(1)

Instance methods(4)

  • SplitEdge(edge: TopoDS_Edge, param: number, vert: TopoDS_Vertex, face: TopoDS_Face, newE1: TopoDS_Edge, newE2: TopoDS_Edge, tol3d: number, tol2d: number): boolean

    Split edge on two new edges using new vertex "vert" and "param" - parameter for splitting The "face" is necessary for pcurves and using TransferParameterProj.

    Parameters (8)
    • edge
    • param
    • vert
    • face
    • newE1
      Mutated in place; read the updated value from this argument after the call.
    • newE2
      Mutated in place; read the updated value from this argument after the call.
    • tol3d
    • tol2d
  • SplitEdge(edge: TopoDS_Edge, param1: number, param2: number, vert: TopoDS_Vertex, face: TopoDS_Face, newE1: TopoDS_Edge, newE2: TopoDS_Edge, tol3d: number, tol2d: number): boolean

    Split edge on two new edges using new vertex "vert" and "param1" and "param2" - parameter for splitting and cutting The "face" is necessary for pcurves and using TransferParameterProj.

    Parameters (9)
    • edge
    • param1
    • param2
    • vert
    • face
    • newE1
      Mutated in place; read the updated value from this argument after the call.
    • newE2
      Mutated in place; read the updated value from this argument after the call.
    • tol3d
    • tol2d
  • SplitEdge(edge: TopoDS_Edge, fp: number, V1: TopoDS_Vertex, lp: number, V2: TopoDS_Vertex, face: TopoDS_Face, SeqE: NCollection_Sequence_TopoDS_Shape, aNum: number, context: ShapeBuild_ReShape, tol3d: number, tol2d: number): { returnValue: boolean; aNum: number }

    Split edge on two new edges using two new vertex V1 and V2 and two parameters for splitting - fp and lp correspondingly The "face" is necessary for pcurves and using TransferParameterProj aNum - number of edge in SeqE which corresponding to [fp,lp].

    Parameters (11)
    • edge
    • fp
    • V1
    • lp
    • V2
    • face
    • SeqE
      Mutated in place; read the updated value from this argument after the call.
    • aNum
    • context
    • tol3d
    • tol2d
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • aNum: updated value from the call.
  • CutEdge(edge: TopoDS_Edge, pend: number, cut: number, face: TopoDS_Face, iscutline: boolean): { returnValue: boolean; iscutline: boolean }

    Cut edge by parameters pend and cut.

    Parameters (5)
    • edge
    • pend
    • cut
    • face
    • iscutline
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • iscutline: updated value from the call.

ShapeFix_Wire

This class provides a set of tools for repairing a wire.
These are methods Fix...(), organised in two levels:
Level 1: Advanced - each method in this level fixes one separate problem, usually dealing with either single edge or connection of the two adjacent edges. These methods should be used carefully and called in right sequence, because some of them depend on others.
Level 2: Public (API) - methods which group several methods of level 1 and call them in a proper sequence in order to make some consistent set of fixes for a whole wire. It is possible to control calls to methods of the advanced level from methods of the public level by use of flags Fix..Mode() (see below).
Fixes can be made in three ways:

  1. Increasing tolerance of an edge or a vertex
  2. Changing topology (adding/removing/replacing edge in the wire and/or replacing the vertex in the edge)
  3. Changing geometry (shifting vertex or adjusting ends of edge curve to vertices, or recomputing curves of the edge)
    When fix can be made in more than one way (e.g., either by increasing tolerance or shifting a vertex), it is chosen according to the flags: ModifyTopologyMode - allows modification of the topology. This flag can be set when fixing a wire on the separate (free) face, and should be unset for face which is part of shell. ModifyGeometryMode - allows modification of the geometry.
    The order of descriptions of Fix() methods in this CDL approximately corresponds to the optimal order of calls.
    NOTE: most of fixing methods expect edges in the ShapeExtend_WireData to be ordered, so it is necessary to make call to FixReorder() before any other fixes
    ShapeFix_Wire should be initialized prior to any fix by the following data: a) Wire (ether TopoDS_Wire or ShapeExtend_Wire) b) Face or surface c) Precision d) Maximal tail angle and width This can be done either by calling corresponding methods (LoadWire, SetFace or SetSurface, SetPrecision, SetMaxTailAngle and SetMaxTailWidth), or by loading already filled ShapeAnalisis_Wire with method Load

Constructors(2)

Static methods(2)

Instance methods(89)

  • ClearModes(): void

    Sets all modes to default.

  • Clears all statuses.

  • Init(wire: TopoDS_Wire, face: TopoDS_Face, prec: number): void

    Load analyzer with all the data for the wire and face and drops all fixing statuses.

    Parameters (3)
    • wire
    • face
    • prec
  • Load analyzer with all the data already prepared and drops all fixing statuses If analyzer contains face, there is no need to set it by SetFace or SetSurface.

    Parameters (1)
    • saw
  • Load(wire: TopoDS_Wire): void

    Load data for the wire, and drops all fixing statuses.

    Parameters (1)
    • wire
  • Load data for the wire, and drops all fixing statuses.

    Parameters (1)
    • sbwd
  • SetFace(face: TopoDS_Face): void

    Set working face for the wire.

    Parameters (1)
    • face
  • SetFace(theFace: TopoDS_Face, theSurfaceAnalysis: ShapeAnalysis_Surface): void

    Set working face for the wire and surface analysis object.

    Parameters (2)
    • theFace
    • theSurfaceAnalysis
  • SetSurface(theSurfaceAnalysis: ShapeAnalysis_Surface): void

    Set surface analysis for the wire.

    Parameters (1)
    • theSurfaceAnalysis
  • Set surface for the wire.

    Parameters (1)
    • surf
  • Set surface for the wire.

    Parameters (2)
    • surf
    • loc
  • SetPrecision(preci: number): void

    Set working precision (to root and to analyzer).

    Parameters (1)
    • preci
  • SetMaxTailAngle(theMaxTailAngle: number): void

    Sets the maximal allowed angle of the tails in radians.

    Parameters (1)
    • theMaxTailAngle
  • SetMaxTailWidth(theMaxTailWidth: number): void

    Sets the maximal allowed width of the tails.

    Parameters (1)
    • theMaxTailWidth
  • IsLoaded(): boolean

    Tells if the wire is loaded.

  • IsReady(): boolean

    Tells if the wire and face are loaded.

  • NbEdges(): number

    returns number of edges in the working wire

  • Makes the resulting Wire (by basic Brep_Builder).

  • Makes the resulting Wire (by BRepAPI_MakeWire).

  • returns field Analyzer (working tool)

  • returns working wire

  • returns working face (Analyzer.Face())

  • Returns (modifiable) the flag which defines whether it is allowed to modify topology of the wire during fixing (adding/removing edges etc.).

  • Returns (modifiable) the flag which defines whether the Fix..() methods are allowed to modify geometry of the edges and vertices.

  • Returns (modifiable) the flag which defines whether the Fix..() methods are allowed to modify RemoveLoop of the edges.

  • ClosedWireMode(): boolean

    Returns (modifiable) the flag which defines whether the wire is to be closed (by calling methods like FixDegenerated() and FixConnected() for last and first edges).

  • Returns (modifiable) the flag which defines whether the 2d (True) representation of the wire is preferable over 3d one (in the case of ambiguity in FixEdgeCurves).

  • Returns (modifiable) the flag which defines whether tool tries to fix gaps first by changing curves ranges (i.e. using intersection, extrema, projections) or not.

  • FixReorderMode(): number
  • FixSmallMode(): number
  • FixLackingMode(): number
  • FixGaps3dMode(): number
  • FixGaps2dMode(): number

    Returns (modifiable) the flag for corresponding Fix..() method which defines whether this method will be called from the method APIFix(): -1 default 1 method will be called 0 method will not be called.

  • FixSeamMode(): number
  • FixShiftedMode(): number
  • Returns (modifiable) the flag for corresponding Fix..() method which defines whether this method will be called from the corresponding Fix..() method of the public level: -1 default 1 method will be called 0 method will not be called.

  • FixTailMode(): number
  • Perform(theProgress?: Message_ProgressRange): boolean

    This method performs all the available fixes. If some fix is turned on or off explicitly by the Fix..Mode() flag, this fix is either called or not depending on that flag. Else (i.e. if flag is default) fix is called depending on the situation: some fixes are not called or are limited if order of edges in the wire is not OK, or depending on modes.
    The order of the fixes and default behaviour of Perform() are: FixReorder FixSmall (with lockvtx true if ! TopoMode or if wire is not ordered) FixConnected (if wire is ordered) FixEdgeCurves (without FixShifted if wire is not ordered) FixDegenerated (if wire is ordered) FixSelfIntersection (if wire is ordered and ClosedMode is True) FixLacking (if wire is ordered)

    Parameters (1)
    • theProgress
  • FixReorder(theModeBoth: boolean): boolean

    Performs an analysis and reorders edges in the wire using class WireOrder. Flag <theModeBoth> determines the use of miscible mode if necessary.

    Parameters (1)
    • theModeBoth
  • Reorder edges in the wire as determined by WireOrder that should be filled and computed before.

    Parameters (1)
    • wi
  • FixSmall(lockvtx: boolean, precsmall: number): number

    Applies FixSmall(num) to all edges in the wire.

    Parameters (2)
    • lockvtx
    • precsmall
  • FixSmall(num: number, lockvtx: boolean, precsmall: number): boolean

    Fixes Null Length Edge to be removed If an Edge has Null Length (regarding preci, or <precsmall>.

    • what is smaller), it should be removed It can be with no problem if its two vertices are the same Else, if lockvtx is False, it is removed and its end vertex is put on the preceding edge But if lockvtx is True, this edge must be kept ...
    Parameters (3)
    • num
    • lockvtx
    • precsmall
  • FixConnected(prec: number): boolean

    Applies FixConnected(num) to all edges in the wire Connection between first and last edges is treated only if flag ClosedMode is True If <prec> is -1 then MaxTolerance() is taken.

    Parameters (1)
    • prec
  • FixConnected(num: number, prec: number, theUpdateWire: boolean): boolean

    Fixes connected edges (preceding and current) Forces Vertices (end of preceding-begin of current) to be the same one Tests with starting preci or, if given greater, <prec> If <prec> is -1 then MaxTolerance() is taken. If <theUpdateWire> is true, synchronizes wire data with context replacements.

    Parameters (3)
    • num
    • prec
    • theUpdateWire
  • FixEdgeCurves(): boolean

    Groups the fixes dealing with 3d and pcurves of the edges. The order of the fixes and the default behaviour are: ShapeFix_Edge::FixReversed2d ShapeFix_Edge::FixRemovePCurve (only if forced) ShapeFix_Edge::FixAddPCurve ShapeFix_Edge::FixRemoveCurve3d (only if forced) ShapeFix_Edge::FixAddCurve3d FixSeam, FixShifted, ShapeFix_Edge::FixSameParameter.

  • FixDegenerated(): boolean

    Applies FixDegenerated(num) to all edges in the wire Connection between first and last edges is treated only if flag ClosedMode is True.

  • FixDegenerated(num: number): boolean

    Fixes Degenerated Edge Checks an <num-th> edge or a point between <num>th-1 and <num>th edges for a singularity on a supporting surface. If singularity is detected, either adds new degenerated edge (before <num>th), or makes <num>th edge to be degenerated.

    Parameters (1)
    • num
  • Applies FixSelfIntersectingEdge(num) and FixIntersectingEdges(num) to all edges in the wire and FixIntersectingEdges(num1, num2) for all pairs num1 and num2 such that num2 >= num1 + 2 and removes wrong edges if any.

  • FixLacking(force: boolean): boolean

    Applies FixLacking(num) to all edges in the wire Connection between first and last edges is treated only if flag ClosedMode is True If <force> is False (default), test for connectness is done with precision of vertex between edges, else it is done with minimal value of vertex tolerance and Analyzer.Precision(). Hence, <force> will lead to inserting lacking edges in replacement of vertices which have big tolerances.

    Parameters (1)
    • force
  • FixLacking(num: number, force: boolean): boolean

    Fixes Lacking Edge Test if two adjucent edges are disconnected in 2d (while connected in 3d), and in that case either increase tolerance of the vertex or add a new edge (straight in 2d space), in order to close wire in 2d. Returns True if edge was added or tolerance was increased.

    Parameters (2)
    • num
    • force
  • FixClosed(prec?: number): boolean

    Fixes a wire to be well closed It performs FixConnected, FixDegenerated and FixLacking between last and first edges (independingly on flag ClosedMode and modes for these fixings) If <prec> is -1 then MaxTolerance() is taken.

    Parameters (1)
    • prec
  • FixGaps3d(): boolean

    Fixes gaps between ends of 3d curves on adjacent edges myPrecision is used to detect the gaps.

  • FixGaps2d(): boolean

    Fixes gaps between ends of pcurves on adjacent edges myPrecision is used to detect the gaps.

  • FixSeam(num: number): boolean

    Fixes a seam edge A Seam edge has two pcurves, one for forward. one for reversed The forward pcurve must be set as first.
    NOTE that correct order of pcurves in the seam edge depends on its orientation (i.e., on orientation of the wire, method of exploration of edges etc.). Since wire represented by the ShapeExtend_WireData is always forward (orientation is accounted by edges), it will work correct if:

    1. Wire created from ShapeExtend_WireData with methods ShapeExtend_WireData::Wire..() is added into the FORWARD face (orientation can be applied later)
    2. Wire is extracted from the face with orientation not composed with orientation of the face
    Parameters (1)
    • num
  • FixShifted(): boolean

    Fixes edges which have pcurves shifted by whole parameter range on the closed surface (the case may occur if pcurve of edge was computed by projecting 3d curve, which goes along the seam).
    It compares each two consequent edges and tries to connect them if distance between ends is near to range of the surface. It also can detect and fix the case if all pcurves are connected, but lie out of parametric bounds of the surface.
    In addition to FixShifted from ShapeFix_Wire, more sophisticated check of degenerate points is performed, and special cases like sphere given by two meridians are treated.

  • FixNotchedEdges(): boolean
  • FixGap3d(num: number, convert?: boolean): boolean

    Fixes gap between ends of 3d curves on num-1 and num-th edges. myPrecision is used to detect the gap. If convert is True, converts curves to bsplines to bend.

    Parameters (2)
    • num
    • convert
  • FixGap2d(num: number, convert?: boolean): boolean

    Fixes gap between ends of pcurves on num-1 and num-th edges. myPrecision is used to detect the gap. If convert is True, converts pcurves to bsplines to bend.

    Parameters (2)
    • num
    • convert
  • FixTails(): boolean
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Parameters (1)
    • status
  • Querying the status of performed API fixing procedures Each Status..() methods gives information about the last call to the corresponding Fix..() method of API level: OK : no problems detected; nothing done DONE: some problem(s) was(were) detected and successfully fixed FAIL: some problem(s) cannot be fixed.

  • Parameters (1)
    • status
  • Queries the status of last call to methods Fix... of advanced level For details see corresponding methods; universal statuses are: OK : problem not detected; nothing done DONE: problem was detected and successfully fixed FAIL: problem cannot be fixed.

    Parameters (1)
    • status
  • Returns tool for fixing wires.

ShapeFix_Wireframe

Provides methods for fixing wireframe of shape.

Constructors(2)

Static methods(2)

Instance methods(13)

ShapeFix_WireVertex

Fixing disconnected edges in the wire Fixes vertices in the wire on the basis of pre-analysis made by ShapeAnalysis_WireVertex (given as argument). The Wire has formerly been loaded in a ShapeExtend_WireData.

Constructors(1)

Instance methods(8)