// in boolean operation and will be added to result.
ListOfShape aShapesToAdd;
for (ObjectHierarchy::Iterator anObjectsIt = anObjectsHierarchy.Begin();
- !isSimpleCreation && anObjectsIt != anObjectsHierarchy.End();
- ++anObjectsIt) {
+ anObjectsIt != anObjectsHierarchy.End(); ++anObjectsIt) {
GeomShapePtr anObject = *anObjectsIt;
GeomShapePtr aParent = anObjectsHierarchy.Parent(anObject, false);
if (anObjectsNb + aToolsNb < 2) {
theError = "Not enough arguments for Fuse operation.";
return false;
- } else if (isAllInSameCompSolid) {
- theError = "Operations only between sub-shapes of the same shape not allowed.";
- return false;
}
return true;
# Make union on extrusion
#=========================================================================
aSession.startOperation()
-aUnionFeature = aPart.addFeature("Union")
-aUnionFeature.selectionList("base_objects").append(anExtrusionResult.subResult(0), None);
-aUnionFeature.selectionList("base_objects").append(anExtrusionResult.subResult(1), None);
-aUnionFeature.selectionList("base_objects").append(anExtrusionResult.subResult(2), None);
+aUnionFeature = aPart.addFeature("Fuse")
+aUnionFeature.string("creation_method").setValue("simple")
+aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(0), None);
+aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(1), None);
+aUnionFeature.selectionList("main_objects").append(anExtrusionResult.subResult(2), None);
+aUnionFeature.boolean("remove_intersection_edges").setValue(False)
aSession.finishOperation()
assert (len(aUnionFeature.results()) > 0)
anUnionResult = modelAPI_ResultBody(aUnionFeature.firstResult())
Edge_1 = model.addEdge(Part_1_doc, [model.selection("EDGE", "Sketch_1/SketchArc_1_2")])
Revolution_1 = model.addRevolution(Part_1_doc, [model.selection("EDGE", "Edge_1_1")], model.selection("EDGE", "PartSet/OY"), 200, 0)
Partition_1 = model.addPartition(Part_1_doc, [model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "Revolution_1_1")])
-Union_1 = model.addUnion(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")])
+Union_1 = model.addFuse(Part_1_doc, [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2")], True)
model.do()
model.checkResult(Union_1,model,1,[0],[0],[1],[4],[8])
Partition_1_objects = [model.selection("FACE", "PartSet/YOZ"), model.selection("FACE", "PartSet/XOZ"), model.selection("FACE", "PartSet/XOY"), model.selection("FACE", "Revolution_1_1")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
Union_1_objects = [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_2"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")]
-Union_1 = model.addUnion(Part_1_doc, Union_1_objects)
+Union_1 = model.addFuse(Part_1_doc, Union_1_objects, True)
model.testHaveNamingSubshapes(Union_1,model,Part_1_doc)
model.do()
model.end()
Partition_1_objects = [model.selection("FACE", "Face_2_1"), model.selection("FACE", "Face_1_1"), model.selection("FACE", "PartSet/YOZ")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
Union_1_objects = [model.selection("FACE", "Partition_1_1_1"), model.selection("FACE", "Partition_1_1_3"), model.selection("FACE", "Partition_1_1_4")]
-Union_1 = model.addUnion(Part_1_doc, Union_1_objects)
+Union_1 = model.addFuse(Part_1_doc, Union_1_objects, True, 20190506)
model.do()
model.checkResult(Union_1,model,1,[2],[0],[2],[13],[26])
-#model.testHaveNamingSubshapes(Union_1,model,Part_1_doc)
+model.testHaveNamingSubshapes(Union_1,model,Part_1_doc)
model.end()
Plane_5 = model.addPlane(Part_1_doc, model.selection("FACE", "Box_1_1/Front"), 5, True)
Partition_1_objects = [model.selection("FACE", "Plane_1"), model.selection("FACE", "Plane_2"), model.selection("SOLID", "Box_1_1")]
Partition_1 = model.addPartition(Part_1_doc, Partition_1_objects)
-Union_1 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")])
-Union_2 = model.addUnion(Part_1_doc, [model.selection("SOLID", "Union_1_1_2"), model.selection("SOLID", "Union_1_1_1")])
+Union_1 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Partition_1_1_3"), model.selection("SOLID", "Partition_1_1_1")])
+Union_2 = model.addFuse(Part_1_doc, [model.selection("SOLID", "Fuse_1_1_2"), model.selection("SOLID", "Fuse_1_1_1")])
model.do()
model.end()
<source path="boolean_split_widget.xml"/>
</feature>
<feature id="Union" title="Union" tooltip="Perform union operations with shapes"
- icon="icons/Features/union.png" helpfile="unionFeature.html">
+ icon="icons/Features/union.png" helpfile="unionFeature.html" internal="1">
<source path="union_widget.xml"/>
</feature>
<feature id="Remove_SubShapes" title="Remove Sub-Shapes" tooltip="Allows to remove sub-shapes from wires, shells, compsolids and compounds"
#include "GeomAlgoAPI_UnifySameDomain.h"
#include <GeomAlgoAPI_CompoundBuilder.h>
+#include <GeomAlgoAPI_DFLoader.h>
#include <GeomAlgoAPI_ShapeTools.h>
#include <ShapeUpgrade_UnifySameDomain.hxx>
if (aResult.IsNull()) {
return;
}
+ // taske off the compound if it consists of single sub-shape
+ if (aResult.ShapeType() == TopAbs_COMPOUND) {
+ aResult = GeomAlgoAPI_DFLoader::refineResult(aResult);
+ }
if (theIsToSimplifyShell && aResult.ShapeType() == TopAbs_SHELL) {
int aNb = 0;