Loading files
// Created by: Eugeny MALTCHIKOV
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <BOPAlgo_Splitter.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_Alerts.hxx>
#include <TopoDS_Iterator.hxx>
//=================================================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter()
= default;
//=================================================================================================
BOPAlgo_Splitter::BOPAlgo_Splitter(const occ::handle<NCollection_BaseAllocator>& theAllocator)
: BOPAlgo_ToolsProvider(theAllocator)
{
}
//=================================================================================================
BOPAlgo_Splitter::~BOPAlgo_Splitter() = default;
//=================================================================================================
void BOPAlgo_Splitter::CheckData()
{
if (myArguments.IsEmpty() || (myArguments.Extent() + myTools.Extent()) < 2)
{
// too few arguments to process
AddError(new BOPAlgo_AlertTooFewArguments);
return;
}
//
CheckFiller();
}
//=================================================================================================
void BOPAlgo_Splitter::Perform(const Message_ProgressRange& theRange)
{
GetReport()->Clear();
//
if (myEntryPoint == 1)
{
delete myPaveFiller;
myPaveFiller = nullptr;
}
//
// prepare shapes for intersection
NCollection_List<TopoDS_Shape> aLS;
//
NCollection_List<TopoDS_Shape>::Iterator aItLS(myArguments);
for (; aItLS.More(); aItLS.Next())
{
aLS.Append(aItLS.Value());
}
//
aItLS.Initialize(myTools);
for (; aItLS.More(); aItLS.Next())
{
aLS.Append(aItLS.Value());
}
//
BOPAlgo_PaveFiller* pPF = new BOPAlgo_PaveFiller();
pPF->SetArguments(aLS);
pPF->SetRunParallel(myRunParallel);
pPF->SetFuzzyValue(myFuzzyValue);
pPF->SetNonDestructive(myNonDestructive);
pPF->SetGlue(myGlue);
pPF->SetUseOBB(myUseOBB);
//
Message_ProgressScope aPS(theRange, "Performing Split operation", 10);
pPF->Perform(aPS.Next(9));
//
myEntryPoint = 1;
PerformInternal(*pPF, aPS.Next(1));
}
//=================================================================================================
void BOPAlgo_Splitter::BuildResult(const TopAbs_ShapeEnum theType)
{
BOPAlgo_Builder::BuildResult(theType);
if (theType == TopAbs_COMPOUND)
{
// The method is called for the last time for this operation.
// If there is only one argument shape and it has been modified into
// a single shape, or has not been modified at all, the result shape
// has to be overwritten to avoid the unnecessary enclosure into compound.
if (myArguments.Extent() == 1)
{
TopoDS_Iterator it(myShape);
if (it.More())
{
const TopoDS_Shape& aSFirst = it.Value();
it.Next();
if (!it.More())
{
myShape = aSFirst;
}
}
}
}
}
3d097a032This file is pinned to the selected release. Download the original to open it in your design tool.