From: dcq Date: Thu, 11 Dec 2003 09:14:44 +0000 (+0000) Subject: DCQ: New archi... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=423b12af2ed438a3be93266584e6ea95c2b85863;p=modules%2Fgeom.git DCQ: New archi... --- diff --git a/Makefile.in b/Makefile.in index 3657e2248..aa908e76b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -25,10 +25,12 @@ arc.png \ archimede.png \ axisinertia.png \ basicproperties.png \ +bezier.png \ bounding.png \ box.png \ box2points.png \ boxdxyz.png \ +bspline.png \ build_compound.png \ build_edge.png \ build_face.png \ @@ -100,6 +102,7 @@ sketch.png \ sphere.png \ spheredxyz.png \ spherepoint.png \ +spline.png \ subshape.png \ supressHolesOnFaceShell.png \ supressface.png \ diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 3758bf0bf..4e76a246b 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -229,6 +229,12 @@ module GEOM in double WaterDensity, in double MeshingDeflection) raises (SALOME::SALOME_Exception); + //-----------------------------------------------------------// + // Splines // + //-----------------------------------------------------------// + GEOM_Shape MakeBezier (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; + GEOM_Shape MakeBSpline(in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; + //-----------------------------------------------------------// // Build // //-----------------------------------------------------------// diff --git a/resources/GEOM_en.xml b/resources/GEOM_en.xml index 92191a138..5691596c2 100644 --- a/resources/GEOM_en.xml +++ b/resources/GEOM_en.xml @@ -71,6 +71,7 @@ + @@ -144,6 +145,7 @@ + @@ -224,7 +226,7 @@ - + diff --git a/resources/bezier.png b/resources/bezier.png new file mode 100644 index 000000000..ca881f8b0 Binary files /dev/null and b/resources/bezier.png differ diff --git a/resources/bspline.png b/resources/bspline.png new file mode 100644 index 000000000..ca881f8b0 Binary files /dev/null and b/resources/bspline.png differ diff --git a/resources/spline.png b/resources/spline.png new file mode 100644 index 000000000..ca881f8b0 Binary files /dev/null and b/resources/spline.png differ diff --git a/src/BasicGUI/BasicGUI_VectorDlg.cxx b/src/BasicGUI/BasicGUI_VectorDlg.cxx index 5c35ded60..6d4eb0d24 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.cxx +++ b/src/BasicGUI/BasicGUI_VectorDlg.cxx @@ -99,6 +99,7 @@ BasicGUI_VectorDlg::~BasicGUI_VectorDlg() void BasicGUI_VectorDlg::Init() { /* init variables */ + myConstructorId = 0; myEditCurrentArgument = GroupPoints->LineEdit1; myDx = 0.0; @@ -110,7 +111,6 @@ void BasicGUI_VectorDlg::Init() /* Vertices Filter for all arguments */ myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); - myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom); mySelection->AddFilter(myVertexFilter); /* Get setting of step value from file configuration */ diff --git a/src/BasicGUI/BasicGUI_VectorDlg.h b/src/BasicGUI/BasicGUI_VectorDlg.h index a0602e4a3..41636b165 100644 --- a/src/BasicGUI/BasicGUI_VectorDlg.h +++ b/src/BasicGUI/BasicGUI_VectorDlg.h @@ -58,7 +58,6 @@ private : double step; int myConstructorId; Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */ - Handle(GEOM_ShapeTypeFilter) myEdgeFilter; gp_Pnt myPoint1; /* Points containing the vector */ gp_Pnt myPoint2; diff --git a/src/BuildGUI/BuildGUI.cxx b/src/BuildGUI/BuildGUI.cxx index 39c0ee47e..28ef04541 100644 --- a/src/BuildGUI/BuildGUI.cxx +++ b/src/BuildGUI/BuildGUI.cxx @@ -43,6 +43,7 @@ using namespace std; #include #include "BuildGUI_SubShapeDlg.h" // Method SUBSHAPE +#include "BuildGUI_SplineDlg.h" // Method SPLINE #include "BuildGUI_EdgeDlg.h" // Method EDGE #include "BuildGUI_WireDlg.h" // Method WIRE #include "BuildGUI_FaceDlg.h" // Method FACE @@ -84,6 +85,11 @@ bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) switch (theCommandID) { + case 406: // GEOM::SPLINE + { + BuildGUI_SplineDlg *aDlg = new BuildGUI_SplineDlg(parent, "", myBuildGUI, Sel); + break; + } case 407: // EXPLODE : use ic { Handle(AIS_InteractiveContext) ic; @@ -134,6 +140,52 @@ bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } +//===================================================================================== +// function : MakeBSplineAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeBSplineAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeBSpline(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeBSplineAndDisplay() +// purpose : +//===================================================================================== +void BuildGUI::MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeBezier(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + //===================================================================================== // function : MakeLinearEdgeAndDisplay() // purpose : diff --git a/src/BuildGUI/BuildGUI.h b/src/BuildGUI/BuildGUI.h index 828b3afb2..d5b376e84 100644 --- a/src/BuildGUI/BuildGUI.h +++ b/src/BuildGUI/BuildGUI.h @@ -53,6 +53,9 @@ public : void MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + void MakeBSplineAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + void MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + /* Methods for sub shapes explode */ bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); bool OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType); diff --git a/src/BuildGUI/BuildGUI_SplineDlg.cxx b/src/BuildGUI/BuildGUI_SplineDlg.cxx new file mode 100644 index 000000000..c7cbe76d2 --- /dev/null +++ b/src/BuildGUI/BuildGUI_SplineDlg.cxx @@ -0,0 +1,339 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_SplineDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +using namespace std; +#include "BuildGUI_SplineDlg.h" + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : BuildGUI_SplineDlg() +// purpose : Constructs a BuildGUI_SplineDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +BuildGUI_SplineDlg::BuildGUI_SplineDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, SALOME_Selection* Sel, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BEZIER"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BSPLINE"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SPLINE_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SPLINE")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->close(TRUE); + + GroupBezier = new DlgRef_1Sel_QTD(this, "GroupBezier"); + GroupBezier->GroupBox1->setTitle(tr("GEOM_BEZIER")); + GroupBezier->TextLabel1->setText(tr("GEOM_POINTS")); + GroupBezier->PushButton1->setPixmap(image2); + + GroupBSpline = new DlgRef_1Sel_QTD(this, "GroupBSpline"); + GroupBSpline->GroupBox1->setTitle(tr("GEOM_BSPLINE")); + GroupBSpline->TextLabel1->setText(tr("GEOM_POINTS")); + GroupBSpline->PushButton1->setPixmap(image2); + + Layout1->addWidget(GroupBezier, 1, 0); + Layout1->addWidget(GroupBSpline, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myBuildGUI = theBuildGUI; + Init(); +} + + +//================================================================================= +// function : ~BuildGUI_SplineDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +BuildGUI_SplineDlg::~BuildGUI_SplineDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void BuildGUI_SplineDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = GroupBezier->LineEdit1; + myOkListShapes = false; + + /* Vertices Filter for all arguments */ + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(GroupBezier->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupBSpline->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + GroupBSpline->hide(); + GroupBezier->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void BuildGUI_SplineDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + mySelection->ClearFilters(); + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myOkListShapes = false; + + switch (constructorId) + { + case 0: + { + GroupBSpline->hide(); + resize(0, 0); + GroupBezier->show(); + + myEditCurrentArgument = GroupBezier->LineEdit1; + GroupBezier->LineEdit1->setText(""); + break; + } + case 1: + { + GroupBezier->hide(); + resize(0, 0); + GroupBSpline->show(); + + myEditCurrentArgument = GroupBSpline->LineEdit1; + GroupBSpline->LineEdit1->setText(""); + break; + } + } + /* filter for next selection */ + mySelection->AddFilter(myVertexFilter); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void BuildGUI_SplineDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void BuildGUI_SplineDlg::ClickOnApply() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + switch(myConstructorId) + { + case 0 : + { + if(myOkListShapes) + myBuildGUI->MakeBezierAndDisplay(myListShapes); + break; + } + case 1 : + { + if(myOkListShapes) + myBuildGUI->MakeBSplineAndDisplay(myListShapes); + break; + } + } + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed or other case +//================================================================================= +void BuildGUI_SplineDlg::SelectionIntoArgument() +{ + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel < 2) { + myOkListShapes = false; + return; + } + + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; + + this->MakeSplineSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void BuildGUI_SplineDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == GroupBezier->PushButton1) { + GroupBezier->LineEdit1->setFocus(); + myEditCurrentArgument = GroupBezier->LineEdit1; + } + else if(send == GroupBSpline->PushButton1) { + GroupBSpline->LineEdit1->setFocus(); + myEditCurrentArgument = GroupBSpline->LineEdit1; + } + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void BuildGUI_SplineDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void BuildGUI_SplineDlg::enterEvent(QEvent* e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : MakeSplineSimulationAndDisplay() +// purpose : +//================================================================================= +void BuildGUI_SplineDlg::MakeSplineSimulationAndDisplay() +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + if(!myOkListShapes) + return; + + try { + TColgp_Array1OfPnt CurvePoints(1, myListShapes.length()); + SALOME_ListIteratorOfListIO It(mySelection->StoredIObjects()); + int i = 1; + for(;It.More(); It.Next()) { + Standard_Boolean found; + Handle(GEOM_AISShape) AISShape = myGeomBase->ConvertIOinGEOMAISShape(It.Value(), found); + if(!found) + return; + TopoDS_Shape Shape = AISShape->Shape(); + if(Shape.IsNull()) + return; + if(Shape.ShapeType() == TopAbs_VERTEX) { + const gp_Pnt& P = BRep_Tool::Pnt(TopoDS::Vertex(Shape)); + CurvePoints.SetValue(i, P); + } + i++; + } + switch(myConstructorId) + { + case 0 : + { + Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints); + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(GBC); + break; + } + case 1 : + { + GeomAPI_PointsToBSpline GBC(CurvePoints); + mySimulationTopoDs = BRepBuilderAPI_MakeEdge(GBC); + break; + } + } + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeSplineSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/BuildGUI/BuildGUI_SplineDlg.h b/src/BuildGUI/BuildGUI_SplineDlg.h new file mode 100644 index 000000000..07bb28377 --- /dev/null +++ b/src/BuildGUI/BuildGUI_SplineDlg.h @@ -0,0 +1,77 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : BuildGUI_SplineDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DIALOGBOX_SPLINE_H +#define DIALOGBOX_SPLINE_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel_QTD.h" + +#include "BuildGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +//================================================================================= +// class : BuildGUI_WireDlg +// purpose : +//================================================================================= +class BuildGUI_SplineDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + BuildGUI_SplineDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~BuildGUI_SplineDlg(); + +private: + void Init(); + void enterEvent(QEvent* e); + void MakeSplineSimulationAndDisplay(); + + BuildGUI* myBuildGUI; + + int myConstructorId; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ + + GEOM::GEOM_Gen::ListOfIOR myListShapes; + bool myOkListShapes; /* to check when arguments is defined */ + + DlgRef_1Sel_QTD* GroupBezier; + DlgRef_1Sel_QTD* GroupBSpline; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ConstructorsClicked(int constructorId); + +}; + +#endif // DIALOGBOX_SPLINE_H diff --git a/src/BuildGUI/Makefile.in b/src/BuildGUI/Makefile.in index c37be075c..1d59f5437 100644 --- a/src/BuildGUI/Makefile.in +++ b/src/BuildGUI/Makefile.in @@ -42,6 +42,7 @@ LIB = libBuildGUI.la LIB_SRC = BuildGUI.cxx \ BuildGUI_SubShapeDlg.cxx \ + BuildGUI_SplineDlg.cxx \ BuildGUI_EdgeDlg.cxx \ BuildGUI_WireDlg.cxx \ BuildGUI_FaceDlg.cxx \ @@ -52,6 +53,7 @@ LIB_SRC = BuildGUI.cxx \ LIB_MOC = \ BuildGUI.h \ BuildGUI_SubShapeDlg.h \ + BuildGUI_SplineDlg.h \ BuildGUI_EdgeDlg.h \ BuildGUI_WireDlg.h \ BuildGUI_FaceDlg.h \ diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index bd7cec6c3..f14ed3474 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -125,10 +125,10 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 212: // MENU VIEW - DISPLAY ALL { - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); - else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - myDisplayGUI->OnDisplayAll(); +// if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) +// ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); +// else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + myDisplayGUI->OnDisplayAll(); break; } case 213: // MENU VIEW - DISPLAY ONLY @@ -488,47 +488,97 @@ void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO //===================================================================================== void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) { - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - - myContext->Display(v3d->getTrihedron()); - - if(!onlyPreviousDisplayedObject) { - AIS_ListOfInteractive List1; - myContext->ObjectsInCollector(List1); - AIS_ListIteratorOfListOfInteractive ite1(List1); - while(ite1.More()) { - if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); - if(aSh->hasIO()) { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); - if(v3d->isInViewer(GIO, true)) { + //myContext->Display(v3d->getTrihedron()); + + if(!onlyPreviousDisplayedObject) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM"); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC); + for(; it->More();it->Next()) { + SALOMEDS::SObject_var CSO = it->Value(); + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::GenericAttribute_var anAttr; + if(CSO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + Standard_Boolean testResult; + Handle(GEOM_AISShape) aSh = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), testResult); + if(testResult) myContext->Display(aSh); + else { + GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value()); + bool AddInSt = myGeomBase->mySettings_AddInStudy; + myGeomBase->mySettings_AddInStudy = false; + myGeomBase->Display(aShape); + myGeomBase->mySettings_AddInStudy = AddInSt; } } } - ite1.Next(); +// AIS_ListOfInteractive List1; +// myContext->ObjectsInCollector(List1); +// AIS_ListIteratorOfListOfInteractive ite1(List1); +// while(ite1.More()) { +// cout<<"DCQ 1"<IsInstance(STANDARD_TYPE(GEOM_AISShape))) { +// Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); +// if(aSh->hasIO()) { +// Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); +// if(v3d->isInViewer(GIO, true)) { +// myContext->Display(aSh); +// } +// } +// } +// ite1.Next(); +// } } - } - else { - AIS_ListOfInteractive aListDisplayedObject; - myContext->DisplayedObjects(aListDisplayedObject); - AIS_ListIteratorOfListOfInteractive ite(aListDisplayedObject); - while(ite.More()) { - if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { - Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); - if (aSh->hasIO()) { - Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); - if (v3d->isInViewer(GIO,true)) { - myContext->Display(aSh); + else { + AIS_ListOfInteractive aListDisplayedObject; + myContext->DisplayedObjects(aListDisplayedObject); + AIS_ListIteratorOfListOfInteractive ite(aListDisplayedObject); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if (aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + if (v3d->isInViewer(GIO,true)) + myContext->Display(aSh); } } + ite.Next(); + } + } + } + else if (QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SComponent_var SC = aStudy->FindComponent("GEOM"); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SC); + for(; it->More();it->Next()) { + SALOMEDS::SObject_var CSO = it->Value(); + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::GenericAttribute_var anAttr; + if(CSO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + Standard_Boolean testResult; + GEOM_Actor* aSh = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), testResult); + if(testResult) { + Handle(SALOME_InteractiveObject) IObject = aSh->getIO(); + // if(myRenderInter->isInViewer(IObject)) { + ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->Display(IObject); + //} + } + else { + GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value()); + bool AddInSt = myGeomBase->mySettings_AddInStudy; + myGeomBase->mySettings_AddInStudy = false; + myGeomBase->Display(aShape); + myGeomBase->mySettings_AddInStudy = AddInSt; + } } - ite.Next(); } +// ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); } return; } diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index 4ec4f1322..14a1c3b09 100644 --- a/src/GEOM/GEOM_Gen_i.cc +++ b/src/GEOM/GEOM_Gen_i.cc @@ -46,12 +46,15 @@ using namespace std; #include #include #include +#include +#include #include #include #include #include #include #include +#include #include #include @@ -129,6 +132,7 @@ using namespace std; #include #include #include +#include #include #include #include @@ -4420,6 +4424,87 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeWire( const GEOM::GEOM_Gen::ListOfIOR& List } +//================================================================================= +// function : MakeBezier() +// purpose : Make a wire from a list containing many points +//================================================================================= +GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBezier( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) + throw (SALOME::SALOME_Exception) +{ + GEOM::GEOM_Shape_var result; + TopoDS_Shape tds, Shape; + TColgp_Array1OfPnt CurvePoints(1, ListShapes.length()); + + try { + for(unsigned int i = 0; i < ListShapes.length(); i++) { + GEOM::GEOM_Shape_var aShape = GetIORFromString(ListShapes[i]); + Shape = GetTopoShape(aShape); + if(Shape.IsNull()) { + THROW_SALOME_CORBA_EXCEPTION("MakeBezier aborted : null shape during operation", SALOME::BAD_PARAM); + } + if(Shape.ShapeType() == TopAbs_VERTEX) { + const gp_Pnt& P = BRep_Tool::Pnt(TopoDS::Vertex(Shape)); + CurvePoints.SetValue(i + 1, P); + } + } + Handle(Geom_BezierCurve) GBC = new Geom_BezierCurve(CurvePoints); + tds = BRepBuilderAPI_MakeEdge(GBC); + } + catch(Standard_Failure) { + THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeBezier", SALOME::BAD_PARAM); + } + + if( tds.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Make Bezier operation aborted : null result", SALOME::BAD_PARAM); + } + else { + result = CreateObject(tds); + InsertInLabelMoreArguments(tds, result, ListShapes, myCurrentOCAFDoc); + } + return result; +} + + +//================================================================================= +// function : MakeBSpline() +// purpose : Make a wire from a list containing many points +//================================================================================= +GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBSpline( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) + throw (SALOME::SALOME_Exception) +{ + GEOM::GEOM_Shape_var result; + TopoDS_Shape tds, Shape; + TColgp_Array1OfPnt CurvePoints(1, ListShapes.length()); + + try { + for(unsigned int i = 0; i < ListShapes.length(); i++) { + GEOM::GEOM_Shape_var aShape = GetIORFromString(ListShapes[i]); + Shape = GetTopoShape(aShape); + if(Shape.IsNull()) { + THROW_SALOME_CORBA_EXCEPTION("MakeBSpline aborted : null shape during operation", SALOME::BAD_PARAM); + } + if(Shape.ShapeType() == TopAbs_VERTEX) { + const gp_Pnt& P = BRep_Tool::Pnt(TopoDS::Vertex(Shape)); + CurvePoints.SetValue(i + 1, P); + } + } + GeomAPI_PointsToBSpline GBC(CurvePoints); + tds = BRepBuilderAPI_MakeEdge(GBC); + } + catch(Standard_Failure) { + THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeBSpline", SALOME::BAD_PARAM); + } + + if( tds.IsNull() ) { + THROW_SALOME_CORBA_EXCEPTION("Make BSpline operation aborted : null result", SALOME::BAD_PARAM); + } + else { + result = CreateObject(tds) ; + InsertInLabelMoreArguments(tds, result, ListShapes, myCurrentOCAFDoc) ; + } + return result; +} + //================================================================================= // function : MakeRevolution() diff --git a/src/GEOM/GEOM_Gen_i.hh b/src/GEOM/GEOM_Gen_i.hh index 753e98e89..1ba8a8243 100644 --- a/src/GEOM/GEOM_Gen_i.hh +++ b/src/GEOM/GEOM_Gen_i.hh @@ -591,6 +591,11 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, GEOM::GEOM_Shape_ptr MakeSolid (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakeBezier (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) + throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakeBSpline (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) + throw (SALOME::SALOME_Exception) ; + //-------------------------------------------------------------------// // Speciic method Archimede // diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index f513c6394..438a1e541 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -552,7 +552,7 @@ bool GEOMBase::Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name) ic->Display(theResult); } - Sel->AddIObject(IO, false); + // DCQ Sel->AddIObject(IO, false); QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame()->Repaint(); if(mySettings_AddInStudy) AddInStudy(false, IO); @@ -768,7 +768,7 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); else { QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(false); - Sel->AddIObject(GIO); + // DCQ Sel->AddIObject(GIO); } return true; } diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 853ab3e2b..a41b0b9d3 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -121,6 +121,7 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) theCommandID == 413 || // MENU SETTINGS - ISOS theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY + theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT theCommandID == 8032 || // POPUP VIEWER - COLOR theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY theCommandID == 8034 || // POPUP VIEWER - ISOS @@ -169,7 +170,8 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) if(!GeomGUI->LoadLibrary("libSketcherGUI.so")) return false; } - else if(theCommandID == 407 || // MENU BUILD - EXPLODE + else if(theCommandID == 406 || // MENU BUILD - SPLINE + theCommandID == 407 || // MENU BUILD - EXPLODE theCommandID == 4081 || // MENU BUILD - EDGE theCommandID == 4082 || // MENU BUILD - WIRE theCommandID == 4083 || // MENU BUILD - FACE diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index ccef0fed6..fe0e3cc9c 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -47,6 +47,13 @@ using namespace std; #include #include +#include +#include +#include +#include +#include + +#include #include #include @@ -310,6 +317,31 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) PyEditor->handleReturn(); break; } + case 5104: // LOAD SCRIPT + { + QStringList filtersList; + filtersList.append(tr("GEOM_MEN_LOAD_SCRIPT")); + filtersList.append(tr("GEOM_MEN_ALL_FILES")); + + QString aFile = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true); + if(!aFile.isEmpty()) { + QFileInfo file = aFile; + QApplication::setOverrideCursor(Qt::waitCursor); + QAD_PyEditor* PyEditor = QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); + + PyEditor->setText("import geompy\n"); + PyEditor->handleReturn(); + + QStringList aTextList = QStringList::split(".", file.fileName()); + PyEditor->setText("geompy.Path('" + file.dirPath() + "')\n"); + PyEditor->handleReturn(); + + PyEditor->setText("from " + aTextList.first() + " import *\n"); + PyEditor->handleReturn(); + } + QApplication::restoreOverrideCursor(); + break; + } case 8032: // COLOR - POPUP VIEWER { if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { @@ -398,7 +430,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) GEOMBase_NbIsosDlg * NbIsosDlg = new GEOMBase_NbIsosDlg(QAD_Application::getDesktop(), tr("GEOM_MEN_ISOS"), TRUE); - + NbIsosDlg->SpinBoxU->setValue(IsoU.toInt()); NbIsosDlg->SpinBoxV->setValue(IsoV.toInt()); @@ -406,7 +438,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) QApplication::setOverrideCursor(Qt::waitCursor); for(; ic->MoreCurrent(); ic->NextCurrent()) { Handle(AIS_Drawer) CurDrawer; - + CurDrawer = ic->Current()->Attributes(); CurDrawer->UIsoAspect()->SetNumber(NbIsosDlg->SpinBoxU->text().toInt()); CurDrawer->VIsoAspect()->SetNumber(NbIsosDlg->SpinBoxV->text().toInt()); @@ -485,11 +517,11 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) //=============================================================================== void GEOMToolsGUI::OnEditDelete() { - if ( QAD_MessageBox::warn2 - ( QAD_Application::getDesktop(), - tr ("GEOM_WRN_WARNING"), - tr ("GEOM_REALLY_DELETE"), - tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 ) + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + if(Sel->IObjectCount() == 0) + return; + + if(QAD_MessageBox::warn2(QAD_Application::getDesktop(), tr("GEOM_WRN_WARNING"), tr("GEOM_REALLY_DELETE"), tr("GEOM_BUT_YES"), tr("GEOM_BUT_NO"), 1, 0, 0) != 1) return; int nbSf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); @@ -498,42 +530,42 @@ void GEOMToolsGUI::OnEditDelete() SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributeIOR_var anIOR; - SALOME_Selection* Sel = SALOME_Selection::Selection( QAD_Application::getDesktop()->getActiveStudy()->getSelection() ); - SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); for(;It.More();It.Next()) { Handle(SALOME_InteractiveObject) IObject = It.Value(); - if ( IObject->hasEntry() ) { + if(IObject->hasEntry()) { SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() ); + SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry()); /* Erase child graphical objects */ SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO); - for (; it->More();it->Next()) { + for(; it->More();it->Next()) { SALOMEDS::SObject_var CSO= it->Value(); - if (CSO->FindAttribute(anAttr, "AttributeIOR") ) { + if(CSO->FindAttribute(anAttr, "AttributeIOR") ) { anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); /* Delete child(s) shape in Client : */ const TCollection_AsciiString ASCior(anIOR->Value()) ; - myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCior ) ; + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(ASCior); - for ( int i = 0; i < nbSf; i++ ) { + for(int i = 0; i < nbSf; i++) { QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); - if ( sf->getTypeView() == VIEW_OCC ) { + if(sf->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); Handle(GEOM_AISShape) Result = myGeomBase->ConvertIORinGEOMAISShape(anIOR->Value(), found); - if ( found ) - myContext->Erase( Result, true, false ); - } else if ( sf->getTypeView() == VIEW_VTK ) { + if(found) + myContext->Erase(Result, true, false); + } + else if(sf->getTypeView() == VIEW_VTK) { //vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); GEOM_Actor* ac = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), found); - if ( found ) { + if(found) { //Renderer->RemoveActor(ac); - if ( ac->hasIO() ) - myRenderInter->Remove( ac->getIO() ); + if(ac->hasIO()) + myRenderInter->Remove(ac->getIO()); } } } @@ -541,30 +573,31 @@ void GEOMToolsGUI::OnEditDelete() } /* Erase main graphical object */ - for ( int i = 0; i < nbSf; i++ ) { + for(int i = 0; i < nbSf; i++) { QAD_StudyFrame* sf = QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i); - if ( sf->getTypeView() == VIEW_OCC ) { + if(sf->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape( IObject, found ); - if ( found ) - myContext->Erase( Result, true, false ); - } else if ( sf->getTypeView() == VIEW_VTK ) { + Handle(AIS_InteractiveContext) myContext = v3d->getAISContext(); + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape(IObject, found ); + if(found) + myContext->Erase(Result, true, false); + } + else if(sf->getTypeView() == VIEW_VTK) { VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); myRenderInter->Remove( IObject ); } } /* Delete main shape in Client : */ - if (SO->FindAttribute(anAttr, "AttributeIOR") ) { + if(SO->FindAttribute(anAttr, "AttributeIOR")) { anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); const TCollection_AsciiString ASCIor(anIOR->Value()) ; - myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCIor ) ; + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer(ASCIor); } /* Erase objects in Study */ - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); - if ( !obj->_is_nil() ) { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); + if(!obj->_is_nil()) { QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); op->start(); aStudyBuilder->RemoveObject(obj); @@ -575,7 +608,7 @@ void GEOMToolsGUI::OnEditDelete() } /* more/next */ /* Clear any previous selection */ - Sel->ClearIObjects() ; + Sel->ClearIObjects(); QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); } diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 1e74b2938..2fd493da7 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -28,6 +28,7 @@ import salome import SALOMEDS +import sys #import SALOMEDS_Attributes_idl #NRI : BugID 1682 : from libSALOME_Swig import * @@ -474,3 +475,8 @@ def Archimede(aShape,weight,WaterDensity,MeshingDeflection): def CheckShape(aShape): Status = geom.CheckShape(aShape) return Status + +def Path(aPath): + paths = sys.path + if not aPath in paths: + sys.path.append(aPath) diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index b1431b950..0826eef58 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -68,8 +68,8 @@ PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg(QWidget* parent, const char* GroupDimensions = new DlgRef_2Spin(this, "GroupDimensions"); GroupDimensions->GroupBox1->setTitle(tr("GEOM_BOX_OBJ")); - GroupDimensions->TextLabel1->setText(tr("GEOM_HEIGHT")); - GroupDimensions->TextLabel2->setText(tr("GEOM_RADIUS")); + GroupDimensions->TextLabel1->setText(tr("GEOM_RADIUS")); + GroupDimensions->TextLabel2->setText(tr("GEOM_HEIGHT")); Layout1->addWidget(GroupPoints, 1, 0); Layout1->addWidget(GroupDimensions, 1, 0);