diff --git a/src/BOPAlgo/BOPAlgo_CellsBuilder.cxx b/src/BOPAlgo/BOPAlgo_CellsBuilder.cxx new file mode 100644 index 0000000000..5c13a2193c --- /dev/null +++ b/src/BOPAlgo/BOPAlgo_CellsBuilder.cxx @@ -0,0 +1,956 @@ +// Created by: Eugeny MALTCHIKOV +// Copyright (c) 2015 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 + +#include + +#include + +#include + +#include +#include + +#include + +#include + + +static + TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim); + +static + void MakeTypedContainers(const TopoDS_Shape& theSC, + const TopAbs_ShapeEnum aType, + TopoDS_Shape& theResult); + +//======================================================================= +//function : empty constructor +//purpose : +//======================================================================= +BOPAlgo_CellsBuilder::BOPAlgo_CellsBuilder() +: + BOPAlgo_Builder(), + myType(TopAbs_SHAPE), + myIndex(100, myAllocator), + myMaterials(100, myAllocator), + myShapeMaterial(100, myAllocator), + myMapGenerated(100, myAllocator) +{ +} + +//======================================================================= +//function : empty constructor +//purpose : +//======================================================================= +BOPAlgo_CellsBuilder::BOPAlgo_CellsBuilder + (const Handle(NCollection_BaseAllocator)& theAllocator) +: + BOPAlgo_Builder(theAllocator), + myType(TopAbs_SHAPE), + myIndex(100, myAllocator), + myMaterials(100, myAllocator), + myShapeMaterial(100, myAllocator), + myMapGenerated(100, myAllocator) +{ +} + +//======================================================================= +//function : ~ +//purpose : +//======================================================================= +BOPAlgo_CellsBuilder::~BOPAlgo_CellsBuilder() +{ + Clear(); +} + + +//======================================================================= +//function : Clear +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::Clear() +{ + BOPAlgo_Builder::Clear(); + myIndex.Clear(); + myMaterials.Clear(); + myShapeMaterial.Clear(); + myMapGenerated.Clear(); +} + +//======================================================================= +//function : GetAllParts +//purpose : +//======================================================================= +const TopoDS_Shape& BOPAlgo_CellsBuilder::GetAllParts() const +{ + return myAllParts; +} + +//======================================================================= +//function : Prepare +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::Prepare() +{ + BOPAlgo_Builder::Prepare(); + // + myFlagHistory=Standard_False; +} + +//======================================================================= +// function: CheckData +// purpose: +//======================================================================= +void BOPAlgo_CellsBuilder::CheckData() +{ + BOPAlgo_Builder::CheckData(); + if (myErrorStatus) { + return; + } + // + // additional check for the arguments to be of the same dimension. + Standard_Integer aDim1, aDimi; + BOPCol_ListIteratorOfListOfShape aIt; + // + aIt.Initialize(myArguments); + const TopoDS_Shape& aS1 = aIt.Value(); + aDim1 = BOPTools_AlgoTools::Dimension(aS1); + // + for (aIt.Next(); aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSi = aIt.Value(); + aDimi = BOPTools_AlgoTools::Dimension(aSi); + // + if (aDim1 != aDimi) { + myErrorStatus = 201; // non-homogenous arguments + break; + } + } +} + +//======================================================================= +//function : PerformInternal1 +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::PerformInternal1(const BOPAlgo_PaveFiller& theFiller) +{ + BOPAlgo_Builder::PerformInternal1(theFiller); + // + if (myErrorStatus) { + return; + } + // + // save the splits to + TakeAllParts(); + // + // index all the parts to its origins + IndexParts(); + // + // and nullify for building the result; + RemoveAllFromResult(); + // + myFlagHistory = Standard_True; +} + +//======================================================================= +//function : TakeAllParts +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::TakeAllParts() +{ + Standard_Integer aDim; + TopoDS_Compound aC; + BRep_Builder aBB; + // + aDim = BOPTools_AlgoTools::Dimension(myArguments.First()); + myType = TypeToExplore(aDim); + // + aBB.MakeCompound(aC); + TopExp_Explorer aExp(myShape, myType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aS = aExp.Current(); + aBB.Add(aC, aS); + } + myAllParts = aC; +} + +//======================================================================= +//function : IndexParts +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::IndexParts() +{ + BOPCol_ListIteratorOfListOfShape aIt, aItIm; + TopExp_Explorer aExp; + // + aIt.Initialize(myArguments); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS = aIt.Value(); + // + aExp.Init(aS, myType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aST = aExp.Current(); + if (!myImages.IsBound(aST)) { + BOPCol_ListOfShape aLS; + aLS.Append(aS); + myIndex.Add(aST, aLS); + continue; + } + // + const BOPCol_ListOfShape& aLSIm = myImages.Find(aST); + aItIm.Initialize(aLSIm); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aSTIm = aItIm.Value(); + // + if (myIndex.Contains(aSTIm)) { + BOPCol_ListOfShape& aLS = myIndex.ChangeFromKey(aSTIm); + aLS.Append(aS); + } + else { + BOPCol_ListOfShape aLS; + aLS.Append(aS); + myIndex.Add(aSTIm, aLS); + } + } // for (; aItIm.More(); aItIm.Next()) { + } // for (; aExp.More(); aExp.Next()) { + } // for (; aIt.More(); aIt.Next()) { +} + +//======================================================================= +//function : AddToResult +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::AddToResult(const BOPCol_ListOfShape& theLSToTake, + const BOPCol_ListOfShape& theLSToAvoid, + const Standard_Integer theMaterial, + const Standard_Boolean theUpdate) +{ + // find parts + BOPCol_ListOfShape aParts; + FindParts(theLSToTake, theLSToAvoid, aParts); + if (aParts.IsEmpty()) { + return; + } + // + Standard_Boolean bChanged; + BRep_Builder aBB; + BOPCol_MapOfShape aResParts; + TopExp_Explorer aExp; + BOPCol_ListIteratorOfListOfShape aIt; + // + bChanged = Standard_False; + // collect result parts to avoid multiple adding of the same parts + aExp.Init(myShape, myType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aPart = aExp.Current(); + aResParts.Add(aPart); + } + // add parts to result + aIt.Initialize(aParts); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aPart = aIt.Value(); + if (aResParts.Add(aPart)) { + aBB.Add(myShape, aPart); + bChanged = Standard_True; + } + } + // + // update the material + if (theMaterial != 0) { + BOPCol_ListOfShape aLSP; + aIt.Initialize(aParts); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aPart = aIt.Value(); + if (!myShapeMaterial.IsBound(aPart)) { + myShapeMaterial.Bind(aPart, theMaterial); + aLSP.Append(aPart); + } + } // for (; aIt.More(); aIt.Next()) { + // + if (aLSP.Extent()) { + if (myMaterials.IsBound(theMaterial)) { + BOPCol_ListOfShape& aLS = myMaterials.ChangeFind(theMaterial); + aLS.Append(aLSP); + } // if (myMaterials.IsBound(theMaterial)) { + else { + myMaterials.Bind(theMaterial, aLSP); + } + } // if (aLSP.Extent()) { + } // if (theMaterial != 0) { + // + if (!theUpdate) { + if (bChanged) { + PrepareHistory(); + } + } + else { + RemoveInternalBoundaries(); + } +} + +//======================================================================= +//function : AddAllToResult +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::AddAllToResult(const Standard_Integer theMaterial, + const Standard_Boolean theUpdate) +{ + TopoDS_Compound aResult; + BRep_Builder aBB; + BOPCol_ListOfShape aLSM; + // + aBB.MakeCompound(aResult); + myShapeMaterial.Clear(); + myMaterials.Clear(); + myMapGenerated.Clear(); + // + TopoDS_Iterator aIt(myAllParts); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aPart = aIt.Value(); + aBB.Add(aResult, aPart); + // + if (theMaterial != 0) { + myShapeMaterial.Bind(aPart, theMaterial); + aLSM.Append(aPart); + } + } + // + myShape = aResult; + // + if (theMaterial != 0) { + myMaterials.Bind(theMaterial, aLSM); + } + // + if (!theUpdate) { + PrepareHistory(); + } + else { + RemoveInternalBoundaries(); + } +} + +//======================================================================= +//function : RemoveFromResult +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::RemoveFromResult(const BOPCol_ListOfShape& theLSToTake, + const BOPCol_ListOfShape& theLSToAvoid) +{ + // find parts + BOPCol_ListOfShape aParts; + FindParts(theLSToTake, theLSToAvoid, aParts); + if (aParts.IsEmpty()) { + return; + } + // + BOPCol_MapOfShape aPartsToRemove; + BOPCol_ListIteratorOfListOfShape aItP, aItM; + // + // collect parts into the map and remove parts from materials + aItP.Initialize(aParts); + for (; aItP.More(); aItP.Next()) { + const TopoDS_Shape& aPart = aItP.Value(); + aPartsToRemove.Add(aPart); + // + if (myShapeMaterial.IsBound(aPart)) { + Standard_Integer iMaterial = myShapeMaterial.Find(aPart); + if (!myMaterials.IsBound(iMaterial)) { + myShapeMaterial.UnBind(aPart); + continue; + } + // + BOPCol_ListOfShape& aLSM = myMaterials.ChangeFind(iMaterial); + // + aItM.Initialize(aLSM); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aSM = aItM.Value(); + if (aSM.IsSame(aPart)) { + aLSM.Remove(aItM); + break; + } // if (aSM.IsSame(aPart)) { + } // for (; aItM.More(); aItM.Next()) { + // + myShapeMaterial.UnBind(aPart); + } // if (myShapeMaterial.IsBound(aPart)) { + } // for (; aItP.More(); aItP.Next()) { + // + Standard_Boolean bChanged; + TopoDS_Compound aResult; + BRep_Builder aBB; + TopoDS_Iterator aIt1, aIt2; + TopAbs_ShapeEnum aType; + // + aBB.MakeCompound(aResult); + bChanged = Standard_False; + // + aIt1.Initialize(myShape); + for (; aIt1.More(); aIt1.Next()) { + const TopoDS_Shape& aS = aIt1.Value(); + aType = aS.ShapeType(); + // + if (aType == myType) { + // basic element + if (aPartsToRemove.Contains(aS)) { + bChanged = Standard_True; + continue; + } + aBB.Add(aResult, aS); + } // if (aType == myType) { + else { + // container + Standard_Boolean bNotEmpty; + TopoDS_Compound aSC; + aBB.MakeCompound(aSC); + // + bNotEmpty = Standard_False; + aIt2.Initialize(aS); + for (; aIt2.More(); aIt2.Next()) { + const TopoDS_Shape& aSS = aIt2.Value(); + if (aPartsToRemove.Contains(aSS)) { + bChanged = Standard_True; + continue; + } + aBB.Add(aSC, aSS); + bNotEmpty = Standard_True; + } // for (; aIt2.More(); aIt2.Next()) { + // + if (bNotEmpty) { + MakeTypedContainers(aSC, myType, aResult); + } + } // else { + } // for (; aIt1.More(); aIt1.Next()) { + // + if (bChanged) { + myShape = aResult; + // + PrepareHistory(); + } +} + +//======================================================================= +//function : RemoveAllFromResult +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::RemoveAllFromResult() +{ + // empty compound + TopoDS_Compound aC; + BRep_Builder aBB; + // + aBB.MakeCompound(aC); + myShape = aC; + // + myMaterials.Clear(); + myShapeMaterial.Clear(); + myMapGenerated.Clear(); + // + PrepareHistory(); +} + +//======================================================================= +//function : RemoveInternalBoundaries +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::RemoveInternalBoundaries() +{ + if (myMaterials.IsEmpty()) { + return; + } + // + Standard_Integer iMaterial, iErr; + TopoDS_Compound aResult; + BRep_Builder aBB; + TopExp_Explorer aExp; + BOPCol_ListIteratorOfListOfShape aItS; + BOPCol_DataMapIteratorOfDataMapOfIntegerListOfShape aItM; + // + aBB.MakeCompound(aResult); + aExp.Init(myShape, myType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aS = aExp.Current(); + if (!myShapeMaterial.IsBound(aS)) { + aBB.Add(aResult, aS); + } + } + // + aItM.Initialize(myMaterials); + for (; aItM.More(); aItM.Next()) { + iMaterial = aItM.Key(); + // + BOPCol_ListOfShape aLSNew; + BOPCol_ListOfShape& aLS = myMaterials(iMaterial); + iErr = RemoveInternals(aLS, aLSNew); + if (iErr || aLSNew.IsEmpty()) { + myErrorStatus = 202; // unable to remove internal boundaries + return; + } + // + // update materials maps and add new shapes to result + aLS.Assign(aLSNew); + aItS.Initialize(aLSNew); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aS = aItS.Value(); + aBB.Add(aResult, aS); + if (!myShapeMaterial.IsBound(aS)) { + myShapeMaterial.Bind(aS, iMaterial); + } + } + } + // + myShape = aResult; + // + PrepareHistory(); +} + +//======================================================================= +//function : FindPart +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::FindParts(const BOPCol_ListOfShape& theLSToTake, + const BOPCol_ListOfShape& theLSToAvoid, + BOPCol_ListOfShape& theParts) +{ + if (theLSToTake.IsEmpty()) { + return; + } + // + Standard_Boolean bFound; + Standard_Integer aNbS; + BOPCol_ListIteratorOfListOfShape aItIm, aItArgs; + BOPCol_MapOfShape aMSToTake, aMSToAvoid, aMS; + TopExp_Explorer aExp; + // + aItArgs.Initialize(theLSToAvoid); + for (; aItArgs.More(); aItArgs.Next()) { + const TopoDS_Shape& aS = aItArgs.Value(); + aMSToAvoid.Add(aS); + } + // + aItArgs.Initialize(theLSToTake); + for (; aItArgs.More(); aItArgs.Next()) { + const TopoDS_Shape& aS = aItArgs.Value(); + aMSToTake.Add(aS); + } + // + aNbS = aMSToTake.Extent(); + // + const TopoDS_Shape& aSToTake = theLSToTake.First(); + aExp.Init(aSToTake, myType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aST = aExp.Current(); + BOPCol_ListOfShape aLSTIm; + if (!myImages.IsBound(aST)) { + aLSTIm.Append(aST); + } else { + aLSTIm = myImages.Find(aST); + } + // + aItIm.Initialize(aLSTIm); + for (; aItIm.More(); aItIm.Next()) { + const TopoDS_Shape& aPart = aItIm.Value(); + // + if (!myIndex.Contains(aPart)) { + continue; + } + // + const BOPCol_ListOfShape& aLS = myIndex.FindFromKey(aPart); + if (aLS.Extent() < aNbS) { + continue; + } + // + aMS.Clear(); + aItArgs.Initialize(aLS); + for (bFound = Standard_True; aItArgs.More() && bFound; aItArgs.Next()) { + const TopoDS_Shape& aS = aItArgs.Value(); + bFound = !aMSToAvoid.Contains(aS); + aMS.Add(aS); + } + // + if (!bFound) { + continue; + } + // + aItArgs.Initialize(theLSToTake); + for (; aItArgs.More() && bFound; aItArgs.Next()) { + const TopoDS_Shape& aS = aItArgs.Value(); + bFound = aMS.Contains(aS); + } + // + if (bFound) { + theParts.Append(aPart); + } // if (bFound) { + } // for (; aItIm.More(); aItIm.Next()) { + } // for (; aExp.More(); aExp.Next()) { +} + +//======================================================================= +//function : MakeContainers +//purpose : +//======================================================================= +void BOPAlgo_CellsBuilder::MakeContainers() +{ + TopoDS_Compound aResult; + BRep_Builder aBB; + // + aBB.MakeCompound(aResult); + MakeTypedContainers(myShape, myType, aResult); + myShape = aResult; +} + +//======================================================================= +//function : RemoveInternals +//purpose : +//======================================================================= +Standard_Integer BOPAlgo_CellsBuilder::RemoveInternals(const BOPCol_ListOfShape& theLS, + BOPCol_ListOfShape& theLSNew) +{ + Standard_Integer iErr = 0; + if (theLS.Extent() < 2) { + theLSNew = theLS; + return iErr; + } + // + BOPCol_ListIteratorOfListOfShape aIt; + TopExp_Explorer aExp; + // + TopAbs_ShapeEnum aType = theLS.First().ShapeType(); + // + if (aType == TopAbs_EDGE || + aType == TopAbs_FACE) { + // + // make container + BRep_Builder aBB; + TopoDS_Shape aShape; + // + BOPTools_AlgoTools::MakeContainer + ((aType == TopAbs_FACE) ? TopAbs_SHELL : TopAbs_WIRE, aShape); + // + aIt.Initialize(theLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS = aIt.Value(); + aBB.Add(aShape, aS); + } + // + // Unify same domain + Standard_Boolean bFaces, bEdges; + // + bFaces = (aType == TopAbs_FACE); + bEdges = (aType == TopAbs_EDGE); + // + ShapeUpgrade_UnifySameDomain anUnify (aShape, bEdges, bFaces); + anUnify.Build(); + const TopoDS_Shape& aSNew = anUnify.Shape(); + // + aExp.Init(aSNew, aType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aSn = aExp.Current(); + theLSNew.Append(aSn); + } + // + // fill map of generated shapes + BOPCol_IndexedMapOfShape aMG; + Standard_Integer i, aNb; + // + BOPTools::MapShapes(aShape, TopAbs_VERTEX, aMG); + BOPTools::MapShapes(aShape, TopAbs_EDGE, aMG); + BOPTools::MapShapes(aShape, TopAbs_FACE, aMG); + // + aNb = aMG.Extent(); + for (i = 1; i <= aNb; ++i) { + const TopoDS_Shape& aSS = aMG(i); + const TopoDS_Shape& aSNew = anUnify.Generated(aSS); + if (!aSNew.IsNull() && !aSS.IsSame(aSNew)) { + myMapGenerated.Bind(aSS, aSNew); + } + } + } + else if (aType == TopAbs_SOLID) { + // build all solids from the faces + BOPCol_ListOfShape aLSF; + // + aIt.Initialize(theLS); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS = aIt.Value(); + // + aExp.Init(aS, TopAbs_FACE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aF = aExp.Current(); + aLSF.Append(aF); + } + } + // + BOPAlgo_BuilderSolid aBS; + aBS.SetShapes(aLSF); + aBS.Perform(); + // + iErr = aBS.ErrorStatus(); + if (iErr) { + return iErr; + } + // + theLSNew = aBS.Areas(); + if (theLSNew.Extent() == 1) { + return iErr; + } + // + // result is a list of solids. we need to select external faces. + BOPCol_IndexedDataMapOfShapeListOfShape aDMFS; + BOPCol_ListOfShape aLFNew; + Standard_Integer i, aNb; + // + // map faces and solids + BOPCol_ListIteratorOfListOfShape aIt(theLSNew); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS = aIt.Value(); + // + aExp.Init(aS, TopAbs_FACE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aF = aExp.Current(); + if (aDMFS.Contains(aF)) { + BOPCol_ListOfShape& aLFS = aDMFS.ChangeFromKey(aF); + aLFS.Append(aS); + } + else { + BOPCol_ListOfShape aLFS; + aLFS.Append(aS); + aDMFS.Add(aF, aLFS); + } + } + } + // + // select faces attached to only one solid + aNb = aDMFS.Extent(); + for (i = 1; i <= aNb; ++i) { + const BOPCol_ListOfShape& aLS = aDMFS(i); + if (aLS.Extent() == 1) { + const TopoDS_Shape& aF = aDMFS.FindKey(i); + aLFNew.Append(aF); + } + } + // + if (aNb == aLFNew.Extent()) { + return iErr; + } + // + // build new solid + BOPAlgo_BuilderSolid aBS1; + aBS1.SetShapes(aLFNew); + aBS1.Perform(); + // + iErr = aBS1.ErrorStatus(); + if (iErr) { + return iErr; + } + // + theLSNew = aBS1.Areas(); + } + // + return iErr; +} + +//======================================================================= +//function : IsDeleted +//purpose : +//======================================================================= +Standard_Boolean BOPAlgo_CellsBuilder::IsDeleted(const TopoDS_Shape& theS) +{ + Standard_Boolean bRet = Standard_True; + if (theS.IsNull()) { + return bRet; + } + // + TopAbs_ShapeEnum aType = theS.ShapeType(); + if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE || + aType==TopAbs_VERTEX || aType==TopAbs_SOLID)) { + return bRet; + } + // + Standard_Boolean bHasImage, bHasGenerated; + // + bHasImage = myImages.IsBound(theS); + bHasGenerated = myMapGenerated.IsBound(theS); + if (!bHasImage && !bHasGenerated) { + bRet = !myMapShape.Contains(theS); + return bRet; + } + // + if (bHasGenerated) { + const TopoDS_Shape& aSG = myMapGenerated.Find(theS); + if (myMapShape.Contains(aSG)) { + bRet = Standard_False; + return bRet; + } + } + // + if (bHasImage) { + const BOPCol_ListOfShape& aLSp = myImages.Find(theS); + BOPCol_ListIteratorOfListOfShape aIt(aLSp); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aSp = aIt.Value(); + const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ? + myShapesSD.Find(aSp) : aSp; + // + const TopoDS_Shape& aSpRG = myMapGenerated.IsBound(aSpR) ? + myMapGenerated.Find(aSpR) : aSpR; + if (myMapShape.Contains(aSpRG)) { + bRet = Standard_False; + break; + } + } + } + // + return bRet; +} + +//======================================================================= +//function : Generated +//purpose : +//======================================================================= +const TopTools_ListOfShape& BOPAlgo_CellsBuilder::Generated(const TopoDS_Shape& theS) +{ + myHistShapes.Clear(); + if (theS.IsNull()) { + return myHistShapes; + } + // + TopAbs_ShapeEnum aType = theS.ShapeType(); + if (!(aType==TopAbs_EDGE || aType==TopAbs_FACE || aType==TopAbs_VERTEX)) { + return myHistShapes; + } + // + Standard_Boolean bHasGenerated = myMapGenerated.IsBound(theS); + if (bHasGenerated) { + const TopoDS_Shape& aSG = myMapGenerated.Find(theS); + if (myMapShape.Contains(aSG)) { + myHistShapes.Append(aSG); + } + return myHistShapes; + } + // + Standard_Boolean bHasImage = myImages.IsBound(theS); + if (!bHasImage) { + return myHistShapes; + } + // + BOPCol_MapOfShape aMFence; + const BOPCol_ListOfShape& aLSp = myImages.Find(theS); + BOPCol_ListIteratorOfListOfShape aIt(aLSp); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape aSp = aIt.Value(); + const TopoDS_Shape& aSpR = myShapesSD.IsBound(aSp) ? + myShapesSD.Find(aSp) : aSp; + // + if (myMapGenerated.IsBound(aSpR)) { + const TopoDS_Shape& aSG = myMapGenerated.Find(aSpR); + if (myMapShape.Contains(aSG)) { + if (aMFence.Add(aSG)) { + myHistShapes.Append(aSG); + } + } + } + } + // + return myHistShapes; +} + +//======================================================================= +//function : MakeTypedContainers +//purpose : +//======================================================================= +void MakeTypedContainers(const TopoDS_Shape& theSC, + const TopAbs_ShapeEnum aType, + TopoDS_Shape& theResult) +{ + TopAbs_ShapeEnum aContainerType, aConnexityType, aPartType; + // + aPartType = aType; + switch (aPartType) { + case TopAbs_EDGE: { + aContainerType = TopAbs_WIRE; + aConnexityType = TopAbs_VERTEX; + break; + } + case TopAbs_FACE: { + aContainerType = TopAbs_SHELL; + aConnexityType = TopAbs_EDGE; + break; + } + case TopAbs_SOLID: { + aContainerType = TopAbs_COMPSOLID; + aConnexityType = TopAbs_FACE; + break; + } + default: + return; + } + // + BOPCol_ListOfShape aLCB; + BOPTools_AlgoTools::MakeConnexityBlocks(theSC, aConnexityType, aPartType, aLCB); + if (aLCB.IsEmpty()) { + return; + } + // + BRep_Builder aBB; + TopExp_Explorer aExp; + BOPCol_ListIteratorOfListOfShape aItCB; + // + aItCB.Initialize(aLCB); + for (; aItCB.More(); aItCB.Next()) { + TopoDS_Shape aRCB; + BOPTools_AlgoTools::MakeContainer(aContainerType, aRCB); + // + const TopoDS_Shape& aCB = aItCB.Value(); + aExp.Init(aCB, aPartType); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aCBS = aExp.Current(); + aBB.Add(aRCB, aCBS); + } + // + if (aContainerType == TopAbs_SHELL) { + BOPTools_AlgoTools::OrientFacesOnShell(aRCB); + } + // + aBB.Add(theResult, aRCB); + } +} + +//======================================================================= +//function : TypeToExplore +//purpose : +//======================================================================= +TopAbs_ShapeEnum TypeToExplore(const Standard_Integer theDim) +{ + TopAbs_ShapeEnum aRet; + // + switch(theDim) { + case 0: + aRet=TopAbs_VERTEX; + break; + case 1: + aRet=TopAbs_EDGE; + break; + case 2: + aRet=TopAbs_FACE; + break; + case 3: + aRet=TopAbs_SOLID; + break; + default: + aRet=TopAbs_SHAPE; + break; + } + return aRet; +} diff --git a/src/BOPAlgo/BOPAlgo_CellsBuilder.hxx b/src/BOPAlgo/BOPAlgo_CellsBuilder.hxx new file mode 100644 index 0000000000..49c7f92639 --- /dev/null +++ b/src/BOPAlgo/BOPAlgo_CellsBuilder.hxx @@ -0,0 +1,263 @@ +// Created by: Eugeny MALTCHIKOV +// Copyright (c) 2015 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. + + +#ifndef _BOPAlgo_CellsBuilder_HeaderFile +#define _BOPAlgo_CellsBuilder_HeaderFile + +#include +#include + +#include + +#include + +#include + +#include +#include +#include +#include +#include + +//! +//! The algorithm is based on the General Fuse algorithm (GFA). The result of +//! GFA is all split parts of the Arguments. +//! +//! The purpose of this algorithm is to provide the result with the content of: +//! 1. Cells (parts) defined by the user; +//! 2. Internal boundaries defined by the user. +//! +//! In other words the algorithm should provide the possibility for the user +//! to add or remove any part to (from) result and remove any internal boundaries +//! between parts. +//! +//! Requirements for the Data: +//! All the requirements of GFA for the DATA are inherited in this algorithm. +//! Plus all the arguments should have the same dimension. +//! +//! Results: +//! The result of the algorithm is compound containing selected parts of +//! the basic type (VERTEX, EDGE, FACE or SOLID). The default result +//! is empty compound. It is possible to add any split part to the result +//! by using the methods AddToRessult() and AddAllToResult(). +//! It is also possible to remove any part from the result by using methods +//! RemoveFromResult() and RemoveAllFromResult(). +//! The method RemoveAllFromResult() is also suitable for clearing the result. +//! +//! To remove Internal boundaries it is necessary to set the same material to the +//! parts between which the boundaries should be removed and call the method +//! RemoveInternalBoundaries(). The material should not be equal to 0, as this is +//! default material value. The boundaries between parts with this value +//! will not be removed. +//! One part cannot be added with the different materials. +//! It is also possible to remove the boundaries during combining the result. +//! To do this it is necessary to set the material for parts (not equal to 0) +//! and set the flag bUpdate to TRUE. +//! BUT for the arguments of the types FACE or EDGE it is recommended +//! to remove the boundaries in the end when the result is completely built. +//! It will help to avoid self-intersections in the result. +//! +//! It is possible to create typed Containers from the parts added to result by using +//! method MakeContainers(). The type of the containers will depend on the type of +//! the arguments: WIRES for EEDGE, SHELLS for FACES and COMPSOLIDS for SOLIDS. +//! The result will be compound containing containers. +//! Adding of the parts to such result will not update containers. The result +//! compound will contain the containers and new added parts (of basic type). +//! Removing of the parts from such result may affect some containers if the +//! the parts that should be removed is in container. In this case this container +//! will be rebuilt without that part. +//! +//! History: +//! The algorithm supports history information for basic types of the shapes - +//! VERTEX, EDGE, FACE. This information available through the methods +//! IsDeleted() and Modified(). In DRAW Test Harness it is available through the same +//! commands as for Boolean Operations (bmodified, bgenerated and bisdeleted). +//! There could be Generated shapes only after removing of the internal boundaries +//! between faces and edges, i.e. after using ShapeUpgrade_UnifySameDomain tool. +//! +//! Examples: +//! 1. API +//! BOPAlgo_CellsBuilder aCBuilder; +//! BOPCol_ListOfShape aLS = ...; // arguments +//! /* parallel or single mode (the default value is FALSE)*/ +//! Standard_Boolean bRunParallel = Standard_False; +//! /* fuzzy option (default value is 0)*/ +//! Standard_Real aTol = 0.0; +//! // +//! aCBuilder.SetArguments(aLS); +//! aCBuilder.SetRunParallel(bRunParallel); +//! aCBuilder.SetFuzzyValue(aTol); +//! // +//! aCBuilder.Perform(); +//! if (aCBuilder.ErrorStatus()) { // check error status +//! return; +//! } +//! /* empty compound, as nothing has been added yet */ +//! const TopoDS_Shape& aRes = aCBuilder.Shape(); +//! /* all split parts */ +//! const TopoDS_Shape& aRes = aCBuilder.GetAllParts(); +//! // +//! BOPCol_ListOfShape aLSToTake = ...; // parts of these arguments will be taken into result +//! BOPCol_ListOfShape aLSToAvoid = ...; // parts of these arguments will not be taken into result +//! // +//! /* defines the material common for the cells, i.e. +//! the boundaries between cells with the same material +//! will be removed. +//! By default it is set to 0. Thus, to remove some boundary +//! the value of this variable should not be equal to 0 */ +//! Standard_Integer iMaterial = ...; +//! /* defines whether to update the result right now or not */ +//! Standard_Boolean bUpdate = ...; +//! // adding to result +//! aCBuilder.AddToResult(aLSToTake, aLSToAvoid, iMaterial, bUpdate); +//! aR = aCBuilder.Shape(); // the result +//! // removing of the boundaries +//! aCBuilder.RemoveInternalBoundaries(); +//! +//! // removing from result +//! aCBuilder.AddAllToResult(); +//! aCBuilder.RemoveFromResult(aLSToTake, aLSToAvoid); +//! aR = aCBuilder.Shape(); // the result +//! +//! +//! 2. DRAW Test Harness +//! psphere s1 15 +//! psphere s2 15 +//! psphere s3 15 +//! ttranslate s1 0 0 10 +//! ttranslate s2 20 0 10 +//! ttranslate s3 10 0 0 +//! +//! bclearobjects; bcleartools +//! baddobjects s1 s2 s3 +//! bfillds +//! # rx will contain all split parts +//! bcbuild rx +//! # add to result the part that is common for all three spheres +//! bcadd res s1 1 s2 1 s3 1 -m 1 +//! # add to result the part that is common only for first and third shperes +//! bcadd res s1 1 s2 0 s3 1 -m 1 +//! # remove internal boundaries +//! bcremoveint res +//! + + +class BOPAlgo_CellsBuilder : public BOPAlgo_Builder +{ + public: + + DEFINE_STANDARD_ALLOC + + Standard_EXPORT BOPAlgo_CellsBuilder(); + + Standard_EXPORT BOPAlgo_CellsBuilder(const Handle(NCollection_BaseAllocator)& theAllocator); + + Standard_EXPORT virtual ~BOPAlgo_CellsBuilder(); + + //! Redefined method Clear - clears the contents. + Standard_EXPORT virtual void Clear() Standard_OVERRIDE; + + //! Adding the parts to result. + //! The parts are defined by two lists of shapes. + //! defines the arguments which parts should be taken into result; + //! defines the arguments which parts should not be taken into result; + //! To be taken into result the part must be IN for all shapes from the list + //! and must be OUT of all shapes from the list . + //! + //! To remove internal boundaries between any cells in the result + //! variable should be used. The boundaries between + //! cells with the same material will be removed. Default value is 0. + //! Thus, to remove any boundary the value of this variable should not be equal to 0. + //! parameter defines whether to remove boundaries now or not + Standard_EXPORT void AddToResult(const BOPCol_ListOfShape& theLSToTake, + const BOPCol_ListOfShape& theLSToAvoid, + const Standard_Integer theMaterial = 0, + const Standard_Boolean theUpdate = Standard_False); + + //! Add all split parts to result + //! defines the removal of internal boundaries; + //! parameter defines whether to remove boundaries now or not. + Standard_EXPORT void AddAllToResult(const Standard_Integer theMaterial = 0, + const Standard_Boolean theUpdate = Standard_False); + + //! Removing the parts from result. + //! The parts are defined by two lists of shapes. + //! defines the arguments which parts should be removed from result; + //! defines the arguments which parts should not be removed from result. + //! To be removed from the result the part must be IN for all shapes from the list + //! and must be OUT of all shapes from the list . + Standard_EXPORT void RemoveFromResult(const BOPCol_ListOfShape& theLSToTake, + const BOPCol_ListOfShape& theLSToAvoid); + + //! Remove all parts from result. + Standard_EXPORT void RemoveAllFromResult(); + + //! Removes internal boundaries between cells with the same material. + Standard_EXPORT void RemoveInternalBoundaries(); + + //! Get all split parts. + Standard_EXPORT const TopoDS_Shape& GetAllParts() const; + + //! Makes the Containers of proper type from the parts added to result. + Standard_EXPORT void MakeContainers(); + + //! Returns the list of shapes generated from the shape theS. + Standard_EXPORT virtual const TopTools_ListOfShape& Generated(const TopoDS_Shape& theS) Standard_OVERRIDE; + + //! Returns true if the shape theS has been deleted. + Standard_EXPORT virtual Standard_Boolean IsDeleted (const TopoDS_Shape& theS) Standard_OVERRIDE; + + protected: + + //! Redefined method Prepare - no need to prepare history + //! information on the default result as it is empty compound. + Standard_EXPORT virtual void Prepare() Standard_OVERRIDE; + + //! Redefined method CheckData() - additional check for the arguments + //! to be of the same dimension. + Standard_EXPORT virtual void CheckData() Standard_OVERRIDE; + + //! Redefined method PerformInternal1 - makes all split parts, + //! nullifies the result , and index all parts. + Standard_EXPORT virtual void PerformInternal1 (const BOPAlgo_PaveFiller& thePF); + + //! Saves all split parts in myAllParts. + Standard_EXPORT void TakeAllParts(); + + //! Indexes the parts for quick access to the arguments. + Standard_EXPORT void IndexParts(); + + //! Looking for the parts defined by two lists. + Standard_EXPORT void FindParts(const BOPCol_ListOfShape& theLSToTake, + const BOPCol_ListOfShape& theLSToAvoid, + BOPCol_ListOfShape& theParts); + + //! Removes internal boundaries between cells with the same material. + Standard_EXPORT Standard_Integer RemoveInternals(const BOPCol_ListOfShape& theLS, + BOPCol_ListOfShape& theLSNew); + + // fields + TopAbs_ShapeEnum myType; + TopoDS_Shape myAllParts; + BOPCol_IndexedDataMapOfShapeListOfShape myIndex; + BOPCol_DataMapOfIntegerListOfShape myMaterials; + BOPCol_DataMapOfShapeInteger myShapeMaterial; + BOPCol_DataMapOfShapeShape myMapGenerated; + + private: + +}; + +#endif //_BOPAlgo_CellsBuilder_HeaderFile diff --git a/src/BOPAlgo/FILES b/src/BOPAlgo/FILES index 1111870102..61be71ef13 100644 --- a/src/BOPAlgo/FILES +++ b/src/BOPAlgo/FILES @@ -63,3 +63,5 @@ BOPAlgo_WireSplitter.cxx BOPAlgo_WireSplitter.hxx BOPAlgo_WireSplitter.lxx BOPAlgo_WireSplitter_1.cxx +BOPAlgo_CellsBuilder.cxx +BOPAlgo_CellsBuilder.hxx \ No newline at end of file diff --git a/src/BOPTest/BOPTest.cxx b/src/BOPTest/BOPTest.cxx index 995548153f..c69edf1c57 100644 --- a/src/BOPTest/BOPTest.cxx +++ b/src/BOPTest/BOPTest.cxx @@ -42,6 +42,7 @@ void BOPTest::AllCommands(Draw_Interpretor& theCommands) BOPTest::APICommands (theCommands); BOPTest::OptionCommands (theCommands); BOPTest::HistoryCommands (theCommands); + BOPTest::CellsCommands (theCommands); } //======================================================================= //function : Factory diff --git a/src/BOPTest/BOPTest.hxx b/src/BOPTest/BOPTest.hxx index 94d55ae7ff..8b966ccccf 100644 --- a/src/BOPTest/BOPTest.hxx +++ b/src/BOPTest/BOPTest.hxx @@ -55,6 +55,7 @@ public: Standard_EXPORT static void HistoryCommands (Draw_Interpretor& aDI); + Standard_EXPORT static void CellsCommands (Draw_Interpretor& aDI); protected: diff --git a/src/BOPTest/BOPTest_CellsCommands.cxx b/src/BOPTest/BOPTest_CellsCommands.cxx new file mode 100644 index 0000000000..8956cdb906 --- /dev/null +++ b/src/BOPTest/BOPTest_CellsCommands.cxx @@ -0,0 +1,333 @@ +// Created by: Eugeny MALTCHIKOV +// Copyright (c) 2015 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 +#include + +#include +#include +#include + +#include +#include +#include + + +static Standard_Integer bcbuild (Draw_Interpretor&, Standard_Integer, const char**); +static Standard_Integer bcaddall (Draw_Interpretor&, Standard_Integer, const char**); +static Standard_Integer bcremoveall (Draw_Interpretor&, Standard_Integer, const char**); +static Standard_Integer bcadd (Draw_Interpretor&, Standard_Integer, const char**); +static Standard_Integer bcremove (Draw_Interpretor&, Standard_Integer, const char**); +static Standard_Integer bcremoveint (Draw_Interpretor&, Standard_Integer, const char**); +static Standard_Integer bcmakecontainers (Draw_Interpretor&, Standard_Integer, const char**); + +//======================================================================= +//function : CellsCommands +//purpose : +//======================================================================= +void BOPTest::CellsCommands(Draw_Interpretor& theCommands) +{ + static Standard_Boolean done = Standard_False; + if (done) return; + done = Standard_True; + // Chapter's name + const char* g = "BOPTest commands"; + // Commands + + theCommands.Add("bcbuild", "Cells builder. Use: bcbuild r", + __FILE__, bcbuild, g); + theCommands.Add("bcaddall", "Add all parts to result. Use: bcaddall r [-m material [-u]]", + __FILE__, bcaddall, g); + theCommands.Add("bcremoveall", "Remove all parts from result. Use: bcremoveall", + __FILE__, bcremoveall, g); + theCommands.Add("bcadd", "Add parts to result. Use: bcadd r s1 (0,1) s2 (0,1) ... [-m material [-u]]", + __FILE__, bcadd, g); + theCommands.Add("bcremove", "Remove parts from result. Use: bcremove r s1 (0,1) s2 (0,1) ...", + __FILE__, bcremove, g); + theCommands.Add("bcremoveint", "Remove internal boundaries. Use: bcremoveint r", + __FILE__, bcremoveint, g); + theCommands.Add("bcmakecontainers", "Make containers from the parts added to result. Use: bcmakecontainers r", + __FILE__, bcmakecontainers, g); +} + +//======================================================================= +//function : bcbuild +//purpose : +//======================================================================= +Standard_Integer bcbuild(Draw_Interpretor& di, + Standard_Integer n, + const char** a) +{ + if (n != 2) { + di << "Cells builder. Use: bcbuild r\n"; + return 1; + } + // + BOPDS_PDS pDS = BOPTest_Objects::PDS(); + if (!pDS) { + di << " prepare PaveFiller first\n"; + return 1; + } + // + Standard_Boolean bRunParallel; + Standard_Integer iErr; + BOPCol_ListIteratorOfListOfShape aIt; + // + BOPAlgo_PaveFiller& aPF = BOPTest_Objects::PaveFiller(); + // + BOPAlgo_CellsBuilder& aCBuilder = BOPTest_Objects::CellsBuilder(); + aCBuilder.Clear(); + // + BOPCol_ListOfShape& aLSObj = BOPTest_Objects::Shapes(); + aIt.Initialize(aLSObj); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS = aIt.Value(); + aCBuilder.AddArgument(aS); + } + // + BOPCol_ListOfShape& aLSTool = BOPTest_Objects::Tools(); + aIt.Initialize(aLSTool); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS = aIt.Value(); + aCBuilder.AddArgument(aS); + } + // + bRunParallel = BOPTest_Objects::RunParallel(); + aCBuilder.SetRunParallel(bRunParallel); + // + aCBuilder.PerformWithFiller(aPF); + iErr = aCBuilder.ErrorStatus(); + if (iErr) { + di << "error: " << iErr << "\n"; + return 1; + } + // + BOPTest_Objects::SetBuilder(&aCBuilder); + // + const TopoDS_Shape& aR = aCBuilder.GetAllParts(); + if (aR.IsNull()) { + di << "no parts were built\n"; + return 0; + } + // + DBRep::Set(a[1], aR); + return 0; +} + +//======================================================================= +//function : bcaddall +//purpose : +//======================================================================= +Standard_Integer bcaddall(Draw_Interpretor& di, + Standard_Integer n, + const char** a) +{ + if (n < 2 || n > 5) { + di << "Add all parts to result. Use: bcaddall r [-m material [-u]]\n"; + return 1; + } + // + Standard_Integer iMaterial = 0; + Standard_Boolean bUpdate = Standard_False; + // + if (n > 3) { + if (!strcmp(a[2], "-m")) { + iMaterial = Draw::Atoi(a[3]); + } + // + if (n == 5) { + bUpdate = !strcmp(a[4], "-u"); + } + } + // + BOPAlgo_CellsBuilder& aCBuilder = BOPTest_Objects::CellsBuilder(); + // + aCBuilder.AddAllToResult(iMaterial, bUpdate); + // + const TopoDS_Shape& aR = aCBuilder.Shape(); + // + DBRep::Set(a[1], aR); + return 0; +} + +//======================================================================= +//function : bcremoveall +//purpose : +//======================================================================= +Standard_Integer bcremoveall(Draw_Interpretor& di, + Standard_Integer n, + const char**) +{ + if (n != 1) { + di << "Remove all parts from result. Use: bcremoveall\n"; + return 1; + } + // + BOPAlgo_CellsBuilder& aCBuilder = BOPTest_Objects::CellsBuilder(); + // + aCBuilder.RemoveAllFromResult(); + // + return 0; +} + +//======================================================================= +//function : bcadd +//purpose : +//======================================================================= +Standard_Integer bcadd(Draw_Interpretor& di, + Standard_Integer n, + const char** a) +{ + if (n < 4) { + di << "Add parts to result. Use: bcadd r s1 (0,1) s2 (0,1) ... [-m material [-u]]\n"; + return 1; + } + // + BOPCol_ListOfShape aLSToTake, aLSToAvoid; + Standard_Integer i, iMaterial, iTake, n1; + Standard_Boolean bUpdate; + // + iMaterial = 0; + bUpdate = Standard_False; + n1 = n; + // + if (!strcmp(a[n-3], "-m")) { + iMaterial = Draw::Atoi(a[n-2]); + bUpdate = !strcmp(a[n-1], "-u"); + n1 = n - 3; + } + else if (!strcmp(a[n-2], "-m")) { + iMaterial = Draw::Atoi(a[n-1]); + n1 = n - 2; + } + // + for (i = 2; i < n1; i += 2) { + const TopoDS_Shape& aS = DBRep::Get(a[i]); + if (aS.IsNull()) { + di << a[i] << " is a null shape\n"; + continue; + } + iTake = Draw::Atoi(a[i+1]); + // + if (iTake) { + aLSToTake.Append(aS); + } + else { + aLSToAvoid.Append(aS); + } + } + // + if (aLSToTake.IsEmpty()) { + di << "No shapes from which to add the parts\n"; + return 1; + } + // + BOPAlgo_CellsBuilder& aCBuilder = BOPTest_Objects::CellsBuilder(); + aCBuilder.AddToResult(aLSToTake, aLSToAvoid, iMaterial, bUpdate); + // + const TopoDS_Shape& aR = aCBuilder.Shape(); + // + DBRep::Set(a[1], aR); + return 0; +} + +//======================================================================= +//function : bcremove +//purpose : +//======================================================================= +Standard_Integer bcremove(Draw_Interpretor& di, + Standard_Integer n, + const char** a) +{ + if (n < 4 || ((n % 2) != 0)) { + di << "Remove parts from result. Use: bcremove r s1 (0,1) s2 (0,1) ...\n"; + return 1; + } + // + BOPCol_ListOfShape aLSToTake, aLSToAvoid; + Standard_Integer i, iTake; + // + for (i = 2; i < n; i += 2) { + const TopoDS_Shape& aS = DBRep::Get(a[i]); + if (aS.IsNull()) { + di << a[i] << " is a null shape\n"; + return 1; + } + iTake = Draw::Atoi(a[i+1]); + // + if (iTake) { + aLSToTake.Append(aS); + } + else { + aLSToAvoid.Append(aS); + } + } + // + if (aLSToTake.IsEmpty()) { + di << "No shapes from which to remove the parts\n"; + return 1; + } + // + BOPAlgo_CellsBuilder& aCBuilder = BOPTest_Objects::CellsBuilder(); + aCBuilder.RemoveFromResult(aLSToTake, aLSToAvoid); + // + const TopoDS_Shape& aR = aCBuilder.Shape(); + // + DBRep::Set(a[1], aR); + return 0; +} + +//======================================================================= +//function : bcremoveint +//purpose : +//======================================================================= +Standard_Integer bcremoveint(Draw_Interpretor& di, + Standard_Integer n, + const char** a) +{ + if (n != 2) { + di << "Remove internal boundaries. Use: bcremoveint r\n"; + return 1; + } + // + BOPAlgo_CellsBuilder& aCBuilder = BOPTest_Objects::CellsBuilder(); + aCBuilder.RemoveInternalBoundaries(); + // + const TopoDS_Shape& aR = aCBuilder.Shape(); + // + DBRep::Set(a[1], aR); + return 0; +} + +//======================================================================= +//function : bcmakecontainers +//purpose : +//======================================================================= +Standard_Integer bcmakecontainers(Draw_Interpretor& di, + Standard_Integer n, + const char** a) +{ + if (n != 2) { + di << "Make containers from the parts added to result. Use: bcmakecontainers r\n"; + return 1; + } + // + BOPAlgo_CellsBuilder& aCBuilder = BOPTest_Objects::CellsBuilder(); + aCBuilder.MakeContainers(); + // + const TopoDS_Shape& aR = aCBuilder.Shape(); + // + DBRep::Set(a[1], aR); + return 0; +} diff --git a/src/BOPTest/BOPTest_Objects.cxx b/src/BOPTest/BOPTest_Objects.cxx index 44a528ee05..027c4323b9 100644 --- a/src/BOPTest/BOPTest_Objects.cxx +++ b/src/BOPTest/BOPTest_Objects.cxx @@ -18,6 +18,7 @@ #include #include #include +#include #include static Handle(NCollection_BaseAllocator)& Allocator1(); @@ -224,6 +225,15 @@ BOPAlgo_Section& BOPTest_Objects::Section() return sSection; } //======================================================================= +//function : CellsBuilder +//purpose : +//======================================================================= +BOPAlgo_CellsBuilder& BOPTest_Objects::CellsBuilder() +{ + static BOPAlgo_CellsBuilder sCBuilder(Allocator1()); + return sCBuilder; +} +//======================================================================= //function : Shapes //purpose : //======================================================================= diff --git a/src/BOPTest/BOPTest_Objects.hxx b/src/BOPTest/BOPTest_Objects.hxx index fa07d35570..b63245864b 100644 --- a/src/BOPTest/BOPTest_Objects.hxx +++ b/src/BOPTest/BOPTest_Objects.hxx @@ -24,6 +24,7 @@ #include #include #include +#include class BOPAlgo_PaveFiller; class BOPAlgo_Builder; class BOPAlgo_BOP; @@ -52,6 +53,8 @@ public: Standard_EXPORT static BOPAlgo_Section& Section(); + Standard_EXPORT static BOPAlgo_CellsBuilder& CellsBuilder(); + Standard_EXPORT static BOPCol_ListOfShape& Shapes(); Standard_EXPORT static BOPCol_ListOfShape& Tools(); diff --git a/src/BOPTest/FILES b/src/BOPTest/FILES index 244f6c1dce..d3aeb3e4ef 100755 --- a/src/BOPTest/FILES +++ b/src/BOPTest/FILES @@ -12,4 +12,5 @@ BOPTest_Objects.hxx BOPTest_OptionCommands.cxx BOPTest_PartitionCommands.cxx BOPTest_TolerCommands.cxx -BOPTest_HistoryCommands.cxx \ No newline at end of file +BOPTest_HistoryCommands.cxx +BOPTest_CellsCommands.cxx \ No newline at end of file diff --git a/src/DrawResources/TestCommands.tcl b/src/DrawResources/TestCommands.tcl index 7fea9b3648..5856350a44 100644 --- a/src/DrawResources/TestCommands.tcl +++ b/src/DrawResources/TestCommands.tcl @@ -2126,7 +2126,7 @@ proc _get_temp_dir {} { if { "$tcl_platform(platform)" == "windows" } { set paths "c:/TEMP c:/TMP /TEMP /TMP" if { [info exists env(HOMEDRIVE)] && [info exists env(HOMEPATH)] } { - set fallback [regsub -all {\\} "$env(HOMEDRIVE)$(HOMEPATH)/tmp" /] + set fallback [regsub -all {\\} "$env(HOMEDRIVE)$env(HOMEPATH)/tmp" /] } } else { set paths "/tmp /var/tmp /usr/tmp" diff --git a/src/TKBO/EXTERNLIB b/src/TKBO/EXTERNLIB index e19e2b474b..ebbaf90b08 100755 --- a/src/TKBO/EXTERNLIB +++ b/src/TKBO/EXTERNLIB @@ -7,4 +7,5 @@ TKG3d TKGeomAlgo TKGeomBase TKPrim +TKShHealing CSF_TBB \ No newline at end of file diff --git a/tests/boolean/cells_test/A1 b/tests/boolean/cells_test/A1 new file mode 100644 index 0000000000..54319c2305 --- /dev/null +++ b/tests/boolean/cells_test/A1 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 0 s3 1 + +donly result +fit + +set square 1345.27 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A2 b/tests/boolean/cells_test/A2 new file mode 100644 index 0000000000..ff25350f60 --- /dev/null +++ b/tests/boolean/cells_test/A2 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 0 s2 1 s3 1 + +donly result +fit + +set square 1345.27 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A3 b/tests/boolean/cells_test/A3 new file mode 100644 index 0000000000..36c4516d30 --- /dev/null +++ b/tests/boolean/cells_test/A3 @@ -0,0 +1,33 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 0 s3 1 +bcadd result s1 0 s2 1 s3 1 + +donly r4 +fit + +set square 2690.54 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A4 b/tests/boolean/cells_test/A4 new file mode 100644 index 0000000000..de2a2e7131 --- /dev/null +++ b/tests/boolean/cells_test/A4 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 1 s3 1 + +donly result +fit + +set square 769.835 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A5 b/tests/boolean/cells_test/A5 new file mode 100644 index 0000000000..9514a00799 --- /dev/null +++ b/tests/boolean/cells_test/A5 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s3 1 + +donly result +fit + +set square 2115.11 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A6 b/tests/boolean/cells_test/A6 new file mode 100644 index 0000000000..0879e0e045 --- /dev/null +++ b/tests/boolean/cells_test/A6 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s2 1 s3 1 + +donly result +fit + +set square 2115.11 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A7 b/tests/boolean/cells_test/A7 new file mode 100644 index 0000000000..52a826358d --- /dev/null +++ b/tests/boolean/cells_test/A7 @@ -0,0 +1,33 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s3 1 +bcadd result s2 1 s3 2 + +donly result +fit + +set square 3460.38 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A8 b/tests/boolean/cells_test/A8 new file mode 100644 index 0000000000..48dc206391 --- /dev/null +++ b/tests/boolean/cells_test/A8 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 0 s2 0 s3 1 + +donly result +fit + +set square 2356.19 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/A9 b/tests/boolean/cells_test/A9 new file mode 100644 index 0000000000..dc8c290ad3 --- /dev/null +++ b/tests/boolean/cells_test/A9 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s2 0 s3 1 + +donly result +fit + +set square 3701.46 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/B1 b/tests/boolean/cells_test/B1 new file mode 100644 index 0000000000..fa00faba0c --- /dev/null +++ b/tests/boolean/cells_test/B1 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 0 s3 1 + +donly result +fit + +set square 3701.46 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/B2 b/tests/boolean/cells_test/B2 new file mode 100644 index 0000000000..5bed45c7fe --- /dev/null +++ b/tests/boolean/cells_test/B2 @@ -0,0 +1,33 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s2 0 s3 1 +bcadd result s1 0 s3 1 + +donly result +fit + +set square 5046.74 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/B3 b/tests/boolean/cells_test/B3 new file mode 100644 index 0000000000..2b0cc25d8b --- /dev/null +++ b/tests/boolean/cells_test/B3 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s3 1 + +donly result +fit + +set square 5816.57 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/B4 b/tests/boolean/cells_test/B4 new file mode 100644 index 0000000000..13d8237571 --- /dev/null +++ b/tests/boolean/cells_test/B4 @@ -0,0 +1,33 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcaddall result +bcremove result s1 1 s2 1 s3 1 +bcremove result s2 0 s3 1 + +donly result +fit + +set square 7172.78 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/B5 b/tests/boolean/cells_test/B5 new file mode 100644 index 0000000000..b1deaa2a3a --- /dev/null +++ b/tests/boolean/cells_test/B5 @@ -0,0 +1,37 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 0 s3 0 -m 1 +bcadd result s1 1 s2 0 s3 1 -m 1 +bcadd result s1 1 s2 1 s3 0 -m 2 +bcadd result s1 1 s2 1 s3 1 -m 2 +bcadd result s1 0 s2 1 s3 1 -m 2 +bcremoveint result + +donly result +fit + +set square 4494.64 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/B6 b/tests/boolean/cells_test/B6 new file mode 100644 index 0000000000..dc21817187 --- /dev/null +++ b/tests/boolean/cells_test/B6 @@ -0,0 +1,37 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +psphere s1 15 +psphere s2 15 +psphere s3 15 +ttranslate s1 0 0 10 +ttranslate s2 20 0 10 +ttranslate s3 10 0 0 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 0 s3 0 -m 1 +bcadd result s1 1 s2 0 s3 1 -m 1 -u +bcadd result s1 1 s2 1 s3 0 -m 2 +bcadd result s1 1 s2 1 s3 1 -m 2 +bcadd result s1 0 s2 1 s3 1 -m 2 -u +bcremoveint result + +donly result +fit + +set square 4494.64 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C1 b/tests/boolean/cells_test/C1 new file mode 100644 index 0000000000..7910672c85 --- /dev/null +++ b/tests/boolean/cells_test/C1 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 1 f2 0 f3 1 + +donly result +fit + +set square 175.992 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C2 b/tests/boolean/cells_test/C2 new file mode 100644 index 0000000000..752c4cfb73 --- /dev/null +++ b/tests/boolean/cells_test/C2 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 0 f2 1 f3 1 + +donly result +fit + +set square 175.992 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C3 b/tests/boolean/cells_test/C3 new file mode 100644 index 0000000000..4f1fcbbfb6 --- /dev/null +++ b/tests/boolean/cells_test/C3 @@ -0,0 +1,43 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 1 f2 0 f3 1 +bcadd result f1 0 f2 1 f3 1 + +donly result +fit + +set square 351.984 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C4 b/tests/boolean/cells_test/C4 new file mode 100644 index 0000000000..c999c7ef0d --- /dev/null +++ b/tests/boolean/cells_test/C4 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 1 f2 1 f3 1 + +donly result +fit + +set square 122.886 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C5 b/tests/boolean/cells_test/C5 new file mode 100644 index 0000000000..32254e8d46 --- /dev/null +++ b/tests/boolean/cells_test/C5 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 1 f3 1 -m 1 + +donly result +fit + +set square 298.878 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C6 b/tests/boolean/cells_test/C6 new file mode 100644 index 0000000000..f095d3a40c --- /dev/null +++ b/tests/boolean/cells_test/C6 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f2 1 f3 1 -m 1 + +donly result +fit + +set square 298.878 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C7 b/tests/boolean/cells_test/C7 new file mode 100644 index 0000000000..4085b5c67f --- /dev/null +++ b/tests/boolean/cells_test/C7 @@ -0,0 +1,44 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 1 f3 1 -m 1 +bcadd result f2 1 f3 1 -m 1 +bcremoveint result + +donly result +fit + +set square 474.87 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C8 b/tests/boolean/cells_test/C8 new file mode 100644 index 0000000000..b4b9f84f95 --- /dev/null +++ b/tests/boolean/cells_test/C8 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 0 f2 0 f3 1 + +donly result +fit + +set square 231.988 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/C9 b/tests/boolean/cells_test/C9 new file mode 100644 index 0000000000..defdd239de --- /dev/null +++ b/tests/boolean/cells_test/C9 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f2 0 f3 1 + +donly result +fit + +set square 407.98 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/D1 b/tests/boolean/cells_test/D1 new file mode 100644 index 0000000000..547fc0b2ae --- /dev/null +++ b/tests/boolean/cells_test/D1 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 0 f3 1 + +donly result +fit + +set square 407.98 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/D2 b/tests/boolean/cells_test/D2 new file mode 100644 index 0000000000..efb62a3096 --- /dev/null +++ b/tests/boolean/cells_test/D2 @@ -0,0 +1,43 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f2 0 f3 1 +bcadd result f1 0 f3 1 + +donly result +fit + +set square 583.972 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/D3 b/tests/boolean/cells_test/D3 new file mode 100644 index 0000000000..4d8545c793 --- /dev/null +++ b/tests/boolean/cells_test/D3 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f3 1 + +donly result +fit + +set square 706.858 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/D4 b/tests/boolean/cells_test/D4 new file mode 100644 index 0000000000..05b509460d --- /dev/null +++ b/tests/boolean/cells_test/D4 @@ -0,0 +1,42 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcaddall result +bcremove result f1 1 f2 1 f3 1 + +donly result +fit + +set square 1367.94 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/D5 b/tests/boolean/cells_test/D5 new file mode 100644 index 0000000000..ee7784ffe7 --- /dev/null +++ b/tests/boolean/cells_test/D5 @@ -0,0 +1,47 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +circle c1 0 10 0 15 +circle c2 20 10 0 15 +circle c3 10 0 0 15 +mkedge e1 c1 +mkedge e2 c2 +mkedge e3 c3 +wire w1 e1 +wire w2 e2 +wire w3 e3 +mkplane f1 w1 +mkplane f2 w2 +mkplane f3 w3 + +donly f1 f2 f3 +fit + +bclearobjects +bcleartools +baddobjects f1 f2 +baddtools f3 +bfillds +bcbuild r + +bcremoveall +bcadd result f1 1 f2 0 f3 0 -m 1 +bcadd result f1 1 f2 0 f3 1 -m 1 +bcadd result f1 1 f2 1 f3 0 -m 2 +bcadd result f1 1 f2 1 f3 1 -m 2 +bcadd result f1 0 f2 1 f3 1 -m 2 +bcremoveint result + +donly result +fit + +set square 882.85 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E1 b/tests/boolean/cells_test/E1 new file mode 100644 index 0000000000..62a3d9b60e --- /dev/null +++ b/tests/boolean/cells_test/E1 @@ -0,0 +1,29 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcaddall result + +donly result +fit + +set square 7729.72 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E2 b/tests/boolean/cells_test/E2 new file mode 100644 index 0000000000..384722b7da --- /dev/null +++ b/tests/boolean/cells_test/E2 @@ -0,0 +1,29 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcaddall result -m 1 -u + +donly result +fit + +set square 2689.14 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E3 b/tests/boolean/cells_test/E3 new file mode 100644 index 0000000000..742d493d39 --- /dev/null +++ b/tests/boolean/cells_test/E3 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 1 s3 1 s4 1 + +donly result +fit + +set square 417.967 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E4 b/tests/boolean/cells_test/E4 new file mode 100644 index 0000000000..fb09deffc3 --- /dev/null +++ b/tests/boolean/cells_test/E4 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 + +donly result +fit + +set square 1416.31 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E5 b/tests/boolean/cells_test/E5 new file mode 100644 index 0000000000..895be8cfa7 --- /dev/null +++ b/tests/boolean/cells_test/E5 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s2 1 + +donly result +fit + +set square 4993.56 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E6 b/tests/boolean/cells_test/E6 new file mode 100644 index 0000000000..9118b017fd --- /dev/null +++ b/tests/boolean/cells_test/E6 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s3 1 + +donly result +fit + +set square 5017.47 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E7 b/tests/boolean/cells_test/E7 new file mode 100644 index 0000000000..bbf08fa356 --- /dev/null +++ b/tests/boolean/cells_test/E7 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s4 1 + +donly result +fit + +set square 2086.49 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E8 b/tests/boolean/cells_test/E8 new file mode 100644 index 0000000000..87c7d22f59 --- /dev/null +++ b/tests/boolean/cells_test/E8 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcaddall result +bcremove result s1 1 s2 1 s3 1 s4 1 + +donly result +fit + +set square 7311.75 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/E9 b/tests/boolean/cells_test/E9 new file mode 100644 index 0000000000..0f14687745 --- /dev/null +++ b/tests/boolean/cells_test/E9 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 1 -m 1 -u + +donly result +fit + +set square 502.043 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F1 b/tests/boolean/cells_test/F1 new file mode 100644 index 0000000000..31c8be8a0c --- /dev/null +++ b/tests/boolean/cells_test/F1 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s3 1 -m 1 -u + +donly result +fit + +set square 514.159 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F2 b/tests/boolean/cells_test/F2 new file mode 100644 index 0000000000..e6b953cafb --- /dev/null +++ b/tests/boolean/cells_test/F2 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s4 1 -m 1 -u + +donly result +fit + +set square 418.093 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F3 b/tests/boolean/cells_test/F3 new file mode 100644 index 0000000000..47aaac97c5 --- /dev/null +++ b/tests/boolean/cells_test/F3 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s2 1 s3 1 -m 1 -u + +donly result +fit + +set square 1135.58 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F4 b/tests/boolean/cells_test/F4 new file mode 100644 index 0000000000..6402d0ec45 --- /dev/null +++ b/tests/boolean/cells_test/F4 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s2 1 s4 1 -m 1 -u + +donly result +fit + +set square 1017.77 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F5 b/tests/boolean/cells_test/F5 new file mode 100644 index 0000000000..0279e9ca40 --- /dev/null +++ b/tests/boolean/cells_test/F5 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s3 1 s4 1 -m 1 -u + +donly result +fit + +set square 1232.14 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F6 b/tests/boolean/cells_test/F6 new file mode 100644 index 0000000000..2e486a3ea9 --- /dev/null +++ b/tests/boolean/cells_test/F6 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 0 s3 0 s4 0 + +donly result +fit + +set square 259.774 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F7 b/tests/boolean/cells_test/F7 new file mode 100644 index 0000000000..1117f8f7d3 --- /dev/null +++ b/tests/boolean/cells_test/F7 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 0 s2 1 s3 0 s4 0 + +donly result +fit + +set square 2067.69 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F8 b/tests/boolean/cells_test/F8 new file mode 100644 index 0000000000..664bcff538 --- /dev/null +++ b/tests/boolean/cells_test/F8 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 0 s2 0 s3 1 s4 0 + +donly result +fit + +set square 1640.54 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/F9 b/tests/boolean/cells_test/F9 new file mode 100644 index 0000000000..39791b6061 --- /dev/null +++ b/tests/boolean/cells_test/F9 @@ -0,0 +1,30 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 0 s2 0 s3 0 s4 1 + +donly result +fit + +set square 145.291 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G1 b/tests/boolean/cells_test/G1 new file mode 100644 index 0000000000..fe94d23d86 --- /dev/null +++ b/tests/boolean/cells_test/G1 @@ -0,0 +1,33 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 s2 0 s3 0 s4 0 +bcadd result s1 0 s2 1 s3 0 s4 0 +bcadd result s1 0 s2 0 s3 1 s4 0 +bcadd result s1 0 s2 0 s3 0 s4 1 + +donly result +fit + +set square 4113.3 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G2 b/tests/boolean/cells_test/G2 new file mode 100644 index 0000000000..c294366b95 --- /dev/null +++ b/tests/boolean/cells_test/G2 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 -m 1 +bcremove result s1 1 s2 0 s3 0 s4 0 +bcremoveint result + +donly result +fit + +set square 545.266 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G3 b/tests/boolean/cells_test/G3 new file mode 100644 index 0000000000..f593b10ece --- /dev/null +++ b/tests/boolean/cells_test/G3 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s2 1 -m 1 +bcremove result s1 0 s2 1 s3 0 s4 0 +bcremoveint result + +donly result +fit + +set square 1166.69 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G4 b/tests/boolean/cells_test/G4 new file mode 100644 index 0000000000..ba83311519 --- /dev/null +++ b/tests/boolean/cells_test/G4 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s3 1 -m 1 +bcremove result s1 0 s2 0 s3 1 s4 0 +bcremoveint result + +donly result +fit + +set square 1393.05 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G5 b/tests/boolean/cells_test/G5 new file mode 100644 index 0000000000..23e61659bb --- /dev/null +++ b/tests/boolean/cells_test/G5 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s4 1 -m 1 +bcremove result s1 0 s2 0 s3 0 s4 1 +bcremoveint result + +donly result +fit + +set square 1232.14 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G6 b/tests/boolean/cells_test/G6 new file mode 100644 index 0000000000..abaf125d0f --- /dev/null +++ b/tests/boolean/cells_test/G6 @@ -0,0 +1,35 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcaddall result -m 1 +bcremove result s1 1 s2 0 s3 0 s4 0 +bcremove result s1 0 s2 1 s3 0 s4 0 +bcremove result s1 0 s2 0 s3 1 s4 0 +bcremove result s1 0 s2 0 s3 0 s4 1 +bcremoveint result + +donly result +fit + +set square 1424.16 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G7 b/tests/boolean/cells_test/G7 new file mode 100644 index 0000000000..19f70528c5 --- /dev/null +++ b/tests/boolean/cells_test/G7 @@ -0,0 +1,34 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcremoveall +bcadd result s1 1 -m 1 +bcadd result s2 1 -m 2 +bcadd result s3 1 -m 3 +bcadd result s4 1 -m 4 +bcremoveint result + +donly result +fit + +set square 4326.81 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/G8 b/tests/boolean/cells_test/G8 new file mode 100644 index 0000000000..ccb1da0e2d --- /dev/null +++ b/tests/boolean/cells_test/G8 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box s1 10 10 10 +psphere s2 12 +pcylinder s3 10 20 +pcone s4 10 0 30 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 s4 +bfillds +bcbuild r + +bcaddall result +bcmakecontainers result +bcremove result s1 1 +bcadd result s1 1 s2 1 + +donly result +fit + +set square 7299.17 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/H1 b/tests/boolean/cells_test/H1 new file mode 100644 index 0000000000..919a1204ae --- /dev/null +++ b/tests/boolean/cells_test/H1 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box b1 10 10 10 +box b2 0 30 0 10 10 10 +compound b1 b2 b1 +box b3 5 5 5 10 10 10 +box b4 30 5 5 10 10 10 +compound b3 b4 b2 +don b1 b2 +bclearobjects +bcleartools +baddobjects b1 b2 +bfillds +bcbuild r + +bcremoveall +bcadd result b1 1 + +donly result +fit + +set square 1350 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/H2 b/tests/boolean/cells_test/H2 new file mode 100644 index 0000000000..75ec073073 --- /dev/null +++ b/tests/boolean/cells_test/H2 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box b1 10 10 10 +box b2 0 30 0 10 10 10 +compound b1 b2 b1 +box b3 5 5 5 10 10 10 +box b4 30 5 5 10 10 10 +compound b3 b4 b2 +don b1 b2 +bclearobjects +bcleartools +baddobjects b1 b2 +bfillds +bcbuild r + +bcremoveall +bcadd result b2 1 + +donly result +fit + +set square 1350 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/H3 b/tests/boolean/cells_test/H3 new file mode 100644 index 0000000000..8e2d6226f1 --- /dev/null +++ b/tests/boolean/cells_test/H3 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box b1 10 10 10 +box b2 0 30 0 10 10 10 +compound b1 b2 b1 +box b3 5 5 5 10 10 10 +box b4 30 5 5 10 10 10 +compound b3 b4 b2 +don b1 b2 +bclearobjects +bcleartools +baddobjects b1 b2 +bfillds +bcbuild r + +bcremoveall +bcadd result b1 1 b2 1 + +donly result +fit + +set square 150 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/H4 b/tests/boolean/cells_test/H4 new file mode 100644 index 0000000000..cf84012756 --- /dev/null +++ b/tests/boolean/cells_test/H4 @@ -0,0 +1,32 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +box b1 10 10 10 +box b2 0 30 0 10 10 10 +compound b1 b2 b1 +box b3 5 5 5 10 10 10 +box b4 30 5 5 10 10 10 +compound b3 b4 b2 +don b1 b2 +bclearobjects +bcleartools +baddobjects b1 b2 +bfillds +bcbuild r + +bcremoveall +bcadd result b1 1 b2 0 + +donly result +fit + +set square 1200 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/I1 b/tests/boolean/cells_test/I1 new file mode 100644 index 0000000000..ee8b1395f3 --- /dev/null +++ b/tests/boolean/cells_test/I1 @@ -0,0 +1,45 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +pcylinder s1 10 20 +plane p 0 0 0 1 0 0 +mkface f p + +bclearobjects +bcleartools +baddobjects s1 f +bfillds +bbuild r +explode r so + +copy r_1 s1 +copy r_2 s2 + +pcylinder s3 5 20 +ttranslate s3 0 -10 0 + +donly s1 s2 s3 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + + +bcremoveall +bcadd result s1 0 s2 1 s3 0 + +donly result +fit + +set square 1238.14 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/I2 b/tests/boolean/cells_test/I2 new file mode 100644 index 0000000000..aa09e63651 --- /dev/null +++ b/tests/boolean/cells_test/I2 @@ -0,0 +1,48 @@ +puts "========" +puts "OCC26798" +puts "========" +puts "" +####################################################################### +# Boolean operations: keep desired cells and boundaries in the result +####################################################################### + +smallview + +pcylinder s1 10 20 +plane p 0 0 0 1 0 0 +mkface f p + +bclearobjects +bcleartools +baddobjects s1 f +bfillds +bbuild r +explode r so + +copy r_1 s1 +copy r_2 s2 + +pcylinder s3 5 20 +ttranslate s3 0 -10 0 + +donly s1 s2 s3 + +bclearobjects +bcleartools +baddobjects s1 s2 s3 +bfillds +bcbuild r + +bcremoveall +bcaddall result -m 1 +bcremove result s1 0 s2 1 s3 0 +bcadd result s1 0 s2 1 s3 0 +bcremoveint result +bcmakecontainers result + +donly result +fit + +set square 2998.06 + +set only_screen_axo 1 diff --git a/tests/boolean/cells_test/begin b/tests/boolean/cells_test/begin new file mode 100644 index 0000000000..dd616d5374 --- /dev/null +++ b/tests/boolean/cells_test/begin @@ -0,0 +1 @@ +set command cells_test diff --git a/tests/boolean/grids.list b/tests/boolean/grids.list index 638754ceca..3d964960dc 100644 --- a/tests/boolean/grids.list +++ b/tests/boolean/grids.list @@ -25,3 +25,4 @@ 025 volumemaker 026 gdml_public 027 gdml_private +028 cells_test