0025167: STEP Reader - allow NextAssemblyUsageOccurance to accept ProductDefinitionSh...
authordrazmyslovich <razmyslovich@volumegraphics.com>
Tue, 19 Aug 2014 11:49:37 +0000 (13:49 +0200)
committerbugmaster <bugmaster@opencascade.com>
Thu, 21 Aug 2014 11:51:18 +0000 (15:51 +0400)
Workaround to allow NextAssemblyUsageOccurance accepting ProductDefinitionShape as child instead of ProductDefinition

src/RWStepRepr/RWStepRepr_RWAssemblyComponentUsage.cxx
src/STEPControl/STEPControl_ActorRead.cxx

index fd277bf..7f47170 100644 (file)
@@ -17,6 +17,8 @@
 
 #include <RWStepRepr_RWAssemblyComponentUsage.ixx>
 
+#include <StepRepr_ProductDefinitionShape.hxx>
+
 //=======================================================================
 //function : RWStepRepr_RWAssemblyComponentUsage
 //purpose  : 
@@ -58,9 +60,27 @@ void RWStepRepr_RWAssemblyComponentUsage::ReadStep (const Handle(StepData_StepRe
 
   Handle(StepBasic_ProductDefinition) aProductDefinitionRelationship_RelatingProductDefinition;
   data->ReadEntity (num, 4, "product_definition_relationship.relating_product_definition", ach, STANDARD_TYPE(StepBasic_ProductDefinition), aProductDefinitionRelationship_RelatingProductDefinition);
+  if (aProductDefinitionRelationship_RelatingProductDefinition.IsNull())
+  {
+    Handle(StepRepr_ProductDefinitionShape) aProductDefinitionShape;
+    data->ReadEntity (num, 4, "product_definition_relationship.relating_product_definition_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape), aProductDefinitionShape);
+    if (!aProductDefinitionShape.IsNull())
+    {
+      aProductDefinitionRelationship_RelatingProductDefinition = aProductDefinitionShape->Definition().ProductDefinition();
+    }
+  }
 
   Handle(StepBasic_ProductDefinition) aProductDefinitionRelationship_RelatedProductDefinition;
   data->ReadEntity (num, 5, "product_definition_relationship.related_product_definition", ach, STANDARD_TYPE(StepBasic_ProductDefinition), aProductDefinitionRelationship_RelatedProductDefinition);
+  if (aProductDefinitionRelationship_RelatedProductDefinition.IsNull())
+  {
+    Handle(StepRepr_ProductDefinitionShape) aProductDefinitionShape;
+    data->ReadEntity (num, 5, "product_definition_relationship.related_product_definition_shape", ach, STANDARD_TYPE(StepRepr_ProductDefinitionShape), aProductDefinitionShape);
+    if (!aProductDefinitionShape.IsNull())
+    {
+      aProductDefinitionRelationship_RelatedProductDefinition = aProductDefinitionShape->Definition().ProductDefinition();
+    }
+  }
 
   // Own fields of AssemblyComponentUsage
 
index 3e29423..6eaf767 100644 (file)
@@ -399,6 +399,7 @@ static void getListSDR(const Handle(StepRepr_ShapeAspect)& sa,
 
 static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
                    Handle(TColStd_HSequenceOfTransient)& listSDR,
+                   Handle(TColStd_HSequenceOfTransient)& listNAUO,
                    Handle(TColStd_HSequenceOfTransient)& listSDRAspect,
                    const Handle(Transfer_TransientProcess)& TP)
 {
@@ -448,6 +449,15 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
       getListSDR(sa,listSDRAspect,TP);
       continue;
     }
+
+    // NAUO is used to find sub-assemblies
+    Handle(StepRepr_NextAssemblyUsageOccurrence) NAUO = 
+      Handle(StepRepr_NextAssemblyUsageOccurrence)::DownCast(subs4.Value());
+    if ( ! NAUO.IsNull() ) {
+      if ( PDS->Definition().ProductDefinition() == NAUO->RelatingProductDefinition() )
+        listNAUO->Append(NAUO);
+      continue;
+    }
   }
 }
 
@@ -480,7 +490,7 @@ static void getSDR(const Handle(StepRepr_ProductDefinitionShape)& PDS,
     Handle(StepRepr_ProductDefinitionShape) PDS = 
       Handle(StepRepr_ProductDefinitionShape)::DownCast(subs3.Value());
     if ( ! PDS.IsNull() ) {
-      getSDR(PDS,listSDR,listSDRAspect,TP);
+      getSDR(PDS,listSDR,listNAUO,listSDRAspect,TP);
       continue;
     }
     // NAUO is used to find sub-assemblies