ShapeProcess
OCCT package ShapeProcess: ShapeProcess, ShapeProcess_Context, ShapeProcess_Operator, ShapeProcess_OperLibrary, and 2 more bound classes.
ShapeProcess
Shape Processing module allows to define and apply general Shape Processing as a customizable sequence of Shape Healing operators. The customization is implemented via user-editable resource file which defines sequence of operators to be executed and their parameters.
Constructors(1)
Static methods(5)
- RegisterOperator(name: string, op: ShapeProcess_Operator): boolean
Registers operator to make it visible for Performer.
Parameters (2)nameop
- FindOperator(name: string): { returnValue: boolean; op: ShapeProcess_Operator; [Symbol.dispose](): void }
Finds operator by its name.
Parameters (1)name
ReturnsA result object with fields:
returnValue: the C++ return valueop: owned by the returned envelope.
Dispose the returned envelope to release owned Handle fields.
- Perform(context: ShapeProcess_Context, seq: string, theProgress: Message_ProgressRange): boolean
Performs a specified sequence of operators on
theContext.Parameters (3)contextseqtheProgress—Progress indicator.
Returnstrue if at least one operation was performed, false otherwise.
- Perform(theContext: ShapeProcess_Context, theOperations: any, theProgress: Message_ProgressRange): boolean
Performs a specified sequence of operators on
theContext.Parameters (3)theContext—Context to perform operations on. Contains the shape to process and processing parameters. If processing parameters are not set, default values are used. Parameters should be in a scope of operation, for example, instead of "FromSTEP.FixShape.Tolerance3d" we should use just "FixShape.Tolerance3d".theOperations—Bitset of operations to perform.theProgress—Progress indicator.
Returnstrue if at least one operation was performed, false otherwise.
- ToOperationFlag(theName: string): [ShapeProcess_Operation, boolean]
Converts operation name to operation flag.
Parameters (1)theName—Operationname.
ReturnsOperationflag and true if the operation name is valid, false otherwise.
ShapeProcess_Context
Provides convenient interface to resource file Allows to load resource file and get values of attributes starting from some scope, for example if scope is defined as "ToV4" and requested parameter is "exec.op", value of "ToV4.exec.op" parameter from the resource file will be returned.
Constructors(2)
Creates an empty tool.
- constructor(file: string, scope?: string): ShapeProcess_Context
Creates a new tool and initialises by name of resource file and (if specified) starting scope Calls method
Init().Parameters (2)filescope
Static methods(2)
- get_type_name(): string
Instance methods(16)
- LoadResourceManager(file: string): Resource_Manager
Loading
Resource_Managerobject if this object not equal internal staticResource_Managerobject or internal staticResource_Managerobject is null.Parameters (1)file
Returns internal
Resource_Managerobject.- SetScope(scope: string): void
Set a new (sub)scope.
Parameters (1)scope
- UnSetScope(): void
Go out of current scope.
- IsParamSet(param: string): boolean
Returns True if parameter is defined in the resource file.
Parameters (1)param
- GetReal(param: string, val: number): { returnValue: boolean; val: number }Parameters (2)
paramval
- GetInteger(param: string, val: number): { returnValue: boolean; val: number }Parameters (2)
paramval
- GetBoolean(param: string, val: boolean): { returnValue: boolean; val: boolean }Parameters (2)
paramval
- GetString(param: string, val: TCollection_AsciiString): boolean
Get value of parameter as being of specific type Returns False if parameter is not defined or has a wrong type.
Parameters (2)paramval—Mutated in place; read the updated value from this argument after the call.
- RealVal(param: string, def: number): numberParameters (2)
paramdef
- IntegerVal(param: string, def: number): numberParameters (2)
paramdef
- BooleanVal(param: string, def: boolean): booleanParameters (2)
paramdef
- StringVal(param: string, def: string): string
Get value of parameter as being of specific type If parameter is not defined or does not have expected type, returns default value as specified.
Parameters (2)paramdef
- SetTraceLevel(tracelev: number): void
Sets trace level used for outputting messages.
- 0: no trace at all
- 1: errors
- 2: errors and warnings
- 3: all messages Default is 1 : Errors traced
Parameters (1)tracelev
- TraceLevel(): number
Returns trace level used for outputting messages.
ShapeProcess_Operator
Abstract Operator class providing a tool to perform an operation on Context.
Static methods(2)
- get_type_name(): string
Instance methods(2)
- Perform(context: ShapeProcess_Context, theProgress?: Message_ProgressRange): boolean
Performs operation and eventually records changes in the context.
Parameters (2)contexttheProgress
ShapeProcess_OperLibrary
Provides a set of following operators.
DirectFaces FixShape SameParameter SetTolerance SplitAngle BSplineRestriction ElementaryToRevolution SurfaceToBSpline ToBezier SplitContinuity SplitClosedFaces FixWireGaps FixFaceSize DropSmallEdges FixShape SplitClosedEdges
Constructors(1)
Static methods(2)
- Init(): void
Registers all the operators.
- ApplyModifier(S: TopoDS_Shape, context: ShapeProcess_ShapeContext, M: BRepTools_Modification, map: NCollection_DataMap_TopoDS_Shape_TopoDS_Shape_TopTools_ShapeMapHasher, msg: ShapeExtend_MsgRegistrator, theMutableInput: boolean): TopoDS_Shape
Applies
BRepTools_Modificationto a shape, taking into account sharing of components of compounds. if theMutableInput vat is set to true then input shape S can be modified during the modification process.Parameters (6)ScontextMmap—Mutated in place; read the updated value from this argument after the call.msgtheMutableInput
ShapeProcess_ShapeContext
Extends Context to handle shapes Contains map of shape-shape, and messages attached to shapes.
Constructors(2)
- constructor(file: string, seq?: string): ShapeProcess_ShapeContextParameters (2)
fileseq
- constructor(S: TopoDS_Shape, file: string, seq?: string): ShapeProcess_ShapeContext
Initializes a tool by resource file and shape to be processed.
Parameters (3)Sfileseq
Static methods(2)
- get_type_name(): string
Instance methods(20)
- Init(S: TopoDS_Shape): void
Initializes tool by a new shape and clears all results.
Parameters (1)S
- Init(file: string, scope: string): boolean
Initializes tool by a new shape and clears all results.
Parameters (2)filescope
Returns shape being processed.
Returns current result.
Returns map of replacements shape -> shape This map is not recursive.
- SetDetalisation(level: TopAbs_ShapeEnum): voidParameters (1)
level
Set and get value for detalisation level Only shapes of types from TopoDS_COMPOUND and until specified detalisation level will be recorded in maps To cancel mapping, use TopAbs_SHAPE To force full mapping, use TopAbs_VERTEX The default level is TopAbs_FACE.
- SetResult(S: TopoDS_Shape): void
Sets a new result shape NOTE: this method should be used very carefully to keep consistency of modifications It is recommended to use
RecordModification()methods with explicit definition of mapping from current result to a new one.Parameters (1)S
- RecordModification(repl: ShapeBuild_ReShape): voidParameters (1)
repl
- RecordModification(repl: NCollection_DataMap_TopoDS_Shape_TopoDS_Shape_TopTools_ShapeMapHasher, msg: ShapeExtend_MsgRegistrator): voidParameters (2)
replmsg
- RecordModification(repl: ShapeBuild_ReShape, msg: ShapeExtend_MsgRegistrator): voidParameters (2)
replmsg
- RecordModification(sh: TopoDS_Shape, repl: BRepTools_Modifier, msg: ShapeExtend_MsgRegistrator): void
Records modifications and resets result accordingly NOTE: modification of resulting shape should be explicitly defined in the maps along with modifications of subshapes.
In the last function, sh is the shape on which Modifier was run. It can be different from the whole shape, but in that case result as a whole should be reset later either by call toSetResult(), or by another call toRecordModification()which contains mapping of current result to a new one explicitlyParameters (3)shreplmsg
- AddMessage(S: TopoDS_Shape, msg: Message_Msg, gravity?: Message_Gravity): void
Record a message for shape S Shape S should be one of subshapes of original shape (or whole one), but not one of intermediate shapes Records only if
Message()is not Null.Parameters (3)Smsggravity
- GetContinuity(param: string, val: GeomAbs_Shape): { returnValue: boolean; val: GeomAbs_Shape }
Get value of parameter as being of the type
GeomAbs_ShapeReturns False if parameter is not defined or has a wrong type.Parameters (2)paramval
ReturnsA result object with fields:
returnValue: the C++ return valueval: updated value from the call.
- ContinuityVal(param: string, def: GeomAbs_Shape): GeomAbs_Shape
Get value of parameter as being of the type
GeomAbs_ShapeIf parameter is not defined or does not have expected type, returns default value as specified.Parameters (2)paramdef
- PrintStatistics(): void
Prints statistics on Shape Processing onto the current Messenger.
- SetNonManifold(theNonManifold: boolean): void
Set NonManifold flag.
Parameters (1)theNonManifold
- IsNonManifold(): boolean
Get NonManifold flag.
ShapeProcess_UOperator
Defines operator as container for static function OperFunc. This allows user to create new operators without creation of new classes.
Constructors(1)
- constructor(func: ((arg0: ShapeProcess_Context, arg1: Message_ProgressRange)): ShapeProcess_UOperator
Creates operator with implementation defined as OperFunc (static function).
Parameters (1)func
Static methods(2)
- get_type_name(): string
Instance methods(2)
- Perform(context: ShapeProcess_Context, theProgress?: Message_ProgressRange): boolean
Performs operation and records changes in the context.
Parameters (2)contexttheProgress