0022767: [EDF] Construction of composite solids

This commit is contained in:
vsr 2014-11-13 18:53:32 +03:00
parent 70cddf0bd7
commit 00995421b1
27 changed files with 525 additions and 82 deletions

View File

@ -0,0 +1,46 @@
# Creation of a Solid(s) from connected faces
import salome
salome.salome_init()
import GEOM
from salome.geom import geomBuilder
geompy = geomBuilder.New(salome.myStudy)
gg = salome.ImportComponentGUI("GEOM")
# create a box
box = geompy.MakeBoxDXDYDZ(200, 200, 200)
# make a copy of a box translated by X coordinate
box_translation = geompy.MakeTranslation(box, 200, 0, 0)
# extract shells from boxes
box_shell = geompy.SubShapeAllSorted(box, geompy.ShapeType["SHELL"])[0]
box_translation_shell = geompy.SubShapeAllSorted(box_translation, geompy.ShapeType["SHELL"])[0]
# extract faces from boxes
box_faces = geompy.SubShapeAllSorted(box, geompy.ShapeType["FACE"])
box_translation_faces = geompy.SubShapeAllSorted(box_translation, geompy.ShapeType["FACE"])
# create solids from shells
msf_shells_noint = geompy.MakeSolidFromConnectedFaces([box_shell, box_translation_shell],0)
msf_shells_int = geompy.MakeSolidFromConnectedFaces([box_shell, box_translation_shell], 1)
# create solids from faces
msf_faces_noint = geompy.MakeSolidFromConnectedFaces(box_faces+box_translation_faces, 0)
msf_faces_int = geompy.MakeSolidFromConnectedFaces(box_faces+box_translation_faces, 1)
# add objects in the study
id_solid_shells_noint = geompy.addToStudy(msf_shells_noint,"Solid_from_shells_no_intersect")
id_solid_shells_int = geompy.addToStudy(msf_shells_int,"Solid_from_shells_intersect")
id_solid_faces_noint = geompy.addToStudy(msf_faces_noint,"Solid_from_faces_no_intersect")
id_solid_faces_int = geompy.addToStudy(msf_faces_int,"Solid_from_faces_intersect")
# display the results
gg.createAndDisplayGO(id_solid_shells_noint)
gg.setDisplayMode(id_solid_shells_noint,1)
gg.createAndDisplayGO(id_solid_shells_int)
gg.setDisplayMode(id_solid_shells_int,1)
gg.createAndDisplayGO(id_solid_faces_noint)
gg.setDisplayMode(id_solid_faces_noint,1)
gg.createAndDisplayGO(id_solid_faces_int)
gg.setDisplayMode(id_solid_faces_int,1)

BIN
doc/salome/gui/GEOM/images/neo-obj6.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -2,24 +2,40 @@
\page create_solid_page Solid \page create_solid_page Solid
\n To create a \b Solid in the <b>Main Menu</b> select <b>New Entity - > Build - > To create a \b Solid in the <b>Main Menu</b> select <b>New Entity - > Build - >
Solid</b>. Solid</b>.
You can create a \b Solid from a list of shells. Firstly, you can create a \b Solid from a list of shells.
The \b Result will be a \b GEOM_Object (SOLID). The \b Result will be a \b GEOM_Object (SOLID).
\n <b>TUI Command:</b> <em>geompy.MakeSolid(ListOfShape),</em> where <b>TUI Command:</b> <em>geompy.MakeSolid(ListOfShape),</em> where
ListOfShape is a list of shells from which the solid is constructed. \c ListOfShape is a list of shells from which the solid is constructed.
\n <b>Arguments:</b> Name + A closed shell or a list of closed shells.
<b>Arguments:</b> Name + A closed shell or a list of closed shells.
\image html neo-obj6.png \image html neo-obj6.png
\n <b>Example:</b> <b>Example:</b>
\image html solidsn.png "Solid" \image html solidsn.png "Solid"
Secondly, it is possible to create a \b Solid (or a compound of solids) from a list of
connected faces or shells.
The \b Result will be a \b GEOM_Object (SOLID or COMPOUND).
<b>TUI Command:</b> <em>geompy.MakeSolidFromConnectedFaces(ListOfShape, isIntersect),</em> where
\c ListOfShape is a list of faces and/or shells from which the solid is constructed and
\c isIntersect is a boolean flag which, when set to \c True, forces performing intersection
between arguments
<b>Arguments:</b> Name + A set of connected faces and/or shells + Boolean flag.
\image html neo-obj6_2.png
Our <b>TUI Scripts</b> provide you with useful examples of creation of Our <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_solid "Advanced Geometric Objects". \ref tui_creation_solid "Solid from shell" and
\ref tui_creation_solid_from_faces "Solid from connected faces".
*/ */

View File

@ -22,6 +22,10 @@
<br><h2>Creation of a Solid</h2> <br><h2>Creation of a Solid</h2>
\tui_script{topological_geom_objs_ex05.py} \tui_script{topological_geom_objs_ex05.py}
\anchor tui_creation_solid_from_faces
<br><h2>Creation of a Solid from the set of connected faces</h2>
\tui_script{topological_geom_objs_ex07.py}
\anchor tui_creation_compound \anchor tui_creation_compound
<br><h2>Creation of a Compound</h2> <br><h2>Creation of a Compound</h2>
\tui_script{topological_geom_objs_ex06.py} \tui_script{topological_geom_objs_ex06.py}

View File

@ -1966,6 +1966,15 @@ module GEOM
*/ */
GEOM_Object MakeCompound (in ListOfGO theShapes); GEOM_Object MakeCompound (in ListOfGO theShapes);
/*!
* \brief Make a solid (or solids) from connected set of faces and/or shells.
* \param theFacesOrShells List of faces and/or shells.
* \param isIntersect If TRUE, forces performing intersections between arguments.
*
* \return New GEOM_Object, containing the created solid (or compound of solids).
*/
GEOM_Object MakeSolidFromConnectedFaces (in ListOfGO theFacesOrShells, in boolean isIntersect);
/*! /*!
* \brief Replace coincident faces in \a theShapes by one face. * \brief Replace coincident faces in \a theShapes by one face.
* \param theShapes Initial shapes. * \param theShapes Initial shapes.

View File

@ -395,6 +395,8 @@ module GEOM
GEOM_Object MakeSolidShell (in GEOM_Object theShell) ; GEOM_Object MakeSolidShell (in GEOM_Object theShell) ;
GEOM_Object MakeSolidShells (in GEOM_List theShells) ; GEOM_Object MakeSolidShells (in GEOM_List theShells) ;
GEOM_Object MakeCompound (in GEOM_List theShapes) ; GEOM_Object MakeCompound (in GEOM_List theShapes) ;
GEOM_Object MakeSolidFromConnectedFaces (in GEOM_List theFacesOrShells,
in boolean isIntersect);
GEOM_Object MakeGlueFaces (in GEOM_Object theShape, GEOM_Object MakeGlueFaces (in GEOM_Object theShape,
in double theTolerance, in double theTolerance,
in boolean doKeepNonSolids); in boolean doKeepNonSolids);

View File

@ -169,6 +169,7 @@ SET( _res_files
shapesonshape.png shapesonshape.png
shared_shapes.png shared_shapes.png
sketch.png sketch.png
solid_from_faces.png
sphere.png sphere.png
spheredxyz.png spheredxyz.png
spherepoint.png spherepoint.png

View File

@ -4327,6 +4327,33 @@
</outParameter-list> </outParameter-list>
<DataStream-list></DataStream-list> <DataStream-list></DataStream-list>
</component-service> </component-service>
<component-service>
<service-name>MakeSolidFromConnectedFaces</service-name>
<service-author>SALOME team</service-author>
<service-version>@SALOMEGEOM_VERSION@</service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<inParameter>
<inParameter-name>theFacesOrShells</inParameter-name>
<inParameter-type>GEOM/GEOM_List</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
<inParameter>
<inParameter-name>isIntersect</inParameter-name>
<inParameter-type>boolean</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
</inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>GEOM/GEOM_Object</outParameter-type>
<outParameter-comment>unknown</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service> <component-service>
<service-name>MakeCompound</service-name> <service-name>MakeCompound</service-name>
<service-author>SALOME team</service-author> <service-author>SALOME team</service-author>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -50,30 +50,37 @@
BuildGUI_SolidDlg::BuildGUI_SolidDlg( GeometryGUI* theGeometryGUI, QWidget* parent ) BuildGUI_SolidDlg::BuildGUI_SolidDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent ) : GEOMBase_Skeleton( theGeometryGUI, parent )
{ {
QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_SOLID" ) ) ); QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) ); QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_BUILD_SOLID" ) ) );
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_SOLID_FROM_FACES" ) ) );
setWindowTitle( tr( "GEOM_SOLID_TITLE" ) ); setWindowTitle( tr( "GEOM_SOLID_TITLE" ) );
/***************************************************************/ /***************************************************************/
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SOLID" ) ); mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SOLID" ) );
mainFrame()->RadioButton1->setIcon( image0 ); mainFrame()->RadioButton1->setIcon( image1 );
mainFrame()->RadioButton2->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton2->setIcon( image2 );
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose ); mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close(); mainFrame()->RadioButton3->close();
GroupSolid = new DlgRef_1Sel1Check( centralWidget() ); GroupSolid = new DlgRef_1Sel1Check( centralWidget() );
GroupSolid->GroupBox1->setTitle( tr( "GEOM_SOLID_SHELLS" ) );
GroupSolid->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
GroupSolid->TextLabel1->setText( tr( "GEOM_OBJECTS" ) ); GroupSolid->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupSolid->CheckButton1->setText( tr( "GEOM_CREATE_SINGLE_SOLID" ) ); GroupSolid->CheckButton1->setText( tr( "GEOM_CREATE_SINGLE_SOLID" ) );
GroupSolid->PushButton1->setIcon( image1 ); GroupSolid->PushButton1->setIcon( image0 );
GroupSolid->LineEdit1->setReadOnly( true ); GroupSolid->LineEdit1->setReadOnly( true );
GroupFaces = new DlgRef_1Sel1Check( centralWidget() );
GroupFaces->GroupBox1->setTitle( tr( "GEOM_SOLID_FACES" ) );
GroupFaces->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
GroupFaces->CheckButton1->setText( tr( "GEOM_SOLID_FROM_FACE_OPT" ) );
GroupFaces->PushButton1->setIcon( image0 );
GroupFaces->LineEdit1->setReadOnly( true );
QVBoxLayout* layout = new QVBoxLayout( centralWidget() ); QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 ); layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupSolid ); layout->addWidget( GroupSolid );
layout->addWidget( GroupFaces );
/***************************************************************/ /***************************************************************/
setHelpFileName("create_solid_page.html"); setHelpFileName("create_solid_page.html");
@ -118,7 +125,10 @@ void BuildGUI_SolidDlg::Init()
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
connect( GroupSolid->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) ); connect( GroupSolid->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupFaces->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupSolid->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( EnableNameField( bool ) ) ); connect( GroupSolid->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( EnableNameField( bool ) ) );
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
@ -126,6 +136,8 @@ void BuildGUI_SolidDlg::Init()
initName( tr( "GEOM_SOLID" ) ); initName( tr( "GEOM_SOLID" ) );
SelectionIntoArgument(); SelectionIntoArgument();
ConstructorsClicked(0);
} }
@ -150,9 +162,45 @@ bool BuildGUI_SolidDlg::ClickOnApply()
return false; return false;
initName(); initName();
myEditCurrentArgument->setText("");
ConstructorsClicked(getConstructorId());
return true; return true;
} }
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void BuildGUI_SolidDlg::ConstructorsClicked(int constructorId)
{
switch (constructorId) {
case 0:
{
globalSelection();
GroupFaces->hide();
GroupSolid->show();
myEditCurrentArgument = GroupSolid->LineEdit1;
GroupSolid->LineEdit1->setText("");
break;
}
case 1:
{
globalSelection();
GroupSolid->hide();
GroupFaces->show();
myEditCurrentArgument = GroupFaces->LineEdit1;
GroupFaces->LineEdit1->setText("");
break;
}
}
qApp->processEvents();
updateGeometry();
resize(minimumSizeHint());
SelectionIntoArgument();
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
@ -164,7 +212,10 @@ void BuildGUI_SolidDlg::SelectionIntoArgument()
//myShells = getSelected( TopAbs_SHELL, -1 ); //myShells = getSelected( TopAbs_SHELL, -1 );
QList<TopAbs_ShapeEnum> types; QList<TopAbs_ShapeEnum> types;
if (myEditCurrentArgument == GroupSolid->LineEdit1)
types << TopAbs_SHELL << TopAbs_COMPOUND; types << TopAbs_SHELL << TopAbs_COMPOUND;
else if (myEditCurrentArgument == GroupFaces->LineEdit1)
types << TopAbs_FACE << TopAbs_SHELL << TopAbs_COMPOUND;
myShells = getSelected( types, -1 ); myShells = getSelected( types, -1 );
if ( !myShells.isEmpty() ) { if ( !myShells.isEmpty() ) {
@ -180,18 +231,25 @@ void BuildGUI_SolidDlg::SelectionIntoArgument()
void BuildGUI_SolidDlg::SetEditCurrentArgument() void BuildGUI_SolidDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
if ( send != GroupSolid->PushButton1 )
return;
//globalSelection( GEOM_SHELL );
TColStd_MapOfInteger aMap; TColStd_MapOfInteger aMap;
aMap.Add( GEOM_SHELL );
aMap.Add( GEOM_COMPOUNDFILTER );
QList<int> aSubShapes; QList<int> aSubShapes;
aSubShapes.append( GEOM_SHELL ); aMap.Add( GEOM_COMPOUNDFILTER );
globalSelection( aMap, aSubShapes );
myEditCurrentArgument = GroupSolid->LineEdit1; if (send == GroupSolid->PushButton1) {
aMap.Add( GEOM_SHELL );
aSubShapes.append( GEOM_SHELL );
globalSelection( aMap, aSubShapes );
myEditCurrentArgument = GroupSolid->LineEdit1;
}
else if (send == GroupFaces->PushButton1) {
aMap.Add( GEOM_SHELL );
aMap.Add( GEOM_FACE );
aSubShapes.append( GEOM_SHELL );
aSubShapes.append( GEOM_FACE );
globalSelection( aMap, aSubShapes );
myEditCurrentArgument = GroupFaces->LineEdit1;
}
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
SelectionIntoArgument(); SelectionIntoArgument();
@ -205,16 +263,10 @@ void BuildGUI_SolidDlg::SetEditCurrentArgument()
void BuildGUI_SolidDlg::ActivateThisDialog() void BuildGUI_SolidDlg::ActivateThisDialog()
{ {
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); this, SLOT(SelectionIntoArgument()));
//globalSelection( GEOM_SHELL ); ConstructorsClicked(getConstructorId());
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_SHELL );
aMap.Add( GEOM_COMPOUNDFILTER );
QList<int> aSubShapes;
aSubShapes.append( GEOM_SHELL );
globalSelection( aMap, aSubShapes );
} }
@ -257,15 +309,14 @@ bool BuildGUI_SolidDlg::isValid (QString& msg)
GEOM::MeasureOpPtr anOp; GEOM::MeasureOpPtr anOp;
anOp.take(myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId())); anOp.take(myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId()));
if (getConstructorId() == 0 && (!GroupSolid->CheckButton1->isChecked() || myShells.count() == 1)) {
if (!GroupSolid->CheckButton1->isChecked() || myShells.count() == 1) { for (int i = 0, n = myShells.count(); i < n && ok; i++) {
for (int i = 0, n = myShells.count(); i < n && ok; i++) { CORBA::String_var aRes = anOp->IsGoodForSolid(myShells[i].get());
CORBA::String_var aRes = anOp->IsGoodForSolid(myShells[i].get()); if (strlen(aRes.in())) {
if (strlen(aRes.in())) { msg = QObject::tr(aRes.in()).arg(GEOMBase::GetName(myShells[i].get()));
msg = QObject::tr(aRes.in()).arg(GEOMBase::GetName(myShells[i].get())); ok = false;
ok = false; }
} }
}
} }
return ok; return ok;
} }
@ -315,24 +366,41 @@ bool BuildGUI_SolidDlg::isClosed( GEOM::GEOM_Object_ptr shell )
bool BuildGUI_SolidDlg::execute( ObjectList& objects ) bool BuildGUI_SolidDlg::execute( ObjectList& objects )
{ {
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() ); GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
GEOM::GEOM_Object_var anObj;
if ( GroupSolid->CheckButton1->isChecked() ) { switch (getConstructorId()) {
GEOM::ListOfGO_var objlist = new GEOM::ListOfGO(); case 0:
objlist->length( myShells.count() ); {
for ( int i = 0; i < myShells.count(); i++ ) if ( GroupSolid->CheckButton1->isChecked() ) {
objlist[i] = myShells[i].copy(); GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
objlist->length( myShells.count() );
for ( int i = 0; i < myShells.count(); i++ )
objlist[i] = myShells[i].copy();
GEOM::GEOM_Object_var anObj = anOper->MakeSolidShells( objlist.in() ); anObj = anOper->MakeSolidShells( objlist.in() );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
objects.push_back( anObj._retn() ); }
} else {
else { for ( int i = 0, n = myShells.count(); i< n; i++ ){
for ( int i = 0, n = myShells.count(); i< n; i++ ) { anObj = anOper->MakeSolidShell( myShells[ i ].get() );
GEOM::GEOM_Object_var anObj = anOper->MakeSolidShell( myShells[ i ].get() );
if ( !anObj->_is_nil() ) if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
objects.push_back( anObj._retn() ); }
}
break;
}
case 1:
{
GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
objlist->length( myShells.count() );
for ( int i = 0; i < myShells.count(); i++ )
objlist[i] = myShells[i].copy();
anObj = anOper->MakeSolidFromConnectedFaces( objlist.in(), GroupFaces->CheckButton1->isChecked() );
if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
break;
} }
} }

View File

@ -59,12 +59,14 @@ private:
QList<GEOM::GeomObjPtr> myShells; QList<GEOM::GeomObjPtr> myShells;
DlgRef_1Sel1Check* GroupSolid; DlgRef_1Sel1Check* GroupSolid;
DlgRef_1Sel1Check* GroupFaces;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply(); bool ClickOnApply();
void SetEditCurrentArgument(); void SetEditCurrentArgument();
void SelectionIntoArgument(); void SelectionIntoArgument();
void ConstructorsClicked( int );
void ActivateThisDialog(); void ActivateThisDialog();
void EnableNameField( bool ); void EnableNameField( bool );
}; };

View File

@ -175,6 +175,10 @@
<source>ICON_DLG_BUILD_SHELL</source> <source>ICON_DLG_BUILD_SHELL</source>
<translation>build_shell.png</translation> <translation>build_shell.png</translation>
</message> </message>
<message>
<source>ICON_DLG_SOLID_FROM_FACES</source>
<translation>solid_from_faces.png</translation>
</message>
<message> <message>
<source>ICON_DLG_BUILD_SOLID</source> <source>ICON_DLG_BUILD_SOLID</source>
<translation>build_solid.png</translation> <translation>build_solid.png</translation>
@ -1267,6 +1271,10 @@
<source>ICO_SOLID</source> <source>ICO_SOLID</source>
<translation>build_solid.png</translation> <translation>build_solid.png</translation>
</message> </message>
<message>
<source>ICO_SOLID_FROM_FACES</source>
<translation>solid_from_face.png</translation>
</message>
<message> <message>
<source>ICO_SOLID_SEL_ONLY</source> <source>ICO_SOLID_SEL_ONLY</source>
<translation>build_solid.png</translation> <translation>build_solid.png</translation>

View File

@ -707,6 +707,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_FACE_OPT</source> <source>GEOM_FACE_OPT</source>
<translation>Try to create a planar face</translation> <translation>Try to create a planar face</translation>
</message> </message>
<message>
<source>GEOM_SOLID_FROM_FACE_OPT</source>
<translation>Intersect shapes</translation>
</message>
<message> <message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source> <source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>Cannot build a planar face: required tolerance is <translation>Cannot build a planar face: required tolerance is
@ -1944,6 +1948,14 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SOLID_TITLE</source> <source>GEOM_SOLID_TITLE</source>
<translation>Solid Construction</translation> <translation>Solid Construction</translation>
</message> </message>
<message>
<source>GEOM_SOLID_SHELLS</source>
<translation>Make Solid From Shells</translation>
</message>
<message>
<source>GEOM_SOLID_FACES</source>
<translation>Make Solid From Connected Set Of Faces/Shells</translation>
</message>
<message> <message>
<source>GEOM_SPHERE</source> <source>GEOM_SPHERE</source>
<translation>Sphere</translation> <translation>Sphere</translation>
@ -3004,6 +3016,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_SOLID</source> <source>MEN_SOLID</source>
<translation>Solid</translation> <translation>Solid</translation>
</message> </message>
<message>
<source>MEN_SOLID_FROM_FACES</source>
<translation>Solid from connected faces</translation>
</message>
<message> <message>
<source>MEN_SOLID_SEL_ONLY</source> <source>MEN_SOLID_SEL_ONLY</source>
<translation>Solid</translation> <translation>Solid</translation>

View File

@ -723,6 +723,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_FACE_OPT</source> <source>GEOM_FACE_OPT</source>
<translation>Privilégier la création d&apos;une face plane</translation> <translation>Privilégier la création d&apos;une face plane</translation>
</message> </message>
<message>
<source>GEOM_SOLID_FROM_FACE_OPT</source>
<translation type="unfinished">Intersect shapes</translation>
</message>
<message> <message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source> <source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>Impossible de construire une face plane: <translation>Impossible de construire une face plane:
@ -1944,6 +1948,14 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>GEOM_SOLID_TITLE</source> <source>GEOM_SOLID_TITLE</source>
<translation>Construction d&apos;un solide</translation> <translation>Construction d&apos;un solide</translation>
</message> </message>
<message>
<source>GEOM_SOLID_SHELLS</source>
<translation type="unfinished">Make Solid From Shells</translation>
</message>
<message>
<source>GEOM_SOLID_FACES</source>
<translation type="unfinished">Make Solid From Connected Set Of Faces/Shells</translation>
</message>
<message> <message>
<source>GEOM_SPHERE</source> <source>GEOM_SPHERE</source>
<translation>Sphère</translation> <translation>Sphère</translation>
@ -2988,6 +3000,10 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
<source>MEN_SOLID</source> <source>MEN_SOLID</source>
<translation>Solide</translation> <translation>Solide</translation>
</message> </message>
<message>
<source>MEN_SOLID_FROM_FACES</source>
<translation type="unfinished">Solid from connected faces</translation>
</message>
<message> <message>
<source>MEN_SOLID_SEL_ONLY</source> <source>MEN_SOLID_SEL_ONLY</source>
<translation>Solide</translation> <translation>Solide</translation>

View File

@ -703,6 +703,10 @@
<source>GEOM_FACE_OPT</source> <source>GEOM_FACE_OPT</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>GEOM_SOLID_FROM_FACE_OPT</source>
<translation type="unfinished">Intersect shapes</translation>
</message>
<message> <message>
<source>MAKE_FACE_TOLERANCE_TOO_BIG</source> <source>MAKE_FACE_TOLERANCE_TOO_BIG</source>
<translation>平坦な面を作成できません: 作成された顔があまりにも高い耐性</translation> <translation>平坦な面を作成できません: 作成された顔があまりにも高い耐性</translation>
@ -1923,6 +1927,14 @@
<source>GEOM_SOLID_TITLE</source> <source>GEOM_SOLID_TITLE</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>GEOM_SOLID_SHELLS</source>
<translation type="unfinished">Make Solid From Shells</translation>
</message>
<message>
<source>GEOM_SOLID_FACES</source>
<translation type="unfinished">Make Solid From Connected Set Of Faces/Shells</translation>
</message>
<message> <message>
<source>GEOM_SPHERE</source> <source>GEOM_SPHERE</source>
<translation>Sphere</translation> <translation>Sphere</translation>
@ -2971,6 +2983,10 @@
<source>MEN_SOLID</source> <source>MEN_SOLID</source>
<translation></translation> <translation></translation>
</message> </message>
<message>
<source>MEN_SOLID_FROM_FACES</source>
<translation type="unfinished">Solid from connected faces</translation>
</message>
<message> <message>
<source>MEN_SOLID_SEL_ONLY</source> <source>MEN_SOLID_SEL_ONLY</source>
<translation></translation> <translation></translation>

View File

@ -36,6 +36,7 @@ class GEOMImpl_IShapes
SHAPE_ARG_SHAPES = 1, // for Wire, Shell, Solid and Compound SHAPE_ARG_SHAPES = 1, // for Wire, Shell, Solid and Compound
SHAPE_ARG_BASE = 2, // for Face, Solid and Sub-shape SHAPE_ARG_BASE = 2, // for Face, Solid and Sub-shape
SHAPE_ARG_PLANAR = 3, // for Face SHAPE_ARG_PLANAR = 3, // for Face
SHAPE_ARG_INTERSECT = 3, // for Solid From Connected Faces (NOTE: same value as SHAPE_ARG_PLANAR is used!)
SHAPE_ARG_SUBTYPE = 4, // for Sub-shape SHAPE_ARG_SUBTYPE = 4, // for Sub-shape
SHAPE_ARG_INDICES = 5, // for Sub-shape SHAPE_ARG_INDICES = 5, // for Sub-shape
SHAPE_ARG_TOLERANCE = 6, // linear tolerance (for Wire, Edge) SHAPE_ARG_TOLERANCE = 6, // linear tolerance (for Wire, Edge)
@ -81,6 +82,11 @@ class GEOMImpl_IShapes
Standard_Real GetAngularTolerance() { return _func->GetReal(SHAPE_ARG_ANGLE_TOL); } Standard_Real GetAngularTolerance() { return _func->GetReal(SHAPE_ARG_ANGLE_TOL); }
void SetIsIntersect(const Standard_Boolean isIntersect)
{_func->SetInteger(SHAPE_ARG_INTERSECT, isIntersect ? 1 : 0);}
Standard_Boolean GetIsIntersect() { return (_func->GetInteger(SHAPE_ARG_INTERSECT) == 1); }
private: private:
Handle(GEOM_Function) _func; Handle(GEOM_Function) _func;

View File

@ -782,6 +782,77 @@ Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeShape
return aShape; return aShape;
} }
//=============================================================================
/*!
* MakeSolidFromConnectedFaces
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeSolidFromConnectedFaces
(std::list<Handle(GEOM_Object)> theFacesOrShells,
const Standard_Boolean isIntersect)
{
SetErrorCode(KO);
//Add a new object
Handle(GEOM_Object) aSolid = GetEngine()->AddObject(GetDocID(), GEOM_SOLID);
//Add a new function
Handle(GEOM_Function) aFunction =
aSolid->AddFunction(GEOMImpl_ShapeDriver::GetID(), SOLID_FACES);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
GEOMImpl_IShapes aCI (aFunction);
Handle(TColStd_HSequenceOfTransient) aShapesSeq = new TColStd_HSequenceOfTransient;
// Shapes
std::list<Handle(GEOM_Object)>::iterator it = theFacesOrShells.begin();
for (; it != theFacesOrShells.end(); it++) {
Handle(GEOM_Function) aRefSh = (*it)->GetLastFunction();
if (aRefSh.IsNull()) {
SetErrorCode("NULL argument shape for the shape construction");
return NULL;
}
aShapesSeq->Append(aRefSh);
}
aCI.SetShapes(aShapesSeq);
aCI.SetIsIntersect(isIntersect);
//Compute the shape
try {
OCC_CATCH_SIGNALS;
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Shape driver failed");
return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
return NULL;
}
//Make a Python command
GEOM::TPythonDump pd (aFunction);
pd << aSolid << " = geompy.MakeSolidFromConnectedFaces([";
// Shapes
it = theFacesOrShells.begin();
if (it != theFacesOrShells.end()) {
pd << (*it++);
while (it != theFacesOrShells.end()) {
pd << ", " << (*it++);
}
}
pd << "]," << (isIntersect ? "True" : "False") << ")";
SetErrorCode(OK);
return aSolid;
}
//============================================================================= //=============================================================================
/*! /*!
* MakeGlueFaces * MakeGlueFaces

View File

@ -95,6 +95,9 @@ class GEOMImpl_IShapesOperations : public GEOM_IOperations
Standard_EXPORT Handle(GEOM_Object) MakeCompound (std::list<Handle(GEOM_Object)> theShapes); Standard_EXPORT Handle(GEOM_Object) MakeCompound (std::list<Handle(GEOM_Object)> theShapes);
Standard_EXPORT Handle(GEOM_Object) MakeSolidFromConnectedFaces (std::list<Handle(GEOM_Object)> theFacesOrShells,
const Standard_Boolean isIntersect);
Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (std::list< Handle(GEOM_Object) >& theShapes, Standard_EXPORT Handle(GEOM_Object) MakeGlueFaces (std::list< Handle(GEOM_Object) >& theShapes,
const Standard_Real theTolerance, const Standard_Real theTolerance,
const Standard_Boolean doKeepNonSolids); const Standard_Boolean doKeepNonSolids);

View File

@ -98,6 +98,11 @@
#include <Standard_TypeMismatch.hxx> #include <Standard_TypeMismatch.hxx>
#include <Standard_ConstructionError.hxx> #include <Standard_ConstructionError.hxx>
#include <BOPAlgo_PaveFiller.hxx>
#include <BOPAlgo_MakerVolume.hxx>
#include <list>
//modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f //modified by NIZNHY-PKV Wed Dec 28 13:48:20 2011f
//static //static
// void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges, // void KeepEdgesOrder(const Handle(TopTools_HSequenceOfShape)& aEdges,
@ -137,12 +142,12 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
TopoDS_Shape aShape; TopoDS_Shape aShape;
TCollection_AsciiString aWarning; TCollection_AsciiString aWarning;
TopAbs_ShapeEnum anExpectedType = TopAbs_SHAPE; std::list<TopAbs_ShapeEnum> anExpectedType;
BRep_Builder B; BRep_Builder B;
if (aType == WIRE_EDGES) { if (aType == WIRE_EDGES) {
anExpectedType = TopAbs_WIRE; anExpectedType.push_back(TopAbs_WIRE);
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
@ -153,7 +158,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aShape = MakeWireFromEdges(aShapes, aTolerance); aShape = MakeWireFromEdges(aShapes, aTolerance);
} }
else if (aType == FACE_WIRE) { else if (aType == FACE_WIRE) {
anExpectedType = TopAbs_FACE; anExpectedType.push_back(TopAbs_FACE);
Handle(GEOM_Function) aRefBase = aCI.GetBase(); Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aShapeBase = aRefBase->GetValue(); TopoDS_Shape aShapeBase = aRefBase->GetValue();
@ -188,7 +193,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
} }
else if (aType == FACE_WIRES) { else if (aType == FACE_WIRES) {
anExpectedType = TopAbs_FACE; anExpectedType.push_back(TopAbs_FACE);
// Try to build a face from a set of wires and edges // Try to build a face from a set of wires and edges
int ind; int ind;
@ -310,9 +315,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
} }
else if (aType == FACE_FROM_SURFACE) { else if (aType == FACE_FROM_SURFACE) {
#ifdef RESULT_TYPE_CHECK anExpectedType.push_back(TopAbs_FACE);
anExpectedType = TopAbs_FACE;
#endif
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
@ -348,7 +351,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
} }
else if (aType == SHELL_FACES) { else if (aType == SHELL_FACES) {
anExpectedType = TopAbs_SHELL; anExpectedType.push_back(TopAbs_SHELL);
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length(); unsigned int ind, nbshapes = aShapes->Length();
@ -407,7 +410,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
else if (aType == SOLID_SHELLS) { else if (aType == SOLID_SHELLS) {
anExpectedType = TopAbs_SOLID; anExpectedType.push_back(TopAbs_SOLID);
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length(); unsigned int ind, nbshapes = aShapes->Length();
@ -441,7 +444,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aShape = Sol; aShape = Sol;
} }
else if (aType == COMPOUND_SHAPES) { else if (aType == COMPOUND_SHAPES) {
anExpectedType = TopAbs_COMPOUND; anExpectedType.push_back(TopAbs_COMPOUND);
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes(); Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length(); unsigned int ind, nbshapes = aShapes->Length();
@ -462,7 +465,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
else if (aType == EDGE_WIRE) { else if (aType == EDGE_WIRE) {
anExpectedType = TopAbs_EDGE; anExpectedType.push_back(TopAbs_EDGE);
Handle(GEOM_Function) aRefBase = aCI.GetBase(); Handle(GEOM_Function) aRefBase = aCI.GetBase();
TopoDS_Shape aWire = aRefBase->GetValue(); TopoDS_Shape aWire = aRefBase->GetValue();
@ -472,8 +475,35 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aShape = MakeEdgeFromWire(aWire, LinTol, AngTol); aShape = MakeEdgeFromWire(aWire, LinTol, AngTol);
} }
else if (aType == SOLID_FACES) {
anExpectedType.push_back(TopAbs_SOLID);
anExpectedType.push_back(TopAbs_COMPOUND);
anExpectedType.push_back(TopAbs_COMPSOLID);
Handle(TColStd_HSequenceOfTransient) aShapes = aCI.GetShapes();
unsigned int ind, nbshapes = aShapes->Length();
// add faces
BOPCol_ListOfShape aLS;
for (ind = 1; ind <= nbshapes; ind++) {
Handle(GEOM_Function) aRefShape = Handle(GEOM_Function)::DownCast(aShapes->Value(ind));
TopoDS_Shape aShape_i = aRefShape->GetValue();
if (aShape_i.IsNull()) {
Standard_NullObject::Raise("Shape for solid construction is null");
}
aLS.Append(aShape_i);
}
BOPAlgo_MakerVolume aMV;
aMV.SetArguments(aLS);
aMV.SetIntersect(aCI.GetIsIntersect());
aMV.Perform();
if (aMV.ErrorStatus()) return 0;
aShape = aMV.Shape();
}
else if (aType == EDGE_CURVE_LENGTH) { else if (aType == EDGE_CURVE_LENGTH) {
anExpectedType = TopAbs_EDGE; anExpectedType.push_back(TopAbs_EDGE);
GEOMImpl_IVector aVI (aFunction); GEOMImpl_IVector aVI (aFunction);
@ -575,9 +605,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
("Shape for isoline construction is not a face"); ("Shape for isoline construction is not a face");
} }
} else if (aType == EDGE_UV) { } else if (aType == EDGE_UV) {
#ifdef RESULT_TYPE_CHECK anExpectedType.push_back(TopAbs_EDGE);
anExpectedType = TopAbs_EDGE;
#endif
GEOMImpl_IShapeExtend aSE (aFunction); GEOMImpl_IShapeExtend aSE (aFunction);
Handle(GEOM_Function) aRefEdge = aSE.GetShape(); Handle(GEOM_Function) aRefEdge = aSE.GetShape();
TopoDS_Shape aShapeEdge = aRefEdge->GetValue(); TopoDS_Shape aShapeEdge = aRefEdge->GetValue();
@ -588,9 +616,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aShape = ExtendEdge(anEdge, aSE.GetUMin(), aSE.GetUMax()); aShape = ExtendEdge(anEdge, aSE.GetUMin(), aSE.GetUMax());
} }
} else if (aType == FACE_UV) { } else if (aType == FACE_UV) {
#ifdef RESULT_TYPE_CHECK anExpectedType.push_back(TopAbs_FACE);
anExpectedType = TopAbs_FACE;
#endif
GEOMImpl_IShapeExtend aSE (aFunction); GEOMImpl_IShapeExtend aSE (aFunction);
Handle(GEOM_Function) aRefFace = aSE.GetShape(); Handle(GEOM_Function) aRefFace = aSE.GetShape();
@ -604,9 +630,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aSE.GetVMin(), aSE.GetVMax()); aSE.GetVMin(), aSE.GetVMax());
} }
} else if (aType == SURFACE_FROM_FACE) { } else if (aType == SURFACE_FROM_FACE) {
#ifdef RESULT_TYPE_CHECK anExpectedType.push_back(TopAbs_FACE);
anExpectedType = TopAbs_FACE;
#endif
GEOMImpl_IShapeExtend aSE (aFunction); GEOMImpl_IShapeExtend aSE (aFunction);
Handle(GEOM_Function) aRefFace = aSE.GetShape(); Handle(GEOM_Function) aRefFace = aSE.GetShape();
@ -663,8 +687,13 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
// Check if the result shape type is compatible with the expected. // Check if the result shape type is compatible with the expected.
const TopAbs_ShapeEnum aShType = aShape.ShapeType(); const TopAbs_ShapeEnum aShType = aShape.ShapeType();
if (anExpectedType != TopAbs_SHAPE && anExpectedType != aShType) { if (!anExpectedType.empty()) {
Standard_ConstructionError::Raise("Result type check failed"); bool ok = false;
std::list<TopAbs_ShapeEnum>::const_iterator it;
for (it = anExpectedType.begin(); it != anExpectedType.end() && !ok; ++it)
ok = (*it == TopAbs_SHAPE || *it == aShType);
if (!ok)
Standard_ConstructionError::Raise("Result type check failed");
} }
aFunction->SetValue(aShape); aFunction->SetValue(aShape);
@ -1516,6 +1545,11 @@ GetCreationInformation(std::string& theOperationName,
theOperationName = "SOLID"; theOperationName = "SOLID";
AddParam( theParams, "Objects", aCI.GetShapes() ); AddParam( theParams, "Objects", aCI.GetShapes() );
break; break;
case SOLID_FACES:
theOperationName = "SOLID_FROM_FACES";
AddParam( theParams, "Objects", aCI.GetShapes() );
AddParam( theParams, "Is intersect", aCI.GetIsIntersect() );
break;
case COMPOUND_SHAPES: case COMPOUND_SHAPES:
theOperationName = "COMPOUND"; theOperationName = "COMPOUND";
AddParam( theParams, "Objects", aCI.GetShapes() ); AddParam( theParams, "Objects", aCI.GetShapes() );

View File

@ -311,7 +311,7 @@
#define EDGE_UV 16 #define EDGE_UV 16
#define FACE_UV 17 #define FACE_UV 17
#define SURFACE_FROM_FACE 18 #define SURFACE_FROM_FACE 18
#define SOLID_FACES 19
#define ARCHIMEDE_TYPE 1 #define ARCHIMEDE_TYPE 1

View File

@ -406,6 +406,40 @@ GEOM_IShapesOperations_i::MakeCompound (const GEOM::ListOfGO& theShapes)
return GetObject(anObject); return GetObject(anObject);
} }
//=============================================================================
/*!
* MakeSolidFromConnectedFaces
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeSolidFromConnectedFaces
(const GEOM::ListOfGO& theFacesOrShells,
const CORBA::Boolean isIntersect)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
int ind, aLen;
std::list<Handle(GEOM_Object)> aShapes;
//Get the shapes
aLen = theFacesOrShells.length();
for (ind = 0; ind < aLen; ind++) {
Handle(GEOM_Object) aSh = GetObjectImpl(theFacesOrShells[ind]);
if (aSh.IsNull()) return aGEOMObject._retn();
aShapes.push_back(aSh);
}
// Make Solid
Handle(GEOM_Object) anObject =
GetOperations()->MakeSolidFromConnectedFaces(aShapes, isIntersect);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//============================================================================= //=============================================================================
/*! /*!
* MakeGlueFaces * MakeGlueFaces

View File

@ -75,6 +75,9 @@ class GEOM_I_EXPORT GEOM_IShapesOperations_i :
GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes); GEOM::GEOM_Object_ptr MakeCompound (const GEOM::ListOfGO& theShapes);
GEOM::GEOM_Object_ptr MakeSolidFromConnectedFaces (const GEOM::ListOfGO& theFacesOrShells,
CORBA::Boolean isIntersect);
GEOM::GEOM_Object_ptr MakeGlueFaces (const GEOM::ListOfGO& theShape, GEOM::GEOM_Object_ptr MakeGlueFaces (const GEOM::ListOfGO& theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids); CORBA::Boolean doKeepNonSolids);

View File

@ -2341,6 +2341,25 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCompound (GEOM::GEOM_List_ptr theShapes
return NULL; return NULL;
} }
//=============================================================================
// MakeSolidFromConnectedFaces:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSolidFromConnectedFaces (GEOM::GEOM_List_ptr theFacesOrShells,
CORBA::Boolean isIntersect)
{
beginService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" );
MESSAGE("GEOM_Superv_i::MakeSolidFromConnectedFaces");
if (GEOM_List_i<GEOM::ListOfGO>* aListImpl =
dynamic_cast<GEOM_List_i<GEOM::ListOfGO>*>(GetServant(theFacesOrShells, myPOA).in())) {
getShapesOp();
GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeSolidFromConnectedFaces(aListImpl->GetList(), isIntersect);
endService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" );
return anObj;
}
endService( " GEOM_Superv_i::MakeSolidFromConnectedFaces" );
return NULL;
}
//============================================================================= //=============================================================================
// MakeGlueFaces: // MakeGlueFaces:
//============================================================================= //=============================================================================

View File

@ -507,6 +507,8 @@ public:
GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell); GEOM::GEOM_Object_ptr MakeSolidShell (GEOM::GEOM_Object_ptr theShell);
GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells); GEOM::GEOM_Object_ptr MakeSolidShells (GEOM::GEOM_List_ptr theShells);
GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes); GEOM::GEOM_Object_ptr MakeCompound (GEOM::GEOM_List_ptr theShapes);
GEOM::GEOM_Object_ptr MakeSolidFromConnectedFaces (GEOM::GEOM_List_ptr theFacesOrShells,
CORBA::Boolean isIntersect);
GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr MakeGlueFaces (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theTolerance, CORBA::Double theTolerance,
CORBA::Boolean doKeepNonSolids); CORBA::Boolean doKeepNonSolids);
@ -534,7 +536,6 @@ public:
CORBA::Short theShapeType, CORBA::Short theShapeType,
GEOM::shape_state theState); GEOM::shape_state theState);
//-----------------------------------------------------------// //-----------------------------------------------------------//
// BlocksOperations // // BlocksOperations //
//-----------------------------------------------------------// //-----------------------------------------------------------//

View File

@ -191,6 +191,12 @@ def TestAll (geompy, math):
prism1_faces[5], prism1_faces[2]]) prism1_faces[5], prism1_faces[2]])
Solid = geompy.MakeSolid([Shell1]) #(List of GEOM_Object)->GEOM_Object Solid = geompy.MakeSolid([Shell1]) #(List of GEOM_Object)->GEOM_Object
Box1_translation = geompy.MakeTranslation(Box1, 10, 0, 0)
Box1_shell = geompy.SubShapeAllSorted(Box1, geompy.ShapeType["SHELL"])[0]
Box1_translation_shell = geompy.SubShapeAllSorted(Box1_translation, geompy.ShapeType["SHELL"])[0]
Solid_from_shells = geompy.MakeSolidFromConnectedFaces([Box1_shell, Box1_translation_shell], 1) #(List of GEOM_Object, Boolean)->GEOM_Object
# Create Isoline # Create Isoline
Isoline = geompy.MakeIsoline(Face1, True, 0.5) #(1 GEOM_Object, Boolean, Double)->GEOM_Object Isoline = geompy.MakeIsoline(Face1, True, 0.5) #(1 GEOM_Object, Boolean, Double)->GEOM_Object
@ -416,6 +422,8 @@ def TestAll (geompy, math):
id_Prism1 = geompy.addToStudy(Prism1, "Prism by Two Pnt") id_Prism1 = geompy.addToStudy(Prism1, "Prism by Two Pnt")
id_Shell1 = geompy.addToStudy(Shell1, "Shell from Prism1 faces") id_Shell1 = geompy.addToStudy(Shell1, "Shell from Prism1 faces")
id_Solid = geompy.addToStudy(Solid, "Solid") id_Solid = geompy.addToStudy(Solid, "Solid")
id_Solid1 = geompy.addToStudy(Solid_from_shells, "Solid1")
id_Compound = geompy.addToStudy(Compound, "Compound") id_Compound = geompy.addToStudy(Compound, "Compound")
id_Plane2 = geompy.addToStudy(Plane2, "Plane on Face") id_Plane2 = geompy.addToStudy(Plane2, "Plane on Face")

View File

@ -4650,6 +4650,39 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
self._autoPublish(anObj, theName, "compound") self._autoPublish(anObj, theName, "compound")
return anObj return anObj
## Create a solid (or solids) from the set of faces and/or shells.
# @param theFacesOrShells List of faces and/or shells.
# @param isIntersect If TRUE, forces performing intersections
# between arguments; otherwise (default) intersection is not performed.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
#
# @return New GEOM.GEOM_Object, containing the created solid (or compound of solids).
#
# @ref tui_creation_solid_from_faces "Example"
@ManageTransactions("ShapesOp")
def MakeSolidFromConnectedFaces(self, theFacesOrShells, isIntersect = False, theName=None):
"""
Create a solid (or solids) from the set of connected faces and/or shells.
Parameters:
theFacesOrShells List of faces and/or shells.
isIntersect If TRUE, forces performing intersections
between arguments; otherwise (default) intersection is not performed
theName Object name; when specified, this parameter is used.
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
New GEOM.GEOM_Object, containing the created solid (or compound of solids).
"""
# Example: see GEOM_TestAll.py
anObj = self.ShapesOp.MakeSolidFromConnectedFaces(theFacesOrShells, isIntersect)
RaiseIfFailed("MakeSolidFromConnectedFaces", self.ShapesOp)
self._autoPublish(anObj, theName, "solid")
return anObj
# end of l3_advanced # end of l3_advanced
## @} ## @}