Add new idl function GEOM_IBooleanOperations::MakePartitionNonSelfIntersectedShape to provide correct publishing in study of a partition arguments and also to provide homogeneous behaviour of Partition in GUI and in python scripts.

This commit is contained in:
jfa 2006-12-13 09:40:11 +00:00
parent 1c87498d87
commit da257d8d06
9 changed files with 479 additions and 162 deletions

View File

@ -219,9 +219,18 @@
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#db16045827aa23070ef98eca038ecd2c">GetShapesOnQuadrangleIDs</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#db16045827aa23070ef98eca038ecd2c">GetShapesOnQuadrangleIDs</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Works like the above method, but returns list of sub-shapes indices. <a href="#db16045827aa23070ef98eca038ecd2c"></a><br></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Works like the above method, but returns list of sub-shapes indices. <a href="#db16045827aa23070ef98eca038ecd2c"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#94c97c957d04ebd433cb5b3d94e8c8ac">GetShapesOnBox</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Find in <em>theShape</em> all sub-shapes of type <em>theShapeType</em>, situated relatively the specified <em>theBox</em> by the certain way, defined through <em>theState</em> parameter. <a href="#94c97c957d04ebd433cb5b3d94e8c8ac"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#c7b1da4e965bf551fc87b72ebd6afde7">GetShapesOnBoxIDs</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Works like the above method, but returns list of sub-shapes indices. <a href="#c7b1da4e965bf551fc87b72ebd6afde7"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#2695635fc745e6aa6cda4545e2133c41">GetInPlace</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#2695635fc745e6aa6cda4545e2133c41">GetInPlace</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get sub-shape(s) of theShapeWhere, which are coincident with <em>theShapeWhat</em> or could be a part of it. <a href="#2695635fc745e6aa6cda4545e2133c41"></a><br></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get sub-shape(s) of theShapeWhere, which are coincident with <em>theShapeWhat</em> or could be a part of it. <a href="#2695635fc745e6aa6cda4545e2133c41"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#808c0723c1cc2c641a02aeaa0d0b45c6">GetSame</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Get sub-shape of theShapeWhere, which is equal to <em>theShapeWhat</em>. <a href="#808c0723c1cc2c641a02aeaa0d0b45c6"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#67706610dda0d5005ee1cdfe2e8362a2">GetSubShape</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#67706610dda0d5005ee1cdfe2e8362a2">GetSubShape</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Obtain a composite sub-shape of &lt;aShape&gt;, composed from sub-shapes of &lt;aShape&gt;, selected by their unique IDs inside &lt;aShape&gt;. <a href="#67706610dda0d5005ee1cdfe2e8362a2"></a><br></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Obtain a composite sub-shape of &lt;aShape&gt;, composed from sub-shapes of &lt;aShape&gt;, selected by their unique IDs inside &lt;aShape&gt;. <a href="#67706610dda0d5005ee1cdfe2e8362a2"></a><br></td></tr>
@ -306,9 +315,9 @@
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#56f48212a436f46c02722f627d27e7f2">MakePartition</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#56f48212a436f46c02722f627d27e7f2">MakePartition</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform partition operation. <a href="#56f48212a436f46c02722f627d27e7f2"></a><br></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform partition operation. <a href="#56f48212a436f46c02722f627d27e7f2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#dcdde81ee91dd4fffbd61f027fce692b">MakePartitionNonSelfIntersectedShape</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#85a4e715d0d0e4c8c9960372bfeb5327">MakePartitionNonSelfIntersectedShape</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform partition operation. <a href="#dcdde81ee91dd4fffbd61f027fce692b"></a><br></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Perform partition operation. <a href="#85a4e715d0d0e4c8c9960372bfeb5327"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#f1fc43bc5612514bcc2f6d772c3d38db">Partition</a></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">def&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="namespacegeompy.html#f1fc43bc5612514bcc2f6d772c3d38db">Partition</a></td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Shortcut to <a class="el" href="namespacegeompy.html#56f48212a436f46c02722f627d27e7f2">MakePartition()</a>. <a href="#f1fc43bc5612514bcc2f6d772c3d38db"></a><br></td></tr> <tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Shortcut to <a class="el" href="namespacegeompy.html#56f48212a436f46c02722f627d27e7f2">MakePartition()</a>. <a href="#f1fc43bc5612514bcc2f6d772c3d38db"></a><br></td></tr>
@ -3934,6 +3943,113 @@ Example: see GEOM_TestOthers.py </td>
Example: see GEOM_TestOthers.py </td> Example: see GEOM_TestOthers.py </td>
</tr> </tr>
</table> </table>
<a class="anchor" name="94c97c957d04ebd433cb5b3d94e8c8ac"></a><!-- doxytag: member="geompy::GetShapesOnBox" ref="94c97c957d04ebd433cb5b3d94e8c8ac" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">def geompy::GetShapesOnBox </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">&nbsp;</td>
<td class="mdname" nowrap> <em>theBox</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>&nbsp;</td>
<td class="mdname" nowrap> <em>theShape</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>&nbsp;</td>
<td class="mdname" nowrap> <em>theShapeType</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>&nbsp;</td>
<td class="mdname" nowrap> <em>theState</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>theBox</em>&nbsp;</td><td>Shape for relative comparing. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>theShape</em>&nbsp;</td><td>Shape to find sub-shapes of. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>theShapeType</em>&nbsp;</td><td>Type of sub-shapes to be retrieved. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>theState</em>&nbsp;</td><td>The state of the subshapes to find. It can be one of ST_ON, ST_OUT, ST_ONOUT, ST_IN, ST_ONIN. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>List of all found sub-shapes. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="c7b1da4e965bf551fc87b72ebd6afde7"></a><!-- doxytag: member="geompy::GetShapesOnBoxIDs" ref="c7b1da4e965bf551fc87b72ebd6afde7" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">def geompy::GetShapesOnBoxIDs </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">&nbsp;</td>
<td class="mdname" nowrap> <em>theBox</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>&nbsp;</td>
<td class="mdname" nowrap> <em>theShape</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>&nbsp;</td>
<td class="mdname" nowrap> <em>theShapeType</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>&nbsp;</td>
<td class="mdname" nowrap> <em>theState</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
</td>
</tr>
</table>
<a class="anchor" name="2695635fc745e6aa6cda4545e2133c41"></a><!-- doxytag: member="geompy::GetInPlace" ref="2695635fc745e6aa6cda4545e2133c41" args="" --><p> <a class="anchor" name="2695635fc745e6aa6cda4545e2133c41"></a><!-- doxytag: member="geompy::GetInPlace" ref="2695635fc745e6aa6cda4545e2133c41" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0"> <table class="mdTable" cellpadding="2" cellspacing="0">
<tr> <tr>
@ -3978,6 +4094,50 @@ Example: see GEOM_TestOthers.py </td>
Example: see GEOM_TestOthers.py </td> Example: see GEOM_TestOthers.py </td>
</tr> </tr>
</table> </table>
<a class="anchor" name="808c0723c1cc2c641a02aeaa0d0b45c6"></a><!-- doxytag: member="geompy::GetSame" ref="808c0723c1cc2c641a02aeaa0d0b45c6" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">def geompy::GetSame </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">&nbsp;</td>
<td class="mdname" nowrap> <em>theShapeWhere</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>&nbsp;</td>
<td class="mdname" nowrap> <em>theShapeWhat</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>theShapeWhere</em>&nbsp;</td><td>Shape to find sub-shape of. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>theShapeWhat</em>&nbsp;</td><td>Shape, specifying what to find. </td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>New <a class="el" href="classGEOM__Object.html">GEOM_Object</a> for found sub-shape. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="67706610dda0d5005ee1cdfe2e8362a2"></a><!-- doxytag: member="geompy::GetSubShape" ref="67706610dda0d5005ee1cdfe2e8362a2" args="" --><p> <a class="anchor" name="67706610dda0d5005ee1cdfe2e8362a2"></a><!-- doxytag: member="geompy::GetSubShape" ref="67706610dda0d5005ee1cdfe2e8362a2" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0"> <table class="mdTable" cellpadding="2" cellspacing="0">
<tr> <tr>
@ -5208,13 +5368,13 @@ Example: see GEOM_TestOthers.py </td>
<table border="0" cellspacing="2" cellpadding="0"> <table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ListShapes</em>&nbsp;</td><td>Shapes to be intersected. </td></tr> <tr><td valign="top"></td><td valign="top"><em>ListShapes</em>&nbsp;</td><td>Shapes to be intersected. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ListTools</em>&nbsp;</td><td>Shapes to intersect theShapes. !!!NOTE: Each compound from ListShapes and ListTools will be exploded in order to avoid possible intersection between shapes from this compound.</td></tr> <tr><td valign="top"></td><td valign="top"><em>ListTools</em>&nbsp;</td><td>Shapes to intersect theShapes. !!!NOTE: Each compound from ListShapes and ListTools will be exploded in order to avoid possible intersection between shapes from this compound.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>Limit</em>&nbsp;</td><td>Type of resulting shapes (corresponding to TopAbs_ShapeEnum). </td></tr>
</table> </table>
</dl> </dl>
After implementation new version of PartitionAlgo (October 2006) other parameters are ignored by current functionality. They are kept in this function only for support old versions. Ignored parameters: <dl compact><dt><b>Parameters:</b></dt><dd> After implementation new version of PartitionAlgo (October 2006) other parameters are ignored by current functionality. They are kept in this function only for support old versions. Ignored parameters: <dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0"> <table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>ListKeepInside</em>&nbsp;</td><td>Shapes, outside which the results will be deleted. Each shape from theKeepInside must belong to theShapes also. </td></tr> <tr><td valign="top"></td><td valign="top"><em>ListKeepInside</em>&nbsp;</td><td>Shapes, outside which the results will be deleted. Each shape from theKeepInside must belong to theShapes also. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ListRemoveInside</em>&nbsp;</td><td>Shapes, inside which the results will be deleted. Each shape from theRemoveInside must belong to theShapes also. </td></tr> <tr><td valign="top"></td><td valign="top"><em>ListRemoveInside</em>&nbsp;</td><td>Shapes, inside which the results will be deleted. Each shape from theRemoveInside must belong to theShapes also. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Limit</em>&nbsp;</td><td>Type of resulting shapes (corresponding to TopAbs_ShapeEnum). </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RemoveWebs</em>&nbsp;</td><td>If TRUE, perform Glue 3D algorithm. </td></tr> <tr><td valign="top"></td><td valign="top"><em>RemoveWebs</em>&nbsp;</td><td>If TRUE, perform Glue 3D algorithm. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ListMaterials</em>&nbsp;</td><td>Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.</td></tr> <tr><td valign="top"></td><td valign="top"><em>ListMaterials</em>&nbsp;</td><td>Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.</td></tr>
</table> </table>
@ -5223,7 +5383,7 @@ After implementation new version of PartitionAlgo (October 2006) other parameter
Example: see GEOM_TestAll.py </td> Example: see GEOM_TestAll.py </td>
</tr> </tr>
</table> </table>
<a class="anchor" name="dcdde81ee91dd4fffbd61f027fce692b"></a><!-- doxytag: member="geompy::MakePartitionNonSelfIntersectedShape" ref="dcdde81ee91dd4fffbd61f027fce692b" args="" --><p> <a class="anchor" name="85a4e715d0d0e4c8c9960372bfeb5327"></a><!-- doxytag: member="geompy::MakePartitionNonSelfIntersectedShape" ref="85a4e715d0d0e4c8c9960372bfeb5327" args="" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0"> <table class="mdTable" cellpadding="2" cellspacing="0">
<tr> <tr>
<td class="mdRow"> <td class="mdRow">
@ -5289,7 +5449,7 @@ Example: see GEOM_TestAll.py </td>
<p> <p>
This method may be useful if it is needed to make a partition for compound contains nonintersected shapes. Performance will be better since intersection between shapes from compound is not performed.<p> This method may be useful if it is needed to make a partition for compound contains nonintersected shapes. Performance will be better since intersection between shapes from compound is not performed.<p>
Description of all parameters as in previous method <a class="el" href="namespacegeompy.html#56f48212a436f46c02722f627d27e7f2">MakePartition()</a><p> Description of all parameters as in previous method <a class="el" href="namespacegeompy.html#56f48212a436f46c02722f627d27e7f2">MakePartition()</a><p>
!!!NOTE: Compounds from ListShapes can not have intersections with each other and compounds from ListTools can not have intersections with each other.<p> !!!NOTE: Passed compounds (via ListShapes or via ListTools) have to consist of nonintersecting shapes.<p>
<dl compact><dt><b>Returns:</b></dt><dd>New <a class="el" href="classGEOM__Object.html">GEOM_Object</a>, containing the result shapes. </dd></dl> <dl compact><dt><b>Returns:</b></dt><dd>New <a class="el" href="classGEOM__Object.html">GEOM_Object</a>, containing the result shapes. </dd></dl>
</td> </td>
</tr> </tr>

View File

@ -1645,13 +1645,21 @@ module GEOM
* Perform partition operation. * Perform partition operation.
* \param theShapes Shapes to be intersected. * \param theShapes Shapes to be intersected.
* \param theTools Shapes to intersect theShapes. * \param theTools Shapes to intersect theShapes.
* \note Each compound from ListShapes and ListTools will be exploded in order
* to avoid possible intersection between shapes from this compound.
* \param theLimit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
*
* After implementation new version of PartitionAlgo (October 2006)
* other parameters are ignored by current functionality. They are kept
* in this function only for supporting old versions.
* Ignored parameters:
* \param theKeepInside Shapes, outside which the results will be deleted. * \param theKeepInside Shapes, outside which the results will be deleted.
* Each shape from theKeepInside must belong to theShapes also. * Each shape from theKeepInside must belong to theShapes also.
* \param theRemoveInside Shapes, inside which the results will be deleted. * \param theRemoveInside Shapes, inside which the results will be deleted.
* Each shape from theRemoveInside must belong to theShapes also. * Each shape from theRemoveInside must belong to theShapes also.
* \param theLimit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
* \param theRemoveWebs If TRUE, perform Glue 3D algorithm. * \param theRemoveWebs If TRUE, perform Glue 3D algorithm.
* \param theMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE. * \param theMaterials Material indices for each shape. Make sence, only if theRemoveWebs is TRUE.
*
* \return New GEOM_Object, containing the result shapes. * \return New GEOM_Object, containing the result shapes.
*/ */
GEOM_Object MakePartition (in ListOfGO theShapes, GEOM_Object MakePartition (in ListOfGO theShapes,
@ -1662,6 +1670,27 @@ module GEOM
in boolean theRemoveWebs, in boolean theRemoveWebs,
in ListOfLong theMaterials); in ListOfLong theMaterials);
/*!
* Perform partition operation.
* This method may be usefull if it is needed to make a partition for
* a compound containing nonintersected shapes. Performance will be better
* since intersection between shapes from compound is not performed.
*
* Description of all parameters as in previous method MakePartition()
*
* \note Passed compounds (via ListShapes or via ListTools)
* have to consist of nonintersecting shapes.
*
* \return New GEOM_Object, containing the result shapes.
*/
GEOM_Object MakePartitionNonSelfIntersectedShape (in ListOfGO theShapes,
in ListOfGO theTools,
in ListOfGO theKeepInside,
in ListOfGO theRemoveInside,
in short theLimit,
in boolean theRemoveWebs,
in ListOfLong theMaterials);
/*! /*!
* Perform partition of the Shape with the Plane * Perform partition of the Shape with the Plane
* \param theShape Shape to be intersected. * \param theShape Shape to be intersected.

View File

@ -17,6 +17,7 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include <GEOMImpl_IBooleanOperations.hxx> #include <GEOMImpl_IBooleanOperations.hxx>
@ -146,7 +147,8 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
const Handle(TColStd_HSequenceOfTransient)& theRemoveIns, const Handle(TColStd_HSequenceOfTransient)& theRemoveIns,
const Standard_Integer theLimit, const Standard_Integer theLimit,
const Standard_Boolean theRemoveWebs, const Standard_Boolean theRemoveWebs,
const Handle(TColStd_HArray1OfInteger)& theMaterials) const Handle(TColStd_HArray1OfInteger)& theMaterials,
const Standard_Boolean thePerformSelfIntersections)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -154,8 +156,11 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
Handle(GEOM_Object) aPartition = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION); Handle(GEOM_Object) aPartition = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION);
//Add a new Partition function //Add a new Partition function
Handle(GEOM_Function) aFunction = Handle(GEOM_Function) aFunction;
aPartition->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_PARTITION); if (thePerformSelfIntersections)
aFunction = aPartition->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_PARTITION);
else
aFunction = aPartition->AddFunction(GEOMImpl_PartitionDriver::GetID(), PARTITION_NO_SELF_INTERSECTIONS);
if (aFunction.IsNull()) return NULL; if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly //Check if the function is set correctly
@ -163,9 +168,6 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
GEOMImpl_IPartition aCI (aFunction); GEOMImpl_IPartition aCI (aFunction);
// int aLen = theShapes.size();
// aCI.SetLength(aLen);
Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient;
Handle(TColStd_HSequenceOfTransient) aToolsSeq = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aToolsSeq = new TColStd_HSequenceOfTransient;
Handle(TColStd_HSequenceOfTransient) aKeepInsSeq = new TColStd_HSequenceOfTransient; Handle(TColStd_HSequenceOfTransient) aKeepInsSeq = new TColStd_HSequenceOfTransient;
@ -280,13 +282,17 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakePartition
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction); GEOM::TPythonDump pd (aFunction);
if (thePerformSelfIntersections)
pd << aPartition << " = geompy.MakePartition(["; pd << aPartition << " = geompy.MakePartition([";
else
pd << aPartition << " = geompy.MakePartitionNonSelfIntersectedShape([";
// Shapes, Tools // Shapes, Tools
pd << aShapesDescr.ToCString() << "], [" << aToolsDescr.ToCString() << "], ["; pd << aShapesDescr.ToCString() << "], [" << aToolsDescr.ToCString() << "], [";
// Keep Ins, Remove Ins // Keep Ins, Remove Ins
pd << aKeepInsDescr.ToCString() << "], [" << aRemoveInsDescr.ToCString() << "], "; pd << aKeepInsDescr.ToCString() << "], [" << aRemoveInsDescr.ToCString() << "], ";
// Limit, Remove Webs // Limit, Remove Webs
pd << theLimit << ", " << (int)theRemoveWebs << ", ["; pd << TopAbs_ShapeEnum(theLimit) << ", " << (int)theRemoveWebs << ", [";
// Materials // Materials
if (!theMaterials.IsNull() && theMaterials->Length() > 0) { if (!theMaterials.IsNull() && theMaterials->Length() > 0) {
int i = theMaterials->Lower(); int i = theMaterials->Lower();
@ -315,7 +321,7 @@ Handle(GEOM_Object) GEOMImpl_IBooleanOperations::MakeHalfPartition
if (theShape.IsNull() || thePlane.IsNull()) return NULL; if (theShape.IsNull() || thePlane.IsNull()) return NULL;
//Add a new Boolean object //Add a new Boolean object
Handle(GEOM_Object) aPart = GetEngine()->AddObject(GetDocID(), GEOM_BOOLEAN); Handle(GEOM_Object) aPart = GetEngine()->AddObject(GetDocID(), GEOM_PARTITION);
//Add a new Partition function //Add a new Partition function
Handle(GEOM_Function) aFunction = Handle(GEOM_Function) aFunction =

View File

@ -23,8 +23,6 @@
#include "GEOM_IOperations.hxx" #include "GEOM_IOperations.hxx"
//#include "TColStd_HSequenceOfTransient.hxx"
#include "list" #include "list"
class GEOM_Engine; class GEOM_Engine;
@ -40,13 +38,15 @@ class GEOMImpl_IBooleanOperations : public GEOM_IOperations {
Handle(GEOM_Object) theShape2, Handle(GEOM_Object) theShape2,
Standard_Integer theOp); Standard_Integer theOp);
Standard_EXPORT Handle(GEOM_Object) MakePartition (const Handle(TColStd_HSequenceOfTransient)& theShapes, Standard_EXPORT Handle(GEOM_Object) MakePartition
(const Handle(TColStd_HSequenceOfTransient)& theShapes,
const Handle(TColStd_HSequenceOfTransient)& theTools, const Handle(TColStd_HSequenceOfTransient)& theTools,
const Handle(TColStd_HSequenceOfTransient)& theKeepInside, const Handle(TColStd_HSequenceOfTransient)& theKeepInside,
const Handle(TColStd_HSequenceOfTransient)& theRemoveInside, const Handle(TColStd_HSequenceOfTransient)& theRemoveInside,
const Standard_Integer theLimit, const Standard_Integer theLimit,
const Standard_Boolean theRemoveWebs, const Standard_Boolean theRemoveWebs,
const Handle(TColStd_HArray1OfInteger)& theMaterials); const Handle(TColStd_HArray1OfInteger)& theMaterials,
const Standard_Boolean thePerformSelfIntersections);
Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) MakeHalfPartition (Handle(GEOM_Object) theShape,
Handle(GEOM_Object) thePlane); Handle(GEOM_Object) thePlane);

View File

@ -36,12 +36,13 @@
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <BRepAlgo.hxx> #include <BRepAlgo.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopoDS.hxx> #include <TopoDS.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <TopAbs.hxx> #include <TopoDS_Iterator.hxx>
#include <TopExp.hxx>
#include <TopTools_MapOfShape.hxx> #include <TopTools_MapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx> #include <TopTools_ListIteratorOfListOfShape.hxx>
@ -70,6 +71,31 @@ GEOMImpl_PartitionDriver::GEOMImpl_PartitionDriver()
{ {
} }
//=======================================================================
//function : SimplifyCompound
//purpose :
//=======================================================================
static void PrepareShapes (const TopoDS_Shape& theShape,
Standard_Integer theType,
TopTools_ListOfShape& theSimpleList)
{
if (theType == PARTITION_NO_SELF_INTERSECTIONS ||
theShape.ShapeType() != TopAbs_COMPOUND) {
theSimpleList.Append(theShape);
return;
}
// explode compound on simple shapes to allow their intersections
TopoDS_Iterator It (theShape, Standard_True, Standard_True);
TopTools_MapOfShape mapShape;
for (; It.More(); It.Next()) {
if (mapShape.Add(It.Value())) {
TopoDS_Shape curSh = It.Value();
PrepareShapes(curSh, theType, theSimpleList);
}
}
}
//======================================================================= //=======================================================================
//function : Execute //function : Execute
//purpose : //purpose :
@ -86,19 +112,21 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
//sklNMTAlgo_Splitter1 PS; //sklNMTAlgo_Splitter1 PS;
GEOMAlgo_Splitter PS; GEOMAlgo_Splitter PS;
if (aType == PARTITION_PARTITION) { if (aType == PARTITION_PARTITION || aType == PARTITION_NO_SELF_INTERSECTIONS)
{
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
Handle(TColStd_HSequenceOfTransient) aTools = aCI.GetTools(); Handle(TColStd_HSequenceOfTransient) aTools = aCI.GetTools();
Handle(TColStd_HSequenceOfTransient) aKeepIns = aCI.GetKeepIns(); Handle(TColStd_HSequenceOfTransient) aKeepIns = aCI.GetKeepIns();
Handle(TColStd_HSequenceOfTransient) aRemIns = aCI.GetRemoveIns(); Handle(TColStd_HSequenceOfTransient) aRemIns = aCI.GetRemoveIns();
Handle(TColStd_HArray1OfInteger) aMaterials = aCI.GetMaterials(); Handle(TColStd_HArray1OfInteger) aMaterials = aCI.GetMaterials();
//sklStandard_Boolean DoRemoveWebs = !aMaterials.IsNull(); //skl Standard_Boolean DoRemoveWebs = !aMaterials.IsNull();
unsigned int ind, nbshapes = 0; unsigned int ind;
nbshapes += aShapes->Length() + aTools->Length(); //unsigned int ind, nbshapes = 0;
nbshapes += aKeepIns->Length() + aRemIns->Length(); //nbshapes += aShapes->Length() + aTools->Length();
//nbshapes += aKeepIns->Length() + aRemIns->Length();
TopTools_MapOfShape ShapesMap(nbshapes), ToolsMap(nbshapes); //TopTools_MapOfShape ShapesMap(nbshapes), ToolsMap(nbshapes);
TopTools_MapOfShape ShapesMap, ToolsMap;
// add object shapes that are in ListShapes; // add object shapes that are in ListShapes;
for (ind = 1; ind <= aShapes->Length(); ind++) { for (ind = 1; ind <= aShapes->Length(); ind++) {
@ -107,12 +135,19 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
if (aShape_i.IsNull()) { if (aShape_i.IsNull()) {
Standard_NullObject::Raise("In Partition a shape is null"); Standard_NullObject::Raise("In Partition a shape is null");
} }
if (ShapesMap.Add(aShape_i)) { //
PS.AddShape(aShape_i); TopTools_ListOfShape aSimpleShapes;
//skl if (DoRemoveWebs) { PrepareShapes(aShape_i, aType, aSimpleShapes);
//skl if (aMaterials->Length() >= ind) TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
//skl PS.SetMaterial(aShape_i, aMaterials->Value(ind)); for (; aSimpleIter.More(); aSimpleIter.Next()) {
//skl } const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (ShapesMap.Add(aSimpleSh)) {
PS.AddShape(aSimpleSh);
//skl if (DoRemoveWebs) {
//skl if (aMaterials->Length() >= ind)
//skl PS.SetMaterial(aSimpleSh, aMaterials->Value(ind));
//skl }
}
} }
} }
@ -123,8 +158,15 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
if (aShape_i.IsNull()) { if (aShape_i.IsNull()) {
Standard_NullObject::Raise("In Partition a tool shape is null"); Standard_NullObject::Raise("In Partition a tool shape is null");
} }
if (!ShapesMap.Contains(aShape_i) && ToolsMap.Add(aShape_i)) { //
PS.AddTool(aShape_i); TopTools_ListOfShape aSimpleShapes;
PrepareShapes(aShape_i, aType, aSimpleShapes);
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
for (; aSimpleIter.More(); aSimpleIter.Next()) {
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (!ShapesMap.Contains(aSimpleSh) && ToolsMap.Add(aSimpleSh)) {
PS.AddTool(aSimpleSh);
}
} }
} }
@ -135,8 +177,15 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
if (aShape_i.IsNull()) { if (aShape_i.IsNull()) {
Standard_NullObject::Raise("In Partition a Keep Inside shape is null"); Standard_NullObject::Raise("In Partition a Keep Inside shape is null");
} }
if (!ToolsMap.Contains(aShape_i) && ShapesMap.Add(aShape_i)) //
PS.AddShape(aShape_i); TopTools_ListOfShape aSimpleShapes;
PrepareShapes(aShape_i, aType, aSimpleShapes);
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
for (; aSimpleIter.More(); aSimpleIter.Next()) {
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (!ToolsMap.Contains(aSimpleSh) && ShapesMap.Add(aSimpleSh))
PS.AddShape(aSimpleSh);
}
} }
// add shapes that are in ListRemoveInside, as object shapes; // add shapes that are in ListRemoveInside, as object shapes;
@ -146,16 +195,23 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
if (aShape_i.IsNull()) { if (aShape_i.IsNull()) {
Standard_NullObject::Raise("In Partition a Remove Inside shape is null"); Standard_NullObject::Raise("In Partition a Remove Inside shape is null");
} }
if (!ToolsMap.Contains(aShape_i) && ShapesMap.Add(aShape_i)) //
PS.AddShape(aShape_i); TopTools_ListOfShape aSimpleShapes;
PrepareShapes(aShape_i, aType, aSimpleShapes);
TopTools_ListIteratorOfListOfShape aSimpleIter (aSimpleShapes);
for (; aSimpleIter.More(); aSimpleIter.Next()) {
const TopoDS_Shape& aSimpleSh = aSimpleIter.Value();
if (!ToolsMap.Contains(aSimpleSh) && ShapesMap.Add(aSimpleSh))
PS.AddShape(aSimpleSh);
}
} }
PS.SetLimit( (TopAbs_ShapeEnum)aCI.GetLimit() ); PS.SetLimit( (TopAbs_ShapeEnum)aCI.GetLimit() );
PS.Perform(); PS.Perform();
//sklPS.Compute(); //skl PS.Compute();
//sklPS.SetRemoveWebs(!DoRemoveWebs); //skl PS.SetRemoveWebs(!DoRemoveWebs);
//sklPS.Build((TopAbs_ShapeEnum) aCI.GetLimit()); //skl PS.Build((TopAbs_ShapeEnum) aCI.GetLimit());
/*skl /*skl
// suppress result outside of shapes in KInsideMap // suppress result outside of shapes in KInsideMap
for (ind = 1; ind <= aKeepIns->Length(); ind++) { for (ind = 1; ind <= aKeepIns->Length(); ind++) {
@ -172,7 +228,8 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
} }
*/ */
} }
else if (aType == PARTITION_HALF) { else if (aType == PARTITION_HALF)
{
Handle(GEOM_Function) aRefShape = aCI.GetShape(); Handle(GEOM_Function) aRefShape = aCI.GetShape();
Handle(GEOM_Function) aRefPlane = aCI.GetPlane(); Handle(GEOM_Function) aRefPlane = aCI.GetPlane();
TopoDS_Shape aShapeArg = aRefShape->GetValue(); TopoDS_Shape aShapeArg = aRefShape->GetValue();
@ -188,7 +245,7 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
// add tool shapes that are in ListTools and not in ListShapes; // add tool shapes that are in ListTools and not in ListShapes;
PS.AddTool(aPlaneArg); PS.AddTool(aPlaneArg);
//sklPS.Compute(); //skl PS.Compute();
PS.Perform(); PS.Perform();
//PS.SetRemoveWebs(Standard_False); //PS.SetRemoveWebs(Standard_False);
//PS.Build(aShapeArg.ShapeType()); //PS.Build(aShapeArg.ShapeType());

View File

@ -173,6 +173,7 @@
#define PARTITION_PARTITION 1 #define PARTITION_PARTITION 1
#define PARTITION_HALF 2 #define PARTITION_HALF 2
#define PARTITION_NO_SELF_INTERSECTIONS 3
#define POLYLINE_POINTS 1 #define POLYLINE_POINTS 1

View File

@ -17,6 +17,7 @@
// //
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
// //
#include <Standard_Stream.hxx> #include <Standard_Stream.hxx>
#include "GEOM_IBooleanOperations_i.hh" #include "GEOM_IBooleanOperations_i.hh"
@ -96,8 +97,8 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
const GEOM::ListOfGO& theTools, const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepIns, const GEOM::ListOfGO& theKeepIns,
const GEOM::ListOfGO& theRemoveIns, const GEOM::ListOfGO& theRemoveIns,
const CORBA::Short theLimit, CORBA::Short theLimit,
const CORBA::Boolean theRemoveWebs, CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials) const GEOM::ListOfLong& theMaterials)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -164,7 +165,94 @@ GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartition
// Make Partition // Make Partition
Handle(GEOM_Object) anObject = Handle(GEOM_Object) anObject =
GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns, GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
theLimit, theRemoveWebs, aMaterials); theLimit, theRemoveWebs, aMaterials,
/*PerformSelfIntersections*/Standard_True);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MakePartitionNonSelfIntersectedShape
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBooleanOperations_i::MakePartitionNonSelfIntersectedShape
(const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepIns,
const GEOM::ListOfGO& theRemoveIns,
CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
int ind, aLen;
Handle(TColStd_HSequenceOfTransient) aShapes = new TColStd_HSequenceOfTransient;
Handle(TColStd_HSequenceOfTransient) aTools = new TColStd_HSequenceOfTransient;
Handle(TColStd_HSequenceOfTransient) aKeepIns = new TColStd_HSequenceOfTransient;
Handle(TColStd_HSequenceOfTransient) aRemIns = new TColStd_HSequenceOfTransient;
Handle(TColStd_HArray1OfInteger) aMaterials;
//Get the shapes
aLen = theShapes.length();
for (ind = 0; ind < aLen; ind++) {
if (theShapes[ind] == NULL) return aGEOMObject._retn();
Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
(theShapes[ind]->GetStudyID(), theShapes[ind]->GetEntry());
if (aSh.IsNull()) return aGEOMObject._retn();
aShapes->Append(aSh);
}
//Get the tools
aLen = theTools.length();
for (ind = 0; ind < aLen; ind++) {
if (theTools[ind] == NULL) return aGEOMObject._retn();
Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
(theTools[ind]->GetStudyID(), theTools[ind]->GetEntry());
if (aSh.IsNull()) return aGEOMObject._retn();
aTools->Append(aSh);
}
//Get the keep inside shapes
aLen = theKeepIns.length();
for (ind = 0; ind < aLen; ind++) {
if (theKeepIns[ind] == NULL) return aGEOMObject._retn();
Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
(theKeepIns[ind]->GetStudyID(), theKeepIns[ind]->GetEntry());
if (aSh.IsNull()) return aGEOMObject._retn();
aKeepIns->Append(aSh);
}
//Get the remove inside shapes
aLen = theRemoveIns.length();
for (ind = 0; ind < aLen; ind++) {
if (theRemoveIns[ind] == NULL) return aGEOMObject._retn();
Handle(GEOM_Object) aSh = GetOperations()->GetEngine()->GetObject
(theRemoveIns[ind]->GetStudyID(), theRemoveIns[ind]->GetEntry());
if (aSh.IsNull()) return aGEOMObject._retn();
aRemIns->Append(aSh);
}
//Get the materials
aLen = theMaterials.length();
if ( aLen ) {
aMaterials = new TColStd_HArray1OfInteger (1, aLen);
for (ind = 0; ind < aLen; ind++) {
aMaterials->SetValue(ind+1, theMaterials[ind]);
}
}
// Make Partition
Handle(GEOM_Object) anObject =
GetOperations()->MakePartition(aShapes, aTools, aKeepIns, aRemIns,
theLimit, theRemoveWebs, aMaterials,
/*PerformSelfIntersections*/Standard_False);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();

View File

@ -51,6 +51,14 @@ class GEOM_IBooleanOperations_i :
CORBA::Boolean theRemoveWebs, CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials); const GEOM::ListOfLong& theMaterials);
GEOM::GEOM_Object_ptr MakePartitionNonSelfIntersectedShape (const GEOM::ListOfGO& theShapes,
const GEOM::ListOfGO& theTools,
const GEOM::ListOfGO& theKeepInside,
const GEOM::ListOfGO& theRemoveInside,
CORBA::Short theLimit,
CORBA::Boolean theRemoveWebs,
const GEOM::ListOfLong& theMaterials);
GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeHalfPartition (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr thePlane); GEOM::GEOM_Object_ptr thePlane);

View File

@ -1379,27 +1379,13 @@ def MakeFuse(s1, s2):
def MakeSection(s1, s2): def MakeSection(s1, s2):
return MakeBoolean(s1, s2, 4) return MakeBoolean(s1, s2, 4)
## Perform explode of compound
# Auxilary method for MakePartition
def ExplodeCompound(aComp):
ResListShapes = []
shapes = SubShapeAll(aComp,ShapeType["SHAPE"])
nbss = len(shapes)
for i in range(0,nbss):
if shapes[i].GetShapeType()==GEOM.COMPOUND:
ResListShapes.extend(ExplodeCompound(shapes[i]))
else:
ResListShapes.append(shapes[i])
pass
pass
return ResListShapes
## Perform partition operation. ## Perform partition operation.
# @param ListShapes Shapes to be intersected. # @param ListShapes Shapes to be intersected.
# @param ListTools Shapes to intersect theShapes. # @param ListTools Shapes to intersect theShapes.
# !!!NOTE: Each compound from ListShapes and ListTools will be exploded # !!!NOTE: Each compound from ListShapes and ListTools will be exploded
# in order to avoid possible intersection between shapes from # in order to avoid possible intersection between shapes from
# this compound. # this compound.
# @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
# #
# After implementation new version of PartitionAlgo (October 2006) # After implementation new version of PartitionAlgo (October 2006)
# other parameters are ignored by current functionality. They are kept # other parameters are ignored by current functionality. They are kept
@ -1409,7 +1395,6 @@ def ExplodeCompound(aComp):
# Each shape from theKeepInside must belong to theShapes also. # Each shape from theKeepInside must belong to theShapes also.
# @param ListRemoveInside Shapes, inside which the results will be deleted. # @param ListRemoveInside Shapes, inside which the results will be deleted.
# Each shape from theRemoveInside must belong to theShapes also. # Each shape from theRemoveInside must belong to theShapes also.
# @param Limit Type of resulting shapes (corresponding to TopAbs_ShapeEnum).
# @param RemoveWebs If TRUE, perform Glue 3D algorithm. # @param RemoveWebs If TRUE, perform Glue 3D algorithm.
# @param ListMaterials Material indices for each shape. Make sence, # @param ListMaterials Material indices for each shape. Make sence,
# only if theRemoveWebs is TRUE. # only if theRemoveWebs is TRUE.
@ -1419,28 +1404,12 @@ def ExplodeCompound(aComp):
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
anObj = BoolOp.MakePartition(ListShapes, ListTools,
NewListShapes = []
nbs = len(ListShapes)
for i in range(0,nbs):
if ListShapes[i].GetShapeType()==GEOM.COMPOUND:
# need to explode
NewListShapes.extend(ExplodeCompound(ListShapes[i]))
else: NewListShapes.append(ListShapes[i])
pass
NewListTools = []
nbs = len(ListTools)
for i in range(0,nbs):
if ListTools[i].GetShapeType()==GEOM.COMPOUND:
# need to explode
NewListTools.extend(ExplodeCompound(ListTools[i]))
else: NewListTools.append(ListTools[i])
pass
return MakePartitionNonSelfIntersectedShape(NewListShapes, NewListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials) Limit, RemoveWebs, ListMaterials);
if BoolOp.IsDone() == 0:
print "MakePartition : ", BoolOp.GetErrorCode()
return anObj
## Perform partition operation. ## Perform partition operation.
# This method may be useful if it is needed to make a partition for # This method may be useful if it is needed to make a partition for
@ -1449,19 +1418,18 @@ def MakePartition(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=
# #
# Description of all parameters as in previous method MakePartition() # Description of all parameters as in previous method MakePartition()
# #
# !!!NOTE: Compounds from ListShapes can not have intersections with each # !!!NOTE: Passed compounds (via ListShapes or via ListTools)
# other and compounds from ListTools can not have intersections # have to consist of nonintersecting shapes.
# with each other.
# #
# @return New GEOM_Object, containing the result shapes. # @return New GEOM_Object, containing the result shapes.
# #
def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[], def MakePartitionNonSelfIntersectedShape(ListShapes, ListTools=[], ListKeepInside=[], ListRemoveInside=[],
Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]): Limit=ShapeType["SHAPE"], RemoveWebs=0, ListMaterials=[]):
anObj = BoolOp.MakePartition(ListShapes, ListTools, anObj = BoolOp.MakePartitionNonSelfIntersectedShape(ListShapes, ListTools,
ListKeepInside, ListRemoveInside, ListKeepInside, ListRemoveInside,
Limit, RemoveWebs, ListMaterials); Limit, RemoveWebs, ListMaterials);
if BoolOp.IsDone() == 0: if BoolOp.IsDone() == 0:
print "MakePartition : ", BoolOp.GetErrorCode() print "MakePartitionNonSelfIntersectedShape : ", BoolOp.GetErrorCode()
return anObj return anObj
## Shortcut to MakePartition() ## Shortcut to MakePartition()