//abv,gka 05.04.99: S4136: change parameters and update units
// PTV 22.08.2002 OCC609 transfer solo vertices into step file.
// PTV 16.09.2002 OCC725 transfer compound of vertices into one geometrical curve set.
-#include <STEPControl_ActorWrite.ixx>
-#include <STEPControl_StepModelType.hxx>
-// Transfer
-#include <Transfer_SimpleBinderOfTransient.hxx>
-#include <gp_Ax2.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepTools_Modifier.hxx>
+#include <Geom_Curve.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_Surface.hxx>
#include <GeomToStep_MakeAxis2Placement3d.hxx>
-#include <StepGeom_Axis2Placement3d.hxx>
-
-#include <STEPConstruct_Part.hxx>
+#include <gp_Ax2.hxx>
+#include <Interface_Macros.hxx>
+#include <Interface_MSG.hxx>
+#include <Interface_Static.hxx>
+#include <MoniTool_DataMapOfShapeTransient.hxx>
+#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>
+#include <STEPConstruct_AP203Context.hxx>
#include <STEPConstruct_Assembly.hxx>
#include <STEPConstruct_ContextTool.hxx>
+#include <STEPConstruct_Part.hxx>
#include <STEPConstruct_UnitContext.hxx>
-
-// TransferShape
+#include <STEPControl_ActorWrite.hxx>
+#include <STEPControl_StepModelType.hxx>
+#include <StepData_StepModel.hxx>
+#include <StepGeom_Axis2Placement3d.hxx>
+#include <StepGeom_GeomRepContextAndGlobUnitAssCtxAndGlobUncertaintyAssCtx.hxx>
+#include <StepGeom_Point.hxx>
+#include <StepRepr_GlobalUnitAssignedContext.hxx>
+#include <StepRepr_HArray1OfRepresentationItem.hxx>
+#include <StepRepr_PropertyDefinition.hxx>
+#include <StepRepr_ShapeRepresentationRelationship.hxx>
+#include <StepShape_AdvancedBrepShapeRepresentation.hxx>
+#include <StepShape_BrepWithVoids.hxx>
+#include <StepShape_FacetedBrep.hxx>
+#include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
+#include <StepShape_FacetedBrepShapeRepresentation.hxx>
+#include <StepShape_GeometricallyBoundedWireframeShapeRepresentation.hxx>
+#include <StepShape_GeometricCurveSet.hxx>
+#include <StepShape_GeometricSetSelect.hxx>
+#include <StepShape_HArray1OfGeometricSetSelect.hxx>
+#include <StepShape_ManifoldSolidBrep.hxx>
+#include <StepShape_ManifoldSurfaceShapeRepresentation.hxx>
+#include <StepShape_NonManifoldSurfaceShapeRepresentation.hxx>
+#include <StepShape_ShapeDefinitionRepresentation.hxx>
+#include <StepShape_ShapeRepresentation.hxx>
+#include <StepShape_ShellBasedSurfaceModel.hxx>
+#include <StepShape_TopologicalRepresentationItem.hxx>
+#include <StepShape_VertexPoint.hxx>
+#include <TCollection_HAsciiString.hxx>
+#include <TColStd_HSequenceOfTransient.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Iterator.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Solid.hxx>
#include <TopoDSToStep.hxx>
#include <TopoDSToStep_Builder.hxx>
#include <TopoDSToStep_FacetedTool.hxx>
-#include <TopoDSToStep_Tool.hxx>
-#include <TopoDSToStep_MakeManifoldSolidBrep.hxx>
#include <TopoDSToStep_MakeBrepWithVoids.hxx>
#include <TopoDSToStep_MakeFacetedBrep.hxx>
#include <TopoDSToStep_MakeFacetedBrepAndBrepWithVoids.hxx>
#include <TopoDSToStep_MakeGeometricCurveSet.hxx>
+#include <TopoDSToStep_MakeManifoldSolidBrep.hxx>
#include <TopoDSToStep_MakeShellBasedSurfaceModel.hxx>
-
-#include <TopoDS.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Solid.hxx>
-#include <Geom_Surface.hxx>
-#include <Geom_Plane.hxx>
-#include <Geom_Curve.hxx>
-#include <Geom_Line.hxx>
-
-#include <StepShape_ShapeDefinitionRepresentation.hxx>
-#include <StepShape_FacetedBrepAndBrepWithVoids.hxx>
-#include <StepShape_FacetedBrep.hxx>
-#include <StepShape_GeometricCurveSet.hxx>
-#include <StepShape_ShellBasedSurfaceModel.hxx>
-#include <StepShape_ManifoldSolidBrep.hxx>
-#include <StepShape_BrepWithVoids.hxx>
-#include <StepRepr_HArray1OfRepresentationItem.hxx>
-#include <StepBasic_HArray1OfProduct.hxx>
-#include <StepRepr_GlobalUnitAssignedContext.hxx>
-#include <StepShape_AdvancedBrepShapeRepresentation.hxx>
-#include <StepShape_FacetedBrepShapeRepresentation.hxx>
-#include <StepShape_TopologicalRepresentationItem.hxx>
-#include <StepShape_ManifoldSurfaceShapeRepresentation.hxx>
-#include <StepShape_GeometricallyBoundedWireframeShapeRepresentation.hxx>
-#include <StepBasic_ApplicationProtocolDefinition.hxx>
-#include <StepRepr_PropertyDefinition.hxx>
-
-#include <TopExp_Explorer.hxx>
-#include <TColStd_HSequenceOfTransient.hxx>
-#include <TCollection_HAsciiString.hxx>
-
-#include <Transfer_TransientProcess.hxx>
+#include <TopoDSToStep_MakeStepVertex.hxx>
+#include <TopoDSToStep_Tool.hxx>
+#include <TopTools_HSequenceOfShape.hxx>
+#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
+#include <TopTools_ListOfShape.hxx>
+#include <TopTools_MapOfShape.hxx>
#include <Transfer_Binder.hxx>
#include <Transfer_Finder.hxx>
#include <Transfer_FinderProcess.hxx>
-#include <TransferBRep_ShapeMapper.hxx>
+#include <Transfer_SequenceOfBinder.hxx>
+#include <Transfer_SimpleBinderOfTransient.hxx>
+#include <Transfer_TransientProcess.hxx>
#include <TransferBRep.hxx>
-#include <OSD_Timer.hxx>
-
-#include <ShapeExtend_Explorer.hxx>
-#include <ShapeAnalysis_ShapeTolerance.hxx>
-#include <Interface_MSG.hxx>
-#include <Interface_Static.hxx>
-
-#include <Interface_Macros.hxx>
-#include <TopTools_HSequenceOfShape.hxx>
-
-#include <BRep_Tool.hxx>
-#include <TopoDS_Iterator.hxx> //:d6
+#include <TransferBRep_ShapeMapper.hxx>
#include <UnitsMethods.hxx>
-#include <STEPConstruct_AP203Context.hxx>
-#include <BRepTools_Modifier.hxx>
-
#include <XSAlgo.hxx>
#include <XSAlgo_AlgoContainer.hxx>
-#include <StepRepr_ShapeRepresentationRelationship.hxx>
-#include <Transfer_SequenceOfBinder.hxx>
-#include <TopoDSToStep_MakeStepVertex.hxx>
-#include <StepShape_VertexPoint.hxx>
-#include <MoniTool_DataMapOfShapeTransient.hxx>
-#include <StepShape_HArray1OfGeometricSetSelect.hxx>
-#include <StepShape_GeometricSetSelect.hxx>
-#include <TopoDS_Compound.hxx>
-#include <BRep_Builder.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(STEPControl_ActorWrite,Transfer_ActorOfFinderProcess)
+// Transfer
+// TransferShape
+//:d6
// Non-manifold topology processing (ssv; 10.11.2010)
-#include <StepShape_NonManifoldSurfaceShapeRepresentation.hxx>
-#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
-#include <TopTools_ListOfShape.hxx>
-#include <TopExp.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_ListIteratorOfListOfShape.hxx>
-
// ============================================================================
// Function: DumpWhatIs
-// Purpose: Use it in DEB mode to dump your shapes
+// Purpose: Use it in debug mode to dump your shapes
// ============================================================================
-
-#ifdef DEB
+#ifdef OCCT_DEBUG
static void DumpWhatIs(const TopoDS_Shape& S) {
TopTools_MapOfShape aMapOfShape;
aBrepBuilder.Add(aDirectShapes, aDirectChild);
}
- #ifdef DEB
+ #ifdef OCCT_DEBUG
DumpWhatIs(aDirectShapes);
#endif
TopExp::MapShapesAndAncestors(aDirectShapes, TopAbs_EDGE, TopAbs_FACE, aMapEdgeFaces);
Standard_Integer aNbEdges = aMapEdgeFaces.Extent();
- #ifdef DEB
+ #ifdef OCCT_DEBUG
cout << "Checking whether the topology passed is manifold..." << endl;
#endif
}
}
- #ifdef DEB
+ #ifdef OCCT_DEBUG
cout << "Check result: "
<< (aResult ? "TRUE" : "FALSE") << endl;
#endif
return aResult;
}
-
-/* this is a start of a comment! */
-#ifdef DEB
-void DumpBinder (const Handle(Transfer_Binder) &binder)
-{
- Handle(Transfer_Binder) bbb = binder;
- while ( ! bbb.IsNull() ) {
- Handle(Transfer_SimpleBinderOfTransient) bx =
- Handle(Transfer_SimpleBinderOfTransient)::DownCast ( bbb );
- cout << (void*)&bx;
- if ( ! bx.IsNull() ) {
- cout << "--> " << bx->ResultTypeName() << " " << *(void**)&bx->Result() << endl;
- }
- else cout << "--> ???" << endl;
- bbb = bbb->NextResult();
- }
- cout << endl;
-}
-#endif
-/* this is a end of a comment */
//=======================================================================
//function : STEPControl_ActorWrite
}
if ( aResult.IsNull() ) {
- #ifdef DEB
+ #ifdef OCCT_DEBUG
cout << "\nNew NMSSR created" << endl;
#endif
aResult = new StepShape_NonManifoldSurfaceShapeRepresentation;
isNMSSRCreated = Standard_True;
} else {
- #ifdef DEB
+ #ifdef OCCT_DEBUG
cout << "\nExisting NMSSR is used" << endl;
#endif
isNMSSRCreated = Standard_False;
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
//:abv 20.05.02: writing box & face from it (shared) in one compound
// as assembly - while face already translated, it should be
// re-translated to break sharing
-#ifdef DEB
+#ifdef OCCT_DEBUG
cout << "Warning: STEPControl_ActorWrite::TransferShape(): shape already translated" << endl;
#endif
// return binder;
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;
// NOTE: aNMBinder is connected now with this SDR. It will be added to the resulting
// binder in the end of this invocation of TransferShape
for (Standard_Integer i = 1; i <= aNMItemsNb; i++) {
- Handle(TransferBRep_ShapeMapper) mapper = TransferBRep::ShapeMapper( FP, RepItemSeq->Value(i) );
- TransferShape(mapper, sdr, FP, NonManifoldGroup, Standard_False);
+ Handle(TransferBRep_ShapeMapper) aMapper = TransferBRep::ShapeMapper( FP, RepItemSeq->Value(i) );
+ TransferShape(aMapper, sdr, FP, NonManifoldGroup, Standard_False);
}
// Nothing else needed for pure non-manifold topology, return
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);
BRep_Builder aB;
aB.MakeCompound(aCompOfVrtx);
- #ifdef DEB
+ #ifdef OCCT_DEBUG
if (!isManifold)
cout << "Exploding Solids to Shells if any..." << endl;
#endif