0025166: STEP Reader - allow GEOMETRIC_SET entity to accept non-geometric children
authordrazmyslovich <razmyslovich@volumegraphics.com>
Thu, 21 Aug 2014 08:41:24 +0000 (12:41 +0400)
committerbugmaster <bugmaster@opencascade.com>
Thu, 21 Aug 2014 11:51:15 +0000 (15:51 +0400)
Allow GEOMETRIC_SET entity to accept GeometricRepresentationItem children

Modification to avoid cyclic dependency between STEPControl and StepToTopoDS packages

Test cases for issue CR25166

src/STEPControl/STEPControl_ActorRead.cxx
src/StepShape/StepShape_GeometricSetSelect.cxx
src/StepToTopoDS/StepToTopoDS.cdl
src/StepToTopoDS/StepToTopoDS_Builder.cdl
src/StepToTopoDS/StepToTopoDS_Builder.cxx
tests/bugs/step/bug25166 [new file with mode: 0644]

index 14657c5..3e29423 100644 (file)
@@ -1231,7 +1231,7 @@ Handle(TransferBRep_ShapeBinder) STEPControl_ActorRead::TransferEntity(const Han
     found = Standard_True;
   } 
   else if (start->IsKind(STANDARD_TYPE(StepShape_GeometricSet))) {
-    myShapeBuilder.Init(GetCasted(StepShape_GeometricSet, start), TP);
+    myShapeBuilder.Init(GetCasted(StepShape_GeometricSet, start), TP, this, isManifold);
     found = Standard_True;
   }
   else if (start->IsKind(STANDARD_TYPE(StepShape_EdgeBasedWireframeModel))) {
index e689089..f8f6644 100644 (file)
@@ -22,6 +22,7 @@ Standard_Integer StepShape_GeometricSetSelect::CaseNum(const Handle(Standard_Tra
        if (ent->IsKind(STANDARD_TYPE(StepGeom_Point))) return 1;
        if (ent->IsKind(STANDARD_TYPE(StepGeom_Curve))) return 2;
        if (ent->IsKind(STANDARD_TYPE(StepGeom_Surface))) return 3;
+  if (ent->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem))) return 4;
        return 0;
 }
 
index 6552865..2f6bd32 100644 (file)
@@ -22,7 +22,7 @@ package StepToTopoDS
 
 uses TopoDS, StdFail, TCollection, TColStd, BRep, Geom, Geom2d,
      GeomAdaptor, Extrema, gp, Transfer, Geom2dAPI,
-     StepRepr, StepGeom, StepShape, TopTools
+     StepRepr, StepGeom, StepShape, TopTools, STEPControl
 
 is
 
index c329e6d..d1abf8d 100644 (file)
@@ -34,10 +34,12 @@ uses
     Shape                       from TopoDS,
     BuilderError                from StepToTopoDS,
     TransientProcess            from Transfer,
-    NMTool                      from StepToTopoDS
+    NMTool                      from StepToTopoDS,
+    ActorRead                   from STEPControl,
+    ActorOfTransientProcess     from Transfer
     
     raises NotDone from StdFail
-     
+    
 is 
 
     Create returns Builder from StepToTopoDS;
@@ -98,7 +100,9 @@ is
          
     Init (me : in out;
          S  : GeometricSet from StepShape;
-          TP : TransientProcess  from Transfer );
+          TP : TransientProcess  from Transfer;
+         RA : ActorOfTransientProcess from Transfer = NULL;
+         isManifold : Boolean = Standard_False );
          
     Value (me) returns Shape from TopoDS
        raises NotDone
index 122f863..e2a27ea 100644 (file)
 #include <StepToTopoDS_TranslateFace.hxx>
 #include <StepShape_HArray1OfFace.hxx>
 
+#include <STEPControl_ActorRead.hxx>
+
 #include <Message_ProgressSentry.hxx>
 #include <Message_Messenger.hxx>
+#include <Transfer_ActorOfTransientProcess.hxx>
+#include <STEPControl_ActorRead.hxx>
 
 static void ResetPreci (const TopoDS_Shape& S, Standard_Real maxtol)
 {
@@ -720,7 +724,9 @@ static TopoDS_Face TranslateBoundedSurf (const Handle(StepGeom_Surface) &surf,
 
 void StepToTopoDS_Builder::Init
 (const Handle(StepShape_GeometricSet)& GCS,
- const Handle(Transfer_TransientProcess)& TP)
+ const Handle(Transfer_TransientProcess)& TP,
+ const Handle(Transfer_ActorOfTransientProcess)& RA,
+ const Standard_Boolean isManifold)
 {
   // Initialisation of the Tool
 
@@ -842,7 +848,23 @@ void StepToTopoDS_Builder::Init
       // try other surfs
       else res = TranslateBoundedSurf (aSurf, preci);
     }
-    else TP->AddWarning (ent," Entity is not a Curve, Point or Surface");
+    else if ( ent->IsKind(STANDARD_TYPE(StepGeom_GeometricRepresentationItem)) )
+    {
+      Handle(StepGeom_GeometricRepresentationItem) GRI = 
+        Handle(StepGeom_GeometricRepresentationItem)::DownCast(ent);
+      if (!RA.IsNull())
+      {
+        Handle(STEPControl_ActorRead) anActor = Handle(STEPControl_ActorRead)::DownCast(RA);
+        Handle(Transfer_Binder) binder;
+        if( !anActor.IsNull())
+          binder = anActor->TransferShape(GRI, TP, isManifold);
+        if (!binder.IsNull())
+        {
+          res = TransferBRep::ShapeResult(binder);
+        }
+      }
+    }
+    else TP->AddWarning (ent," Entity is not a Curve, Point, Surface or GeometricRepresentationItem");
     if ( ! res.IsNull() ) {
       B.Add(S, res);
       TransferBRep::SetShapeResult ( TP, ent, res );
diff --git a/tests/bugs/step/bug25166 b/tests/bugs/step/bug25166
new file mode 100644 (file)
index 0000000..fe8e703
--- /dev/null
@@ -0,0 +1,24 @@
+puts "============"
+puts "OCC25166"
+puts "============"
+puts ""
+#####################################################
+# STEP Reader - allow GEOMETRIC_SET entity to accept non-geometric children
+#####################################################
+
+stepread [locate_data_file bug25166_piston.stp] a *
+tpcompound result
+
+set square 46280.7
+
+set nb_v_good 176
+set nb_e_good 176
+set nb_w_good 176
+set nb_f_good 168
+set nb_sh_good 168
+set nb_sol_good 0
+set nb_compsol_good 0
+set nb_compound_good 2
+set nb_shape_good 866
+
+set 3dviewer 1