DiscussionsIssue archiveOCCT:Data Exchange

Archived issue #0033660

Data Exchange, Step Import - Adding product attributes to metadata

Open CASCADEOCCT:Data Exchangeassigned9 public notes

Search issues

Description

Needs to update ReadMetadata method.

Steps to reproduce

Not required

Public activity

9 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: ichesnok
Date: Mon Apr 1 12:13:15 2024 +0100

    0033660: Data Exchange, Step Import - Adding product attributes to metadata
    
    Attributes of product was added to metadata.
02Commenter 2
Dear Commenter 3,
please review branch CR33660.
03Commenter 3
There are new bug into Hoops are detected.
No remarks about result of importing.
But there are some remarks about code.

Continue should be?
+        TopoDS_Shape aShape = TransferBRep::ShapeResult(aTP, aBinder);
+        if (aShape.IsNull())
+          continue;
+

Better to rework
from:
+        TDF_Label aShapeLabel;
+        if (myMap.IsBound(aShape))
+        {
+          aShapeLabel = myMap.Find(aShape);
+        }
+        if (!aShapeLabel.IsNull())
+        {
to:
+        TDF_Label aShapeLabel;
+        if (myMap.Find(aShape, aShapeLabel))
+        {

There always Add can be perform.
+          if (!aGeneralLabelMap.Contains(aShapeLabel))
+          {
+            aGeneralLabelMap.Add(aShapeLabel);
+          }
to
aGeneralLabelMap.Add(aShapeLabel);
Just bacause the code of Add already have checking for existing :)

The same remarks about Add
@@ -5134,28 +5172,78 @@ Standard_Boolean STEPCAFControl_Reader::ReadMetadata(const Handle(XSControl_Work
         if (!aShapeLabel.IsNull())
         {
           aLabelSeq.Append(aShapeLabel);
+          if (!aGeneralLabelMap.Contains(aShapeLabel))
+          {
+            aGeneralLabelMap.Add(aShapeLabel);
+          }

// fill user defined attribute map
Can be optimize to use instead of isBound Seek operation and working with pointer.
Nor Bind all the time, we can work with map element directly all the time to avoid copying :)

Anything else about IsBoind then Find can be replaces just with Find :)
There more samples, please check your fix with that kind of remarks
+    if (anAttrMap.IsBound(aLabelIt.Value()))
+    {
+      NCollection_Sequence<Handle(StepRepr_PropertyDefinition)> anAttrib = anAttrMap.Find(aLabelIt.Value());
04Commenter 2
Branch [archived branch] has been created by Author.

[revision removed]


Detailed log of new commits:

Author: ichesnok
Date: Mon Apr 1 12:13:15 2024 +0100

    0033660: Data Exchange, Step Import - Adding product attributes to metadata
    
    Attributes of product was added to metadata.
05Commenter 5
Dear Commenter 3, remarks were fixed.
Please review branch CR33660_1.
06Commenter 3
Needs to use "const auto& aPair" I mean needs to use reference.
+        std::pair<TCollection_AsciiString, Handle(TCollection_HAsciiString)> aPair = aSeqIt.Value();
+        if (aPair.second.IsNull() || aPair.second->String().IsEmpty())
+        {

No more remarks
07Commenter 2
Branch [archived branch] has been updated forcibly by Author.

[revision removed]
08Commenter 3
Need to think about integrate this solution into OCCT.
But in that case need to think about special flag or enum for metadata
09Commenter 3
Need to verify and integrate to the master if no conflicts.