diff --git a/doc/salome/gui/GEOM/images/3dsketch1.png b/doc/salome/gui/GEOM/images/3dsketch1.png
new file mode 100755
index 000000000..087ea15dc
Binary files /dev/null and b/doc/salome/gui/GEOM/images/3dsketch1.png differ
diff --git a/doc/salome/gui/GEOM/images/3dsketch2.png b/doc/salome/gui/GEOM/images/3dsketch2.png
new file mode 100755
index 000000000..51f171d9f
Binary files /dev/null and b/doc/salome/gui/GEOM/images/3dsketch2.png differ
diff --git a/doc/salome/gui/GEOM/images/3dsketch3.png b/doc/salome/gui/GEOM/images/3dsketch3.png
new file mode 100755
index 000000000..feb56e7cb
Binary files /dev/null and b/doc/salome/gui/GEOM/images/3dsketch3.png differ
diff --git a/doc/salome/gui/GEOM/input/creating_3dsketcher.doc b/doc/salome/gui/GEOM/input/creating_3dsketcher.doc
new file mode 100755
index 000000000..c3f847d2d
--- /dev/null
+++ b/doc/salome/gui/GEOM/input/creating_3dsketcher.doc
@@ -0,0 +1,32 @@
+/*!
+
+\page create_3dsketcher_page 3D Sketcher
+
+3D Sketcher allows creating a closed or unclosed 3D wire from a list of points.
+
+To create a 3D Sketch, select in the main menu New Entity -> 3D Sketch .
+
+\image html 3dsketch2.png
+
+The position of each coordinates can be defined by absolute coordinates X, Y, Z or
+by relative coordinates DX, DY, DZ with respect to the previous Applied point.
+Type of coordinates can be selected by the Coordinates Type radio buttons.
+\n "Sketch Validation" button applies the whole wire.
+\n "Sketch Closure" button connects the first and the last points closing
+the contour and applies the closed wire.
+To make a closed wire using the TUI command, the first and the last point shoul
+have the same coordinates.
+
+The Result of the operation will be a \b GEOM_Object.
+
+TUI Command: geompy.Make3DSketcher( [ PointsList ] )
+This algorithm creates a wire, from the list of real values which define XYZ
+coordinates of points.
+
+Example:
+
+\image html 3dsketch1.png
+
+Our TUI Scripts provide you with useful examples of the use of
+\ref tui_3dsketcher_page "3D Sketcher".
+*/
diff --git a/doc/salome/gui/GEOM/input/creating_geom_objects.doc b/doc/salome/gui/GEOM/input/creating_geom_objects.doc
index 5d889f02a..02c30498a 100644
--- a/doc/salome/gui/GEOM/input/creating_geom_objects.doc
+++ b/doc/salome/gui/GEOM/input/creating_geom_objects.doc
@@ -36,6 +36,7 @@
\subpage work_with_groups_page
\subpage build_by_blocks_page
\subpage create_sketcher_page
+\subpage create_3dsketcher_page
\subpage create_adv_obj_page
\ref create_explode_page
diff --git a/doc/salome/gui/GEOM/input/index.doc b/doc/salome/gui/GEOM/input/index.doc
index cc7fda330..12941c823 100644
--- a/doc/salome/gui/GEOM/input/index.doc
+++ b/doc/salome/gui/GEOM/input/index.doc
@@ -40,6 +40,7 @@
\ref work_with_groups_page
\ref build_by_blocks_page
\ref create_sketcher_page
+\ref create_3dsketcher_page
\ref create_adv_obj_page
\ref create_explode_page
@@ -122,6 +123,7 @@
\ref tui_working_with_groups_page
\ref tui_building_by_blocks_page
\ref tui_sketcher_page
+\ref tui_3dsketcher_page
\ref tui_advanced_geom_objs_page
\ref tui_transformation_page
diff --git a/doc/salome/gui/GEOM/input/tui_3dsketcher.doc b/doc/salome/gui/GEOM/input/tui_3dsketcher.doc
new file mode 100755
index 000000000..c9760fbcf
--- /dev/null
+++ b/doc/salome/gui/GEOM/input/tui_3dsketcher.doc
@@ -0,0 +1,20 @@
+/*!
+
+\page tui_3dsketcher_page 3D Sketcher
+
+\code
+import geompy
+import salome
+gg = salome.ImportComponentGUI("GEOM")
+
+# create a 3D sketcher (wire) of the given points coordinates
+sketcher1 = geompy.Make3DSketcher([ 0,0,0, 50,50,50, 0,50,0, 50,0,50, 10,20,100, 0,0,0 ])
+
+# add object in the study
+id_sketcher1 = geompy.addToStudy(sketcher1,"Sketcher1")
+
+# display the sketcher
+gg.createAndDisplayGO(id_sketcher1)
+\endcode
+
+*/
\ No newline at end of file
diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl
index afbc705a5..bffefb664 100644
--- a/idl/GEOM_Gen.idl
+++ b/idl/GEOM_Gen.idl
@@ -2178,6 +2178,16 @@ module GEOM
* \return New GEOM_Object, containing the created wire.
*/
GEOM_Object MakeSketcher (in string theCommand, in ListOfDouble theWorkingPlane);
+
+ /*!
+ * Create a 3D sketcher, following the numerical description,
+ * passed through points created by \a theCoordinates argument. \n
+ * Format of the description string have to be the following:
+ *
+ * "Make3DSketcher[x1, y1, z1, x2, y2, z2, ..., xN, yN, zN]"
+ */
+
+ GEOM_Object Make3DSketcher (in ListOfDouble theCoordinates);
/*!
* Create a sketcher (wire or face), following the textual description,
diff --git a/resources/3dsketch.png b/resources/3dsketch.png
new file mode 100755
index 000000000..f34ec0516
Binary files /dev/null and b/resources/3dsketch.png differ
diff --git a/resources/GEOM_en.xml b/resources/GEOM_en.xml
index 175c2fb98..a7aac6c05 100644
--- a/resources/GEOM_en.xml
+++ b/resources/GEOM_en.xml
@@ -81,6 +81,7 @@
+
diff --git a/resources/GEOM_fr.xml b/resources/GEOM_fr.xml
index 1a551988e..feaac78e7 100644
--- a/resources/GEOM_fr.xml
+++ b/resources/GEOM_fr.xml
@@ -71,6 +71,7 @@
+
diff --git a/resources/Makefile.am b/resources/Makefile.am
index 3d4405ed0..f37e8e9e8 100644
--- a/resources/Makefile.am
+++ b/resources/Makefile.am
@@ -36,6 +36,7 @@ Plugin \
GEOMDS_Resources \
ImportExport \
ShHealing \
+3dsketch.png \
angle.png \
arc.png \
arccenter.png \
diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx
index 2bdb051f4..fa7ea74ba 100644
--- a/src/EntityGUI/EntityGUI.cxx
+++ b/src/EntityGUI/EntityGUI.cxx
@@ -37,6 +37,7 @@
#include
#include "EntityGUI_SketcherDlg.h" // Sketcher
+#include "EntityGUI_3DSketcherDlg.h" // Sketcher
#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
//=======================================================================
@@ -75,6 +76,9 @@ bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
getGeometryGUI()->ActiveWorkingPlane();
aDlg = new EntityGUI_SketcherDlg( getGeometryGUI(), parent );
break;
+ case 405: // 3D SKETCHER
+ aDlg = new EntityGUI_3DSketcherDlg( getGeometryGUI(), parent );
+ break;
case 407: // EXPLODE : use ic
aDlg = new EntityGUI_SubShapeDlg( getGeometryGUI(), parent );
break;
diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
new file mode 100755
index 000000000..e10e6e692
--- /dev/null
+++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx
@@ -0,0 +1,566 @@
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : EntityGUI_3DSketcherDlg.cxx
+// Author : DMV, OCN
+//
+
+#include "EntityGUI_3DSketcherDlg.h"
+#include "EntityGUI_Widgets.h"
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+class Locker
+{
+public:
+ Locker( bool& l ) : myLock( l ) { myLock = true; }
+ ~Locker() { myLock = false; }
+private:
+ bool& myLock;
+};
+
+//=================================================================================
+// class : EntityGUI_3DSketcherDlg()
+// purpose : Constructs a EntityGUI_3DSketcherDlg 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.
+//=================================================================================
+EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl )
+ : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl )
+{
+ QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_UNDO" ) ) );
+ QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_REDO" ) ) );
+ QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_3DSKETCH" ) ) );
+
+ setWindowTitle( tr( "GEOM_3DSKETCHER_TITLE" ) );
+
+ /***************************************************************/
+
+ mainFrame()->GroupConstructors->setTitle( tr( "GEOM_3DSKETCHER" ) );
+ mainFrame()->RadioButton1->setIcon( image3 );;
+ mainFrame()->RadioButton2->close();
+ mainFrame()->RadioButton3->close();
+
+ GroupType = new DlgRef_3Radio(centralWidget());
+ GroupType->GroupBox1->setTitle(tr("GEOM_COORDINATES_TYPE"));
+ GroupType->RadioButton1->setText(tr("GEOM_SKETCHER_ABS"));
+ GroupType->RadioButton2->setText(tr("GEOM_SKETCHER_REL"));
+ GroupType->RadioButton3->close();
+
+ Group3Spin = new EntityGUI_3Spin( centralWidget() );
+ Group3Spin->GroupBox1->setTitle( tr( "GEOM_SKETCHER_VALUES" ) );
+ Group3Spin->buttonApply->setText( tr( "GEOM_SKETCHER_APPLY" ) );
+ Group3Spin->buttonUndo->setIcon( image1 );
+ Group3Spin->buttonRedo->setIcon( image2 );
+ Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
+ Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
+ Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
+
+ buttonOk()->setText( tr( "GEOM_BUT_END_SKETCH" ) );
+ buttonApply()->setText( tr( "GEOM_BUT_CLOSE_SKETCH" ) );
+
+ QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
+ layout->setMargin( 0 ); layout->setSpacing( 6 );
+ layout->addWidget( GroupType );
+ layout->addWidget( Group3Spin );
+
+ setHelpFileName( "create_3dsketcher_page.html" );
+
+ resize(0,0);
+ Init();
+}
+
+
+
+//=================================================================================
+// function : ~EntityGUI_3DSketcherDlg()
+// purpose : Destroys the object and frees any allocated resources
+//=================================================================================
+EntityGUI_3DSketcherDlg::~EntityGUI_3DSketcherDlg()
+{
+ myGeomGUI->SetActiveDialogBox( 0 );
+}
+
+//=================================================================================
+// function : Init()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::Init()
+{
+ myOK = false;
+
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+
+ /* Get setting of step value from file configuration */
+ double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
+
+ /* min, max, step and decimals for spin boxes */
+ initSpinBox( Group3Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+ initSpinBox( Group3Spin->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+ initSpinBox( Group3Spin->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+
+ /* signals and slots connections */
+ connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( PointClicked( int ) ) );
+
+ connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+
+ connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+
+ connect( Group3Spin->buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnAddPoint() ) );
+ connect( Group3Spin->buttonUndo, SIGNAL( clicked() ), this, SLOT( ClickOnUndo() ) );
+ connect( Group3Spin->buttonRedo, SIGNAL( clicked() ), this, SLOT( ClickOnRedo() ) ) ;
+
+ connect( GroupType->RadioButton1, SIGNAL( clicked() ), this, SLOT( TypeClicked() ) );
+ connect( GroupType->RadioButton2, SIGNAL( clicked() ), this, SLOT( TypeClicked() ) );
+
+ connect( Group3Spin->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( Group3Spin->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( Group3Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+
+ connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
+
+ connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
+ connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
+
+ initName( tr( "GEOM_3DSKETCHER" ) );
+
+ UpdateButtonsState();
+}
+
+//=================================================================================
+// function : TypeClicked()
+// purpose : Radio button management
+//=================================================================================
+void EntityGUI_3DSketcherDlg::TypeClicked()
+{
+ bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
+ Group3Spin->SpinBox_DX->blockSignals(true);
+ Group3Spin->SpinBox_DY->blockSignals(true);
+ Group3Spin->SpinBox_DZ->blockSignals(true);
+ // Get setting of step value from file configuration
+ double x, y, z;
+ GetLastPoints(x, y, z);
+ if ( GroupType->RadioButton1->isChecked() ) { // XY
+ Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_X2" ) );
+ Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_Y2" ) );
+ Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_Z2" ) );
+ Group3Spin->SpinBox_DX->setValue( x + Group3Spin->SpinBox_DX->value() );
+ Group3Spin->SpinBox_DY->setValue( y + Group3Spin->SpinBox_DY->value() );
+ Group3Spin->SpinBox_DZ->setValue( z + Group3Spin->SpinBox_DZ->value() );
+ Group3Spin->buttonApply->setFocus();
+ } else if ( GroupType->RadioButton2->isChecked() ) { // DXDY
+ Group3Spin->TextLabel1->setText( tr( "GEOM_SKETCHER_DX2" ) );
+ Group3Spin->TextLabel2->setText( tr( "GEOM_SKETCHER_DY2" ) );
+ Group3Spin->TextLabel3->setText( tr( "GEOM_SKETCHER_DZ2" ) );
+ Group3Spin->SpinBox_DX->setValue( Group3Spin->SpinBox_DX->value() - x );
+ Group3Spin->SpinBox_DY->setValue( Group3Spin->SpinBox_DY->value() - y );
+ Group3Spin->SpinBox_DZ->setValue( Group3Spin->SpinBox_DZ->value() - z );
+ Group3Spin->buttonApply->setFocus();
+ }
+ Group3Spin->SpinBox_DX->blockSignals(blocked);
+ Group3Spin->SpinBox_DY->blockSignals(blocked);
+ Group3Spin->SpinBox_DZ->blockSignals(blocked);
+}
+
+//=================================================================================
+// function : ClickOnAddPoint()
+// purpose : called when the point coordinates is Applyed
+//=================================================================================
+void EntityGUI_3DSketcherDlg::ClickOnAddPoint()
+{
+ double x, y, z;
+ GetCurrentPoints(x, y, z);
+ myPointsList.append(x);
+ myPointsList.append(y);
+ myPointsList.append(z);
+
+ /*if (myRedoList.size() >= 2) { // Remove this positions from Redo List
+ for (int i = 0; i <= 2; i++)
+ myRedoList.removeFirst();
+ }*/
+ myRedoList.clear();
+
+ if ( GroupType->RadioButton2->isChecked() ) {
+ Group3Spin->SpinBox_DX->setValue( 0.0 );
+ Group3Spin->SpinBox_DY->setValue( 0.0 );
+ Group3Spin->SpinBox_DZ->setValue( 0.0 );
+ }
+ UpdateButtonsState();
+ displayPreview();
+}
+
+//=================================================================================
+// function : UpdateButtonsState()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::UpdateButtonsState()
+{
+ if ( !myPointsList.count() )
+ GroupType->RadioButton1->setChecked( true );
+ GroupType->RadioButton2->setEnabled( myPointsList.count() > 2 );
+ Group3Spin->buttonUndo->setEnabled( myPointsList.count() > 2 );
+ Group3Spin->buttonRedo->setEnabled( myRedoList.count() > 2 );
+}
+
+//=================================================================================
+// function : ClickOnUndo()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::ClickOnUndo()
+{
+ if (myPointsList.count() > 2) {
+ double x, y, z;
+ GetLastPoints(x, y, z);
+ myRedoList.append(x);
+ myRedoList.append(y);
+ myRedoList.append(z);
+ myPointsList.removeLast();
+ myPointsList.removeLast();
+ myPointsList.removeLast();
+
+ UpdateButtonsState();
+ displayPreview();
+ }
+}
+
+//=================================================================================
+// function : ClickOnRedo()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::ClickOnRedo()
+{
+ int count = myRedoList.count();
+ if ( count > 2 ) {
+ myPointsList.append( myRedoList[count-3] );
+ myPointsList.append( myRedoList[count-2] );
+ myPointsList.append( myRedoList[count-1] );
+ myRedoList.removeLast();
+ myRedoList.removeLast();
+ myRedoList.removeLast();
+
+ UpdateButtonsState();
+ displayPreview();
+ }
+}
+
+//=================================================================================
+// function : SelectionIntoArgument()
+// purpose : Called when selection as changed
+//=================================================================================
+void EntityGUI_3DSketcherDlg::SelectionIntoArgument()
+{
+ LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+ SALOME_ListIO aSelList;
+ aSelMgr->selectedObjects(aSelList);
+
+ int nbSel = aSelList.Extent();
+ if ( nbSel == 1 ) {
+ Standard_Boolean aRes = Standard_False;
+ GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aRes);
+ if (!CORBA::is_nil(aSelectedObject) && aRes) {
+ TopoDS_Shape aShape;
+ if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE)) { // Explore the shape if its a local selection
+ TColStd_IndexedMapOfInteger aMap;
+ aSelMgr->GetIndexes(aSelList.First(), aMap);
+ if (aMap.Extent() == 1)
+ {
+ int anIndex = aMap(1);
+ GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+ aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+ }
+ }
+ bool isOk = true;
+ if ( aShape.ShapeType() != TopAbs_VERTEX )
+ isOk = GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX);
+ if (isOk) {
+ gp_Pnt aPnt;
+ if ( GEOMBase::VertexToPoint( aShape, aPnt ) ) {
+ // set coordinates to the Spin Boxes
+ double aX, aY, aZ;
+ aX = aPnt.X();
+ aY = aPnt.Y();
+ aZ = aPnt.Z();
+ bool blocked = Group3Spin->SpinBox_DX->signalsBlocked();
+ Group3Spin->SpinBox_DX->blockSignals(true);
+ Group3Spin->SpinBox_DY->blockSignals(true);
+ Group3Spin->SpinBox_DZ->blockSignals(true);
+ if ( GroupType->RadioButton1->isChecked() ) {
+ Group3Spin->SpinBox_DX->setValue( aX );
+ Group3Spin->SpinBox_DY->setValue( aY );
+ Group3Spin->SpinBox_DZ->setValue( aZ );
+ } else if ( GroupType->RadioButton2->isChecked() ) {
+ double x, y, z;
+ GetLastPoints(x, y, z);
+ Group3Spin->SpinBox_DX->setValue( aX - x );
+ Group3Spin->SpinBox_DY->setValue( aY - y );
+ Group3Spin->SpinBox_DZ->setValue( aZ - z );
+ }
+ Group3Spin->SpinBox_DX->blockSignals(blocked);
+ Group3Spin->SpinBox_DY->blockSignals(blocked);
+ Group3Spin->SpinBox_DZ->blockSignals(blocked);
+ }
+ }
+ }
+ }
+ displayPreview();
+}
+
+//=================================================================================
+// function : DeactivateActiveDialog()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::DeactivateActiveDialog()
+{
+ setEnabled( false );
+ globalSelection();
+ disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
+ myGeomGUI->SetActiveDialogBox( 0 );
+}
+
+
+//=================================================================================
+// function : ActivateThisDialog()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::ActivateThisDialog()
+{
+ myGeomGUI->EmitSignalDeactivateDialog();
+ setEnabled( true );
+ myGeomGUI->SetActiveDialogBox( this );
+
+ connect( myGeomGUI->getApp()->selectionMgr(),
+ SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
+
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ displayPreview();
+}
+
+
+//=================================================================================
+// function : ValueChangedInSpinBox()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox( double newValue )
+{
+ displayPreview();
+}
+
+//=================================================================================
+// function : enterEvent()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::enterEvent( QEvent* )
+{
+ if ( !mainFrame()->GroupConstructors->isEnabled() )
+ ActivateThisDialog();
+}
+
+//=================================================================================
+// function : createOperation
+// purpose :
+//=================================================================================
+GEOM::GEOM_IOperations_ptr EntityGUI_3DSketcherDlg::createOperation()
+{
+ return getGeomEngine()->GetICurvesOperations( getStudyId() );
+}
+
+//=================================================================================
+// function : isValid
+// purpose :
+//=================================================================================
+bool EntityGUI_3DSketcherDlg::isValid( QString& msg )
+{
+ int nbPoints = myPointsList.count()/3;
+ if ( myOK )
+ return nbPoints >= 2;
+ else
+ return nbPoints >= 1;
+}
+
+//=================================================================================
+// function : execute
+// purpose :
+//=================================================================================
+bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects )
+{
+ GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble;
+ if (myOK)
+ aCoordsArray->length(myPointsList.size());
+ else
+ aCoordsArray->length(myPointsList.size()+3);
+
+ int i = 0;
+ QList::const_iterator it;
+ for(it = myPointsList.begin(); it != myPointsList.end(); ++it ) {
+ aCoordsArray[i] = *it;
+ i++;
+ }
+
+ if (!myOK) {
+ double x, y, z;
+ GetCurrentPoints(x, y, z);
+ aCoordsArray[i] = x;
+ aCoordsArray[i+1] = y;
+ aCoordsArray[i+2] = z;
+ }
+
+ GEOM::GEOM_Object_var anObj =
+ GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->Make3DSketcher( aCoordsArray );
+
+ if ( !anObj->_is_nil() )
+ objects.push_back( anObj._retn() );
+
+ return true;
+}
+
+//=================================================================================
+// function : initSpinBox()
+// purpose :
+//=================================================================================
+
+void EntityGUI_3DSketcherDlg::initSpinBox( QDoubleSpinBox* spinBox,
+ double min, double max,
+ double step, int decimals )
+{
+ spinBox->setDecimals( decimals );
+ spinBox->setRange( min, max );
+ spinBox->setSingleStep( step );
+}
+
+//=================================================================================
+// function : SetDoubleSpinBoxStep()
+// purpose : Double spin box management
+//=================================================================================
+void EntityGUI_3DSketcherDlg::SetDoubleSpinBoxStep( double step )
+{
+ Group3Spin->SpinBox_DX->setSingleStep(step);
+ Group3Spin->SpinBox_DY->setSingleStep(step);
+ Group3Spin->SpinBox_DZ->setSingleStep(step);
+}
+
+//=================================================================================
+// function : isSameAsPrevious()
+// purpose : Compare Last point in the list with current selected point
+//=================================================================================
+/*bool EntityGUI_3DSketcherDlg::isSameAsPrevious() // Not used this time
+{
+ double curX, curY, curZ;
+ double lastX, lastY, lastZ;
+ GetCurrentPoints(curX, curY, curZ);
+ GetLastPoints(lastX, lastY, lastZ);
+ if ( abs(lastX - curX) < Precision::Confusion() &&
+ abs(lastY - curY) < Precision::Confusion() &&
+ abs(lastZ - curZ) < Precision::Confusion() )
+ return true;
+
+ return false;
+}*/
+
+//=================================================================================
+// function : ClickOnOk()
+// purpose :
+//=================================================================================
+void EntityGUI_3DSketcherDlg::ClickOnOk()
+{
+ Locker lock( myOK );
+
+ if ( !onAccept() )
+ return;
+
+ ClickOnCancel();
+}
+
+//=================================================================================
+// function : ClickOnApply()
+// purpose :
+//=================================================================================
+bool EntityGUI_3DSketcherDlg::ClickOnApply()
+{
+ if (myPointsList.count() > 3) {
+ myPointsList.append(myPointsList[0]);
+ myPointsList.append(myPointsList[1]);
+ myPointsList.append(myPointsList[2]);
+ }
+
+ Locker lock( myOK );
+
+ if ( !onAccept() )
+ return false;
+
+ ClickOnCancel();
+ return true;
+}
+
+//=================================================================================
+// function : GetLastPoints()
+// purpose : return last points from list
+//=================================================================================
+void EntityGUI_3DSketcherDlg::GetLastPoints(double& x, double& y, double& z)
+{
+ int count = myPointsList.count();
+ x = count > 2 ? myPointsList[count-3] : 0.0;
+ y = count > 2 ? myPointsList[count-2] : 0.0;
+ z = count > 2 ? myPointsList[count-1] : 0.0;
+}
+
+//=================================================================================
+// function : GetCurrentPoints()
+// purpose : returns current points
+//=================================================================================
+void EntityGUI_3DSketcherDlg::GetCurrentPoints(double& x, double& y, double& z)
+{
+ if ( GroupType->RadioButton1->isChecked() ) {
+ x = Group3Spin->SpinBox_DX->value();
+ y = Group3Spin->SpinBox_DY->value();
+ z = Group3Spin->SpinBox_DZ->value();
+ } else { // if (GroupType->RadioButton2->isChecked())
+ GetLastPoints(x, y, z);
+ x += Group3Spin->SpinBox_DX->value();
+ y += Group3Spin->SpinBox_DY->value();
+ z += Group3Spin->SpinBox_DZ->value();
+ }
+}
diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.h b/src/EntityGUI/EntityGUI_3DSketcherDlg.h
new file mode 100755
index 000000000..8c2544f45
--- /dev/null
+++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.h
@@ -0,0 +1,97 @@
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : EntityGUI_3DSketcherDlg.h
+// Author : DMV, OCN
+//
+
+#ifndef ENTITYGUI_3DSKETCHERDLG_H
+#define ENTITYGUI_3DSKETCHERDLG_H
+
+#include
+
+class QDoubleSpinBox;
+class EntityGUI_3Spin;
+class DlgRef_3Radio;
+
+#ifndef COORD_MIN
+# define COORD_MIN -1e+15
+# define COORD_MAX +1e+15
+# define MAX_NUMBER 100000
+# define DBL_DIGITS_DISPLAY 16
+#endif // COORD_MIN
+
+//=================================================================================
+// class : EntityGUI_Dlg
+// purpose :
+//=================================================================================
+class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton
+{
+ Q_OBJECT
+
+public:
+ EntityGUI_3DSketcherDlg( GeometryGUI*, QWidget* = 0, bool = false, Qt::WindowFlags = 0 );
+ ~EntityGUI_3DSketcherDlg();
+
+protected:
+ void initSpinBox( QDoubleSpinBox*,
+ double, double, double = 0.1,
+ int = 3 );
+
+ // redefined from GEOMBase_Helper
+ virtual GEOM::GEOM_IOperations_ptr createOperation();
+ virtual bool isValid( QString& );
+ virtual bool execute( ObjectList& );
+
+private:
+ void Init();
+ void enterEvent( QEvent* );
+
+private:
+ QList myPointsList;
+ QList myRedoList;
+
+ EntityGUI_3Spin* Group3Spin;
+ DlgRef_3Radio* GroupType;
+
+ bool myOK;
+
+private slots:
+ void ClickOnOk();
+ void ClickOnAddPoint();
+ bool ClickOnApply();
+ // bool isSameAsPrevious();
+ void UpdateButtonsState();
+ void GetLastPoints(double&, double&, double&);
+ void GetCurrentPoints(double&, double&, double&);
+
+ void ClickOnUndo();
+ void ClickOnRedo();
+
+ void SelectionIntoArgument();
+ void DeactivateActiveDialog();
+ void ActivateThisDialog();
+ void TypeClicked();
+ void ValueChangedInSpinBox( double );
+ void SetDoubleSpinBoxStep( double );
+};
+
+#endif // ENTITYGUI_SKETCHERDLG_H
diff --git a/src/EntityGUI/Makefile.am b/src/EntityGUI/Makefile.am
index 89c9671ce..ce74db216 100644
--- a/src/EntityGUI/Makefile.am
+++ b/src/EntityGUI/Makefile.am
@@ -34,17 +34,20 @@ salomeinclude_HEADERS = \
EntityGUI.h \
EntityGUI_Widgets.h \
EntityGUI_SketcherDlg.h \
+ EntityGUI_3DSketcherDlg.h \
EntityGUI_SubShapeDlg.h
dist_libEntityGUI_la_SOURCES = \
EntityGUI.cxx \
EntityGUI_Widgets.cxx \
EntityGUI_SketcherDlg.cxx \
+ EntityGUI_3DSketcherDlg.cxx \
EntityGUI_SubShapeDlg.cxx
MOC_FILES = \
EntityGUI_Widgets_moc.cxx \
EntityGUI_SketcherDlg_moc.cxx \
+ EntityGUI_3DSketcherDlg_moc.cxx \
EntityGUI_SubShapeDlg_moc.cxx
nodist_libEntityGUI_la_SOURCES = \
diff --git a/src/GEOMGUI/GEOM_images.ts b/src/GEOMGUI/GEOM_images.ts
index 5fcf863eb..8d0a032d8 100644
--- a/src/GEOMGUI/GEOM_images.ts
+++ b/src/GEOMGUI/GEOM_images.ts
@@ -894,6 +894,10 @@
ICO_SKETCH
sketch.png
+
+ ICO_3DSKETCH
+ 3dsketch.png
+
ICO_SOLID
build_solid.png
diff --git a/src/GEOMGUI/GEOM_msg_en.ts b/src/GEOMGUI/GEOM_msg_en.ts
index fc4d51282..9d466b0aa 100644
--- a/src/GEOMGUI/GEOM_msg_en.ts
+++ b/src/GEOMGUI/GEOM_msg_en.ts
@@ -1432,6 +1432,10 @@ Please, select face, shell or solid and try again
GEOM_SKETCHER_DY2
DY :
+
+ GEOM_SKETCHER_DZ2
+ DZ :
+
GEOM_SKETCHER_EL
Element Type
@@ -1480,6 +1484,10 @@ Please, select face, shell or solid and try again
GEOM_SKETCHER_TITLE
Sketch Construction
+
+ GEOM_3DSKETCHER_TITLE
+ 3D Sketch Construction
+
GEOM_SKETCHER_TYPE
Type
@@ -1528,6 +1536,18 @@ Please, select face, shell or solid and try again
GEOM_SKETCHER_Y3
Abs. Y :
+
+ GEOM_SKETCHER_Z2
+ Z :
+
+
+ GEOM_3DSKETCHER
+ 3D Sketcher
+
+
+ GEOM_COORDINATES_TYPE
+ Coordinates Type
+
GEOM_SOLID
Solid
@@ -2324,6 +2344,10 @@ Please, select face, shell or solid and try again
MEN_SKETCH
Sketch
+
+ MEN_3DSKETCH
+ 3D Sketch
+
MEN_SOLID
Solid
diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx
index 0efa80e7e..3b514664a 100644
--- a/src/GEOMGUI/GeometryGUI.cxx
+++ b/src/GEOMGUI/GeometryGUI.cxx
@@ -441,6 +441,7 @@ void GeometryGUI::OnGUIEvent( int id )
#endif
}
else if( id == 404 || // MENU ENTITY - SKETCHER
+ id == 405 || // MENU ENTITY - 3D SKETCHER
id == 407 ) { // MENU ENTITY - EXPLODE
#ifndef WNT
library = getLibrary( "libEntityGUI.so" );
@@ -797,6 +798,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( 9999, "HEX_SOLID" );
createGeomAction( 404, "SKETCH" );
+ createGeomAction( 405, "3DSKETCH" );
createGeomAction( 407, "EXPLODE" );
createGeomAction( 4081, "EDGE" );
@@ -945,6 +947,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( separator(), newEntId, -1 );
createMenu( 404, newEntId, -1 );
+ createMenu( 405, newEntId, -1 );
createMenu( separator(), newEntId, -1 );
createMenu( 407, newEntId, -1 );
diff --git a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx
new file mode 100755
index 000000000..27603fe0f
--- /dev/null
+++ b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.cxx
@@ -0,0 +1,137 @@
+// Copyright (C) 2005 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+
+// OCCT Includes
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+//=======================================================================
+//function : GetID
+//purpose :
+//=======================================================================
+const Standard_GUID& GEOMImpl_3DSketcherDriver::GetID()
+{
+ static Standard_GUID a3DSketcherDriver("FF2BBB54-5D24-4df3-210B-3A678263EA26");
+ return a3DSketcherDriver;
+}
+
+
+//=======================================================================
+//function : GEOMImpl_3DSketcherDriver
+//purpose :
+//=======================================================================
+GEOMImpl_3DSketcherDriver::GEOMImpl_3DSketcherDriver()
+{
+}
+
+//=======================================================================
+//function : Execute
+//purpose :
+//=======================================================================
+Standard_Integer GEOMImpl_3DSketcherDriver::Execute(TFunction_Logbook& log) const
+{
+ if (Label().IsNull()) return 0;
+ Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
+
+ GEOMImpl_I3DSketcher aCI (aFunction);
+
+ TopoDS_Shape aShape;
+
+ Handle(TColStd_HArray1OfReal) aCoordsArray = aCI.GetCoordinates();
+
+ BRepBuilderAPI_MakePolygon aMakePoly;
+ int anArrayLength = aCoordsArray->Length();
+ double x, y, z;
+ for (int i = 0; i <=(anArrayLength - 3); i+=3) {
+ x = aCoordsArray->Value(i+1);
+ y = aCoordsArray->Value(i+2);
+ z = aCoordsArray->Value(i+3);
+ gp_Pnt aPnt = gp_Pnt(x, y, z);
+ aMakePoly.Add(aPnt);
+ }
+ if (aCoordsArray->Value(1) == x && aCoordsArray->Value(2) == y && aCoordsArray->Value(3) == z)
+ aMakePoly.Close();
+
+ if (aMakePoly.IsDone())
+ aShape = aMakePoly.Wire();
+
+ if (aShape.IsNull()) return 0;
+
+ aFunction->SetValue(aShape);
+ log.SetTouched(Label());
+ return 1;
+}
+
+
+//=======================================================================
+//function : GEOMImpl_3DSketcherDriver_Type_
+//purpose :
+//=======================================================================
+Standard_EXPORT Handle_Standard_Type& GEOMImpl_3DSketcherDriver_Type_()
+{
+
+ static Handle_Standard_Type aType1 = STANDARD_TYPE(TFunction_Driver);
+ if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TFunction_Driver);
+ static Handle_Standard_Type aType2 = STANDARD_TYPE(MMgt_TShared);
+ if ( aType2.IsNull()) aType2 = STANDARD_TYPE(MMgt_TShared);
+ static Handle_Standard_Type aType3 = STANDARD_TYPE(Standard_Transient);
+ if ( aType3.IsNull()) aType3 = STANDARD_TYPE(Standard_Transient);
+
+
+ static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,NULL};
+ static Handle_Standard_Type _aType = new Standard_Type("GEOMImpl_3DSketcherDriver",
+ sizeof(GEOMImpl_3DSketcherDriver),
+ 1,
+ (Standard_Address)_Ancestors,
+ (Standard_Address)NULL);
+
+ return _aType;
+}
+
+//=======================================================================
+//function : DownCast
+//purpose :
+//=======================================================================
+const Handle(GEOMImpl_3DSketcherDriver) Handle(GEOMImpl_3DSketcherDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
+{
+ Handle(GEOMImpl_3DSketcherDriver) _anOtherObject;
+
+ if (!AnObject.IsNull()) {
+ if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_3DSketcherDriver))) {
+ _anOtherObject = Handle(GEOMImpl_3DSketcherDriver)((Handle(GEOMImpl_3DSketcherDriver)&)AnObject);
+ }
+ }
+
+ return _anOtherObject ;
+}
diff --git a/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx
new file mode 100755
index 000000000..f0f2476f8
--- /dev/null
+++ b/src/GEOMImpl/GEOMImpl_3DSketcherDriver.hxx
@@ -0,0 +1,158 @@
+// Copyright (C) 2005 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : GEOMImpl_3DSketcherDriver.ixx
+// Module : GEOMImpl
+
+#ifndef _GEOMImpl_3DSketcherDriver_HeaderFile
+#define _GEOMImpl_3DSketcherDriver_HeaderFile
+
+#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
+#include
+#endif
+#ifndef _Standard_TypeMismatch_HeaderFile
+#include
+#endif
+
+#ifndef _Standard_HeaderFile
+#include
+#endif
+
+#ifndef _Standard_Macro_HeaderFile
+#include
+#endif
+#ifndef _Standard_HeaderFile
+#include
+#endif
+#ifndef _Standard_GUID_HeaderFile
+#include
+#endif
+
+#ifndef _Handle_TFunction_Driver_HeaderFile
+#include
+#endif
+
+class Standard_Transient;
+class Handle_Standard_Type;
+class Handle(TFunction_Driver);
+class GEOMImpl_3DSketcherDriver;
+
+Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_3DSketcherDriver);
+
+class Handle(GEOMImpl_3DSketcherDriver) : public Handle(TFunction_Driver) {
+ public:
+ inline void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ inline void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ inline void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+
+ Handle(GEOMImpl_3DSketcherDriver)():Handle(TFunction_Driver)() {}
+ Handle(GEOMImpl_3DSketcherDriver)(const Handle(GEOMImpl_3DSketcherDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
+ {
+ }
+
+ Handle(GEOMImpl_3DSketcherDriver)(const GEOMImpl_3DSketcherDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
+ {
+ }
+
+ Handle(GEOMImpl_3DSketcherDriver)& operator=(const Handle(GEOMImpl_3DSketcherDriver)& aHandle)
+ {
+ Assign(aHandle.Access());
+ return *this;
+ }
+
+ Handle(GEOMImpl_3DSketcherDriver)& operator=(const GEOMImpl_3DSketcherDriver* anItem)
+ {
+ Assign((Standard_Transient *)anItem);
+ return *this;
+ }
+
+ GEOMImpl_3DSketcherDriver* operator->()
+ {
+ return (GEOMImpl_3DSketcherDriver *)ControlAccess();
+ }
+
+ GEOMImpl_3DSketcherDriver* operator->() const
+ {
+ return (GEOMImpl_3DSketcherDriver *)ControlAccess();
+ }
+
+ Standard_EXPORT ~Handle(GEOMImpl_3DSketcherDriver)() {};
+
+ Standard_EXPORT static const Handle(GEOMImpl_3DSketcherDriver) DownCast(const Handle(Standard_Transient)& AnObject);
+};
+
+#ifndef _TFunction_Driver_HeaderFile
+#include
+#endif
+#ifndef _TFunction_Logbook_HeaderFile
+#include
+#endif
+#ifndef _Standard_CString_HeaderFile
+#include
+#endif
+
+class TColStd_SequenceOfExtendedString;
+
+
+class GEOMImpl_3DSketcherDriver : public TFunction_Driver {
+
+public:
+
+ inline void* operator new(size_t,void* anAddress)
+ {
+ return anAddress;
+ }
+ inline void* operator new(size_t size)
+ {
+ return Standard::Allocate(size);
+ }
+ inline void operator delete(void *anAddress)
+ {
+ if (anAddress) Standard::Free((Standard_Address&)anAddress);
+ }
+
+ // Methods PUBLIC
+ //
+Standard_EXPORT GEOMImpl_3DSketcherDriver();
+Standard_EXPORT virtual Standard_Integer Execute(TFunction_Logbook& log) const;
+Standard_EXPORT virtual void Validate(TFunction_Logbook&) const {}
+Standard_EXPORT Standard_Boolean MustExecute(const TFunction_Logbook&) const { return Standard_True; }
+Standard_EXPORT static const Standard_GUID& GetID();
+Standard_EXPORT ~GEOMImpl_3DSketcherDriver() {};
+
+
+ // Type management
+ //
+Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_3DSketcherDriver_Type_();
+Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_3DSketcherDriver) ; }
+Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_3DSketcherDriver) == AType || TFunction_Driver::IsKind(AType)); }
+
+
+};
+
+#endif
diff --git a/src/GEOMImpl/GEOMImpl_Gen.cxx b/src/GEOMImpl/GEOMImpl_Gen.cxx
index 16e512673..ad458c33c 100644
--- a/src/GEOMImpl/GEOMImpl_Gen.cxx
+++ b/src/GEOMImpl/GEOMImpl_Gen.cxx
@@ -43,6 +43,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -100,6 +101,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_PolylineDriver::GetID(), new GEOMImpl_PolylineDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SplineDriver::GetID(), new GEOMImpl_SplineDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_SketcherDriver::GetID(), new GEOMImpl_SketcherDriver());
+ TFunction_DriverTable::Get()->AddDriver(GEOMImpl_3DSketcherDriver::GetID(), new GEOMImpl_3DSketcherDriver());
// 3D Primitives
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_BoxDriver::GetID(), new GEOMImpl_BoxDriver());
diff --git a/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx b/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx
new file mode 100755
index 000000000..dc4ea30f6
--- /dev/null
+++ b/src/GEOMImpl/GEOMImpl_I3DSketcher.hxx
@@ -0,0 +1,43 @@
+// Copyright (C) 2005 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//NOTE: This is an interface to a function for the Sketcher creation.
+
+
+#include "GEOM_Function.hxx"
+
+#include
+
+#define SKETCH_ARG_COORDS 1
+
+class GEOMImpl_I3DSketcher
+{
+ public:
+
+ GEOMImpl_I3DSketcher(Handle(GEOM_Function) theFunction): _func(theFunction) {}
+
+ void SetCoordinates(const Handle(TColStd_HArray1OfReal)& theValue)
+ { _func->SetRealArray(SKETCH_ARG_COORDS, theValue); }
+
+ Handle(TColStd_HArray1OfReal) GetCoordinates() { return _func->GetRealArray(SKETCH_ARG_COORDS); }
+
+ private:
+
+ Handle(GEOM_Function) _func;
+};
diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
index c9507c5fa..c7adc5915 100644
--- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
+++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.cxx
@@ -21,6 +21,8 @@
#include
+#include
+
#include
#include
@@ -32,6 +34,7 @@
#include
#include
#include
+#include
#include
#include
@@ -39,6 +42,7 @@
#include
#include
#include
+#include
#include "utilities.h"
@@ -768,6 +772,73 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom
return aSketcher;
}
+//=============================================================================
+/*!
+ * Make3DSketcher
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (list theCoordinates)
+{
+ SetErrorCode(KO);
+
+ //Add a new Sketcher object
+ Handle(GEOM_Object) a3DSketcher = GetEngine()->AddObject(GetDocID(), GEOM_3DSKETCHER);
+
+ //Add a new Sketcher function
+ Handle(GEOM_Function) aFunction =
+ a3DSketcher->AddFunction(GEOMImpl_3DSketcherDriver::GetID(), GEOM_3DSKETCHER);
+ if (aFunction.IsNull()) return NULL;
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_3DSketcherDriver::GetID()) return NULL;
+
+ GEOMImpl_I3DSketcher aCI (aFunction);
+
+ int nbOfCoords = 0;
+ list::iterator it = theCoordinates.begin();
+ for (; it != theCoordinates.end(); it++)
+ nbOfCoords++;
+
+ Handle(TColStd_HArray1OfReal) aCoordsArray = new TColStd_HArray1OfReal (1, nbOfCoords);
+
+ it = theCoordinates.begin();
+ int ind = 1;
+ for (; it != theCoordinates.end(); it++, ind++)
+ aCoordsArray->SetValue(ind, *it);
+
+ aCI.SetCoordinates(aCoordsArray);
+
+ //Compute the Sketcher value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("3D Sketcher driver failed");
+ return NULL;
+ }
+ }
+ catch (Standard_Failure) {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ return NULL;
+ }
+
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction);
+ pd << a3DSketcher << " = geompy.Make3DSketcher([";
+
+ it = theCoordinates.begin();
+ pd << (*it++);
+ while (it != theCoordinates.end()) {
+ pd << ", " << (*it++);
+ }
+ pd << "])";
+
+ SetErrorCode(OK);
+ return a3DSketcher;
+}
+
//=============================================================================
/*!
* MakeSketcherOnPlane
diff --git a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
index 60a1e56b8..f5865ed80 100644
--- a/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
+++ b/src/GEOMImpl/GEOMImpl_ICurvesOperations.hxx
@@ -69,6 +69,7 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
list theWorkingPlane);
+ Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (list theCoordinates);
Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand,
Handle(GEOM_Object) theWorkingPlane);
};
diff --git a/src/GEOMImpl/GEOMImpl_Types.hxx b/src/GEOMImpl/GEOMImpl_Types.hxx
index 7b70e9b8b..ec7b469d0 100755
--- a/src/GEOMImpl/GEOMImpl_Types.hxx
+++ b/src/GEOMImpl/GEOMImpl_Types.hxx
@@ -87,6 +87,7 @@
#define GEOM_ELLIPSE_ARC 43
+#define GEOM_3DSKETCHER 44
//GEOM_Function types
diff --git a/src/GEOMImpl/Makefile.am b/src/GEOMImpl/Makefile.am
index b0113b6ca..c68c850a2 100644
--- a/src/GEOMImpl/Makefile.am
+++ b/src/GEOMImpl/Makefile.am
@@ -60,6 +60,7 @@ salomeinclude_HEADERS = \
GEOMImpl_IArchimede.hxx \
GEOMImpl_IArc.hxx \
GEOMImpl_ISketcher.hxx \
+ GEOMImpl_I3DSketcher.hxx \
GEOMImpl_IVector.hxx \
GEOMImpl_IDisk.hxx \
GEOMImpl_IFace.hxx \
@@ -123,6 +124,7 @@ salomeinclude_HEADERS = \
GEOMImpl_ArcDriver.hxx \
GEOMImpl_SplineDriver.hxx \
GEOMImpl_SketcherDriver.hxx \
+ GEOMImpl_3DSketcherDriver.hxx \
GEOMImpl_FilletDriver.hxx \
GEOMImpl_ChamferDriver.hxx \
GEOMImpl_BooleanDriver.hxx \
@@ -184,6 +186,7 @@ dist_libGEOMimpl_la_SOURCES = \
GEOMImpl_ArcDriver.cxx \
GEOMImpl_SplineDriver.cxx \
GEOMImpl_SketcherDriver.cxx \
+ GEOMImpl_3DSketcherDriver.cxx \
GEOMImpl_FilletDriver.cxx \
GEOMImpl_ChamferDriver.cxx \
GEOMImpl_BooleanDriver.cxx \
diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.cc b/src/GEOM_I/GEOM_ICurvesOperations_i.cc
index 740385c37..0400f241d 100644
--- a/src/GEOM_I/GEOM_ICurvesOperations_i.cc
+++ b/src/GEOM_I/GEOM_ICurvesOperations_i.cc
@@ -444,6 +444,31 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeSketcher
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * Make3DSketcher
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::Make3DSketcher
+ (const GEOM::ListOfDouble& theCoordinates)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ int ind = 0;
+ int aLen = theCoordinates.length();
+ list aCoords;
+ for (; ind < aLen; ind++)
+ aCoords.push_back(theCoordinates[ind]);
+
+ // Make Sketcher
+ Handle(GEOM_Object) anObject =
+ GetOperations()->Make3DSketcher(aCoords);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return GEOM::GEOM_Object::_nil();
+
+ return GetObject(anObject);
+}
//=============================================================================
/*!
diff --git a/src/GEOM_I/GEOM_ICurvesOperations_i.hh b/src/GEOM_I/GEOM_ICurvesOperations_i.hh
index e719bf74d..dd1c70525 100644
--- a/src/GEOM_I/GEOM_ICurvesOperations_i.hh
+++ b/src/GEOM_I/GEOM_ICurvesOperations_i.hh
@@ -76,6 +76,8 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
GEOM::GEOM_Object_ptr MakeSplineInterpolation (const GEOM::ListOfGO& thePoints);
GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand, const GEOM::ListOfDouble& theWorkingPlane);
+
+ GEOM::GEOM_Object_ptr Make3DSketcher (const GEOM::ListOfDouble& theCoordinates);
GEOM::GEOM_Object_ptr MakeSketcherOnPlane (const char* theCommand, GEOM::GEOM_Object_ptr theWorkingPlane);
diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc
index 90ee3a838..2ee744c7f 100644
--- a/src/GEOM_I_Superv/GEOM_Superv_i.cc
+++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc
@@ -2649,6 +2649,24 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeSketcher (const char* theCommand,
return NULL;
}
+//=============================================================================
+// Make3DSketcher:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::Make3DSketcher ( GEOM::GEOM_List_ptr theCoordinates)
+{
+ beginService( " GEOM_Superv_i::Make3DSketcher" );
+ MESSAGE("GEOM_Superv_i::Make3DSketcher");
+ if (GEOM_List_i* aListImpl =
+ dynamic_cast*>(GetServant(theCoordinates, myPOA).in())) {
+ getCurvesOp();
+ GEOM::GEOM_Object_ptr anObj = myCurvesOp->Make3DSketcher(aListImpl->GetList());
+ endService( " GEOM_Superv_i::Make3DSketcher" );
+ return anObj;
+ }
+ endService( " GEOM_Superv_i::Make3DSketcher" );
+ return NULL;
+}
+
//=============================== LocalOperations =============================
//=============================================================================
// MakeFilletAll:
diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh
index 3d8425253..d667c1222 100644
--- a/src/GEOM_I_Superv/GEOM_Superv_i.hh
+++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh
@@ -569,6 +569,7 @@ public:
GEOM::GEOM_Object_ptr MakeSplineInterpolation (GEOM::GEOM_List_ptr thePoints);
GEOM::GEOM_Object_ptr MakeSketcher (const char* theCommand,
GEOM::GEOM_List_ptr theWorkingPlane);
+ GEOM::GEOM_Object_ptr Make3DSketcher (GEOM::GEOM_List_ptr theCoordinates);
//-----------------------------------------------------------//
// LocalOperations //
diff --git a/src/GEOM_SWIG/GEOM_TestAll.py b/src/GEOM_SWIG/GEOM_TestAll.py
index a44d8bcfb..f8d842be9 100644
--- a/src/GEOM_SWIG/GEOM_TestAll.py
+++ b/src/GEOM_SWIG/GEOM_TestAll.py
@@ -102,6 +102,7 @@ def TestAll (geompy, math):
Interpol = geompy.MakeInterpol([px, py, p200, pxyz]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
Sketcher = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
[100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object_ptr
+ Sketcher3d = geompy.Make3DSketcher([0,0,0, 50,50,50, 0,50,50, 10,0,0])
#Test point on curve creation
p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
@@ -304,6 +305,7 @@ def TestAll (geompy, math):
id_Bezier = geompy.addToStudy(Bezier, "Bezier")
id_Interpol = geompy.addToStudy(Interpol, "Interpol")
id_Sketcher = geompy.addToStudy(Sketcher, "Sketcher")
+ id_Sketcher3d = geompy.addToStudy(Sketcher3d, "Sketcher 3D")
id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc (0.25)")
id_p_on_l1l2 = geompy.addToStudy(p_on_l1l2, "Vertex on Lines Intersection")
diff --git a/src/GEOM_SWIG/geompyDC.py b/src/GEOM_SWIG/geompyDC.py
index 18b06e9e1..072fd41f7 100644
--- a/src/GEOM_SWIG/geompyDC.py
+++ b/src/GEOM_SWIG/geompyDC.py
@@ -670,6 +670,18 @@ class geompyDC(GEOM._objref_GEOM_Gen):
anObj = self.CurvesOp.MakeSketcherOnPlane(theCommand, theWorkingPlane)
RaiseIfFailed("MakeSketcherOnPlane", self.CurvesOp)
return anObj
+
+ ## Create a sketcher wire, following the numerical description,
+ # passed through theCoordinates argument. \n
+ # @param theCoordinates double values, defining points to create a wire,
+ # passing from it.
+ # @return New GEOM_Object, containing the created wire.
+ #
+ # @ref tui_sketcher_page "Example"
+ def Make3DSketcher(self, theCoordinates):
+ anObj = self.CurvesOp.Make3DSketcher(theCoordinates)
+ RaiseIfFailed("Make3DSketcher", self.CurvesOp)
+ return anObj
# end of l3_sketcher
## @}