STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 3)
-SET(${PROJECT_NAME_UC}_PATCH_VERSION 1)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
+SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
SET(${PROJECT_NAME_UC}_VERSION
${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
# Find KERNEL
# ===========
COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp/geomBuilder.py ${CMAKE_SOURCE_DIR}/src/GEOM_SWIG/geomBuilder.py
COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp/gsketcher.py ${CMAKE_SOURCE_DIR}/src/GEOM_SWIG/gsketcher.py
COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp/geomtools.py ${CMAKE_SOURCE_DIR}/src/GEOM_PY/geomtools.py
+ COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp/sketcher.py ${CMAKE_SOURCE_DIR}/src/GEOM_PY/sketcher.py
COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp/structelem.py ${CMAKE_SOURCE_DIR}/src/GEOM_PY/structelem/__init__.py
COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp/parts.py ${CMAKE_SOURCE_DIR}/src/GEOM_PY/structelem/parts.py
COMMAND ${PYTHON_EXECUTABLE} ${f} -o tmp/orientation.py ${CMAKE_SOURCE_DIR}/src/GEOM_PY/structelem/orientation.py
<EM> Vmaj' = (Vn * Vmaj) * Vn</em>, where \em Vn is a normal vector and
\em Vmaj is an original vector of the major axis.
-\n <b>TUI Command (with the major axis):</b> <em>geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor)</em>
+\n <b>TUI Command (without the major axis):</b> <em>geompy.MakeEllipse(Point, Vector, RadiusMajor, RadiusMinor)</em>
\n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
the direction) + 1 X Radius + 1 Y Radius.
-\n <b>TUI Command (without the major axis):</b> <em>geompy.MakeEllipseVec(Point, Vector, RadiusMajor, RadiusMinor, VectorMajor)</em>
+\n <b>TUI Command (with the major axis):</b> <em>geompy.MakeEllipseVec(Point, Vector, RadiusMajor, RadiusMinor, VectorMajor)</em>
\n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
the normal direction) + 1 X Radius + 1 Y Radius + 1 edge (for the
major axis direction).
\image html sketcher_dlg.png
-\n At first it is necessary to define the reference coordinate system, where the sketch will be created:
+At first it is necessary to define the reference coordinate system, where the sketch will be created:
- The XOY plane of the <b>Global coordinate system</b> is suggested by default (if no plane or planar face is selected when <b>2D Sketcher</b> is activated).
- If any Local Coordinate Systems have been created in the study earlier, they can be selected as a reference coordinate system in the corresponding list box.
- The \b Arrow button allows selecting a \b plane or a <b>planar face</b> in the viewer or in the object browser as the reference coordinate system for the sketch. The start point will be set in the \b geometric \b center of the face.
- <b>Restore</b> button orientates the viewer correspondingly to the chosen working plane and fits the scene to show all objects.
-\n It is possible to create sketches of two types:
+It is possible to create sketches of two types:
- \b Profiles made of <b>line segments</b> and \b arcs, or
- \b Rectangles.
<h2>Creation of a Profile by straight segments</h2>
- Choose \b segment radio button to start a \b profile.
+
- Define the start point. By default the start point of the curve is located at the origin of the reference coordinate system. A point in 2D Sketcher can be defined in one of three ways:
- - By \b Absolute coordinates. Select \b Absolute radio button in \b Points group, input \b X and \b Y values and click \b Apply button.
-
- \image html 2dsketch1.png
- - By \b Relative coordinates. Select \b Relative radio button in \b Points group, input \b DX and \b DY values and click \b Apply button.
-
- \image html 2dsketch2.png
+ - By \b Absolute coordinates. Select \b Absolute radio button in \b Points group, input \b X and \b Y values and click \b Apply button:
+ \image html 2dsketch1.png
+
+ - By \b Relative coordinates. Select \b Relative radio button in \b Points group, input \b DX and \b DY values and click \b Apply button.
+ \image html 2dsketch2.png
- - By \b Selection of an existing point. Select \b Selection radio button in \b Points group, select a point in the viewer or in the object browser and click \b Apply button.
-
- \image html 2dsketch3.png
+ - By \b Selection of an existing point. Select \b Selection radio button in \b Points group, select a point in the viewer or in the object browser and click \b Apply button.
+ \image html 2dsketch3.png
- Define the next point. Together these two points form the first segment of the sketch.
-\n Alternatively to the definition by \b Points it is possible to define segments by \b Direction and \Distance.
+Alternatively to the definition by \b Points it is possible to define segments by \b Direction and \b Distance.
- The \b Direction can be:
- - Defined by an \b Angle to the previous segment.
-
- \image html 2dsketch4.png
-
- - \b Perpendicular to the previous segment (i.e. the Angle is 90 degrees).
-
- \image html 2dsketch5.png
-
- - \b Tangent (collinear) to the previous segment (i.e. the Angle is 0 degrees).
- \image html 2dsketch6.png
-
- - Defined by <b>VX-VY</b> vector coordinates.
-
- \image html 2dsketch7.png
+ - Defined by an \b Angle to the previous segment.
+ \image html 2dsketch4.png
+
+ - \b Perpendicular to the previous segment (i.e. the Angle is 90 degrees).
+ \image html 2dsketch5.png
+
+ - \b Tangent (collinear) to the previous segment (i.e. the Angle is 0 degrees).
+ \image html 2dsketch6.png
+
+ - Defined by <b>VX-VY</b> vector coordinates.
+ \image html 2dsketch7.png
- The \b Distance can be defined:
- - By the absolute segment \b Length or
- - By \b DX - the length of segment projection on X-axis.
- - By \b DY - the length of segment projection on Y-axis.
+
+ - By the absolute segment \b Length
+ - By \b DX - the length of segment projection on X-axis.
+ - By \b DY - the length of segment projection on Y-axis.
- Proceed with creation of the sketch segments and click \b Apply after each step. The drawn segments will be displayed in the viewer.
- Use \b Undo and \b Redo buttons to cancel an erroneously applied segment or to restore it.
<h2>TUI Commands</h2>
-\n <em>geompy.MakeSketcherOnPlane(Command, WorkingPlane)</em>
+<em>geompy.MakeSketcherOnPlane(Command, WorkingPlane)</em>
This algorithm creates a sketcher (wire or face), following the textual description, passed through the <i>Command</i> argument. The edges of the resulting wire or face will be arcs of circles and/or linear segments.
- \em Command is a string, defining the sketcher by the coordinates of points in the current LCS.
- <em>WorkingPlane</em> can be a Local CS, a plane, or a planar face.
-\n Another way to create the 2D Sketcher in TUI is using Sketcher2D interface.
+Another way to create the 2D Sketcher in TUI is using Sketcher2D interface.
-\n <em>sk = geompy.Sketcher2D()</em> - returns an instance of Sketcher2D interface <i>sk</i>.
+<em>sk = geompy.Sketcher2D()</em> - returns an instance of Sketcher2D interface <i>sk</i>.
\image html sketch_example.png
- the list of \b Points or compounds of points, from which it is approximated;
- <b>Max nbr of Bezier pieces</b> in the resulting surface;
- <b>Max BSpline surface degree</b> of the resulting BSpline surface;
-- <b>Max plate criterion value</b>, which is computed as <em> max(0.0001,10*error), </em> where error is a 3D tolerance of the surface.
+- <b>3D tolerance of initial approximation</b>
+
+\note <b>3D tolerance of initial approximation</b> represents a tolerance of
+initial plate surface approximation. If this parameter is equal to 0 (default),
+its value is automatically computed as <em> max(0.0001, 10*error)</em>,
+where <em>error</em> is a 3D tolerance of the surface representing a maximal
+distance between computed plate surface and given points.
+
+<b>Advanced options:</b> \ref preview_anchor "Preview"
Press "Apply" or "Apply & Close" button to get the resulting <em>GEOM_Object(Surface)</em>.
- \em thelPoints is a list of points or compounds of points;
- \em theNbMax maximum number of Bezier pieces in the resulting surface;
- \em theDegMax maximum degree;
-- \em theDMax specifies maximum value of <em> GeomPlate_PlateG0Criterion </em>.
+- \em theDMax specifies 3D tolerance of initial approximation
Example:
This operation retrieves all non-block solids and non-quadrangular faces from the selected shape.
-A non-block solid is a solid that does not have 6 faces, or has 6 faces, but some of them are not quadrangular).
+A non-block solid is a solid that does not have 6 faces, or has 6 faces, but some of them are not quadrangular.
\image html measures2.png
\n <b>TUI Command:</b>
<em>geompy.GetNonBlocks(Compound).</em> Returns a tuple of two GEOM_Objects.
+The first object is a group of all non block solids; the second object is a group of all non
+quadrangular faces.
+
See also a \ref tui_get_non_blocks_page "TUI example".
*/
\page manipulate_object Manipulate GEOM object in the study (module geomtools)
+The Python module <a href="geompy_doc/group__geomtools.html">geomtools</a> provides
+utility functions to handle %GEOM items in SALOME study:
+- add or remove a shape;
+- display or erase a shape in the viewer;
+- completely delete a shape (undisplay, unpublish, and destroy it);
+- manage the selection in the object browser
+
The usage of <em>geomtools</em> module can be tested with the following set of instructions:
\code
- Delete the cylinder. It is no longer displayed and does not exist any more in the study or in the GEOM component.
At outcome of the test execution, the following objects appear in the SALOME session:
-- the box located in a dedicated study folder and displayed in the viewer;
-- the sphere in the standard place of the study, and not displayed.
+- The box located in a dedicated study folder and displayed in the viewer;
+- The sphere in the standard place of the study, and not displayed.
*/
The %GEOM python package essentially contains:
-- Python Interface \subpage geompy_page "geomBuilder.py" to import/export, create and transform geometrical objects and use measurement tools;
-- Utility functions <em>geomtools.py</em> to handle %GEOM items in Salome study:
+- Python Interface \subpage geompy_page "geomBuilder.py" to import/export,
+ create and transform geometrical objects, manage fields, use measurement tools;
+
+- Utility functions within Python module \subpage manipulate_object "geomtools.py"
+ to handle %GEOM items in SALOME study:
- add or remove a shape;
- display or erase a shape in the viewer;
- completely delete a shape (undisplay, unpublish, and destroy it);
- - manage the selection in the object browser
- See for example how to \subpage manipulate_object "Manipulate a GEOM object in the study".
-- Wrapping functions for %GEOM tools:
- - sketcher module to create sketches from the python API (gsketcher.py)
-- \subpage struct_elem_visualisation "Visualization of structural elements" function to create
- geometrical 3D representations of mechanical models called
- "structural elements" (package \ref structelem.py "structelem")
+ - manage the selection in the object browser.
+
+- \subpage pythonutils_page "Wrapping functions" for %GEOM tools
+
+- Python package \subpage struct_elem_visualisation "structelem" that provides
+ functions to create geometrical 3D representations of mechanical models called
+ "structural elements"
The functions are distributed in the python package <em>salome.geom.</em>
Its documentation is mainly generated from the code of source python files.
-<b>salome.geom</b> – Package containing the %GEOM python utilities:
-- <a href="geompy_doc/group__geomtools.html">geomtools</a>
-- <a href="geompy_doc/group__sketcher.html">sketcher</a>
-- <a href="geompy_doc/group__structelem.html">structelem</a>
\note The main package <em>salome</em> contains other sub-packages that are
distributed with the other SALOME modules. For example, the KERNEL
--- /dev/null
+/*!
+
+\page pythonutils_page Auxiliary Python API of Geometry module
+
+Python API of Geometry module includes some additional packages:
+
+- Sketcher module <a href="geompy_doc/group__sketcher.html">gsketcher.py</a> to create 2D / 3D sketches
+
+- Simplified sketcher module <a href="geompy_doc/group__simplesketcher.html">sketcher.py</a> (deprecated)
+
+*/
\ No newline at end of file
\page struct_elem_visualisation Visualization of structural elements (package structelem)
+The Python package <a href="geompy_doc/group__structelem.html">structelem</a> contains functions
+to create geometrical 3D representations of mechanical models called "structural elements".
+
The visualization of structural elements can be tested with the following set of instructions:
\code
AddParam(theParams, "Max nbr of Bezier pieces", aCI.GetNbMax());
AddParam(theParams, "Max BSpline surface degree", aCI.GetDegMax());
- AddParam(theParams, "Max plate criterion value", aCI.GetDMax());
+ AddParam(theParams, "3D tolerance of initial approximation", aCI.GetDMax());
}
break;
default:
myDegMaxSpin->setValue(8);
myDMaxSpin->setValue(0.);
+ showOnlyPreviewControl();
+
//@@ initialize dialog box widgets here @@//
// Signal/slot connections
initName(tr("GEOM_SMOOTHINGSURFACE"));
//displayPreview();
+ SelectionIntoArgument();
}
//=================================================================================
</message>
<message>
<source>GEOM_SMOOTHINGSURFACE_ARG_D_MAX</source>
- <translation>Max plate criterion value</translation>
+ <translation>3D tolerance of initial approximation</translation>
</message>
<message>
<source>GEOM_SMOOTHINGSURFACE_NO_POINTS</source>
myOK(false),
myLineWidth(lineWidth),
myGeometryGUI(theGeometryGUI),
- myLengthIORedoList()
+ myLengthIORedoList(),
+ myIsUndoRedo(false)
{
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_UNDO")));
//=================================================================================
void EntityGUI_3DSketcherDlg::ClickOnUndo()
{
+ myIsUndoRedo = true;
if (myPointsList.count() > 0) {
myRedoList.append(myPointsList.last());
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs);
// Remove last point from list
+ myWorkPoint = myPointsList.last();
myPointsList.removeLast();
GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
UpdateButtonsState();
updateViewer();
}
+ myIsUndoRedo = false;
}
//=================================================================================
//=================================================================================
void EntityGUI_3DSketcherDlg::ClickOnRedo()
{
+ myIsUndoRedo = true;
if (myRedoList.count() > 0) {
myPointsList.append(myRedoList.last());
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs);
// Remove last point from redo list
+ myWorkPoint = myRedoList.last();
myRedoList.removeLast();
GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
UpdateButtonsState();
updateViewer();
}
+ myIsUndoRedo = false;
}
//=================================================================================
bool twoAngles = GroupAngles->checkBox->isChecked();
XYZ Last = getLastPoint();
- XYZ Current = getCurrentPoint();
+ XYZ Current;
+ if( myIsUndoRedo ) {
+ Current = myWorkPoint;
+ } else {
+ Current = getCurrentPoint();
+ }
+
XYZ Penultimate = getPenultimatePoint();
gp_Pnt P1 = gp_Pnt(Last.x,Last.y,Last.z);
}
}
// If no angles, the plane is the one formed by the last edge and the current one
- aNormal = gp_Dir(Vec1.Crossed(Vec2));
+ if(Abs(Vec1.CrossMagnitude(Vec2)) > Precision::Confusion()) {
+ aNormal = gp_Dir(Vec1.Crossed(Vec2));
+ }
}
return aNormal;
}
SOCC_Prs* myAnglePrs;
SOCC_Prs* myLengthPrs;
SOCC_Prs* myTextPrs;
+ bool myIsUndoRedo;
+ XYZ myWorkPoint;
private slots:
void ClickOnOk();
void GeometryGUI::windows( QMap<int, int>& mappa ) const
{
mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+ mappa.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea );
mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
if ( myCreationInfoWdg )
mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
#
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
+
+## \defgroup simplesketcher sketcher - Simplified sketcher API
+# \{
+# \details
+# This module provides simplified access to the 2D sketcher functionality of Geometry module.
+#
+# \note This module is deprecated, refer to \ref gsketcher for more details
+# \}
+
"""
This module provides the user with a simple python API to realize
various sketches from the GEOM text user interface.
geompyEnable = False
pass
+##
+# \ingroup simplesketcher
class Sketcher:
__sketch = None
self.myStudyId = self.myStudy._get_StudyId()
self.myBuilder = self.myStudy.NewBuilder()
self.father = self.myStudy.FindComponent("GEOM")
+ notebook.myStudy = theStudy
if self.father is None:
self.father = self.myBuilder.NewComponent("GEOM")
A1 = self.myBuilder.FindOrCreateAttribute(self.father, "AttributeName")
# @param theNbMax maximum number of Bezier pieces in the resulting
# surface.
# @param theDegMax maximum degree of the resulting BSpline surface.
- # @param theDMax specifies maximum value of the
- # GeomPlate_PlateG0Criterion criterion.
+ # @param theDMax 3D tolerance of initial approximation.
# @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @return New GEOM_Object, containing the created shape.
+ # @note 3D tolerance of initial approximation represents a tolerance of
+ # initial plate surface approximation. If this parameter is equal
+ # to 0 (default value) it is computed. In this case an error of
+ # initial plate surface computation is used as the approximation
+ # tolerance. This error represents a maximal distance between
+ # computed plate surface and given points.
#
# @ref tui_creation_smoothingsurface "Example"
def MakeSmoothingSurface(self, thelPoints, theNbMax=2, theDegMax=8,
theNbMax maximum number of Bezier pieces in the resulting
surface.
theDegMax maximum degree of the resulting BSpline surface.
- theDMax specifies maximum value of the
- GeomPlate_PlateG0Criterion criterion.
+ theDMax 3D tolerance of initial approximation.
theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name.
Returns:
New GEOM_Object, containing the created shape.
+
+ Note:
+ 3D tolerance of initial approximation represents a tolerance of
+ initial plate surface approximation. If this parameter is equal
+ to 0 (default value) it is computed. In this case an error of
+ initial plate surface computation is used as the approximation
+ tolerance. This error represents a maximal distance between
+ computed plate surface and given points.
"""
anObj = self.AdvOp.MakeSmoothingSurface(thelPoints, theNbMax,
theDegMax, theDMax)
# Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
# Module : GEOM_SWIG
-## @defgroup sketcher sketcher - Wrapper to help the creation of simple sketches
+## @defgroup sketcher gsketcher - Wrapper to help the creation of simple sketches
# @{
# @details
# This module provides the user with a simple python API
myMode(mode),
myBusy(false),
myIsShapeType(false),
- myIsHiddenMain(false)
+ myIsHiddenMain(false),
+ myWasHiddenMain(true)
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
GroupGUI_GroupDlg::~GroupGUI_GroupDlg()
{
GEOM_Displayer* aDisplayer = getDisplayer();
- if (myIsHiddenMain) {
+ if (myWasHiddenMain) {
+ aDisplayer->Erase(myMainObj);
+ myIsHiddenMain = true;
+ } else {
aDisplayer->Display(myMainObj);
myIsHiddenMain = false;
}
GEOM::GEOM_IGroupOperations_var anOper = GEOM::GEOM_IGroupOperations::_narrow(getOperation());
myMainObj = anOper->GetMainShape(myGroup);
- if (!CORBA::is_nil(myMainObj))
+ if (!CORBA::is_nil(myMainObj)) {
myMainName->setText(GEOMBase::GetName(myMainObj));
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ if (view) {
+ CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
+ Handle(SALOME_InteractiveObject) io =
+ new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
+ if (view->isVisible(io)) myWasHiddenMain = false;
+ }
+ }
setShapeType((TopAbs_ShapeEnum)anOper->GetType(myGroup));
if (ClickOnApply())
ClickOnCancel();
setIsApplyAndClose(false);
+ getDisplayer()->UnsetDisplayMode();
}
//=================================================================================
myIsHiddenMain = false;
}
myMainObj = anObj;
+ if (!CORBA::is_nil(myMainObj)) {
+ SALOME_View* view = GEOM_Displayer::GetActiveView();
+ if (view) {
+ CORBA::String_var aMainEntry = myMainObj->GetStudyEntry();
+ Handle(SALOME_InteractiveObject) io =
+ new SALOME_InteractiveObject (aMainEntry.in(), "GEOM", "TEMP_IO");
+ if (view->isVisible(io)) myWasHiddenMain = false;
+ }
+ }
myEditCurrentArgument->setText(GEOMBase::GetName(anObj));
// activate sub-shapes selection by default
myEditCurrentArgument = 0;
bool myBusy;
bool myIsShapeType;
bool myIsHiddenMain;
+ bool myWasHiddenMain;
GEOM::GEOM_Object_var myMainObj;
GEOM::GEOM_Object_var myGroup;
GEOM::GEOM_Object_var myInPlaceObj;