//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;
}
}
- cout << "//What is?// NB SOLIDS: " << nbSolids << endl;
- cout << "//What is?// NB SHELLS: " << nbShells << endl;
- cout << "//What is?// OPEN SHELLS: " << nbOpenShells << endl;
- cout << "//What is?// CLOSED SHELLS: " << nbShells - nbOpenShells << endl;
- cout << "//What is?// NB FACES: " << nbFaces << endl;
- cout << "//What is?// NB WIRES: " << nbWires << endl;
- cout << "//What is?// NB EDGES: " << nbEdges << endl;
- cout << "//What is?// NB VERTEXES: " << nbVertexes << endl;
+ std::cout << "//What is?// NB SOLIDS: " << nbSolids << std::endl;
+ std::cout << "//What is?// NB SHELLS: " << nbShells << std::endl;
+ std::cout << "//What is?// OPEN SHELLS: " << nbOpenShells << std::endl;
+ std::cout << "//What is?// CLOSED SHELLS: " << nbShells - nbOpenShells << std::endl;
+ std::cout << "//What is?// NB FACES: " << nbFaces << std::endl;
+ std::cout << "//What is?// NB WIRES: " << nbWires << std::endl;
+ std::cout << "//What is?// NB EDGES: " << nbEdges << std::endl;
+ std::cout << "//What is?// NB VERTEXES: " << nbVertexes << std::endl;
}
#endif
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
- cout << "Checking whether the topology passed is manifold..." << endl;
+ #ifdef OCCT_DEBUG
+ std::cout << "Checking whether the topology passed is manifold..." << std::endl;
#endif
// Check topology
}
}
- #ifdef DEB
- cout << "Check result: "
- << (aResult ? "TRUE" : "FALSE") << endl;
+ #ifdef OCCT_DEBUG
+ std::cout << "Check result: "
+ << (aResult ? "TRUE" : "FALSE") << std::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
- cout << "\nNew NMSSR created" << endl;
+ #ifdef OCCT_DEBUG
+ std::cout << "\nNew NMSSR created" << std::endl;
#endif
aResult = new StepShape_NonManifoldSurfaceShapeRepresentation;
isNMSSRCreated = Standard_True;
} else {
- #ifdef DEB
- cout << "\nExisting NMSSR is used" << endl;
+ #ifdef OCCT_DEBUG
+ std::cout << "\nExisting NMSSR is used" << std::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
case STEPControl_BrepWithVoids : ModeTrans() = 5; break;
case STEPControl_FacetedBrep : ModeTrans() = 1; break;
case STEPControl_FacetedBrepAndBrepWithVoids : ModeTrans() = 6; break;
- case STEPControl_ShellBasedSurfaceModel : ModeTrans() = 2;
- case STEPControl_GeometricCurveSet : ModeTrans() = 4;
+ case STEPControl_ShellBasedSurfaceModel : ModeTrans() = 2; break;
+ case STEPControl_GeometricCurveSet : ModeTrans() = 4; break;
case STEPControl_Hybrid : ModeTrans() = 0; break; // PAS IMPLEMENTE !!
default: break;
}
{
if ( ! GroupMode() || S.ShapeType() != TopAbs_COMPOUND ) return Standard_False;
// PTV 16.09.2002 OCC725 for storing compound of vertices
- if (S.ShapeType() == TopAbs_COMPOUND ) {
- Standard_Boolean IsOnlyVertices = Standard_True;
- TopoDS_Iterator anItr( S );
- for ( ; anItr.More(); anItr.Next() ) {
- if ( anItr.Value().ShapeType() != TopAbs_VERTEX ) {
- IsOnlyVertices = Standard_False;
- break;
+ if (Interface_Static::IVal("write.step.vertex.mode") == 0) {//bug 23950
+ if (S.ShapeType() == TopAbs_COMPOUND ) {
+ Standard_Boolean IsOnlyVertices = Standard_True;
+ TopoDS_Iterator anItr( S );
+ for ( ; anItr.More(); anItr.Next() ) {
+ if ( anItr.Value().ShapeType() != TopAbs_VERTEX ) {
+ IsOnlyVertices = Standard_False;
+ break;
+ }
}
+ if ( IsOnlyVertices )
+ return Standard_False;
}
- if ( IsOnlyVertices )
- return Standard_False;
}
if ( GroupMode() ==1 ) return Standard_True;
TopoDS_Iterator it ( S );
//: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
- cout << "Warning: STEPControl_ActorWrite::TransferShape(): shape already translated" << endl;
+#ifdef OCCT_DEBUG
+ std::cout << "Warning: STEPControl_ActorWrite::TransferShape(): shape already translated" << std::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
// create a list of items to translate
Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
+ Standard_Boolean isSeparateVertices =
+ Interface_Static::IVal("write.step.vertex.mode") == 0;//bug 23950
// PTV 16.09.2002 OCC725 separate shape from solo vertices.
Standard_Boolean isOnlyVertices = Standard_False;
if (theShape.ShapeType() == TopAbs_COMPOUND) {
aB.MakeCompound(aNewShape);
aB.MakeCompound(aCompOfVrtx);
TopoDS_Iterator anCompIt(theShape);
- for (; anCompIt.More(); anCompIt.Next()) {
- TopoDS_Shape aCurSh = anCompIt.Value();
- if (aCurSh.ShapeType() != TopAbs_VERTEX) {
- aB.Add(aNewShape, aCurSh);
- countSh++;
- }
- else {
- aB.Add(aCompOfVrtx, aCurSh);
- countVrtx++;
+ if (isSeparateVertices) {
+ for (; anCompIt.More(); anCompIt.Next()) {
+ TopoDS_Shape aCurSh = anCompIt.Value();
+ if (aCurSh.ShapeType() != TopAbs_VERTEX) {
+ aB.Add(aNewShape, aCurSh);
+ countSh++;
+ }
+ else {
+ aB.Add(aCompOfVrtx, aCurSh);
+ countVrtx++;
+ }
}
+ // replace the shapes
+ if (countSh)
+ theShape = aNewShape;
+ if (countVrtx)
+ RepItemSeq->Append(aCompOfVrtx);
+ if (countSh == 0)
+ isOnlyVertices = Standard_True;
}
- // replace the shapes
- if (countSh)
- theShape = aNewShape;
- if (countVrtx)
- RepItemSeq->Append(aCompOfVrtx);
- if (countSh == 0)
- isOnlyVertices = Standard_True;
}
if (theShape.ShapeType() == TopAbs_COMPOUND) {
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);
Handle(TopTools_HSequenceOfShape) RepItemSeq = new TopTools_HSequenceOfShape();
// Prepare a collection for non-manifold group of shapes
Handle(TopTools_HSequenceOfShape) NonManifoldGroup = new TopTools_HSequenceOfShape();
+ Standard_Boolean isSeparateVertices =
+ (Interface_Static::IVal("write.step.vertex.mode") == 0);//bug 23950
// PTV OCC725 17.09.2002 -- begin --
Standard_Integer nbFreeVrtx = 0;
TopoDS_Compound aCompOfVrtx;
BRep_Builder aB;
aB.MakeCompound(aCompOfVrtx);
- #ifdef DEB
+ #ifdef OCCT_DEBUG
if (!isManifold)
- cout << "Exploding Solids to Shells if any..." << endl;
+ std::cout << "Exploding Solids to Shells if any..." << std::endl;
#endif
for (TopoDS_Iterator iter(theShape); iter.More(); iter.Next()) {
TopoDS_Shape aSubShape = iter.Value();
- if (aSubShape.ShapeType() != TopAbs_VERTEX) {
+ if (aSubShape.ShapeType() != TopAbs_VERTEX || !isSeparateVertices) {
// Store non-manifold topology as shells (ssv; 10.11.2010)
if (!isManifold && aSubShape.ShapeType() == TopAbs_SOLID) {
NonManifoldGroup->Append(aSubShell);
}
}
- else if (!isManifold && (aSubShape.ShapeType() == TopAbs_SHELL) ) {
+ else if (!isManifold &&
+ (aSubShape.ShapeType() == TopAbs_SHELL || aSubShape.ShapeType() == TopAbs_FACE))
+ {
RepItemSeq->Append(aSubShape);
NonManifoldGroup->Append(aSubShape);
}