mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-15 10:08:35 +05:00
Implementation of change orientation in Repair in GEOM.
This commit is contained in:
parent
d9a43e10d9
commit
50d053afee
@ -1894,6 +1894,15 @@ module GEOM
|
||||
boolean GetFreeBoundary (in GEOM_Object theObject,
|
||||
out ListOfGO theClosedWires,
|
||||
out ListOfGO theOpenWires);
|
||||
|
||||
/*!
|
||||
* Change orientation of the given object.
|
||||
* \param theObject Shape to be processed.
|
||||
* \return New GEOM_Object, containing processed shape.
|
||||
*/
|
||||
GEOM_Object ChangeOrientation (in GEOM_Object theObject);
|
||||
GEOM_Object ChangeOrientationCopy (in GEOM_Object theObject);
|
||||
|
||||
};
|
||||
|
||||
/*!
|
||||
|
@ -337,6 +337,10 @@ msgstr "supresshole.png"
|
||||
msgid "ICON_DLG_SUPRESS_HOLE_FACE_SHELL"
|
||||
msgstr "supressHolesOnFaceShell.png"
|
||||
|
||||
#ChangeOrientationDlg
|
||||
msgid "ICON_DLG_CHANGE_ORIENTATION"
|
||||
msgstr "change_orientation.png"
|
||||
|
||||
#MultiTranslationDlg
|
||||
msgid "ICON_DLG_MULTITRANSLATION_SIMPLE"
|
||||
msgstr "multitranslationsimple.png"
|
||||
|
@ -307,6 +307,10 @@ msgstr "pointonedge.png"
|
||||
msgid "ICON_DLG_SEWING"
|
||||
msgstr "sewing.png"
|
||||
|
||||
#ChangeOrientationDlg
|
||||
msgid "ICON_DLG_CHANGE_ORIENTATION"
|
||||
msgstr "change_orientation.png"
|
||||
|
||||
#PipeDlg
|
||||
msgid "ICON_DLG_PIPE"
|
||||
msgstr "pipe.png"
|
||||
@ -701,6 +705,9 @@ msgstr "free_bound.png"
|
||||
msgid "ICO_CHECK_FREE_FACES"
|
||||
msgstr "free_faces.png"
|
||||
|
||||
msgid "ICO_CHANGE_ORIENTATION"
|
||||
msgstr "change_orientation.png"
|
||||
|
||||
msgid "ICO_POINT_COORDS"
|
||||
msgstr "point_coord.png"
|
||||
|
||||
|
@ -1642,6 +1642,12 @@ msgstr "Free boundaries"
|
||||
msgid "GEOM_FREE_FACES"
|
||||
msgstr "Free faces"
|
||||
|
||||
msgid "GEOM_CHANGE_ORIENTATION_TITLE"
|
||||
msgstr "Change orientation"
|
||||
|
||||
msgid "GEOM_CHANGE_ORIENTATION"
|
||||
msgstr "Objects to change orientation"
|
||||
|
||||
msgid "GEOM_BY_PARAMETER"
|
||||
msgstr "By parameter"
|
||||
|
||||
@ -1988,6 +1994,9 @@ msgstr "ProcessShape"
|
||||
msgid "SUPRESS_FACE_NEW_OBJ_NAME"
|
||||
msgstr "SupressFaces"
|
||||
|
||||
msgid "CHANGE_ORIENTATION_NEW_OBJ_NAME"
|
||||
msgstr "Invert"
|
||||
|
||||
msgid "NON_GEOM_OBJECTS_SELECTED"
|
||||
msgstr "There are objects selected which do not belong to %1 component."
|
||||
|
||||
@ -2613,6 +2622,15 @@ msgstr "Check free faces"
|
||||
msgid "STB_CHECK_FREE_FACES"
|
||||
msgstr "Check free faces"
|
||||
|
||||
msgid "TOP_CHANGE_ORIENTATION"
|
||||
msgstr "Change orientation"
|
||||
|
||||
msgid "MEN_CHANGE_ORIENTATION"
|
||||
msgstr "Change orientation"
|
||||
|
||||
msgid "STB_CHANGE_ORIENTATION"
|
||||
msgstr "Change orientation"
|
||||
|
||||
msgid "MEN_MEASURES"
|
||||
msgstr "Measures"
|
||||
|
||||
|
@ -503,6 +503,7 @@ void GeometryGUI::OnGUIEvent( int id )
|
||||
id == 608 || // MENU REPAIR - ADD POINT ON EDGE
|
||||
id == 609 || // MENU REPAIR - FREE BOUNDARIES
|
||||
id == 610 || // MENU REPAIR - FREE FACES
|
||||
id == 611 || // MENU REPAIR - CHANGE ORIENTATION
|
||||
id == 602 ) { // MENU REPAIR - GLUE FACES
|
||||
#ifndef WNT
|
||||
library = getLibrary( "libRepairGUI.so" );
|
||||
@ -829,6 +830,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createGeomAction( 608, "POINT_ON_EDGE" );
|
||||
createGeomAction( 609, "CHECK_FREE_BNDS" );
|
||||
createGeomAction( 610, "CHECK_FREE_FACES" );
|
||||
createGeomAction( 611, "CHANGE_ORIENTATION" );
|
||||
|
||||
createGeomAction( 708, "POINT_COORDS" );
|
||||
createGeomAction( 701, "BASIC_PROPS" );
|
||||
@ -971,6 +973,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createMenu( 608, repairId, -1 );
|
||||
createMenu( 609, repairId, -1 );
|
||||
createMenu( 610, repairId, -1 );
|
||||
createMenu( 611, repairId, -1 );
|
||||
|
||||
int measurId = createMenu( tr( "MEN_MEASURES" ), -1, -1, 10 );
|
||||
createMenu( 708, measurId, -1 );
|
||||
|
@ -454,3 +454,71 @@ CORBA::Boolean GEOM_IHealingOperations_i::GetFreeBoundary ( GEOM::GEOM_Object_pt
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ChangeOrientation
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientation (GEOM::GEOM_Object_ptr theObject)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
// Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
// Check parameters
|
||||
if ( CORBA::is_nil(theObject) )
|
||||
return aGEOMObject._retn();
|
||||
|
||||
aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
||||
|
||||
// Get the object itself
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
|
||||
if (anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
// Perform
|
||||
// Handle(GEOM_Object) aNewObject =
|
||||
GetOperations()->ChangeOrientation( anObject );
|
||||
// if (!GetOperations()->IsDone() || aNewObject.IsNull())
|
||||
// return aGEOMObject._retn();
|
||||
|
||||
//return GetObject(aNewObject);
|
||||
return aGEOMObject._retn();
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* ChangeOrientationCopy
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_IHealingOperations_i::ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
// Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
// Check parameters
|
||||
if ( CORBA::is_nil(theObject) )
|
||||
return aGEOMObject._retn();
|
||||
|
||||
// Get the object itself
|
||||
Handle(GEOM_Object) anObject =
|
||||
GetOperations()->GetEngine()->GetObject(theObject->GetStudyID(), theObject->GetEntry());
|
||||
if (anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
// Perform
|
||||
Handle(GEOM_Object) aNewObject =
|
||||
GetOperations()->ChangeOrientationCopy( anObject );
|
||||
if (!GetOperations()->IsDone() || aNewObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(aNewObject);
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,9 @@ class GEOM_IHealingOperations_i :
|
||||
|
||||
CORBA::Boolean GetFreeBoundary(GEOM::GEOM_Object_ptr theObject, GEOM::ListOfGO_out theClosedWires, GEOM::ListOfGO_out theOpenWires );
|
||||
|
||||
GEOM::GEOM_Object_ptr ChangeOrientation (GEOM::GEOM_Object_ptr theObject);
|
||||
GEOM::GEOM_Object_ptr ChangeOrientationCopy (GEOM::GEOM_Object_ptr theObject);
|
||||
|
||||
::GEOMImpl_IHealingOperations* GetOperations() { return (::GEOMImpl_IHealingOperations*)GetImpl(); }
|
||||
|
||||
private:
|
||||
|
@ -1199,6 +1199,23 @@ def DivideEdge(theObject, theEdgeIndex, theValue, isByParameter):
|
||||
print "DivideEdge : ", HealOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
## Change orientation of the given object.
|
||||
# @param theObject Shape to be processed.
|
||||
# @update given shape
|
||||
def ChangeOrientation(theObject):
|
||||
theObject = HealOp.ChangeOrientation(theObject)
|
||||
if HealOp.IsDone() == 0:
|
||||
print "ChangeOrientation : ", HealOp.GetErrorCode()
|
||||
|
||||
## Change orientation of the given object.
|
||||
# @param theObject Shape to be processed.
|
||||
# @return New GEOM_Object, containing processed shape.
|
||||
def ChangeOrientationCopy(theObject):
|
||||
anObj = HealOp.ChangeOrientation(theObject)
|
||||
if HealOp.IsDone() == 0:
|
||||
print "ChangeOrientation : ", HealOp.GetErrorCode()
|
||||
return anObj
|
||||
|
||||
## Get a list of wires (wrapped in GEOM_Object-s),
|
||||
# that constitute a free boundary of the given shape.
|
||||
# @param theObject Shape to get free boundary of.
|
||||
|
@ -47,6 +47,7 @@ LIB_SRC = \
|
||||
ShHealOper_ShapeProcess.cxx \
|
||||
ShHealOper_SplitCurve2d.cxx \
|
||||
ShHealOper_SplitCurve3d.cxx \
|
||||
ShHealOper_ChangeOrientation.cxx \
|
||||
ShHealOper_Tool.cxx \
|
||||
|
||||
LIB_CLIENT_IDL =
|
||||
@ -64,6 +65,7 @@ EXPORT_HEADERS = \
|
||||
ShHealOper_SpiltCurve2d.hxx \
|
||||
ShHealOper_SplitCurve2d.hxx \
|
||||
ShHealOper_SplitCurve3d.hxx \
|
||||
ShHealOper_ChangeOrientation.hxx \
|
||||
ShHealOper_Tool.hxx
|
||||
|
||||
# idl files
|
||||
|
82
src/ShHealOper/ShHealOper_ChangeOrientation.cxx
Normal file
82
src/ShHealOper/ShHealOper_ChangeOrientation.cxx
Normal file
@ -0,0 +1,82 @@
|
||||
// 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: ShHealOper_ChangeOrientation.cxx
|
||||
// Created: 11.07.06 11:46:45
|
||||
// Author: Sergey KUUL
|
||||
|
||||
|
||||
#include <ShHealOper_ChangeOrientation.hxx>
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <TopoDS_Iterator.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : ShHealOper_ChangeOrientation()
|
||||
//purpose : Constructor
|
||||
//=======================================================================
|
||||
|
||||
ShHealOper_ChangeOrientation::ShHealOper_ChangeOrientation ( const TopoDS_Shape& theShape )
|
||||
{
|
||||
Init(theShape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void ShHealOper_ChangeOrientation::Init(const TopoDS_Shape& theShape)
|
||||
{
|
||||
ShHealOper_Tool::Init(theShape);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean ShHealOper_ChangeOrientation::Perform()
|
||||
{
|
||||
if (myInitShape.ShapeType() == TopAbs_SHELL) {
|
||||
BRep_Builder B;
|
||||
myResultShape = myInitShape.EmptyCopied();
|
||||
TopoDS_Iterator itr(myInitShape);
|
||||
while (itr.More()) {
|
||||
B.Add(myResultShape,itr.Value().Reversed());
|
||||
itr.Next();
|
||||
}
|
||||
}
|
||||
else if (myInitShape.ShapeType() == TopAbs_FACE) {
|
||||
myResultShape = myInitShape.Reversed();
|
||||
}
|
||||
else if (myInitShape.ShapeType() == TopAbs_WIRE) {
|
||||
myResultShape = myInitShape.Reversed();
|
||||
}
|
||||
else if (myInitShape.ShapeType() == TopAbs_EDGE) {
|
||||
myResultShape = myInitShape.Reversed();
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
66
src/ShHealOper/ShHealOper_ChangeOrientation.hxx
Normal file
66
src/ShHealOper/ShHealOper_ChangeOrientation.hxx
Normal file
@ -0,0 +1,66 @@
|
||||
// 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: ShHealOper_ChangeOrientation.hxx
|
||||
// Created: 11.07.06 11:22:26
|
||||
// Author: Sergey KUUL
|
||||
|
||||
|
||||
#ifndef ShHealOper_ChangeOrientation_HeaderFile
|
||||
#define ShHealOper_ChangeOrientation_HeaderFile
|
||||
|
||||
#include <MMgt_TShared.hxx>
|
||||
#include <ShHealOper_Tool.hxx>
|
||||
#include <TopoDS_Shape.hxx>
|
||||
|
||||
/// Class ShHealOper_ChangeOrientation
|
||||
// Intended for change orientation of given shape
|
||||
// if shape is Shell - create empty copy and put to it
|
||||
// each face as Reversed()
|
||||
|
||||
class ShHealOper_ChangeOrientation : public ShHealOper_Tool
|
||||
{
|
||||
public:
|
||||
// ---------- PUBLIC METHODS ----------
|
||||
|
||||
/// Empty constructor
|
||||
Standard_EXPORT ShHealOper_ChangeOrientation () {}
|
||||
|
||||
/// Copy constructor
|
||||
Standard_EXPORT ShHealOper_ChangeOrientation (const TopoDS_Shape& theShape);
|
||||
//Method for initalization by whole shape.
|
||||
|
||||
Standard_EXPORT virtual void Init(const TopoDS_Shape& theShape);
|
||||
//Method for initalization by whole shape.
|
||||
|
||||
Standard_EXPORT Standard_Boolean Perform();
|
||||
//Change orientation
|
||||
|
||||
|
||||
public:
|
||||
// Declaration of CASCADE RTTI
|
||||
//DEFINE_STANDARD_RTTI (ShHealOper_RemoveInternalWires)
|
||||
};
|
||||
|
||||
// Definition of HANDLE object using Standard_DefineHandle.hxx
|
||||
//DEFINE_STANDARD_HANDLE (ShHealOper_RemoveInternalWires, )
|
||||
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user