// read metadata
if (GetMetaMode())
+ {
ReadMetadata(reader.WS(), doc, aLocalFactors);
+ }
+
+ // read product metadata
+ if (GetProductMetaMode())
+ {
+ ReadProductMetadata(reader.WS(), doc);
+ }
// Expand resulting CAF structure for sub-shapes (optionally with their
// names) if requested
//=================================================================================================
+void STEPCAFControl_Reader::SetProductMetaMode(const Standard_Boolean theProductMetaMode)
+{
+ myProductMetaMode = theProductMetaMode;
+}
+
+//=================================================================================================
+
+Standard_Boolean STEPCAFControl_Reader::GetProductMetaMode() const
+{
+ return myProductMetaMode;
+}
+
+//=================================================================================================
+
void STEPCAFControl_Reader::SetSHUOMode(const Standard_Boolean mode)
{
mySHUOMode = mode;
//=================================================================================================
-Standard_Boolean STEPCAFControl_Reader::ReadMetadata(const Handle(XSControl_WorkSession)& theWS,
- const Handle(TDocStd_Document)& theDoc,
- const StepData_Factors& theLocalFactors) const
+TDF_Label STEPCAFControl_Reader::getShapeLabelFromProductDefinition(
+ const Handle(Transfer_TransientProcess)& theTransferProcess,
+ const Handle(StepBasic_ProductDefinition)& theProductDefinition) const
{
- const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
- const Handle(XSControl_TransferReader)& aTR = theWS->TransferReader();
- const Handle(Transfer_TransientProcess)& aTP = aTR->TransientProcess();
- Handle(XCAFDoc_ShapeTool) aSTool = XCAFDoc_DocumentTool::ShapeTool(theDoc->Main());
- if (aSTool.IsNull())
+ TDF_Label aShapeLabel;
+
+ Handle(Transfer_Binder) aBinder = theTransferProcess->Find(theProductDefinition);
+ if (aBinder.IsNull())
{
- return Standard_False;
+ return aShapeLabel;
}
- Standard_Integer aNb = aModel->NbEntities();
- STEPConstruct_Tool aTool(theWS);
+ const TopoDS_Shape aShape = TransferBRep::ShapeResult(theTransferProcess, aBinder);
+ if (aShape.IsNull())
+ {
+ return aShapeLabel;
+ }
- for (Standard_Integer anEntityInd = 1; anEntityInd <= aNb; ++anEntityInd)
+ myMap.Find(aShape, aShapeLabel);
+ return aShapeLabel;
+}
+
+//=================================================================================================
+
+Handle(StepBasic_Product) STEPCAFControl_Reader::getProductFromProductDefinition(
+ const Handle(StepBasic_ProductDefinition)& theProductDefinition) const
+{
+ Handle(StepBasic_ProductDefinitionFormation) aFormation = theProductDefinition->Formation();
+ if (aFormation.IsNull())
+ {
+ return nullptr;
+ }
+
+ return aFormation->OfProduct();
+}
+
+//=================================================================================================
+
+std::vector<Handle(StepRepr_PropertyDefinition)> STEPCAFControl_Reader::collectPropertyDefinitions(
+ const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(Standard_Transient)& theGeneralProperty) const
+{
+ std::vector<Handle(StepRepr_PropertyDefinition)> aResult;
+
+ Handle(StepBasic_GeneralProperty) aGeneralProp =
+ Handle(StepBasic_GeneralProperty)::DownCast(theGeneralProperty);
+ if (aGeneralProp.IsNull())
{
- Handle(Standard_Transient) anEntity = aModel->Value(anEntityInd);
- Handle(StepBasic_GeneralProperty) aGeneralProp =
- Handle(StepBasic_GeneralProperty)::DownCast(anEntity);
- if (aGeneralProp.IsNull())
+ return aResult;
+ }
+
+ Interface_EntityIterator aSharingListOfGP = theWorkSession->Graph().Sharings(aGeneralProp);
+ for (aSharingListOfGP.Start(); aSharingListOfGP.More(); aSharingListOfGP.Next())
+ {
+ Handle(StepBasic_GeneralPropertyAssociation) aPropAssociation =
+ Handle(StepBasic_GeneralPropertyAssociation)::DownCast(aSharingListOfGP.Value());
+ if (aPropAssociation.IsNull())
+ {
continue;
+ }
+
+ aResult.emplace_back(aPropAssociation->PropertyDefinition());
+ }
- Handle(StepBasic_GeneralPropertyAssociation) aPropAssociation;
- NCollection_List<Handle(StepRepr_PropertyDefinition)> aPropDefinitionList;
- Interface_EntityIterator aSharingListOfGP = theWS->Graph().Sharings(aGeneralProp);
- for (aSharingListOfGP.Start(); aSharingListOfGP.More(); aSharingListOfGP.Next())
+ return aResult;
+}
+
+//=================================================================================================
+
+std::vector<TDF_Label> STEPCAFControl_Reader::collectShapeLabels(
+ const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(Transfer_TransientProcess)& theTransferProcess,
+ const Handle(StepRepr_PropertyDefinition)& theSource) const
+{
+ std::vector<TDF_Label> aResult;
+
+ NCollection_List<Handle(Transfer_Binder)> aBinders;
+ collectBinders(theWorkSession, theTransferProcess, theSource, aBinders);
+ if (aBinders.IsEmpty())
+ {
+ return aResult;
+ }
+
+ NCollection_List<Handle(Transfer_Binder)>::Iterator aBindIt(aBinders);
+ for (; aBindIt.More(); aBindIt.Next())
+ {
+ const TopoDS_Shape aShape = TransferBRep::ShapeResult(theTransferProcess, aBindIt.Value());
+ if (aShape.IsNull())
{
- aPropAssociation =
- Handle(StepBasic_GeneralPropertyAssociation)::DownCast(aSharingListOfGP.Value());
- if (aPropAssociation.IsNull())
- continue;
+ continue;
+ }
- aPropDefinitionList.Append(aPropAssociation->PropertyDefinition());
+ TDF_Label aShapeResultLabel;
+ if (myMap.Find(aShape, aShapeResultLabel))
+ {
+ aResult.emplace_back(aShapeResultLabel);
}
+ }
+
+ return aResult;
+}
- if (aPropDefinitionList.IsEmpty())
+//=================================================================================================
+
+std::vector<Handle(StepRepr_PropertyDefinition)> STEPCAFControl_Reader::
+ collectRelatedPropertyDefinitions(const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(StepRepr_PropertyDefinition)& theProperty) const
+{
+ std::vector<Handle(StepRepr_PropertyDefinition)> aGroupedProperties;
+ aGroupedProperties.emplace_back(theProperty);
+
+ Interface_EntityIterator aSharingsListOfPD = theWorkSession->Graph().Sharings(theProperty);
+ for (aSharingsListOfPD.Start(); aSharingsListOfPD.More(); aSharingsListOfPD.Next())
+ {
+ Handle(StepRepr_PropertyDefinitionRelationship) aRel =
+ Handle(StepRepr_PropertyDefinitionRelationship)::DownCast(aSharingsListOfPD.Value());
+ if (aRel.IsNull())
+ {
continue;
+ }
- NCollection_List<Handle(StepRepr_PropertyDefinition)>::Iterator aPropDefIter(
- aPropDefinitionList);
- for (; aPropDefIter.More(); aPropDefIter.Next())
+ Handle(StepRepr_PropertyDefinition) aGroupedProp = aRel->RelatedPropertyDefinition();
+ if (!aGroupedProp.IsNull())
{
- Handle(StepRepr_PropertyDefinition) aPropDefinition = aPropDefIter.Value();
+ aGroupedProperties.emplace_back(aGroupedProp);
+ }
+ }
- // check group of PropertyDefinition
- NCollection_List<Handle(StepRepr_PropertyDefinition)> aGroupedProperties;
- Interface_EntityIterator aSharingsListOfPD = theWS->Graph().Sharings(aPropDefinition);
- for (aSharingsListOfPD.Start(); aSharingsListOfPD.More(); aSharingsListOfPD.Next())
- {
- Handle(StepRepr_PropertyDefinitionRelationship) aRel =
- Handle(StepRepr_PropertyDefinitionRelationship)::DownCast(aSharingsListOfPD.Value());
- if (aRel.IsNull())
- {
- continue;
- }
+ return aGroupedProperties;
+}
- Handle(StepRepr_PropertyDefinition) aGroupedProp = aRel->RelatedPropertyDefinition();
- if (!aGroupedProp.IsNull())
- {
- aGroupedProperties.Append(aGroupedProp);
- }
+//=================================================================================================
+
+Handle(TDataStd_NamedData) STEPCAFControl_Reader::getNamedData(const TDF_Label& theLabel) const
+{
+ Handle(TDataStd_NamedData) anAttribute;
+ if (!theLabel.FindAttribute(TDataStd_NamedData::GetID(), anAttribute))
+ {
+ anAttribute = new TDataStd_NamedData;
+ theLabel.AddAttribute(anAttribute);
+ }
+ return anAttribute;
+}
+
+//=================================================================================================
+
+void STEPCAFControl_Reader::collectBinders(
+ const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(Transfer_TransientProcess)& theTransientProcess,
+ const Handle(StepRepr_PropertyDefinition)& theSource,
+ NCollection_List<Handle(Transfer_Binder)>& theBinders) const
+{
+ Interface_EntityIterator aSharedListOfPD = theWorkSession->Graph().Shareds(theSource);
+ for (aSharedListOfPD.Start(); aSharedListOfPD.More(); aSharedListOfPD.Next())
+ {
+ // Acquire binder from StepBasic_ProductDefinition.
+ Handle(StepBasic_ProductDefinition) aProductDefinition =
+ Handle(StepBasic_ProductDefinition)::DownCast(aSharedListOfPD.Value());
+ if (!aProductDefinition.IsNull())
+ {
+ const Handle(Transfer_Binder) aBinder = theTransientProcess->Find(aProductDefinition);
+ if (!aBinder.IsNull())
+ {
+ theBinders.Append(aBinder);
}
+ continue;
+ }
- NCollection_List<Handle(Transfer_Binder)> aBinders;
- Interface_EntityIterator aSharedListOfPD = theWS->Graph().Shareds(aPropDefinition);
- for (aSharedListOfPD.Start(); aSharedListOfPD.More(); aSharedListOfPD.Next())
+ // Acquire binder from StepRepr_ProductDefinitionShape.
+ Handle(StepRepr_ProductDefinitionShape) aProductDefinitionShape =
+ Handle(StepRepr_ProductDefinitionShape)::DownCast(aSharedListOfPD.Value());
+ if (!aProductDefinitionShape.IsNull())
+ {
+ Handle(StepBasic_ProductDefinition) aProductDef =
+ aProductDefinitionShape->Definition().ProductDefinition();
+ const Handle(Transfer_Binder) aBinder = theTransientProcess->Find(aProductDef);
+ if (!aBinder.IsNull())
{
- Handle(Transfer_Binder) aBinder;
- Handle(StepBasic_ProductDefinition) aProductDefinition =
- Handle(StepBasic_ProductDefinition)::DownCast(aSharedListOfPD.Value());
- if (!aProductDefinition.IsNull())
- {
- aBinder = aTP->Find(aProductDefinition);
- if (!aBinder.IsNull())
- {
- aBinders.Append(aBinder);
- }
- continue;
- }
+ theBinders.Append(aBinder);
+ }
+ continue;
+ }
- Handle(StepRepr_ProductDefinitionShape) aProductDefinitionShape =
- Handle(StepRepr_ProductDefinitionShape)::DownCast(aSharedListOfPD.Value());
- if (!aProductDefinitionShape.IsNull())
- {
- Handle(StepBasic_ProductDefinition) aProductDef =
- aProductDefinitionShape->Definition().ProductDefinition();
- aBinder = aTP->Find(aProductDef);
- if (!aBinder.IsNull())
- {
- aBinders.Append(aBinder);
- }
- continue;
- }
+ // Acquire binder from StepRepr_NextAssemblyUsageOccurrence.
+ Handle(StepRepr_NextAssemblyUsageOccurrence) aNextAssembUsOcc =
+ Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(aSharedListOfPD.Value());
+ if (!aNextAssembUsOcc.IsNull())
+ {
+ const Handle(Transfer_Binder) aBinder = theTransientProcess->Find(aNextAssembUsOcc);
+ if (!aBinder.IsNull())
+ {
+ theBinders.Append(aBinder);
+ }
+ continue;
+ }
- Handle(StepRepr_NextAssemblyUsageOccurrence) aNextAssembUsOcc =
- Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(aSharedListOfPD.Value());
- if (!aNextAssembUsOcc.IsNull())
+ Handle(StepRepr_ShapeAspect) aShapeAspect =
+ Handle(StepRepr_ShapeAspect)::DownCast(aSharedListOfPD.Value());
+ if (!aShapeAspect.IsNull())
+ {
+ Interface_EntityIterator aSharedListOfSA = theWorkSession->Graph().Sharings(aShapeAspect);
+ for (aSharedListOfSA.Start(); aSharedListOfSA.More(); aSharedListOfSA.Next())
+ {
+ Handle(StepAP242_DraughtingModelItemAssociation) aDMIA =
+ Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(aSharedListOfSA.Value());
+ if (!aDMIA.IsNull())
{
- aBinder = aTP->Find(aNextAssembUsOcc);
- if (!aBinder.IsNull())
- {
- aBinders.Append(aBinder);
- }
- continue;
+ break;
}
- Handle(StepRepr_ShapeAspect) aShapeAspect =
- Handle(StepRepr_ShapeAspect)::DownCast(aSharedListOfPD.Value());
- if (!aShapeAspect.IsNull())
+ Handle(StepAP242_ItemIdentifiedRepresentationUsage) anItemIdentUsage =
+ Handle(StepAP242_ItemIdentifiedRepresentationUsage)::DownCast(aSharedListOfSA.Value());
+ if (!anItemIdentUsage.IsNull())
{
- TDF_Label aLabel;
- if (!aBinder.IsNull())
+ for (Standard_Integer anIndex = 1; anIndex <= anItemIdentUsage->NbIdentifiedItem();
+ ++anIndex)
{
- TopoDS_Shape aShape = TransferBRep::ShapeResult(aTP, aBinder);
- if (aShape.IsNull())
+ Handle(StepRepr_RepresentationItem) aReprItem =
+ anItemIdentUsage->IdentifiedItemValue(anIndex);
+ if (aReprItem.IsNull())
+ {
continue;
+ }
- if (myMap.IsBound(aShape))
+ const Handle(Transfer_Binder) aBinder = theTransientProcess->Find(aReprItem);
+ if (!aBinder.IsNull())
{
- aLabel = myMap.Find(aShape);
+ theBinders.Append(aBinder);
}
}
- Interface_EntityIterator aSharedListOfSA = theWS->Graph().Sharings(aShapeAspect);
- for (aSharedListOfSA.Start(); aSharedListOfSA.More(); aSharedListOfSA.Next())
- {
- Handle(StepAP242_DraughtingModelItemAssociation) aDMIA =
- Handle(StepAP242_DraughtingModelItemAssociation)::DownCast(aSharedListOfSA.Value());
- if (!aDMIA.IsNull())
- break;
-
- Handle(StepAP242_ItemIdentifiedRepresentationUsage) anItemIdentUsage =
- Handle(StepAP242_ItemIdentifiedRepresentationUsage)::DownCast(
- aSharedListOfSA.Value());
- if (!anItemIdentUsage.IsNull())
- {
- for (Standard_Integer anIndex = 1; anIndex <= anItemIdentUsage->NbIdentifiedItem();
- ++anIndex)
- {
- Handle(StepRepr_RepresentationItem) aReprItem =
- anItemIdentUsage->IdentifiedItemValue(anIndex);
- if (aReprItem.IsNull())
- continue;
- aBinder = aTP->Find(aReprItem);
- if (!aBinder.IsNull())
- {
- aBinders.Append(aBinder);
- }
- }
- continue;
- }
+ continue;
+ }
- Handle(StepRepr_PropertyDefinition) aPropDef =
- Handle(StepRepr_PropertyDefinition)::DownCast(aSharedListOfSA.Value());
- if (!aPropDef.IsNull() && aPropDef != aPropDefinition)
+ Handle(StepRepr_PropertyDefinition) aPropDef =
+ Handle(StepRepr_PropertyDefinition)::DownCast(aSharedListOfSA.Value());
+ if (!aPropDef.IsNull() && aPropDef != theSource)
+ {
+ Interface_EntityIterator aSharingListOfPD = theWorkSession->Graph().Sharings(aPropDef);
+ for (aSharingListOfPD.Start(); aSharingListOfPD.More(); aSharingListOfPD.Next())
+ {
+ Handle(StepShape_ShapeDefinitionRepresentation) aShDef =
+ Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSharingListOfPD.Value());
+ if (aShDef.IsNull())
{
- Interface_EntityIterator aSharingListOfPD = theWS->Graph().Sharings(aPropDef);
- for (aSharingListOfPD.Start(); aSharingListOfPD.More(); aSharingListOfPD.Next())
- {
- Handle(StepShape_ShapeDefinitionRepresentation) aShDef =
- Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(
- aSharingListOfPD.Value());
- if (aShDef.IsNull())
- continue;
-
- findReprItems(theWS, aShDef, aBinders);
- }
continue;
}
- Handle(StepShape_ShapeDefinitionRepresentation) aShapeDefRepr =
- Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSharedListOfSA.Value());
- if (!aShapeDefRepr.IsNull())
- {
- findReprItems(theWS, aShapeDefRepr, aBinders);
- }
+ findReprItems(theWorkSession, aShDef, theBinders);
}
- }
- }
-
- if (aBinders.IsEmpty())
- continue;
-
- TDF_LabelSequence aLabelSeq;
- NCollection_List<Handle(Transfer_Binder)>::Iterator aBindIt(aBinders);
- for (; aBindIt.More(); aBindIt.Next())
- {
- TopoDS_Shape aShape = TransferBRep::ShapeResult(aTP, aBindIt.Value());
- if (aShape.IsNull())
continue;
-
- TDF_Label aShapeLabel;
- if (myMap.IsBound(aShape))
- {
- aShapeLabel = myMap.Find(aShape);
}
- if (!aShapeLabel.IsNull())
+
+ Handle(StepShape_ShapeDefinitionRepresentation) aShapeDefRepr =
+ Handle(StepShape_ShapeDefinitionRepresentation)::DownCast(aSharedListOfSA.Value());
+ if (!aShapeDefRepr.IsNull())
{
- aLabelSeq.Append(aShapeLabel);
+ findReprItems(theWorkSession, aShapeDefRepr, theBinders);
}
}
+ }
+ }
+}
+
+//=================================================================================================
+
+Standard_Boolean STEPCAFControl_Reader::ReadMetadata(const Handle(XSControl_WorkSession)& theWS,
+ const Handle(TDocStd_Document)& theDoc,
+ const StepData_Factors& theLocalFactors) const
+{
+ if (XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()).IsNull())
+ {
+ return Standard_False;
+ }
- // create metadata
- for (TDF_LabelSequence::Iterator aLabelIt(aLabelSeq); aLabelIt.More(); aLabelIt.Next())
+ const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
+ const Handle(Transfer_TransientProcess)& aTransientProcess =
+ theWS->TransferReader()->TransientProcess();
+
+ for (Standard_Integer anEntityInd = 1; anEntityInd <= aModel->NbEntities(); ++anEntityInd)
+ {
+ for (const auto& aPropertyDefinition :
+ collectPropertyDefinitions(theWS, aModel->Value(anEntityInd)))
+ {
+ // Collect all the related PropertyDefinitions.
+ const std::vector<Handle(StepRepr_PropertyDefinition)> aGroupedProperties =
+ collectRelatedPropertyDefinitions(theWS, aPropertyDefinition);
+
+ // Collect all the shapes labels.
+ const std::vector<TDF_Label> aLabels =
+ collectShapeLabels(theWS, aTransientProcess, aPropertyDefinition);
+
+ // Fill all atributes for each shape label.
+ for (const auto& aLabel : aLabels)
{
- TDF_Label aLabel = aLabelIt.Value();
- Handle(TDataStd_NamedData) anAttr;
- if (!aLabel.FindAttribute(TDataStd_NamedData::GetID(), anAttr))
- {
- anAttr = new TDataStd_NamedData;
- aLabel.AddAttribute(anAttr);
- }
+ Handle(TDataStd_NamedData) anAttribute = getNamedData(aLabel);
- fillAttributes(theWS, aPropDefinition, theLocalFactors, anAttr);
- if (!aGroupedProperties.IsEmpty())
+ for (const auto& aPropDefinition : aGroupedProperties)
{
- NCollection_List<Handle(StepRepr_PropertyDefinition)>::Iterator aPropIt(
- aGroupedProperties);
- for (; aPropIt.More(); aPropIt.Next())
- {
- fillAttributes(theWS, aPropIt.Value(), theLocalFactors, anAttr);
- }
+ fillAttributes(theWS, aPropDefinition, theLocalFactors, anAttribute);
}
}
}
//=================================================================================================
+Standard_Boolean STEPCAFControl_Reader::ReadProductMetadata(
+ const Handle(XSControl_WorkSession)& theWS,
+ const Handle(TDocStd_Document)& theDoc) const
+{
+ if (XCAFDoc_DocumentTool::ShapeTool(theDoc->Main()).IsNull())
+ {
+ return Standard_False;
+ }
+
+ const Handle(Interface_InterfaceModel)& aModel = theWS->Model();
+ const Handle(Transfer_TransientProcess)& aTransientProcess =
+ theWS->TransferReader()->TransientProcess();
+
+ for (Standard_Integer anEntityInd = 1; anEntityInd <= aModel->NbEntities(); ++anEntityInd)
+ {
+ // Processing only StepBasic_ProductDefinition entities.
+ const Handle(StepBasic_ProductDefinition) aProdDefinition =
+ Handle(StepBasic_ProductDefinition)::DownCast(aModel->Value(anEntityInd));
+ if (aProdDefinition.IsNull())
+ {
+ continue;
+ }
+
+ // Prepare required data for processing: ShapeLabel and Product entity.
+ const TDF_Label aShapeLabel =
+ getShapeLabelFromProductDefinition(aTransientProcess, aProdDefinition);
+ if (aShapeLabel.IsNull())
+ {
+ continue;
+ }
+ const Handle(StepBasic_Product) aProduct = getProductFromProductDefinition(aProdDefinition);
+ if (aProduct.IsNull())
+ {
+ continue;
+ }
+
+ // Find or create NamedData attribute for ShapeLabel.
+ Handle(TDataStd_NamedData) anAttribute = getNamedData(aShapeLabel);
+ // Fill NamedData attribute with product metadata.
+ if (aProduct->Id() && !aProduct->Id()->String().IsEmpty())
+ {
+ anAttribute->SetString("ProductID", aProduct->Id()->String());
+ }
+ if (aProduct->Name() && !aProduct->Name()->String().IsEmpty())
+ {
+ anAttribute->SetString("ProductName", aProduct->Name()->String());
+ }
+ if (aProduct->Description() && !aProduct->Description()->String().IsEmpty())
+ {
+ anAttribute->SetString("Description", aProduct->Description()->String());
+ }
+ if (aProdDefinition->Description() && !aProdDefinition->Description()->String().IsEmpty())
+ {
+ anAttribute->SetString("ProductDefinition", aProdDefinition->Description()->String());
+ }
+ }
+
+ return true;
+}
+
+//=================================================================================================
+
Standard_Boolean STEPCAFControl_Reader::findReprItems(
const Handle(XSControl_WorkSession)& theWS,
const Handle(StepShape_ShapeDefinitionRepresentation)& theShDefRepr,
class StepRepr_RepresentationItem;
class Transfer_TransientProcess;
class StepBasic_NamedUnit;
+class StepBasic_Product;
class StepShape_ConnectedFaceSet;
class StepShape_ShapeDefinitionRepresentation;
class StepRepr_NextAssemblyUsageOccurrence;
Standard_EXPORT Standard_Boolean GetMetaMode() const;
+ //! MetaMode for indicate whether to read Product Metadata or not.
+ Standard_EXPORT void SetProductMetaMode(const Standard_Boolean theProductMetaMode);
+
+ Standard_EXPORT Standard_Boolean GetProductMetaMode() const;
+
//! Set SHUO mode for indicate write SHUO or not.
Standard_EXPORT void SetSHUOMode(const Standard_Boolean shuomode);
const Handle(TDocStd_Document)& theDoc,
const StepData_Factors& theLocalFactors = StepData_Factors()) const;
+ Standard_EXPORT Standard_Boolean
+ ReadProductMetadata(const Handle(XSControl_WorkSession)& theWS,
+ const Handle(TDocStd_Document)& theDoc) const;
+
//! Reads layers of parts defined in the STEP model and
//! set reference between shape and layers in the DECAF document
Standard_EXPORT Standard_Boolean ReadLayers(const Handle(XSControl_WorkSession)& WS,
const StepData_Factors& theLocalFactors,
Handle(TDataStd_NamedData)& theAttr) const;
+ //! Returns the label of the shape associated with the given product definition.
+ //! @param theTransferProcess The transfer process to use for finding the label.
+ //! @param theProductDefinition The product definition for which to find the label.
+ //! @return The label of the shape associated with the given product definition.
+ TDF_Label getShapeLabelFromProductDefinition(
+ const Handle(Transfer_TransientProcess)& theTransferProcess,
+ const Handle(StepBasic_ProductDefinition)& theProductDefinition) const;
+
+ //! Returns the product associated with the given product definition.
+ //! @param theProductDefinition The product definition for which to get the product.
+ //! @return The product associated with the given product definition.
+ Handle(StepBasic_Product) getProductFromProductDefinition(
+ const Handle(StepBasic_ProductDefinition)& theProductDefinition) const;
+
+ //! Collects property definitions from the given general property and stores them in a vector.
+ //! @param theWorkSession The work session to use for collecting property definitions.
+ //! @param theGeneralProperty The general property from which to collect property definitions.
+ //! @return A vector of collected property definitions.
+ std::vector<Handle(StepRepr_PropertyDefinition)> collectPropertyDefinitions(
+ const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(Standard_Transient)& theGeneralProperty) const;
+
+ //! Collects shape labels from the given property definition.
+ //! @param theWorkSession The work session to use for collecting shape labels.
+ //! @param theTransferProcess The transfer process to use for collecting shape labels.
+ //! @param theSource The property definition from which to collect shape labels.
+ //! @return A vector of collected shape labels.
+ std::vector<TDF_Label> collectShapeLabels(
+ const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(Transfer_TransientProcess)& theTransferProcess,
+ const Handle(StepRepr_PropertyDefinition)& theSource) const;
+
+ //! Collects a group of related property definitions from the given property definition.
+ //! @p theProperty itself will be added to the result as well.
+ //! @param theWorkSession The work session to use for collecting related property definitions.
+ //! @param theProperty The property definition from which to collect related property definitions.
+ //! @return A vector of collected related property definitions.
+ std::vector<Handle(StepRepr_PropertyDefinition)> collectRelatedPropertyDefinitions(
+ const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(StepRepr_PropertyDefinition)& theProperty) const;
+
+ //! Helper method to get NamedData attribute assigned to the given label.
+ //! @param theLabel The label to get NamedData attribute from.
+ //! @return Handle to the NamedData attribute. Guarantees that the attribute is never null.
+ Handle(TDataStd_NamedData) getNamedData(const TDF_Label& theLabel) const;
+
+ //! Collects binders from the given property definition and stores them in the binder list.
+ //! @param theWorkSession The work session to use for collecting binders.
+ //! @param theTransientProcess The transient process to use for collecting binders.
+ //! @param theSource The property definition from which to collect binders.
+ //! @param theBinders The list to store the collected binders.
+ void collectBinders(const Handle(XSControl_WorkSession)& theWorkSession,
+ const Handle(Transfer_TransientProcess)& theTransientProcess,
+ const Handle(StepRepr_PropertyDefinition)& theSource,
+ NCollection_List<Handle(Transfer_Binder)>& theBinders) const;
+
private:
STEPControl_Reader myReader;
NCollection_DataMap<TCollection_AsciiString, Handle(STEPCAFControl_ExternFile)> myFiles;
Standard_Boolean myLayerMode;
Standard_Boolean myPropsMode;
Standard_Boolean myMetaMode;
+ Standard_Boolean myProductMetaMode;
Standard_Boolean mySHUOMode;
Standard_Boolean myGDTMode;
Standard_Boolean myMatMode;