]> OCCT Git - occt.git/commitdiff
0032914: Data Exchange - Some parts of compound are lost while writing STEP in nonman...
authorsnn <snn@opencascade.com>
Wed, 20 Apr 2022 11:56:21 +0000 (14:56 +0300)
committerjfa <jfa@opencascade.com>
Wed, 18 May 2022 13:42:48 +0000 (16:42 +0300)
src/STEPControl/STEPControl_ActorWrite.cxx
tests/bugs/step/bug32914 [new file with mode: 0644]

index 54295e103084f4473027d91ea4e530d67f60223f..1f1ddbf9bebb1382377fc01404278a6d9b93512c 100644 (file)
@@ -1241,8 +1241,8 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
       Handle(StepRepr_HArray1OfRepresentationItem) newItems = 
         new StepRepr_HArray1OfRepresentationItem(1, oldItems->Length() + 1);
       Standard_Integer el = 1;
-      for (Standard_Integer i = 1; i <= oldItems->Length(); i++)
-        newItems->SetValue( el++, oldItems->Value(i) );
+        for (Standard_Integer i = 1; i <= oldItems->Length(); i++)
+          newItems->SetValue(el++, oldItems->Value(i));
       newItems->SetValue( el, items->Value( items->Length() ) );
       shapeRep->SetItems(newItems);
     }
@@ -1276,7 +1276,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferShape
     return resbind;
   } else return FP->Find(start);
 
-}
+  }
 
 //=======================================================================
 //function : TransferCompound
@@ -1381,11 +1381,7 @@ Handle(Transfer_Binder) STEPControl_ActorWrite::TransferCompound
       Handle(Transfer_SimpleBinderOfTransient) bx = 
         Handle(Transfer_SimpleBinderOfTransient)::DownCast(bnd);
       if ( !bx.IsNull() ) {
-        // Single SDR is created for a non-manifold group (ssv: 12.11.2010)
-        if (!isManifold && i > 1)
-          break;
-        else
-          binder->AddResult( TransientResult( bx->Result() ) );
+        binder->AddResult( TransientResult( bx->Result() ) );
       }
       bnd = bnd->NextResult();
     }
@@ -1465,7 +1461,10 @@ Handle(Transfer_Binder)  STEPControl_ActorWrite::TransferSubShape
   //:abv 20.05.02: see comment in TransferShape(): added "! iasdr ||"
   Handle(Transfer_Binder) resprod = TransientResult(sdr);  //KA - OCC7141(skl 10.11.2004)
   if ( ! iasdr || resbind.IsNull() ) {
-    resbind = TransferShape(mapper, sdr, FP, shapeGroup, isManifold, theProgress);
+    Handle(Transfer_Binder) resbind1 = TransferShape(mapper, sdr, FP, shapeGroup, isManifold, theProgress);
+    if (resbind1.IsNull() || sdr->UsedRepresentation().IsNull())
+      return Handle(Transfer_Binder)();
+    resbind = resbind1;
     Handle(Transfer_Binder) oldbind = FP->Find ( mapper );
     if ( ! oldbind.IsNull() && !resbind.IsNull()) resbind->AddResult ( oldbind );
     FP->Bind (mapper,resbind);
diff --git a/tests/bugs/step/bug32914 b/tests/bugs/step/bug32914
new file mode 100644 (file)
index 0000000..cfa6536
--- /dev/null
@@ -0,0 +1,19 @@
+puts "==================================================="
+puts " 0032914: Data Exchange - Some parts of compound are lost while writing STEP in nonmanifold mode "
+puts "==================================================="
+puts ""
+
+set BugNumber OCC32914
+
+set filepath [locate_data_file ${BugNumber}.brep]
+
+restore ${filepath} s
+
+param write.step.nonmanifold 1
+stepwrite 0 s ${imagedir}/${BugNumber}.step
+
+testreadstep ${imagedir}/${BugNumber}.step result
+
+checknbshapes result -vertex 16 -edge 17 -wire 7 -face 7 -shell 2 -solid 0 -compsolid 0 -compound 4 -shape 53
+
+checkview -display result -2d -path ${imagedir}/${test_image}.png