@COMMENCE@
-SUBDIRS = idl src doc
+SUBDIRS = idl src doc adm_local
RESOURCES_FILES = \
GEOM_en.xml \
--- /dev/null
+# source path
+top_srcdir=@top_srcdir@
+top_builddir=..
+srcdir=@srcdir@
+VPATH=.:$(srcdir)/adm_local
+
+
+all: resources
+
+install:
+ cp -rf @top_srcdir@/adm_local @prefix@
+
+bin:
+
+resources :
+ cp -rf @top_srcdir@/adm_local $(top_builddir)
+
+inc:
+
+lib:
+
+depend:
+
+depend_idl:
+
+install-end:
+
+install-include:
+
+install-bin:
+
+uninstall:
+
+uninstall-idl:
+
+distclean:
+
+clean:
+
+distclean-other:
+
--- /dev/null
+# Check availability of Geom binary distribution
+#
+# Author : Nicolas REJNERI (OPEN CASCADE, 2003)
+#
+
+AC_DEFUN([CHECK_GEOM],[
+
+AC_CHECKING(for Geom)
+
+Geom_ok=no
+
+AC_ARG_WITH(geom,
+ [ --with-geom=DIR root directory path of GEOM installation ],
+ GEOM_DIR="$withval",GEOM_DIR="")
+
+if test "x$GEOM_DIR" == "x" ; then
+
+# no --with-geom-dir option used
+
+ if test "x$GEOM_ROOT_DIR" != "x" ; then
+
+ # GEOM_ROOT_DIR environment variable defined
+ GEOM_DIR=$GEOM_ROOT_DIR
+
+ else
+
+ # search Geom binaries in PATH variable
+ AC_PATH_PROG(TEMP, libGEOM_Swig.py)
+ if test "x$TEMP" != "x" ; then
+ GEOM_BIN_DIR=`dirname $TEMP`
+ GEOM_DIR=`dirname $GEOM_BIN_DIR`
+ fi
+
+ fi
+#
+fi
+
+if test -f ${GEOM_DIR}/bin/salome/libGEOM_Swig.py ; then
+ Geom_ok=yes
+ AC_MSG_RESULT(Using Geom module distribution in ${GEOM_DIR})
+
+ if test "x$GEOM_ROOT_DIR" == "x" ; then
+ GEOM_ROOT_DIR=${GEOM_DIR}
+ fi
+ AC_SUBST(GEOM_ROOT_DIR)
+
+else
+ AC_MSG_WARN("Cannot find compiled Geom module distribution")
+fi
+
+AC_MSG_RESULT(for Geom: $Geom_ok)
+
+])dnl
+
ACLOCAL_SRC = \
-ac_cxx_bool.m4 check_corba.m4 check_vtk.m4 \
+ac_cxx_bool.m4 check_corba.m4 \
ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \
ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \
ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \
-ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \
+ac_cxx_partial_specialization.m4 python.m4 \
ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
-ac_cc_warnings.m4 check_qt.m4 check_swig.m4
+ac_cc_warnings.m4 check_swig.m4
-$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
- cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files
+ACLOCAL_GUI = \
+check_vtk.m4 check_opengl.m4 check_qt.m4 \
+check_GUI.m4 check_corba_in_GUI.m4
+
+$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \
+ $(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%)
+ cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \
+ -I @GUI_ROOT_DIR@/adm_local/unix/config_files
# echo "failed : KERNEL_SRC variable is not correct !"
# exit
#fi
+########################################################################
+# Test if the GUI_ROOT_DIR is set correctly
+if test ! -d "${GUI_ROOT_DIR}"; then
+ echo "failed : GUI_ROOT_DIR variable is not correct !"
+ exit
+fi
+
########################################################################
# find_in - utility function
#
echo -n "Creating 'configure' script ... "
fi
-aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
+aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
+ -I ${GUI_ROOT_DIR}/adm_local/unix/config_files
if autoconf
then
echo "done"
CHECK_HTML_GENERATORS
+echo
+echo ---------------------------------------------
+echo Testing GUI
+echo ---------------------------------------------
+echo
+
+CHECK_SALOME_GUI
+
+echo
+echo ---------------------------------------------
+echo Testing full GUI
+echo ---------------------------------------------
+echo
+
+CHECK_CORBA_IN_GUI
+if test "x${CORBA_IN_GUI}" != "xyes"; then
+ echo "failed : For configure GEOM module necessary full GUI !"
+ exit
+fi
+
echo
echo ---------------------------------------------
echo Testing Kernel
bool GEOM_Object::IsMainShape()
{
Handle(GEOM_Function) aFunction = GetFunction(1);
- if(aFunction == NULL || aFunction->GetDriverGUID() != GetSubShapeID()) return true;
+ if(aFunction.IsNull() || aFunction->GetDriverGUID() != GetSubShapeID()) return true; // mkr : IPAL9921
return false;
}
#include <TDF_Tool.hxx>
+#include <TopAbs.hxx>
+
+#include <TColStd_ListOfInteger.hxx>
+#include <TColStd_ListIteratorOfListOfInteger.hxx>
+
namespace GEOM
{
size_t TPythonDump::myCounter = 0;
return *this;
}
+ TPythonDump& TPythonDump::operator<< (const TopAbs_ShapeEnum theArg)
+ {
+ myStream<<"geompy.ShapeType[\"";
+ TopAbs::Print(theArg, myStream);
+ myStream<<"\"]";
+ return *this;
+ }
+
TPythonDump& TPythonDump::operator<< (const Handle(GEOM_Object)& theObject)
{
TCollection_AsciiString anEntry;
myStream << anEntry.ToCString();
return *this;
}
+
+ Handle(GEOM_Object) GetCreatedLast(const Handle(GEOM_Object)& theObj1,
+ const Handle(GEOM_Object)& theObj2)
+ {
+ if (theObj1.IsNull()) return theObj2;
+ if (theObj2.IsNull()) return theObj1;
+
+ TColStd_ListOfInteger aTags1, aTags2;
+ TDF_Tool::TagList(theObj1->GetEntry(), aTags1);
+ TDF_Tool::TagList(theObj2->GetEntry(), aTags2);
+ TColStd_ListIteratorOfListOfInteger aListIter1(aTags1), aListIter2(aTags2);
+ for (; aListIter1.More(); aListIter1.Next()) {
+ if (!aListIter2.More())
+ return theObj1; // anObj1 is stored under anObj2
+
+ if (aListIter1.Value() > aListIter2.Value())
+ return theObj1;
+ else if (aListIter1.Value() < aListIter2.Value())
+ return theObj2;
+ }
+ return theObj1;
+ }
+
+ Handle(GEOM_Object) GetCreatedLast(const Handle(TColStd_HSequenceOfTransient)& theObjects)
+ {
+ Handle(GEOM_Object) anObject, aLatest;
+ int i, aLen = theObjects->Length();
+ if (aLen < 1)
+ return aLatest;
+
+ for (i = 1; i <= aLen; i++) {
+ anObject = Handle(GEOM_Object)::DownCast(theObjects->Value(i));
+ aLatest = GetCreatedLast(aLatest, anObject);
+ }
+ return aLatest;
+ }
}
Standard_EXPORT TPythonDump& operator<< (float theArg);
Standard_EXPORT TPythonDump& operator<< (const void* theArg);
Standard_EXPORT TPythonDump& operator<< (const char* theArg);
+ Standard_EXPORT TPythonDump& operator<< (const TopAbs_ShapeEnum theArg);
Standard_EXPORT TPythonDump& operator<< (const Handle(GEOM_Object)& theObject);
};
+
+ /*! Returns an object from two given, which has the latest entry
+ */
+ Handle(GEOM_Object) GetCreatedLast (const Handle(GEOM_Object)& theObj1,
+ const Handle(GEOM_Object)& theObj2);
+
+ /*! Returns an object from \a theObjects, which has the latest entry
+ */
+ Handle(GEOM_Object) GetCreatedLast (const Handle(TColStd_HSequenceOfTransient)& theObjects);
}
#endif
{
myGeomGUI = 0;
SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication());
- if (app)
- {
- SalomeApp_Module* module = dynamic_cast<SalomeApp_Module*>(app->loadModule("Geometry"));
- if (module)
- myGeomGUI = dynamic_cast<GeometryGUI*>(module);
- }
+ if( app )
+ myGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
/* init variables */
myGeomBase = new GEOMBase(); // SAN -- TO BE REMOVED !!!
/* signals and slots connections */
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
if (myGeomGUI)
- {
- connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
- }
+ {
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
+ }
/* Move widget on the botton right corner of main widget */
// int x, y;
// function : GeometryGUI::OnKeyPress()
// purpose : Called when any key is pressed by user [static]
//=================================================================================
-bool GeometryGUI::OnKeyPress( QKeyEvent* pe, SUIT_ViewWindow* win )
+void GeometryGUI::OnKeyPress( SUIT_ViewWindow* win, QKeyEvent* pe )
{
GUIMap::Iterator it;
bool bOk = true;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
bOk = bOk && it.data()->OnKeyPress( pe, application()->desktop(), win );
- return bOk;
+// return bOk;
}
// function : GeometryGUI::OnMouseMove()
// purpose : Manages mouse move events [static]
//=================================================================================
-bool GeometryGUI::OnMouseMove( QMouseEvent* pe, SUIT_ViewWindow* win )
+void GeometryGUI::OnMouseMove( SUIT_ViewWindow* win, QMouseEvent* pe )
{
GUIMap::Iterator it;
bool bOk = true;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
bOk = bOk && it.data()->OnMouseMove( pe, application()->desktop(), win );
- return bOk;
+// return bOk;
}
// function : GeometryGUI::0nMousePress()
// purpose : Manage mouse press events [static]
//=================================================================================
-bool GeometryGUI::OnMousePress( QMouseEvent* pe, SUIT_ViewWindow* win )
+void GeometryGUI::OnMousePress( SUIT_ViewWindow* win, QMouseEvent* pe )
{
GUIMap::Iterator it;
// OnMousePress() should return false if this event should be processed further
bool processed = false;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
processed = processed || it.data()->OnMousePress( pe, application()->desktop(), win );
- return processed;
+// return processed;
}
/*
connect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
- connect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
- this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
- connect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
- this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
GUIMap::Iterator it;
for ( it = myGUIMap.begin(); it != myGUIMap.end(); ++it )
disconnect( application()->desktop(), SIGNAL( windowActivated( SUIT_ViewWindow* ) ),
this, SLOT( onWindowActivated( SUIT_ViewWindow* ) ) );
- disconnect( (STD_Application*)application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
- this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
- disconnect( (STD_Application*)application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
- this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
EmitSignalCloseAllDialogs();
{
if ( vm->getType() == OCCViewer_Viewer::Type() )
{
+ qDebug( "connect" );
+ connect( vm, SIGNAL( keyPress ( SUIT_ViewWindow*, QKeyEvent* ) ),
+ this, SLOT( OnKeyPress( SUIT_ViewWindow*, QKeyEvent* ) ) );
+ connect( vm, SIGNAL( mousePress( SUIT_ViewWindow*, QMouseEvent* ) ),
+ this, SLOT( OnMousePress( SUIT_ViewWindow*, QMouseEvent* ) ) );
+ connect( vm, SIGNAL( mouseMove ( SUIT_ViewWindow*, QMouseEvent* ) ),
+ this, SLOT( OnMouseMove( SUIT_ViewWindow*, QMouseEvent* ) ) );
+
+
LightApp_SelectionMgr* sm = getApp()->selectionMgr();
myOCCSelectors.append( new GEOMGUI_OCCSelector( ((OCCViewer_ViewManager*)vm)->getOCCViewer(), sm ) );
void OnGUIEvent( int id );
- virtual bool OnKeyPress( QKeyEvent*, SUIT_ViewWindow* );
- virtual bool OnMousePress( QMouseEvent*, SUIT_ViewWindow* );
- virtual bool OnMouseMove( QMouseEvent*, SUIT_ViewWindow* );
-
// virtual bool SetSettings();
// virtual void SupportedViewType ( int* buffer, int bufferSize );
virtual void BuildPresentation( const Handle(SALOME_InteractiveObject)&, SUIT_ViewWindow* = 0 );
public slots:
virtual bool deactivateModule( SUIT_Study* );
virtual bool activateModule( SUIT_Study* );
+ virtual void OnKeyPress ( SUIT_ViewWindow*, QKeyEvent* );
+ virtual void OnMousePress( SUIT_ViewWindow*, QMouseEvent* );
+ virtual void OnMouseMove ( SUIT_ViewWindow*, QMouseEvent* );
+
+protected slots:
+ virtual void onViewManagerAdded( SUIT_ViewManager* );
+ virtual void onViewManagerRemoved( SUIT_ViewManager* );
private slots:
void OnGUIEvent();
- void onViewManagerAdded( SUIT_ViewManager* );
- void onViewManagerRemoved( SUIT_ViewManager* );
void onWindowActivated( SUIT_ViewWindow* );
signals :
//The GetPoint() doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
- GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< aResult << " = geompy.GetPoint(" << theShape << ", "
- << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
+ << theX << ", " << theY << ", " << theZ << ", " << theEpsilon << ")";
SetErrorCode(OK);
return aResult;
//The explode doesn't change object so no new function is required.
aFunction = theCompound->GetLastFunction();
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
- GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
- << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
- << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "[" << anAsciiList.ToCString() << "] = geompy.MakeBlockExplode("
+ << theCompound << ", " << theMinNbFaces << ", " << theMaxNbFaces << ")";
SetErrorCode(OK);
return aBlocks;
// The Propagation doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
// Make a Python command
- GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t["
- << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "[" << aListRes.ToCString() << "] = geompy.Propagate(" << theShape << ")";
SetErrorCode(OK);
return aSeq;
*/
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IGroupOperations::CreateGroup
- (Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType)
+ (Handle(GEOM_Object) theMainShape, TopAbs_ShapeEnum theShapeType)
{
SetErrorCode(KO);
//Make a Python command
Handle(GEOM_Function) aFunction = aGroup->GetFunction(1);
- //TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- //GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t" << aGroup
GEOM::TPythonDump(aFunction) << aGroup
- << " = geompy.CreateGroup(" << theMainShape << ", " << (int)theShapeType << ")";
+ << " = geompy.CreateGroup(" << theMainShape << ", " << theShapeType << ")";
SetErrorCode(OK);
- return aGroup;
+ return aGroup;
}
//=============================================================================
}
//Make a Python command
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
-
- GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "geompy.AddObject(" << theGroup << ", " << theSubShapeID << ")";
SetErrorCode(OK);
}
//Make a Python command
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
-
- GEOM::TPythonDump(aFunction) << anOldDescr.ToCString() << "\n\t"
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "geompy.RemoveObject(" << theGroup << ", " << theSubShapeID << ")";
SetErrorCode(OK);
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ Standard_Integer aLen = theSubShapes->Length();
+ if (aLen < 1) {
+ SetErrorCode("The list is empty");
+ return;
+ }
+
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to add
- Standard_Integer i, new_id, aLen = theSubShapes->Length();
+ Standard_Integer i, new_id;
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
aSSI.SetIndices(aNewSeq);
}
- //Make a Python command
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+ //Make a Python command
+ Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes);
+ aLatest = GEOM::GetCreatedLast(aLatest, theGroup);
+ Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction();
- GEOM::TPythonDump pd (aFunction);
- pd << anOldDescr.ToCString() << "\n\t" << "geompy.UnionList(" << theGroup << ", [";
+ GEOM::TPythonDump pd (aLastFunc, /*append=*/true);
+ pd << "geompy.UnionList(" << theGroup << ", [";
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ Standard_Integer aLen = theSubShapes->Length();
+ if (aLen < 1) {
+ SetErrorCode("The list is empty");
+ return;
+ }
+
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to be removed
- Standard_Integer i, rem_id, aLen = theSubShapes->Length();
+ Standard_Integer i, rem_id;
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
}
//Make a Python command
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
+ Handle(GEOM_Object) aLatest = GEOM::GetCreatedLast(theSubShapes);
+ aLatest = GEOM::GetCreatedLast(aLatest, theGroup);
+ Handle(GEOM_Function) aLastFunc = aLatest->GetLastFunction();
- GEOM::TPythonDump pd (aFunction);
- pd << anOldDescr.ToCString() << "\n\t" << "geompy.DifferenceList(" << theGroup << ", [";
+ GEOM::TPythonDump pd (aLastFunc, /*append=*/true);
+ pd << "geompy.DifferenceList(" << theGroup << ", [";
for (i = 1; i <= aLen; i++) {
Handle(GEOM_Object) anObj_i = Handle(GEOM_Object)::DownCast(theSubShapes->Value(i));
SetErrorCode(OK);
}
+
//=============================================================================
/*!
* UnionIDs
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ Standard_Integer aLen = theSubShapes->Length();
+ if (aLen < 1) {
+ SetErrorCode("The list is empty");
+ return;
+ }
+
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to add
- Standard_Integer i, new_id, aLen = theSubShapes->Length();
+ Standard_Integer i, new_id;
for (i = 1; i <= aLen; i++) {
new_id = theSubShapes->Value(i);
aSSI.SetIndices(aNewSeq);
}
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction, /*append=*/true);
+ pd << "geompy.UnionIDs(" << theGroup << ", [";
+ for (i = 1; i < aLen; i++)
+ pd << theSubShapes->Value(i) << ", ";
+ pd << theSubShapes->Value(aLen) << "])";
+
SetErrorCode(OK);
}
SetErrorCode(KO);
if (theGroup.IsNull()) return;
+ Standard_Integer aLen = theSubShapes->Length();
+ if (aLen < 1) {
+ SetErrorCode("The list is empty");
+ return;
+ }
+
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if (aFunction.IsNull()) return;
TopExp::MapShapes(aMainShape, mapIndices);
// Get IDs of sub-shapes to be removed
- Standard_Integer i, rem_id, aLen = theSubShapes->Length();
+ Standard_Integer i, rem_id;
for (i = 1; i <= aLen; i++) {
rem_id = theSubShapes->Value(i);
if (mapIDsCurrent.Contains(rem_id)) {
aSSI.SetIndices(aNewSeq);
}
+ //Make a Python command
+ GEOM::TPythonDump pd (aFunction, /*append=*/true);
+ pd << "geompy.DifferenceIDs(" << theGroup << ", [";
+ for (i = 1; i < aLen; i++)
+ pd << theSubShapes->Value(i) << ", ";
+ pd << theSubShapes->Value(aLen) << "])";
+
SetErrorCode(OK);
}
if (aMainShape.IsNull()) return NULL;
//Make a Python command
- TCollection_AsciiString anOldDescr = aGroupFunction->GetDescription();
-
- GEOM::TPythonDump(aGroupFunction) << anOldDescr.ToCString() << "\n\t"
+ GEOM::TPythonDump(aGroupFunction, /*append=*/true)
<< aMainShape << " = geompy.GetMainShape(" << theGroup << ")";
SetErrorCode(OK);
Handle(TColStd_HArray1OfInteger) GEOMImpl_IGroupOperations::GetObjects(Handle(GEOM_Object) theGroup)
{
SetErrorCode(KO);
-
- if(theGroup.IsNull()) return NULL;
+
+ if(theGroup.IsNull()) return NULL;
Handle(GEOM_Function) aFunction = theGroup->GetFunction(1);
if(aFunction.IsNull()) return NULL;
-
+
GEOM_ISubShape aSSI(aFunction);
Handle(TColStd_HArray1OfInteger) aSeq = aSSI.GetIndices();
if(aSeq.IsNull()) return NULL;
#include <TColStd_HArray1OfInteger.hxx>
#include <vector>
-//#include <iostream>
-
-//#include <OSD_Timer.hxx>
#include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
const Standard_Integer theShapeType,
const Standard_Boolean isSorted)
{
-// OSD_Timer timer1, timer2, timer3, timer4;
-// timer1.Start();
-
SetErrorCode(KO);
if (theShape.IsNull()) return NULL;
return aSeq;
}
-// timer1.Stop();
-// timer2.Start();
-
if (isSorted)
SortShapes(listShape);
-// timer2.Stop();
-// timer3.Start();
-
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aShape, anIndices);
Handle(TColStd_HArray1OfInteger) anArray;
anAsciiList.Trunc(anAsciiList.Length() - 1);
aFunction = theShape->GetLastFunction();
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
- GEOM::TPythonDump pd (aFunction);
- pd << anOldDescr.ToCString() << "\n\t[" << anAsciiList.ToCString();
+ GEOM::TPythonDump pd (aFunction, /*append=*/true);
+ pd << "[" << anAsciiList.ToCString();
pd << "] = geompy.SubShapeAll" << (isSorted ? "Sorted(" : "(");
- pd << theShape << ", " << theShapeType << ")";
+ pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
-// timer4.Stop();
-
-// cout << "Explosure takes:" << endl;
-// timer1.Show();
-// cout << "Sorting takes:" << endl;
-// timer2.Show();
-// cout << "Sub-shapes addition takes:" << endl;
-// timer3.Show();
-// cout << "Update Description takes:" << endl;
-// timer4.Show();
-
return aSeq;
}
}
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
- GEOM::TPythonDump pd (aFunction);
- pd << anOldDescr.ToCString() << "\n\tlistSubShapeIDs = geompy.SubShapeAll";
+ GEOM::TPythonDump pd (aFunction, /*append=*/true);
+ pd << "listSubShapeIDs = geompy.SubShapeAll";
pd << (isSorted ? "SortedIDs(" : "IDs(");
- pd << theShape << ", " << theShapeType << ")";
+ pd << theShape << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
return aSeq;
//The explode doesn't change object so no new function is required.
Handle(GEOM_Function) aFunction = theShape->GetLastFunction();
- TCollection_AsciiString anOldDescr = aFunction->GetDescription();
//Make a Python command
- GEOM::TPythonDump(aFunction) << anOldDescr.ToCString()
- << "\n\tlistFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
+ GEOM::TPythonDump(aFunction, /*append=*/true)
+ << "listFreeFacesIDs = geompy.GetFreeFacesIDs(" << theShape << ")";
SetErrorCode(OK);
return aSeq;
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
<< "] = geompy.GetSharedShapes(" << theShape1 << ", "
- << theShape2 << ", " << theShapeType << ")";
+ << theShape2 << ", " << TopAbs_ShapeEnum(theShapeType) << ")";
SetErrorCode(OK);
return aSeq;
GEOMAlgo_State theState)
{
Handle(TColStd_HSequenceOfInteger) aSeqOfIDs;
-// MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:");
-// OSD_Timer timer1;
-// timer1.Start();
// Check presence of triangulation, build if need
if (!CheckTriangulation(theShape))
// Default value=0
aFinder.SetNbPntsMax(100);
-// timer1.Stop();
-// timer1.Show();
-
-// MESSAGE("--------------------------- Perform on Plane takes:");
-// timer1.Reset();
-// timer1.Start();
aFinder.Perform();
-// timer1.Stop();
-// timer1.Show();
-
-// MESSAGE("--------------------------- GetShapesOnPlane phase 3 takes:");
-// timer1.Reset();
-// timer1.Start();
// Interprete results
Standard_Integer iErr = aFinder.ErrorStatus();
return aSeqOfIDs;
}
-// timer1.Stop();
-// timer1.Show();
-
-// MESSAGE("--------------------------- GetShapesOnPlane phase 4 takes:");
-// timer1.Reset();
-// timer1.Start();
-
// Fill sequence of object IDs
aSeqOfIDs = new TColStd_HSequenceOfInteger;
int id = anIndices.FindIndex(itSub.Value());
aSeqOfIDs->Append(id);
}
-// timer1.Stop();
-// timer1.Show();
+
return aSeqOfIDs;
}
{
SetErrorCode(KO);
-// MESSAGE("--------------------------- GetShapesOnPlane phase 1 takes:");
-// OSD_Timer timer1;
-// timer1.Start();
-
if (theShape.IsNull() || theAx1.IsNull()) return NULL;
TopoDS_Shape aShape = theShape->GetValue();
if ( aSeq.IsNull() || aSeq->Length() == 0 )
return NULL;
-// timer1.Stop();
-// timer1.Show();
-
-// MESSAGE("--------------------------- GetShapesOnPlane phase 5 takes:");
-// timer1.Reset();
-// timer1.Start();
-
// Make a Python command
Handle(GEOM_Object) anObj = Handle(GEOM_Object)::DownCast( aSeq->Value( 1 ));
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
<< "] = geompy.GetShapesOnPlane(" << theShape << ", "
- << theShapeType << ", " << theAx1 << ", " << theState << ")";
+ << aShapeType << ", " << theAx1 << ", " << theState << ")";
SetErrorCode(OK);
return aSeq;
Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
- << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << theShapeType
+ << "] = geompy.GetShapesOnCylinder(" << theShape << ", " << aShapeType
<< ", " << theAxis << ", " << theRadius << ", " << theState << ")";
SetErrorCode(OK);
Handle(GEOM_Function) aFunction = anObj->GetLastFunction();
GEOM::TPythonDump(aFunction) << "[" << anAsciiList.ToCString()
- << "] = geompy.GetShapesOnSphere(" << theShape << ", " << theShapeType
+ << "] = geompy.GetShapesOnSphere(" << theShape << ", " << aShapeType
<< ", " << theCenter << ", " << theRadius << ", " << theState << ")";
SetErrorCode(OK);
return aSeq;
}
-//=======================================================================
-//function : getCreatedLast
- /*!
- * \brief Select the object created last
- * \param theObj1 - Object 1
- * \param theObj2 - Object 2
- * \retval Handle(GEOM_Object) - selected object
- */
-//=======================================================================
-
-Handle(GEOM_Object) GEOMImpl_IShapesOperations::getCreatedLast(const Handle(GEOM_Object)& theObj1,
- const Handle(GEOM_Object)& theObj2)
-{
- if ( theObj1.IsNull() ) return theObj2;
- if ( theObj2.IsNull() ) return theObj1;
- return ( theObj1->GetEntry().Tag() > theObj2->GetEntry().Tag() ) ? theObj1 : theObj2;
-}
-
//=============================================================================
/*!
* GetShapesOnPlaneIDs
aSeq = getShapesOnSurfaceIDs( aPlane, aShape, aShapeType, theState );
// The GetShapesOnPlaneIDs() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAx1)->GetLastFunction();
+ Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAx1)->GetLastFunction();
// Make a Python command
- const bool append = true;
- GEOM::TPythonDump(aFunction,append)
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnPlane = geompy.GetShapesOnPlaneIDs"
- << "(" << theShape << "," << theShapeType << "," << theAx1 << "," << theState << ")";
+ << "(" << theShape << "," << aShapeType << "," << theAx1 << "," << theState << ")";
SetErrorCode(OK);
return aSeq;
aSeq = getShapesOnSurfaceIDs( aCylinder, aShape, aShapeType, theState );
// The GetShapesOnCylinder() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theAxis)->GetLastFunction();
+ Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theAxis)->GetLastFunction();
// Make a Python command
- const bool append = true;
- GEOM::TPythonDump(aFunction,append)
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
- << "(" << theShape << ", " << theShapeType << ", " << theAxis << ", "
+ << "(" << theShape << ", " << aShapeType << ", " << theAxis << ", "
<< theRadius << ", " << theState << ")";
SetErrorCode(OK);
aSeq = getShapesOnSurfaceIDs( aSphere, aShape, aShapeType, theState );
// The GetShapesOnSphere() doesn't change object so no new function is required.
- Handle(GEOM_Function) aFunction = getCreatedLast(theShape,theCenter)->GetLastFunction();
+ Handle(GEOM_Function) aFunction = GEOM::GetCreatedLast(theShape,theCenter)->GetLastFunction();
// Make a Python command
- const bool append = true;
- GEOM::TPythonDump(aFunction,append)
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnCylinder = geompy.GetShapesOnCylinderIDs"
- << "(" << theShape << ", " << theShapeType << ", " << theCenter << ", "
+ << "(" << theShape << ", " << aShapeType << ", " << theCenter << ", "
<< theRadius << ", " << theState << ")";
SetErrorCode(OK);
GEOM::TPythonDump(aFunction)
<< "[" << anAsciiList.ToCString() << "] = geompy.GetShapesOnQuadrangle("
<< theShape << ", "
- << theShapeType << ", "
+ << TopAbs_ShapeEnum(theShapeType) << ", "
<< theTopLeftPoint << ", "
<< theTopRigthPoint << ", "
<< theBottomLeftPoint << ", "
// Make a Python command
// The GetShapesOnCylinder() doesn't change object so no new function is required.
- Handle(GEOM_Object) lastObj = getCreatedLast(theShape,theTopLeftPoint);
- lastObj = getCreatedLast(lastObj,theTopRigthPoint);
- lastObj = getCreatedLast(lastObj,theBottomRigthPoint);
- lastObj = getCreatedLast(lastObj,theBottomLeftPoint);
+ Handle(GEOM_Object) lastObj = GEOM::GetCreatedLast(theShape,theTopLeftPoint);
+ lastObj = GEOM::GetCreatedLast(lastObj,theTopRigthPoint);
+ lastObj = GEOM::GetCreatedLast(lastObj,theBottomRigthPoint);
+ lastObj = GEOM::GetCreatedLast(lastObj,theBottomLeftPoint);
Handle(GEOM_Function) aFunction = lastObj->GetLastFunction();
- const bool append = true;
- GEOM::TPythonDump(aFunction,append)
+ GEOM::TPythonDump(aFunction, /*append=*/true)
<< "listShapesOnQuadrangle = geompy.GetShapesOnQuadrangleIDs("
<< theShape << ", "
- << theShapeType << ", "
+ << TopAbs_ShapeEnum(theShapeType) << ", "
<< theTopLeftPoint << ", "
<< theTopRigthPoint << ", "
<< theBottomLeftPoint << ", "
MidXYZ.SetValue(Index,
GPoint.X()*999 + GPoint.Y()*99 + GPoint.Z()*0.9);
}
+
// Sorting
Standard_Integer aTemp;
Standard_Boolean exchange, Sort = Standard_True;
//=======================================================================
bool GEOMImpl_IShapesOperations::CheckTriangulation (const TopoDS_Shape& aShape)
{
-// MESSAGE("CheckTriangulation");
-//
-// OSD_Timer timer1;
-// timer1.Start();
-
TopExp_Explorer exp (aShape, TopAbs_FACE);
if (!exp.More()) {
SetErrorCode("Shape without faces given");
Standard_Real dx = aXmax - aXmin, dy = aYmax - aYmin, dz = aZmax - aZmin;
Standard_Real aDeflection = Max(Max(dx, dy), dz) * aDeviationCoefficient * 4;
-
-// MESSAGE("Deflection = " << aDeflection);
-
Standard_Real aHLRAngle = 0.349066;
BRepMesh_IncrementalMesh Inc (aShape, aDeflection, Standard_False, aHLRAngle);
}
-// timer1.Stop();
-// timer1.Show();
return true;
}
# additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lCASCatch -lGEOMbasic -lNMTAlgo -lGEOMAlgo -lShHealOper
+LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(CAS_LDPATH) -lTKCAF -lTKFillet -lTKOffset -lGEOMbasic -lNMTAlgo -lGEOMAlgo -lShHealOper
# additional file to be cleaned
#include "GeometryGUI.h"
#include "GEOMToolsGUI_TransparencyDlg.h"
#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement
-#include "GEOMToolsGUI_NameDlg.h"
#include "GEOM_Actor.h"
#include "GEOMBase.h"
#include <SUIT_MessageBox.h>
#include <SalomeApp_Application.h>
-#include <LightApp_SelectionMgr.h>
#include <SalomeApp_Study.h>
#include <SalomeApp_Module.h>
+#include <LightApp_SelectionMgr.h>
+#include <LightApp_NameDlg.h>
+
#include "SALOMEDSClient.hxx"
#include "utilities.h"
if( obj->FindAttribute(anAttr, "AttributeName") ) {
_PTR(AttributeName) aName (anAttr);
- QString newName = GEOMToolsGUI_NameDlg::getName( app->desktop(), aName->Value().c_str() );
+ QString newName = LightApp_NameDlg::getName( app->desktop(), aName->Value().c_str() );
if ( !newName.isEmpty() ) {
aName->SetValue( newName.latin1() ); // rename the SObject
IObject->setName( newName.latin1() );// rename the InteractiveObject
+++ /dev/null
-// SALOME GEOMToolsGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : GEOMToolsGUI_NameDlg.cxx
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-
-#include "GEOMToolsGUI_NameDlg.h"
-#include <SUIT_Session.h>
-#include <SUIT_Application.h>
-#include <SUIT_Desktop.h>
-#include <SUIT_Tools.h>
-
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlayout.h>
-
-//using namespace std;
-/*!
- Constructor
-*/
-GEOMToolsGUI_NameDlg::GEOMToolsGUI_NameDlg( QWidget* parent )
- : QDialog( parent ? parent : SUIT_Session::session()->activeApplication()->desktop(),
- "GEOMToolsGUI_NameDlg",
- true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
-{
- setCaption( tr("TLT_RENAME") );
- setSizeGripEnabled( TRUE );
-
- QVBoxLayout* topLayout = new QVBoxLayout( this );
- topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
-
- /***************************************************************/
- QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
- GroupC1->setColumnLayout(0, Qt::Vertical );
- GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 );
- QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() );
- GroupC1Layout->setAlignment( Qt::AlignTop );
- GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 );
-
- QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" );
- TextLabel->setText( tr( "NAME_LBL" ) );
- GroupC1Layout->addWidget( TextLabel );
-
- myLineEdit = new QLineEdit( GroupC1, "LineEdit1" );
- myLineEdit->setMinimumSize( 250, 0 );
- GroupC1Layout->addWidget( myLineEdit );
-
- /***************************************************************/
- QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
- GroupButtons->setColumnLayout(0, Qt::Vertical );
- GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 );
- QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() );
- GroupButtonsLayout->setAlignment( Qt::AlignTop );
- GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 );
-
- myButtonOk = new QPushButton( GroupButtons, "buttonOk" );
- myButtonOk->setText( tr( "GEOM_BUT_OK" ) );
- myButtonOk->setAutoDefault( TRUE );
- myButtonOk->setDefault( TRUE );
- GroupButtonsLayout->addWidget( myButtonOk );
-
- GroupButtonsLayout->addStretch();
-
- myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" );
- myButtonCancel->setText( tr( "GEOM_BUT_CANCEL" ) );
- myButtonCancel->setAutoDefault( TRUE );
- GroupButtonsLayout->addWidget( myButtonCancel );
- /***************************************************************/
-
- topLayout->addWidget( GroupC1 );
- topLayout->addWidget( GroupButtons );
-
- // signals and slots connections
- connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-
- /* Move widget on the botton right corner of main widget */
- SUIT_Tools::centerWidget( this, parent );
-}
-
-/*!
- Destructor
-*/
-GEOMToolsGUI_NameDlg::~GEOMToolsGUI_NameDlg()
-{
-}
-
-/*!
- Sets name
-*/
-void GEOMToolsGUI_NameDlg::setName( const QString& name )
-{
- myLineEdit->setText( name );
- myLineEdit->end(false);
- myLineEdit->home(true);
-}
-
-/*!
- Returns name entered by user
-*/
-QString GEOMToolsGUI_NameDlg::name()
-{
- return myLineEdit->text();
-}
-
-void GEOMToolsGUI_NameDlg::accept()
-{
- if ( name().stripWhiteSpace().isEmpty() )
- return;
- QDialog::accept();
-}
-
-/*!
- Creates modal <Rename> dialog and returns name entered [ static ]
-*/
-QString GEOMToolsGUI_NameDlg::getName( QWidget* parent, const QString& oldName )
-{
- QString n;
- GEOMToolsGUI_NameDlg* dlg = new GEOMToolsGUI_NameDlg( parent );
- if ( !oldName.isNull() )
- dlg->setName( oldName );
- if ( dlg->exec() == QDialog::Accepted )
- n = dlg->name();
- delete dlg;
- return n;
-}
+++ /dev/null
-// SALOME GEOMToolsGUI : implementation of desktop and GUI kernel
-//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
-//
-//
-// File : GEOMToolsGUI_NameDlg.h
-// Author : Vadim SANDLER
-// Module : SALOME
-// $Header$
-
-#ifndef GEOMToolsGUI_NAMEDLG_H
-#define GEOMToolsGUI_NAMEDLG_H
-
-#include <qdialog.h>
-
-class QLineEdit;
-class QPushButton;
-
-//=================================================================================
-// class : GEOMToolsGUI_NameDlg
-// purpose : Common <Rename> dialog box class
-//=================================================================================
-class GEOMToolsGUI_NameDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- GEOMToolsGUI_NameDlg( QWidget* parent = 0 );
- ~GEOMToolsGUI_NameDlg();
-
- void setName( const QString& name );
- QString name();
-
- static QString getName( QWidget* parent = 0, const QString& oldName = QString::null );
-
-protected slots:
- void accept();
-
-private:
- QPushButton* myButtonOk;
- QPushButton* myButtonCancel;
- QLineEdit* myLineEdit;
-};
-
-#endif // GEOMToolsGUI_NAMEDLG_H
LIB = libGEOMToolsGUI.la
# header files
-EXPORT_HEADERS=
+EXPORT_HEADERS =
LIB_SRC = GEOMToolsGUI.cxx \
GEOMToolsGUI_1.cxx \
GEOMToolsGUI_TransparencyDlg.cxx \
- GEOMToolsGUI_NbIsosDlg.cxx \
- GEOMToolsGUI_NameDlg.cxx
+ GEOMToolsGUI_NbIsosDlg.cxx
LIB_MOC = GEOMToolsGUI_TransparencyDlg.h \
- GEOMToolsGUI_NbIsosDlg.h \
- GEOMToolsGUI_NameDlg.h
+ GEOMToolsGUI_NbIsosDlg.h
LIB_CLIENT_IDL = SALOMEDS_Attributes.idl \
SALOME_GenericObj.idl \
#include <TCollection_AsciiString.hxx>
#include <TColStd_HArray1OfInteger.hxx>
#include <TopAbs_ShapeEnum.hxx>
+#include <OSD.hxx>
#include "SALOMEDS_Tool.hxx"
_impl = new ::GEOMImpl_Gen;
+ OSD::SetSignal( true );
}
geompy.AddObject(CreateGroup, f_ind_6) # box_faces[5]
geompy.AddObject(CreateGroup, f_ind_1) # box_faces[0]
geompy.AddObject(CreateGroup, f_ind_4) # box_faces[3]
+ # Now contains f_ind_6, f_ind_1, f_ind_4
# UnionList
geompy.UnionList(CreateGroup, [box_faces[2], box_faces[4], box_faces[5]])
+ # Now contains f_ind_6, f_ind_1, f_ind_4, f_ind_3, f_ind_5
# RemoveObject(theGroup, theSubShapeID)
geompy.RemoveObject(CreateGroup, f_ind_1) # box_faces[0]
+ # Now contains f_ind_6, f_ind_4, f_ind_3, f_ind_5
# DifferenceList
geompy.DifferenceList(CreateGroup, [box_faces[1], box_faces[0], box_faces[3]])
+ # Now contains f_ind_6, f_ind_3, f_ind_5
# GetObjectIDs
GetObjectIDs = geompy.GetObjectIDs(CreateGroup)
BoxCopy = geompy.GetMainShape(CreateGroup)
+ # DifferenceIDs
+ geompy.DifferenceIDs(CreateGroup, [f_ind_3, f_ind_5])
+ # Now contains f_ind_6
+
+ # UnionIDs
+ geompy.UnionIDs(CreateGroup, [f_ind_1, f_ind_2, f_ind_6])
+ # Now contains f_ind_6, f_ind_1, f_ind_2
+
+ # Check
+ GetObjectIDs = geompy.GetObjectIDs(CreateGroup)
+ print "Group of Box's faces includes the following IDs:"
+ print "(must be ", f_ind_6, ", ", f_ind_1, " and ", f_ind_2, ")"
+ for ObjectID in GetObjectIDs:
+ print " ", ObjectID
+
# -----------------------------------------------------------------------------
# enumeration ShapeTypeString as a dictionary
# -----------------------------------------------------------------------------
for face_i in faces_on_pln:
geompy.addToStudy(face_i, "Face on Plane (N = (0, 1, 1)) or below it")
+ # GetShapesOnPlaneIDs
+ faces_above_pln_ids = geompy.GetShapesOnPlaneIDs(blocksComp, geompy.ShapeType["FACE"],
+ v_0pp, geompy.GEOM.ST_OUT)
+ faces_above = geompy.CreateGroup(blocksComp, geompy.ShapeType["FACE"])
+ geompy.UnionIDs(faces_above, faces_above_pln_ids)
+ geompy.addToStudy(faces_above, "Group of faces above Plane (N = (0, 1, 1))")
+
# GetShapesOnCylinder
- edges_on_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"],
- vy, 55, geompy.GEOM.ST_OUT)
- for edge_i in edges_on_cyl:
+ edges_out_cyl = geompy.GetShapesOnCylinder(blocksComp, geompy.ShapeType["EDGE"],
+ vy, 55, geompy.GEOM.ST_OUT)
+ for edge_i in edges_out_cyl:
geompy.addToStudy(edge_i, "Edge out of Cylinder (axis = (0, 1, 0), r = 55)")
+ # GetShapesOnCylinderIDs
+ edges_in_cyl_ids = geompy.GetShapesOnCylinderIDs(blocksComp, geompy.ShapeType["EDGE"],
+ vy, 55, geompy.GEOM.ST_IN)
+ edges_in = geompy.CreateGroup(blocksComp, geompy.ShapeType["EDGE"])
+ geompy.UnionIDs(edges_in, edges_in_cyl_ids)
+ geompy.addToStudy(edges_in, "Group of edges inside Cylinder (axis = (0, 1, 0), r = 55)")
+
# GetShapesOnSphere
vertices_on_sph = geompy.GetShapesOnSphere(blocksComp, geompy.ShapeType["VERTEX"],
p0, 100, geompy.GEOM.ST_ON)
geompy.addToStudy(vertex_i, "Vertex on Sphere (center = (0, 0, 0), r = 100)")
pass
+ # GetShapesOnSphereIDs
+ vertices_on_sph_ids = geompy.GetShapesOnSphereIDs(blocksComp, geompy.ShapeType["VERTEX"],
+ p0, 100, geompy.GEOM.ST_ON)
+ vertices_on = geompy.CreateGroup(blocksComp, geompy.ShapeType["VERTEX"])
+ geompy.UnionIDs(vertices_on, vertices_on_sph_ids)
+ geompy.addToStudy(vertices_on, "Group of vertices on Sphere (center = (0, 0, 0), r = 100)")
+
# GetShapesOnQuadrangle
geompy.addToStudy(f12, "F12" )
print "Error in GetShapesOnQuadrangle()"
pass
+ # GetShapesOnQuadrangleIDs
+ vertices_on_quad_ids = geompy.GetShapesOnQuadrangleIDs(f12, geompy.ShapeType["VERTEX"],
+ tl, tr, bl, br, geompy.GEOM.ST_ON)
+ vertices_on_quad = geompy.CreateGroup(f12, geompy.ShapeType["VERTEX"])
+ geompy.UnionIDs(vertices_on_quad, vertices_on_quad_ids)
+ geompy.addToStudy(vertices_on_quad, "Group of vertices on Quadrangle F12")
+
# GetInPlace(theShapeWhere, theShapeWhat)
box5 = geompy.MakeBoxDXDYDZ(100, 100, 100)
box6 = geompy.MakeTranslation(box5, 50, 50, 0)
def GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
+
+ * Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnPlaneIDs(theShape, theShapeType, theAx1, theState)
if ShapesOp.IsDone() == 0:
def GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
+
+ * Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnCylinderIDs(theShape, theShapeType, theAxis, theRadius, theState)
if ShapesOp.IsDone() == 0:
def GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
+
+ * Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnSphereIDs(theShape, theShapeType, theCenter, theRadius, theState)
if ShapesOp.IsDone() == 0:
def GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState):
"""
* Works like the above method, but returns list of sub-shapes indices
+
+ * Example: see GEOM_TestOthers.py
"""
aList = ShapesOp.GetShapesOnQuadrangleIDs(theShape, theShapeType, theTopLeftPoint, theTopRigthPoint, theBottomLeftPoint, theBottomRigthPoint, theState)
if ShapesOp.IsDone() == 0:
"""
* Works like the above method, but argument
* theSubShapes here is a list of sub-shapes indices
+
+ * Example: see GEOM_TestOthers.py
"""
GroupOp.UnionIDs(theGroup, theSubShapes)
if GroupOp.IsDone() == 0:
"""
* Works like the above method, but argument
* theSubShapes here is a list of sub-shapes indices
+
+ * Example: see GEOM_TestOthers.py
"""
GroupOp.DifferenceIDs(theGroup, theSubShapes)
if GroupOp.IsDone() == 0:
// try to find out and process the object browser selection
if ( !aMapIndex.Extent() ) {
+ globalSelection( GEOM_ALLSHAPES );
+
GEOM::ListOfGO anObjects;
GEOMBase::ConvertListOfIOInListOfGO(selectedIO(), anObjects);
GEOM::GEOM_ILocalOperations_var aLocOp = getGeomEngine()->GetILocalOperations( getStudyId() );
aMapIndex.Add( anIndex );
}
}
+
+ if ( !myMainObj->_is_nil() )
+ localSelection( myMainObj, getShapeType() );
}
if (aMapIndex.Extent() >= 1) {
RETURN_WITH_MSG( !CORBA::is_nil( myMainObj ), tr( "NO_GROUP" ) )
}
- const char* aName = getNewObjectName();
- RETURN_WITH_MSG ( aName && strlen( aName ), tr( "EMPTY_NAME" ) )
+ QString aName (getNewObjectName());
+ RETURN_WITH_MSG ( !aName.stripWhiteSpace().isEmpty(), tr( "EMPTY_NAME" ) )
RETURN_WITH_MSG ( myIdList->count(), tr( "EMPTY_LIST" ) )
return true;