Merge branch 'master' into V7_5_BR

This commit is contained in:
vsr 2014-11-07 18:40:17 +03:00
commit 1c3dc0bc76
8 changed files with 67 additions and 77 deletions

View File

@ -5,7 +5,7 @@
\n To create a \b Compound in the <b>Main Menu</b> select <b>New \n To create a \b Compound in the <b>Main Menu</b> select <b>New
Entity - > Build - > Compound</b>. Entity - > Build - > Compound</b>.
\n You can create a compound from a list of shells. \n You can create a compound from a list of shapes.
\n The \b Result will be a \b GEOM_Object (COMPOUND). \n The \b Result will be a \b GEOM_Object (COMPOUND).
\n <b>TUI Command:</b> <em>geompy.MakeCompound(ListOfShape)</em> \n <b>TUI Command:</b> <em>geompy.MakeCompound(ListOfShape)</em>

View File

@ -6,15 +6,15 @@ To create a \b Face in the <b>Main Menu</b> select <b>New Entity - >
Build - > Face</b> Build - > Face</b>
\n To create a \b Face you need to select input shape(s). The list of \n To create a \b Face you need to select input shape(s). The list of
input shapes can include shapes of any type; if the shapes are nor input shapes can include shapes of any type except vertices; if the shapes are
wires or edges, the algorithm extracts all edges from neither wires nor edges, the algorithm extracts all edges from
the input shapes and works on the obtaineed edges. the input shapes and works on the obtaineed edges.
\n The edges and wires do not necessarily have to be closed, the \n The edges and wires do not necessarily have to be closed, the
algorithm automatically builds a wire of maximum length from all algorithm automatically builds a wire of maximum length from all
given edges and wires. If it founds multiple closed wires, it can given edges and wires. If several closed wires are detected the algorithm tries
build a face with holes or some separate faces, depending on the to create a face with holes. It is possible only if there is only one wire
placement of the wires. If some resulting wires remain open, they will that can be interpreted as an outer one; other wires can be considered as
be added in the resulting compound "as is". inner ones.
\n Check <b>Try to create a planar face</b> to create a planar \n Check <b>Try to create a planar face</b> to create a planar
face or nothing if it is impossible. face or nothing if it is impossible.
\note Please note, that the resulting face can have a huge tolerance, if the initial wire has a big deviation from the plane. If the final tolerance exceeds 1e-06, a warning will be shown, but the face will be created and published in the study in a normal way. Using such faces can lead to failures or unpredictable results in most operations. \note Please note, that the resulting face can have a huge tolerance, if the initial wire has a big deviation from the plane. If the final tolerance exceeds 1e-06, a warning will be shown, but the face will be created and published in the study in a normal way. Using such faces can lead to failures or unpredictable results in most operations.

View File

@ -106,10 +106,7 @@ void BuildGUI_FaceDlg::Init()
GroupWire->CheckButton1->setChecked( true ); GroupWire->CheckButton1->setChecked( true );
myWires.clear(); myWires.clear();
TColStd_MapOfInteger aMap; setGlobalSelection();
aMap.Add( GEOM_EDGE );
aMap.Add( GEOM_WIRE );
globalSelection( aMap );
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
@ -123,6 +120,23 @@ void BuildGUI_FaceDlg::Init()
SelectionIntoArgument(); SelectionIntoArgument();
} }
//=================================================================================
// function : setGlobalSelection
// purpose :
//=================================================================================
void BuildGUI_FaceDlg::setGlobalSelection()
{
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_EDGE);
aMap.Add(GEOM_WIRE);
aMap.Add(GEOM_FACE);
aMap.Add(GEOM_SHELL);
aMap.Add(GEOM_SOLID);
aMap.Add(GEOM_COMPOUND);
globalSelection(aMap);
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
@ -159,7 +173,8 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
myEditCurrentArgument->setText( "" ); myEditCurrentArgument->setText( "" );
QList<TopAbs_ShapeEnum> types; QList<TopAbs_ShapeEnum> types;
types << TopAbs_EDGE << TopAbs_WIRE; types << TopAbs_EDGE << TopAbs_WIRE << TopAbs_FACE
<< TopAbs_SHELL << TopAbs_SOLID << TopAbs_COMPOUND;
myWires = getSelected( types, -1 ); myWires = getSelected( types, -1 );
if ( !myWires.isEmpty() ) { if ( !myWires.isEmpty() ) {
@ -179,11 +194,7 @@ void BuildGUI_FaceDlg::SetEditCurrentArgument()
if ( send != GroupWire->PushButton1 ) if ( send != GroupWire->PushButton1 )
return; return;
TColStd_MapOfInteger aMap; setGlobalSelection();
aMap.Add( GEOM_EDGE );
aMap.Add( GEOM_WIRE );
globalSelection( aMap );
myEditCurrentArgument = GroupWire->LineEdit1; myEditCurrentArgument = GroupWire->LineEdit1;
myEditCurrentArgument->setFocus(); myEditCurrentArgument->setFocus();
@ -200,10 +211,7 @@ void BuildGUI_FaceDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
TColStd_MapOfInteger aMap; setGlobalSelection();
aMap.Add( GEOM_EDGE );
aMap.Add( GEOM_WIRE );
globalSelection( aMap );
} }

View File

@ -53,6 +53,7 @@ protected:
private: private:
void Init(); void Init();
void enterEvent( QEvent* ); void enterEvent( QEvent* );
void setGlobalSelection();
private: private:
QList<GEOM::GeomObjPtr> myWires; QList<GEOM::GeomObjPtr> myWires;

View File

@ -351,6 +351,18 @@ void DependencyTree_View::onRebuildModel()
updateModel( true, false ); updateModel( true, false );
} }
//=================================================================================
// function : resizeEvent()
// purpose : reimplemented from QGraphicsView::resizeEvent()
//=================================================================================
void DependencyTree_View::resizeEvent(QResizeEvent *event)
{
QPointF aCenter = mapToScene( event->oldSize().width()/2,
event->oldSize().height()/2 );
QGraphicsView::resizeEvent( event );
centerOn( aCenter.x(),aCenter.y() );
}
//================================================================================= //=================================================================================
// function : onUpdateModel() // function : onUpdateModel()
// purpose : slot for updating tree model for main objects in viewer // purpose : slot for updating tree model for main objects in viewer
@ -689,7 +701,7 @@ void DependencyTree_View::updateView()
return; return;
drawTree(); drawTree();
fitAll(); fitWindow();
} }
//================================================================================= //=================================================================================
@ -734,6 +746,23 @@ void DependencyTree_View::clearView( bool isClearModel )
} }
} }
//=================================================================================
// function : fitWindow()
// purpose : scale the window considering a size of scene
//=================================================================================
void DependencyTree_View::fitWindow()
{
int sizeFactor = 4;
if( objectsBoundingRect(true).width() > sizeFactor*size().width() ||
objectsBoundingRect(true).height() > sizeFactor*size().width() ) {
QRectF aRect = QRectF( -sizeFactor*size().width()/2, -sizeFactor*size().height()/2,
sizeFactor*size().width(), sizeFactor*size().height() );
fitInView( aRect, Qt::KeepAspectRatio );
}
else
fitAll();
}
//================================================================================= //=================================================================================
// function : getNewTreeModel() // function : getNewTreeModel()
// purpose : get dependency tree model from engine // purpose : get dependency tree model from engine

View File

@ -68,6 +68,10 @@ public slots:
void onRebuildModel(); void onRebuildModel();
protected:
void resizeEvent( QResizeEvent *event );
private slots: private slots:
void onUpdateModel(); void onUpdateModel();
@ -93,6 +97,8 @@ private:
void updateView(); void updateView();
void clearView( bool ); void clearView( bool );
void fitWindow();
int checkMaxLevelsNumber(); int checkMaxLevelsNumber();
void getNewTreeModel( bool = true, bool = true ); void getNewTreeModel( bool = true, bool = true );

View File

@ -360,35 +360,6 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
} }
} }
}
else if (aType == SOLID_SHELL) {
anExpectedType = TopAbs_SOLID;
Handle(GEOM_Function) aRefShell = aCI.GetBase();
TopoDS_Shape aShapeShell = aRefShell->GetValue();
if (!aShapeShell.IsNull() && aShapeShell.ShapeType() == TopAbs_COMPOUND) {
TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
if (It.More()) aShapeShell = It.Value();
}
if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) {
Standard_NullObject::Raise("Shape for solid construction is null or not a shell");
}
BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell));
if (chkShell.Closed() == BRepCheck_NotClosed) return 0;
TopoDS_Solid Sol;
B.MakeSolid(Sol);
B.Add(Sol, aShapeShell);
BRepClass3d_SolidClassifier SC (Sol);
SC.PerformInfinitePoint(Precision::Confusion());
if (SC.State() == TopAbs_IN) {
B.MakeSolid(Sol);
B.Add(Sol, aShapeShell.Reversed());
}
aShape = Sol;
} }
else if (aType == SOLID_SHELLS) { else if (aType == SOLID_SHELLS) {
anExpectedType = TopAbs_SOLID; anExpectedType = TopAbs_SOLID;
@ -445,30 +416,6 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const
aShape = C; aShape = C;
} }
/*
else if (aType == REVERSE_ORIENTATION) {
Handle(GEOM_Function) aRefShape = aCI.GetBase();
TopoDS_Shape aShape_i = aRefShape->GetValue();
if (aShape_i.IsNull()) {
Standard_NullObject::Raise("Shape for reverse is null");
}
BRepBuilderAPI_Copy Copy(aShape_i);
if( Copy.IsDone() ) {
TopoDS_Shape tds = Copy.Shape();
if( tds.IsNull() ) {
Standard_ConstructionError::Raise("Orientation aborted : Can not reverse the shape");
}
if( tds.Orientation() == TopAbs_FORWARD)
tds.Orientation(TopAbs_REVERSED);
else
tds.Orientation(TopAbs_FORWARD);
aShape = tds;
}
}
*/
else if (aType == EDGE_WIRE) { else if (aType == EDGE_WIRE) {
anExpectedType = TopAbs_EDGE; anExpectedType = TopAbs_EDGE;
@ -1221,7 +1168,6 @@ GetCreationInformation(std::string& theOperationName,
theOperationName = "SHELL"; theOperationName = "SHELL";
AddParam( theParams, "Objects", aCI.GetShapes() ); AddParam( theParams, "Objects", aCI.GetShapes() );
break; break;
case SOLID_SHELL:
case SOLID_SHELLS: case SOLID_SHELLS:
theOperationName = "SOLID"; theOperationName = "SOLID";
AddParam( theParams, "Objects", aCI.GetShapes() ); AddParam( theParams, "Objects", aCI.GetShapes() );

View File

@ -292,7 +292,7 @@
#define WIRE_EDGES 1 #define WIRE_EDGES 1
#define FACE_WIRE 2 #define FACE_WIRE 2
#define SHELL_FACES 3 #define SHELL_FACES 3
#define SOLID_SHELL 4 //#define SOLID_SHELL 4
#define SOLID_SHELLS 5 #define SOLID_SHELLS 5
#define COMPOUND_SHAPES 6 #define COMPOUND_SHAPES 6
#define SUBSHAPE_SORTED 7 #define SUBSHAPE_SORTED 7