Component
-
class
HPS.Component: HPS.Sprocket The Component class is a smart pointer. It represents an arbitrary component of a structured file.
Subclassed by HPS.CADModel, HPS.Capture, HPS.DWG.Component, HPS.Exchange.Component, HPS.Filter, HPS.Parasolid.Component
Public Types
-
enum
ComponentType Enumerates the format-dependent types a Component can represent.
Values:
-
None
-
GenericMask
-
ExchangeModelFile Represents an A3DAsmModelFile in Exchange. This will be represented by an Exchange.CADModel.
-
ExchangeRIBRepModel Represents an A3DRiBrepModel in Exchange. This will be represented by an Exchange.Component.
-
ExchangeRICurve Represents an A3DRiCurve in Exchange. This will be represented by an Exchange.Component.
-
ExchangeRIDirection Represents an A3DRiDirection in Exchange. This will be represented by an Exchange.Component.
-
ExchangeRIPlane Represents an A3DRiPlane in Exchange. This will be represented by an Exchange.Component.
-
ExchangeRIPointSet Represents an A3DRiPointSet in Exchange. This will be represented by an Exchange.Component.
-
ExchangeRIPolyWire Represents an A3DRiPolyWire in Exchange. This will be represented by an Exchange.Component.
-
ExchangeRISet Represents an A3DRiSet in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoBody Represents an A3DTopoBody in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoConnex Represents an A3DTopoConnex in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoShell Represents an A3DTopoShell in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoFace Represents an A3DTopoFace in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoLoop Represents an A3DTopoLoop in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoCoEdge Represents an A3DTopoCoEdge in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoEdge Represents an A3DTopoEdge in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoVertex Represents an A3DTopoVertex in Exchange. This will be represented by an Exchange.Component.
-
ExchangeTopoWireEdge Represents an A3DTopoWireEdge in Exchange. This will be represented by an Exchange.Component.
-
ExchangePMIText Represents an A3DMarkupText in Exchange. This will be represented by an Exchange.Component.
-
ExchangePMIRichText Represents an A3DMarkupRichText in Exchange. This will be represented by an Exchange.Component.
-
ExchangePMIGDT Represents an A3DMarkupGDT in Exchange. This will be represented by an Exchange.Component.
-
ExchangePMIDatum Represents an A3DMarkupDatum in Exchange. This will be represented by an Exchange.Component.
-
ExchangePMIBalloon Represents an A3DMarkupBalloon in Exchange. This will be represented by an Exchange.Component.
-
ExchangePMIFastener Represents an A3DMarkupFastener in Exchange. This will be represented by an Exchange.Component.
-
ExchangePMILocator Represents an A3DMarkupLocator in Exchange. This will be represented by an Exchange.Component.
-
ParasolidAssembly Represents a PK_ASSEMBLY in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidInstance Represents a PK_INSTANCE in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoBody Represents a PK_BODY in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoRegion Represents a PK_REGION in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoShell Represents a PK_SHELL in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoFace Represents a PK_FACE in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoLoop Represents a PK_LOOP in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoFin Represents a PK_FIN in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoEdge Represents a PK_EDGE in Parasolid. This will be represented by a Parasolid.Component.
-
ParasolidTopoVertex Represents a PK_VERTEX in Parasolid. This will be represented by a Parasolid.Component.
-
DWGModelFile Represents an AcDbDatabase in RealDWG. This will be represented by a DWG.CADModel.
-
DWGLayout Represents an AcDbLayout in RealDWG.
-
DWGBlockTable Represents an AcDbBlockTable in RealDWG.
-
DWGBlockTableRecord Represents an AcDbBlockTableRecord in RealDWG.
-
DWGEntity Represents an AcDbEntity in RealDWG.
-
DWGLayerTable Represents an AcDbLayerTable in RealDWG.
-
DWGLayer Represents an AcDbLayer in RealDWG.
-
UserComponent Represents a user created component.
-
-
enum
DeleteMode Enumerates whether the delete operation will use the mode Standard, Full or StandardAndExchange.
Values:
-
Standard Subcomponents will be deleted if they don’t have multiple owners, otherwise their reference count will be decremented.
-
Full Subcomponents will always be deleted, even if they are shared.
-
StandardAndExchange Subcomponents will deleted if they don’t have multiple owners, otherwise their reference count will be decremented.
-
Public Functions
-
void
AddKey(HPS.Key in_key) Adds a key to be associated with this Component. This will additionally ensure this key can be used to find this Component via CADModel.GetComponentFromKey on the owning CADModel. In general, this will either be a SegmentKey or a GeometryKey (or a subclass thereof), but it may also be an IncludeKey, which is necessary for an instanced Component. If an IncludeKey is associated with this Component, the underlying target of the include will be associated with this Component, though the include will be stored as well to determine things like the associated KeyPath correctly.
Param in_key: The key to associate with this Component.
-
void
AddOwner(HPS.Component in_owner) Adds an owner to this Component. This is intended to facilitate adding additional owners to an instanced Component, and allows specifying the associated IncludeKey for the additional owner. It is possible to add an owner without adding an IncludeKey, and, if desired, add the IncludeKey separately via AddKey.
Param in_owner: The Component to act as an additional owner for this Component.
-
void
AddOwner(HPS.Component in_owner, HPS.IncludeKey in_include) Adds an owner to this Component. This is intended to facilitate adding additional owners to an instanced Component, and allows specifying the associated IncludeKey for the additional owner. It is possible to add an owner without adding an IncludeKey, and, if desired, add the IncludeKey separately via AddKey.
Param in_owner: The Component to act as an additional owner for this Component. Param in_include: The IncludeKey for this Component for this new owner. This defaults to an uninitialized IncludeKey.
-
void
AddReference(HPS.Component in_reference) Adds a Component as a reference to this Component.
Param in_reference: The Component to add as a reference to this Component.
-
bool
AddTransform(HPS.MatrixKit in_transform) Appends a transform to the underlying PRC or Parasolid data associated with this component.
Warning
For Parasolid components, only transformations which are rigid motions can be applied. Calling SetTransform from a Parasolid component with a transform which is not a rigid motion, such as a shear, will cause the function to fail.
Warning
For Exchange components, only components of type ExchangeProductOccurrence, or components that have the type ExchangeRepresentationItemMask can have transforms applied to them. Additionally, SetTransform does not work on Exchange models which have a Drawing structure to them. This would include CATDrawing files and 2D DWG files loaded through Exchange. Any attempt to use this function on those models will produce a warning.
Param in_transform: The transform to apply to this component. Return: true if transform was applied correctly, false otherwise.
-
void
Assign(HPS.Component in_that) Share the underlying smart-pointer of the Component source.
Param in_that: The Component source of the assignment. Return: A reference to this Component.
-
Component() The default constructor creates an uninitialized Component object. The Type() function will return Type.None.
-
Component(HPS.Component in_that) The copy constructor creates a Component object that shares the underlying smart-pointer of the source Component.
Param in_that: The source Component to copy.
-
HPS.Component
CopyTo(HPS.Component in_new_owner) Creates a deep copy of this component under another component. Please note how entity copying is handled for each type of entity:
-
Copying a RepresentationItem to a ProductOccurrence: The copy of the representation item will be inserted under the Part Definition under the target Product Occurrence
-
Copying a RepresentationItem to a PartDefinition: supported
-
Copying a RepresentationItem to a RepresentationItemSet: supported
-
Copying a PartDefinition to a ProductOccurrence: The function will create a new ProductOccurrence object, insert the copy into the children of this product occurrence and then insert this product occurrence under the target product occurrence. This is to avoid rewrite on the original PartDefinition of the target ProductOccurrence (if one exists)
-
Copying a ProductOccurrence to a ProductOccurrence: The newly created copy will be inserted under the target Product Occurrence. However we need to note that if the target ProductOccurrence already has a prototype, the prototype will not be visualized by HPS but only the newly created copy will be. In the case of ExternalData, both will be rendered by HPS.
-
Copying a ProductOccurrence to a Exchange ModelFile: The A3DAsmModelFile under the target component will be deleted, and a new one will be created. This new model is identical with the old model except that the copy of the source ProductOccurrence will be inserted under this new model. In this case, since we create a new CADModel, the reload process may take more time since we need to re-render the whole new model.
Note
This will currently only work for derived Exchange components.
Param in_new_owner: The component which will be the owner of the newly created component. Return: The newly created component. -
-
void
Delete() The behavior of the Delete function varies according to the type of object it’s being called on. HPS:
Removes this component from memory and invalidates any component objects referring to it. All owners of this component will no longer have it as a subcomponent, all components that reference this component will no longer have it as a reference, and the keys underlying this component will be deleted. Any subcomponents of this component that have multiple owners will have this component removed as an owner. Any subcomponents of this component that have only this component as an owner will be recursively deleted via this function. Invoking this function on an instance of an object derived from Component will perform some additional cleanup relevant to the derived type. For example, performing a delete on a CADModel will delete the default capture associated with the CADModel, delete its associated Model, and delete the mapping information between keys and components, in addition to performing all the operations for a generic component. See below for the behavior of derived types in the integrations that create component trees. Lastly, note that it is not necessary to construct or cast a component to its specific type to ensure the appropriate delete logic is used. The appropriate logic will always be invoked even if using a base Component object handle to a derived type. Exchange:
Invoking delete on these types will not modify the associated Exchange data. It will remove the associated A3DEntity pointer and component from the mapping data accessible via Exchange.CADModel.GetComponentFromEntity, and then it will invoke the base Component delete logic. When invoking Delete on the last root HPS.Exchange.Component, the whole subtree is deleted, but a new root HPS.Exchange.Component will be associated to the CADModel in order to be consistent with HOOPS Exchange behavior. In this case, it has an empty product occurrence data structure with no child at the HPS.Exchange.Component level.
Invoking delete on an Exchange.CADModel will delete the underlying A3DAsmModelFile via A3DAsmModelFileDelete if Exchange.CADModel.GetEntityOwnership is true. It will additionally clean up the associated A3DRWParamsPrcReadHelper if one was created during import (see Exchange.ImportOptionsKit.SetPRCReadHelper). The mapping data between A3DEntity pointers and components will also be deleted, and lastly it will invoke the delete logic for the base CADModel. Parasolid:
Invoking delete on this type will invoke PK_ENTITY_delete on the underlying Parasolid entity if the entity has class PK_CLASS_assembly or PK_CLASS_body. It will remove this Parasolid entity and component from the mapping data accessible via Parasolid.CADModel.GetComponentFromEntity, and then it will invoke the base Component delete logic.
The mapping data between Parasolid entities and components will be deleted, and then it will invoke the base CADModel delete logic. DWG:
Invoking delete on these types will not modify the associated DWG database. It will simply invoke the base Component delete logic.
Invoking delete on a DWG.CADModel will release the underlying AcDbDatabase via acdbReleaseHostDwg, and then it will invoke the base CADModel delete logic.
-
void
Delete(HPS.Component.DeleteMode mode) The behavior of the Delete function varies according to the type of object it’s being called on. HPS:
Removes this component from memory and invalidates any component objects referring to it. All owners of this component will no longer have it as a subcomponent, all components that reference this component will no longer have it as a reference, and the keys underlying this component will be deleted. Any subcomponents of this component that have multiple owners will have this component removed as an owner. Any subcomponents of this component that have only this component as an owner will be recursively deleted via this function. Invoking this function on an instance of an object derived from Component will perform some additional cleanup relevant to the derived type. For example, performing a delete on a CADModel will delete the default capture associated with the CADModel, delete its associated Model, and delete the mapping information between keys and components, in addition to performing all the operations for a generic component. See below for the behavior of derived types in the integrations that create component trees. Lastly, note that it is not necessary to construct or cast a component to its specific type to ensure the appropriate delete logic is used. The appropriate logic will always be invoked even if using a base Component object handle to a derived type. Exchange:
Invoking delete on these types will not modify the associated Exchange data. It will remove the associated A3DEntity pointer and component from the mapping data accessible via Exchange.CADModel.GetComponentFromEntity, and then it will invoke the base Component delete logic. When invoking Delete on the last root HPS.Exchange.Component, the whole subtree is deleted, but a new root HPS.Exchange.Component will be associated to the CADModel in order to be consistent with HOOPS Exchange behavior. In this case, it has an empty product occurrence data structure with no child at the HPS.Exchange.Component level.
Invoking delete on an Exchange.CADModel will delete the underlying A3DAsmModelFile via A3DAsmModelFileDelete if Exchange.CADModel.GetEntityOwnership is true. It will additionally clean up the associated A3DRWParamsPrcReadHelper if one was created during import (see Exchange.ImportOptionsKit.SetPRCReadHelper). The mapping data between A3DEntity pointers and components will also be deleted, and lastly it will invoke the delete logic for the base CADModel. Parasolid:
Invoking delete on this type will invoke PK_ENTITY_delete on the underlying Parasolid entity if the entity has class PK_CLASS_assembly or PK_CLASS_body. It will remove this Parasolid entity and component from the mapping data accessible via Parasolid.CADModel.GetComponentFromEntity, and then it will invoke the base Component delete logic.
The mapping data between Parasolid entities and components will be deleted, and then it will invoke the base CADModel delete logic. DWG:
Invoking delete on these types will not modify the associated DWG database. It will simply invoke the base Component delete logic.
Invoking delete on a DWG.CADModel will release the underlying AcDbDatabase via acdbReleaseHostDwg, and then it will invoke the base CADModel delete logic.
Param mode: The DeleteMode that we will use.
-
override void
Dispose()
-
bool
Equals(HPS.Component in_that) Check if the source Component points to the same underlying impl as this Component.
Param in_that: The source Component to compare to this Component. Return: true if the objects reference the same impl, false otherwise.
-
override bool
Equals(Object obj)
-
void
Flush() Removes all references to the underlying subcomponents, but leaves this Component around. If a subcomponent of the component being flushed has multiple owners, the flush will simply remove the reference to that subcomponent. If a subcomponent of the component being flushed has only one owner (the component being flushed), that subcomponent will be deleted. Any handles to the deleted components will become invalid.
-
HPS.Metadata[]
GetAllMetadata() Get all Metadata objects associated with this Component.
Return: All Metadata objects associated with this Component.
-
HPS.Component[]
GetAllSubcomponents(HPS.Component.ComponentType in_type) Gets all components under this Component that have the specified ComponentType mask. This will examine this subcomponents of this Component, the subcomponents of the subcomponents, and so on.
Param in_type: Mask of the components to look for. Return: The Component objects under this Component (if any) which have the specified mask.
-
HPS.Component.ComponentType
GetComponentType() Gets the specific format-dependent type this Component represents.
Return: The specific format-dependent type this Component represents.
-
override int
GetHashCode()
-
HPS.Key[]
GetKeys() Get the underlying keys (if any) which represent this Component. Generally this will either be a segment or geometry key.
Return: The underlying keys (if any) which represent this Component.
-
HPS.Metadata
GetMetadata(string in_name) Get the single Metadata object with the given name associated with this Component (if present).
Param in_name: UTF8-encoded name of the Metadata object to find on this Component. Return: The single Metadata object with the given name associated with this Component (if present).
-
string
GetName() Gets the name for this Component. This is a convenience function equivalent to getting the “Name” metadata for this Component. If a Component does not have a name, an empty UTF8 object will be returned.
Return: The name (if any) for this Component.
-
HPS.Component[]
GetOwners() Get the Component objects (if any) which “own” this Component. Generally this will be a single element or no elements for a root component. It is possible for there to be multiple owners of a Component if it is instanced (i.e., it may have both a prototype and a containing Component).
See also
Return: The Component objects (if any) which “own” this Component.
-
HPS.Component[]
GetReferences() Get the Component objects (if any) which are referenced by this Component. These are Component objects which are associated with this Component, but not “owned” by this Component, and would not be deleted if this Component is deleted (though the reference relationship will be removed).
Return: The Component objects (if any) which are referenced by this Component.
-
HPS.Component[]
GetReferrers() Gets the Component objects which refer to this Component (if any). These relationships are defined in the original CAD file and can be arbitrarily assigned between Components.
For the Exchange implementation of the Component hierarchy, Referrers will typically indicate which PMI elements refer to the Component being inspected.
See also
Return: The Component objects which refer to this Component.
-
HPS.Component[]
GetSubcomponents() Get the subcomponent objects (if any) owned or referenced by this Component. These Component objects would be deleted if this Component is deleted.
Return: The subcomponent objects (if any) owned or referenced by this Component.
-
bool
HasComponentType(HPS.Component.ComponentType in_mask) This function indicates whether this Component has the given ComponentType mask.
Param in_mask: The ComponentType mask to check against this Component. Return: true if this Component has the given ComponentType mask, false otherwise.
-
override HPS.Type
ObjectType() This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).
Return: The declared type of the object in question, which may differ from the true, underlying type.
-
bool
SetName(string in_new_name) Sets the name for this component.
Note
This will currently only work for derived Exchange components.
Return: true if the name was set successfully, false otherwise.
-
bool
SetTransform(HPS.MatrixKit in_transform) Applies a transform to the underlying PRC or Parasolid data associated with this component, replacing any transforms currently set on it.
Warning
For Parasolid components, only transformations which are rigid motions can be applied. Calling SetTransform from a Parasolid component with a transform which is not a rigid motion, such as a shear, will cause the function to fail.
Warning
For Exchange components, only components of type ExchangeProductOccurrence, or components that have the type ExchangeRepresentationItemMask can have transforms applied to them. Additionally, SetTransform does not work on Exchange models which have a Drawing structure to them. This would include CATDrawing files and 2D DWG files loaded through Exchange. Any attempt to use this function on those models will produce a warning.
Param in_transform: The transform to apply to this component. Return: true if transform was applied correctly, false otherwise.
Public Static Functions
-
HPS.KeyPath[]
GetKeyPath(HPS.Component in_component) Gets the list of KeyPath objects that correspond to the given Component. There will be at least one KeyPath, and possibly more than one if a particular Component is instanced, e.g., if the Component corresponds to the wheel of a car, a KeyPath would be returned for each wheel (driver side front and rear, and passenger side front and rear). Each KeyPath in the list will also include the portion of the path above the Model (associated with the root CADModel) for each View, Layout layer, and Canvas permutation which includes the Model. This function will not take into account any includes or paths which do not come from the Component hierarchy or the View, Layout, and Canvas permutations which include the Model.
See also
Param in_component: The Component for which to compute the corresponding KeyPath objects. Return: A list of all KeyPath objects which refer to the given Component.
-
HPS.KeyPath[]
GetKeyPath(HPS.Component[] in_components) Gets the list of KeyPath objects that correspond to the given ComponentPath. This function can be used to get the KeyPath for a particular instance of an instanced Component. For a non-instanced Component, since the ComponentPath can be determined unambiguously, the KeyPath returned will be the same as if only the leaf non-instanced Component was given to this function. There will be at least one KeyPath returned, and possibly more than one for each View, Layout layer, and Canvas which include the Model associated with the root CADModel. This function will not take into account any includes or paths which do not come from the Component hierarchy or the View, Layout, and Canvas permutations which include the Model.
See also
Param in_components: The ComponentPath for which to compute the corresponding KeyPath objects. The path should be defined such that the first element is the leaf Component, and the last element is the root CADModel. Each element in the path should be an owner of the preceding Component, otherwise an exception will be thrown. Return: A list of all KeyPath objects which refer to the given Component.
-
bool
operator!=(HPS.Component a, HPS.Component b)
-
bool
operator==(HPS.Component a, HPS.Component b)
-
enum