#include <STEPSelections_SelectForTransfer.hxx>
#include <STEPSelections_SelectGSCurves.hxx>
#include <STEPSelections_SelectInstances.hxx>
+#include <ShapeUpgrade_RemoveLocations.hxx>
#include <TopoDS_Shape.hxx>
#include <Transfer_ActorOfTransientProcess.hxx>
#include <XSAlgo.hxx>
+#include <XSAlgo_ShapeProcessor.hxx>
#include <XSControl_WorkSession.hxx>
IMPLEMENT_STANDARD_RTTIEXT(STEPControl_Controller,XSControl_Controller)
Handle(STEPControl_ActorWrite) ActWrite =
Handle(STEPControl_ActorWrite)::DownCast(myAdaptorWrite);
// A PRESENT ON PASSE PAR LE PROFILE
+ Handle(StepData_StepModel) aModel = Handle(StepData_StepModel)::DownCast(model);
if (!ActWrite.IsNull())
- ActWrite->SetGroupMode (Handle(StepData_StepModel)::DownCast(model)->InternalParameters.WriteAssembly);
-
- return XSControl_Controller::TransferWriteShape(shape, FP, model, modeshape, theProgress);
+ ActWrite->SetGroupMode (aModel->InternalParameters.WriteAssembly);
+ TopoDS_Shape aShape = shape;
+ TopTools_DataMapOfShapeShape aModifedMap;
+ if (aModel->InternalParameters.WriteNonmanifold)
+ {
+ ShapeUpgrade_RemoveLocations aRemLoc;
+ aRemLoc.SetRemoveLevel(TopAbs_COMPOUND);
+ aRemLoc.Remove(aShape);
+ aShape = aRemLoc.GetResult();
+ aModifedMap = aRemLoc.GetModifiedShapesMap();
+ }
+ const IFSelect_ReturnStatus aStatus = XSControl_Controller::TransferWriteShape(aShape, FP, model, modeshape, theProgress);
+ XSAlgo_ShapeProcessor::MergeShapeTransferInfo(FP, aModifedMap, Handle(ShapeExtend_MsgRegistrator)());
+ return aStatus;
}
Standard_Boolean STEPControl_Controller::Init ()
//=============================================================================
-void XSAlgo_ShapeProcessor::MergeTransferInfo(const Handle(Transfer_TransientProcess)& theTransientProcess,
- const Standard_Integer theFirstTPItemIndex) const
+void XSAlgo_ShapeProcessor::MergeShapeTransferInfo(
+ const Handle(Transfer_TransientProcess)& theTransientProcess,
+ const TopTools_DataMapOfShapeShape& theModifiedShapesMap,
+ const Standard_Integer theFirstTPItemIndex,
+ Handle(ShapeExtend_MsgRegistrator) theMessages)
{
- if (myContext.IsNull())
+ if (theModifiedShapesMap.IsEmpty())
{
return;
}
-
- const TopTools_DataMapOfShapeShape& aShapesMap = myContext->Map();
- Handle(ShapeExtend_MsgRegistrator) aMessages = myContext->Messages();
- if (aShapesMap.IsEmpty() && (aMessages.IsNull() || aMessages->MapShape().IsEmpty()))
+ const bool aToPrint = !theMessages.IsNull() && !theMessages->MapShape().IsEmpty();
+ for (Standard_Integer i = std::max(theFirstTPItemIndex, 1); i <= theTransientProcess->NbMapped();
+ ++i)
{
- return;
- }
-
- for (Standard_Integer i = std::max(theFirstTPItemIndex, 1); i <= theTransientProcess->NbMapped(); ++i)
- {
- Handle(TransferBRep_ShapeBinder) aShapeBinder = Handle(TransferBRep_ShapeBinder)::DownCast(theTransientProcess->MapItem(i));
+ Handle(TransferBRep_ShapeBinder) aShapeBinder =
+ Handle(TransferBRep_ShapeBinder)::DownCast(theTransientProcess->MapItem(i));
if (aShapeBinder.IsNull() || aShapeBinder->Result().IsNull())
{
continue;
const TopoDS_Shape anOriginalShape = aShapeBinder->Result();
- if (aShapesMap.IsBound(anOriginalShape))
+ if (theModifiedShapesMap.IsBound(anOriginalShape))
{
- aShapeBinder->SetResult(aShapesMap.Find(anOriginalShape));
+ aShapeBinder->SetResult(theModifiedShapesMap.Find(anOriginalShape));
}
else if (!anOriginalShape.Location().IsIdentity())
{
TopLoc_Location aNullLoc;
TopoDS_Shape aTemporaryShape = anOriginalShape.Located(aNullLoc);
- if (aShapesMap.IsBound(aTemporaryShape))
+ if (theModifiedShapesMap.IsBound(aTemporaryShape))
{
- aShapeBinder->SetResult(aShapesMap.Find(aTemporaryShape));
+ aShapeBinder->SetResult(theModifiedShapesMap.Find(aTemporaryShape));
}
}
else
// Remember modifications.
for (TopExp_Explorer anExpSE(anOriginalShape, TopAbs_EDGE); anExpSE.More(); anExpSE.Next())
{
- if (aShapesMap.IsBound(anExpSE.Current()))
+ if (theModifiedShapesMap.IsBound(anExpSE.Current()))
{
aHasModifiedEdges = Standard_True;
- TopoDS_Shape aModifiedShape = aShapesMap.Find(anExpSE.Current());
+ TopoDS_Shape aModifiedShape = theModifiedShapesMap.Find(anExpSE.Current());
aReShaper.Replace(anExpSE.Current(), aModifiedShape);
}
}
}
// update messages
- addMessages(aMessages, anOriginalShape, aShapeBinder);
+ if (aToPrint)
+ {
+ addMessages(theMessages, anOriginalShape, aShapeBinder);
+ }
}
}
//=============================================================================
-void XSAlgo_ShapeProcessor::MergeTransferInfo(const Handle(Transfer_FinderProcess)& theFinderProcess) const
+void XSAlgo_ShapeProcessor::MergeTransferInfo(
+ const Handle(Transfer_TransientProcess)& theTransientProcess,
+ const Standard_Integer theFirstTPItemIndex) const
{
if (myContext.IsNull())
{
return;
}
+ return MergeShapeTransferInfo(theTransientProcess,
+ myContext->Map(),
+ theFirstTPItemIndex,
+ myContext->Messages());
+}
- const TopTools_DataMapOfShapeShape& aShapesMap = myContext->Map();
- Handle(ShapeExtend_MsgRegistrator) aMessages = myContext->Messages();
+//=============================================================================
+
+void XSAlgo_ShapeProcessor::MergeShapeTransferInfo(
+ const Handle(Transfer_FinderProcess)& theFinderProcess,
+ const TopTools_DataMapOfShapeShape& theModifiedShapesMap,
+ Handle(ShapeExtend_MsgRegistrator) theMessages)
+{
+ if (theModifiedShapesMap.IsEmpty())
+ {
+ return;
+ }
+ const bool aToPrint = !theMessages.IsNull() && !theMessages->MapShape().IsEmpty();
- for (TopTools_DataMapIteratorOfDataMapOfShapeShape ShapeShapeIterator(aShapesMap); ShapeShapeIterator.More();
+ for (TopTools_DataMapIteratorOfDataMapOfShapeShape ShapeShapeIterator(theModifiedShapesMap);
+ ShapeShapeIterator.More();
ShapeShapeIterator.Next())
{
- const TopoDS_Shape anOriginalShape = ShapeShapeIterator.Key();
- const TopoDS_Shape aResultShape = ShapeShapeIterator.Value();
+ const TopoDS_Shape anOriginalShape = ShapeShapeIterator.Key();
+ const TopoDS_Shape aResultShape = ShapeShapeIterator.Value();
- Handle(TransferBRep_ShapeMapper) aResultMapper = TransferBRep::ShapeMapper(theFinderProcess, aResultShape);
- Handle(Transfer_Binder) aResultBinder = theFinderProcess->Find(aResultMapper);
+ Handle(TransferBRep_ShapeMapper) aResultMapper =
+ TransferBRep::ShapeMapper(theFinderProcess, aResultShape);
+ Handle(Transfer_Binder) aResultBinder = theFinderProcess->Find(aResultMapper);
if (aResultBinder.IsNull())
{
aResultBinder = new TransferBRep_ShapeBinder(aResultShape);
- //if <orig> shape was split, put entities corresponding to new shapes
- // into Transfer_TransientListBinder.
+ // if <orig> shape was split, put entities corresponding to new shapes
+ // into Transfer_TransientListBinder.
if (anOriginalShape.ShapeType() > aResultShape.ShapeType())
{
TopoDS_Shape aSubShape;
- Handle(Transfer_TransientListBinder) aTransientListBinder = new Transfer_TransientListBinder;
- for (TopoDS_Iterator aSubShapeIter(aResultShape); aSubShapeIter.More(); aSubShapeIter.Next())
+ Handle(Transfer_TransientListBinder) aTransientListBinder =
+ new Transfer_TransientListBinder;
+ for (TopoDS_Iterator aSubShapeIter(aResultShape); aSubShapeIter.More();
+ aSubShapeIter.Next())
{
const TopoDS_Shape aCurrentSubShape = aSubShapeIter.Value();
- Handle(Transfer_Finder) aSubShapeMapper = TransferBRep::ShapeMapper(theFinderProcess, aCurrentSubShape);
+ Handle(Transfer_Finder) aSubShapeMapper =
+ TransferBRep::ShapeMapper(theFinderProcess, aCurrentSubShape);
if (aSubShapeMapper.IsNull())
{
continue;
}
- Handle(Standard_Transient) aTransientResult = theFinderProcess->FindTransient(aSubShapeMapper);
+ Handle(Standard_Transient) aTransientResult =
+ theFinderProcess->FindTransient(aSubShapeMapper);
if (aTransientResult.IsNull())
{
continue;
}
}
- Handle(TransferBRep_ShapeMapper) anOriginalMapper = TransferBRep::ShapeMapper(theFinderProcess, anOriginalShape);
- Handle(Transfer_Binder) anOriginalBinder = theFinderProcess->Find(anOriginalMapper);
+ Handle(TransferBRep_ShapeMapper) anOriginalMapper =
+ TransferBRep::ShapeMapper(theFinderProcess, anOriginalShape);
+ Handle(Transfer_Binder) anOriginalBinder = theFinderProcess->Find(anOriginalMapper);
if (anOriginalBinder.IsNull())
{
theFinderProcess->Bind(anOriginalMapper, aResultBinder);
}
// update messages
- addMessages(aMessages, anOriginalShape, aResultBinder);
+ if (aToPrint)
+ {
+ addMessages(theMessages, anOriginalShape, aResultBinder);
+ }
+ }
+}
+
+//=============================================================================
+
+void XSAlgo_ShapeProcessor::MergeTransferInfo(const Handle(Transfer_FinderProcess)& theFinderProcess) const
+{
+ if (myContext.IsNull())
+ {
+ return;
}
+ return MergeShapeTransferInfo(theFinderProcess, myContext->Map(), myContext->Messages());
}
//=============================================================================
#include <DE_ShapeFixParameters.hxx>
#include <ShapeProcess.hxx>
#include <TopAbs_ShapeEnum.hxx>
+#include <TopTools_DataMapOfShapeShape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
//! value associated with the key "xstep.cascade.unit".
Standard_EXPORT static void PrepareForTransfer();
+ //! Merge the results of the shape processing with the finder process.
+ //! @param theTransientProcess Transfer process to merge with.
+ //! @param theModifiedShapesMap Map of modified shapes.
+ //! @param theFirstTPItemIndex Index of the first item in the transfer process to merge with.
+ //! @param theMessages Messages to add.
+ Standard_EXPORT static void MergeShapeTransferInfo(
+ const Handle(Transfer_TransientProcess)& theFinderProcess,
+ const TopTools_DataMapOfShapeShape& theModifiedShapesMap,
+ const Standard_Integer theFirstTPItemIndex,
+ Handle(ShapeExtend_MsgRegistrator) theMessages);
+
+ //! Merge the results of the shape processing with the transfer process.
+ //! @param theTransientProcess Transfer process to merge with.
+ //! @param theModifiedShapesMap Map of modified shapes.
+ //! @param theFirstTPItemIndex Index of the first item in the transfer process to merge with.
+ //! @param theMessages Messages to add.
+ Standard_EXPORT static void MergeShapeTransferInfo(
+ const Handle(Transfer_FinderProcess)& theTransientProcess,
+ const TopTools_DataMapOfShapeShape& theModifiedShapesMap,
+ Handle(ShapeExtend_MsgRegistrator) theMessages);
+
private:
//! Initialize the context with the specified shape.
//! @param theShape Shape to process.