mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-11-11 16:19:16 +05:00
Merge branch 'occ/shaper2smesh'
This commit is contained in:
commit
6472eab132
@ -347,6 +347,12 @@ module SMESH
|
||||
GEOM::GEOM_Object GetShapeToMesh()
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Replaces a shape in the mesh
|
||||
*/
|
||||
void ReplaceShape(in GEOM::GEOM_Object theNewGeom)
|
||||
raises (SALOME::SALOME_Exception);
|
||||
|
||||
/*!
|
||||
* Return false if the mesh is not yet fully loaded from the study file
|
||||
*/
|
||||
|
@ -208,6 +208,7 @@ SET(SMESH_RESOURCES_FILES
|
||||
mesh_tree_hypo_volume.png
|
||||
mesh_tree_importedmesh.png
|
||||
mesh_tree_mesh.png
|
||||
mesh_tree_mesh_geom_modif.png
|
||||
mesh_tree_mesh_partial.png
|
||||
mesh_tree_mesh_warn.png
|
||||
mesh_triangle.png
|
||||
|
BIN
resources/mesh_tree_mesh_geom_modif.png
Normal file
BIN
resources/mesh_tree_mesh_geom_modif.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
@ -213,7 +213,7 @@ TopAbs_ShapeEnum GeomSelectionTools::entryToShapeType(std::string entry){
|
||||
// if the Geom Object is a group
|
||||
if (aShape->GetType() == GEOM_GROUP){
|
||||
// MESSAGE("It's a group");
|
||||
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
|
||||
GEOM::GEOM_IGroupOperations_ptr aGroupOp =
|
||||
_geomEngine->GetIGroupOperations();
|
||||
ShapeType= (TopAbs_ShapeEnum)aGroupOp->GetType(aShape);
|
||||
}
|
||||
|
@ -87,6 +87,9 @@ class SMESH_EXPORT SMESH_Mesh
|
||||
* \brief Return true if there is a geometry to be meshed, not PseudoShape()
|
||||
*/
|
||||
bool HasShapeToMesh() const { return _isShapeToMesh; }
|
||||
|
||||
void UndefShapeToMesh() { _isShapeToMesh = false; }
|
||||
|
||||
/*!
|
||||
* \brief Return diagonal size of bounding box of shape to mesh.
|
||||
*/
|
||||
|
@ -172,6 +172,7 @@
|
||||
#include <SALOMEDS_Study.hxx>
|
||||
#include <SALOMEDS_SObject.hxx>
|
||||
#include "utilities.h"
|
||||
#include <SALOME_LifeCycleCORBA.hxx>
|
||||
|
||||
// OCCT includes
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
@ -1382,6 +1383,108 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
// Break link with Shaper model
|
||||
void breakShaperLink()
|
||||
{
|
||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
SALOME_ListIO selected;
|
||||
if (aSel) {
|
||||
aSel->selectedObjects(selected);
|
||||
if (selected.Extent()) {
|
||||
Handle(SALOME_InteractiveObject) anIObject = selected.First();
|
||||
_PTR(Study) aStudy = SMESH::getStudy();
|
||||
std::string aEntry = anIObject->getEntry();
|
||||
_PTR(SObject) aSObj = aStudy->FindObjectID(aEntry);
|
||||
if (aSObj) {
|
||||
std::string aName = aSObj->GetName();
|
||||
QMessageBox::StandardButton aRes = SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("MSG_BREAK_SHAPER_LINK").arg(aName.c_str()),
|
||||
SUIT_MessageBox::Yes | SUIT_MessageBox::No, SUIT_MessageBox::No);
|
||||
if (aRes == SUIT_MessageBox::Yes) {
|
||||
SUIT_DataOwnerPtrList aList;
|
||||
aSel->selected(aList, "ObjectBrowser", true);
|
||||
SUIT_DataOwner* aOwn = aList.first();
|
||||
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
|
||||
QString aREntry = sowner->entry();
|
||||
|
||||
static GEOM::GEOM_Gen_var geomGen;
|
||||
if (CORBA::is_nil(geomGen)) {
|
||||
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
|
||||
(SUIT_Session::session()->activeApplication());
|
||||
if (app) {
|
||||
SALOME_LifeCycleCORBA* ls = new SALOME_LifeCycleCORBA(app->namingService());
|
||||
Engines::EngineComponent_var comp =
|
||||
ls->FindOrLoad_Component("FactoryServer", "SHAPERSTUDY");
|
||||
geomGen = GEOM::GEOM_Gen::_narrow(comp);
|
||||
}
|
||||
}
|
||||
if (!CORBA::is_nil(geomGen))
|
||||
{
|
||||
geomGen->BreakLink(aREntry.toStdString().c_str());
|
||||
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
|
||||
|
||||
// remove actors whose objects are removed by BreakLink()
|
||||
QList<SUIT_ViewWindow*> wndList = SMESHGUI::desktop()->windows();
|
||||
SUIT_ViewWindow* wnd;
|
||||
foreach(wnd, wndList)
|
||||
SMESH::UpdateActorsAfterUpdateStudy(wnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return true if a mesh icon == ICON_SMESH_TREE_GEOM_MODIF
|
||||
* which means that the mesh can't be modified. It should be either re-computed
|
||||
* or breakShaperLink()'ed. Warn the user about it.
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool warnOnGeomModif()
|
||||
{
|
||||
SALOME_ListIO selected;
|
||||
if ( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
|
||||
aSel->selectedObjects(selected,"",/*convertReferences=*/false);
|
||||
|
||||
SALOME_ListIteratorOfListIO It( selected );
|
||||
for ( ; It.More(); It.Next() )
|
||||
{
|
||||
Handle(SALOME_InteractiveObject) io = It.Value();
|
||||
if ( !io->hasEntry() ) continue;
|
||||
_PTR(SObject) so = SMESH::getStudy()->FindObjectID( io->getEntry() );
|
||||
SMESH::SMESH_Mesh_var mesh;
|
||||
while ( mesh->_is_nil() && so )
|
||||
{
|
||||
CORBA::Object_var obj = SMESH::SObjectToObject( so );
|
||||
SMESH::SMESH_IDSource_var isrc = SMESH::SMESH_IDSource::_narrow( obj );
|
||||
if ( isrc->_is_nil() )
|
||||
so = so->GetFather();
|
||||
else
|
||||
mesh = isrc->GetMesh();
|
||||
}
|
||||
if ( mesh->_is_nil() ) continue;
|
||||
so = SMESH::FindSObject( mesh );
|
||||
if ( !so ) continue;
|
||||
_PTR(GenericAttribute) attr;
|
||||
so->FindAttribute( attr, "AttributePixMap" );
|
||||
_PTR(AttributePixMap) pixmap = attr;
|
||||
if ( !pixmap ) continue;
|
||||
|
||||
if ( pixmap->GetPixMap() == "ICON_SMESH_TREE_GEOM_MODIF" )
|
||||
{
|
||||
SUIT_MessageBox::warning(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("MSG_WARN_ON_GEOM_MODIF"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap)
|
||||
{
|
||||
SALOME_ListIO selected;
|
||||
@ -2754,16 +2857,19 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
break;
|
||||
}
|
||||
|
||||
case SMESHOp::OpCreateMesh:
|
||||
case SMESHOp::OpCreateSubMesh:
|
||||
case SMESHOp::OpEditMeshOrSubMesh:
|
||||
case SMESHOp::OpEditMesh:
|
||||
case SMESHOp::OpEditSubMesh:
|
||||
case SMESHOp::OpMeshOrder:
|
||||
case SMESHOp::OpCreateSubMesh:
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
case SMESHOp::OpCreateMesh:
|
||||
case SMESHOp::OpCompute:
|
||||
case SMESHOp::OpComputeSubMesh:
|
||||
case SMESHOp::OpPreCompute:
|
||||
case SMESHOp::OpEvaluate:
|
||||
case SMESHOp::OpMeshOrder:
|
||||
startOperation( theCommandID );
|
||||
break;
|
||||
case SMESHOp::OpCopyMesh:
|
||||
@ -2792,6 +2898,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
|
||||
if ( isStudyLocked() )
|
||||
break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
/*Standard_Boolean aRes;
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
|
||||
@ -2822,6 +2930,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
|
||||
if ( isStudyLocked() )
|
||||
break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
EmitSignalDeactivateDialog();
|
||||
SMESHGUI_MultiEditDlg* aDlg = NULL;
|
||||
@ -2840,6 +2950,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpSmoothing:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_SmoothingDlg( this ) )->show();
|
||||
@ -2852,6 +2964,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpExtrusion:
|
||||
{
|
||||
if (isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if (vtkwnd) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_ExtrusionDlg ( this ) )->show();
|
||||
@ -2863,6 +2977,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpExtrusionAlongAPath:
|
||||
{
|
||||
if (isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if (vtkwnd) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
|
||||
@ -2874,6 +2990,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpRevolution:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_RevolutionDlg( this ) )->show();
|
||||
@ -2887,6 +3005,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
{
|
||||
if ( isStudyLocked() )
|
||||
break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd )
|
||||
{
|
||||
EmitSignalDeactivateDialog();
|
||||
@ -2903,6 +3023,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpReorientFaces:
|
||||
case SMESHOp::OpCreateGeometryGroup:
|
||||
{
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
startOperation( theCommandID );
|
||||
break;
|
||||
}
|
||||
@ -2915,6 +3037,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
EmitSignalDeactivateDialog();
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
|
||||
|
||||
@ -2942,6 +3066,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
EmitSignalDeactivateDialog();
|
||||
|
||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
@ -3019,6 +3145,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
EmitSignalDeactivateDialog();
|
||||
|
||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
@ -3116,6 +3244,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
|
||||
if ( isStudyLocked() )
|
||||
break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
EmitSignalDeactivateDialog();
|
||||
|
||||
@ -3136,6 +3266,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
{
|
||||
if ( isStudyLocked() )
|
||||
break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
EmitSignalDeactivateDialog();
|
||||
SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this );
|
||||
@ -3148,6 +3280,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
{
|
||||
if ( isStudyLocked() )
|
||||
break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
EmitSignalDeactivateDialog();
|
||||
SMESHGUI_FaceGroupsSeparatedByEdgesDlg* aDlg = new SMESHGUI_FaceGroupsSeparatedByEdgesDlg( this );
|
||||
@ -3207,6 +3341,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpEditHypothesis:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
SALOME_ListIO selected;
|
||||
@ -3252,6 +3388,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpUnassign: // REMOVE HYPOTHESIS / ALGORITHMS
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
SUIT_OverrideCursor wc;
|
||||
|
||||
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
|
||||
@ -3283,6 +3421,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpHexagonalPrism:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
SMDSAbs_EntityType type = SMDSEntity_Edge;
|
||||
@ -3309,6 +3449,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpPolyhedron:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
|
||||
@ -3332,6 +3474,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpTriQuadraticHexahedron:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
SMDSAbs_EntityType type = SMDSEntity_Last;
|
||||
@ -3363,6 +3507,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpRemoveNodes:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_RemoveNodesDlg( this ) )->show();
|
||||
@ -3376,6 +3522,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpRemoveElements: // REMOVES ELEMENTS
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_RemoveElementsDlg( this ) )->show();
|
||||
@ -3390,6 +3538,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpClearMesh: {
|
||||
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
|
||||
SALOME_ListIO selected;
|
||||
if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
|
||||
@ -3429,6 +3579,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpRemoveOrphanNodes:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
SALOME_ListIO selected;
|
||||
if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
|
||||
aSel->selectedObjects( selected );
|
||||
@ -3468,6 +3620,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpRenumberingNodes:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
|
||||
@ -3482,6 +3636,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpRenumberingElements:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
|
||||
@ -3496,6 +3652,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpTranslation:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_TranslationDlg( this ) )->show();
|
||||
@ -3509,6 +3667,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpRotation:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_RotationDlg( this ) )->show();
|
||||
@ -3522,6 +3682,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpSymmetry:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if(vtkwnd) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_SymmetryDlg( this ) )->show();
|
||||
@ -3535,6 +3697,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpScale:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_ScaleDlg( this ) )->show();
|
||||
@ -3549,6 +3713,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpOffset:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_OffsetDlg( this ) )->show();
|
||||
@ -3563,6 +3729,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpSewing:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if(vtkwnd) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_SewingDlg( this ) )->show();
|
||||
@ -3576,6 +3744,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpMergeNodes:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if(vtkwnd) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_MergeDlg( this, 0 ) )->show();
|
||||
@ -3589,6 +3759,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpMergeElements:
|
||||
{
|
||||
if (isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if (vtkwnd) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_MergeDlg( this, 1 ) )->show();
|
||||
@ -3600,12 +3772,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
|
||||
case SMESHOp::OpMoveNode: // MAKE MESH PASS THROUGH POINT
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
startOperation( SMESHOp::OpMoveNode );
|
||||
break;
|
||||
|
||||
case SMESHOp::OpDuplicateNodes:
|
||||
{
|
||||
if(isStudyLocked()) break;
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
if ( vtkwnd ) {
|
||||
EmitSignalDeactivateDialog();
|
||||
( new SMESHGUI_DuplicateNodesDlg( this ) )->show();
|
||||
@ -3618,6 +3794,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
}
|
||||
|
||||
case SMESHOp::OpElem0DOnElemNodes: // 0D_ON_ALL_NODES
|
||||
if ( warnOnGeomModif() )
|
||||
break; // action forbiden as geometry modified
|
||||
startOperation( SMESHOp::OpElem0DOnElemNodes );
|
||||
break;
|
||||
|
||||
@ -3751,6 +3929,9 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
|
||||
case SMESHOp::OpSortChild:
|
||||
::sortChildren();
|
||||
break;
|
||||
case SMESHOp::OpBreakLink:
|
||||
::breakShaperLink();
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
@ -4084,6 +4265,8 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
|
||||
createSMESHAction( SMESHOp::OpSortChild, "SORT_CHILD_ITEMS" );
|
||||
|
||||
createSMESHAction( SMESHOp::OpBreakLink, "BREAK_SHAPER_LINK" );
|
||||
|
||||
QList<int> aCtrlActions;
|
||||
aCtrlActions << SMESHOp::OpFreeNode << SMESHOp::OpEqualNode
|
||||
<< SMESHOp::OpNodeConnectivityNb // node controls
|
||||
@ -4857,6 +5040,9 @@ void SMESHGUI::initialize( CAM_Application* app )
|
||||
popupMgr()->setRule( action( SMESHOp::OpSortChild ), "$component={'SMESH'} and client='ObjectBrowser' and isContainer and nbChildren>1", QtxPopupMgr::VisibleRule );
|
||||
popupMgr()->insert( separator(), -1, -1 );
|
||||
|
||||
popupMgr()->insert( action( SMESHOp::OpBreakLink), -1, -1 );
|
||||
popupMgr()->setRule( action( SMESHOp::OpBreakLink), "$component={'SHAPERSTUDY'} and client='ObjectBrowser' and canBreakLink", QtxPopupMgr::VisibleRule );
|
||||
|
||||
connect( application(), SIGNAL( viewManagerActivated( SUIT_ViewManager* ) ),
|
||||
this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
|
||||
|
||||
|
@ -951,7 +951,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
SMESH::SMESH_IDSource_var aSubMeshObj =
|
||||
SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj );
|
||||
SMESH_Actor *anActor = SMESH::FindActorByObject( aSubMeshObj );
|
||||
if ( anActor && anActor->GetVisibility() )
|
||||
if ( anActor /*&& anActor->GetVisibility()*/ )
|
||||
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj ));
|
||||
}
|
||||
// put Groups into list
|
||||
@ -967,7 +967,7 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
SMESH::SMESH_IDSource_var aGroupObj =
|
||||
SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO );
|
||||
SMESH_Actor *anActor = SMESH::FindActorByObject( aGroupObj );
|
||||
if ( anActor && anActor->GetVisibility() )
|
||||
if ( anActor /*&& anActor->GetVisibility()*/ )
|
||||
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO ));
|
||||
}
|
||||
|
||||
@ -994,6 +994,13 @@ void SMESHGUI_BaseComputeOp::computeMesh()
|
||||
//SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); -- 23615
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SMESH_Actor *anActor = SMESH::FindActorByEntry( entry.c_str() );
|
||||
anActor->Update();
|
||||
if ( !anActor->GetVisibility() )
|
||||
continue;
|
||||
}
|
||||
SMESH::UpdateView( SMESH::eDisplay, entry.c_str() );
|
||||
|
||||
if ( SVTK_ViewWindow* vtkWnd = SMESH::GetVtkViewWindow(SMESH::GetActiveWindow() ))
|
||||
@ -1251,8 +1258,8 @@ void SMESHGUI_BaseComputeOp::stopOperation()
|
||||
|
||||
void SMESHGUI_BaseComputeOp::onPublishShape()
|
||||
{
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( meshShape );
|
||||
|
||||
QStringList entryList;
|
||||
QList<int> rows;
|
||||
@ -1273,7 +1280,7 @@ void SMESHGUI_BaseComputeOp::onPublishShape()
|
||||
// look for myMainShape in the table
|
||||
for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) {
|
||||
if ( table()->item( r, COL_SHAPEID )->text() == "1" ) {
|
||||
if ( so->_is_nil() ) {
|
||||
if ( !so->_is_nil() ) {
|
||||
CORBA::String_var name = so->GetName();
|
||||
CORBA::String_var entry = so->GetID();
|
||||
QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() );
|
||||
|
@ -91,9 +91,6 @@ GetAllFields(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes,
|
||||
{
|
||||
myFields = & fields;
|
||||
myTree->clear();
|
||||
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations();
|
||||
|
||||
for ( int iM = 0; iM < meshes.count(); ++iM )
|
||||
{
|
||||
@ -109,6 +106,9 @@ GetAllFields(const QList< QPair< SMESH::SMESH_IDSource_var, QString > >& meshes,
|
||||
QTreeWidgetItem* meshItem = createItem( myTree, meshes[iM].second, iM );
|
||||
|
||||
GEOM::GEOM_Object_var shape = mesh->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( shape );
|
||||
GEOM::GEOM_IFieldOperations_wrap fieldOp = geomGen->GetIFieldOperations();
|
||||
|
||||
fields = fieldOp->GetFields( shape );
|
||||
for ( size_t iF = 0; iF < fields->length(); ++iF )
|
||||
{
|
||||
|
@ -44,16 +44,12 @@
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
GEOM::GEOM_Gen_var GetGEOMGen()
|
||||
GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go )
|
||||
{
|
||||
static GEOM::GEOM_Gen_var aGEOMGen;
|
||||
|
||||
if(CORBA::is_nil(aGEOMGen)) {
|
||||
if ( GeometryGUI::GetGeomGen()->_is_nil() )
|
||||
GeometryGUI::InitGeomGen();
|
||||
aGEOMGen = GeometryGUI::GetGeomGen();
|
||||
}
|
||||
return aGEOMGen;
|
||||
GEOM::GEOM_Gen_ptr gen;
|
||||
if ( !CORBA::is_nil( go ))
|
||||
gen = go->GetGen();
|
||||
return gen;
|
||||
}
|
||||
|
||||
GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh(_PTR(SObject) theMeshOrSubmesh,
|
||||
@ -155,14 +151,18 @@ namespace SMESH
|
||||
GEOM::GEOM_Object_ptr GetSubShape (GEOM::GEOM_Object_ptr theMainShape,
|
||||
long theID)
|
||||
{
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
if ( CORBA::is_nil( theMainShape ))
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( theMainShape );
|
||||
if (geomGen->_is_nil())
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
GEOM::GEOM_IShapesOperations_wrap aShapesOp =
|
||||
geomGen->GetIShapesOperations();
|
||||
|
||||
GEOM::GEOM_IShapesOperations_wrap aShapesOp = geomGen->GetIShapesOperations();
|
||||
if (aShapesOp->_is_nil())
|
||||
return GEOM::GEOM_Object::_nil();
|
||||
GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape (theMainShape,theID);
|
||||
|
||||
GEOM::GEOM_Object_wrap subShape = aShapesOp->GetSubShape( theMainShape, theID );
|
||||
return subShape._retn();
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ class QString;
|
||||
|
||||
namespace SMESH
|
||||
{
|
||||
SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen();
|
||||
SMESHGUI_EXPORT GEOM::GEOM_Gen_var GetGEOMGen( GEOM::GEOM_Object_ptr go );
|
||||
|
||||
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetShapeOnMeshOrSubMesh( _PTR(SObject), bool* isMesh=0 );
|
||||
|
||||
@ -53,7 +53,7 @@ namespace SMESH
|
||||
|
||||
SMESHGUI_EXPORT GEOM::GEOM_Object_var GetGeom( Handle(SALOME_InteractiveObject) io );
|
||||
|
||||
SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO );
|
||||
SMESHGUI_EXPORT char* GetGeomName( _PTR(SObject) smeshSO );
|
||||
|
||||
SMESHGUI_EXPORT GEOM::GEOM_Object_ptr GetSubShape( GEOM::GEOM_Object_ptr, long );
|
||||
|
||||
|
@ -1055,27 +1055,27 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
}
|
||||
else {
|
||||
SMESH::SMESH_Gen_var aSMESHGen = SMESHGUI::GetSMESHGen();
|
||||
if ( aSMESHGen->_is_nil() )
|
||||
if ( aSMESHGen->_is_nil() || myGeomObjects->length() == 0 )
|
||||
return false;
|
||||
|
||||
// create a geometry group
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( myGeomObjects[0] );
|
||||
if (geomGen->_is_nil())
|
||||
return false;
|
||||
|
||||
GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
|
||||
GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
|
||||
if (op->_is_nil())
|
||||
return false;
|
||||
|
||||
// check and add all selected GEOM objects: they must be
|
||||
// a sub-shapes of the main GEOM and must be of one type
|
||||
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
|
||||
for ( int i =0; i < (int)myGeomObjects->length(); i++) {
|
||||
for ( CORBA::ULong i =0; i < myGeomObjects->length(); i++)
|
||||
{
|
||||
TopAbs_ShapeEnum aSubShapeType = (TopAbs_ShapeEnum)myGeomObjects[i]->GetShapeType();
|
||||
if (i == 0)
|
||||
if ( i == 0 )
|
||||
aGroupType = aSubShapeType;
|
||||
else if (aSubShapeType != aGroupType) {
|
||||
else if ( aSubShapeType != aGroupType ) {
|
||||
aGroupType = TopAbs_SHAPE;
|
||||
break;
|
||||
}
|
||||
@ -1083,6 +1083,8 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
|
||||
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
|
||||
GEOM::GEOM_Object_wrap aGroupVar = op->CreateGroup(aMeshShape, aGroupType);
|
||||
if ( aGroupVar->_is_nil() )
|
||||
return false;
|
||||
op->UnionList(aGroupVar, myGeomObjects);
|
||||
|
||||
if (op->IsDone()) {
|
||||
@ -1106,7 +1108,7 @@ bool SMESHGUI_GroupDlg::onApply()
|
||||
|
||||
resultGroup = SMESH::SMESH_GroupBase::_narrow( myGroupOnGeom );
|
||||
isCreation = false;
|
||||
}
|
||||
}
|
||||
anIsOk = true;
|
||||
}
|
||||
if (myGrpTypeId == 2) // group on filter
|
||||
@ -1410,13 +1412,15 @@ void SMESHGUI_GroupDlg::onObjectSelectionChanged()
|
||||
|
||||
// The main shape of the group
|
||||
GEOM::GEOM_Object_var aGroupMainShape;
|
||||
if (aGeomGroup->GetType() == 37) {
|
||||
GEOM::GEOM_IGroupOperations_wrap anOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations();
|
||||
aGroupMainShape = anOp->GetMainShape(aGeomGroup);
|
||||
if (aGeomGroup->GetType() == 37)
|
||||
{
|
||||
GEOM::GEOM_IGroupOperations_ptr anOp =
|
||||
SMESH::GetGEOMGen( aGeomGroup )->GetIGroupOperations();
|
||||
aGroupMainShape = anOp->GetMainShape( aGeomGroup );
|
||||
// aGroupMainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
aGroupMainShape = aGeomGroup;
|
||||
aGroupMainShape->Register();
|
||||
}
|
||||
@ -1867,7 +1871,8 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
QListWidgetItem* anItem = 0;
|
||||
QList<QListWidgetItem*> listItemsToSel;
|
||||
|
||||
if (myCurrentLineEdit == 0) {
|
||||
if ( myCurrentLineEdit == 0 )
|
||||
{
|
||||
//if (aNbSel != 1) { myIsBusy = false; return; }
|
||||
QString aListStr = "";
|
||||
int aNbItems = 0;
|
||||
@ -1910,7 +1915,9 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
onListSelectionChanged();
|
||||
listItemsToSel.clear();
|
||||
}
|
||||
} else if (myCurrentLineEdit == mySubMeshLine) {
|
||||
}
|
||||
else if ( myCurrentLineEdit == mySubMeshLine )
|
||||
{
|
||||
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
|
||||
|
||||
SALOME_ListIO aList;
|
||||
@ -1958,7 +1965,9 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
myIsBusy = false;
|
||||
onListSelectionChanged();
|
||||
|
||||
} else if (myCurrentLineEdit == myGroupLine) {
|
||||
}
|
||||
else if ( myCurrentLineEdit == myGroupLine )
|
||||
{
|
||||
//SALOME_ListIteratorOfListIO anIt (mySelectionMgr->StoredIObjects());
|
||||
SALOME_ListIO aList;
|
||||
mySelectionMgr->selectedObjects( aList );
|
||||
@ -2000,9 +2009,11 @@ void SMESHGUI_GroupDlg::onAdd()
|
||||
myIsBusy = false;
|
||||
onListSelectionChanged();
|
||||
|
||||
} else if (myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1) {
|
||||
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations();
|
||||
}
|
||||
else if ( myCurrentLineEdit == myGeomGroupLine && myGeomObjects->length() == 1 )
|
||||
{
|
||||
GEOM::GEOM_IGroupOperations_ptr aGroupOp =
|
||||
SMESH::GetGEOMGen( myGeomObjects[0] )->GetIGroupOperations();
|
||||
|
||||
SMESH::ElementType aGroupType = SMESH::ALL;
|
||||
switch(aGroupOp->GetType(myGeomObjects[0])) {
|
||||
|
@ -220,12 +220,12 @@ SMESH::ElementType SMESHGUI_GroupOnShapeOp::ElementType(GEOM::GEOM_Object_var ge
|
||||
case GEOM::COMPOUND: break;
|
||||
default: return SMESH::ALL;
|
||||
}
|
||||
GEOM::GEOM_IShapesOperations_wrap aShapeOp =
|
||||
SMESH::GetGEOMGen()->GetIShapesOperations();
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( geom );
|
||||
GEOM::GEOM_IShapesOperations_wrap aShapeOp = geomGen->GetIShapesOperations();
|
||||
|
||||
if ( geom->GetType() == 37 ) { // geom group
|
||||
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
|
||||
SMESH::GetGEOMGen()->GetIGroupOperations();
|
||||
if ( geom->GetType() == 37 ) // geom group
|
||||
{
|
||||
GEOM::GEOM_IGroupOperations_ptr aGroupOp = geomGen->GetIGroupOperations();
|
||||
if ( !aGroupOp->_is_nil() ) {
|
||||
// mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
|
||||
GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
|
||||
@ -236,7 +236,8 @@ SMESH::ElementType SMESHGUI_GroupOnShapeOp::ElementType(GEOM::GEOM_Object_var ge
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( !aShapeOp->_is_nil() ) { // just a compoud shape
|
||||
else if ( !aShapeOp->_is_nil() ) // just a compoud shape
|
||||
{
|
||||
GEOM::ListOfLong_var ids = aShapeOp->SubShapeAllIDs( geom, GEOM::SHAPE, false );
|
||||
if ( ids->length() ) {
|
||||
GEOM::GEOM_Object_wrap member = aShapeOp->GetSubShape( geom, ids[0] );
|
||||
|
@ -346,10 +346,10 @@ bool SMESHGUI_MeshOp::isSubshapeOk() const
|
||||
myDlg->selectedObject(SMESHGUI_MeshDlg::Geom, aGEOMs);
|
||||
|
||||
if (aGEOMs.count() > 0) {
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
|
||||
if (geomGen->_is_nil()) return false;
|
||||
|
||||
GEOM::GEOM_IGroupOperations_wrap op = geomGen->GetIGroupOperations();
|
||||
GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
|
||||
if (op->_is_nil()) return false;
|
||||
|
||||
// check all selected shapes
|
||||
@ -1756,7 +1756,7 @@ void SMESHGUI_MeshOp::createSubMeshOnInternalEdges( SMESH::SMESH_Mesh_ptr theMes
|
||||
for ( size_t i = 0; i < internalEdges.size(); ++i )
|
||||
intIDSet.insert( shapeIDs.FindIndex( internalEdges[ i ]));
|
||||
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
GEOM::GEOM_Gen_var geomGen = theMainShape->GetGen();
|
||||
if (geomGen->_is_nil()) return;
|
||||
|
||||
GEOM::GEOM_Object_var edgeGroup;
|
||||
@ -2062,7 +2062,7 @@ bool SMESHGUI_MeshOp::createMesh( QString& theMess, QStringList& theEntryList )
|
||||
{
|
||||
// Create groups on all geom groups
|
||||
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
GEOM::GEOM_Gen_var geomGen = aGeomVar->GetGen();
|
||||
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
|
||||
GEOM::ListOfGO_var geomGroups = op->GetExistingSubObjects( aGeomVar,
|
||||
/*groupsOnly=*/false );
|
||||
@ -2138,11 +2138,11 @@ bool SMESHGUI_MeshOp::createSubMesh( QString& theMess, QStringList& theEntryList
|
||||
else if (aGEOMs.count() > 1)
|
||||
{
|
||||
// create a GEOM group
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
if (!geomGen->_is_nil()) {
|
||||
GEOM::GEOM_IGroupOperations_wrap op =
|
||||
geomGen->GetIGroupOperations();
|
||||
if (!op->_is_nil()) {
|
||||
GEOM::GEOM_Gen_var geomGen = mainGeom->GetGen();
|
||||
if ( !geomGen->_is_nil() ) {
|
||||
GEOM::GEOM_IGroupOperations_ptr op = geomGen->GetIGroupOperations();
|
||||
if ( !op->_is_nil() )
|
||||
{
|
||||
// check and add all selected GEOM objects: they must be
|
||||
// a sub-shapes of the main GEOM and must be of one type
|
||||
int iSubSh = 0;
|
||||
|
@ -230,6 +230,8 @@ namespace SMESHOp {
|
||||
OpClipping = 6100, // POPUP MENU - CLIPPING
|
||||
// SortChild ----------------------//--------------------------------
|
||||
OpSortChild = 6110, // POPUP MENU - SORT CHILDREN
|
||||
// Break link with Shaper object --//--------------------------------
|
||||
OpBreakLink = 6120, // POPUP MENU - Break link with Shaper
|
||||
// Advanced -----------------------//--------------------------------
|
||||
OpAdvancedNoOp = 10000, // NO OPERATION (advanced operations base)
|
||||
//@@ insert new functions before this line @@ do not remove this line @@//
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include <SalomeApp_Application.h>
|
||||
#include <LightApp_VTKSelector.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
#include <LightApp_SelectionMgr.h>
|
||||
#include <LightApp_DataOwner.h>
|
||||
|
||||
// IDL includes
|
||||
#include <SALOMEconfig.h>
|
||||
@ -77,6 +79,8 @@ void SMESHGUI_Selection::init( const QString& client, LightApp_SelectionMgr* mgr
|
||||
|
||||
if( mgr )
|
||||
{
|
||||
myOwners.clear();
|
||||
mgr->selected(myOwners, client);
|
||||
for( int i=0, n=count(); i<n; i++ ) {
|
||||
myTypes.append( typeName( type( entry( i ) ) ) );
|
||||
myControls.append( controlMode( i ) );
|
||||
@ -140,6 +144,7 @@ QVariant SMESHGUI_Selection::parameter( const int ind, const QString& p ) const
|
||||
else if ( p=="nbChildren") val = QVariant( nbChildren( ind ) );
|
||||
else if ( p=="isContainer") val = QVariant( isContainer( ind ) );
|
||||
else if ( p=="guiState") val = QVariant( guiState() );
|
||||
else if ( p=="canBreakLink") val = QVariant( canBreakLink(ind) );
|
||||
|
||||
if ( val.isValid() )
|
||||
return val;
|
||||
@ -605,6 +610,33 @@ bool SMESHGUI_Selection::hasGeomReference( int ind ) const
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : canBreakLink
|
||||
//purpose : returns true if selected object is a Shaper object and it can break link
|
||||
//=======================================================================
|
||||
|
||||
bool SMESHGUI_Selection::canBreakLink( int ind ) const
|
||||
{
|
||||
if ( ind >= 0 && ind < myTypes.count()) {
|
||||
if (isReference(ind)) {
|
||||
SUIT_DataOwner* aOwn = myOwners.at(ind);
|
||||
LightApp_DataOwner* sowner = dynamic_cast<LightApp_DataOwner*>(aOwn);
|
||||
QString aEntry = sowner->entry();
|
||||
_PTR(SObject) aSObject = SMESH::getStudy()->FindObjectID(aEntry.toStdString());
|
||||
_PTR(SObject) aFatherObj = aSObject->GetFather();
|
||||
_PTR(SComponent) aComponent = aFatherObj->GetFatherComponent();
|
||||
if (aComponent->ComponentDataType() == "SMESH") {
|
||||
QString aObjEntry = entry(ind);
|
||||
_PTR(SObject) aGeomSObject = SMESH::getStudy()->FindObjectID(aObjEntry.toStdString());
|
||||
GEOM::GEOM_Object_var aObject = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aGeomSObject);
|
||||
if (!aObject->_is_nil())
|
||||
return aObject->IsParametrical();
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : isEditableHyp
|
||||
//purpose :
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
// SALOME GUI includes
|
||||
#include <LightApp_Selection.h>
|
||||
#include <SUIT_DataOwner.h>
|
||||
|
||||
// SALOME KERNEL includes
|
||||
#include <SALOMEDSClient_definitions.hxx>
|
||||
@ -61,6 +62,7 @@ public:
|
||||
virtual bool hasGeomReference( int ) const;
|
||||
virtual bool isEditableHyp( int ) const;
|
||||
virtual bool isVisible( int ) const;
|
||||
virtual bool canBreakLink(int) const;
|
||||
|
||||
virtual bool isQuadratic( int ) const;
|
||||
virtual QString quadratic2DMode( int ) const;
|
||||
@ -95,6 +97,7 @@ private:
|
||||
QStringList myTypes;
|
||||
QStringList myControls;
|
||||
QList<SMESH_Actor*> myActors;
|
||||
SUIT_DataOwnerPtrList myOwners;
|
||||
};
|
||||
|
||||
#endif // SMESHGUI_SELECTION_H
|
||||
|
@ -318,14 +318,14 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
|
||||
}
|
||||
else
|
||||
{
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
|
||||
|
||||
if (geomGen->_is_nil())
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( aMeshShape );
|
||||
if ( geomGen->_is_nil() )
|
||||
return;
|
||||
|
||||
GEOM::GEOM_IShapesOperations_wrap aShapesOp =
|
||||
geomGen->GetIShapesOperations();
|
||||
if (aShapesOp->_is_nil() )
|
||||
GEOM::GEOM_IShapesOperations_wrap aShapesOp = geomGen->GetIShapesOperations();
|
||||
if ( aShapesOp->_is_nil() )
|
||||
return;
|
||||
|
||||
TopAbs_ShapeEnum aGroupType = TopAbs_SHAPE;
|
||||
@ -333,8 +333,6 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
|
||||
std::map<int, GEOM::GEOM_Object_wrap> aGeomObjectsMap;
|
||||
GEOM::GEOM_Object_wrap aGeomObject;
|
||||
|
||||
GEOM::GEOM_Object_var aMeshShape = myMesh->GetShapeToMesh();
|
||||
|
||||
for ( int i = 0; i < aListId.count(); i++ )
|
||||
{
|
||||
aGeomObject = // received object need UnRegister()!
|
||||
@ -362,9 +360,8 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
|
||||
}
|
||||
else if (aNumberOfGO > 1)
|
||||
{
|
||||
GEOM::GEOM_IGroupOperations_wrap aGroupOp =
|
||||
geomGen->GetIGroupOperations();
|
||||
if(aGroupOp->_is_nil())
|
||||
GEOM::GEOM_IGroupOperations_ptr aGroupOp = geomGen->GetIGroupOperations();
|
||||
if ( aGroupOp->_is_nil() )
|
||||
return;
|
||||
|
||||
GEOM::ListOfGO_var aGeomObjects = new GEOM::ListOfGO();
|
||||
@ -379,7 +376,7 @@ void SMESHGUI_ShapeByMeshOp::commitOperation()
|
||||
aGeomObject = aGroupOp->CreateGroup(aMeshShape, aGroupType);
|
||||
aGroupOp->UnionList(aGeomObject, aGeomObjects);
|
||||
|
||||
if (!aGroupOp->IsDone())
|
||||
if ( !aGroupOp->IsDone() )
|
||||
return;
|
||||
}
|
||||
|
||||
@ -419,7 +416,7 @@ void SMESHGUI_ShapeByMeshOp::onSelectionDone()
|
||||
try {
|
||||
SALOME_ListIO aList;
|
||||
selectionMgr()->selectedObjects(aList);
|
||||
if (!myIsMultipleAllowed && aList.Extent() != 1)
|
||||
if ( aList.IsEmpty() || ( !myIsMultipleAllowed && aList.Extent() != 1) )
|
||||
return;
|
||||
|
||||
SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO(aList.First());
|
||||
|
@ -281,7 +281,7 @@ namespace SMESH
|
||||
_PTR(AttributePixMap) pixMap = attr;
|
||||
toShow = ( pixMap->GetPixMap() != emptyIcon );
|
||||
}
|
||||
smeshActor->Update();
|
||||
//smeshActor->Update();
|
||||
UpdateView( theWindow, toShow ? eDisplay : eErase, io->getEntry() );
|
||||
}
|
||||
}
|
||||
|
@ -531,6 +531,10 @@
|
||||
<source>ICON_SMESH_TREE_MESH_WARN</source>
|
||||
<translation>mesh_tree_mesh_warn.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_SMESH_TREE_GEOM_MODIF</source>
|
||||
<translation>mesh_tree_mesh_geom_modif.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_STD_INFO</source>
|
||||
<translation>standard_mesh_info.png</translation>
|
||||
|
@ -4503,6 +4503,24 @@ It can't be deleted </translation>
|
||||
<source>STB_SORT_CHILD_ITEMS</source>
|
||||
<translation>Sort child items</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_BREAK_SHAPER_LINK</source>
|
||||
<translation>Break link</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_BREAK_SHAPER_LINK</source>
|
||||
<translation>Break link with Shaper model</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MSG_BREAK_SHAPER_LINK</source>
|
||||
<translation>A link with Shaper model for object %1 will be broken.
|
||||
Continue?</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MSG_WARN_ON_GEOM_MODIF</source>
|
||||
<translation>This action is prohibited since the geometry
|
||||
was changed and the mesh needs to be recomputed.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ADVANCED</source>
|
||||
<translation>Advanced</translation>
|
||||
|
@ -4470,6 +4470,21 @@ Il ne peut pas être supprimé.</translation>
|
||||
<source>STB_SORT_CHILD_ITEMS</source>
|
||||
<translation>Trier les items enfants</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_BREAK_SHAPER_LINK</source>
|
||||
<translation>Rompre le lien</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_BREAK_SHAPER_LINK</source>
|
||||
<translation>Rupture du lien avec le modèle Shaper</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MSG_BREAK_SHAPER_LINK</source>
|
||||
<translation>
|
||||
Un lien avec le modèle Shaper pour l'objet %1 sera rompu.
|
||||
Continuer?
|
||||
</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SMESH_ADVANCED</source>
|
||||
<translation>Avancé</translation>
|
||||
|
@ -567,7 +567,8 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod
|
||||
myRemovedObjIDs( theRemovedObjIDs ),
|
||||
myNbFilters( 0 ),
|
||||
myToKeepAllCommands( theToKeepAllCommands ),
|
||||
myGeomIDNb(0), myGeomIDIndex(-1)
|
||||
myGeomIDNb(0), myGeomIDIndex(-1),
|
||||
myShaperIDNb(0), myShaperIDIndex(-1)
|
||||
{
|
||||
// make that GetID() to return TPythonDump::SMESHGenName()
|
||||
GetCreationCmd()->Clear();
|
||||
@ -575,30 +576,38 @@ _pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod
|
||||
GetCreationCmd()->GetString() += "=";
|
||||
|
||||
// Find 1st digit of study entry by which a GEOM object differs from a SMESH object
|
||||
if ( !theObjectNames.IsEmpty() )
|
||||
if (!theObjectNames.IsEmpty())
|
||||
{
|
||||
// find a GEOM entry
|
||||
_pyID geomID;
|
||||
SALOMEDS::SComponent_wrap geomComp = SMESH_Gen_i::getStudyServant()->FindComponent("GEOM");
|
||||
if ( geomComp->_is_nil() ) return;
|
||||
CORBA::String_var entry = geomComp->GetID();
|
||||
geomID = entry.in();
|
||||
// find a GEOM (aPass == 0) and SHAPERSTUDY (aPass == 1) entries
|
||||
for(int aPass = 0; aPass < 2; aPass++) {
|
||||
_pyID geomID;
|
||||
SALOMEDS::SComponent_wrap geomComp = SMESH_Gen_i::getStudyServant()->
|
||||
FindComponent(aPass == 0 ? "GEOM" : "SHAPERSTUDY");
|
||||
if (geomComp->_is_nil()) continue;
|
||||
CORBA::String_var entry = geomComp->GetID();
|
||||
geomID = entry.in();
|
||||
|
||||
// find a SMESH entry
|
||||
_pyID smeshID;
|
||||
Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString e2n( theObjectNames );
|
||||
for ( ; e2n.More() && smeshID.IsEmpty(); e2n.Next() )
|
||||
if ( _pyCommand::IsStudyEntry( e2n.Key() ))
|
||||
smeshID = e2n.Key();
|
||||
// find a SMESH entry
|
||||
_pyID smeshID;
|
||||
Resource_DataMapIteratorOfDataMapOfAsciiStringAsciiString e2n(theObjectNames);
|
||||
for (; e2n.More() && smeshID.IsEmpty(); e2n.Next())
|
||||
if (_pyCommand::IsStudyEntry(e2n.Key()))
|
||||
smeshID = e2n.Key();
|
||||
|
||||
// find 1st difference between smeshID and geomID
|
||||
if ( !geomID.IsEmpty() && !smeshID.IsEmpty() )
|
||||
for ( int i = 1; i <= geomID.Length() && i <= smeshID.Length(); ++i )
|
||||
if ( geomID.Value( i ) != smeshID.Value( i ))
|
||||
{
|
||||
myGeomIDNb = geomID.Value( i );
|
||||
myGeomIDIndex = i;
|
||||
}
|
||||
// find 1st difference between smeshID and geomID
|
||||
if (!geomID.IsEmpty() && !smeshID.IsEmpty())
|
||||
for (int i = 1; i <= geomID.Length() && i <= smeshID.Length(); ++i)
|
||||
if (geomID.Value(i) != smeshID.Value(i))
|
||||
{
|
||||
if (aPass == 0) {
|
||||
myGeomIDNb = geomID.Value(i);
|
||||
myGeomIDIndex = i;
|
||||
} else {
|
||||
myShaperIDNb = geomID.Value(i);
|
||||
myShaperIDIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1680,13 +1689,11 @@ Handle(_pyObject) _pyGen::FindObject( const _pyID& theObjID ) const
|
||||
|
||||
bool _pyGen::IsGeomObject(const _pyID& theObjID) const
|
||||
{
|
||||
if ( myGeomIDNb )
|
||||
{
|
||||
return ( myGeomIDIndex <= theObjID.Length() &&
|
||||
int( theObjID.Value( myGeomIDIndex )) == myGeomIDNb &&
|
||||
_pyCommand::IsStudyEntry( theObjID ));
|
||||
}
|
||||
return false;
|
||||
bool isGeom = myGeomIDNb && myGeomIDIndex <= theObjID.Length() &&
|
||||
int( theObjID.Value( myGeomIDIndex )) == myGeomIDNb;
|
||||
bool isShaper = myShaperIDNb && myShaperIDIndex <= theObjID.Length() &&
|
||||
int( theObjID.Value( myShaperIDIndex )) == myShaperIDNb;
|
||||
return ((isGeom || isShaper) && _pyCommand::IsStudyEntry( theObjID ));
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
@ -3831,6 +3838,8 @@ bool _pyCommand::IsMethodCall()
|
||||
return false;
|
||||
if ( myString.StartsWith("#") )
|
||||
return false;
|
||||
if ( myString.StartsWith("SHAPERSTUDY") ) // skip shaperstudy specific dump string analysis
|
||||
return false;
|
||||
const char* s = myString.ToCString() + GetBegPos( METHOD_IND ) + myMeth.Length() - 1;
|
||||
return ( s[0] == '(' || s[1] == '(' );
|
||||
}
|
||||
|
@ -323,7 +323,10 @@ private:
|
||||
Handle(_pyCommand) myLastCommand;
|
||||
int myNbFilters;
|
||||
bool myToKeepAllCommands;
|
||||
// difference of entry and index of this difference
|
||||
int myGeomIDNb, myGeomIDIndex;
|
||||
// difference of entry and index of this difference, specific for the SHAPER study
|
||||
int myShaperIDNb, myShaperIDIndex;
|
||||
std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
|
||||
Handle( _pyHypothesisReader ) myHypReader;
|
||||
|
||||
|
@ -903,9 +903,7 @@ void BelongToGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
||||
{
|
||||
if ( theGeom->_is_nil() )
|
||||
return;
|
||||
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
|
||||
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
|
||||
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
|
||||
TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
|
||||
myBelongToGeomPtr->SetGeom( aLocShape );
|
||||
TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
|
||||
}
|
||||
@ -1001,9 +999,7 @@ void BelongToSurface_i::SetSurface( GEOM::GEOM_Object_ptr theGeom, ElementType t
|
||||
{
|
||||
if ( theGeom->_is_nil() )
|
||||
return;
|
||||
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
|
||||
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
|
||||
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
|
||||
TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
|
||||
|
||||
if ( aLocShape.ShapeType() == TopAbs_FACE )
|
||||
{
|
||||
@ -1173,9 +1169,7 @@ void LyingOnGeom_i::SetGeom( GEOM::GEOM_Object_ptr theGeom )
|
||||
{
|
||||
if ( theGeom->_is_nil() )
|
||||
return;
|
||||
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
|
||||
GEOM::GEOM_Gen_ptr aGEOMGen = SMESH_Gen_i::GetGeomEngine();
|
||||
TopoDS_Shape aLocShape = aSMESHGen->GetShapeReader()->GetShape( aGEOMGen, theGeom );
|
||||
TopoDS_Shape aLocShape = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( theGeom );
|
||||
myLyingOnGeomPtr->SetGeom( aLocShape );
|
||||
TPythonDump()<<this<<".SetGeom("<<theGeom<<")";
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ static int MYDEBUG = 0;
|
||||
#endif
|
||||
|
||||
// Static variables definition
|
||||
GEOM::GEOM_Gen_var SMESH_Gen_i::myGeomGen = GEOM::GEOM_Gen::_nil();
|
||||
GEOM::GEOM_Gen_var SMESH_Gen_i::myGeomGen;
|
||||
CORBA::ORB_var SMESH_Gen_i::myOrb;
|
||||
PortableServer::POA_var SMESH_Gen_i::myPoa;
|
||||
SALOME_NamingService* SMESH_Gen_i::myNS = NULL;
|
||||
@ -258,14 +258,15 @@ SALOME_NamingService* SMESH_Gen_i::GetNS()
|
||||
* Get SALOME_LifeCycleCORBA object
|
||||
*/
|
||||
//=============================================================================
|
||||
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
|
||||
|
||||
SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC()
|
||||
{
|
||||
if ( myLCC == NULL ) {
|
||||
myLCC = new SALOME_LifeCycleCORBA( GetNS() );
|
||||
}
|
||||
return myLCC;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetGeomEngine [ static ]
|
||||
@ -273,18 +274,33 @@ SALOME_LifeCycleCORBA* SMESH_Gen_i::GetLCC() {
|
||||
* Get GEOM::GEOM_Gen reference
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine() {
|
||||
//CCRT GEOM::GEOM_Gen_var aGeomEngine =
|
||||
//CCRT GEOM::GEOM_Gen::_narrow( GetLCC()->FindOrLoad_Component("FactoryServer","GEOM") );
|
||||
//CCRT return aGeomEngine._retn();
|
||||
if(CORBA::is_nil(myGeomGen))
|
||||
{
|
||||
Engines::EngineComponent_ptr temp=GetLCC()->FindOrLoad_Component("FactoryServer","GEOM");
|
||||
myGeomGen=GEOM::GEOM_Gen::_narrow(temp);
|
||||
}
|
||||
|
||||
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine( bool isShaper )
|
||||
{
|
||||
Engines::EngineComponent_ptr temp =
|
||||
GetLCC()->FindOrLoad_Component( isShaper ? "FactoryServer" : "FactoryServer",
|
||||
isShaper ? "SHAPERSTUDY" : "GEOM" );
|
||||
myGeomGen = GEOM::GEOM_Gen::_narrow( temp );
|
||||
|
||||
return myGeomGen;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* GetGeomEngine [ static ]
|
||||
*
|
||||
* Get GEOM::GEOM_Gen reference
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
GEOM::GEOM_Gen_var SMESH_Gen_i::GetGeomEngine( GEOM::GEOM_Object_ptr go )
|
||||
{
|
||||
GEOM::GEOM_Gen_ptr gen;
|
||||
if ( !CORBA::is_nil( go ))
|
||||
gen = go->GetGen();
|
||||
return gen;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Gen_i::SMESH_Gen_i
|
||||
@ -687,11 +703,18 @@ void SMESH_Gen_i::UpdateStudy()
|
||||
myStudyContext = new StudyContext;
|
||||
|
||||
SALOMEDS::Study_var aStudy = getStudyServant();
|
||||
if ( !CORBA::is_nil( aStudy ) ) {
|
||||
if ( !CORBA::is_nil( aStudy ) )
|
||||
{
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
|
||||
SALOMEDS::SComponent_wrap GEOM_var = aStudy->FindComponent( "GEOM" );
|
||||
if( !GEOM_var->_is_nil() )
|
||||
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine() );
|
||||
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine( /*isShaper=*/false ) );
|
||||
|
||||
GEOM_var = aStudy->FindComponent( "SHAPERSTUDY" );
|
||||
if( !GEOM_var->_is_nil() )
|
||||
aStudyBuilder->LoadWith( GEOM_var, GetGeomEngine( /*isShaper=*/true ) );
|
||||
|
||||
// NPAL16168, issue 0020210
|
||||
// Let meshes update their data depending on GEOM groups that could change
|
||||
CORBA::String_var compDataType = ComponentDataType();
|
||||
@ -708,6 +731,63 @@ void SMESH_Gen_i::UpdateStudy()
|
||||
}
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return true if mesh has ICON_SMESH_TREE_GEOM_MODIF icon
|
||||
*/
|
||||
//================================================================================
|
||||
|
||||
bool SMESH_Gen_i::isGeomModifIcon( SMESH::SMESH_Mesh_ptr mesh )
|
||||
{
|
||||
SALOMEDS::SObject_wrap so = ObjectToSObject( mesh );
|
||||
SALOMEDS::GenericAttribute_wrap attr;
|
||||
if ( ! so->_is_nil() && so->FindAttribute( attr.inout(), "AttributePixMap" ))
|
||||
{
|
||||
SALOMEDS::AttributePixMap_wrap pm = attr;
|
||||
CORBA::String_var ico = pm->GetPixMap();
|
||||
return ( strcmp( ico.in(), "ICON_SMESH_TREE_GEOM_MODIF" ) == 0 );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : hasObjectInfo()
|
||||
// purpose : shows if module provides information for its objects
|
||||
//=================================================================================
|
||||
|
||||
bool SMESH_Gen_i::hasObjectInfo()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : getObjectInfo()
|
||||
// purpose : returns an information for a given object by its entry
|
||||
//=================================================================================
|
||||
|
||||
char* SMESH_Gen_i::getObjectInfo( const char* entry )
|
||||
{
|
||||
// for a mesh with icon == ICON_SMESH_TREE_GEOM_MODIF show a warning;
|
||||
// for the rest, "module 'SMESH', ID=0:1:2:*"
|
||||
|
||||
SMESH_Comment txt;
|
||||
|
||||
SALOMEDS::SObject_wrap so = getStudyServant()->FindObjectID( entry );
|
||||
CORBA::Object_var obj = SObjectToObject( so );
|
||||
SMESH::SMESH_Mesh_var mesh = SMESH::SMESH_Mesh::_narrow( obj );
|
||||
if ( isGeomModifIcon( mesh ))
|
||||
{
|
||||
txt << "The geometry was changed and the mesh needs to be recomputed";
|
||||
}
|
||||
|
||||
if ( txt.empty() )
|
||||
{
|
||||
CORBA::String_var compType = ComponentDataType();
|
||||
txt << "module '" << compType << "', ID=" << entry;
|
||||
}
|
||||
return CORBA::string_dup( txt );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Gen_i::GetStudyContext
|
||||
@ -1995,7 +2075,10 @@ CORBA::Boolean SMESH_Gen_i::Compute( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
|
||||
ASSERT( meshServant );
|
||||
if ( meshServant ) {
|
||||
meshServant->Load();
|
||||
if ( isGeomModifIcon( theMesh ))
|
||||
meshServant->Clear();
|
||||
else
|
||||
meshServant->Load();
|
||||
// NPAL16168: "geometrical group edition from a submesh don't modify mesh computation"
|
||||
meshServant->CheckGeomModif();
|
||||
// get local TopoDS_Shape
|
||||
@ -2351,7 +2434,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
GEOM::GEOM_Object_wrap geom = FindGeometryByMeshElement(theMesh, theElementID);
|
||||
if ( !geom->_is_nil() ) {
|
||||
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine();
|
||||
GEOM::GEOM_Gen_var geomGen = GetGeomEngine( geom );
|
||||
|
||||
// try to find the corresponding SObject
|
||||
SALOMEDS::SObject_wrap SObj = ObjectToSObject( geom.in() );
|
||||
@ -2382,7 +2465,7 @@ SMESH_Gen_i::GetGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( SObj->_is_nil() ) // publish a new subshape
|
||||
if ( SObj->_is_nil() && !geomGen->_is_nil() ) // publish a new subshape
|
||||
SObj = geomGen->AddInStudy( geom, theGeomName, mainShape );
|
||||
|
||||
// return only published geometry
|
||||
@ -2415,7 +2498,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
THROW_SALOME_CORBA_EXCEPTION( "bad Mesh reference", SALOME::BAD_PARAM );
|
||||
|
||||
GEOM::GEOM_Object_var mainShape = theMesh->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_ptr geomGen = GetGeomEngine();
|
||||
GEOM::GEOM_Gen_var geomGen = GetGeomEngine( mainShape );
|
||||
|
||||
// get a core mesh DS
|
||||
SMESH_Mesh_i* meshServant = SMESH::DownCast<SMESH_Mesh_i*>( theMesh );
|
||||
@ -2438,7 +2521,7 @@ SMESH_Gen_i::FindGeometryByMeshElement( SMESH::SMESH_Mesh_ptr theMesh,
|
||||
}
|
||||
if ( !it->_is_nil() ) {
|
||||
for ( it->InitEx(true); it->More(); it->Next() ) {
|
||||
SALOMEDS::SObject_wrap so = it->Value();
|
||||
SALOMEDS::SObject_wrap so = it->Value();
|
||||
CORBA::Object_var obj = SObjectToObject( so );
|
||||
GEOM::GEOM_Object_var subGeom = GEOM::GEOM_Object::_narrow( obj );
|
||||
if ( !subGeom->_is_nil() ) {
|
||||
@ -3098,7 +3181,7 @@ namespace // utils for CopyMeshWithGeom()
|
||||
std::string newMainEntry = newEntry.in();
|
||||
|
||||
SALOMEDS::Study_var study = myGen_i->getStudyServant();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
|
||||
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
|
||||
mySubshapes = op->GetExistingSubObjects( mainShapeNew,
|
||||
/*groupsOnly=*/false );
|
||||
@ -3153,7 +3236,7 @@ namespace // utils for CopyMeshWithGeom()
|
||||
return GEOM::GEOM_Object::_duplicate( oldShape ); // shape independent of the old shape
|
||||
|
||||
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
|
||||
|
||||
// try to find by entry or name
|
||||
if ( myToPublish )
|
||||
@ -3213,7 +3296,7 @@ namespace // utils for CopyMeshWithGeom()
|
||||
{
|
||||
int groupType = getShapeType( myNewMesh_i, newIndices[0] );
|
||||
|
||||
GEOM::GEOM_IGroupOperations_wrap grOp = geomGen->GetIGroupOperations();
|
||||
GEOM::GEOM_IGroupOperations_ptr grOp = geomGen->GetIGroupOperations();
|
||||
newShape = grOp->CreateGroup( mainShapeNew, groupType );
|
||||
|
||||
GEOM::ListOfLong_var newIndicesList = new GEOM::ListOfLong();
|
||||
@ -3375,7 +3458,7 @@ namespace // utils for CopyMeshWithGeom()
|
||||
|
||||
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
|
||||
GEOM::GEOM_Object_var mainShapeOld = mySrcMesh_i->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
|
||||
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
|
||||
try
|
||||
{
|
||||
@ -3397,7 +3480,7 @@ namespace // utils for CopyMeshWithGeom()
|
||||
GEOM::GEOM_Object_var newShape;
|
||||
|
||||
GEOM::GEOM_Object_var mainShapeNew = myNewMesh_i->GetShapeToMesh();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine();
|
||||
GEOM::GEOM_Gen_var geomGen = myGen_i->GetGeomEngine( mainShapeNew );
|
||||
GEOM::GEOM_IShapesOperations_wrap op = geomGen->GetIShapesOperations();
|
||||
try
|
||||
{
|
||||
@ -4392,6 +4475,14 @@ SALOMEDS::TMPFile* SMESH_Gen_i::Save( SALOMEDS::SComponent_ptr theComponent,
|
||||
aDataset->WriteOnDisk( &meshPersistentId );
|
||||
aDataset->CloseOnDisk();
|
||||
|
||||
// Store SMESH_Mesh_i::_mainShapeTick
|
||||
int shapeTick = myImpl->MainShapeTick();
|
||||
aSize[ 0 ] = 1;
|
||||
aDataset = new HDFdataset( "shapeTick", aTopGroup, HDF_INT32, aSize, 1 );
|
||||
aDataset->CreateOnDisk();
|
||||
aDataset->WriteOnDisk( &shapeTick );
|
||||
aDataset->CloseOnDisk();
|
||||
|
||||
// write reference on a shape if exists
|
||||
SALOMEDS::SObject_wrap myRef;
|
||||
bool shapeRefFound = false;
|
||||
@ -5067,23 +5158,6 @@ SALOMEDS::TMPFile* SMESH_Gen_i::SaveASCII( SALOMEDS::SComponent_ptr theComponent
|
||||
return anAsciiStreamFile._retn();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Gen_i::loadGeomData
|
||||
*
|
||||
* Load GEOM module data
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void SMESH_Gen_i::loadGeomData( SALOMEDS::SComponent_ptr theCompRoot )
|
||||
{
|
||||
if ( theCompRoot->_is_nil() )
|
||||
return;
|
||||
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = getStudyServant()->NewBuilder();
|
||||
aStudyBuilder->LoadWith( theCompRoot, GetGeomEngine() );
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* SMESH_Gen_i::Load
|
||||
@ -5097,17 +5171,10 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
const char* theURL,
|
||||
bool isMultiFile )
|
||||
{
|
||||
// localizing
|
||||
UpdateStudy(); // load geom data
|
||||
Kernel_Utils::Localizer loc;
|
||||
|
||||
//if (!myStudyContext)
|
||||
UpdateStudy();
|
||||
SALOMEDS::Study_var aStudy = getStudyServant();
|
||||
/* if( !theComponent->_is_nil() )
|
||||
{
|
||||
if( !aStudy->FindComponent( "GEOM" )->_is_nil() )
|
||||
loadGeomData( aStudy->FindComponent( "GEOM" ) );
|
||||
}*/
|
||||
|
||||
// Get temporary files location
|
||||
TCollection_AsciiString tmpDir =
|
||||
@ -5429,11 +5496,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
aDataset->CloseOnDisk();
|
||||
if ( strlen( refFromFile ) > 0 ) {
|
||||
SALOMEDS::SObject_wrap shapeSO = aStudy->FindObjectID( refFromFile );
|
||||
|
||||
// Make sure GEOM data are loaded first
|
||||
//loadGeomData( shapeSO->GetFatherComponent() );
|
||||
|
||||
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
|
||||
CORBA::Object_var shapeObject = SObjectToObject( shapeSO );
|
||||
if ( !CORBA::is_nil( shapeObject ) ) {
|
||||
aShapeObject = GEOM::GEOM_Object::_narrow( shapeObject );
|
||||
if ( !aShapeObject->_is_nil() )
|
||||
@ -5444,7 +5507,7 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
}
|
||||
|
||||
// issue 20918. Restore Persistent Id of SMESHDS_Mesh
|
||||
if( aTopGroup->ExistInternalObject( "meshPersistentId" ) )
|
||||
if ( aTopGroup->ExistInternalObject( "meshPersistentId" ) )
|
||||
{
|
||||
aDataset = new HDFdataset( "meshPersistentId", aTopGroup );
|
||||
aDataset->OpenOnDisk();
|
||||
@ -5456,6 +5519,16 @@ bool SMESH_Gen_i::Load( SALOMEDS::SComponent_ptr theComponent,
|
||||
delete [] meshPersistentId;
|
||||
}
|
||||
|
||||
// Restore SMESH_Mesh_i::_mainShapeTick
|
||||
if ( aTopGroup->ExistInternalObject( "shapeTick" ))
|
||||
{
|
||||
aDataset = new HDFdataset( "shapeTick", aTopGroup );
|
||||
aDataset->OpenOnDisk();
|
||||
int* shapeTick = & myNewMeshImpl->MainShapeTick();
|
||||
aDataset->ReadFromDisk( shapeTick );
|
||||
aDataset->CloseOnDisk();
|
||||
}
|
||||
|
||||
// Restore file info
|
||||
if ( aTopGroup->ExistInternalObject( "file info" ))
|
||||
{
|
||||
|
@ -109,7 +109,8 @@ public:
|
||||
// Get SALOME_LifeCycleCORBA object
|
||||
static SALOME_LifeCycleCORBA* GetLCC();
|
||||
// Retrieve and get GEOM engine reference
|
||||
static GEOM::GEOM_Gen_var GetGeomEngine();
|
||||
static GEOM::GEOM_Gen_var GetGeomEngine( bool isShaper );
|
||||
static GEOM::GEOM_Gen_var GetGeomEngine( GEOM::GEOM_Object_ptr );
|
||||
// Get object of the CORBA reference
|
||||
static PortableServer::ServantBase_var GetServant( CORBA::Object_ptr theObject );
|
||||
// Get CORBA object corresponding to the SALOMEDS::SObject
|
||||
@ -158,6 +159,12 @@ public:
|
||||
// Update study
|
||||
void UpdateStudy();
|
||||
|
||||
// Do provide info on objects
|
||||
bool hasObjectInfo();
|
||||
|
||||
// Return an information for a given object
|
||||
char* getObjectInfo(const char* entry);
|
||||
|
||||
// Create hypothesis/algorithm of given type
|
||||
SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const char* theHypType,
|
||||
const char* theLibName)
|
||||
@ -635,6 +642,9 @@ private:
|
||||
SMESH::SMESH_Mesh_ptr createMesh()
|
||||
throw ( SALOME::SALOME_Exception );
|
||||
|
||||
// Check mesh icon
|
||||
bool isGeomModifIcon( SMESH::SMESH_Mesh_ptr mesh );
|
||||
|
||||
// Create a sub-mesh on a geometry that is not a sub-shape of the main shape
|
||||
// for the case where a valid sub-shape not found by CopyMeshWithGeom()
|
||||
SMESH::SMESH_subMesh_ptr createInvalidSubMesh( SMESH::SMESH_Mesh_ptr mesh,
|
||||
@ -643,8 +653,6 @@ private:
|
||||
|
||||
void highLightInvalid( SALOMEDS::SObject_ptr theSObject, bool isInvalid );
|
||||
|
||||
static void loadGeomData( SALOMEDS::SComponent_ptr theCompRoot );
|
||||
|
||||
SMESH::mesh_array* CreateMeshesFromMEDorSAUV( const char* theFileName,
|
||||
SMESH::DriverMED_ReadStatus& theStatus,
|
||||
const char* theCommandNameForPython,
|
||||
|
@ -252,9 +252,10 @@ GEOM::GEOM_Object_ptr SMESH_Gen_i::ShapeToGeomObject (const TopoDS_Shape& theSha
|
||||
TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
|
||||
{
|
||||
TopoDS_Shape S;
|
||||
if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() ) {
|
||||
GEOM_Client* aClient = GetShapeReader();
|
||||
GEOM::GEOM_Gen_ptr aGeomEngine = GetGeomEngine();
|
||||
if ( !theGeomObject->_is_nil() && !theGeomObject->_non_existent() )
|
||||
{
|
||||
GEOM_Client* aClient = GetShapeReader();
|
||||
GEOM::GEOM_Gen_var aGeomEngine = GetGeomEngine( theGeomObject );
|
||||
if ( aClient && !aGeomEngine->_is_nil () )
|
||||
S = aClient->GetShape( aGeomEngine, theGeomObject );
|
||||
}
|
||||
@ -263,7 +264,7 @@ TopoDS_Shape SMESH_Gen_i::GeomObjectToShape(GEOM::GEOM_Object_ptr theGeomObject)
|
||||
|
||||
//=======================================================================
|
||||
//function : publish
|
||||
//purpose :
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
static SALOMEDS::SObject_ptr publish(CORBA::Object_ptr theIOR,
|
||||
|
@ -72,6 +72,7 @@
|
||||
#include <TColStd_MapOfInteger.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopTools_DataMapOfShapeShape.hxx>
|
||||
#include <TopTools_MapIteratorOfMapOfShape.hxx>
|
||||
#include <TopTools_MapOfShape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
@ -255,6 +256,47 @@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh()
|
||||
return aShapeObj._retn();
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Replaces a shape in the mesh
|
||||
*/
|
||||
//================================================================================
|
||||
void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom)
|
||||
throw (SALOME::SALOME_Exception)
|
||||
{
|
||||
TopoDS_Shape S = _impl->GetShapeToMesh();
|
||||
GEOM_Client* geomClient = _gen_i->GetShapeReader();
|
||||
TCollection_AsciiString aIOR;
|
||||
if (geomClient->Find(S, aIOR)) {
|
||||
geomClient->RemoveShapeFromBuffer(aIOR);
|
||||
}
|
||||
|
||||
// update the reference to theNewGeom (needed for correct execution of a dumped python script)
|
||||
SMESH::SMESH_Mesh_var me = _this();
|
||||
SALOMEDS::SObject_wrap aSO = _gen_i->ObjectToSObject( me );
|
||||
CORBA::String_var entry = theNewGeom->GetStudyEntry();
|
||||
if ( !aSO->_is_nil() )
|
||||
{
|
||||
SALOMEDS::SObject_wrap aShapeRefSO;
|
||||
if ( aSO->FindSubObject( _gen_i->GetRefOnShapeTag(), aShapeRefSO.inout() ))
|
||||
{
|
||||
SALOMEDS::SObject_wrap aShapeSO = _gen_i->getStudyServant()->FindObjectID( entry );
|
||||
SALOMEDS::StudyBuilder_var builder = _gen_i->getStudyServant()->NewBuilder();
|
||||
builder->Addreference( aShapeRefSO, aShapeSO );
|
||||
}
|
||||
}
|
||||
|
||||
// re-assign global hypotheses to the new shape
|
||||
_mainShapeTick = -1;
|
||||
CheckGeomModif( true );
|
||||
|
||||
TPythonDump() << "SHAPERSTUDY.breakLinkForSubElements(salome.ObjectToSObject("
|
||||
<< me <<".GetMesh()), " << entry.in() << ")";
|
||||
|
||||
TPythonDump() << me << ".ReplaceShape( " << entry.in() << " )";
|
||||
|
||||
}
|
||||
|
||||
//================================================================================
|
||||
/*!
|
||||
* \brief Return false if the mesh is not yet fully loaded from the study file
|
||||
@ -1986,9 +2028,8 @@ void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
|
||||
if ( groupSO->_is_nil() )
|
||||
return;
|
||||
// group indices
|
||||
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
|
||||
GEOM::GEOM_IGroupOperations_wrap groupOp =
|
||||
geomGen->GetIGroupOperations();
|
||||
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( theGeomObj );
|
||||
GEOM::GEOM_IGroupOperations_ptr groupOp = geomGen->GetIGroupOperations();
|
||||
GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
|
||||
|
||||
// store data
|
||||
@ -2030,41 +2071,58 @@ void SMESH_Mesh_i::removeGeomGroupData(CORBA::Object_ptr theSmeshObj)
|
||||
* \brief Return new group contents if it has been changed and update group data
|
||||
*/
|
||||
//================================================================================
|
||||
enum { ONLY_IF_CHANGED, IS_BREAK_LINK, MAIN_TRANSFORMED };
|
||||
|
||||
TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
|
||||
TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData, int how )
|
||||
{
|
||||
TopoDS_Shape newShape;
|
||||
|
||||
// get geom group
|
||||
SALOMEDS::SObject_wrap groupSO = SMESH_Gen_i::getStudyServant()->FindObjectID( groupData._groupEntry.c_str() );
|
||||
if ( !groupSO->_is_nil() )
|
||||
if ( how == IS_BREAK_LINK )
|
||||
{
|
||||
CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO );
|
||||
if ( CORBA::is_nil( groupObj )) return newShape;
|
||||
GEOM::GEOM_Object_var geomGroup = GEOM::GEOM_Object::_narrow( groupObj );
|
||||
|
||||
// get indices of group items
|
||||
set<int> curIndices;
|
||||
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
|
||||
GEOM::GEOM_IGroupOperations_wrap groupOp =
|
||||
geomGen->GetIGroupOperations();
|
||||
GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
|
||||
for ( CORBA::ULong i = 0; i < ids->length(); ++i )
|
||||
curIndices.insert( ids[i] );
|
||||
|
||||
if ( groupData._indices == curIndices )
|
||||
return newShape; // group not changed
|
||||
|
||||
// update data
|
||||
groupData._indices = curIndices;
|
||||
|
||||
GEOM_Client* geomClient = _gen_i->GetShapeReader();
|
||||
if ( !geomClient ) return newShape;
|
||||
CORBA::String_var groupIOR = geomGen->GetStringFromIOR( geomGroup );
|
||||
geomClient->RemoveShapeFromBuffer( groupIOR.in() );
|
||||
newShape = _gen_i->GeomObjectToShape( geomGroup );
|
||||
SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( groupData._smeshObject );
|
||||
SALOMEDS::SObject_wrap geomRefSO, geomSO;
|
||||
if ( !meshSO->_is_nil() &&
|
||||
meshSO->FindSubObject( SMESH::Tag_RefOnShape, geomRefSO.inout() ) &&
|
||||
geomRefSO->ReferencedObject( geomSO.inout() ))
|
||||
{
|
||||
CORBA::Object_var geomObj = _gen_i->SObjectToObject( geomSO );
|
||||
GEOM::GEOM_Object_var geom = GEOM::GEOM_Object::_narrow( geomObj );
|
||||
newShape = _gen_i->GeomObjectToShape( geom );
|
||||
CORBA::String_var entry = geom->GetStudyEntry();
|
||||
groupData._groupEntry = entry.in();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// get geom group
|
||||
SALOMEDS::SObject_wrap groupSO = SMESH_Gen_i::getStudyServant()->FindObjectID( groupData._groupEntry.c_str() );
|
||||
if ( !groupSO->_is_nil() )
|
||||
{
|
||||
CORBA::Object_var groupObj = _gen_i->SObjectToObject( groupSO );
|
||||
if ( CORBA::is_nil( groupObj )) return newShape;
|
||||
GEOM::GEOM_Object_var geomGroup = GEOM::GEOM_Object::_narrow( groupObj );
|
||||
|
||||
// get indices of group items
|
||||
set<int> curIndices;
|
||||
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( geomGroup );
|
||||
GEOM::GEOM_IGroupOperations_ptr groupOp = geomGen->GetIGroupOperations();
|
||||
GEOM::ListOfLong_var ids = groupOp->GetObjects( geomGroup );
|
||||
for ( CORBA::ULong i = 0; i < ids->length(); ++i )
|
||||
curIndices.insert( ids[i] );
|
||||
|
||||
if ( how == ONLY_IF_CHANGED && groupData._indices == curIndices )
|
||||
return newShape; // group not changed
|
||||
|
||||
// update data
|
||||
groupData._indices = curIndices;
|
||||
|
||||
GEOM_Client* geomClient = _gen_i->GetShapeReader();
|
||||
if ( !geomClient ) return newShape;
|
||||
CORBA::String_var groupIOR = geomGen->GetStringFromIOR( geomGroup );
|
||||
geomClient->RemoveShapeFromBuffer( groupIOR.in() );
|
||||
newShape = _gen_i->GeomObjectToShape( geomGroup );
|
||||
}
|
||||
}
|
||||
if ( newShape.IsNull() ) {
|
||||
// geom group becomes empty - return empty compound
|
||||
TopoDS_Compound compound;
|
||||
@ -2163,11 +2221,13 @@ namespace
|
||||
*/
|
||||
//=============================================================================
|
||||
|
||||
void SMESH_Mesh_i::CheckGeomModif()
|
||||
void SMESH_Mesh_i::CheckGeomModif( bool isBreakLink )
|
||||
{
|
||||
SMESH::SMESH_Mesh_var me = _this();
|
||||
GEOM::GEOM_Object_var mainGO = GetShapeToMesh();
|
||||
|
||||
TPythonDump dumpNothing; // prevent any dump
|
||||
|
||||
//bool removedFromClient = false;
|
||||
|
||||
if ( mainGO->_is_nil() ) // GEOM_Client cleared or geometry removed? (IPAL52735, PAL23636)
|
||||
@ -2229,20 +2289,25 @@ void SMESH_Mesh_i::CheckGeomModif()
|
||||
return;
|
||||
}
|
||||
|
||||
// Update after shape transformation like Translate
|
||||
// Update after shape modification
|
||||
|
||||
GEOM_Client* geomClient = _gen_i->GetShapeReader();
|
||||
if ( !geomClient ) return;
|
||||
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine();
|
||||
GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( mainGO );
|
||||
if ( geomGen->_is_nil() ) return;
|
||||
|
||||
CORBA::String_var ior = geomGen->GetStringFromIOR( mainGO );
|
||||
geomClient->RemoveShapeFromBuffer( ior.in() );
|
||||
|
||||
// Update data taking into account that
|
||||
// Update data taking into account that if topology doesn't change
|
||||
// all sub-shapes change but IDs of sub-shapes remain (except for geom groups)
|
||||
|
||||
_impl->Clear();
|
||||
if ( _preMeshInfo )
|
||||
_preMeshInfo->ForgetAllData();
|
||||
|
||||
|
||||
if (isBreakLink)
|
||||
_impl->Clear();
|
||||
TopoDS_Shape newShape = _gen_i->GeomObjectToShape( mainGO );
|
||||
if ( newShape.IsNull() )
|
||||
return;
|
||||
@ -2255,6 +2320,7 @@ void SMESH_Mesh_i::CheckGeomModif()
|
||||
std::vector< TGroupOnGeomData > groupsData;
|
||||
const std::set<SMESHDS_GroupBase*>& groups = meshDS->GetGroups();
|
||||
groupsData.reserve( groups.size() );
|
||||
TopTools_DataMapOfShapeShape old2newShapeMap;
|
||||
std::set<SMESHDS_GroupBase*>::const_iterator g = groups.begin();
|
||||
for ( ; g != groups.end(); ++g )
|
||||
{
|
||||
@ -2270,12 +2336,34 @@ void SMESH_Mesh_i::CheckGeomModif()
|
||||
|
||||
GEOM::GEOM_Object_var geom;
|
||||
if ( !gog->_is_nil() )
|
||||
geom = gog->GetShape();
|
||||
{
|
||||
if ( isBreakLink )
|
||||
{
|
||||
SALOMEDS::SObject_wrap grpSO = _gen_i->ObjectToSObject( gog );
|
||||
SALOMEDS::SObject_wrap geomRefSO, geomSO;
|
||||
if ( !grpSO->_is_nil() &&
|
||||
grpSO->FindSubObject( SMESH::Tag_RefOnShape, geomRefSO.inout() ) &&
|
||||
geomRefSO->ReferencedObject( geomSO.inout() ))
|
||||
{
|
||||
CORBA::Object_var geomObj = _gen_i->SObjectToObject( geomSO );
|
||||
geom = GEOM::GEOM_Object::_narrow( geomObj );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
geom = gog->GetShape();
|
||||
}
|
||||
}
|
||||
if ( !geom->_is_nil() )
|
||||
{
|
||||
CORBA::String_var ior = geomGen->GetStringFromIOR( geom );
|
||||
geomClient->RemoveShapeFromBuffer( ior.in() );
|
||||
groupsData.back()._shape = _gen_i->GeomObjectToShape( geom );
|
||||
old2newShapeMap.Bind( group->GetShape(), groupsData.back()._shape );
|
||||
}
|
||||
else if ( old2newShapeMap.IsBound( group->GetShape() ))
|
||||
{
|
||||
groupsData.back()._shape = old2newShapeMap( group->GetShape() );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2289,16 +2377,50 @@ void SMESH_Mesh_i::CheckGeomModif()
|
||||
ids2Hyps.push_back( make_pair( meshDS->ShapeToIndex( s ), hyps ));
|
||||
}
|
||||
|
||||
// change shape to mesh
|
||||
std::map< std::set<int>, int > ii2iMap; // group sub-ids to group id in SMESHDS
|
||||
|
||||
// count shapes excluding compounds corresponding to geom groups
|
||||
int oldNbSubShapes = meshDS->MaxShapeIndex();
|
||||
for ( ; oldNbSubShapes > 0; --oldNbSubShapes )
|
||||
{
|
||||
const TopoDS_Shape& s = meshDS->IndexToShape( oldNbSubShapes );
|
||||
if ( s.IsNull() || s.ShapeType() != TopAbs_COMPOUND )
|
||||
break;
|
||||
// fill ii2iMap
|
||||
std::set<int> subIds;
|
||||
for ( TopoDS_Iterator it( s ); it.More(); it.Next() )
|
||||
subIds.insert( meshDS->ShapeToIndex( it.Value() ));
|
||||
ii2iMap.insert( std::make_pair( subIds, oldNbSubShapes ));
|
||||
}
|
||||
|
||||
// check if shape topology changes - save shape type per shape ID
|
||||
std::vector< TopAbs_ShapeEnum > shapeTypes( Max( oldNbSubShapes + 1, 1 ));
|
||||
for ( int shapeID = oldNbSubShapes; shapeID > 0; --shapeID )
|
||||
shapeTypes[ shapeID ] = meshDS->IndexToShape( shapeID ).ShapeType();
|
||||
|
||||
// change shape to mesh
|
||||
_impl->ShapeToMesh( TopoDS_Shape() );
|
||||
_impl->ShapeToMesh( newShape );
|
||||
|
||||
// re-add shapes of geom groups
|
||||
// check if shape topology changes - check new shape types
|
||||
bool sameTopology = ( oldNbSubShapes == meshDS->MaxShapeIndex() );
|
||||
for ( int shapeID = oldNbSubShapes; shapeID > 0 && sameTopology; --shapeID )
|
||||
{
|
||||
const TopoDS_Shape& s = meshDS->IndexToShape( shapeID );
|
||||
sameTopology = ( !s.IsNull() && s.ShapeType() == shapeTypes[ shapeID ]);
|
||||
}
|
||||
|
||||
// re-add shapes (compounds) of geom groups
|
||||
std::map< int, int > old2newIDs; // group IDs
|
||||
std::list<TGeomGroupData>::iterator data = _geomGroupData.begin();
|
||||
for ( ; data != _geomGroupData.end(); ++data )
|
||||
{
|
||||
TopoDS_Shape newShape = newGroupShape( *data );
|
||||
int oldID = 0;
|
||||
std::map< std::set<int>, int >::iterator ii2i = ii2iMap.find( data->_indices );
|
||||
if ( ii2i != ii2iMap.end() )
|
||||
oldID = ii2i->second;
|
||||
|
||||
TopoDS_Shape newShape = newGroupShape( *data, isBreakLink ? IS_BREAK_LINK : MAIN_TRANSFORMED );
|
||||
if ( !newShape.IsNull() )
|
||||
{
|
||||
if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape
|
||||
@ -2308,48 +2430,88 @@ void SMESH_Mesh_i::CheckGeomModif()
|
||||
BRep_Builder().Add( compound, newShape );
|
||||
newShape = compound;
|
||||
}
|
||||
_impl->GetSubMesh( newShape );
|
||||
int newID = _impl->GetSubMesh( newShape )->GetId();
|
||||
if ( oldID && oldID != newID )
|
||||
old2newIDs.insert( std::make_pair( oldID, newID ));
|
||||
}
|
||||
}
|
||||
if ( oldNbSubShapes != meshDS->MaxShapeIndex() )
|
||||
THROW_SALOME_CORBA_EXCEPTION( "SMESH_Mesh_i::CheckGeomModif() bug",
|
||||
SALOME::INTERNAL_ERROR );
|
||||
|
||||
// re-assign hypotheses
|
||||
for ( size_t i = 0; i < ids2Hyps.size(); ++i )
|
||||
{
|
||||
const TopoDS_Shape& s = meshDS->IndexToShape( ids2Hyps[i].first );
|
||||
if ( !sameTopology && ids2Hyps[i].first != 1 )
|
||||
continue; // assign only global hypos
|
||||
int sID = ids2Hyps[i].first;
|
||||
std::map< int, int >::iterator o2n = old2newIDs.find( sID );
|
||||
if ( o2n != old2newIDs.end() )
|
||||
sID = o2n->second;
|
||||
const TopoDS_Shape& s = meshDS->IndexToShape( sID );
|
||||
const THypList& hyps = ids2Hyps[i].second;
|
||||
THypList::const_iterator h = hyps.begin();
|
||||
for ( ; h != hyps.end(); ++h )
|
||||
_impl->AddHypothesis( s, (*h)->GetID() );
|
||||
}
|
||||
|
||||
// restore groups on geometry
|
||||
for ( size_t i = 0; i < groupsData.size(); ++i )
|
||||
if ( !sameTopology )
|
||||
{
|
||||
const TGroupOnGeomData& data = groupsData[i];
|
||||
if ( data._shape.IsNull() )
|
||||
continue;
|
||||
// remove invalid study sub-objects
|
||||
CheckGeomGroupModif();
|
||||
}
|
||||
else
|
||||
{
|
||||
// restore groups on geometry
|
||||
for ( size_t i = 0; i < groupsData.size(); ++i )
|
||||
{
|
||||
const TGroupOnGeomData& data = groupsData[i];
|
||||
if ( data._shape.IsNull() )
|
||||
continue;
|
||||
|
||||
std::map<int, SMESH::SMESH_GroupBase_ptr>::iterator i2g = _mapGroups.find( data._oldID );
|
||||
if ( i2g == _mapGroups.end() ) continue;
|
||||
std::map<int, SMESH::SMESH_GroupBase_ptr>::iterator i2g = _mapGroups.find( data._oldID );
|
||||
if ( i2g == _mapGroups.end() ) continue;
|
||||
|
||||
SMESH_GroupBase_i* gr_i = SMESH::DownCast<SMESH_GroupBase_i*>( i2g->second );
|
||||
if ( !gr_i ) continue;
|
||||
SMESH_GroupBase_i* gr_i = SMESH::DownCast<SMESH_GroupBase_i*>( i2g->second );
|
||||
if ( !gr_i ) continue;
|
||||
|
||||
SMESH_Group* g = _impl->AddGroup( data._type, data._name.c_str(), data._oldID, data._shape );
|
||||
if ( !g )
|
||||
_mapGroups.erase( i2g );
|
||||
else
|
||||
g->GetGroupDS()->SetColor( data._color );
|
||||
SMESH_Group* g = _impl->AddGroup( data._type, data._name.c_str(), data._oldID, data._shape );
|
||||
if ( !g )
|
||||
_mapGroups.erase( i2g );
|
||||
else
|
||||
g->GetGroupDS()->SetColor( data._color );
|
||||
}
|
||||
|
||||
std::map< int, int >::iterator o2n = old2newIDs.begin();
|
||||
for ( ; o2n != old2newIDs.end(); ++o2n )
|
||||
{
|
||||
int newID = o2n->second, oldID = o2n->first;
|
||||
if ( !_mapSubMesh.count( oldID ))
|
||||
continue;
|
||||
if ( newID > 0 )
|
||||
{
|
||||
_mapSubMesh [ newID ] = _impl->GetSubMeshContaining( newID );
|
||||
_mapSubMesh_i [ newID ] = _mapSubMesh_i [ oldID ];
|
||||
_mapSubMeshIor[ newID ] = _mapSubMeshIor[ oldID ];
|
||||
}
|
||||
_mapSubMesh. erase(oldID);
|
||||
_mapSubMesh_i. erase(oldID);
|
||||
_mapSubMeshIor.erase(oldID);
|
||||
if ( newID > 0 )
|
||||
_mapSubMesh_i [ newID ]->changeLocalId( newID );
|
||||
}
|
||||
|
||||
// update _mapSubMesh
|
||||
std::map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
|
||||
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
|
||||
i_sm->second = _impl->GetSubMesh( meshDS->IndexToShape( i_sm->first ));
|
||||
}
|
||||
|
||||
// update _mapSubMesh
|
||||
std::map<int, ::SMESH_subMesh*>::iterator i_sm = _mapSubMesh.begin();
|
||||
for ( ; i_sm != _mapSubMesh.end(); ++i_sm )
|
||||
i_sm->second = _impl->GetSubMesh( meshDS->IndexToShape( i_sm->first ));
|
||||
_gen_i->UpdateIcons( me );
|
||||
|
||||
if ( !isBreakLink )
|
||||
{
|
||||
SALOMEDS::SObject_wrap meshSO = _gen_i->ObjectToSObject( me );
|
||||
if ( !meshSO->_is_nil() )
|
||||
_gen_i->SetPixMap(meshSO, "ICON_SMESH_TREE_GEOM_MODIF");
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
@ -2473,7 +2635,7 @@ void SMESH_Mesh_i::CheckGeomGroupModif()
|
||||
bool processedGroup = !it_new.second;
|
||||
TopoDS_Shape& newShape = it_new.first->second;
|
||||
if ( !processedGroup )
|
||||
newShape = newGroupShape( *data );
|
||||
newShape = newGroupShape( *data, ONLY_IF_CHANGED );
|
||||
if ( newShape.IsNull() )
|
||||
continue; // no changes
|
||||
|
||||
|
@ -74,6 +74,9 @@ public:
|
||||
GEOM::GEOM_Object_ptr GetShapeToMesh()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
virtual void ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom)
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
CORBA::Boolean IsLoaded()
|
||||
throw (SALOME::SALOME_Exception);
|
||||
|
||||
@ -460,7 +463,7 @@ public:
|
||||
*
|
||||
* Issue 0022501
|
||||
*/
|
||||
void CheckGeomModif();
|
||||
void CheckGeomModif( bool isBreakLink = false );
|
||||
/*!
|
||||
* \brief Update hypotheses assigned to geom groups if the latter change
|
||||
*
|
||||
@ -618,6 +621,12 @@ public:
|
||||
std::string FileInfoToString();
|
||||
void FileInfoFromString(const std::string& info);
|
||||
|
||||
/*!
|
||||
* Persistence of geometry tick
|
||||
*/
|
||||
int& MainShapeTick() { return _mainShapeTick; }
|
||||
|
||||
|
||||
/*!
|
||||
* Sets list of notebook variables used for Mesh operations separated by ":" symbol
|
||||
*/
|
||||
@ -765,7 +774,7 @@ private:
|
||||
/*!
|
||||
* Return new group contents if it has been changed and update group data
|
||||
*/
|
||||
TopoDS_Shape newGroupShape( TGeomGroupData & groupData);
|
||||
TopoDS_Shape newGroupShape( TGeomGroupData & groupData, int how );
|
||||
|
||||
};
|
||||
|
||||
|
@ -1061,12 +1061,15 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
||||
isHistoricalDump );
|
||||
|
||||
bool importGeom = false;
|
||||
GEOM::GEOM_Gen_ptr geom = GetGeomEngine();
|
||||
GEOM::GEOM_Gen_ptr geom[2];
|
||||
for ( int isShaper = 0; isShaper < 2; ++isShaper )
|
||||
{
|
||||
geom[ isShaper ] = GetGeomEngine( isShaper );
|
||||
if ( CORBA::is_nil( geom[ isShaper ]))
|
||||
continue;
|
||||
// Add names of GEOM objects to theObjectNames to exclude same names of SMESH objects
|
||||
GEOM::string_array_var aGeomNames = geom->GetAllDumpNames();
|
||||
int ign = 0, nbgn = aGeomNames->length();
|
||||
for (; ign < nbgn; ign++) {
|
||||
GEOM::string_array_var aGeomNames = geom[ isShaper ]->GetAllDumpNames();
|
||||
for ( CORBA::ULong ign = 0; ign < aGeomNames->length(); ign++) {
|
||||
TCollection_AsciiString aName = aGeomNames[ign].in();
|
||||
theObjectNames.Bind(aName, "1");
|
||||
}
|
||||
@ -1100,7 +1103,11 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
||||
anUpdatedScript += aLine.SubString( aStart, aSeq->Value(i) - 1 ); // line part before i-th entry
|
||||
anEntry = aLine.SubString( aSeq->Value(i), aSeq->Value(i + 1) );
|
||||
// is a GEOM object?
|
||||
CORBA::String_var geomName = geom->GetDumpName( anEntry.ToCString() );
|
||||
CORBA::String_var geomName;
|
||||
if ( !CORBA::is_nil( geom[0] ))
|
||||
geomName = geom[0]->GetDumpName( anEntry.ToCString() );
|
||||
if (( !geomName.in() || !geomName.in()[0] ) && !CORBA::is_nil( geom[1] ))
|
||||
geomName = geom[1]->GetDumpName( anEntry.ToCString() );
|
||||
if ( !geomName.in() || !geomName.in()[0] ) {
|
||||
// is a SMESH object
|
||||
if ( theObjectNames.IsBound( anEntry )) {
|
||||
|
@ -123,6 +123,7 @@ protected:
|
||||
|
||||
void changeLocalId(int localId) { _localId = localId; }
|
||||
friend void SMESH_Mesh_i::CheckGeomGroupModif();
|
||||
friend void SMESH_Mesh_i::CheckGeomModif(bool);
|
||||
|
||||
SMESH_PreMeshInfo* _preMeshInfo; // mesh info before full loading from study file
|
||||
|
||||
|
@ -305,7 +305,7 @@ def AssureGeomPublished(mesh, geom, name=''):
|
||||
"""
|
||||
if not mesh.smeshpyD.IsEnablePublish():
|
||||
return
|
||||
if not isinstance( geom, geomBuilder.GEOM._objref_GEOM_Object ):
|
||||
if not hasattr( geom, "GetShapeType" ):
|
||||
return
|
||||
if not geom.GetStudyEntry():
|
||||
## get a name
|
||||
@ -318,27 +318,13 @@ def AssureGeomPublished(mesh, geom, name=''):
|
||||
mesh.geompyD.addToStudyInFather( mesh.geom, geom, name )
|
||||
return
|
||||
|
||||
def FirstVertexOnCurve(mesh, edge):
|
||||
"""
|
||||
Returns:
|
||||
the first vertex of a geometrical edge by ignoring orientation
|
||||
"""
|
||||
vv = mesh.geompyD.SubShapeAll( edge, geomBuilder.geomBuilder.ShapeType["VERTEX"])
|
||||
if not vv:
|
||||
raise TypeError("Given object has no vertices")
|
||||
if len( vv ) == 1: return vv[0]
|
||||
v0 = mesh.geompyD.MakeVertexOnCurve(edge,0.)
|
||||
xyz = mesh.geompyD.PointCoordinates( v0 ) # coords of the first vertex
|
||||
xyz1 = mesh.geompyD.PointCoordinates( vv[0] )
|
||||
xyz2 = mesh.geompyD.PointCoordinates( vv[1] )
|
||||
dist1, dist2 = 0,0
|
||||
for i in range(3):
|
||||
dist1 += abs( xyz[i] - xyz1[i] )
|
||||
dist2 += abs( xyz[i] - xyz2[i] )
|
||||
if dist1 < dist2:
|
||||
return vv[0]
|
||||
else:
|
||||
return vv[1]
|
||||
# def FirstVertexOnCurve(mesh, edge):
|
||||
# """
|
||||
# Returns:
|
||||
# the first vertex of a geometrical edge by ignoring orientation
|
||||
# """
|
||||
# return mesh.geompyD.GetVertexByIndex( edge, 0, False )
|
||||
|
||||
|
||||
smeshInst = None
|
||||
"""
|
||||
@ -531,8 +517,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
|
||||
Returns:
|
||||
:class:`SMESH.PointStruct`
|
||||
"""
|
||||
|
||||
[x, y, z] = self.geompyD.PointCoordinates(theVertex)
|
||||
geompyD = theVertex.GetGen()
|
||||
[x, y, z] = geompyD.PointCoordinates(theVertex)
|
||||
return PointStruct(x,y,z)
|
||||
|
||||
def GetDirStruct(self,theVector):
|
||||
@ -545,13 +531,13 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
|
||||
Returns:
|
||||
:class:`SMESH.DirStruct`
|
||||
"""
|
||||
|
||||
vertices = self.geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
geompyD = theVector.GetGen()
|
||||
vertices = geompyD.SubShapeAll( theVector, geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
if(len(vertices) != 2):
|
||||
print("Error: vector object is incorrect.")
|
||||
return None
|
||||
p1 = self.geompyD.PointCoordinates(vertices[0])
|
||||
p2 = self.geompyD.PointCoordinates(vertices[1])
|
||||
p1 = geompyD.PointCoordinates(vertices[0])
|
||||
p2 = geompyD.PointCoordinates(vertices[1])
|
||||
pnt = PointStruct(p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
|
||||
dirst = DirStruct(pnt)
|
||||
return dirst
|
||||
@ -581,28 +567,29 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
|
||||
:class:`SMESH.AxisStruct`
|
||||
"""
|
||||
import GEOM
|
||||
edges = self.geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] )
|
||||
geompyD = theObj.GetGen()
|
||||
edges = geompyD.SubShapeAll( theObj, geomBuilder.geomBuilder.ShapeType["EDGE"] )
|
||||
axis = None
|
||||
if len(edges) > 1:
|
||||
vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
vertex3, vertex4 = self.geompyD.SubShapeAll( edges[1], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
vertex1 = self.geompyD.PointCoordinates(vertex1)
|
||||
vertex2 = self.geompyD.PointCoordinates(vertex2)
|
||||
vertex3 = self.geompyD.PointCoordinates(vertex3)
|
||||
vertex4 = self.geompyD.PointCoordinates(vertex4)
|
||||
vertex1, vertex2 = geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
vertex3, vertex4 = geompyD.SubShapeAll( edges[1], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
vertex1 = geompyD.PointCoordinates(vertex1)
|
||||
vertex2 = geompyD.PointCoordinates(vertex2)
|
||||
vertex3 = geompyD.PointCoordinates(vertex3)
|
||||
vertex4 = geompyD.PointCoordinates(vertex4)
|
||||
v1 = [vertex2[0]-vertex1[0], vertex2[1]-vertex1[1], vertex2[2]-vertex1[2]]
|
||||
v2 = [vertex4[0]-vertex3[0], vertex4[1]-vertex3[1], vertex4[2]-vertex3[2]]
|
||||
normal = [ v1[1]*v2[2]-v2[1]*v1[2], v1[2]*v2[0]-v2[2]*v1[0], v1[0]*v2[1]-v2[0]*v1[1] ]
|
||||
axis = AxisStruct(vertex1[0], vertex1[1], vertex1[2], normal[0], normal[1], normal[2])
|
||||
axis._mirrorType = SMESH.SMESH_MeshEditor.PLANE
|
||||
elif len(edges) == 1:
|
||||
vertex1, vertex2 = self.geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
p1 = self.geompyD.PointCoordinates( vertex1 )
|
||||
p2 = self.geompyD.PointCoordinates( vertex2 )
|
||||
vertex1, vertex2 = geompyD.SubShapeAll( edges[0], geomBuilder.geomBuilder.ShapeType["VERTEX"] )
|
||||
p1 = geompyD.PointCoordinates( vertex1 )
|
||||
p2 = geompyD.PointCoordinates( vertex2 )
|
||||
axis = AxisStruct(p1[0], p1[1], p1[2], p2[0]-p1[0], p2[1]-p1[1], p2[2]-p1[2])
|
||||
axis._mirrorType = SMESH.SMESH_MeshEditor.AXIS
|
||||
elif theObj.GetShapeType() == GEOM.VERTEX:
|
||||
x,y,z = self.geompyD.PointCoordinates( theObj )
|
||||
x,y,z = geompyD.PointCoordinates( theObj )
|
||||
axis = AxisStruct( x,y,z, 1,0,0,)
|
||||
axis._mirrorType = SMESH.SMESH_MeshEditor.POINT
|
||||
return axis
|
||||
@ -972,7 +959,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
|
||||
name = aCriterion.ThresholdStr
|
||||
if not name:
|
||||
name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
|
||||
aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name )
|
||||
geompyD = aThreshold.GetGen()
|
||||
aCriterion.ThresholdID = geompyD.addToStudy( aThreshold, name )
|
||||
# or a name of GEOM object
|
||||
elif isinstance( aThreshold, str ):
|
||||
aCriterion.ThresholdStr = aThreshold
|
||||
@ -1023,7 +1011,8 @@ class smeshBuilder( SMESH._objref_SMESH_Gen, object ):
|
||||
name = aThreshold.GetName()
|
||||
if not name:
|
||||
name = "%s_%s"%(aThreshold.GetShapeType(), id(aThreshold)%10000)
|
||||
aCriterion.ThresholdID = self.geompyD.addToStudy( aThreshold, name )
|
||||
geompyD = aThreshold.GetGen()
|
||||
aCriterion.ThresholdID = geompyD.addToStudy( aThreshold, name )
|
||||
elif isinstance(aThreshold, int): # node id
|
||||
aCriterion.Threshold = aThreshold
|
||||
elif isinstance(aThreshold, list): # 3 point coordinates
|
||||
@ -1654,14 +1643,15 @@ class Mesh(metaclass = MeshMeta):
|
||||
Parameters:
|
||||
theMesh: a :class:`SMESH.SMESH_Mesh` object
|
||||
"""
|
||||
|
||||
|
||||
# do not call Register() as this prevents mesh servant deletion at closing study
|
||||
#if self.mesh: self.mesh.UnRegister()
|
||||
self.mesh = theMesh
|
||||
if self.mesh:
|
||||
#self.mesh.Register()
|
||||
self.geom = self.mesh.GetShapeToMesh()
|
||||
if self.geom:
|
||||
self.geompyD = self.geom.GetGen()
|
||||
pass
|
||||
pass
|
||||
|
||||
def GetMesh(self):
|
||||
|
@ -413,12 +413,11 @@ class Mesh_Algorithm:
|
||||
into a list acceptable to SetReversedEdges() of some 1D hypotheses
|
||||
"""
|
||||
|
||||
from salome.smesh.smeshBuilder import FirstVertexOnCurve
|
||||
resList = []
|
||||
geompy = self.mesh.geompyD
|
||||
for i in reverseList:
|
||||
if isinstance( i, int ):
|
||||
s = geompy.SubShapes(self.mesh.geom, [i])[0]
|
||||
s = geompy.GetSubShape(self.mesh.geom, [i])
|
||||
if s.GetShapeType() != geomBuilder.GEOM.EDGE:
|
||||
raise TypeError("Not EDGE index given")
|
||||
resList.append( i )
|
||||
@ -438,7 +437,7 @@ class Mesh_Algorithm:
|
||||
if e.GetShapeType() != geomBuilder.GEOM.EDGE or \
|
||||
v.GetShapeType() != geomBuilder.GEOM.VERTEX:
|
||||
raise TypeError("A list item must be a tuple (edge, 1st_vertex_of_edge)")
|
||||
vFirst = FirstVertexOnCurve( self.mesh, e )
|
||||
vFirst = geompy.GetVertexByIndex( e, 0, False )
|
||||
tol = geompy.Tolerance( vFirst )[-1]
|
||||
if geompy.MinDistance( v, vFirst ) > 1.5*tol:
|
||||
resList.append( geompy.GetSubShapeID(self.mesh.geom, e ))
|
||||
|
@ -464,7 +464,7 @@ bool StdMeshersGUI_StdHypothesisCreator::checkParams( QString& msg ) const
|
||||
// then the FACE must have only one VERTEX
|
||||
GEOM::GEOM_Object_var face = w->GetObject< GEOM::GEOM_Object >();
|
||||
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen();
|
||||
GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( face );
|
||||
_PTR(Study) aStudy = SMESH::getStudy();
|
||||
GEOM::GEOM_IShapesOperations_wrap shapeOp;
|
||||
if ( !geomGen->_is_nil() && aStudy )
|
||||
|
Loading…
Reference in New Issue
Block a user