OpenCascade.js
API ReferenceDataExchangeTKXCAF

XCAFDoc

OCCT package XCAFDoc: XCAFDoc, XCAFDoc_Area, XCAFDoc_AssemblyGraph, XCAFDoc_AssemblyGraph_Iterator, and 36 more bound classes.

XCAFDoc

Definition of general structure of DECAF document and tools to work with it.
The document is composed of sections, each section storing its own kind of data and managing by corresponding tool Some properties can be attached directly to shapes. These properties are:

  • Name (the standard definition from OCAF) - class TDataStd_Name
  • Centroid (for the validation of transfer) - class XCAFDoc_Centroid
  • Volume (for the validation of transfer) - class XCAFDoc_Volume
  • Area (for the validation of transfer) - class XCafDoc_Area Management of these attributes is realized by OCAF. For getting the attributes attached to a label the method class TDF_Label::FindAttribute() should be used.

Constructors(1)

Static methods(25)

XCAFDoc_Area

attribute to store area

Constructors(1)

Static methods(6)

Instance methods(5)

XCAFDoc_AssemblyGraph

Constructors(2)

Instance methods(12)

  • Returns

    Document shape tool.

  • GetRoots(): TColStd_PackedMapOfInteger

    Returns IDs of the root nodes.

    Returns

    IDs of the root nodes.

  • HasChildren(theNode: number): boolean

    Checks whether direct children exist for the given node.

    Parameters (1)
    • theNode
      • one-based node ID.
    Returns

    true/false.

  • GetChildren(theNode: number): TColStd_PackedMapOfInteger

    Returns IDs of child nodes for the given node.

    Parameters (1)
    • theNode
      • one-based node ID.
    Returns

    set of child IDs.

  • GetNodeType(theNode: number): XCAFDoc_AssemblyGraph_NodeType

    Returns the node type from NodeType enum.

    Parameters (1)
    • theNode
      • one-based node ID.
    Returns

    node type.

    See also
    • NodeType
  • GetNode(theNode: number): TDF_Label

    returns object ID by node ID.

    Parameters (1)
    • theNode
      • one-based node ID.
    Returns

    persistent ID.

  • Returns the unordered set of graph nodes.

    Returns

    graph nodes.

  • NbNodes(): number

    Returns the number of graph nodes.

    Returns

    number of graph nodes.

  • NbOccurrences(theNode: number): number

    Returns quantity of part usage occurrences.

    Parameters (1)
    • theNode
      • one-based part ID.
    Returns

    usage occurrence quantity.

XCAFDoc_AssemblyItemId

Unique item identifier in the hierarchical product structure. A full path to an assembly component in the "part-of" graph starting from the root node.

Constructors(3)

Instance methods(9)

  • Initializes the item ID from a list of strings, where every string is a label entry.

    Parameters (1)
    • thePath
      • list of label entries.
  • Init(theString: TCollection_AsciiString): void

    Initializes the item ID from a formatted path, where label entries are separated by '/' symbol.

    Parameters (1)
    • theString
      • formatted full path.
  • IsNull(): boolean

    Returns true if the full path is empty, otherwise - false.

  • Nullify(): void

    Clears the full path.

  • IsChild(theOther: XCAFDoc_AssemblyItemId): boolean

    Checks if this item is a child of the given item.

    Parameters (1)
    • theOther
      • potentially ancestor item.
    Returns

    true if the item is a child of theOther item, otherwise - false.

  • Checks if this item is a direct child of the given item.

    Parameters (1)
    • theOther
      • potentially parent item.
    Returns

    true if the item is a direct child of theOther item, otherwise - false.

  • IsEqual(theOther: XCAFDoc_AssemblyItemId): boolean

    Checks for item IDs equality.

    Parameters (1)
    • theOther
      • the item ID to check equality with.
    Returns

    true if this ID is equal to theOther, otherwise - false.

  • Returns the full path as a list of label entries.

  • Returns the full pass as a formatted string.

XCAFDoc_AssemblyItemRef

An attribute that describes a weak reference to an assembly item or to a subshape or to an assembly label attribute.

Constructors(1)

Static methods(7)

Instance methods(18)

XCAFDoc_AssemblyIterator

Iterator in depth along the assembly tree.

Constructors(2)

Instance methods(3)

  • More(): boolean
    Returns

    true if there is still something to iterate, false - otherwise.

  • Next(): void

    Moves depth-first iterator to the next position.

  • Returns

    current item.

XCAFDoc_Centroid

attribute to store centroid

Constructors(1)

Static methods(5)

Instance methods(7)

  • Set(pnt: gp_Pnt): void
    Parameters (1)
    • pnt
  • Returns the ID of the attribute.

  • Restore(anAttribute: TDF_Attribute): void

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

    Parameters (1)
    • anAttribute
  • 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 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

XCAFDoc_ClippingPlaneTool

Provide tool for management of ClippingPlane section of document. Provide tool to store, retrieve, remove and modify clipping planes. Each clipping plane consists of gp_Pln and its name.

Constructors(1)

Static methods(4)

Instance methods(17)

  • returns the label under which ClippingPlanes are stored

  • IsClippingPlane(theLabel: TDF_Label): boolean

    Returns True if label belongs to a ClippingPlane table and is a ClippingPlane definition.

    Parameters (1)
    • theLabel
  • GetClippingPlane(theLabel: TDF_Label, thePlane: gp_Pln, theName: TCollection_ExtendedString, theCapping: boolean): { returnValue: boolean; theCapping: boolean }

    Returns ClippingPlane defined by label lab Returns False if the label is not in ClippingPlane table or does not define a ClippingPlane.

    Parameters (4)
    • theLabel
    • thePlane
      Mutated in place; read the updated value from this argument after the call.
    • theName
      Mutated in place; read the updated value from this argument after the call.
    • theCapping
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theCapping: updated value from the call.
  • GetClippingPlane(theLabel: TDF_Label, thePlane: gp_Pln, theCapping: boolean): { returnValue: boolean; theName: TCollection_HAsciiString; theCapping: boolean; [Symbol.dispose](): void }

    Returns ClippingPlane defined by label lab Returns False if the label is not in ClippingPlane table or does not define a ClippingPlane.

    Parameters (3)
    • theLabel
    • thePlane
      Mutated in place; read the updated value from this argument after the call.
    • theCapping
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theName: owned by the returned envelope.
    • theCapping: updated value from the call.
      Dispose the returned envelope to release owned Handle fields.
  • Adds a clipping plane definition to a ClippingPlane table and returns its label (returns existing label if the same clipping plane is already defined).

    Parameters (2)
    • thePlane
    • theName
  • Adds a clipping plane definition to a ClippingPlane table and returns its label (returns existing label if the same clipping plane is already defined).

    Parameters (2)
    • thePlane
    • theName
  • AddClippingPlane(thePlane: gp_Pln, theName: TCollection_ExtendedString, theCapping: boolean): TDF_Label

    Adds a clipping plane definition to a ClippingPlane table and returns its label (returns existing label if the same clipping plane is already defined).

    Parameters (3)
    • thePlane
    • theName
    • theCapping
  • AddClippingPlane(thePlane: gp_Pln, theName: TCollection_HAsciiString, theCapping: boolean): TDF_Label

    Adds a clipping plane definition to a ClippingPlane table and returns its label (returns existing label if the same clipping plane is already defined).

    Parameters (3)
    • thePlane
    • theName
    • theCapping
  • RemoveClippingPlane(theLabel: TDF_Label): boolean

    Removes clipping plane from the ClippingPlane table Return false and do nothing if clipping plane is referenced in at least one View.

    Parameters (1)
    • theLabel
  • Returns a sequence of clipping planes currently stored in the ClippingPlane table.

    Parameters (1)
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • UpdateClippingPlane(theLabelL: TDF_Label, thePlane: gp_Pln, theName: TCollection_ExtendedString): void

    Sets new value of plane and name to the given clipping plane label or do nothing, if the given label is not a clipping plane label.

    Parameters (3)
    • theLabelL
    • thePlane
    • theName
  • SetCapping(theClippingPlaneL: TDF_Label, theCapping: boolean): void

    Set new value of capping for given clipping plane label.

    Parameters (2)
    • theClippingPlaneL
    • theCapping
  • GetCapping(theClippingPlaneL: TDF_Label): boolean

    Get capping value for given clipping plane label Return capping value.

    Parameters (1)
    • theClippingPlaneL
  • GetCapping(theClippingPlaneL: TDF_Label, theCapping: boolean): { returnValue: boolean; theCapping: boolean }

    Get capping value for given clipping plane label Return true if Label is valid and capping exists.

    Parameters (2)
    • theClippingPlaneL
    • theCapping
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theCapping: updated value from the call.
  • Returns the ID of the attribute.

XCAFDoc_Color

attribute to store color

Constructors(1)

Static methods(7)

Instance methods(14)

XCAFDoc_ColorTool

Provides tools to store and retrieve attributes (colors) of TopoDS_Shape in and from TDocStd_Document A Document is intended to hold different attributes of ONE shape and it's sub-shapes Provide tools for management of Colors section of document.

Constructors(1)

Static methods(12)

  • AutoNaming(): boolean

    Returns current auto-naming mode; TRUE by default. If TRUE then for added colors the TDataStd_Name attribute will be automatically added. This setting is global.

  • SetAutoNaming(theIsAutoNaming: boolean): void

    See also AutoNaming().

    Parameters (1)
    • theIsAutoNaming
  • Creates (if not exist) ColorTool.

    Parameters (1)
    • L
  • GetColor(lab: TDF_Label, col: Quantity_Color): boolean

    Returns color defined by label lab Returns False if the label is not in colortable or does not define a color.

    Parameters (2)
    • lab
    • col
      Mutated in place; read the updated value from this argument after the call.
  • Returns color defined by label lab Returns False if the label is not in colortable or does not define a color.

    Parameters (2)
    • lab
    • col
      Mutated in place; read the updated value from this argument after the call.
  • GetColor(L: TDF_Label, type_: XCAFDoc_ColorType, colorL: TDF_Label): boolean

    Returns label with color assigned to <L> as <type> Returns False if no such color is assigned.

    Parameters (3)
    • L
    • type_
    • colorL
      Mutated in place; read the updated value from this argument after the call.
  • GetColor(L: TDF_Label, type_: XCAFDoc_ColorType, color: Quantity_Color): boolean

    Returns color assigned to <L> as <type> Returns False if no such color is assigned.

    Parameters (3)
    • L
    • type_
    • color
      Mutated in place; read the updated value from this argument after the call.
  • Returns color assigned to <L> as <type> Returns False if no such color is assigned.

    Parameters (3)
    • L
    • type_
    • color
      Mutated in place; read the updated value from this argument after the call.
  • IsVisible(L: TDF_Label): boolean

    Return TRUE if object on this label is visible, FALSE if invisible.

    Parameters (1)
    • L
  • get_type_name(): string

Instance methods(36)

  • returns the label under which colors are stored

  • Returns internal XCAFDoc_ShapeTool tool.

  • IsColor(lab: TDF_Label): boolean

    Returns True if label belongs to a colortable and is a color definition.

    Parameters (1)
    • lab
  • GetColor(S: TopoDS_Shape, type_: XCAFDoc_ColorType, colorL: TDF_Label): boolean

    Returns label with color assigned to <L> as <type> Returns False if no such color is assigned.

    Parameters (3)
    • S
    • type_
    • colorL
      Mutated in place; read the updated value from this argument after the call.
  • Returns color assigned to <L> as <type> Returns False if no such color is assigned.

    Parameters (3)
    • S
    • type_
    • color
      Mutated in place; read the updated value from this argument after the call.
  • Returns color assigned to <L> as <type> Returns False if no such color is assigned.

    Parameters (3)
    • S
    • type_
    • color
      Mutated in place; read the updated value from this argument after the call.
  • Finds a color definition in a colortable and returns its label if found (or Null label else).

    Parameters (1)
    • col
  • Finds a color definition in a colortable and returns its label if found (or Null label else).

    Parameters (1)
    • col
  • FindColor(col: Quantity_Color, lab: TDF_Label): boolean

    Finds a color definition in a colortable and returns its label if found Returns False if color is not found in colortable.

    Parameters (2)
    • col
    • lab
      Mutated in place; read the updated value from this argument after the call.
  • Finds a color definition in a colortable and returns its label if found Returns False if color is not found in colortable.

    Parameters (2)
    • col
    • lab
      Mutated in place; read the updated value from this argument after the call.
  • Adds a color definition to a colortable and returns its label (returns existing label if the same color is already defined).

    Parameters (1)
    • col
  • Adds a color definition to a colortable and returns its label (returns existing label if the same color is already defined).

    Parameters (1)
    • col
  • Removes color from the colortable.

    Parameters (1)
    • lab
  • Returns a sequence of colors currently stored in the colortable.

    Parameters (1)
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • SetColor(L: TDF_Label, colorL: TDF_Label, type_: XCAFDoc_ColorType): void

    Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color defined by <colorL>. Color of shape is defined following way in dependance with type of color. If type of color is XCAFDoc_ColorGen - then this color defines default color for surfaces and curves. If for shape color with types XCAFDoc_ColorSurf or XCAFDoc_ColorCurv is specified then such color overrides generic color.

    Parameters (3)
    • L
    • colorL
    • type_
  • Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color <Color> in the colortable Adds a color as necessary.

    Parameters (3)
    • L
    • Color
    • type_
  • Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color <Color> in the colortable Adds a color as necessary.

    Parameters (3)
    • L
    • Color
    • type_
  • SetColor(S: TopoDS_Shape, colorL: TDF_Label, type_: XCAFDoc_ColorType): boolean

    Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color defined by <colorL> Returns False if cannot find a label for shape S.

    Parameters (3)
    • S
    • colorL
    • type_
  • Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color <Color> in the colortable Adds a color as necessary Returns False if cannot find a label for shape S.

    Parameters (3)
    • S
    • Color
    • type_
  • Sets a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color <Color> in the colortable Adds a color as necessary Returns False if cannot find a label for shape S.

    Parameters (3)
    • S
    • Color
    • type_
  • Removes a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color.

    Parameters (2)
    • L
    • type_
  • Removes a link with GUID defined by <type> (see XCAFDoc::ColorRefGUID()) from label <L> to color Returns True if such link existed.

    Parameters (2)
    • S
    • type_
  • IsSet(L: TDF_Label, type_: XCAFDoc_ColorType): boolean

    Returns True if label <L> has a color assignment of the type <type>.

    Parameters (2)
    • L
    • type_
  • IsSet(S: TopoDS_Shape, type_: XCAFDoc_ColorType): boolean

    Returns True if label <L> has a color assignment of the type <type>.

    Parameters (2)
    • S
    • type_
  • SetVisibility(shapeLabel: TDF_Label, isvisible?: boolean): void

    Set the visibility of object on label. Do nothing if there no any object. Set UAttribute with corresponding GUID.

    Parameters (2)
    • shapeLabel
    • isvisible
  • Return TRUE if object color defined by its Layer, FALSE if not.

    Parameters (1)
    • L
  • SetColorByLayer(shapeLabel: TDF_Label, isColorByLayer?: boolean): void

    Set the Color defined by Layer flag on label. Do nothing if there no any object. Set UAttribute with corresponding GUID.

    Parameters (2)
    • shapeLabel
    • isColorByLayer
  • SetInstanceColor(theShape: TopoDS_Shape, type_: XCAFDoc_ColorType, color: Quantity_Color, isCreateSHUO: boolean): boolean

    Sets the color of component that styled with SHUO structure Returns FALSE if no sush component found NOTE: create SHUO structeure if it is necessary and if <isCreateSHUO>.

    Parameters (4)
    • theShape
    • type_
    • color
    • isCreateSHUO
  • SetInstanceColor(theShape: TopoDS_Shape, type_: XCAFDoc_ColorType, color: Quantity_ColorRGBA, isCreateSHUO: boolean): boolean

    Sets the color of component that styled with SHUO structure Returns FALSE if no sush component found NOTE: create SHUO structeure if it is necessary and if <isCreateSHUO>.

    Parameters (4)
    • theShape
    • type_
    • color
    • isCreateSHUO
  • Gets the color of component that styled with SHUO structure Returns FALSE if no sush component or color type.

    Parameters (3)
    • theShape
    • type_
    • color
      Mutated in place; read the updated value from this argument after the call.
  • Gets the color of component that styled with SHUO structure Returns FALSE if no sush component or color type.

    Parameters (3)
    • theShape
    • type_
    • color
      Mutated in place; read the updated value from this argument after the call.
  • IsInstanceVisible(theShape: TopoDS_Shape): boolean

    Gets the visibility status of component that styled with SHUO structure Returns FALSE if no sush component.

    Parameters (1)
    • theShape
  • Reverses order in chains of TreeNodes (from Last to First) under each Color Label since we became to use function ::Prepend() instead of ::Append() in method SetColor() for acceleration.

  • Returns the ID of the attribute.

XCAFDoc_Datum

attribute to store datum

Constructors(1)

Static methods(5)

Instance methods(11)

XCAFDoc_Dimension

Attribute that identifies a dimension in the GD&T table. Its parent label is used as a container to store data provided by XCAFDimTolObjects_DimensionObject.

Constructors(1)

Static methods(4)

Instance methods(5)

XCAFDoc_DimTol

attribute to store dimension and tolerance

Constructors(1)

Static methods(4)

Instance methods(10)

XCAFDoc_DimTolTool

Attribute containing GD&T section of XCAF document. Provide tools for GD&T section management.

Constructors(1)

Static methods(7)

Instance methods(42)

XCAFDoc_DocumentTool

Defines sections structure of an XDE document. attribute marking CAF document as being DECAF document. Creates the sections structure of the document.

Constructors(1)

Static methods(37)

Instance methods(5)

XCAFDoc_Editor

Tool for edit structure of document.

Constructors(1)

Static methods(10)

  • Expand(theDoc: TDF_Label, theShape: TDF_Label, theRecursively: boolean): boolean

    Converts shape (compound/compsolid/shell/wire) to assembly.

    Parameters (3)
    • theDoc
      input document
    • theShape
      input shape label
    • theRecursively
      recursively expand a compound subshape
    Returns

    True if shape successfully expanded

  • Expand(theDoc: TDF_Label, theRecursively: boolean): boolean

    Converts all compounds shapes in the document to assembly.

    Parameters (2)
    • theDoc
      input document
    • theRecursively
      recursively expand a compound subshape
    Returns

    True if shape successfully expanded

  • Extract(theSrcLabels: NCollection_Sequence_TDF_Label, theDstLabel: TDF_Label, theIsNoVisMat: boolean): boolean

    Clones all labels to a new position, keeping the structure with all the attributes.

    Parameters (3)
    • theSrcLabels
      original labels to copy from
    • theDstLabel
      label to set result as a component of or a main document's label to simply set new shape
    • theIsNoVisMat
      get a VisMaterial attributes as is or convert to color
    Returns

    True if shape successfully extracted

  • Extract(theSrcLabel: TDF_Label, theDstLabel: TDF_Label, theIsNoVisMat: boolean): boolean

    Clones the label to a new position, keeping the structure with all the attributes.

    Parameters (3)
    • theSrcLabel
      original label to copy from
    • theDstLabel
      label to set result as a component of or a main document's label to simply set new shape
    • theIsNoVisMat
      get a VisMaterial attributes as is or convert to color
    Returns

    True if shape successfully extracted

  • Copies shapes label with keeping of shape structure (recursively).

    Parameters (4)
    • theSrcLabel
      original label to copy from
    • theSrcShapeTool
      shape tool to get
    • theDstShapeTool
      shape tool to set
    • theMap
      relating map of the original shapes label and labels created from them Mutated in place; read the updated value from this argument after the call.
    Returns

    result shape label

  • CloneMetaData(theSrcLabel: TDF_Label, theDstLabel: TDF_Label, theVisMatMap: NCollection_DataMap_handle_XCAFDoc_VisMaterial_handle_XCAFDoc_VisMaterial, theToCopyColor?: boolean, theToCopyLayer?: boolean, theToCopyMaterial?: boolean, theToCopyVisMaterial?: boolean, theToCopyAttributes?: boolean): void

    Copies metadata contains from the source label to the destination label. Protected against creating a new label for non-existent tools.

    Parameters (8)
    • theSrcLabel
      original label to copy from
    • theDstLabel
      destination shape label to set attributes
    • theVisMatMap
      relating map of the original VisMaterial and created. Can be NULL for the same document
    • theToCopyColor
      copying visible value and shape color (handled all color type)
    • theToCopyLayer
      copying layer
    • theToCopyMaterial
      copying material
    • theToCopyVisMaterial
      copying visual material
    • theToCopyAttributes
      copying of other node attributes, for example, a shape's property
  • GetParentShapeLabels(theLabel: TDF_Label, theRelatedLabels: NCollection_Map_TDF_Label): void

    Gets shape labels that has down relation with the input label.

    Parameters (2)
    • theLabel
      input label
    • theRelatedLabels
      output labels Mutated in place; read the updated value from this argument after the call.
  • GetChildShapeLabels(theLabel: TDF_Label, theRelatedLabels: NCollection_Map_TDF_Label): void

    Gets shape labels that has up relation with the input label.

    Parameters (2)
    • theLabel
      input label
    • theRelatedLabels
      output labels Mutated in place; read the updated value from this argument after the call.
  • FilterShapeTree(theShapeTool: XCAFDoc_ShapeTool, theLabelsToKeep: NCollection_Map_TDF_Label): boolean

    Filters original shape tree with keeping structure. The result will include the full label hierarchy lower then input labels. Any higher hierarchy labels will be filtered to keep only necessary labels. All not related shape labels with input will be cleared (all attributes will be removed).
    The result impact directly into original document and existed shape labels. Attributes related to removed shape can became invalide. For example, GDT with relation on removed shape label(s) and without attachment point(s) became invalid for visualization.

    Parameters (2)
    • theShapeTool
      shape tool to extract from
    • theLabelsToKeep
      labels to keep
    Returns

    true if the tree was filtered successfully.

  • RescaleGeometry(theLabel: TDF_Label, theScaleFactor: number, theForceIfNotRoot?: boolean): boolean

    Applies geometrical scaling to the following assembly components:

    • part geometry
    • sub-assembly/part occurrence location
    • part's centroid, area and volume attributes
    • PMIs (warnings and errors are reported if it is impossible to make changes) Normally, should start from a root sub-assembly, but if theForceIfNotRoot true scaling will be applied forcibly. If theLabel corresponds to the shape tool scaling is applied to the whole assembly.
    Parameters (3)
    • theLabel
      starting label
    • theScaleFactor
      scale factor, should be positive
    • theForceIfNotRoot
      allows scaling of a non root assembly if true, otherwise - returns false
    Returns

    true in case of success, otherwise - false.

XCAFDoc_GeomTolerance

Attribute to store dimension and tolerance.

Constructors(1)

Static methods(4)

Instance methods(5)

XCAFDoc_GraphNode

This attribute allow user multirelation tree of labels. This GraphNode is experimental Graph that not control looping and redundance. Attribute containing sequence of father's and child's labels. Provide create and work with Graph in XCAFDocument.

Constructors(1)

Static methods(6)

  • Find(L: TDF_Label): { returnValue: boolean; G: XCAFDoc_GraphNode; [Symbol.dispose](): void }

    class methods working on the node
    Shortcut to search a Graph node attribute with default GraphID. Returns true if found.

    Parameters (1)
    • L
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • G: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • Finds or Creates a GraphNode attribute on the label <L> with the default Graph ID, returned by the method <GetDefaultGraphID>. Returns the created/found GraphNode attribute.

    Parameters (1)
    • L
  • Finds or Creates a GraphNode attribute on the label <L>, with an explicit tree ID. <ExplicitGraphID> is the ID returned by <TDF_Attribute::ID> method. Returns the found/created GraphNode attribute.

    Parameters (2)
    • L
    • ExplicitGraphID
  • returns a default Graph ID. this ID is used by the <Set> method without explicit tree ID.
    Instance methods:

  • get_type_name(): string

Instance methods(22)

  • SetGraphID(explicitID: Standard_GUID): void
    Parameters (1)
    • explicitID
  • Set GraphNode <F> as father of me and returns index of <F> in Sequence that containing Fathers GraphNodes. return index of <F> from GraphNodeSequnece.

    Parameters (1)
    • F
  • Set GraphNode <Ch> as child of me and returns index of <Ch> in Sequence that containing Children GraphNodes. return index of <Ch> from GraphNodeSequnece.

    Parameters (1)
    • Ch
  • Remove <F> from Fathers GraphNodeSequence. and remove link between father and child.

    Parameters (1)
    • F
  • UnSetFather(Findex: number): void

    Remove Father GraphNode by index from Fathers GraphNodeSequence. and remove link between father and child.

    Parameters (1)
    • Findex
  • Remove <Ch> from GraphNodeSequence. and remove link between father and child.

    Parameters (1)
    • Ch
  • UnSetChild(Chindex: number): void

    Remove Child GraphNode by index from Children GraphNodeSequence. and remove link between father and child.

    Parameters (1)
    • Chindex
  • GetFather(Findex: number): XCAFDoc_GraphNode

    Return GraphNode by index from GraphNodeSequence.

    Parameters (1)
    • Findex
  • GetChild(Chindex: number): XCAFDoc_GraphNode

    Return GraphNode by index from GraphNodeSequence.

    Parameters (1)
    • Chindex
  • Return index of <F>, or zero if there is no such Graphnode.

    Parameters (1)
    • F
  • Return index of <Ch>, or zero if there is no such Graphnode.

    Parameters (1)
    • Ch
  • returns TRUE if <me> is father of <Ch>.

    Parameters (1)
    • Ch
  • returns TRUE if <me> is child of <F>.

    Parameters (1)
    • F
  • NbFathers(): number

    return Number of Fathers GraphNodes.

  • NbChildren(): number

    return Number of Childrens GraphNodes.
    Implementation of Attribute methods:

  • Returns the Graph ID (default or explicit one depending on the Set method used).

  • 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
  • Returns an new empty attribute from the good end type. It is used by the copy algorithm.

  • 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
  • BeforeForget(): void

    Something to do before forgetting an Attribute to a label.

XCAFDoc_LayerTool

Provides tools to store and retrieve attributes (Layers) of TopoDS_Shape in and from TDocStd_Document A Document is intended to hold different attributes of ONE shape and it's sub-shapes Provide tools for management of Layers section of document.

Constructors(1)

Static methods(5)

Instance methods(37)

  • returns the label under which Layers are stored

  • Returns internal XCAFDoc_ShapeTool tool.

  • IsLayer(lab: TDF_Label): boolean

    Returns True if label belongs to a Layertable and is a Layer definition.

    Parameters (1)
    • lab
  • Returns Layer defined by label lab Returns False if the label is not in Layertable or does not define a Layer.

    Parameters (2)
    • lab
    • aLayer
      Mutated in place; read the updated value from this argument after the call.
  • Finds a Layer definition in a Layertable and returns its label if found Returns False if Layer is not found in Layertable.

    Parameters (2)
    • aLayer
    • lab
      Mutated in place; read the updated value from this argument after the call.
  • FindLayer(aLayer: TCollection_ExtendedString, theToFindWithProperty: boolean, theToFindVisible: boolean): TDF_Label

    Finds a Layer definition in a Layertable by name Returns first founded label with the same name if <theToFindWithProperty> is false If <theToFindWithProperty> is true returns first label that contains or not contains visible attr, according to the <theToFindVisible> parameter.

    Parameters (3)
    • aLayer
    • theToFindWithProperty
    • theToFindVisible
  • Adds a Layer definition to a Layertable and returns its label (returns existing label if the same Layer is already defined).

    Parameters (1)
    • theLayer
  • AddLayer(theLayer: TCollection_ExtendedString, theToFindVisible: boolean): TDF_Label

    Adds a Layer definition to a Layertable and returns its label Returns existing label (if it is already defined) of visible or invisible layer, according to <theToFindVisible> parameter.

    Parameters (2)
    • theLayer
    • theToFindVisible
  • Removes Layer from the Layertable.

    Parameters (1)
    • lab
  • Returns a sequence of Layers currently stored in the Layertable.

    Parameters (1)
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • SetLayer(L: TDF_Label, LayerL: TDF_Label, shapeInOneLayer: boolean): void

    Sets a link from label <L> to Layer defined by <LayerL> optional parameter <shapeInOneLayer> show could shape be in number of layers or only in one.

    Parameters (3)
    • L
    • LayerL
    • shapeInOneLayer
  • SetLayer(L: TDF_Label, aLayer: TCollection_ExtendedString, shapeInOneLayer: boolean): void

    Sets a link from label <L> to Layer <aLayer> in the Layertable Adds a Layer as necessary optional parameter <shapeInOneLayer> show could shape be in number of layers or only in one.

    Parameters (3)
    • L
    • aLayer
    • shapeInOneLayer
  • SetLayer(Sh: TopoDS_Shape, LayerL: TDF_Label, shapeInOneLayer: boolean): boolean

    Sets a link from label that containing shape <Sh> with layer that situated at label <LayerL>. optional parameter <shapeInOneLayer> show could shape be in number of layers or only in one. return FALSE if no such shape <Sh> or label <LayerL>.

    Parameters (3)
    • Sh
    • LayerL
    • shapeInOneLayer
  • SetLayer(Sh: TopoDS_Shape, aLayer: TCollection_ExtendedString, shapeInOneLayer: boolean): boolean

    Sets a link from label that containing shape <Sh> with layer <aLayer>. Add <aLayer> to LayerTable if nessesery. optional parameter <shapeInOneLayer> show could shape be in number of layers or only in one. return FALSE if no such shape <Sh>.

    Parameters (3)
    • Sh
    • aLayer
    • shapeInOneLayer
  • Removes a link from label <L> to all layers.

    Parameters (1)
    • L
  • Remove link between shape <Sh> and all Layers at LayerTable. return FALSE if no such shape <Sh> in XCAF Document.

    Parameters (1)
    • Sh
  • Remove link from label <L> and Layer <aLayer>. returns FALSE if no such layer.

    Parameters (2)
    • L
    • aLayer
  • UnSetOneLayer(L: TDF_Label, aLayerL: TDF_Label): boolean

    Remove link from label <L> and Layer <aLayerL>. returns FALSE if <aLayerL> is not a layer label.

    Parameters (2)
    • L
    • aLayerL
  • Remove link between shape <Sh> and layer <aLayer>. returns FALSE if no such layer <aLayer> or shape <Sh>.

    Parameters (2)
    • Sh
    • aLayer
  • UnSetOneLayer(Sh: TopoDS_Shape, aLayerL: TDF_Label): boolean

    Remove link between shape <Sh> and layer <aLayerL>. returns FALSE if no such layer <aLayerL> or shape <Sh>.

    Parameters (2)
    • Sh
    • aLayerL
  • Returns True if label <L> has a Layer associated with the <aLayer>.

    Parameters (2)
    • L
    • aLayer
  • IsSet(L: TDF_Label, aLayerL: TDF_Label): boolean

    Returns True if label <L> has a Layer associated with the <aLayerL> label.

    Parameters (2)
    • L
    • aLayerL
  • Returns True if shape <Sh> has a Layer associated with the <aLayer>.

    Parameters (2)
    • Sh
    • aLayer
  • IsSet(Sh: TopoDS_Shape, aLayerL: TDF_Label): boolean

    Returns True if shape <Sh> has a Layer associated with the <aLayerL>.

    Parameters (2)
    • Sh
    • aLayerL
  • GetLayers(L: TDF_Label): { returnValue: boolean; aLayerS: NCollection_HSequence_TCollection_ExtendedString; [Symbol.dispose](): void }

    Return sequence of strings <aLayerS> that associated with label <L>.

    Parameters (1)
    • L
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • aLayerS: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • GetLayers_1(L: TDF_Label): { returnValue: boolean; aLayerS: NCollection_HSequence_TCollection_ExtendedString; [Symbol.dispose](): void }

    Return sequence of strings <aLayerS> that associated with label <L>.

    Parameters (1)
    • L
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • aLayerS: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • Return sequence of strings that associated with shape <Sh>.

    Parameters (1)
    • L
  • GetLayers(Sh: TopoDS_Shape): { returnValue: boolean; aLayerS: NCollection_HSequence_TCollection_ExtendedString; [Symbol.dispose](): void }

    Return sequence of strings <aLayerS> that associated with shape <Sh>.

    Parameters (1)
    • Sh
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • aLayerS: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • GetLayers_4(Sh: TopoDS_Shape): { returnValue: boolean; aLayerS: NCollection_HSequence_TCollection_ExtendedString; [Symbol.dispose](): void }

    Return sequence of strings <aLayerS> that associated with shape <Sh>.

    Parameters (1)
    • Sh
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • aLayerS: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • Return sequence of strings that associated with shape <Sh>.

    Parameters (1)
    • Sh
  • Return sequence of strings <aLayerS> that associated with label <L>.

    Parameters (2)
    • L
    • aLayerLS
      Mutated in place; read the updated value from this argument after the call.
  • Return sequence of labels <aLayerSL> that associated with label <L>.

    Parameters (2)
    • Sh
    • aLayerLS
      Mutated in place; read the updated value from this argument after the call.
  • IsVisible(layerL: TDF_Label): boolean

    Return TRUE if layer is visible, FALSE if invisible.

    Parameters (1)
    • layerL
  • SetVisibility(layerL: TDF_Label, isvisible?: boolean): void

    Set the visibility of layer. If layer is invisible when on it's layer will set UAttribute with corresponding GUID.

    Parameters (2)
    • layerL
    • isvisible
  • Returns the ID of the attribute.

XCAFDoc_LengthUnit

Used to define a Length Unit attribute containing a length unit info.

Constructors(1)

Static methods(6)

  • Returns the GUID of the attribute.

  • Set(theLabel: TDF_Label, theUnitValue: number): XCAFDoc_LengthUnit

    Finds or creates a LengthUnit attribute.

    Parameters (2)
    • theLabel
    • theUnitValue
      • length scale factor to meter The LengthUnit attribute is returned.
  • Set(theLabel: TDF_Label, theUnitName: TCollection_AsciiString, theUnitValue: number): XCAFDoc_LengthUnit

    Finds or creates a LengthUnit attribute.

    Parameters (3)
    • theLabel
    • theUnitName
      • name of the unit: mm, m, cm, km, micron, in, min, nin, ft, stat.mile
    • theUnitValue
      • length scale factor to meter The LengthUnit attribute is returned.
  • Set(theLabel: TDF_Label, theGUID: Standard_GUID, theUnitName: TCollection_AsciiString, theUnitValue: number): XCAFDoc_LengthUnit

    Finds, or creates, a LengthUnit attribute with explicit user defined GUID.

    Parameters (4)
    • theLabel
    • theGUID
    • theUnitName
      • name of the unit: mm, m, cm, km, micron, in, min, nin, ft, stat.mile
    • theUnitValue
      • length scale factor to meter The LengthUnit attribute is returned
  • get_type_name(): string

Instance methods(9)

  • Set(theUnitName: TCollection_AsciiString, theUnitValue: number): void

    Creates a LengthUnit attribute.

    Parameters (2)
    • theUnitName
      • name of the unit: mm, m, cm, km, micron, in, min, nin, ft, stat.mile
    • theUnitValue
      • length scale factor to meter
  • Length unit description (could be arbitrary text).

  • GetUnitValue(): number

    Returns length unit scale factor to meter.

  • IsEmpty(): boolean
  • Returns the ID of the attribute.

  • 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

XCAFDoc_Location

attribute to store TopLoc_Location

Constructors(1)

Static methods(4)

Instance methods(7)

  • Set(Loc: TopLoc_Location): void
    Parameters (1)
    • Loc
  • Returns True if there is a reference on the same label.

  • Returns the ID of the attribute.

  • Restore(anAttribute: TDF_Attribute): void

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

    Parameters (1)
    • anAttribute
  • 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 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

XCAFDoc_Material

attribute to store material

Constructors(1)

Static methods(4)

Instance methods(11)

XCAFDoc_MaterialTool

Provides tools to store and retrieve attributes (materials) of TopoDS_Shape in and from TDocStd_Document A Document is intended to hold different attributes of ONE shape and it's sub-shapes Provide tools for management of Materialss section of document.

Constructors(1)

Static methods(6)

Instance methods(10)

XCAFDoc_Note

A base note attribute. Any note contains the name of the user created the note and the creation timestamp.

Static methods(4)

Instance methods(9)

XCAFDoc_NoteBalloon

A comment note attribute. Contains a textual comment.

Constructors(1)

Static methods(5)

Instance methods(5)

XCAFDoc_NoteBinData

Constructors(1)

Static methods(4)

Instance methods(11)

XCAFDoc_NoteComment

A comment note attribute. Contains a textual comment.

Constructors(1)

Static methods(5)

Instance methods(8)

  • Set(theComment: TCollection_ExtendedString): void

    Sets the comment text.

    Parameters (1)
    • theComment
  • Set(theUserName: TCollection_ExtendedString, theTimeStamp: TCollection_ExtendedString): void

    Create (if not exist) a comment note on the given label.

    Parameters (2)
    • theUserName
      • the name of the user, who created the note.
    • theTimeStamp
      • creation timestamp of the note.
  • Returns the comment text.

  • Returns the ID of the 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

XCAFDoc_NotesTool

A tool to annotate items in the hierarchical product structure. There are two basic entities, which operates the notes tool: notes and annotated items.
A note is a user defined data structure derived from XCAFDoc_Note attribute that is attached to a separate label under the notes hive.
An annotated item is represented by XCAFDoc_AssemblyItemRef attribute attached to a separate label under the annotated items hive. Notes are linked with annotated items by means of XCAFDoc_GraphNode attribute. Notes play parent roles and annotated items - child roles.
| XCAFDoc_DocumentTool |
| 0:1 |
|1
| XCAFDoc_NotesTool |
| 0:1:9 |
|1 | ------------------ -------------------------- +| Notes |----| XCAFDoc_Note | | 1| 0:1:9:1 |1 | 0:1:9:1: | | ------------------ -------------------------- | !* | { XCAFDoc_GraphNode } | *! | ------------------ -------------------------- +| Annotated items |----| XCAFDoc_AssemblyItemRef | 1| 0:1:9:2 |1 | 0:1:9:2: |
A typical annotation procedure is illustrated by the code example below:

//GetthenotestoolfromaXCAFdocument occ::handle<XCAFDoc_NotesTool>aNotesTool=XCAFDoc_DocumentTool::NotesTool(aDoc->Main()); //Createnewcommentnote occ::handle<XCAFDoc_Note>aNote=aNotesTool->CreateComment(aUserName,aTimestamp,aComment); if(!aNote.IsNull()){ occ::handle<XCAFDoc_AssemblyItemRef>aRef=aNotesTool->AddNote(aNote->Label(), anAssemblyItemId);if(aRef.IsNull()){ //Processerror... } }

Constructors(1)

Static methods(3)

Instance methods(48)

XCAFDoc_ShapeMapTool

attribute containing map of sub shapes

Constructors(1)

Static methods(4)

Instance methods(8)

  • IsSubShape(sub: TopoDS_Shape): boolean

    Checks whether shape is subshape of shape stored on label shapeL.

    Parameters (1)
    • sub
  • Sets representation (TopoDS_Shape) for top-level shape.

    Parameters (1)
    • S
  • Returns the ID of the attribute.

  • Restore(anAttribute: TDF_Attribute): void

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

    Parameters (1)
    • anAttribute
  • 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 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

XCAFDoc_ShapeTool

A tool to store shapes in an XDE document in the form of assembly structure, and to maintain this structure. Attribute containing Shapes section of DECAF document. Provide tools for management of Shapes section. The API provided by this class allows to work with this structure regardless of its low-level implementation. All the shapes are stored on child labels of a main label which is XCAFDoc_DocumentTool::LabelShapes().
The label for assembly also has sub-labels, each of which represents the instance of another shape in that assembly (component).
Such sub-label stores reference to the label of the original shape in the form of TDataStd_TreeNode with GUID XCAFDoc::ShapeRefGUID(), and its location encapsulated into the NamedShape. For correct work with an XDE document, it is necessary to use methods for analysis and methods for working with shapes.
For example: if ( STool->IsAssembly(aLabel) ) { bool subchilds = false; (default) int nbc = STool->NbComponents (aLabel[,subchilds]); } If subchilds is True, commands also consider sub-levels. By default, only level one is checked. In this example, number of children from the first level of assembly will be returned.
Methods for creation and initialization: Constructor: XCAFDoc_ShapeTool::XCAFDoc_ShapeTool() Getting a guid: Standard_GUID GetID (); Creation (if does not exist) of ShapeTool on label L: occ::handle<XCAFDoc_ShapeTool> XCAFDoc_ShapeTool::Set(const TDF_Label& L) Analyze whether shape is a simple shape or an instance or a component of an assembly or it is an assembly ( methods of analysis).
For example: STool->IsShape(aLabel) ; Analyze that the label represents a shape (simple shape, assembly or reference) or STool->IsTopLevel(aLabel); Analyze that the label is a label of a top-level shape. Work with simple shapes, assemblies and instances ( methods for work with shapes).
For example: Add shape: bool makeAssembly; // True to interpret a Compound as an Assembly, False to take it as a whole aLabel = STool->AddShape(aShape, makeAssembly); Get shape: TDF_Label aLabel... // A label must be present if (aLabel.IsNull()) { ... no such label : abandon .. } TopoDS_Shape aShape; aShape = STool->GetShape(aLabel); if (aShape.IsNull()) { ... this label is not for a Shape ... } To get a label from shape. bool findInstance = false; (this is default value) aLabel = STool->FindShape(aShape [,findInstance]); if (aLabel.IsNull()) { ... no label found for this shape ... }.

Constructors(1)

  • Creates an empty tool Creates a tool to work with a document <Doc> Attaches to label XCAFDoc::LabelShapes().

Static methods(30)

  • Create (if not exist) ShapeTool from XCAFDoc on <L>.

    Parameters (1)
    • L
  • IsFree(L: TDF_Label): boolean

    Returns True if the label is not used by any assembly, i.e. contains sublabels which are assembly components This is relevant only if IsShape() is True (There is no Father TreeNode on this <L>).

    Parameters (1)
    • L
  • IsShape(L: TDF_Label): boolean

    Returns True if the label represents a shape (simple shape, assembly or reference).

    Parameters (1)
    • L
  • Returns True if the label is a label of simple shape.

    Parameters (1)
    • L
  • IsReference(L: TDF_Label): boolean

    Return true if <L> is a located instance of other shape i.e. reference.

    Parameters (1)
    • L
  • IsAssembly(L: TDF_Label): boolean

    Returns True if the label is a label of assembly, i.e. contains sublabels which are assembly components This is relevant only if IsShape() is True.

    Parameters (1)
    • L
  • IsComponent(L: TDF_Label): boolean

    Return true if <L> is reference serving as component of assembly.

    Parameters (1)
    • L
  • IsCompound(L: TDF_Label): boolean

    Returns True if the label is a label of compound, i.e. contains some sublabels This is relevant only if IsShape() is True.

    Parameters (1)
    • L
  • IsSubShape(L: TDF_Label): boolean

    Return true if <L> is subshape of the top-level shape.

    Parameters (1)
    • L
  • To get TopoDS_Shape from shape's label For component, returns new shape with correct location Returns False if label does not contain shape.

    Parameters (2)
    • L
    • S
      Mutated in place; read the updated value from this argument after the call.
  • To get TopoDS_Shape from shape's label For component, returns new shape with correct location Returns Null shape if label does not contain shape.

    Parameters (1)
    • L
  • Gets shape from a sequence of shape's labels.

    Parameters (1)
    • theLabels
      a sequence of labels to get shapes from
    Returns

    original shape in case of one label and a compound of shapes in case of more

  • SetAutoNaming(V: boolean): void

    Sets auto-naming mode to <V>. If True then for added shapes, links, assemblies and SHUO's, the TDataStd_Name attribute is automatically added. For shapes it contains a shape type (e.g. "SOLID", "SHELL", etc); for links it has a form "=>[0:1:1:2]" (where a tag is a label containing a shape without a location); for assemblies it is "ASSEMBLY", and "SHUO" for SHUO's. This setting is global; it cannot be made a member function as it is used by static methods as well. By default, auto-naming is enabled. See also AutoNaming().

    Parameters (1)
    • V
  • AutoNaming(): boolean

    Returns current auto-naming mode. See SetAutoNaming() for description.

  • GetUsers(L: TDF_Label, Labels: NCollection_Sequence_TDF_Label, getsubchilds: boolean): number

    Returns list of labels which refer shape L as component Returns number of users (0 if shape is free).

    Parameters (3)
    • L
    • Labels
      Mutated in place; read the updated value from this argument after the call.
    • getsubchilds
  • Returns location of instance.

    Parameters (1)
    • L
  • GetReferredShape(L: TDF_Label, Label: TDF_Label): boolean

    Returns label which corresponds to a shape referred by L Returns False if label is not reference.

    Parameters (2)
    • L
    • Label
      Mutated in place; read the updated value from this argument after the call.
  • NbComponents(L: TDF_Label, getsubchilds?: boolean): number

    Returns number of Assembles components.

    Parameters (2)
    • L
    • getsubchilds
  • GetComponents(L: TDF_Label, Labels: NCollection_Sequence_TDF_Label, getsubchilds: boolean): boolean

    Returns list of components of assembly Returns False if label is not assembly.

    Parameters (3)
    • L
    • Labels
      Mutated in place; read the updated value from this argument after the call.
    • getsubchilds
  • Returns list of labels identifying subshapes of the given shape Returns False if no subshapes are placed on that label.

    Parameters (2)
    • L
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • IsExternRef(L: TDF_Label): boolean

    Returns True if the label is a label of external references, i.e. there are some reference on the no-step files, which are described in document only their names.

    Parameters (1)
    • L
  • Gets the names of references on the no-step files.

    Parameters (2)
    • L
    • SHAS
      Mutated in place; read the updated value from this argument after the call.
  • GetSHUO(SHUOLabel: TDF_Label): { returnValue: boolean; aSHUOAttr: XCAFDoc_GraphNode; [Symbol.dispose](): void }

    Returns founded SHUO GraphNode attribute <aSHUOAttr> Returns false in other case.

    Parameters (1)
    • SHUOLabel
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • aSHUOAttr: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • Returns founded SHUO GraphNodes of indicated component Returns false in other case.

    Parameters (2)
    • CompLabel
    • SHUOAttrs
      Mutated in place; read the updated value from this argument after the call.
  • Returns the sequence of labels of SHUO attributes, which is upper_usage for this next_usage SHUO attribute (that indicated by label) NOTE: returns upper_usages only on one level (not recurse) NOTE: do not clear the sequence before filling.

    Parameters (2)
    • NextUsageL
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • Returns the sequence of labels of SHUO attributes, which is next_usage for this upper_usage SHUO attribute (that indicated by label) NOTE: returns next_usages only on one level (not recurse) NOTE: do not clear the sequence before filling.

    Parameters (2)
    • UpperUsageL
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • FindSHUO(Labels: NCollection_Sequence_TDF_Label): { returnValue: boolean; theSHUOAttr: XCAFDoc_GraphNode; [Symbol.dispose](): void }

    Searches the SHUO by labels of components from upper_usage component to next_usage Returns null attribute if no SHUO found.

    Parameters (1)
    • Labels
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • theSHUOAttr: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • get_type_name(): string

Instance methods(41)

  • IsTopLevel(L: TDF_Label): boolean

    Returns True if the label is a label of top-level shape, as opposed to component of assembly or subshape.

    Parameters (1)
    • L
  • IsSubShape(shapeL: TDF_Label, sub: TopoDS_Shape): boolean

    Checks whether shape is subshape of shape stored on label shapeL.

    Parameters (2)
    • shapeL
    • sub
  • SearchUsingMap(S: TopoDS_Shape, L: TDF_Label, findWithoutLoc: boolean, findSubshape: boolean): boolean
    Parameters (4)
    • S
    • L
    • findWithoutLoc
    • findSubshape
  • FindShape(S: TopoDS_Shape, L: TDF_Label, findInstance: boolean): boolean

    Returns the label corresponding to shape S (searches among top-level shapes, not including subcomponents of assemblies and subshapes) If findInstance is False (default), search for the input shape without location If findInstance is True, searches for the input shape as is. Return True if is found.

    Parameters (3)
    • S
    • L
      Mutated in place; read the updated value from this argument after the call.
    • findInstance
  • FindShape(S: TopoDS_Shape, findInstance: boolean): TDF_Label

    Does the same as previous method Returns Null label if not found.

    Parameters (2)
    • S
    • findInstance
  • Gets shape from a sequence of all top-level shapes which are free.

    Returns

    original shape in case of one label and a compound of shapes in case of more

  • Creates new (empty) top-level shape. Initially it holds empty TopoDS_Compound.

  • Sets representation (TopoDS_Shape) for top-level shape.

    Parameters (2)
    • L
    • S
  • AddShape(S: TopoDS_Shape, makeAssembly?: boolean, makePrepare?: boolean): TDF_Label

    Adds a new top-level (creates and returns a new label) If makeAssembly is True, treats TopAbs_COMPOUND shapes as assemblies (creates assembly structure). NOTE: <makePrepare> replace components without location in assembly by located components to avoid some problems. If AutoNaming() is True then automatically attaches names.

    Parameters (3)
    • S
    • makeAssembly
    • makePrepare
  • RemoveShape(L: TDF_Label, removeCompletely?: boolean): boolean

    Removes shape (whole label and all its sublabels) If removeCompletely is true, removes complete shape If removeCompletely is false, removes instance(location) only Returns False (and does nothing) if shape is not free or is not top-level shape.

    Parameters (2)
    • L
    • removeCompletely
  • Init(): void

    set hasComponents into false

  • recursive

    Parameters (1)
    • L
  • Compute a sequence of simple shapes.

  • Returns a sequence of all top-level shapes.

    Parameters (1)
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • Returns a sequence of all top-level shapes which are free (i.e. not referred by any other).

    Parameters (1)
    • FreeLabels
      Mutated in place; read the updated value from this argument after the call.
  • Adds a component given by its label and location to the assembly Note: assembly must be IsAssembly() or IsSimpleShape().

    Parameters (3)
    • assembly
    • comp
    • Loc
  • AddComponent(assembly: TDF_Label, comp: TopoDS_Shape, expand: boolean): TDF_Label

    Adds a shape (located) as a component to the assembly If necessary, creates an additional top-level shape for component and return the Label of component. If expand is True and component is Compound, it will be created as assembly also Note: assembly must be IsAssembly() or IsSimpleShape().

    Parameters (3)
    • assembly
    • comp
    • expand
  • Removes a component from its assembly.

    Parameters (1)
    • comp
  • Top-down update for all assembly compounds stored in the document.

  • FindSubShape(shapeL: TDF_Label, sub: TopoDS_Shape, L: TDF_Label): boolean

    Finds a label for subshape of shape stored on label shapeL Returns Null label if it is not found.

    Parameters (3)
    • shapeL
    • sub
    • L
      Mutated in place; read the updated value from this argument after the call.
  • Adds a label for subshape of shape stored on label shapeL Returns Null label if it is not subshape.

    Parameters (2)
    • shapeL
    • sub
  • AddSubShape(shapeL: TDF_Label, sub: TopoDS_Shape, addedSubShapeL: TDF_Label): boolean

    Adds (of finds already existed) a label for subshape of shape stored on label shapeL. Label addedSubShapeL returns added (found) label or empty in case of wrong subshape. Returns True, if new shape was added, False in case of already existed subshape/wrong subshape.

    Parameters (3)
    • shapeL
    • sub
    • addedSubShapeL
      Mutated in place; read the updated value from this argument after the call.
  • Parameters (1)
    • sub
  • Performs a search among top-level shapes to find the shape containing as subshape Checks only simple shapes, and returns the first found label (which should be the only one for valid model).

    Parameters (1)
    • sub
  • returns the label under which shapes are stored

  • Returns the ID of the attribute.

  • Sets the names of references on the no-step files.

    Parameters (1)
    • SHAS
  • Sets the names of references on the no-step files.

    Parameters (2)
    • L
    • SHAS
  • SetSHUO(Labels: NCollection_Sequence_TDF_Label): { returnValue: boolean; MainSHUOAttr: XCAFDoc_GraphNode; [Symbol.dispose](): void }

    Sets the SHUO structure between upper_usage and next_usage create multy-level (if number of labels > 2) SHUO from first to last Initialise out <MainSHUOAttr> by main upper_usage SHUO attribute. Returns FALSE if some of labels in not component label.

    Parameters (1)
    • Labels
    Returns

    A result object with fields:

    • returnValue: the C++ return value
    • MainSHUOAttr: owned by the returned envelope.
      Dispose the returned envelope to release owned Handle fields.
  • RemoveSHUO(SHUOLabel: TDF_Label): boolean

    Remove SHUO from component sublabel, remove all dependencies on other SHUO. Returns FALSE if cannot remove SHUO dependencies. NOTE: remove any styles that associated with this SHUO.

    Parameters (1)
    • SHUOLabel
  • Search the path of labels in the document, that corresponds the component from any assembly Try to search the sequence of labels with location that produce this shape as component of any assembly NOTE: Clear sequence of labels before filling.

    Parameters (2)
    • theShape
    • Labels
      Mutated in place; read the updated value from this argument after the call.
  • Search for the component shape that styled by shuo Returns null shape if no any shape is found.

    Parameters (1)
    • theSHUO
  • Search for the component shape by labelks path and set SHUO structure for founded label structure Returns null attribute if no component in any assembly found.

    Parameters (1)
    • theShape
  • Searching for component shapes that styled by shuo Returns empty sequence of shape if no any shape is found.

    Parameters (2)
    • theSHUO
    • theSHUOShapeSeq
      Mutated in place; read the updated value from this argument after the call.
  • SetLocation(theShapeLabel: TDF_Label, theLoc: TopLoc_Location, theRefLabel: TDF_Label): boolean

    Sets location to the shape label If label is reference -> changes location attribute If label is free shape -> creates reference with location to it.

    Parameters (3)
    • theShapeLabel
      the shape label to change location
    • theLoc
      location to set
    • theRefLabel
      the reference label with new location Mutated in place; read the updated value from this argument after the call.
    Returns

    TRUE if new location was set

  • Expand(Shape: TDF_Label): boolean

    Convert Shape (compound/compsolid/shell/wire) to assembly.

    Parameters (1)
    • Shape
  • GetNamedProperties(theLabel: TDF_Label, theToCreate: boolean): TDataStd_NamedData

    Method to get NamedData attribute assigned to the given shape label.

    Parameters (2)
    • theLabel
      the shape Label
    • theToCreate
      create and assign attribute if it doesn't exist
    Returns

    Handle to the NamedData attribute or Null if there is none

  • GetNamedProperties(theShape: TopoDS_Shape, theToCreate: boolean): TDataStd_NamedData

    Method to get NamedData attribute assigned to a label of the given shape.

    Parameters (2)
    • theShape
      input shape
    • theToCreate
      create and assign attribute if it doesn't exist
    Returns

    Handle to the NamedData attribute or Null if there is none

XCAFDoc_View

Attribute to store view.

Constructors(1)

Static methods(4)

Instance methods(5)

XCAFDoc_ViewTool

Provides tools to store and retrieve Views in and from TDocStd_Document Each View contains parts XCAFDoc_View attribute with all information about camera and view window. Also each view contain information of displayed shapes and GDTs as sets of shape and GDT labels.

Constructors(1)

Static methods(4)

Instance methods(25)

XCAFDoc_VisMaterial

Attribute storing Material definition for visualization purposes.
Visualization material provides extended information about how object should be displayed on the screen (albedo, metalness, roughness - not just a single color as in case of XCAFDoc_Color). It is expected to correlate with physical material properties (XCAFDoc_Material), but not necessarily (like painted/polished/rusty object).
The document defines the list of visualization materials via global attribute XCAFDoc_VisMaterialTool, while particular material assignment to the shape is done through tree-nodes links. Therefore, XCAFDoc_VisMaterialTool methods should be used for managing XCAFDoc_VisMaterial attributes.
Visualization material definition consists of two options: Common and PBR (for Physically Based Rendering). Common material definition is an obsolete model defined by very first version of OpenGL graphics API and having specific hardware-accelerated implementation in past (like T&L). PBR metallic-roughness model is closer to physical material properties, and intended to be used within physically-based renderer.
For compatibility reasons, this attribute allows defining both material models, so that it is up-to Data Exchange and Application deciding which one to define and use for rendering (depending on viewer capabilities). Automatic conversion from one model to another is possible, but lossy (converted material will not look the same).
Within Data Exchange, different file formats have different capabilities for storing visualization material properties from simple color (STEP, IGES), to common (OBJ, glTF 1.0) and PBR (glTF 2.0). This should be taken into account while defining or converting document into one or another format - material definition might be lost or disturbed.

Constructors(1)

Static methods(2)

Instance methods(28)

XCAFDoc_VisMaterialPBR

Metallic-roughness PBR material definition.

Constructors(1)

Instance methods(1)

Properties(11)

XCAFDoc_VisMaterialTool

Provides tools to store and retrieve attributes (visualization materials) of TopoDS_Shape in and from TDocStd_Document.
This attribute defines the list of visualization materials (XCAFDoc_VisMaterial) within the whole document. Particular material is assigned to the shape through tree-nodes links.
Visualization materials might co-exists with independent color attributes (XCAFDoc_ColorTool), but beware to preserve consistency between them (it is better using one attribute type at once to avoid ambiguity). Unlike color attributes, list of materials should be managed explicitly by application, so that there is no tool eliminating material duplicates or removing unused materials.

Constructors(1)

Static methods(7)

Instance methods(20)

XCAFDoc_Volume

attribute to store volume

Constructors(1)

Static methods(6)

Instance methods(5)