Merge from BR_V5_IMP_P8

This commit is contained in:
eap 2009-01-22 13:39:09 +00:00
parent 7b811326ff
commit 10bf139e7d
92 changed files with 4101 additions and 126 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,31 @@
/*!
\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 <em>New Entity -> 3D Sketch</em>.
\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 <b>Coordinates Type</b> radio buttons.
\n <b>"Sketch Validation"</b> button applies the wire, only red part will be built by "Sketch Validation".
\n <b>"Sketch Closure"</b> will close the Sketch by straight line from last red part and apply it.
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.
<b>TUI Command:</b> <em>geompy.Make3DSketcher( [ PointsList ] )</em>
This algorithm creates a wire, from the list of real values which define XYZ
coordinates of points.
<b>Example:</b>
\image html 3dsketch1.png
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_3dsketcher_page "3D Sketcher".
*/

View File

@ -29,6 +29,17 @@ Point, End Point, boolean Sense)</em>
\image html arc2.png
Finally, it is possible to create an <b>Arc of Ellipse</b>, which is also done by three points:
the Arguments <b>Point 1</b>, <b>Point 2</b> and the <b>Center Point</b>. The arc is built on the Ellipse that
lies in the plane defined by the three points, with the center in the <b>Center point</b>.
The major radius of the Ellipse is defined by the distance between the <b>Center Point</b> and
the most remote Argument point. The minor radius is defined by the shortest distance between the
other Argument point and the major radius.
\n <b>TUI Command:</b> <em>geompy.MakeArcOfEllipse(Center Point, First Point, Second Point)</em>
\n <b>Arguments:</b> Name + 3 vertices.
\image html arcofellipse2.png
\n <b>Examples:</b>
\image html arcsn.png
@ -40,4 +51,10 @@ Point, End Point, boolean Sense)</em>
\image html arcsn2.png
<center>Reversed arc.</center>
\image html arcofellipse1.png
<center>Arc Of Ellipse.</center>
Our <b>TUI Scripts</b> provide you with useful examples of creation of
\ref tui_creation_arc "Basic Geometric Objects".
*/

View File

@ -15,7 +15,10 @@ extrusion, rotation, interpolation of other objects.</li>
lower dimension, which belong to the objects of higher dimension.</li>
<li>\subpage build_by_blocks_page "Build by blocks" faces from
edges and solids from faces.</li>
<li>create line segments and arcs using \subpage create_sketcher_page "Sketcher".</li>
<li>create line segments and arcs using \subpage create_sketcher_page
"Sketcher".</li>
<li>create a closed or unclosed 3D wire from a list of points using
\subpage create_3dsketcher_page "3D Sketcher".</li>
<li>\subpage create_explode_page "Explode" objects of higher dimension
into sub-objects of lower dimension.</li>
<li>create \subpage create_adv_obj_page "Advanced geometrical objects" - edges, wires, shells...</li>

View File

@ -52,6 +52,11 @@ is predefined and is equal to 90 degrees);</li>
<li>Parameters of an element (for segment : length or target X or Y coordinate value, for arc : radius and angle).</li>
</ol>
\b Buttons:
<b>"Sketch Validation"</b> button applies the wire, only red part will be built by "Sketch Validation".
\n <b>"Sketch Closure"</b> will close the Sketch by straight line from last red part and apply it.
\n <b>Dialog Box:</b>
\image html neo-scetcher1.png

View File

@ -0,0 +1,27 @@
/*!
\page fillet2d_operation_page Fillet 2D
This operation creates fillets on the corners of a <b>2D Planar Face</b>.
\image html fillet2d_2.png
To produce a \b Fillet 2D in the <b>Main Menu</b> select
<b>Operations - > Transformation - > Fillet 2D</b>
Define the <b>Planar Face</b> to create a fillet on, select the necessary
vertexes on this face in the OCC Viewer and define the \b Radius of the Fillet.
\b Note: This Operation Works for the <b>Planar 2D</b> Faces Only.
<b>TUI Command:</b> <em>geompy.MakeFillet(Shape, R, ListVertexes)</em>
\n <b>Arguments:</b> Name + 1 shape + one or several vertexes + 1 value (Fillet radius).
<b>Examples:</b>
\image html fillet2d_1.png
Our <b>TUI Scripts</b> provide you with useful examples of the use of
\ref tui_fillet2d "Transformation Operations".
*/

View File

@ -22,4 +22,4 @@ Almost all geometry module functionalities are accessible via
\image html image3.jpg "Example of Geometry module usage for engineering tasks"
*/
*/

View File

@ -54,12 +54,31 @@ translated cube at the position (-100;0;0)
\image html image4.gif
The third algorithm modifies the location of an object using the Path object (Wire or Edge)
and the Distance parameter (ranging from 0 to 1) defining how far the object will move along the path.
\n <b>Create a copy</b> checkbox allows to keep the initial object,
otherwise it will be removed.
\n <b>Select Unpublished edges</b> checkbox allows to select subshape edges on
the other objects.
\n <b>Reverse Direction</b> checkbox allows to REVERSE the direction of the object movement along its path.
<b>Arguments:</b> Name + one or several objects + Translation path.
\n <b>Advanced option:</b>
\ref restore_presentation_parameters_page "Set presentation
parameters and subshapes from arguments".
\image html transformation13.png
\image html transformation12.png
\image html transformation14.png
\n <b>TUI Command:</b> <em>geompy.MakePosition(theObject, theStartLCS,
theEndLCS),</em> where \em theObject is a shape, location of which is
modified, \em theStartLCS is a location to move the shape from, \em
theEndLCS is a location to move the shape to.
\n Our <b>TUI Scripts</b> provide you with useful examples of the use
of \ref tui_translation "Transformation Operations".
of \ref tui_modify_location "Transformation Operations".
*/

View File

@ -20,6 +20,7 @@ factors.</li>
<li>Create a simultaneous \subpage multi_rotation_operation_page</li> "Rotation in several directions".</li>
<li>Produce a \subpage fillet_operation_page "Fillet" on the selected
edges of the object.</li>
<li>Produce a \subpage fillet2d_operation_page "2D Fillet" on the corners of a Planar Face.</li>
<li>Produce a \subpage chamfer_operation_page "Chamfer" on the
selected edges of the object.</li>
</ul>

View File

@ -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
*/

View File

@ -132,6 +132,39 @@ id_ellipse = geompy.addToStudy(ellipse,"Ellipse")
gg.createAndDisplayGO(id_vector)
gg.createAndDisplayGO(id_ellipse)
\endcode
\anchor tui_creation_arc
<br><h2>Creation of an Arc</h2>
\code
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create vertices
p0 = geompy.MakeVertex(0., 0., 0.)
p1 = geompy.MakeVertex(100., 0., 0.)
p2 = geompy.MakeVertex(50., 0., 50.)
# create an arc from a three points
arc1 = geompy.MakeArc(p0, p1, p2)
# create an arc from a center point, a start point and end point
arc2 = geompy.MakeArcCenter(p0, p1, p2, 1)
# create an arc from a center point, a major point and minor point
arc3 = geompy.MakeArcOfEllipse(p0, p1, p2)
# add objects in the study
id_arc1 = geompy.addToStudy(arc1, "Arc 1")
id_arc2 = geompy.addToStudy(arc2, "Arc 2")
id_arc3 = geompy.addToStudy(arc3, "Arc 3")
# display the arcs
gg.createAndDisplayGO(id_arc1)
gg.createAndDisplayGO(id_arc2)
gg.createAndDisplayGO(id_arc3)
\endcode
\anchor tui_creation_curve
<br><h2>Creation of a Curve</h2>

View File

@ -115,6 +115,7 @@ v = geompy.MakeVector(p1, p2)
height = 35
radius1 = 20
cylinder = geompy.MakeCylinder(p1, v, radius1, height)
circle = geompy.MakeCircle(p2, v, radius1)
# create local coordinate systems
cs1 = geompy.MakeMarker( 0, 0, 0, 1,0,0, 0,1,0)
@ -122,18 +123,25 @@ cs2 = geompy.MakeMarker(30,40,40, 1,0,0, 0,1,0)
# modify the location of the given object
position = geompy.MakePosition(cylinder, cs1, cs2)
position2 = geompy.PositionAlongPath(position, circle, 0.75, 1, 1)
# add objects in the study
id_cs1 = geompy.addToStudy(cs1, "Coordinate system 1")
id_cs2 = geompy.addToStudy(cs2, "Coordinate system 2")
id_cylinder = geompy.addToStudy(cylinder, "Cylinder")
id_circle = geompy.addToStudy(circle, "Circle")
id_position = geompy.addToStudy(position, "Position")
id_position2 = geompy.addToStudy(position2, "PositionAlongPath")
# display the results
gg.createAndDisplayGO(id_cylinder)
gg.setDisplayMode(id_cylinder,1)
gg.createAndDisplayGO(id_position)
gg.setDisplayMode(id_position,1)
gg.createAndDisplayGO(id_circle)
gg.setDisplayMode(id_circle,1)
gg.createAndDisplayGO(id_position2)
gg.setDisplayMode(id_position2,1)
\endcode
\anchor tui_mirror
@ -341,6 +349,27 @@ gg.createAndDisplayGO(id_rot2d)
gg.setDisplayMode(id_rot2d,1)
\endcode
\anchor tui_fillet2d
<br><h2>Fillet 2D</h2>
\code
import geompy
import salome
gg = salome.ImportComponentGUI("GEOM")
# create a face in OXY plane
face = geompy.MakeFaceHW(100, 100, 1)
fillet2d = geompy.MakeFillet2D(face, 30, [7, 9])
# add objects in the study
id_face = geompy.addToStudy(face,"Face_1")
id_fillet2d = geompy.addToStudy(fillet2d,"Fillet 2D_1")
# display disks
gg.createAndDisplayGO(id_face)
gg.createAndDisplayGO(id_fillet2d)
\endcode
\anchor tui_fillet
<br><h2>Fillet</h2>

View File

@ -795,6 +795,22 @@ module GEOM
in GEOM_Object theStartLCS,
in GEOM_Object theEndLCS);
/*!
* Modify the Location of the given object by Path,
* \param theObject The object to be displaced.
* \param thePath Wire or Edge along that the object will be translated.
* \param theDistance progress of Path (0 = actual location, 1 = end of path location).
* \param theCopy is a true or false parameter. true is to create a copy, false to move the object.
* \param theCopy is a true or false parameter. true is to reverse direction, false is to move normal direction.
* \return New GEOM_Object, containing the displaced shape.
*/
GEOM_Object PositionAlongPath (in GEOM_Object theObject,
in GEOM_Object thePath,
in double theDistance,
in boolean theCopy,
in boolean theReverse);
/*!
* Recompute the shape from its arguments.
* \param theObject The object to be recomputed.
@ -2097,6 +2113,17 @@ module GEOM
in GEOM_Object thePnt1,
in GEOM_Object thePnt2,
in boolean theSense);
/*!
* Create an arc of ellipse of center C and two points P1 P2.
* \param theCenter Center point of the arc.
* \param thePnt1 Major radius is distance from center to Pnt1.
* \param thePnt2 define a plane and Minor radius as a shortest distance from Pnt2 to vector Center->Pnt1.
* \return New GEOM_Object, containing the created arc.
*/
GEOM_Object MakeArcOfEllipse (in GEOM_Object theCenter,
in GEOM_Object thePnt1,
in GEOM_Object thePnt2);
/*!
@ -2155,6 +2182,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,
@ -2211,10 +2248,24 @@ module GEOM
GEOM_Object MakeFilletFaces (in GEOM_Object theShape,
in double theR,
in ListOfLong theFaces);
GEOM_Object MakeFilletFacesR1R2 (in GEOM_Object theShape,
in double theR1,
in double theR2,
in ListOfLong theFaces);
/*!
* Perform a fillet on face of the specified vertexes of the given shape.
* \param theShape Shape, to perform fillet on.
* \param theR Fillet radius.
* \param theVertexes Global indices of vertexes to perform fillet on.
* \note Global index of sub-shape can be obtained, using method
* <VAR>GEOM_IShapesOperations.GetSubShapeIndex()</VAR>.
* \return New GEOM_Object, containing the result shape.
*/
GEOM_Object MakeFillet2D (in GEOM_Object theShape,
in double theR,
in ListOfLong theVertexes);
/*!
* Perform a symmetric chamfer on all edges of the given shape.

View File

@ -343,6 +343,11 @@ module GEOM
GEOM_Object PositionShapeCopy (in GEOM_Object theObject,
in GEOM_Object theStartLCS,
in GEOM_Object theEndLCS) ;
GEOM_Object PositionAlongPath (in GEOM_Object theObject,
in GEOM_Object thePath,
in double theDistance,
in boolean theCopy,
in boolean theReverse);
//-----------------------------------------------------------//
// ShapesOperations //
@ -480,6 +485,9 @@ module GEOM
in GEOM_Object thePnt1,
in GEOM_Object thePnt2,
in boolean theSense) ;
GEOM_Object MakeArcOfEllipse (in GEOM_Object theCenter,
in GEOM_Object thePnt1,
in GEOM_Object thePnt2) ;
GEOM_Object MakePolyline (in GEOM_List thePoints) ;
GEOM_Object MakeSplineBezier (in GEOM_List thePoints) ;
GEOM_Object MakeSplineInterpolation (in GEOM_List thePoints) ;
@ -505,6 +513,9 @@ module GEOM
in double theR1,
in double theR2,
in GEOM_List theFaces) ;
GEOM_Object MakeFillet2D (in GEOM_Object theShape,
in double theR,
in GEOM_List theVertexes) ;
GEOM_Object MakeChamferAll (in GEOM_Object theShape,
in double theD) ;
GEOM_Object MakeChamferEdge (in GEOM_Object theShape,

BIN
resources/3dsketch.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

View File

@ -4247,6 +4247,38 @@
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>MakeArcOfEllipse</service-name>
<service-author></service-author>
<service-version></service-version>
<service-comment>unknown</service-comment>
<service-by-default>0</service-by-default>
<inParameter-list>
<inParameter>
<inParameter-name>thePnt1</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
<inParameter>
<inParameter-name>thePnt2</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
<inParameter>
<inParameter-name>thePnt3</inParameter-name>
<inParameter-type>GEOM_Object</inParameter-type>
<inParameter-comment>unknown</inParameter-comment>
</inParameter>
</inParameter-list>
<outParameter-list>
<outParameter>
<outParameter-name>return</outParameter-name>
<outParameter-type>GEOM_Object</outParameter-type>
<outParameter-comment>unknown</outParameter-comment>
</outParameter>
</outParameter-list>
<DataStream-list></DataStream-list>
</component-service>
<component-service>
<service-name>MakePolyline</service-name>
<service-author></service-author>

View File

@ -104,6 +104,7 @@
<separator pos-id=""/>
<popup-item item-id="404" pos-id="" label-id="Sketch" icon-id="sketch.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="405" pos-id="" label-id="3D Sketch" icon-id="3dsketch.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="407" pos-id="" label-id="Explode" icon-id="subshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<submenu label-id="Build" item-id="408" pos-id="">

View File

@ -94,6 +94,7 @@
<endsubmenu />
<separator pos-id=""/>
<popup-item item-id="404" pos-id="" label-id="Sketch" icon-id="sketch.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="405" pos-id="" label-id="3D Sketch" icon-id="3dsketch.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="406" pos-id="" label-id="Spline" icon-id="spline.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="407" pos-id="" label-id="Exploser" icon-id="subshape.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>

View File

@ -22,8 +22,7 @@
# -* Makefile *-
# Author : Patrick GOLDBRONN (CEA)
# Date : 28/06/2001
# Modified by : Alexander BORODIN (OCN) - autotools usage
# $Header$
# Modified by : Alexander BORODIN (OCN) - autotools usage
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -36,8 +35,11 @@ Plugin \
GEOMDS_Resources \
ImportExport \
ShHealing \
3dsketch.png \
angle.png \
arc.png \
arccenter.png \
arcofellipse.png \
archimede.png \
axisinertia.png \
basicproperties.png \
@ -84,6 +86,7 @@ eraseall.png \
face_hw.png \
face_vechw.png \
fillet.png \
fillet2d.png \
filletall.png \
filletedge.png \
filletface.png \
@ -182,6 +185,7 @@ marker2.png \
marker3.png \
position.png \
position2.png \
position3.png \
free_bound.png \
point_coord.png \
point3.png \
@ -203,7 +207,6 @@ free_faces.png \
propagate.png \
redo.png \
undo.png \
arccenter.png \
glue2.png \
remove_extra_edges.png \
coordsys.png \

BIN
resources/arcofellipse.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

BIN
resources/fillet2d.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 980 B

BIN
resources/position3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 891 B

View File

@ -58,6 +58,7 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
QPixmap image0( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC" ) ) );
QPixmap image1( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_CENTER" ) ) );
QPixmap image2( aResMgr->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
QPixmap image3( aResMgr->loadPixmap( "GEOM", tr( "ICON_DLG_ARC_OF_ELLIPSE" ) ) );
setWindowTitle( tr( "GEOM_ARC_TITLE" ) );
@ -65,8 +66,7 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_ARC" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
mainFrame()->RadioButton3->close();
mainFrame()->RadioButton3->setIcon( image3 );
Group3Pnts = new DlgRef_3Sel( centralWidget() );
@ -109,10 +109,30 @@ BasicGUI_ArcDlg::BasicGUI_ArcDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
Group3Pnts2->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
Group3Pnts3 = new DlgRef_3Sel( centralWidget() );
Group3Pnts3->GroupBox1->setTitle( tr( "GEOM_POINTS" ) );
Group3Pnts3->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
Group3Pnts3->TextLabel2->setText( tr( "GEOM_POINT_I" ).arg( 1 ) );
Group3Pnts3->TextLabel3->setText( tr( "GEOM_POINT_I" ).arg( 2 ) );
Group3Pnts3->LineEdit1->setReadOnly( true );
Group3Pnts3->LineEdit2->setReadOnly( true );
Group3Pnts3->LineEdit3->setReadOnly( true );
Group3Pnts3->LineEdit1->setEnabled(true);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(false);
Group3Pnts3->PushButton1->setIcon(image2);
Group3Pnts3->PushButton2->setIcon(image2);
Group3Pnts3->PushButton3->setIcon(image2);
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( Group3Pnts );
layout->addWidget( Group3Pnts2 );
layout->addWidget( Group3Pnts3 );
setHelpFileName( "create_arc_page.html" );
@ -166,9 +186,17 @@ void BasicGUI_ArcDlg::Init()
connect( Group3Pnts2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) );
connect( Group3Pnts3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group3Pnts3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group3Pnts3->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group3Pnts3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts3->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts3->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
@ -211,9 +239,6 @@ bool BasicGUI_ArcDlg::ClickOnApply()
//=================================================================================
void BasicGUI_ArcDlg::SelectionIntoArgument()
{
if ( getConstructorId() != 0 && getConstructorId() != 1 )
return;
myEditCurrentArgument->setText( "" );
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@ -234,6 +259,12 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
return;
break;
case 2:
if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) myPoint1 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
return;
break;
}
}
// nbSel == 1
@ -314,6 +345,23 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
Group3Pnts2->PushButton1->click();
}
break;
case 2:
if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) {
myPoint1 = aSelectedObject;
if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
Group3Pnts3->PushButton2->click();
}
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) {
myPoint2 = aSelectedObject;
if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
Group3Pnts3->PushButton3->click();
}
else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) {
myPoint3 = aSelectedObject;
if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
Group3Pnts3->PushButton1->click();
}
break;
}
}
@ -384,6 +432,32 @@ void BasicGUI_ArcDlg::SetEditCurrentArgument()
Group3Pnts2->LineEdit3->setEnabled(true);
}
break;
case 2:
if ( send == Group3Pnts3->PushButton1 ) {
myEditCurrentArgument = Group3Pnts3->LineEdit1;
Group3Pnts3->PushButton2->setDown(false);
Group3Pnts3->PushButton3->setDown(false);
Group3Pnts3->LineEdit1->setEnabled(true);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(false);
}
else if ( send == Group3Pnts3->PushButton2 ) {
myEditCurrentArgument = Group3Pnts3->LineEdit2;
Group3Pnts3->PushButton1->setDown(false);
Group3Pnts3->PushButton3->setDown(false);
Group3Pnts3->LineEdit1->setEnabled(false);
Group3Pnts3->LineEdit2->setEnabled(true);
Group3Pnts3->LineEdit3->setEnabled(false);
}
else if ( send == Group3Pnts3->PushButton3 ) {
myEditCurrentArgument = Group3Pnts3->LineEdit3;
Group3Pnts3->PushButton1->setDown(false);
Group3Pnts3->PushButton2->setDown(false);
Group3Pnts3->LineEdit1->setEnabled(false);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(true);
}
break;
}
myEditCurrentArgument->setFocus();
// SelectionIntoArgument();
@ -400,7 +474,8 @@ void BasicGUI_ArcDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 ||
send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ) {
send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ||
send == Group3Pnts3->LineEdit1 || send == Group3Pnts3->LineEdit2 || send == Group3Pnts3->LineEdit3 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
@ -474,6 +549,14 @@ bool BasicGUI_ArcDlg::isValid( QString& msg )
return false;
break;
}
case 2:
{
if (Group3Pnts3->LineEdit1->text().trimmed().isEmpty() ||
Group3Pnts3->LineEdit2->text().trimmed().isEmpty() ||
Group3Pnts3->LineEdit3->text().trimmed().isEmpty())
return false;
break;
}
}
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
@ -506,6 +589,14 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects )
}
break;
}
case 2:
{
if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
anObj = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() )->MakeArcOfEllipse( myPoint1, myPoint2, myPoint3 );
res = true;
}
break;
}
}
if ( !anObj->_is_nil() ) {
objects.push_back( anObj._retn() );
@ -527,8 +618,9 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
Group3Pnts2->hide();
Group3Pnts->show();
Group3Pnts2->hide();
Group3Pnts3->hide();
Group3Pnts->PushButton1->setDown(true);
Group3Pnts->PushButton2->setDown(false);
Group3Pnts->PushButton3->setDown(false);
@ -550,6 +642,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
Group3Pnts->hide();
Group3Pnts2->show();
Group3Pnts3->hide();
Group3Pnts2->PushButton1->setDown(true);
Group3Pnts2->PushButton2->setDown(false);
Group3Pnts2->PushButton3->setDown(false);
@ -564,6 +657,28 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
myEditCurrentArgument = Group3Pnts2->LineEdit1;
break;
}
case 2:
{
globalSelection(); // close local contexts, if any
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
Group3Pnts->hide();
Group3Pnts2->hide();
Group3Pnts3->show();
Group3Pnts3->PushButton1->setDown(true);
Group3Pnts3->PushButton2->setDown(false);
Group3Pnts3->PushButton3->setDown(false);
Group3Pnts3->LineEdit1->setText( "" );
Group3Pnts3->LineEdit2->setText( "" );
Group3Pnts3->LineEdit3->setText( "" );
Group3Pnts3->LineEdit1->setEnabled(true);
Group3Pnts3->LineEdit2->setEnabled(false);
Group3Pnts3->LineEdit3->setEnabled(false);
myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
myEditCurrentArgument = Group3Pnts3->LineEdit1;
break;
}
}
qApp->processEvents();
@ -608,6 +723,11 @@ void BasicGUI_ArcDlg::addSubshapesToStudy()
objMap[Group3Pnts2->LineEdit2->text()] = myPoint2;
objMap[Group3Pnts2->LineEdit3->text()] = myPoint3;
break;
case 2:
objMap[Group3Pnts3->LineEdit1->text()] = myPoint1;
objMap[Group3Pnts3->LineEdit2->text()] = myPoint2;
objMap[Group3Pnts3->LineEdit3->text()] = myPoint3;
break;
}
addSubshapesToFather( objMap );
}

View File

@ -59,6 +59,7 @@ private:
DlgRef_3Sel* Group3Pnts;
DlgRef_3Sel1Check* Group3Pnts2;
DlgRef_3Sel* Group3Pnts3;
private slots:
void ClickOnOk();

View File

@ -702,6 +702,20 @@ void DlgRef_4Sel1Spin2Check::ShowRows( int fromRow, int toRow, bool toShow )
}
}
//////////////////////////////////////////
// DlgRef_4Sel1Spin3Check
//////////////////////////////////////////
DlgRef_4Sel1Spin3Check::DlgRef_4Sel1Spin3Check( QWidget* parent, Qt::WindowFlags f )
: QWidget( parent, f )
{
setupUi( this );
}
DlgRef_4Sel1Spin3Check::~DlgRef_4Sel1Spin3Check()
{
}
//////////////////////////////////////////
// DlgRef_6Sel
//////////////////////////////////////////

View File

@ -763,6 +763,22 @@ public:
void ShowRows( int, int, bool = true );
};
//////////////////////////////////////////
// DlgRef_4Sel1Spin2Check
//////////////////////////////////////////
#include "ui_DlgRef_4Sel1Spin3Check_QTD.h"
class DLGREF_EXPORT DlgRef_4Sel1Spin3Check : public QWidget,
public Ui::DlgRef_4Sel1Spin3Check_QTD
{
Q_OBJECT
public:
DlgRef_4Sel1Spin3Check( QWidget* = 0, Qt::WindowFlags = 0 );
~DlgRef_4Sel1Spin3Check();
};
//////////////////////////////////////////
// DlgRef_6Sel
//////////////////////////////////////////

View File

@ -78,6 +78,7 @@ HEADERS += DlgRef_3Spin_QTD.h
HEADERS += DlgRef_3Spin1Check_QTD.h
HEADERS += DlgRef_3Sel3Spin1Check_QTD.h
HEADERS += DlgRef_4Sel1Spin2Check_QTD.h
HEADERS += DlgRef_4Sel1Spin3Check_QTD.h
HEADERS += DlgRef_SpinBox.h
HEADERS += DlgRef_1Sel1Spin.h
HEADERS += DlgRef_1Sel2Spin.h

View File

@ -5,30 +5,18 @@
<rect>
<x>0</x>
<y>0</y>
<width>131</width>
<height>196</height>
<width>225</width>
<height>306</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<property name="margin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
@ -37,44 +25,12 @@
<string/>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<property name="margin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<property name="spacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="5" column="0" colspan="4" >
<widget class="QCheckBox" name="CheckButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="4" column="3" >
<widget class="QCheckBox" name="CheckButton2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" >
<property name="sizePolicy" >
@ -229,7 +185,43 @@
<item row="1" column="2" colspan="2" >
<widget class="QLineEdit" name="LineEdit2" />
</item>
<item row="6" column="0" colspan="4" >
<widget class="QCheckBox" name="CheckButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4" >
<widget class="QCheckBox" name="CheckButton2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
<zorder>SpinBox_DX</zorder>
<zorder>TextLabel3</zorder>
<zorder>TextLabel5</zorder>
<zorder>TextLabel4</zorder>
<zorder>TextLabel2</zorder>
<zorder>TextLabel1</zorder>
<zorder>PushButton2</zorder>
<zorder>LineEdit5</zorder>
<zorder>LineEdit1</zorder>
<zorder>PushButton5</zorder>
<zorder>PushButton4</zorder>
<zorder>PushButton1</zorder>
<zorder>LineEdit4</zorder>
<zorder>LineEdit2</zorder>
<zorder>CheckButton1</zorder>
<zorder>CheckButton2</zorder>
</widget>
</item>
</layout>
@ -253,7 +245,6 @@
<tabstop>PushButton5</tabstop>
<tabstop>LineEdit5</tabstop>
<tabstop>SpinBox_DX</tabstop>
<tabstop>CheckButton2</tabstop>
<tabstop>CheckButton1</tabstop>
</tabstops>
<resources/>

View File

@ -0,0 +1,265 @@
<ui version="4.0" >
<class>DlgRef_4Sel1Spin3Check_QTD</class>
<widget class="QWidget" name="DlgRef_4Sel1Spin3Check_QTD" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<height>306</height>
</rect>
</property>
<property name="windowTitle" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<widget class="QGroupBox" name="GroupBox1" >
<property name="title" >
<string/>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="4" column="1" colspan="2" >
<widget class="QtxDoubleSpinBox" name="SpinBox_DX" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="4" column="0" >
<widget class="QLabel" name="TextLabel3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL3</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="TextLabel5" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL5</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="TextLabel4" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL4</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="TextLabel2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL2</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="TextLabel1" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>TL1</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QPushButton" name="PushButton2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="3" column="2" colspan="2" >
<widget class="QLineEdit" name="LineEdit5" />
</item>
<item row="0" column="2" colspan="2" >
<widget class="QLineEdit" name="LineEdit1" />
</item>
<item row="3" column="1" >
<widget class="QPushButton" name="PushButton5" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="QPushButton" name="PushButton4" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="PushButton1" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="2" column="2" colspan="2" >
<widget class="QLineEdit" name="LineEdit4" />
</item>
<item row="1" column="2" colspan="2" >
<widget class="QLineEdit" name="LineEdit2" />
</item>
<item row="6" column="0" colspan="4" >
<widget class="QCheckBox" name="CheckButton1" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4" >
<widget class="QCheckBox" name="CheckButton2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="8" column="0" colspan="4" >
<widget class="QCheckBox" name="CheckButton3" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
</layout>
<zorder>SpinBox_DX</zorder>
<zorder>TextLabel3</zorder>
<zorder>TextLabel5</zorder>
<zorder>TextLabel4</zorder>
<zorder>TextLabel2</zorder>
<zorder>TextLabel1</zorder>
<zorder>PushButton2</zorder>
<zorder>LineEdit5</zorder>
<zorder>LineEdit1</zorder>
<zorder>PushButton5</zorder>
<zorder>PushButton4</zorder>
<zorder>PushButton1</zorder>
<zorder>LineEdit4</zorder>
<zorder>LineEdit2</zorder>
<zorder>CheckButton1</zorder>
<zorder>CheckButton2</zorder>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>QtxDoubleSpinBox</class>
<extends>QDoubleSpinBox</extends>
<header location="global" >QtxDoubleSpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>PushButton1</tabstop>
<tabstop>LineEdit1</tabstop>
<tabstop>PushButton2</tabstop>
<tabstop>LineEdit2</tabstop>
<tabstop>PushButton4</tabstop>
<tabstop>LineEdit4</tabstop>
<tabstop>PushButton5</tabstop>
<tabstop>LineEdit5</tabstop>
<tabstop>SpinBox_DX</tabstop>
<tabstop>CheckButton1</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@ -83,6 +83,7 @@ UIC_FILES = \
ui_DlgRef_4Sel1List1Check_QTD.h \
ui_DlgRef_4Sel1List_QTD.h \
ui_DlgRef_4Sel1Spin2Check_QTD.h \
ui_DlgRef_4Sel1Spin3Check_QTD.h \
ui_DlgRef_6Sel_QTD.h \
ui_DlgRef_Skeleton_QTD.h

View File

@ -37,6 +37,7 @@
#include <TopoDS_Shape.hxx>
#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;

View File

@ -0,0 +1,629 @@
// 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 <QtxDoubleSpinBox.h>
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <GEOMImpl_Types.hxx>
#include <Precision.hxx>
#include <DlgRef.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
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,
const double lineWidth )
: GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
myGeometryGUI( theGeometryGUI ),
myLineWidth( lineWidth )
{
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();
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
}
//=================================================================================
// 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()
{
Locker lock( myOK );
double x, y, z;
GetCurrentPoints(x, y, z);
myPointsList.append(x);
myPointsList.append(y);
myPointsList.append(z);
myRedoList.clear();
if ( GroupType->RadioButton2->isChecked() ) {
Group3Spin->SpinBox_DX->setValue( 0.0 );
Group3Spin->SpinBox_DY->setValue( 0.0 );
Group3Spin->SpinBox_DZ->setValue( 0.0 );
}
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
UpdateButtonsState();
}
//=================================================================================
// 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();
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
}
}
//=================================================================================
// 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();
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
}
}
//=================================================================================
// 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);
}
}
}
}
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
}
//=================================================================================
// 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 );
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void EntityGUI_3DSketcherDlg::ValueChangedInSpinBox( double newValue )
{
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
}
//=================================================================================
// 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 )
{
return true;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool EntityGUI_3DSketcherDlg::execute( ObjectList& objects )
{
GEOM::ListOfDouble_var aCoordsArray = new GEOM::ListOfDouble;
if (!myOK || myPointsList.size() == 0)
aCoordsArray->length(myPointsList.size()+3);
else
aCoordsArray->length(myPointsList.size());
int i = 0;
QList<double>::const_iterator it;
for(it = myPointsList.begin(); it != myPointsList.end(); ++it ) {
aCoordsArray[i] = *it;
i++;
}
if (!myOK || myPointsList.size() == 0) {
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 : 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();
}
}
//================================================================
// Function : displayPreview
// Purpose : Method for displaying preview of resulting shape
// Redefined from GEOMBase_Helper.
//================================================================
void EntityGUI_3DSketcherDlg::displayPreview( GEOM::GEOM_Object_ptr object,
const bool append,
const bool activate,
const bool update,
const double lineWidth,
const int displayMode,
const int color )
{
// Set color for preview shape
getDisplayer()->SetColor( Quantity_NOC_RED );
// set width of displayed shape
getDisplayer()->SetWidth( (lineWidth == -1)?myLineWidth:lineWidth );
// Disable activation of selection
getDisplayer()->SetToActivate( activate );
// Make a reference to GEOM_Object
CORBA::String_var objStr = myGeometryGUI->getApp()->orb()->object_to_string( object );
getDisplayer()->SetName( objStr.in() );
// Create wire from applayed object
TopoDS_Shape anApplyedWire, aLastSegment;
if ( !createShapes( object, anApplyedWire, aLastSegment ) )
return;
// Build prs
SALOME_Prs* aPrs = getDisplayer()->BuildPrs( anApplyedWire );
if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update );
getDisplayer()->SetColor( Quantity_NOC_VIOLET );
aPrs = getDisplayer()->BuildPrs( aLastSegment );
if ( aPrs != 0 && !aPrs->IsNull() )
GEOMBase_Helper::displayPreview( aPrs, append, update );
getDisplayer()->UnsetName();
// Enable activation of displayed objects
getDisplayer()->SetToActivate( true );
}
//================================================================
// Function : createShapes
// Purpose : Create applyed wire, and last segment from entry object
//================================================================
bool EntityGUI_3DSketcherDlg::createShapes( GEOM::GEOM_Object_ptr theObject,
TopoDS_Shape& theApplyedWire,
TopoDS_Shape& theLastSegment )
{
TopoDS_Shape aShape;
if ( !GEOMBase::GetShape( theObject, aShape ) ||
aShape.ShapeType() != TopAbs_WIRE && aShape.ShapeType() != TopAbs_VERTEX )
return false;
if ( myOK ) {
theApplyedWire = aShape;
return true;
}
BRepBuilderAPI_MakeWire aBuilder;
TopExp_Explorer anExp( aShape, TopAbs_EDGE );
while ( 1 ) {
TopoDS_Shape anEdge = anExp.Current();
anExp.Next();
if ( anExp.More() ) // i.e. non-last edge
aBuilder.Add( TopoDS::Edge( anEdge ) );
else {
theLastSegment = anEdge;
break;
}
}
if ( aBuilder.IsDone() )
theApplyedWire = aBuilder.Shape();
return true;
}

View File

@ -0,0 +1,111 @@
// 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 <GEOMBase_Skeleton.h>
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, const double = 2. );
~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* );
virtual void displayPreview( GEOM::GEOM_Object_ptr,
const bool = false,
const bool = false,
const bool = true,
const double = -1,
const int = -1,
const int = -1);
bool createShapes( GEOM::GEOM_Object_ptr,
TopoDS_Shape&,
TopoDS_Shape& );
private:
QList<double> myPointsList;
QList<double> myRedoList;
EntityGUI_3Spin* Group3Spin;
DlgRef_3Radio* GroupType;
bool myOK;
double myLineWidth;
GeometryGUI* myGeometryGUI;
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

View File

@ -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 = \

View File

@ -41,6 +41,10 @@
<source>ICON_DLG_ARC_CENTER</source>
<translation>arccenter.png</translation>
</message>
<message>
<source>ICON_DLG_ARC_OF_ELLIPSE</source>
<translation>arcofellipse.png</translation>
</message>
<message>
<source>ICON_DLG_BASICPROPERTIES</source>
<translation>basicproperties.png</translation>
@ -221,6 +225,10 @@
<source>ICON_DLG_FILLET</source>
<translation>fillet.png</translation>
</message>
<message>
<source>ICON_DLG_FILLET_2D</source>
<translation>fillet2d.png</translation>
</message>
<message>
<source>ICON_DLG_FILLET_ALL</source>
<translation>filletall.png</translation>
@ -381,6 +389,10 @@
<source>ICON_DLG_POSITION2</source>
<translation>position2.png</translation>
</message>
<message>
<source>ICON_DLG_POSITION3</source>
<translation>position3.png</translation>
</message>
<message>
<source>ICON_DLG_PRISM</source>
<translation>prism.png</translation>
@ -753,6 +765,10 @@
<source>ICO_FILLET</source>
<translation>fillet.png</translation>
</message>
<message>
<source>ICO_FILLET_2D</source>
<translation>fillet2d.png</translation>
</message>
<message>
<source>ICO_FILLING</source>
<translation>filling.png</translation>
@ -909,6 +925,10 @@
<source>ICO_SKETCH</source>
<translation>sketch.png</translation>
</message>
<message>
<source>ICO_3DSKETCH</source>
<translation>3dsketch.png</translation>
</message>
<message>
<source>ICO_SOLID</source>
<translation>build_solid.png</translation>

View File

@ -684,6 +684,10 @@ msgstr "Edge"
msgid "GEOM_FACE"
msgstr "Face"
#Face
msgid "GEOM_PLANAR_FACE"
msgstr "Planar Face"
#Faces
msgid "GEOM_FACES"
msgstr "Faces"

View File

@ -611,6 +611,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_FILLET</source>
<translation>Fillet</translation>
</message>
<message>
<source>GEOM_FILLET_2D</source>
<translation>Fillet 2D</translation>
</message>
<message>
<source>GEOM_FILLET_ABORT</source>
<translation>Fillet can't be computed with radius %1</translation>
@ -627,10 +631,18 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_FILLET_FACES</source>
<translation>Fillet On Faces From Shape</translation>
</message>
<message>
<source>GEOM_FILLET_VERTEXES</source>
<translation>Fillet On Vertexes From Face</translation>
</message>
<message>
<source>GEOM_FILLET_TITLE</source>
<translation>Fillet Construction</translation>
</message>
<message>
<source>GEOM_FILLET_2D_TITLE</source>
<translation>2D Fillet Construction</translation>
</message>
<message>
<source>GEOM_FILLING</source>
<translation>Filling</translation>
@ -1327,6 +1339,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_REVERSE</source>
<translation>Reverse</translation>
</message>
<message>
<source>GEOM_REVERSE_DIRECTION</source>
<translation>Reverse Direction</translation>
</message>
<message>
<source>GEOM_REVERSE_PLANE</source>
<translation>Reverse the plane normal</translation>
@ -1467,6 +1483,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SKETCHER_DY2</source>
<translation>DY :</translation>
</message>
<message>
<source>GEOM_SKETCHER_DZ2</source>
<translation>DZ :</translation>
</message>
<message>
<source>GEOM_SKETCHER_EL</source>
<translation>Element Type</translation>
@ -1515,6 +1535,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SKETCHER_TITLE</source>
<translation>Sketch Construction</translation>
</message>
<message>
<source>GEOM_3DSKETCHER_TITLE</source>
<translation>3D Sketch Construction</translation>
</message>
<message>
<source>GEOM_SKETCHER_TYPE</source>
<translation>Type</translation>
@ -1563,6 +1587,18 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_SKETCHER_Y3</source>
<translation>Abs. Y :</translation>
</message>
<message>
<source>GEOM_SKETCHER_Z2</source>
<translation>Z :</translation>
</message>
<message>
<source>GEOM_3DSKETCHER</source>
<translation>3D Sketcher</translation>
</message>
<message>
<source>GEOM_COORDINATES_TYPE</source>
<translation>Coordinates Type</translation>
</message>
<message>
<source>GEOM_SOLID</source>
<translation>Solid</translation>
@ -1599,6 +1635,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_START_LCS</source>
<translation>Start LCS</translation>
</message>
<message>
<source>SELECT_UNPUBLISHED_EDGES</source>
<translation>Select unpublished edges</translation>
</message>
<message>
<source>GEOM_STEP</source>
<translation>Step :</translation>
@ -1823,6 +1863,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_VERTEX</source>
<translation>Vertex</translation>
</message>
<message>
<source>GEOM_VERTEXES</source>
<translation>Vertexes</translation>
</message>
<message>
<source>GEOM_WATER_DENSITY</source>
<translation>Water Density :</translation>
@ -2131,6 +2175,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_FILLET</source>
<translation>Fillet</translation>
</message>
<message>
<source>MEN_FILLET_2D</source>
<translation>Fillet 2D</translation>
</message>
<message>
<source>MEN_FILLING</source>
<translation>Filling</translation>
@ -2355,6 +2403,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_SKETCH</source>
<translation>Sketch</translation>
</message>
<message>
<source>MEN_3DSKETCH</source>
<translation>3D Sketch</translation>
</message>
<message>
<source>MEN_SOLID</source>
<translation>Solid</translation>
@ -3597,7 +3649,7 @@ Please, select face, shell or solid and try again</translation>
</message>
<message>
<source>GEOM_PLANAR_FACE</source>
<translation>Planar face</translation>
<translation>Planar Face</translation>
</message>
<message>
<source>GEOM_POLYGON</source>

View File

@ -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" );
@ -490,7 +491,8 @@ void GeometryGUI::OnGUIEvent( int id )
id == 505 || // MENU OPERATION - FILLET
id == 506 || // MENU OPERATION - CHAMFER
id == 507 || // MENU OPERATION - CLIPPING RANGE
id == 508 ) { // MENU OPERATION - GET SHAPES ON SHAPE
id == 508 || // MENU OPERATION - GET SHAPES ON SHAPE
id == 509 ) { // MENU OPERATION - FILLET 2D
#ifndef WNT
library = getLibrary( "libOperationGUI.so" );
#else
@ -797,6 +799,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( 9999, "HEX_SOLID" );
createGeomAction( 404, "SKETCH" );
createGeomAction( 405, "3DSKETCH" );
createGeomAction( 407, "EXPLODE" );
createGeomAction( 4081, "EDGE" );
@ -826,6 +829,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( 506, "CHAMFER" );
//createGeomAction( 507, "CLIPPING" );
createGeomAction( 508, "GET_SHAPES_ON_SHAPES" );
createGeomAction( 509, "FILLET_2D" );
createGeomAction( 9998, "MUL_TRANSFORM" );
createGeomAction( 9995, "EXPLODE_BLOCKS" );
@ -945,6 +949,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 );
@ -979,6 +984,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( 504, operId, -1 );
createMenu( 508, operId, -1 );
createMenu( separator(), operId, -1 );
createMenu( 509, transId, -1 );
createMenu( 505, transId, -1 );
createMenu( 506, transId, -1 );
//createMenu( 507, transId, -1 );

View File

@ -108,6 +108,7 @@ SOURCES += GEOMImpl_ArcDriver.cxx
SOURCES += GEOMImpl_SplineDriver.cxx
SOURCES += GEOMImpl_SketcherDriver.cxx
SOURCES += GEOMImpl_FilletDriver.cxx
SOURCES += GEOMImpl_Fillet2dDriver.cxx
SOURCES += GEOMImpl_ChamferDriver.cxx
SOURCES += GEOMImpl_BooleanDriver.cxx
SOURCES += GEOMImpl_PartitionDriver.cxx

View File

@ -0,0 +1,145 @@
// 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 <Standard_Stream.hxx>
#include <GEOMImpl_3DSketcherDriver.hxx>
#include <GEOMImpl_I3DSketcher.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
#include <GEOMImpl_IMeasureOperations.hxx>
// OCCT Includes
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Wire.hxx>
#include <gp_Pnt.hxx>
#include <Standard_ConstructionError.hxx>
//=======================================================================
//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;
gp_Pnt aPnt;
for (int i = 0; i <=(anArrayLength - 3); i+=3) {
x = aCoordsArray->Value(i+1);
y = aCoordsArray->Value(i+2);
z = aCoordsArray->Value(i+3);
aPnt = gp_Pnt(x, y, z);
aMakePoly.Add(aPnt);
}
if ( anArrayLength == 3) { // Only Start Point
BRepBuilderAPI_MakeVertex mkVertex (aPnt);
aShape = mkVertex.Shape();
}
else { // Make Wire
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 ;
}

View File

@ -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 <TColStd_SequenceOfExtendedString.hxx>
#endif
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_GUID_HeaderFile
#include <Standard_GUID.hxx>
#endif
#ifndef _Handle_TFunction_Driver_HeaderFile
#include <Handle_TFunction_Driver.hxx>
#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 <TFunction_Driver.hxx>
#endif
#ifndef _TFunction_Logbook_HeaderFile
#include <TFunction_Logbook.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#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

View File

@ -37,12 +37,16 @@
#include <GC_MakeArcOfCircle.hxx>
#include <GC_MakeCircle.hxx>
#include <GC_MakeArcOfEllipse.hxx>
#include <GC_MakeEllipse.hxx>
#include <Standard_ConstructionError.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Circ.hxx>
#include <gp_Elips.hxx>
#include <Geom_Circle.hxx>
#include <Geom_Ellipse.hxx>
#include "utilities.h"
@ -78,7 +82,7 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
if ((aType == CIRC_ARC_THREE_PNT) || (aType == CIRC_ARC_CENTER))
if ((aType == CIRC_ARC_THREE_PNT) || (aType == CIRC_ARC_CENTER) || (aType == ELLIPSE_ARC_CENTER_TWO_PNT))
{
Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1();
Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2();
@ -108,9 +112,7 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const
{
GC_MakeArcOfCircle arc (aP1, aP2, aP3);
aShape = BRepBuilderAPI_MakeEdge(arc).Edge();
}
else // CIRC_ARC_CENTER
{
} else if ( aType == CIRC_ARC_CENTER ) { // CIRC_ARC_CENTER
Standard_Boolean sense = aCI.GetSense();
Standard_Real aRad = aP1.Distance(aP2);
@ -126,9 +128,29 @@ Standard_Integer GEOMImpl_ArcDriver::Execute(TFunction_Logbook& log) const
GC_MakeArcOfCircle arc (aGeomCirc->Circ(), aP2, aP3, Standard_True);
aShape = BRepBuilderAPI_MakeEdge(arc).Edge();
} else if ( aType == ELLIPSE_ARC_CENTER_TWO_PNT ) { // ELLIPSE_ARC_CENTER_TWO_PNT
if ( aP1.Distance(aP2) <= aP1.Distance(aP3) ) {
// Standard_ConstructionError::Raise("Arc creation aborted: the distance from Center Point to Point 1 needs to be bigger than the distance from Center Point to Point 2");
cout << "aP1.Distance(aP2) <= aP1.Distance(aP3)" << endl;
gp_Pnt aTmpP = aP2;
aP2 = aP3;
aP3 = aTmpP;
}
GC_MakeEllipse ellipse (aP2, aP3, aP1);
Handle(Geom_Ellipse) aGeomEllipse = ellipse.Value();
gp_Vec aV1 (aP1, aP2);
gp_Vec aV2 (aP1, aP3);
double alpha = fabs(aV1.Angle(aV2));
GC_MakeArcOfEllipse arc (aGeomEllipse->Elips(), aP2, aP3, Standard_True);
aShape = BRepBuilderAPI_MakeEdge(arc).Edge();
}
}
} else {
}
else {
}
if (aShape.IsNull()) return 0;

View File

@ -0,0 +1,152 @@
// 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 <Standard_Stream.hxx>
#include <GEOMImpl_Fillet2dDriver.hxx>
#include <GEOMImpl_IFillet2d.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_ILocalOperations.hxx>
#include <GEOM_Function.hxx>
#include <BRepFilletAPI_MakeFillet2d.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRep_Tool.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopAbs.hxx>
#include <TopExp_Explorer.hxx>
#include <ShapeFix_ShapeTolerance.hxx>
#include <ShapeFix_Shape.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <StdFail_NotDone.hxx>
//=======================================================================
//function : GetID
//purpose :
//=======================================================================
const Standard_GUID& GEOMImpl_Fillet2dDriver::GetID()
{
static Standard_GUID aFillet2dDriver("FF1AAB41-2A14-4df2-581B-3A568163BA46");
return aFillet2dDriver;
}
//=======================================================================
//function : GEOMImpl_Fillet2dDriver
//purpose :
//=======================================================================
GEOMImpl_Fillet2dDriver::GEOMImpl_Fillet2dDriver()
{
}
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_Fillet2dDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IFillet2d aCI (aFunction);
TopoDS_Shape aShape;
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Face aFaceShape = TopoDS::Face(aRefShape->GetValue());
if (aFaceShape.ShapeType() != TopAbs_FACE)
Standard_ConstructionError::Raise("Wrong arguments: two faces must be given");
BRepFilletAPI_MakeFillet2d fillet2d (aFaceShape);
int aLen = aCI.GetLength();
int ind = 1;
double rad = aCI.GetR();
for (; ind <= aLen; ind++) {
TopoDS_Shape aShapeVertex;
if (GEOMImpl_ILocalOperations::GetSubShape
(aFaceShape, aCI.GetVertex(ind), aShapeVertex)) {
fillet2d.AddFillet(TopoDS::Vertex(aShapeVertex), rad);
}
}
fillet2d.Build();
if (!fillet2d.IsDone()) {
StdFail_NotDone::Raise("2D Fillet can't be computed on the given shape with the given radius");
}
aShape = fillet2d.Shape();
if (aShape.IsNull()) return 0;
aFunction->SetValue(aShape);
log.SetTouched(Label());
return 1;
}
//=======================================================================
//function : GEOMImpl_Fillet2dDriver_Type_
//purpose :
//=======================================================================
Standard_EXPORT Handle_Standard_Type& GEOMImpl_Fillet2dDriver_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_Fillet2dDriver",
sizeof(GEOMImpl_Fillet2dDriver),
1,
(Standard_Address)_Ancestors,
(Standard_Address)NULL);
return _aType;
}
//=======================================================================
//function : DownCast
//purpose :
//=======================================================================
const Handle(GEOMImpl_Fillet2dDriver) Handle(GEOMImpl_Fillet2dDriver)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(GEOMImpl_Fillet2dDriver) _anOtherObject;
if (!AnObject.IsNull()) {
if (AnObject->IsKind(STANDARD_TYPE(GEOMImpl_Fillet2dDriver))) {
_anOtherObject = Handle(GEOMImpl_Fillet2dDriver)((Handle(GEOMImpl_Fillet2dDriver)&)AnObject);
}
}
return _anOtherObject ;
}

View File

@ -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_Fillet2dDriver.ixx
// Module : GEOMImpl
#ifndef _GEOMImpl_Fillet2dDriver_HeaderFile
#define _GEOMImpl_Fillet2dDriver_HeaderFile
#ifndef _TColStd_SequenceOfExtendedString_HeaderFile
#include <TColStd_SequenceOfExtendedString.hxx>
#endif
#ifndef _Standard_TypeMismatch_HeaderFile
#include <Standard_TypeMismatch.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_Macro_HeaderFile
#include <Standard_Macro.hxx>
#endif
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_GUID_HeaderFile
#include <Standard_GUID.hxx>
#endif
#ifndef _Handle_TFunction_Driver_HeaderFile
#include <Handle_TFunction_Driver.hxx>
#endif
class Standard_Transient;
class Handle_Standard_Type;
class Handle(TFunction_Driver);
class GEOMImpl_Fillet2dDriver;
Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(GEOMImpl_Fillet2dDriver);
class Handle(GEOMImpl_Fillet2dDriver) : 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_Fillet2dDriver)():Handle(TFunction_Driver)() {}
Handle(GEOMImpl_Fillet2dDriver)(const Handle(GEOMImpl_Fillet2dDriver)& aHandle) : Handle(TFunction_Driver)(aHandle)
{
}
Handle(GEOMImpl_Fillet2dDriver)(const GEOMImpl_Fillet2dDriver* anItem) : Handle(TFunction_Driver)((TFunction_Driver *)anItem)
{
}
Handle(GEOMImpl_Fillet2dDriver)& operator=(const Handle(GEOMImpl_Fillet2dDriver)& aHandle)
{
Assign(aHandle.Access());
return *this;
}
Handle(GEOMImpl_Fillet2dDriver)& operator=(const GEOMImpl_Fillet2dDriver* anItem)
{
Assign((Standard_Transient *)anItem);
return *this;
}
GEOMImpl_Fillet2dDriver* operator->()
{
return (GEOMImpl_Fillet2dDriver *)ControlAccess();
}
GEOMImpl_Fillet2dDriver* operator->() const
{
return (GEOMImpl_Fillet2dDriver *)ControlAccess();
}
Standard_EXPORT ~Handle(GEOMImpl_Fillet2dDriver)() {};
Standard_EXPORT static const Handle(GEOMImpl_Fillet2dDriver) DownCast(const Handle(Standard_Transient)& AnObject);
};
#ifndef _TFunction_Driver_HeaderFile
#include <TFunction_Driver.hxx>
#endif
#ifndef _TFunction_Logbook_HeaderFile
#include <TFunction_Logbook.hxx>
#endif
#ifndef _Standard_CString_HeaderFile
#include <Standard_CString.hxx>
#endif
class TColStd_SequenceOfExtendedString;
class GEOMImpl_Fillet2dDriver : 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_Fillet2dDriver();
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_Fillet2dDriver() {};
// Type management
//
Standard_EXPORT friend Handle_Standard_Type& GEOMImpl_Fillet2dDriver_Type_();
Standard_EXPORT const Handle(Standard_Type)& DynamicType() const { return STANDARD_TYPE(GEOMImpl_Fillet2dDriver) ; }
Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)& AType) const { return (STANDARD_TYPE(GEOMImpl_Fillet2dDriver) == AType || TFunction_Driver::IsKind(AType)); }
};
#endif

View File

@ -45,6 +45,7 @@
#include <GEOMImpl_PolylineDriver.hxx>
#include <GEOMImpl_SplineDriver.hxx>
#include <GEOMImpl_SketcherDriver.hxx>
#include <GEOMImpl_3DSketcherDriver.hxx>
#include <GEOMImpl_BoxDriver.hxx>
#include <GEOMImpl_FaceDriver.hxx>
#include <GEOMImpl_DiskDriver.hxx>
@ -61,6 +62,7 @@
#include <GEOMImpl_BooleanDriver.hxx>
#include <GEOMImpl_ChamferDriver.hxx>
#include <GEOMImpl_FilletDriver.hxx>
#include <GEOMImpl_Fillet2dDriver.hxx>
#include <GEOMImpl_TranslateDriver.hxx>
#include <GEOMImpl_RotateDriver.hxx>
#include <GEOMImpl_MirrorDriver.hxx>
@ -102,6 +104,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());
@ -131,6 +134,7 @@ GEOMImpl_Gen::GEOMImpl_Gen()
// Local Operations
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ChamferDriver::GetID(), new GEOMImpl_ChamferDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_FilletDriver::GetID(), new GEOMImpl_FilletDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_Fillet2dDriver::GetID(), new GEOMImpl_Fillet2dDriver());
TFunction_DriverTable::Get()->AddDriver(GEOMImpl_ArchimedeDriver::GetID(), new GEOMImpl_ArchimedeDriver());
// Geometrical Transformations, Offset, Scale

View File

@ -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 <TColStd_HArray1OfReal.hxx>
#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;
};

View File

@ -23,6 +23,8 @@
#include <GEOMImpl_ICurvesOperations.hxx>
#include <TColStd_HArray1OfReal.hxx>
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
@ -34,6 +36,7 @@
#include <GEOMImpl_EllipseDriver.hxx>
#include <GEOMImpl_ArcDriver.hxx>
#include <GEOMImpl_SketcherDriver.hxx>
#include <GEOMImpl_3DSketcherDriver.hxx>
#include <GEOMImpl_IPolyline.hxx>
#include <GEOMImpl_ICircle.hxx>
@ -41,6 +44,7 @@
#include <GEOMImpl_IEllipse.hxx>
#include <GEOMImpl_IArc.hxx>
#include <GEOMImpl_ISketcher.hxx>
#include <GEOMImpl_I3DSketcher.hxx>
#include "utilities.h"
@ -511,6 +515,67 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcCenter (Handle(GEOM_Objec
return anArc;
}
//=============================================================================
/*!
* MakeArcOfEllipse
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeArcOfEllipse (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2,
Handle(GEOM_Object) thePnt3)
{
SetErrorCode(KO);
if (thePnt1.IsNull() || thePnt2.IsNull() || thePnt3.IsNull()) return NULL;
//Add a new Circle Arc object
Handle(GEOM_Object) anArc = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE_ARC);
//Add a new Circle Arc function
Handle(GEOM_Function) aFunction =
anArc->AddFunction(GEOMImpl_ArcDriver::GetID(), ELLIPSE_ARC_CENTER_TWO_PNT);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_ArcDriver::GetID()) return NULL;
GEOMImpl_IArc aCI (aFunction);
Handle(GEOM_Function) aRefPnt1 = thePnt1->GetLastFunction();
Handle(GEOM_Function) aRefPnt2 = thePnt2->GetLastFunction();
Handle(GEOM_Function) aRefPnt3 = thePnt3->GetLastFunction();
if (aRefPnt1.IsNull() || aRefPnt2.IsNull() || aRefPnt3.IsNull()) return NULL;
aCI.SetPoint1(aRefPnt1);
aCI.SetPoint2(aRefPnt2);
aCI.SetPoint3(aRefPnt3);
//Compute the Arc value
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Arc 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(aFunction) << anArc << " = geompy.MakeArcOfEllipse("
<< thePnt1 << ", " << thePnt2 << ", " << thePnt3 << ")";
SetErrorCode(OK);
return anArc;
}
//=============================================================================
/*!
* MakeSplineBezier
@ -709,6 +774,73 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeSketcher (const char* theCom
return aSketcher;
}
//=============================================================================
/*!
* Make3DSketcher
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ICurvesOperations::Make3DSketcher (list<double> 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<double>::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

View File

@ -62,11 +62,16 @@ class GEOMImpl_ICurvesOperations : public GEOM_IOperations {
Handle(GEOM_Object) thePnt3,
bool theSense);
Standard_EXPORT Handle(GEOM_Object) MakeArcOfEllipse (Handle(GEOM_Object) thePnt1,
Handle(GEOM_Object) thePnt2,
Handle(GEOM_Object) thePnt3);
Standard_EXPORT Handle(GEOM_Object) MakeSplineBezier (list<Handle(GEOM_Object)> thePoints);
Standard_EXPORT Handle(GEOM_Object) MakeSplineInterpolation (list<Handle(GEOM_Object)> thePoints);
Standard_EXPORT Handle(GEOM_Object) MakeSketcher (const char* theCommand,
list<double> theWorkingPlane);
Standard_EXPORT Handle(GEOM_Object) Make3DSketcher (list<double> theCoordinates);
Standard_EXPORT Handle(GEOM_Object) MakeSketcherOnPlane (const char* theCommand,
Handle(GEOM_Object) theWorkingPlane);
};

View File

@ -0,0 +1,51 @@
// 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 Fillet2d and creation.
#include "GEOM_Function.hxx"
#define FILLET2D_ARG_SH 1
#define FILLET2D_ARG_R 2
#define FILLET2D_ARG_LENG 3
#define FILLET2D_ARG_LAST 4
class GEOMImpl_IFillet2d
{
public:
GEOMImpl_IFillet2d(Handle(GEOM_Function) theFunction): _func(theFunction) {}
void SetShape(Handle(GEOM_Function) theRef) { _func->SetReference(FILLET2D_ARG_SH, theRef); }
Handle(GEOM_Function) GetShape() { return _func->GetReference(FILLET2D_ARG_SH); }
void SetR(double theR) { _func->SetReal(FILLET2D_ARG_R, theR); }
void SetLength(int theLen) { _func->SetInteger(FILLET2D_ARG_LENG, theLen); }
void SetVertex(int theInd, int theVertex)
{ _func->SetInteger(FILLET2D_ARG_LAST + theInd, theVertex); }
double GetR() { return _func->GetReal(FILLET2D_ARG_R); }
int GetLength() { return _func->GetInteger(FILLET2D_ARG_LENG); }
int GetVertex(int theInd) { return _func->GetInteger(FILLET2D_ARG_LAST + theInd); }
private:
Handle(GEOM_Function) _func;
};

View File

@ -29,9 +29,11 @@
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_FilletDriver.hxx>
#include <GEOMImpl_Fillet2dDriver.hxx>
#include <GEOMImpl_ChamferDriver.hxx>
#include <GEOMImpl_IFillet.hxx>
#include <GEOMImpl_IFillet2d.hxx>
#include <GEOMImpl_IChamfer.hxx>
#include <GEOMImpl_IArchimede.hxx>
@ -410,6 +412,75 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFilletFacesR1R2
return aFillet;
}
//=============================================================================
/*!
* MakeFillet2D
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeFillet2D
(Handle(GEOM_Object) theShape, double theR, std::list<int> theVertexes)
{
SetErrorCode(KO);
//Add a new Fillet object
Handle(GEOM_Object) aFillet2D = GetEngine()->AddObject(GetDocID(), GEOM_FILLET_2D);
//Add a new Fillet function
Handle(GEOM_Function) aFunction =
aFillet2D->AddFunction(GEOMImpl_Fillet2dDriver::GetID(), FILLET_2D_SHAPE_VERTEXES);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_Fillet2dDriver::GetID()) return NULL;
GEOMImpl_IFillet2d aCI (aFunction);
Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
if (aRefShape.IsNull()) return NULL;
aCI.SetShape(aRefShape);
aCI.SetR(theR);
int aLen = theVertexes.size();
aCI.SetLength(aLen);
int ind = 1;
std::list<int>::iterator it = theVertexes.begin();
for (; it != theVertexes.end(); it++, ind++) {
aCI.SetVertex(ind, (*it));
}
//Compute the Fillet value
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("2D Fillet 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 << aFillet2D << " = geompy.MakeFillet2D(" << theShape
<< ", " << theR << ", [";
it = theVertexes.begin();
pd << (*it++);
while (it != theVertexes.end()) {
pd << ", " << (*it++);
}
pd << "])";
SetErrorCode(OK);
return aFillet2D;
}
//=============================================================================
/*!
* MakeChamferAll

View File

@ -46,6 +46,8 @@ class GEOMImpl_ILocalOperations : public GEOM_IOperations {
Standard_EXPORT Handle(GEOM_Object) MakeFilletFacesR1R2 (Handle(GEOM_Object) theShape,
double theR1, double theR2,
std::list<int> theFaces);
Standard_EXPORT Handle(GEOM_Object) MakeFillet2D (Handle(GEOM_Object) theShape, double theR,
std::list<int> theVertexes);
Standard_EXPORT Handle(GEOM_Object) MakeChamferAll (Handle(GEOM_Object) theShape, double theD);
Standard_EXPORT Handle(GEOM_Object) MakeChamferEdge (Handle(GEOM_Object) theShape,

View File

@ -23,9 +23,12 @@
//
#include "GEOM_Function.hxx"
#define POSITION_ARG_SHAPE 1
#define POSITION_ARG_SHAPE 1
#define POSITION_ARG_START_LCS 2
#define POSITION_ARG_END_LCS 3
#define POSITION_ARG_END_LCS 3
#define POSITION_ARG_PATH 5
#define POSITION_ARG_DISTANCE 6
#define POSITION_ARG_REVERSE 7
class GEOMImpl_IPosition
{
@ -47,6 +50,17 @@ class GEOMImpl_IPosition
Handle(GEOM_Function) GetEndLCS() { return _func->GetReference(POSITION_ARG_END_LCS); }
void SetPath(Handle(GEOM_Function) thePath) { _func->SetReference(POSITION_ARG_PATH, thePath); }
Handle(GEOM_Function) GetPath() { return _func->GetReference(POSITION_ARG_PATH); }
void SetDistance(double theDistance) { _func->SetReal(POSITION_ARG_DISTANCE, theDistance); }
double GetDistance() { return _func->GetReal(POSITION_ARG_DISTANCE); }
void SetReverse(bool theReverse) { _func->SetReal(POSITION_ARG_REVERSE, theReverse); }
bool GetReverse() { return _func->GetReal(POSITION_ARG_REVERSE); }
private:
Handle(GEOM_Function) _func;

View File

@ -1336,6 +1336,75 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionShapeCopy
return aCopy;
}
//=============================================================================
/*!
* PositionAlongPath
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_ITransformOperations::PositionAlongPath
(Handle(GEOM_Object) theObject, Handle(GEOM_Object) thePath,
double theDistance, bool theCopy, bool theReverse)
{
SetErrorCode(KO);
if (theObject.IsNull() || thePath.IsNull()) return NULL;
Handle(GEOM_Function) anOriginal = theObject->GetLastFunction();
if (anOriginal.IsNull()) return NULL; //There is no function which creates an object to be set in position
//Add a position function
Handle(GEOM_Function) aFunction;
Handle(GEOM_Object) aCopy;
if (theCopy) {
aCopy = GetEngine()->AddObject(GetDocID(), theObject->GetType());
aFunction = aCopy->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
}
else
aFunction = theObject->AddFunction(GEOMImpl_PositionDriver::GetID(), POSITION_ALONG_PATH);
if (aFunction.IsNull()) return NULL;
//Check if the function is set correctly
if (aFunction->GetDriverGUID() != GEOMImpl_PositionDriver::GetID()) return NULL;
GEOMImpl_IPosition aTI (aFunction);
aTI.SetShape(anOriginal);
aTI.SetPath(thePath->GetLastFunction());
aTI.SetDistance(theDistance);
aTI.SetReverse(theReverse);
//Compute the position
try {
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
if (!GetSolver()->ComputeFunction(aFunction)) {
SetErrorCode("Position driver failed");
return NULL;
}
}
catch (Standard_Failure) {
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
SetErrorCode(aFail->GetMessageString());
return NULL;
}
//Make a Python command
if (theCopy) {
GEOM::TPythonDump(aFunction) << aCopy << " = geompy.PositionAlongPath("
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
SetErrorCode(OK);
return aCopy;
}
GEOM::TPythonDump(aFunction) << "geompy.TrsfOp.PositionAlongPath("
<< theObject << ", " << thePath << ", " << theDistance << ", " << theCopy << ", " << theReverse << ")";
SetErrorCode(OK);
return theObject;
}
//=============================================================================
/*!
* Rotate

View File

@ -119,6 +119,12 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations
Handle(GEOM_Object) theStartLCS,
Handle(GEOM_Object) theEndLCS);
Standard_EXPORT Handle(GEOM_Object) PositionAlongPath (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) thePath,
double theDistance,
bool theCopy,
bool theReverse);
Standard_EXPORT Handle(GEOM_Object) Rotate (Handle(GEOM_Object) theObject,
Handle(GEOM_Object) theAxis,
double theAngle);

View File

@ -30,19 +30,33 @@
// OCCT Includes
#include <BRepBuilderAPI_Transform.hxx>
#include <GCPnts_AbscissaPoint.hxx>
#include <ShHealOper_EdgeDivide.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Wire.hxx>
#include <TopAbs.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <gp_Pln.hxx>
#include <Geom_Plane.hxx>
#include <Geom_Curve.hxx>
#include <GProp_GProps.hxx>
#include <BRepGProp.hxx>
#include <ShapeAnalysis_Edge.hxx>
#include <GeomAdaptor_Curve.hxx>
#include <BRepGProp.hxx>
#include <ShapeFix_Wire.hxx>
#include <Precision.hxx>
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <TopExp.hxx>
//=======================================================================
//function : GetID
@ -131,6 +145,183 @@ Standard_Integer GEOMImpl_PositionDriver::Execute(TFunction_Logbook& log) const
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
aShape = aBRepTrsf.Shape();
}
else if (aType == POSITION_ALONG_PATH) {
Handle(GEOM_Function) aRefShape = aCI.GetShape();
Handle(GEOM_Function) aPathShape = aCI.GetPath();
double aValue = aCI.GetDistance();
bool aReversed = aCI.GetReverse();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
TopoDS_Shape aPath = aPathShape->GetValue();
if (aShapeBase.IsNull() || aPath.IsNull())
return 0;
//Get a Center Of Mass Of Base Object
GProp_GProps aSystem;
gp_Pnt aCenterMass;
if (aShapeBase.ShapeType() == TopAbs_VERTEX) {
aCenterMass = BRep_Tool::Pnt(TopoDS::Vertex(aShapeBase));
} else if (aShapeBase.ShapeType() == TopAbs_EDGE || aShapeBase.ShapeType() == TopAbs_WIRE) {
BRepGProp::LinearProperties(aShapeBase, aSystem);
aCenterMass = aSystem.CentreOfMass();
} else if (aShapeBase.ShapeType() == TopAbs_FACE || aShapeBase.ShapeType() == TopAbs_SHELL) {
BRepGProp::SurfaceProperties(aShapeBase, aSystem);
aCenterMass = aSystem.CentreOfMass();
} else {
BRepGProp::VolumeProperties(aShapeBase, aSystem);
aCenterMass = aSystem.CentreOfMass();
}
TopoDS_Shape aTrimmedPath;
gp_Trsf aTrsf;
Handle(Geom_Curve) aCurve;
Standard_Real aFirst =0.,aLast=0.;
Standard_Real aParam = 0.;
Standard_Real aLength = 0.;
gp_Pnt aPFirst, aPLast;
if ( aPath.ShapeType() == TopAbs_EDGE ) { // The Path is Edge
TopoDS_Edge anEdge = TopoDS::Edge(aPath);
BRep_Tool::Range(anEdge,aFirst,aLast);
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
if (aReversed)
aCurve = aCurve->Reversed();
aCurve->D0(aFirst, aPFirst);
aCurve->D0(aLast, aPLast);
// Translate a CenterMass of Base Shape to the start of the path
if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
gp_Trsf aCurTrsf;
aCurTrsf.SetTranslation(aCenterMass, aPFirst);
aTrsf.PreMultiply(aCurTrsf);
}
aParam = aFirst + aValue*(aLast - aFirst); // Calculate parameter
} else if ( aPath.ShapeType() == TopAbs_WIRE ) { // The path Shape is Wire
TopoDS_Wire aWire = TopoDS::Wire(aPath);
// fix edges order
Handle(ShapeFix_Wire) aFixWire = new ShapeFix_Wire;
aFixWire->Load(aWire);
aFixWire->FixReorder();
aWire = aFixWire->Wire();
TopExp_Explorer ex;
TopTools_SequenceOfShape Edges;
Standard_Real nbEdges = 0.;
BRepTools_WireExplorer aWE (aWire);
for (; aWE.More(); aWE.Next(), nbEdges++) // Explore a Wire on Edges
Edges.Append(aWE.Current());
Standard_Real aSummOfLen =0.;
Standard_Real aCurLen =0.;
GeomAdaptor_Curve aAdC;
for(int i=1; i<=Edges.Length(); i++) { // Calculate summary Lenght of edges
TopoDS_Edge anEdge = TopoDS::Edge(Edges.Value(i));
BRep_Tool::Range(anEdge,aFirst,aLast);
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
aAdC.Load(aCurve,aFirst,aLast);
aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast);
aSummOfLen += aCurLen;
}
// Move BaseShape to the Start Of the Curve
TopoDS_Edge anEdge;
if (!aReversed)
anEdge = TopoDS::Edge(Edges.Value(1));
else
anEdge = TopoDS::Edge(Edges.Value(Edges.Length()));
BRep_Tool::Range(anEdge,aFirst,aLast);
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
aCurve->D0(aFirst, aPFirst);
aCurve->D0(aLast, aPLast);
if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
gp_Trsf aCurTrsf;
if (aReversed && anEdge.Orientation() == TopAbs_FORWARD)
aPFirst = aPLast;
aCurTrsf.SetTranslation(aCenterMass, aPFirst);
aTrsf.PreMultiply(aCurTrsf);
}
Standard_Real aWireLen = aSummOfLen*aValue;
aSummOfLen = 0;
for(int i=1; i<=Edges.Length(); i++) {
TopoDS_Edge anEdge;
if (!aReversed)
anEdge = TopoDS::Edge(Edges.Value(i));
else
anEdge = TopoDS::Edge(Edges.Value(Edges.Length() - i + 1));
aCurve = BRep_Tool::Curve(anEdge,aFirst,aLast);
BRep_Tool::Range(anEdge,aFirst,aLast);
if (!aReversed && anEdge.Orientation() == TopAbs_REVERSED)
aCurve = aCurve->Reversed();
if (aReversed && anEdge.Orientation() == TopAbs_FORWARD)
aCurve = aCurve->Reversed();
aAdC.Load(aCurve,aFirst,aLast);
aCurLen = GCPnts_AbscissaPoint::Length(aAdC,aFirst,aLast);
if ( aWireLen > (aSummOfLen + aCurLen) ) { // Transform a Base object along this Edge
aSummOfLen += aCurLen;
gp_Pnt aP1, aP2;
gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2;
aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 );
aCurve->D2(aLast, aP2, aDestVec1, aDestVec2 );
gp_Trsf aCurTrsf;
if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) {
gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2);
gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2);
aCurTrsf.SetDisplacement(aStartAx3, aDestAx3);
} else
aCurTrsf.SetTranslation(aP1, aP2);
aTrsf.PreMultiply(aCurTrsf);
}
else {
aLength = aWireLen - aSummOfLen;
GCPnts_AbscissaPoint anAbsc(aAdC,aLength,aFirst);
if(anAbsc.IsDone())
aParam = anAbsc.Parameter();
break;
}
}
} else
return 0; // Unknown Type
gp_Trsf aCurTrsf;
gp_Pnt aP1, aP2;
gp_Vec aStartVec1, aStartVec2, aDestVec1, aDestVec2;
aCurve->D2(aFirst, aP1, aStartVec1, aStartVec2 );
aCurve->D2(aParam, aP2, aDestVec1, aDestVec2 );
if (aStartVec2.Magnitude() > gp::Resolution() && aDestVec2.Magnitude() > gp::Resolution()) {
gp_Ax3 aStartAx3(aP1, aStartVec1, aStartVec2);
gp_Ax3 aDestAx3(aP2, aDestVec1, aDestVec2);
aCurTrsf.SetDisplacement(aStartAx3, aDestAx3);
} else
aCurTrsf.SetTranslation(aP1, aP2);
aTrsf.PreMultiply(aCurTrsf);
if ( !aPFirst.IsEqual(aCenterMass, gp::Resolution()) ) {
gp_Trsf aCurTrsf;
aCurTrsf.SetTranslation(aPFirst, aCenterMass);
aTrsf.PreMultiply(aCurTrsf);
}
// Perform transformation
BRepBuilderAPI_Transform aBRepTrsf (aShapeBase, aTrsf, Standard_False);
aShape = aBRepTrsf.Shape();
}
else
return 0;

View File

@ -47,8 +47,9 @@
#define GEOM_ELLIPSE 18
#define GEOM_CIRC_ARC 19
#define GEOM_FILLET 20
#define GEOM_CHAMFER 21
#define GEOM_FILLET 20
#define GEOM_FILLET_2D 45
#define GEOM_CHAMFER 21
#define GEOM_EDGE 22
#define GEOM_WIRE 23
@ -87,6 +88,9 @@
#define GEOM_SHAPES_ON_SHAPE 42
#define GEOM_ELLIPSE_ARC 43
#define GEOM_3DSKETCHER 44
//GEOM_Function types
@ -153,6 +157,7 @@
#define POSITION_SHAPE_COPY 2
#define POSITION_SHAPE_FROM_GLOBAL 3
#define POSITION_SHAPE_FROM_GLOBAL_COPY 4
#define POSITION_ALONG_PATH 5
#define TORUS_RR 1
#define TORUS_PNT_VEC_RR 2
@ -215,8 +220,9 @@
#define ELLIPSE_PNT_VEC_RR 1
#define CIRC_ARC_THREE_PNT 1
#define CIRC_ARC_CENTER 2
#define CIRC_ARC_THREE_PNT 1
#define CIRC_ARC_CENTER 2
#define ELLIPSE_ARC_CENTER_TWO_PNT 3
#define FILLET_SHAPE_ALL 1
#define FILLET_SHAPE_EDGES 2
@ -224,6 +230,8 @@
#define FILLET_SHAPE_EDGES_2R 4
#define FILLET_SHAPE_FACES_2R 5
#define FILLET_2D_SHAPE_VERTEXES 1
#define CHAMFER_SHAPE_ALL 1
#define CHAMFER_SHAPE_EDGE 2
#define CHAMFER_SHAPE_FACES 3

View File

@ -56,11 +56,13 @@ salomeinclude_HEADERS = \
GEOMImpl_ISpline.hxx \
GEOMImpl_IEllipse.hxx \
GEOMImpl_IFillet.hxx \
GEOMImpl_IFillet2d.hxx \
GEOMImpl_IChamfer.hxx \
GEOMImpl_ICopy.hxx \
GEOMImpl_IArchimede.hxx \
GEOMImpl_IArc.hxx \
GEOMImpl_ISketcher.hxx \
GEOMImpl_I3DSketcher.hxx \
GEOMImpl_IVector.hxx \
GEOMImpl_IDisk.hxx \
GEOMImpl_IFace.hxx \
@ -124,7 +126,9 @@ salomeinclude_HEADERS = \
GEOMImpl_ArcDriver.hxx \
GEOMImpl_SplineDriver.hxx \
GEOMImpl_SketcherDriver.hxx \
GEOMImpl_3DSketcherDriver.hxx \
GEOMImpl_FilletDriver.hxx \
GEOMImpl_Fillet2dDriver.hxx \
GEOMImpl_ChamferDriver.hxx \
GEOMImpl_BooleanDriver.hxx \
GEOMImpl_PartitionDriver.hxx \
@ -185,7 +189,9 @@ dist_libGEOMimpl_la_SOURCES = \
GEOMImpl_ArcDriver.cxx \
GEOMImpl_SplineDriver.cxx \
GEOMImpl_SketcherDriver.cxx \
GEOMImpl_3DSketcherDriver.cxx \
GEOMImpl_FilletDriver.cxx \
GEOMImpl_Fillet2dDriver.cxx \
GEOMImpl_ChamferDriver.cxx \
GEOMImpl_BooleanDriver.cxx \
GEOMImpl_PartitionDriver.cxx \

View File

@ -161,7 +161,6 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
Unexpect aCatch(SALOME_SalomeException);
SALOMEDS::SObject_var aResultSO;
if(CORBA::is_nil(theObject) || theStudy->_is_nil()) return aResultSO;
GEOM::GEOM_Object_var aShape = GEOM::GEOM_Object::_narrow(theObject);
if(aShape->_is_nil()) return aResultSO;
@ -1308,6 +1307,157 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::GetObject (CORBA::Long theStudyID, const char*
return obj._retn();
}
//=================================================================================
// function : hasObjectInfo()
// purpose : shows if module provides information for its objects
//=================================================================================
bool GEOM_Gen_i::hasObjectInfo()
{
return true;
}
//=================================================================================
// function : getObjectInfo()
// purpose : returns an information for a given object by its entry
//=================================================================================
char* GEOM_Gen_i::getObjectInfo(CORBA::Long studyId, const char* entry)
{
GEOM::GEOM_Object_var aGeomObject;
CORBA::Object_var aSMObject = name_service->Resolve( "/myStudyManager" );
SALOMEDS::StudyManager_var aStudyManager = SALOMEDS::StudyManager::_narrow( aSMObject );
SALOMEDS::Study_var aStudy = aStudyManager->GetStudyByID( studyId );
SALOMEDS::SObject_var aSObj = aStudy->FindObjectID( entry );
SALOMEDS::SObject_var aResultSObj;
if (aSObj->ReferencedObject(aResultSObj))
aSObj = aResultSObj;
SALOMEDS::GenericAttribute_var anAttr;
if (!aSObj->_is_nil() && aSObj->FindAttribute(anAttr, "AttributeIOR")) {
SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
CORBA::String_var aVal = anIOR->Value();
CORBA::Object_var anObject = aStudy->ConvertIORToObject(aVal);
aGeomObject = GEOM::GEOM_Object::_narrow(anObject);
}
char* aTypeInfo = "Object";
if ( !aGeomObject->_is_nil() ) {
GEOM::GEOM_IKindOfShape::shape_kind aKind;
GEOM::ListOfLong_var anInts;
GEOM::ListOfDouble_var aDbls;
GEOM::GEOM_IMeasureOperations_var anOp = GetIMeasureOperations( studyId );
aKind = anOp->KindOfShape( aGeomObject, anInts, aDbls );
if ( anOp->IsDone() ) {
switch ( aKind ) {
case GEOM::GEOM_IKindOfShape::COMPOUND:
aTypeInfo = "Compound";
break;
case GEOM::GEOM_IKindOfShape::COMPSOLID:
aTypeInfo = "CompSolid";
break;
case GEOM::GEOM_IKindOfShape::SHELL:
aTypeInfo = "Shell";
break;
case GEOM::GEOM_IKindOfShape::WIRE:
if ( anInts[0] == 1 )
aTypeInfo = "Closed Wire";
else if ( anInts[0] == 2 )
aTypeInfo = "Opened Wire";
else
aTypeInfo = "Wire";
break;
// SOLIDs
case GEOM::GEOM_IKindOfShape::SPHERE:
aTypeInfo = "Sphere";
break;
case GEOM::GEOM_IKindOfShape::CYLINDER:
aTypeInfo = "Cylinder";
break;
case GEOM::GEOM_IKindOfShape::BOX:
case GEOM::GEOM_IKindOfShape::ROTATED_BOX:
aTypeInfo = "Box";
break;
case GEOM::GEOM_IKindOfShape::TORUS:
aTypeInfo = "Torus";
break;
case GEOM::GEOM_IKindOfShape::CONE:
aTypeInfo = "Cone";
break;
case GEOM::GEOM_IKindOfShape::POLYHEDRON:
aTypeInfo = "Polyhedron";
break;
case GEOM::GEOM_IKindOfShape::SOLID:
aTypeInfo = "Solid";
break;
// FACEs
case GEOM::GEOM_IKindOfShape::SPHERE2D:
aTypeInfo = "Spherical Face";
break;
case GEOM::GEOM_IKindOfShape::CYLINDER2D:
aTypeInfo = "Cylindrical Face";
break;
case GEOM::GEOM_IKindOfShape::TORUS2D:
aTypeInfo = "Toroidal Face";
break;
case GEOM::GEOM_IKindOfShape::CONE2D:
aTypeInfo = "Conical Face";
break;
case GEOM::GEOM_IKindOfShape::DISK_CIRCLE:
aTypeInfo = "Disk";
break;
case GEOM::GEOM_IKindOfShape::DISK_ELLIPSE:
aTypeInfo = "Elliptical Face";
break;
case GEOM::GEOM_IKindOfShape::POLYGON:
aTypeInfo = "Polygon";
break;
case GEOM::GEOM_IKindOfShape::PLANE:
aTypeInfo = "Plane";
break;
case GEOM::GEOM_IKindOfShape::PLANAR:
aTypeInfo = "Planar Face";
break;
case GEOM::GEOM_IKindOfShape::FACE:
aTypeInfo = "Face";
break;
// EDGEs
case GEOM::GEOM_IKindOfShape::CIRCLE:
aTypeInfo = "Circle";
break;
case GEOM::GEOM_IKindOfShape::ARC_CIRCLE:
aTypeInfo = "Ark";
break;
case GEOM::GEOM_IKindOfShape::ELLIPSE:
aTypeInfo = "Ellipse";
break;
case GEOM::GEOM_IKindOfShape::ARC_ELLIPSE:
aTypeInfo = "Arc Ellipse";
break;
case GEOM::GEOM_IKindOfShape::LINE:
aTypeInfo = "Line";
break;
case GEOM::GEOM_IKindOfShape::SEGMENT:
aTypeInfo = "Segment";
break;
case GEOM::GEOM_IKindOfShape::EDGE:
aTypeInfo = "Edge";
break;
case GEOM::GEOM_IKindOfShape::VERTEX:
aTypeInfo = "Vertex";
break;
default:
break;
}
}
}
char anInfo [strlen("Module ") + strlen(ComponentDataType()) + strlen(", ") + strlen(aTypeInfo)];
sprintf(anInfo, "Module %s, %s", ComponentDataType(), aTypeInfo);
return CORBA::string_dup(anInfo);
}
//=====================================================================================
// EXPORTED METHODS

View File

@ -232,7 +232,11 @@ class GEOM_I_EXPORT GEOM_Gen_i: virtual public POA_GEOM::GEOM_Gen, virtual publi
char* GetDumpName (const char* theStudyEntry);
GEOM::string_array* GetAllDumpNames();
// Object information
virtual bool hasObjectInfo();
virtual char* getObjectInfo(CORBA::Long studyId, const char* entry);
//-----------------------------------------------------------------------//
// Internal methods //
//-----------------------------------------------------------------------//

View File

@ -275,6 +275,43 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcCenter
return GetObject(anObject);
}
//=============================================================================
/*!
* MakeArc
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeArcOfEllipse
(GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
if (thePnt1 == NULL || thePnt2 == NULL || thePnt3 == NULL) return aGEOMObject._retn();
//Get the reference points
Handle(GEOM_Object) aPnt1 = GetOperations()->GetEngine()->GetObject
(thePnt1->GetStudyID(), thePnt1->GetEntry());
Handle(GEOM_Object) aPnt2 = GetOperations()->GetEngine()->GetObject
(thePnt2->GetStudyID(), thePnt2->GetEntry());
Handle(GEOM_Object) aPnt3 = GetOperations()->GetEngine()->GetObject
(thePnt3->GetStudyID(), thePnt3->GetEntry());
if (aPnt1.IsNull() || aPnt2.IsNull() || aPnt3.IsNull()) return aGEOMObject._retn();
// Make Arc
Handle(GEOM_Object) anObject =
GetOperations()->MakeArcOfEllipse(aPnt1, aPnt2, aPnt3);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MakePolyline
@ -409,6 +446,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<double> 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);
}
//=============================================================================
/*!

View File

@ -65,6 +65,10 @@ class GEOM_I_EXPORT GEOM_ICurvesOperations_i :
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3,
bool theSense);
GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3);
GEOM::GEOM_Object_ptr MakePolyline (const GEOM::ListOfGO& thePoints);
@ -73,6 +77,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);

View File

@ -221,6 +221,41 @@ GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFilletFacesR1R2
return GetObject(anObject);
}
//=============================================================================
/*!
* MakeFillet2D
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ILocalOperations_i::MakeFillet2D
(GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
const GEOM::ListOfLong& theVertexes)
{
GEOM::GEOM_Object_var aGEOMObject;
if (theShape == NULL) return aGEOMObject._retn();
//Get the reference shape
Handle(GEOM_Object) aShapeRef = GetOperations()->GetEngine()->GetObject
(theShape->GetStudyID(), theShape->GetEntry());
if (aShapeRef.IsNull()) return aGEOMObject._retn();
//Get the reference vertex
int ind = 0;
int aLen = theVertexes.length();
list<int> aVertexes;
for (; ind < aLen; ind++) {
aVertexes.push_back(theVertexes[ind]);
}
//Create the Fillet
Handle(GEOM_Object) anObject =
GetOperations()->MakeFillet2D(aShapeRef, theR, aVertexes);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MakeChamferAll

View File

@ -59,6 +59,9 @@ class GEOM_I_EXPORT GEOM_ILocalOperations_i :
CORBA::Double theR1,
CORBA::Double theR2,
const GEOM::ListOfLong& theFaces);
GEOM::GEOM_Object_ptr MakeFillet2D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
const GEOM::ListOfLong& theVertexes);
GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD);

View File

@ -989,6 +989,47 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionShapeCopy
return GetObject(anObject);
}
//=============================================================================
/*!
* PositionAlongPath
*/
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::PositionAlongPath
(GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
CORBA::Boolean theCopy,
CORBA::Boolean theReverse)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
GetOperations()->SetNotDone();
if (theObject == NULL || thePath == NULL)
return aGEOMObject._retn();
//Get the basic object
CORBA::String_var anEntry = theObject->GetEntry();
Handle(GEOM_Object) aBasicObject =
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), anEntry);
if (aBasicObject.IsNull()) return aGEOMObject._retn();
//Get the path object
CORBA::String_var aPathEntry = thePath->GetEntry();
Handle(GEOM_Object) aPathObject =
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), aPathEntry);
if (aPathObject.IsNull()) return aGEOMObject._retn();
//Perform the position
Handle(GEOM_Object) anObject =
GetOperations()->PositionAlongPath(aBasicObject, aPathObject, theDistance, theCopy, theReverse);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
return GetObject(anObject);
}
//=============================================================================
/*!
* MultiTranslate1D

View File

@ -142,6 +142,12 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
GEOM::GEOM_Object_ptr theStartLCS,
GEOM::GEOM_Object_ptr theEndLCS);
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
CORBA::Boolean theCopy,
CORBA::Boolean theReverse);
GEOM::GEOM_Object_ptr RotateThreePoints (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theCentPoint,
GEOM::GEOM_Object_ptr thePoint1,

View File

@ -1821,6 +1821,23 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionShapeCopy (GEOM::GEOM_Object_ptr th
return anObj;
}
//=============================================================================
// PositionAlongPath:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
CORBA::Boolean theCopy,
CORBA::Boolean theReverse)
{
beginService( " GEOM_Superv_i::PositionAlongPath" );
MESSAGE("GEOM_Superv_i::PositionAlongPath");
getTransfOp();
GEOM::GEOM_Object_ptr anObj = myTransfOp->PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse);
endService( " GEOM_Superv_i::PositionAlongPath" );
return anObj;
}
//=============================== ShapesOperations ============================
//=============================================================================
// Make:
@ -2546,6 +2563,21 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcCenter (GEOM::GEOM_Object_ptr theCen
return anObj;
}
//=============================================================================
// MakeArcOfEllipse:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3)
{
beginService( " GEOM_Superv_i::MakeArcOfEllipse" );
MESSAGE("GEOM_Superv_i::MakeArcOfEllipse");
getCurvesOp();
GEOM::GEOM_Object_ptr anObj = myCurvesOp->MakeArcOfEllipse(thePnt1, thePnt2, thePnt3);
endService( " GEOM_Superv_i::MakeArcOfEllipse" );
return anObj;
}
//=============================================================================
// MakePolyline:
//=============================================================================
@ -2619,6 +2651,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<GEOM::ListOfDouble>* aListImpl =
dynamic_cast<GEOM_List_i<GEOM::ListOfDouble>*>(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:
@ -2718,6 +2768,26 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr
return NULL;
}
//=============================================================================
// MakeFillet2D:
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeFillet2D (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theR,
GEOM::GEOM_List_ptr theVertexes)
{
beginService( " GEOM_Superv_i::MakeFillet2D" );
MESSAGE("GEOM_Superv_i::MakeFillet2D");
if (GEOM_List_i<GEOM::ListOfLong>* aListImplV =
dynamic_cast<GEOM_List_i<GEOM::ListOfLong>*>(GetServant(theVertexes, myPOA).in())) {
getLocalOp();
GEOM::GEOM_Object_ptr anObj = myLocalOp->MakeFillet2D(theShape, theR, aListImplV->GetList());
endService( " GEOM_Superv_i::MakeFillet2D" );
return anObj;
}
endService( " GEOM_Superv_i::MakeFillet2D" );
return NULL;
}
//=============================================================================
// MakeChamferAll:
//=============================================================================

View File

@ -421,6 +421,11 @@ public:
GEOM::GEOM_Object_ptr PositionShapeCopy (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr theStartLCS,
GEOM::GEOM_Object_ptr theEndLCS);
GEOM::GEOM_Object_ptr PositionAlongPath (GEOM::GEOM_Object_ptr theObject,
GEOM::GEOM_Object_ptr thePath,
CORBA::Double theDistance,
CORBA::Boolean theCopy,
CORBA::Boolean theReverse);
//-----------------------------------------------------------//
// ShapesOperations //
@ -559,11 +564,15 @@ public:
GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
CORBA::Boolean theSense);
GEOM::GEOM_Object_ptr MakeArcOfEllipse (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2,
GEOM::GEOM_Object_ptr thePnt3);
GEOM::GEOM_Object_ptr MakePolyline (GEOM::GEOM_List_ptr thePoints);
GEOM::GEOM_Object_ptr MakeSplineBezier (GEOM::GEOM_List_ptr thePoints);
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 //
@ -578,6 +587,8 @@ public:
GEOM::GEOM_List_ptr theFaces);
GEOM::GEOM_Object_ptr MakeFilletFacesR1R2 (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR1,
CORBA::Double theR2, GEOM::GEOM_List_ptr theFaces);
GEOM::GEOM_Object_ptr MakeFillet2D (GEOM::GEOM_Object_ptr theShape, CORBA::Double theR,
GEOM::GEOM_List_ptr theVertexes);
GEOM::GEOM_Object_ptr MakeChamferAll (GEOM::GEOM_Object_ptr theShape, CORBA::Double theD);
GEOM::GEOM_Object_ptr MakeChamferEdge (GEOM::GEOM_Object_ptr theShape,
CORBA::Double theD1, CORBA::Double theD2,

View File

@ -0,0 +1,60 @@
# GEOM GEOM_SWIG : binding of C++ omplementaion with Python
#
# 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 : GEOM_ObjectInfo.py
# Author : Michael ZORIN
# Module : GEOM
# $Header:
import salome
import geompy
geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM")
# Create several objects
obj1 = geompy.MakeVertex(0.,0.,0.)
obj2 = geompy.MakeCircleR(150.)
obj3 = geompy.MakeBoxDXDYDZ(300.,400.,500.)
obj4 = geompy.MakeCylinderRH(100.,200.)
ShapeListCompound = []
ShapeListCompound.append(obj3)
ShapeListCompound.append(obj4)
obj5 = geompy.MakeCompound(ShapeListCompound)
obj1_entry = geompy.addToStudy(obj1, "Object1")
obj2_entry = geompy.addToStudy(obj2, "Object2")
obj3_entry = geompy.addToStudy(obj3, "Object3")
obj4_entry = geompy.addToStudy(obj4, "Object4")
obj5_entry = geompy.addToStudy(obj5, "Object5")
# Get information about objects
hasInfo = geom.hasObjectInfo()
print "Check if GEOM module provides information about its objects: ", hasInfo
if hasInfo == True:
print "Information about first object: ", geom.getObjectInfo(salome.myStudyId, obj1_entry)
print "Information about second object: ", geom.getObjectInfo(salome.myStudyId, obj2_entry)
print "Information about third object: ", geom.getObjectInfo(salome.myStudyId, obj3_entry)
print "Information about fourth object: ", geom.getObjectInfo(salome.myStudyId, obj4_entry)
print "Information about fifth object: ", geom.getObjectInfo(salome.myStudyId, obj5_entry)
salome.sg.updateObjBrowser(1)

View File

@ -23,7 +23,7 @@
# File : GEOM_usinggeom.py
# Author : Damien COQUERET, Open CASCADE
# Module : GEOM
# $Header$
#
# ! Please, if you edit this example file, update also
# ! GEOM_SRC/doc/salome/gui/GEOM/input/tui_test_all.doc
# ! as some sequences of symbols from this example are used during
@ -92,6 +92,7 @@ def TestAll (geompy, math):
Arc = geompy.MakeArc(py, pz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
Arc3 = geompy.MakeArcOfEllipse(p0, px, pz) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
@ -101,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
@ -205,6 +207,7 @@ def TestAll (geompy, math):
MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) #
MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) #
Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object_ptr, 1 Double, 2 Bool)->GEOM_Object_ptr
Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
Orientation = geompy.ChangeOrientation(Box)
@ -232,6 +235,7 @@ def TestAll (geompy, math):
IDlist_f = [f_ind_1, f_ind_2]
#Local operations
Fillet2d = geompy.MakeFillet2D(Face3, radius, [4, 7, 9]) #(GEOM_Object_ptr, Double, ListOfLong)->GEOM_Object_ptr
Fillet = geompy.MakeFillet (Prism, radius, ShapeTypeEdge,
IDlist_e) #(GEOM_Object_ptr, Double, Short, ListOfLong)->GEOM_Object_ptr
Fillet2 = geompy.MakeFilletR1R2 (Prism, 7., 13., ShapeTypeEdge,
@ -292,6 +296,8 @@ def TestAll (geompy, math):
id_Plane1 = geompy.addToStudy(Plane1, "Plane by 3 points")
id_Arc = geompy.addToStudy(Arc, "Arc")
id_Arc2 = geompy.addToStudy(Arc2, "Arc2")
id_Arc3 = geompy.addToStudy(Arc3, "Arc3")
id_Circle = geompy.addToStudy(Circle, "Circle")
id_Circle1 = geompy.addToStudy(Circle1, "Circle by 3 points")
id_Circle2 = geompy.addToStudy(Circle2, "Circle by center and 2 points")
@ -300,6 +306,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")
@ -369,11 +376,13 @@ def TestAll (geompy, math):
id_MirrorAxis = geompy.addToStudy(MirrorAxis, "Mirror by Axis")
id_MirrorPnt = geompy.addToStudy(MirrorPnt, "Mirror by Point")
id_Position = geompy.addToStudy(Position, "Positioned box")
id_Position2 = geompy.addToStudy(Position2, "Positioned box along path")
id_Offset = geompy.addToStudy(Offset, "Offset")
id_Orientation = geompy.addToStudy(Orientation, "Orientation")
id_Fillet = geompy.addToStudy(Fillet, "Fillet")
id_Fillet2 = geompy.addToStudy(Fillet2, "Fillet2")
id_Fillet2d = geompy.addToStudy(Fillet2d, "Fillet2D")
id_Chamfer = geompy.addToStudy(Chamfer, "Chamfer on Edge")
id_Chamfer2 = geompy.addToStudy(Chamfer2, "Chamfer on Faces")

View File

@ -24,7 +24,8 @@
# Author : Nicolas REJNERI, Paul RASCLE
# Modified by : Alexander BORODIN (OCN) - autotools usage
# Module : GEOM
# $Header$
# Libraries targets
#
include $(top_srcdir)/adm_local/unix/make_common_starter.am
@ -64,6 +65,7 @@ dist_salomescript_DATA = \
GEOM_tube_geom_gg2.py \
GEOM_Nut.py \
GEOM_Sketcher.py \
GEOM_ObjectInfo.py \
PAL_MESH_019_020_geometry.py \
PAL_MESH_028_geometry.py \
PAL_MESH_030_geometry.py \

View File

@ -23,8 +23,7 @@
# File : geompy.py
# Author : Paul RASCLE, EDF
# Module : GEOM
# $Header$
#
"""
\namespace geompy
\brief Module geompy
@ -491,6 +490,19 @@ class geompyDC(GEOM._objref_GEOM_Gen):
anObj = self.CurvesOp.MakeArcCenter(thePnt1, thePnt2, thePnt3, theSense)
RaiseIfFailed("MakeArcCenter", self.CurvesOp)
return anObj
## Create an arc of ellipse, of center and two points.
# @param theCenter Center of the arc.
# @param thePnt1 defines major radius of the arc by distance from Pnt1 to Pnt2.
# @param thePnt2 defines plane of ellipse and minor radius as distance from Pnt3 to line from Pnt1 to Pnt2.
# @return New GEOM_Object, containing the created arc.
#
# @ref swig_MakeArc "Example"
def MakeArcOfEllipse(self,theCenter, thePnt1, thePnt2):
# Example: see GEOM_TestAll.py
anObj = self.CurvesOp.MakeArcOfEllipse(theCenter, thePnt1, thePnt2)
RaiseIfFailed("MakeArcOfEllipse", self.CurvesOp)
return anObj
## Create a circle with given center, normal vector and radius.
# @param thePnt Circle center.
@ -656,6 +668,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 <VAR>theCoordinates</VAR> 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
## @}
@ -2217,6 +2241,21 @@ class geompyDC(GEOM._objref_GEOM_Gen):
RaiseIfFailed("PositionShapeCopy", self.TrsfOp)
return anObj
## Modify the Location of the given object by Path,
# @param theObject The object to be displaced.
# @param thePath Wire or Edge along that the object will be translated.
# @param theDistance progress of Path (0 = start location, 1 = end of path location).
# @param theCopy is to create a copy objects if true.
# @param theReverse - 0 for usual direction, 1 to reverse path direction.
# @return New GEOM_Object, containing the displaced shape.
#
# @ref tui_modify_location "Example"
def PositionAlongPath(self,theObject, thePath, theDistance, theCopy, theReverse):
# Example: see GEOM_TestAll.py
anObj = self.TrsfOp.PositionAlongPath(theObject, thePath, theDistance, theCopy, theReverse)
RaiseIfFailed("PositionAlongPath", self.TrsfOp)
return anObj
## Create new object as offset of the given one.
# @param theObject The base object for the offset.
# @param theOffset Offset value.
@ -2369,6 +2408,20 @@ class geompyDC(GEOM._objref_GEOM_Gen):
anObj = self.LocalOp.MakeFilletFacesR1R2(theShape, theR1, theR2, theListShapes)
RaiseIfFailed("MakeFilletFacesR1R2", self.LocalOp)
return anObj
## Perform a fillet on the specified edges/faces of the given shape
# @param theShape - Face Shape to perform fillet on.
# @param theR - Fillet radius.
# @param theListOfVertexes Global indices of vertexes to perform fillet on.
# \note Global index of sub-shape can be obtained, using method geompy.GetSubShapeID().
# @return New GEOM_Object, containing the result shape.
#
# @ref tui_fillet2d "Example"
def MakeFillet2D(self,theShape, theR, theListOfVertexes):
# Example: see GEOM_TestAll.py
anObj = self.LocalOp.MakeFillet2D(theShape, theR, theListOfVertexes)
RaiseIfFailed("MakeFillet2D", self.LocalOp)
return anObj
## Perform a symmetric chamfer on all edges of the given shape.
# @param theShape Shape, to perform chamfer on.

View File

@ -48,7 +48,7 @@
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2 };
enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2, SUBSHAPES_OF_INVISIBLE_SHAPE2 };
GroupGUI_GroupDlg::GroupGUI_GroupDlg( Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent )
: GEOMBase_Skeleton( theGeometryGUI, parent, false ),
@ -383,7 +383,10 @@ void GroupGUI_GroupDlg::onGetInPlace()
setInPlaceObj( aGetInPlaceObj );
}
else {
setInPlaceObj( anObj );
bool isVisible = true;
if ( SALOME_View* view = GEOM_Displayer::GetActiveView() )
isVisible = view->isVisible( aSelList.First() );
setInPlaceObj( anObj, isVisible );
}
myEditCurrentArgument = 0;
//myBusy = true; // just activate but do not select in the list
@ -398,14 +401,16 @@ void GroupGUI_GroupDlg::onGetInPlace()
//purpose : temporarily add an object to study and remove old InPlaceObj
//=======================================================================
void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj )
void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj, const bool isVisible )
{
if ( ! myInPlaceObj->_is_equivalent( theObj ) )
{
const char* tmpName = "__InPlaceObj__";
// remove old InPlaceObj
if ( !myInPlaceObj->_is_nil() ) {
if ( myInPlaceObjSelectWay == GET_IN_PLACE ) { // hide temporary object
if ( myInPlaceObjSelectState == GET_IN_PLACE ||
myInPlaceObjSelectState == SUBSHAPES_OF_INVISIBLE_SHAPE2 ) {
// hide temporary object or initially invisible shape 2 (issue 0014047)
GEOM_Displayer aDisplayer(getStudy());
aDisplayer.Erase( myInPlaceObj, true );
}
@ -437,7 +442,9 @@ void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj )
myMain2InPlaceIndices.Bind( aMainIndex, aPlaceIndex );
}
}
myInPlaceObjSelectWay = subSelectionWay();
myInPlaceObjSelectState = subSelectionWay();
if ( myInPlaceObjSelectState == SUBSHAPES_OF_SHAPE2 && !isVisible )
myInPlaceObjSelectState = SUBSHAPES_OF_INVISIBLE_SHAPE2;
}
//=================================================================================

View File

@ -86,7 +86,7 @@ private:
void updateState();
void highlightSubShapes();
void onGetInPlace();
void setInPlaceObj( GEOM::GEOM_Object_var );
void setInPlaceObj( GEOM::GEOM_Object_var, const bool isVisible=1);
private:
Mode myMode;
@ -94,7 +94,7 @@ private:
GEOM::GEOM_Object_var myMainObj;
GEOM::GEOM_Object_var myGroup;
GEOM::GEOM_Object_var myInPlaceObj;
int myInPlaceObjSelectWay;
int myInPlaceObjSelectState;
TColStd_DataMapOfIntegerInteger myMain2InPlaceIndices;
QPushButton* mySelBtn;

View File

@ -32,6 +32,7 @@ salomeinclude_HEADERS = \
OperationGUI_ArchimedeDlg.h \
OperationGUI_PartitionDlg.h \
OperationGUI_FilletDlg.h \
OperationGUI_Fillet2dDlg.h \
OperationGUI_ChamferDlg.h \
OperationGUI_GetShapesOnShapeDlg.h \
OperationGUI_ClippingDlg.h
@ -45,6 +46,7 @@ dist_libOperationGUI_la_SOURCES = \
OperationGUI_PartitionDlg.cxx \
OperationGUI_GetShapesOnShapeDlg.cxx \
OperationGUI_FilletDlg.cxx \
OperationGUI_Fillet2dDlg.cxx \
OperationGUI_ChamferDlg.cxx \
OperationGUI_ClippingDlg.cxx
@ -53,6 +55,7 @@ MOC_FILES = \
OperationGUI_PartitionDlg_moc.cxx \
OperationGUI_GetShapesOnShapeDlg_moc.cxx\
OperationGUI_FilletDlg_moc.cxx \
OperationGUI_Fillet2dDlg_moc.cxx \
OperationGUI_ChamferDlg_moc.cxx \
OperationGUI_ClippingDlg_moc.cxx

View File

@ -38,6 +38,7 @@
#include "OperationGUI_PartitionDlg.h" // Method PARTITION
#include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE
#include "OperationGUI_FilletDlg.h" // Method FILLET
#include "OperationGUI_Fillet2dDlg.h" // Method FILLET 2D
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER
#include "OperationGUI_ClippingDlg.h" // Clipping dialog box
#include "OperationGUI_GetShapesOnShapeDlg.h"
@ -78,6 +79,7 @@ bool OperationGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
case 506: ( new OperationGUI_ChamferDlg ( getGeometryGUI(), parent ) )->show(); break;
case 507: ( new OperationGUI_ClippingDlg ( getGeometryGUI(), parent ) )->show(); break;
case 508: ( new OperationGUI_GetShapesOnShapeDlg( getGeometryGUI(), parent ) )->show(); break;
case 509: ( new OperationGUI_Fillet2dDlg ( getGeometryGUI(), parent ) )->show(); break;
default:
app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
}

View File

@ -0,0 +1,400 @@
// 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 : OperationGUI_Fillet2dDlg.cxx
// Author : DMV, OCN.
//
#include "OperationGUI_Fillet2dDlg.h"
#include <DlgRef.h>
#include <GeometryGUI.h>
#include <GEOMBase.h>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <SUIT_ResourceMgr.h>
#include <SUIT_ViewWindow.h>
#include <SUIT_ViewManager.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <OCCViewer_ViewModel.h>
// OCCT Includes
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
#include <GEOMImpl_Types.hxx>
//=================================================================================
// class : OperationGUI_Fillet2dDlg()
// purpose : Constructs a OperationGUI_Fillet2dDlg 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.
//=================================================================================
OperationGUI_Fillet2dDlg::OperationGUI_Fillet2dDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
: GEOMBase_Skeleton(theGeometryGUI, parent, false)
{
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_FILLET_2D")));
QPixmap iconSelect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_FILLET_2D_TITLE"));
/***************************************************************/
mainFrame()->GroupConstructors->setTitle(tr("GEOM_FILLET_2D"));
mainFrame()->RadioButton1->setIcon(image0);
mainFrame()->RadioButton2->close();
mainFrame()->RadioButton3->close();
GroupVertexes = new DlgRef_2Sel1Spin(centralWidget());
GroupVertexes->GroupBox1->setTitle(tr("GEOM_FILLET_2D"));
GroupVertexes->TextLabel1->setText(tr("GEOM_PLANAR_FACE"));
GroupVertexes->TextLabel2->setText(tr("GEOM_VERTEXES"));
GroupVertexes->TextLabel3->setText(tr("GEOM_RADIUS"));
GroupVertexes->PushButton1->setIcon(iconSelect);
GroupVertexes->PushButton2->setIcon(iconSelect);
GroupVertexes->LineEdit1->setReadOnly(true);
GroupVertexes->LineEdit2->setReadOnly(true);
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupVertexes);
/***************************************************************/
// Set range of spinboxes
double SpecificStep = 10.0;
initSpinBox(GroupVertexes->SpinBox_DX, 0.00001, COORD_MAX, SpecificStep, 5); // VSR: TODO: DBL_DIGITS_DISPLAY
setHelpFileName("fillet2d_operation_page.html");
// Initialisation
Init();
resize(0,0);
}
//=================================================================================
// function : ~OperationGUI_Fillet2dDlg()
// purpose : Destroys the object and frees any allocated resources
//=================================================================================
OperationGUI_Fillet2dDlg::~OperationGUI_Fillet2dDlg()
{
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::Init()
{
// Set Initial values of spinboxes
GroupVertexes->SpinBox_DX->setValue(5);
// Clear line edits
GroupVertexes->LineEdit1->setText("");
GroupVertexes->LineEdit2->setText("");
myShape = GEOM::GEOM_Object::_nil();
myVertexes.Clear();
// signals and slots connections
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk() ));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
// connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(GroupVertexes->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupVertexes->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupVertexes->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupVertexes->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupVertexes->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
initName(tr("GEOM_FILLET_2D"));
GroupVertexes->PushButton1->click();
}
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::ClickOnOk()
{
if (ClickOnApply())
ClickOnCancel();
}
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool OperationGUI_Fillet2dDlg::ClickOnApply()
{
if (!onAccept())
return false;
initName();
// Reset dialog state
GroupVertexes->LineEdit1->setText("");
GroupVertexes->LineEdit2->setText("");
myShape = GEOM::GEOM_Object::_nil();
myVertexes.Clear();
GroupVertexes->PushButton1->click();
return true;
}
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection is changed or on dialog initialization or activation
//=================================================================================
void OperationGUI_Fillet2dDlg::SelectionIntoArgument()
{
erasePreview();
myEditCurrentArgument->setText("");
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
aSelMgr->selectedObjects(aSelList);
// If selection of main object is activated
if (myEditCurrentArgument == GroupVertexes->LineEdit1) {
myShape = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil()) {
QString aName = GEOMBase::GetName( anObj );
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( anObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap);
if ( aMap.Extent() == 1 ) { // Local Selection
int anIndex = aMap( 1 );
aName += QString( ":face_%1" ).arg( anIndex );
//Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( anObj, aName );
if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
anObj = aShapesOp->GetSubShape( anObj, anIndex );
}
else
anObj = aFindedObject; // get Object from study
}
else { // Global Selection
if ( aShape.ShapeType() != TopAbs_FACE ) {
anObj = GEOM::GEOM_Object::_nil();
aName = "";
}
}
}
myShape = anObj;
myEditCurrentArgument->setText(aName
);
displayPreview();
}
}
} else if (myEditCurrentArgument == GroupVertexes->LineEdit2) {
myVertexes.Clear();
if (aSelList.Extent() == 1) {
Standard_Boolean aResult = Standard_False;
GEOM::GEOM_Object_var anObj =
GEOMBase::ConvertIOinGEOMObject(aSelList.First(), aResult);
if (aResult && !anObj->_is_nil()) {
TColStd_IndexedMapOfInteger anIndexes;
aSelMgr->GetIndexes(aSelList.First(), anIndexes);
if (anIndexes.Extent() > 0) {
QString aName;
if (anIndexes.Extent() == 1) {
int anIndex = anIndexes(1);
aName = QString(GEOMBase::GetName(anObj)) + QString(":vertex_%1").arg(anIndex);
}
else
aName = tr("GEOM_MEN_POPUP_NAME").arg(anIndexes.Extent());
myEditCurrentArgument->setText(aName);
myVertexes = anIndexes;
displayPreview();
}
}
}
}
if (myEditCurrentArgument == GroupVertexes->LineEdit1) {
if (!myShape->_is_nil() && myVertexes.Extent() == 0)
GroupVertexes->PushButton2->click();
}
}
//=================================================================================
// function : SetEditCurrentArgument()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::SetEditCurrentArgument()
{
QPushButton* send = (QPushButton*)sender();
if (send == GroupVertexes->PushButton1) {
myEditCurrentArgument = GroupVertexes->LineEdit1;
GroupVertexes->PushButton2->setDown(false);
GroupVertexes->LineEdit2->setEnabled(false);
}
else if (send == GroupVertexes->PushButton2) {
myEditCurrentArgument = GroupVertexes->LineEdit2;
GroupVertexes->PushButton1->setDown(false);
GroupVertexes->LineEdit1->setEnabled(false);
}
// enable line edit
myEditCurrentArgument->setEnabled(true);
myEditCurrentArgument->setFocus();
// after setFocus(), because it will be setDown(false) when loses focus
send->setDown(true);
activateSelection();
// seems we need it only to avoid preview disappearing, caused by selection mode change
displayPreview();
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if (send == GroupVertexes->LineEdit1)
myEditCurrentArgument = GroupVertexes->LineEdit1;
else if (send == GroupVertexes->LineEdit2)
myEditCurrentArgument = GroupVertexes->LineEdit2;
else
return;
GEOMBase_Skeleton::LineEditReturnPressed();
}
//=================================================================================
// function : ActivateThisDialog()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
}
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::enterEvent (QEvent*)
{
if (!mainFrame()->GroupConstructors->isEnabled())
this->ActivateThisDialog();
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void OperationGUI_Fillet2dDlg::ValueChangedInSpinBox (double)
{
displayPreview();
}
//=================================================================================
// function : activateSelection
// purpose : Activate selection in accordance with myEditCurrentArgument
//=================================================================================
void OperationGUI_Fillet2dDlg::activateSelection()
{
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
globalSelection();
if (myEditCurrentArgument == GroupVertexes->LineEdit1)
globalSelection( GEOM_FACE ); // localSelection(myShape, TopAbs_FACE);
else if (!myShape->_is_nil() && myEditCurrentArgument == GroupVertexes->LineEdit2)
localSelection(myShape, TopAbs_VERTEX);
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
}
//=================================================================================
// function : createOperation
// purpose :
//=================================================================================
GEOM::GEOM_IOperations_ptr OperationGUI_Fillet2dDlg::createOperation()
{
return getGeomEngine()->GetILocalOperations(getStudyId());
}
//=================================================================================
// function : isValid()
// purpose : Verify validity of input data
//=================================================================================
bool OperationGUI_Fillet2dDlg::isValid (QString&)
{
return !myShape->_is_nil() && myVertexes.Extent() > 0;
}
//=================================================================================
// function : execute
// purpose :
//=================================================================================
bool OperationGUI_Fillet2dDlg::execute (ObjectList& objects)
{
GEOM::GEOM_Object_var anObj;
GEOM::ListOfLong_var aListOfIndexes = new GEOM::ListOfLong;
aListOfIndexes->length(myVertexes.Extent());
for (int i = 1, n = myVertexes.Extent(); i <= n; i++)
aListOfIndexes[ i - 1 ] = myVertexes(i);
anObj = GEOM::GEOM_ILocalOperations::_narrow(getOperation())->
MakeFillet2D(myShape, getRadius(), aListOfIndexes);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
return true;
}
//=================================================================================
// function : getRadius
// purpose : Get radius
//=================================================================================
double OperationGUI_Fillet2dDlg::getRadius() const
{
return GroupVertexes ->SpinBox_DX->value();
}

View File

@ -0,0 +1,75 @@
// 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 : OperationGUI_Fillet2dDlg.h
// Author : DMV, OCN
//
#ifndef OPERATIONGUI_FILLET2DDLG_H
#define OPERATIONGUI_FILLET2DDLG_H
#include <GEOMBase_Skeleton.h>
#include <TColStd_IndexedMapOfInteger.hxx>
class DlgRef_2Sel1Spin;
//=================================================================================
// class : OperationGUI_Fillet2dDlg
// purpose :
//=================================================================================
class OperationGUI_Fillet2dDlg : public GEOMBase_Skeleton
{
Q_OBJECT
public:
OperationGUI_Fillet2dDlg( GeometryGUI*, QWidget* );
~OperationGUI_Fillet2dDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
private slots:
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void LineEditReturnPressed();
void SelectionIntoArgument();
void SetEditCurrentArgument();
void ValueChangedInSpinBox( double );
private:
void Init();
void enterEvent( QEvent* );
void activateSelection();
double getRadius() const;
private:
GEOM::GEOM_Object_var myShape;
TColStd_IndexedMapOfInteger myVertexes;
DlgRef_2Sel1Spin* GroupVertexes;
};
#endif // OPERATIONGUI_FILLET2DDLG_H

View File

@ -33,6 +33,7 @@
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
#include <TColStd_IndexedMapOfInteger.hxx>
// OCCT Includes
#include <TColStd_MapOfInteger.hxx>
@ -54,6 +55,7 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
SUIT_ResourceMgr* aResMgr = myGeomGUI->getApp()->resourceMgr();
QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION")));
QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION2")));
QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POSITION3")));
QPixmap imageselect (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
setWindowTitle(tr("GEOM_POSITION_TITLE"));
@ -62,24 +64,22 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
mainFrame()->GroupConstructors->setTitle(tr("GEOM_POSITION"));
mainFrame()->RadioButton1->setIcon(image0);
mainFrame()->RadioButton2->setIcon(image1);
mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
mainFrame()->RadioButton3->close();
mainFrame()->RadioButton3->setIcon(image2);
Group1 = new DlgRef_3Sel3Spin1Check(centralWidget());
Group1->SpinBox1->hide();
Group1->SpinBox2->hide();
Group1->SpinBox3->hide();
Group1->TextLabel4->hide();
Group1->TextLabel5->hide();
Group1->TextLabel6->hide();
Group1 = new DlgRef_4Sel1Spin3Check(centralWidget());
Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
Group1->TextLabel1->setText(tr("GEOM_OBJECTS"));
Group1->TextLabel2->setText(tr("GEOM_START_LCS"));
Group1->TextLabel3->setText(tr("GEOM_END_LCS"));
Group1->TextLabel3->setText(tr("GEOM_DISTANCE"));
Group1->TextLabel4->setText(tr("GEOM_END_LCS"));
Group1->TextLabel5->setText(tr("GEOM_PATH_OBJECT"));
Group1->PushButton1->setIcon(imageselect);
Group1->PushButton2->setIcon(imageselect);
Group1->PushButton3->setIcon(imageselect);
Group1->CheckBox1->setText(tr("GEOM_CREATE_COPY"));
Group1->PushButton4->setIcon(imageselect);
Group1->PushButton5->setIcon(imageselect);
Group1->CheckButton1->setText(tr("GEOM_CREATE_COPY"));
Group1->CheckButton2->setText(tr("SELECT_UNPUBLISHED_EDGES"));
Group1->CheckButton3->setText(tr("GEOM_REVERSE_DIRECTION"));
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
@ -89,7 +89,8 @@ TransformationGUI_PositionDlg::TransformationGUI_PositionDlg
setHelpFileName("modify_location_operation_page.html");
// Activate Create a Copy mode
Group1->CheckBox1->setChecked(true);
Group1->CheckButton1->setChecked(true);
Group1->CheckButton1->setChecked(false);
CreateCopyModeChanged(true);
Init();
@ -113,11 +114,18 @@ void TransformationGUI_PositionDlg::Init()
// init variables
Group1->LineEdit1->setReadOnly(true);
Group1->LineEdit2->setReadOnly(true);
Group1->LineEdit3->setReadOnly(true);
Group1->LineEdit4->setReadOnly(true);
Group1->LineEdit5->setReadOnly(true);
Group1->LineEdit1->setText("");
Group1->LineEdit2->setText("");
Group1->LineEdit3->setText("");
Group1->LineEdit4->setText("");
Group1->LineEdit5->setText("");
initSpinBox(Group1->SpinBox_DX, 0, 1, 0.05, 6); // VSR:TODO : DBL_DIGITS_DISPLAY
Group1->SpinBox_DX->setValue(0);
Group1->CheckButton2->setEnabled(false);
myStartLCS = myEndLCS = GEOM::GEOM_Object::_nil();
@ -131,13 +139,19 @@ void TransformationGUI_PositionDlg::Init()
connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->PushButton4, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->PushButton5, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group1->LineEdit4, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group1->LineEdit5, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(Group1->CheckBox1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
connect(Group1->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(CreateCopyModeChanged(bool)));
connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
connect(Group1->CheckButton2, SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
connect(Group1->CheckButton3, SIGNAL(toggled(bool)), this, SLOT(ValueChangedInSpinBox()));
initName(tr("GEOM_POSITION"));
@ -153,9 +167,11 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
Group1->LineEdit2->clear();
Group1->LineEdit3->clear();
Group1->LineEdit4->clear();
Group1->LineEdit5->clear();
myStartLCS = GEOM::GEOM_Object::_nil();
myEndLCS = GEOM::GEOM_Object::_nil();
myPath = GEOM::GEOM_Object::_nil();
switch (constructorId) {
case 0:
@ -164,7 +180,21 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
Group1->TextLabel2->hide();
Group1->PushButton2->hide();
Group1->LineEdit5->hide();
Group1->TextLabel5->hide();
Group1->PushButton5->hide();
Group1->SpinBox_DX->hide();
Group1->TextLabel3->hide();
Group1->LineEdit4->show();
Group1->TextLabel4->show();
Group1->PushButton4->show();
Group1->PushButton1->click();
Group1->CheckButton2->hide();
Group1->CheckButton3->hide();
}
break;
case 1:
@ -173,7 +203,40 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
Group1->TextLabel2->show();
Group1->PushButton2->show();
Group1->LineEdit5->hide();
Group1->TextLabel5->hide();
Group1->PushButton5->hide();
Group1->SpinBox_DX->hide();
Group1->TextLabel3->hide();
Group1->PushButton1->click();
Group1->CheckButton2->hide();
Group1->CheckButton3->hide();
}
break;
case 2:
{
Group1->LineEdit4->hide();
Group1->TextLabel4->hide();
Group1->PushButton4->hide();
Group1->LineEdit2->hide();
Group1->TextLabel2->hide();
Group1->PushButton2->hide();
Group1->LineEdit5->show();
Group1->TextLabel5->show();
Group1->PushButton5->show();
Group1->SpinBox_DX->show();
Group1->TextLabel3->show();
Group1->PushButton1->click();
Group1->CheckButton2->show();
Group1->CheckButton3->show();
}
break;
}
@ -191,6 +254,31 @@ void TransformationGUI_PositionDlg::ConstructorsClicked (int constructorId)
}
}
//=================================================================================
// function : SelectionBittonClicked()
// purpose : Selection type Radio button management
//=================================================================================
void TransformationGUI_PositionDlg::SelectionTypeButtonClicked()
{
if ( Group1->CheckButton2->isChecked() ) {
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_WIRE);
aMap.Add(GEOM_LINE);
globalSelection(aMap);
}
}
//=================================================================================
// function : ValueChangedInSpinBox()
// purpose :
//=================================================================================
void TransformationGUI_PositionDlg::ValueChangedInSpinBox()
{
displayPreview();
}
//=================================================================================
// function : ClickOnOk()
// purpose :
@ -207,7 +295,7 @@ void TransformationGUI_PositionDlg::ClickOnOk()
//=================================================================================
bool TransformationGUI_PositionDlg::ClickOnApply()
{
if (!onAccept(Group1->CheckBox1->isChecked()))
if (!onAccept(Group1->CheckButton1->isChecked()))
return false;
initName();
@ -229,8 +317,10 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
myObjects.length(0);
else if (myEditCurrentArgument == Group1->LineEdit2)
myStartLCS = GEOM::GEOM_Object::_nil();
else if (myEditCurrentArgument == Group1->LineEdit3)
else if (myEditCurrentArgument == Group1->LineEdit4)
myEndLCS = GEOM::GEOM_Object::_nil();
else if (myEditCurrentArgument == Group1->LineEdit5)
myPath = GEOM::GEOM_Object::_nil();
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
SALOME_ListIO aSelList;
@ -248,6 +338,9 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
return;
else
myEditCurrentArgument->setText(aName);
if (getConstructorId() == 2)
Group1->PushButton5->click();
}
else if (myEditCurrentArgument == Group1->LineEdit2) {
if (aSelList.Extent() != 1)
@ -263,9 +356,9 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
myEditCurrentArgument->setText(aName);
if (!myStartLCS->_is_nil() && myEndLCS->_is_nil())
Group1->PushButton3->click();
Group1->PushButton4->click();
}
else if (myEditCurrentArgument == Group1->LineEdit3) {
else if (myEditCurrentArgument == Group1->LineEdit4) {
myEndLCS = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() != 1)
return;
@ -281,6 +374,55 @@ void TransformationGUI_PositionDlg::SelectionIntoArgument()
if (!myEndLCS->_is_nil() && !myObjects.length())
Group1->PushButton1->click();
}
else if (myEditCurrentArgument == Group1->LineEdit5) {
myPath = GEOM::GEOM_Object::_nil();
if (aSelList.Extent() != 1)
return;
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject(aSelList.First(), testResult);
if (!testResult || aSelectedObject->_is_nil())
return;
aName = GEOMBase::GetName(myPath);
// Local Selection
TopoDS_Shape S;
if (!GEOMBase::GetShape(aSelectedObject, S))
return;
TColStd_IndexedMapOfInteger aMap;
aSelMgr->GetIndexes(aSelList.First(), aMap);
aName = GEOMBase::GetName(aSelectedObject);
if (aMap.Extent() == 1) {
int anIndex = aMap(1);
aName.append(":edge_" + QString::number(anIndex));
//Find SubShape Object in Father
GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
if (aFindedObject == GEOM::GEOM_Object::_nil()) { // Object not found in study
GEOM::GEOM_IShapesOperations_var aShapesOp =
getGeomEngine()->GetIShapesOperations(getStudyId());
aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
}
else { // get Object from study
aSelectedObject = aFindedObject;
}
}
else {
if (S.ShapeType() != TopAbs_EDGE && S.ShapeType() != TopAbs_WIRE) {
aSelectedObject = GEOM::GEOM_Object::_nil();
aName = "";
return;
}
}
myEditCurrentArgument->setText(aName);
myPath = aSelectedObject;
if (!myPath->_is_nil() && !myObjects.length())
Group1->PushButton1->click();
}
// clear selection
disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
@ -306,9 +448,13 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
globalSelection();
Group1->PushButton2->setDown(false);
Group1->PushButton3->setDown(false);
Group1->PushButton4->setDown(false);
Group1->PushButton5->setDown(false);
Group1->LineEdit2->setEnabled(false);
Group1->LineEdit3->setEnabled(false);
Group1->LineEdit4->setEnabled(false);
Group1->LineEdit5->setEnabled(false);
Group1->CheckButton2->setEnabled(false);
}
else if (send == Group1->PushButton2) {
myEditCurrentArgument = Group1->LineEdit2;
@ -319,12 +465,16 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
globalSelection(aMap);
Group1->PushButton1->setDown(false);
Group1->PushButton3->setDown(false);
Group1->PushButton4->setDown(false);
Group1->PushButton5->setDown(false);
Group1->LineEdit1->setEnabled(false);
Group1->LineEdit3->setEnabled(false);
Group1->LineEdit4->setEnabled(false);
Group1->LineEdit5->setEnabled(false);
Group1->CheckButton2->setEnabled(false);
}
else if (send == Group1->PushButton3) {
myEditCurrentArgument = Group1->LineEdit3;
else if (send == Group1->PushButton4) {
myEditCurrentArgument = Group1->LineEdit4;
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_PLANE);
@ -333,8 +483,33 @@ void TransformationGUI_PositionDlg::SetEditCurrentArgument()
Group1->PushButton1->setDown(false);
Group1->PushButton2->setDown(false);
Group1->PushButton5->setDown(false);
Group1->LineEdit1->setEnabled(false);
Group1->LineEdit2->setEnabled(false);
Group1->LineEdit5->setEnabled(false);
Group1->CheckButton2->setEnabled(false);
}
else if (send == Group1->PushButton5) {
myEditCurrentArgument = Group1->LineEdit5;
Group1->CheckButton2->setEnabled(true);
if ( Group1->CheckButton2->isChecked() ) {
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
} else {
TColStd_MapOfInteger aMap;
aMap.Add(GEOM_WIRE);
aMap.Add(GEOM_LINE);
globalSelection(aMap);
}
Group1->PushButton1->setDown(false);
Group1->PushButton2->setDown(false);
Group1->PushButton4->setDown(false);
Group1->LineEdit1->setEnabled(false);
Group1->LineEdit2->setEnabled(false);
Group1->LineEdit4->setEnabled(false);
}
connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
this, SLOT(SelectionIntoArgument()));
@ -358,10 +533,16 @@ void TransformationGUI_PositionDlg::LineEditReturnPressed()
QLineEdit* send = (QLineEdit*)sender();
if (send == Group1->LineEdit1 ||
send == Group1->LineEdit2 ||
send == Group1->LineEdit3) {
send == Group1->LineEdit4 ||
send == Group1->LineEdit5 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
if (send == Group1->LineEdit5)
Group1->CheckButton2->setEnabled(true);
else
Group1->CheckButton2->setEnabled(false);
}
//=================================================================================
@ -374,6 +555,9 @@ void TransformationGUI_PositionDlg::ActivateThisDialog()
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() );
}
@ -405,8 +589,10 @@ bool TransformationGUI_PositionDlg::isValid (QString& /*msg*/)
bool res;
if (getConstructorId() == 0)
res = !(myObjects.length() == 0 || myEndLCS->_is_nil());
else
else if ( getConstructorId() == 1 )
res = !(myObjects.length() == 0 || myStartLCS->_is_nil() || myEndLCS->_is_nil());
else if ( getConstructorId() == 2 )
res = !(myObjects.length() == 0 || myPath->_is_nil());
return res;
}
@ -418,7 +604,7 @@ bool TransformationGUI_PositionDlg::isValid (QString& /*msg*/)
bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
{
bool res = false;
bool toCreateCopy = IsPreview() || Group1->CheckBox1->isChecked();
bool toCreateCopy = IsPreview() || Group1->CheckButton1->isChecked();
GEOM::GEOM_Object_var anObj;
switch (getConstructorId()) {
@ -453,6 +639,19 @@ bool TransformationGUI_PositionDlg::execute (ObjectList& objects)
res = true;
break;
}
case 2:
{
double aDistance = Group1->SpinBox_DX->value();
bool toReverse = Group1->CheckButton3->isChecked();
for (int i = 0; i < myObjects.length(); i++) {
anObj = GEOM::GEOM_ITransformOperations::_narrow(getOperation())->
PositionAlongPath(myObjects[i], myPath, aDistance, toCreateCopy, toReverse);
if (!anObj->_is_nil())
objects.push_back(anObj._retn());
}
res = true;
break;
}
}
return res;
@ -481,3 +680,16 @@ void TransformationGUI_PositionDlg::CreateCopyModeChanged (bool isCreateCopy)
{
mainFrame()->GroupBoxName->setEnabled(isCreateCopy);
}
//=================================================================================
// function : addSubshapeToStudy
// purpose : virtual method to add new SubObjects if local selection
//=================================================================================
void TransformationGUI_PositionDlg::addSubshapesToStudy()
{
QMap<QString, GEOM::GEOM_Object_var> objMap;
objMap[Group1->LineEdit5->text()] = myPath;
addSubshapesToFather(objMap);
}

View File

@ -28,7 +28,7 @@
#include <GEOMBase_Skeleton.h>
class DlgRef_3Sel3Spin1Check;
class DlgRef_4Sel1Spin3Check;
//=================================================================================
// class : TransformationGUI_PositionDlg
@ -49,6 +49,7 @@ protected:
virtual bool isValid( QString& );
virtual bool execute( ObjectList& );
virtual void restoreSubShapes( SALOMEDS::Study_ptr, SALOMEDS::SObject_ptr );
virtual void addSubshapesToStudy();
private:
void Init();
@ -58,11 +59,12 @@ private:
GEOM::GEOM_Object_var myStartLCS;
GEOM::GEOM_Object_var myEndLCS;
GEOM::ListOfGO myObjects;
GEOM::GEOM_Object_var myPath;
// to initialize the first selection field with a selected object on the dialog creation
bool myInitial;
DlgRef_3Sel3Spin1Check* Group1;
DlgRef_4Sel1Spin3Check* Group1;
private slots:
void ClickOnOk();
@ -73,6 +75,8 @@ private slots:
void SetEditCurrentArgument();
void ConstructorsClicked( int );
void CreateCopyModeChanged( bool );
void ValueChangedInSpinBox();
void SelectionTypeButtonClicked();
};
#endif // TRANSFORMATIONGUI_POSITIONDLG_H