#include <OSD_Timer.hxx>
#include <ShapeAnalysis_ShapeTolerance.hxx>
#include <ShapeExtend_Explorer.hxx>
+#include <ShapeProcess_ShapeContext.hxx>
#include <Standard_Type.hxx>
#include <StepBasic_ApplicationProtocolDefinition.hxx>
#include <StepBasic_HArray1OfProduct.hxx>
return aResult;
}
+//=======================================================================
+//function : mergeInfoForNM
+//purpose : bind already written shared faces to STEP entity for non-manifold
+//=======================================================================
+void STEPControl_ActorWrite::mergeInfoForNM(const Handle(Transfer_FinderProcess)& theFP,
+ const Handle(Standard_Transient) &theInfo) const
+{
+ Handle(ShapeProcess_ShapeContext) aContext = Handle(ShapeProcess_ShapeContext)::DownCast ( theInfo );
+ if ( aContext.IsNull() ) return;
+
+ const TopTools_DataMapOfShapeShape &aMap = aContext->Map();
+ TopTools_DataMapIteratorOfDataMapOfShapeShape aShapeShapeIt(aMap);
+
+ for ( ; aShapeShapeIt.More(); aShapeShapeIt.Next() ) {
+ TopoDS_Shape anOrig = aShapeShapeIt.Key(), aRes = aShapeShapeIt.Value();
+ if (anOrig.ShapeType() != TopAbs_FACE)
+ continue;
+
+ Handle(TransferBRep_ShapeMapper) anOrigMapper= TransferBRep::ShapeMapper ( theFP, anOrig);
+ Handle(Transfer_Binder) anOrigBinder = theFP->Find ( anOrigMapper );
+ if (anOrigBinder.IsNull())
+ continue;
+
+ Handle(TransferBRep_ShapeMapper) aResMapper = TransferBRep::ShapeMapper ( theFP, aRes );
+ theFP->Bind(aResMapper, anOrigBinder);
+ }
+}
+
//=======================================================================
//function : SetMode
return TransferCompound(start, SDR0, FP);
// [BEGIN] Separate manifold topology from non-manifold in group mode 0 (ssv; 18.11.2010)
- Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold");
+ Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
Handle(Transfer_Binder) aNMBinder;
if (isNMMode && !GroupMode() && theShape.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Compound aNMCompound;
Handle(Standard_Transient) info;
Standard_Real maxTol = Interface_Static::RVal("read.maxprecision.val");
- // Fix only manifold shapes, do nothing with non-manifold topology as it is processed separately (ssv; 13.11.2010)
TopoDS_Shape aShape;
- if (isManifold)
- aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
- "write.step.resource.name",
- "write.step.sequence", info,
- FP->GetProgress() );
- else
- aShape = xShape;
-
+ aShape = XSAlgo::AlgoContainer()->ProcessShape(xShape, Tol, maxTol,
+ "write.step.resource.name",
+ "write.step.sequence", info,
+ FP->GetProgress() );
+ if (!isManifold) {
+ mergeInfoForNM(FP, info);
+ }
+
// create a STEP entity corresponding to shape
Handle(StepGeom_GeometricRepresentationItem) item;
switch (trmode)
TopoDS_Shape theShape = mapper->Value();
// Inspect non-manifold topology case (ssv; 10.11.2010)
- Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold");
+ Standard_Boolean isNMMode = Interface_Static::IVal("write.step.nonmanifold") != 0;
Standard_Boolean isManifold;
if (isNMMode)
isManifold = IsManifoldShape(theShape);