OpenCascade.js
API ReferenceApplicationFrameworkTKCAF

TNaming

OCCT package TNaming: TNaming, TNaming_Builder, TNaming_CopyShape, TNaming_DeltaOnModification, and 22 more bound classes.

TNaming

A topological attribute can be seen as a hook into the topological structure. To this hook, data can be attached and references defined. It is used for keeping and access to topological objects and their evolution. All topological objects are stored in the one user-protected TNaming_UsedShapes attribute at the root label of the data framework. This attribute contains map with all topological shapes, used in this document. To all other labels TNaming_NamedShape attribute can be added.
This attribute contains references (hooks) to shapes from the TNaming_UsedShapes attribute and evolution of these shapes. TNaming_NamedShape attribute contains a set of pairs of hooks: old shape and new shape (see the figure below).
It allows not only get the topological shapes by the labels, but also trace evolution of the shapes and correctly resolve dependent shapes by the changed one. If shape is just-created, then the old shape for accorded named shape is an empty shape. If a shape is deleted, then the new shape in this named shape is empty. Different algorithms may dispose sub-shapes of the result shape at the individual label depending on necessity:

  • If a sub-shape must have some extra attributes (material of each face or color of each edge). In this case a specific sub-shape is placed to the separate label (usually, sub-label of the result shape label) with all attributes of this sub-shape.
  • If topological naming is needed, a necessary and sufficient (for selected sub-shapes identification) set of sub-shapes is placed to the child labels of the result shape label. As usual, as far as basic solids and closed shells are concerned, all faces of the shape are disposed. Edges and vertices sub-shapes can be identified as intersection of contiguous faces.
    Modified/generated shapes may be placed to one named shape and identified as this named shape and source named shape that also can be identified with used algorithms. TNaming_NamedShape may contain a few pairs of hooks with the same evolution. In this case topology shape, which belongs to the named shape, is a compound of new shapes. The data model contains both the topology and the hooks, and functions handle both topological entities and hooks. Consider the case of a box function, which creates a solid with six faces and six hooks. Each hook is attached to a face. If you want, you can also have this function create hooks for edges and vertices as well as for faces. For the sake of simplicity though, let's limit the example.
    Not all functions can define explicit hooks for all topological entities they create, but all topological entities can be turned into hooks when necessary. This is where topological naming is necessary.

Constructors(1)

Static methods(14)

TNaming_Builder

A tool to create and maintain topological attributes. Constructor creates an empty TNaming_NamedShape attribute at the given label. It allows adding "old shape" and "new shape" pairs with the specified evolution to this named shape. One evolution type per one builder must be used.

Constructors(1)

Instance methods(6)

  • Generated(newShape: TopoDS_Shape): void

    Records the shape newShape which was generated during a topological construction. As an example, consider the case of a face generated in construction of a box.

    Parameters (1)
    • newShape
  • Generated(oldShape: TopoDS_Shape, newShape: TopoDS_Shape): void

    Records the shape newShape which was generated from the shape oldShape during a topological construction. As an example, consider the case of a face generated from an edge in construction of a prism.

    Parameters (2)
    • oldShape
    • newShape
  • Delete(oldShape: TopoDS_Shape): void

    Records the shape oldShape which was deleted from the current label. As an example, consider the case of a face removed by a Boolean operation.

    Parameters (1)
    • oldShape
  • Modify(oldShape: TopoDS_Shape, newShape: TopoDS_Shape): void

    Records the shape newShape which is a modification of the shape oldShape. As an example, consider the case of a face split or merged in a Boolean operation.

    Parameters (2)
    • oldShape
    • newShape
  • Select(aShape: TopoDS_Shape, inShape: TopoDS_Shape): void

    Add a Shape to the current label, This Shape is unmodified. Used for example to define a set of shapes under a label.

    Parameters (2)
    • aShape
    • inShape
  • Returns the NamedShape which has been built or is under construction.

TNaming_CopyShape

Constructors(1)

Static methods(3)

TNaming_DeltaOnModification

This class provides default services for an AttributeDelta on a MODIFICATION action.
Applying this AttributeDelta means GOING BACK to the attribute previously registered state.

Constructors(1)

Static methods(2)

Instance methods(2)

TNaming_Identifier

Constructors(2)

Instance methods(16)

TNaming_Iterator

A tool to visit the contents of a named shape attribute. Pairs of shapes in the attribute are iterated, one being the pre-modification or the old shape, and the other the post-modification or the new shape. This allows you to have a full access to all contents of an attribute. If, on the other hand, you are only interested in topological entities stored in the attribute, you can use the functions GetShape and CurrentShape in TNaming_Tool.

Constructors(3)

Instance methods(6)

TNaming_Localizer

Constructors(1)

Static methods(3)

Instance methods(7)

TNaming_Name

store the arguments of Naming.

Constructors(1)

Instance methods(18)

TNaming_NamedShape

The basis to define an attribute for the storage of topology and naming data. This attribute contains two parts:

  • The type of evolution, a term of the enumeration TNaming_Evolution
  • A list of pairs of shapes called the "old" shape and the "new" shape. The meaning depends on the type of evolution.

Constructors(1)

Static methods(3)

Instance methods(19)

  • IsEmpty(): boolean
  • Returns the shapes contained in <NS>. Returns a null shape if IsEmpty.

  • Returns the Evolution of the attribute.

  • Version(): number

    Returns the Version of the attribute.

  • SetVersion(version: number): void

    Set the Version of the attribute.

    Parameters (1)
    • version
  • Clear(): void
  • Returns the ID of the attribute.

  • Copies the attribute contents into a new other attribute. It is used by Backup().

  • Restore(anAttribute: TDF_Attribute): void

    Restores the contents from <anAttribute> into this one. It is used when aborting a transaction.

    Parameters (1)
    • anAttribute
  • Makes a DeltaOnModification between <me> and.

    Parameters (1)
    • anOldAttribute
  • Applies a DeltaOnModification to <me>.

    Parameters (1)
    • aDelta
  • Makes a DeltaOnRemoval on <me> because <me> has disappeared from the DS.

  • Returns an new empty attribute from the good end type. It is used by the copy algorithm.

  • Paste(intoAttribute: TDF_Attribute, aRelocationTable: TDF_RelocationTable): void

    This method is different from the "Copy" one, because it is used when copying an attribute from a source structure into a target structure. This method pastes the current attribute to the label corresponding to the insertor. The pasted attribute may be a brand new one or a new version of the previous one.

    Parameters (2)
    • intoAttribute
    • aRelocationTable
  • References(aDataSet: TDF_DataSet): void

    Adds the directly referenced attributes and labels to <aDataSet>. "Directly" means we have only to look at the first level of references.

    Parameters (1)
    • aDataSet
  • Something to do before removing an Attribute from a label.

  • BeforeUndo(anAttDelta: TDF_AttributeDelta, forceIt?: boolean): boolean

    Something to do before applying <anAttDelta>.

    Parameters (2)
    • anAttDelta
    • forceIt
  • AfterUndo(anAttDelta: TDF_AttributeDelta, forceIt?: boolean): boolean

    Something to do after applying <anAttDelta>.

    Parameters (2)
    • anAttDelta
    • forceIt

TNaming_NameType

Properties(12)

TNaming_Naming

This attribute store the topological naming of any selected shape, when this shape is not already attached to a specific label. This class is also used to solve it when the arguments of the topological naming are modified.

Constructors(1)

Static methods(5)

  • following code from TDesignStd

  • Parameters (1)
    • under
  • Name(where: TDF_Label, Selection: TopoDS_Shape, Context: TopoDS_Shape, Geometry?: boolean, KeepOrientation?: boolean, BNproblem?: boolean): TNaming_NamedShape

    Creates a Naming attribute at label <where> to identify the shape <Selection>. Geometry is true if we are only interested by the underlying geometry (e.g. setting a constraint). <Context> is used to find neighbours of when required by the naming. If KeepOrientation is True the Selection orientation is taken into account. BNproblem == True points out that Context sub-shapes in DF have orientation differences with Context shape itself.
    instance method

    Parameters (6)
    • where
    • Selection
    • Context
    • Geometry
    • KeepOrientation
    • BNproblem
  • get_type_name(): string

Instance methods(11)

  • IsDefined(): boolean
  • regenerate only the Name associated to me

    Parameters (1)
    • scope
      Mutated in place; read the updated value from this argument after the call.
  • Regenerate recursively the whole name with scope. If scope is empty it means that all the labels of the framework are valid.

    Parameters (1)
    • scope
      Mutated in place; read the updated value from this argument after the call.
  • Deferred methods from TDF_Attribute

  • Returns an new empty attribute from the good end type. It is used by the copy algorithm.

  • Restore(anAttribute: TDF_Attribute): void

    Restores the backuped contents from <anAttribute> into this one. It is used when aborting a transaction.

    Parameters (1)
    • anAttribute
  • Paste(intoAttribute: TDF_Attribute, aRelocationTable: TDF_RelocationTable): void

    This method is different from the "Copy" one, because it is used when copying an attribute from a source structure into a target structure. This method may paste the contents of <me> into <intoAttribute>.
    The given pasted attribute can be full or empty of its contents. But don't make a NEW! Just set the contents!
    It is possible to use <aRelocationTable> to get/set the relocation value of a source attribute.

    Parameters (2)
    • intoAttribute
    • aRelocationTable
  • References(aDataSet: TDF_DataSet): void

    Adds the first level referenced attributes and labels to <aDataSet>.
    For this, use the AddLabel or AddAttribute of DataSet.
    If there is none, do not implement the method.

    Parameters (1)
    • aDataSet

TNaming_NamingTool

Constructors(1)

Static methods(3)

TNaming_NewShapeIterator

Iterates on all the descendants of a shape.

Constructors(2)

Instance methods(6)

TNaming_OldShapeIterator

Iterates on all the ascendants of a shape.

Constructors(2)

Instance methods(6)

TNaming_Scope

this class manage a scope of labels

Constructors(3)

Instance methods(11)

TNaming_Selector

This class provides a single API for selection of shapes. This involves both identification and selection of shapes in the data framework. If the selected shape is modified, this selector will solve its identifications. This class is the user interface for topological naming resources.

  • The <IsIdentified> method returns (if exists) the NamedShape which contains a given shape. The definition of an identified shape is: a Shape handled by a NamedShape (this shape is the only one stored), which has the TNaming_PRImITIVE evolution
  • The <Select> method returns ALWAYS a new NamedShape at the given label, which contains the argument selected shape. When calling this method, the sub-hierarchy of <label> is first cleared, then a TNaming_NamedShape is ALWAYS created at this <label>, with the TNaming_SELECTED evolution. The <Naming attribute> is associated to the selected shape which store the arguments of the selection. If the given selected shape was already identified (method IsIdentified), this Naming attribute contains the reference (Identity code) to the argument shape.
  • The <Solve> method update the current value of the NamedShape, according to the <Naming> attribute. A boolean status is returned to say if the algorithm succeed or not. To read the current value of the selected Named Shape use the TNaming_Tool::GetShape method, as for any NamedShape attribute.

Constructors(1)

Static methods(1)

  • IsIdentified(access: TDF_Label, selection: TopoDS_Shape, Geometry: boolean): { returnValue: boolean; NS: TNaming_NamedShape; [Symbol.dispose](): void }

    To know if a shape is already identified (not selected)
    The label access defines the point of access to the data framework. selection is the shape for which we want to know whether it is identified or not. If true, NS is returned as the identity of selection. If Geometry is true, NS will be the named shape containing the first appearance of selection and not any other shape. In other words, selection must be the only shape stored in NS.

    Parameters (3)
    • access
    • selection
    • Geometry
    Returns

    A result object with fields:

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

Instance methods(5)

  • Select(Selection: TopoDS_Shape, Context: TopoDS_Shape, Geometry: boolean, KeepOrientatation: boolean): boolean

    Creates a topological naming on the label aLabel given as an argument at construction time. If successful, the shape Selection - found in the shape Context - is now identified in the named shape returned in NamedShape. If Geometry is true, NamedShape contains the first appearance of Selection. This syntax is more robust than the previous syntax for this method.

    Parameters (4)
    • Selection
    • Context
    • Geometry
    • KeepOrientatation
  • Select(Selection: TopoDS_Shape, Geometry: boolean, KeepOrientatation: boolean): boolean

    Creates a topological naming on the label aLabel given as an argument at construction time. If successful, the shape Selection is now identified in the named shape returned in NamedShape. If Geometry is true, NamedShape contains the first appearance of Selection.

    Parameters (3)
    • Selection
    • Geometry
    • KeepOrientatation
  • Updates the topological naming on the label aLabel given as an argument at construction time. The underlying shape returned in the method NamedShape is updated. To read this shape, use the method TNaming_Tool::GetShape.

    Parameters (1)
    • Valid
      Mutated in place; read the updated value from this argument after the call.
  • Returns the attribute list args. This list contains the named shape on which the topological naming was built.

    Parameters (1)
    • args
      Mutated in place; read the updated value from this argument after the call.
  • Returns the NamedShape build or under construction, which contains the topological naming..

TNaming_ShapesSet

Constructors(2)

Instance methods(11)

TNaming_Tool

A tool to get information on the topology of a named shape attribute. This information is typically a TopoDS_Shape object. Using this tool, relations between named shapes are also accessible.

Constructors(1)

Static methods(14)

  • Returns the last Modification of <NS>. Returns the shape CurrentShape contained in the named shape attribute NS. CurrentShape is the current state of the entities if they have been modified in other attributes of the same data structure. Each call to this function creates a new compound.

    Parameters (1)
    • NS
  • Returns the shape CurrentShape contained in the named shape attribute NS, and present in the updated attribute map Updated. CurrentShape is the current state of the entities if they have been modified in other attributes of the same data structure. Each call to this function creates a new compound. Warning Only the contents of Updated are searched.R.

    Parameters (2)
    • NS
    • Updated
  • Returns the NamedShape of the last Modification of <NS>. This shape is identified by a label.

    Parameters (2)
    • NS
    • Updated
  • Returns NamedShape the last Modification of <NS>.

    Parameters (1)
    • NS
  • Returns the named shape attribute defined by the shape aShape and the label anAccess. This attribute is returned as a new shape. You call this function, if you need to create a topological attribute for existing data. Example class MyPkg_MyClass { public: bool SameEdge(const occ::handle<OCafTest_Line>& , const occ::handle<CafTest_Line>& ); };.
    bool MyPkg_MyClass::SameEdge (const occ::handle<OCafTest_Line>& L1 const occ::handle<OCafTest_Line>& L2) { occ::handle<TNaming_NamedShape> NS1 = L1->NamedShape(); occ::handle<TNaming_NamedShape> NS2 = L2->NamedShape();
    return BRepTools::Compare(NS1->Get(),NS2->Get()); } In the example above, the function SameEdge is created to compare the edges having two lines for geometric supports. If these edges are found by BRepTools::Compare to be within the same tolerance, they are considered to be the same. Warning To avoid sharing of names, a SELECTED attribute will not be returned. Sharing of names makes it harder to manage the data structure. When the user of the name is removed, for example, it is difficult to know whether the name should be destroyed.

    Parameters (2)
    • aShape
    • anAcces
  • Returns the entities stored in the named shape attribute NS. If there is only one old-new pair, the new shape is returned. Otherwise, a Compound is returned. This compound is made out of all the new shapes found. Each call to this function creates a new compound.

    Parameters (1)
    • NS
  • Returns the shape contained as OldShape in <NS>.

    Parameters (1)
    • NS
  • Returns the shape generated from S or by a modification of S and contained in the named shape Generation.

    Parameters (2)
    • S
    • Generation
  • Parameters (3)
    • NS
    • Labels
    • OnlyModif
  • HasLabel(access: TDF_Label, aShape: TopoDS_Shape): boolean

    Returns True if <aShape> appears under a label.(DP).

    Parameters (2)
    • access
    • aShape
  • Label(access: TDF_Label, aShape: TopoDS_Shape, TransDef: number): { returnValue: TDF_Label; TransDef: number; [Symbol.dispose](): void }

    Returns the label of the first apparition of <aShape>. Transdef is a value of the transaction of the first apparition of <aShape>.

    Parameters (3)
    • access
    • aShape
    • TransDef
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • TransDef: updated value from the call.
      Dispose the returned envelope to release owned Handle fields.
  • Returns the shape created from the shape aShape contained in the attribute anAcces.

    Parameters (3)
    • aShape
    • anAcces
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • ValidUntil(access: TDF_Label, S: TopoDS_Shape): number

    Returns the last transaction where the creation of S is valid.

    Parameters (2)
    • access
    • S
  • Returns the current shape (a Wire or a Shell) built (in the data framework) from the shapes of the argument named shape. It is used for IDENTITY name type computation.

    Parameters (4)
    • Valid
    • Forbiden
    • Arg
    • S
      Mutated in place; read the updated value from this argument after the call.

TNaming_TranslateTool

tool to copy underlying TShape of a Shape. The TranslateTool class is provided to support the translation of topological data structures Transient to Transient.

Constructors(1)

Static methods(2)

Instance methods(14)

TNaming_UsedShapes

Global attribute located under root label to store all the shapes handled by the framework Set of Shapes Used in a Data from TDF Only one instance by Data, it always Stored as Attribute of The Root.

Static methods(3)

Instance methods(13)

  • Destroy(): void
  • Map(): TNaming_DataMapOfShapePtrRefShape
  • Returns the ID of the attribute.

  • Copies the attribute contents into a new other attribute. It is used by Backup().

  • Restore(anAttribute: TDF_Attribute): void

    Restores the contents from <anAttribute> into this one. It is used when aborting a transaction.

    Parameters (1)
    • anAttribute
  • Clears the table.

  • AfterUndo(anAttDelta: TDF_AttributeDelta, forceIt?: boolean): boolean

    Something to do after applying <anAttDelta>.

    Parameters (2)
    • anAttDelta
    • forceIt
  • this method returns a null handle (no delta).

  • this method returns a null handle (no delta).

  • Returns an new empty attribute from the good end type. It is used by the copy algorithm.

  • Paste(intoAttribute: TDF_Attribute, aRelocationTable: TDF_RelocationTable): void

    This method is different from the "Copy" one, because it is used when copying an attribute from a source structure into a target structure. This method pastes the current attribute to the label corresponding to the insertor. The pasted attribute may be a brand new one or a new version of the previous one.

    Parameters (2)
    • intoAttribute
    • aRelocationTable
  • References(aDataSet: TDF_DataSet): void

    Adds the directly referenced attributes and labels to <aDataSet>. "Directly" means we have only to look at the first level of references.
    For this, use only the AddLabel() & AddAttribute() from DataSet and do not try to modify information previously stored in <aDataSet>.

    Parameters (1)
    • aDataSet