mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-25 08:50:36 +05:00
GPUSPHGUI: add an option to Offset Surface opreation
definig a mode of filling the gap between adjacent translated surfaces: - by pipes or - by intersection
This commit is contained in:
parent
ba2e210e02
commit
939f3cca95
@ -11,13 +11,16 @@ gg = salome.ImportComponentGUI("GEOM")
|
||||
box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
|
||||
|
||||
# create a new object as offset of the given object
|
||||
offset = geompy.MakeOffset(box, 70.)
|
||||
offset = geompy.MakeOffset(box, 70.)
|
||||
offset2 = geompy.MakeOffsetIntersectionJoin(box, 70.)
|
||||
|
||||
# add objects in the study
|
||||
id_box = geompy.addToStudy(box, "Box")
|
||||
id_offset = geompy.addToStudy(offset, "Offset")
|
||||
id_offset2 = geompy.addToStudy(offset2, "Offset_intersection_join")
|
||||
|
||||
# display the results
|
||||
gg.createAndDisplayGO(id_box)
|
||||
gg.setDisplayMode(id_box,1)
|
||||
gg.createAndDisplayGO(id_offset)
|
||||
gg.createAndDisplayGO(id_offset)
|
||||
gg.createAndDisplayGO(id_offset2)
|
||||
|
BIN
doc/salome/gui/GEOM/images/transformation11.png
Executable file → Normal file
BIN
doc/salome/gui/GEOM/images/transformation11.png
Executable file → Normal file
Binary file not shown.
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 17 KiB |
@ -7,7 +7,12 @@
|
||||
|
||||
\n This operation translates each point of an \b Object (a set of
|
||||
Objects) along a local normal by a given \b Offset distance (signed
|
||||
number, negative value meaning inner offset).
|
||||
number, negative value meaning inner offset). Gaps between translated
|
||||
adjacent surfaces are filled in either of two ways:
|
||||
- if <b>Join by pipes</b> is activated, they are filled with pipes;
|
||||
- else the surfaces are extended and intersected, so that sharp edges
|
||||
are preserved.
|
||||
|
||||
\n \b Offset operation is applicable to faces, shells and solids.
|
||||
\n \ref restore_presentation_parameters_page "Advanced options".
|
||||
|
||||
@ -16,9 +21,12 @@ number, negative value meaning inner offset).
|
||||
|
||||
\n <b>Example:</b>
|
||||
|
||||
\image html offsetsn.png "The box and its offset surface"
|
||||
\image html offsetsn.png "The box and its offset surface (Join by pipes activated)"
|
||||
|
||||
\n <b>TUI Command:</b>
|
||||
- Gaps filled by pipes: <em>geompy.MakeOffset(Shape, Offset),</em>
|
||||
- Gaps filled by intersection: <em>geompy.MakeOffsetIntersectionJoin(Shape, Offset),</em>
|
||||
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeOffset(Shape, Offset),</em>
|
||||
where Shape is a shape(s) which has to be an offset, Offset is a value of
|
||||
the offset.
|
||||
\n <b>Arguments:</b> Name + Object (face(s), shell(s), solid(s)) +
|
||||
|
@ -1300,17 +1300,23 @@ module GEOM
|
||||
* \brief Replace the given object by its offset.
|
||||
* \param theObject The base object for the offset.
|
||||
* \param theOffset Offset value.
|
||||
* \param theJoinByPipes To join offset surfaces by pipes or by intersection.
|
||||
* \return theObject.
|
||||
*/
|
||||
GEOM_Object OffsetShape (in GEOM_Object theObject, in double theOffset);
|
||||
GEOM_Object OffsetShape (in GEOM_Object theObject,
|
||||
in double theOffset,
|
||||
in boolean theJoinByPipes);
|
||||
|
||||
/*!
|
||||
* \brief Create new object as offset of the given one.
|
||||
* \param theObject The base object for the offset.
|
||||
* \param theOffset Offset value.
|
||||
* \param theJoinByPipes To join offset surfaces by pipes or by intersection.
|
||||
* \return New GEOM_Object, containing the offset object.
|
||||
*/
|
||||
GEOM_Object OffsetShapeCopy (in GEOM_Object theObject, in double theOffset);
|
||||
GEOM_Object OffsetShapeCopy (in GEOM_Object theObject,
|
||||
in double theOffset,
|
||||
in boolean theJoinByPipes);
|
||||
|
||||
/*!
|
||||
* \brief Create new object as projection of the given one on a 2D surface.
|
||||
|
@ -7816,6 +7816,13 @@ Do you want to create new material?</translation>
|
||||
<translation>Rotation angle</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>TransformationGUI_OffsetDlg</name>
|
||||
<message>
|
||||
<source>GEOM_JOIN_BY_PIPES</source>
|
||||
<translation>Join by pipes</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>OperationGUI_ExtractionDlg</name>
|
||||
<message>
|
||||
|
@ -29,6 +29,7 @@
|
||||
#define OFF_ARG_VALUE 2
|
||||
#define OFF_ARG_IDS 3
|
||||
#define OFF_ARG_PARAM 4
|
||||
#define OFF_ARG_JOIN 5
|
||||
|
||||
class GEOMImpl_IOffset
|
||||
{
|
||||
@ -48,6 +49,10 @@ class GEOMImpl_IOffset
|
||||
|
||||
Standard_Boolean GetParam() { return _func->GetInteger(OFF_ARG_PARAM); }
|
||||
|
||||
void SetJoinByPipes(Standard_Boolean theValue) { _func->SetInteger(OFF_ARG_JOIN, theValue); }
|
||||
|
||||
Standard_Boolean GetJoinByPipes() { return _func->GetInteger(OFF_ARG_JOIN); }
|
||||
|
||||
void SetFaceIDs(const Handle(TColStd_HArray1OfInteger)& theFaceIDs)
|
||||
{ _func->SetIntegerArray(OFF_ARG_IDS, theFaceIDs); }
|
||||
|
||||
|
@ -1036,8 +1036,10 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::MirrorAxisCopy
|
||||
* OffsetShape
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
|
||||
(Handle(GEOM_Object) theObject, double theOffset)
|
||||
Handle(GEOM_Object)
|
||||
GEOMImpl_ITransformOperations::OffsetShape (Handle(GEOM_Object) theObject,
|
||||
double theOffset,
|
||||
bool theJoinByPipes)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -1055,8 +1057,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IOffset aTI (aFunction);
|
||||
aTI.SetShape(anOriginal);
|
||||
aTI.SetValue(theOffset);
|
||||
aTI.SetShape( anOriginal );
|
||||
aTI.SetValue( theOffset );
|
||||
aTI.SetJoinByPipes( theJoinByPipes );
|
||||
|
||||
//Compute the offset
|
||||
try {
|
||||
@ -1084,8 +1087,10 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShape
|
||||
* OffsetShapeCopy
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
|
||||
(Handle(GEOM_Object) theObject, double theOffset)
|
||||
Handle(GEOM_Object)
|
||||
GEOMImpl_ITransformOperations::OffsetShapeCopy( Handle(GEOM_Object) theObject,
|
||||
double theOffset,
|
||||
bool theJoinByPipes)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -1106,8 +1111,9 @@ Handle(GEOM_Object) GEOMImpl_ITransformOperations::OffsetShapeCopy
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_OffsetDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_IOffset aTI (aFunction);
|
||||
aTI.SetShape(anOriginal);
|
||||
aTI.SetValue(theOffset);
|
||||
aTI.SetShape( anOriginal );
|
||||
aTI.SetValue( theOffset );
|
||||
aTI.SetJoinByPipes( theJoinByPipes );
|
||||
|
||||
//Compute the offset
|
||||
try {
|
||||
|
@ -105,10 +105,12 @@ class GEOMImpl_ITransformOperations : public GEOM_IOperations
|
||||
Handle(GEOM_Object) thePoint);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) OffsetShape (Handle(GEOM_Object) theObject,
|
||||
double theOffset);
|
||||
double theOffset,
|
||||
bool theJoinByPipes);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) OffsetShapeCopy (Handle(GEOM_Object) theObject,
|
||||
double theOffset);
|
||||
double theOffset,
|
||||
bool theJoinByPipes);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) ProjectShapeCopy (Handle(GEOM_Object) theSource,
|
||||
Handle(GEOM_Object) theTarget);
|
||||
|
@ -86,11 +86,20 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(Handle(TFunction_Logbook)& log)
|
||||
StdFail_NotDone::Raise(aMsg.ToCString());
|
||||
}
|
||||
|
||||
if (aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY) {
|
||||
BRepOffsetAPI_MakeOffsetShape MO (aShapeBase,
|
||||
aCI.GetValue(),
|
||||
aTol);
|
||||
if (MO.IsDone()) {
|
||||
if ( aType == OFFSET_SHAPE || aType == OFFSET_SHAPE_COPY )
|
||||
{
|
||||
BRepOffsetAPI_MakeOffsetShape MO;
|
||||
BRepOffset_Mode aMode = BRepOffset_Skin;
|
||||
Standard_Boolean anIntersection = Standard_False, aSelfInter = Standard_False;
|
||||
MO.PerformByJoin( aShapeBase,
|
||||
aCI.GetValue(),
|
||||
aTol,
|
||||
aMode,
|
||||
anIntersection,
|
||||
aSelfInter,
|
||||
aCI.GetJoinByPipes() ? GeomAbs_Arc : GeomAbs_Intersection );
|
||||
|
||||
if ( MO.IsDone() ) {
|
||||
aShape = MO.Shape();
|
||||
if ( !GEOMUtils::CheckShape(aShape, true) && !GEOMUtils::FixShapeTolerance(aShape) )
|
||||
Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
|
||||
|
@ -313,6 +313,8 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy,
|
||||
aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_GROUP_SOLID");
|
||||
aNamePrefix = "Group_Of_Solids_";
|
||||
break;
|
||||
default:
|
||||
aNamePrefix = "Group_";
|
||||
}
|
||||
} else if ( mytype == GEOM_MARKER ) {
|
||||
aResultSO->SetAttrString("AttributePixMap","ICON_OBJBROWSER_LCS");
|
||||
@ -2548,7 +2550,7 @@ GEOM::GEOM_Object_ptr GEOM_Gen_i::AddSubShape (GEOM::GEOM_Object_ptr theMainSh
|
||||
if (aMainShape.IsNull()) return GEOM::GEOM_Object::_nil();
|
||||
|
||||
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1, theIndices.length());
|
||||
for(Standard_Integer i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
|
||||
for(CORBA::ULong i = 0; i<theIndices.length(); i++) anArray->SetValue(i+1, theIndices[i]);
|
||||
|
||||
Handle(::GEOM_Object) anObject = _impl->AddSubShape(aMainShape, anArray, true);
|
||||
if(anObject.IsNull()) return GEOM::GEOM_Object::_nil();
|
||||
@ -2933,7 +2935,7 @@ void GEOM_Gen_i::Move( const GEOM::object_list& what,
|
||||
}
|
||||
}
|
||||
|
||||
for ( int i = 0; i < what.length(); i++ ) {
|
||||
for ( CORBA::ULong i = 0; i < what.length(); i++ ) {
|
||||
SALOMEDS::SObject_var sobj = what[i];
|
||||
if ( CORBA::is_nil( sobj ) ) continue; // skip bad object
|
||||
// insert the object to the use case tree
|
||||
@ -2954,7 +2956,7 @@ SALOMEDS::TMPFile* GEOM_Gen_i::GetDependencyTree( SALOMEDS::Study_ptr theStudy,
|
||||
GEOMUtils::TreeModel tree;
|
||||
|
||||
std::string entry;
|
||||
for ( int i = 0; i < theObjectEntries.length(); i++ ) {
|
||||
for ( CORBA::ULong i = 0; i < theObjectEntries.length(); i++ ) {
|
||||
// process objects one-by-one
|
||||
entry = theObjectEntries[i].in();
|
||||
GEOM::GEOM_BaseObject_var anObj = GetObject( theStudy->StudyId(), entry.c_str() );
|
||||
@ -2997,7 +2999,7 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||
GEOMUtils::NodeLinks anEntries;
|
||||
GEOMUtils::LevelInfo aLevelMap;
|
||||
if ( level > 0 ) {
|
||||
if ( level-1 >= upLevelList.size() ) {
|
||||
if ( level-1 >= (int)upLevelList.size() ) {
|
||||
// create a new map
|
||||
upLevelList.push_back( aLevelMap );
|
||||
} else {
|
||||
@ -3011,7 +3013,7 @@ void GEOM_Gen_i::getUpwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||
// get objects on that the current one depends
|
||||
GEOM::ListOfGBO_var depList = gbo->GetDependency();
|
||||
std::string aDepEntry;
|
||||
for( int j = 0; j < depList->length(); j++ ) {
|
||||
for( CORBA::ULong j = 0; j < depList->length(); j++ ) {
|
||||
if ( depList[j]->_is_nil() )
|
||||
continue;
|
||||
aDepEntry = depList[j]->GetEntry();
|
||||
@ -3067,7 +3069,7 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||
continue;
|
||||
std::string aGoEntry = geomObj->GetEntry();
|
||||
// go through dependencies of current object to check whether it depends on the given object
|
||||
for( int i = 0; i < depList->length(); i++ ) {
|
||||
for( CORBA::ULong i = 0; i < depList->length(); i++ ) {
|
||||
if ( depList[i]->_is_nil() )
|
||||
continue;
|
||||
if ( depList[i]->_is_equivalent( gbo ) ) {
|
||||
@ -3081,7 +3083,7 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||
GEOMUtils::NodeLinks anEntries;
|
||||
GEOMUtils::LevelInfo aLevelMap;
|
||||
anEntries.push_back( aGboEntry );
|
||||
if ( level >= downLevelList.size() ) {
|
||||
if ( level >= (int)downLevelList.size() ) {
|
||||
downLevelList.push_back( aLevelMap );
|
||||
} else {
|
||||
aLevelMap = downLevelList.at(level);
|
||||
@ -3105,13 +3107,13 @@ void GEOM_Gen_i::getDownwardDependency( GEOM::GEOM_BaseObject_ptr gbo,
|
||||
// purpose : Fills 3 lists that is used to clean study of redundant objects
|
||||
//==============================================================================
|
||||
void GEOM_Gen_i::GetEntriesToReduceStudy(SALOMEDS::Study_ptr theStudy,
|
||||
GEOM::string_array& theSelectedEntries,
|
||||
GEOM::string_array& theParentEntries,
|
||||
GEOM::string_array& theSubEntries,
|
||||
GEOM::string_array& theOtherEntries)
|
||||
GEOM::string_array& theSelectedEntries,
|
||||
GEOM::string_array& theParentEntries,
|
||||
GEOM::string_array& theSubEntries,
|
||||
GEOM::string_array& theOtherEntries)
|
||||
{
|
||||
std::set<std::string> aSelected, aParents, aChildren, anOthers;
|
||||
for ( int i = 0; i < theSelectedEntries.length(); i++ ) {
|
||||
for ( CORBA::ULong i = 0; i < theSelectedEntries.length(); i++ ) {
|
||||
aSelected.insert( CORBA::string_dup( theSelectedEntries[i] ) );
|
||||
}
|
||||
|
||||
@ -3237,7 +3239,7 @@ void GEOM_Gen_i::includeParentDependencies(GEOM::GEOM_BaseObject_ptr geomObj,
|
||||
return;
|
||||
// go through dependencies of current object to check whether it depends on the given object
|
||||
std::string aDepEntry;
|
||||
for( int i = 0; i < depList->length(); i++ ) {
|
||||
for( CORBA::ULong i = 0; i < depList->length(); i++ ) {
|
||||
aDepEntry = depList[i]->GetEntry();
|
||||
if ( depList[i]->_is_nil() ||
|
||||
aDepEntry == anEntry || // skip self-depending
|
||||
|
@ -68,7 +68,7 @@
|
||||
//=====================================================================
|
||||
class GEOM_I_EXPORT GEOM_GenericOperationsCreator
|
||||
{
|
||||
public:
|
||||
public:
|
||||
// Create operations
|
||||
virtual GEOM_IOperations_i* Create (PortableServer::POA_ptr thePOA,
|
||||
int theStudyId,
|
||||
@ -76,6 +76,7 @@ public:
|
||||
::GEOMImpl_Gen* theGenImpl) = 0;
|
||||
// return the name of IDL module
|
||||
//virtual std::string GetModuleName() = 0;
|
||||
virtual ~GEOM_GenericOperationsCreator() {}
|
||||
};
|
||||
|
||||
//=====================================================================
|
||||
|
@ -609,9 +609,10 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::MirrorPointCopy
|
||||
* OffsetShape
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
|
||||
(GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theOffset)
|
||||
GEOM::GEOM_Object_ptr
|
||||
GEOM_ITransformOperations_i::OffsetShape (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theOffset,
|
||||
CORBA::Boolean theJoinByPipes)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject = GEOM::GEOM_Object::_duplicate(theObject);
|
||||
|
||||
@ -631,7 +632,7 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
|
||||
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Create the offset shape
|
||||
GetOperations()->OffsetShape(aBasicObject, theOffset);
|
||||
GetOperations()->OffsetShape( aBasicObject, theOffset, theJoinByPipes );
|
||||
|
||||
// Update GUI.
|
||||
UpdateGUIForObject(theObject);
|
||||
@ -644,9 +645,10 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShape
|
||||
* OffsetShapeCopy
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy
|
||||
(GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theOffset)
|
||||
GEOM::GEOM_Object_ptr
|
||||
GEOM_ITransformOperations_i::OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theOffset,
|
||||
CORBA::Boolean theJoinByPipes)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
@ -658,7 +660,8 @@ GEOM::GEOM_Object_ptr GEOM_ITransformOperations_i::OffsetShapeCopy
|
||||
if (aBasicObject.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Create the offset shape
|
||||
Handle(::GEOM_Object) anObject = GetOperations()->OffsetShapeCopy(aBasicObject, theOffset);
|
||||
Handle(::GEOM_Object) anObject =
|
||||
GetOperations()->OffsetShapeCopy(aBasicObject, theOffset, theJoinByPipes);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
|
@ -135,10 +135,12 @@ class GEOM_I_EXPORT GEOM_ITransformOperations_i :
|
||||
GEOM::GEOM_Object_ptr thePoint);
|
||||
|
||||
GEOM::GEOM_Object_ptr OffsetShape (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theOffset);
|
||||
CORBA::Double theOffset,
|
||||
CORBA::Boolean theJoinByPipes);
|
||||
|
||||
GEOM::GEOM_Object_ptr OffsetShapeCopy (GEOM::GEOM_Object_ptr theObject,
|
||||
CORBA::Double theOffset);
|
||||
CORBA::Double theOffset,
|
||||
CORBA::Boolean theJoinByPipes);
|
||||
|
||||
GEOM::GEOM_Object_ptr ProjectShapeCopy (GEOM::GEOM_Object_ptr theSource,
|
||||
GEOM::GEOM_Object_ptr theTarget);
|
||||
|
@ -9228,14 +9228,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
"""
|
||||
theOffset, Parameters = ParseParameters(theOffset)
|
||||
if theCopy:
|
||||
anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
|
||||
anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset, True)
|
||||
else:
|
||||
anObj = self.TrsfOp.OffsetShape(theObject, theOffset)
|
||||
anObj = self.TrsfOp.OffsetShape(theObject, theOffset, True)
|
||||
RaiseIfFailed("Offset", self.TrsfOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
return anObj
|
||||
|
||||
## Create new object as offset of the given one.
|
||||
## Create new object as offset of the given one. Gap between two adjacent
|
||||
# offset surfaces is filled by a pipe.
|
||||
# @param theObject The base object for the offset.
|
||||
# @param theOffset Offset value.
|
||||
# @param theName Object name; when specified, this parameter is used
|
||||
@ -9244,11 +9245,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
#
|
||||
# @return New GEOM.GEOM_Object, containing the offset object.
|
||||
#
|
||||
# @sa MakeOffsetIntersectionJoin
|
||||
# @ref tui_offset "Example"
|
||||
@ManageTransactions("TrsfOp")
|
||||
def MakeOffset(self, theObject, theOffset, theName=None):
|
||||
"""
|
||||
Create new object as offset of the given one.
|
||||
Create new object as offset of the given one. Gap between adjacent
|
||||
offset surfaces is filled by a pipe.
|
||||
|
||||
Parameters:
|
||||
theObject The base object for the offset.
|
||||
@ -9267,7 +9270,48 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
theOffset, Parameters = ParseParameters(theOffset)
|
||||
anObj = self.TrsfOp.OffsetShapeCopy(theObject, theOffset)
|
||||
anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, True )
|
||||
RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
self._autoPublish(anObj, theName, "offset")
|
||||
return anObj
|
||||
|
||||
## Create new object as offset of the given one. Gap between adjacent
|
||||
# offset surfaces is filled by extending and intersecting them.
|
||||
# @param theObject The base object for the offset.
|
||||
# @param theOffset Offset value.
|
||||
# @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.GEOM_Object, containing the offset object.
|
||||
#
|
||||
# @sa MakeOffset
|
||||
# @ref tui_offset "Example"
|
||||
@ManageTransactions("TrsfOp")
|
||||
def MakeOffsetIntersectionJoin(self, theObject, theOffset, theName=None):
|
||||
"""
|
||||
Create new object as offset of the given one. Gap between adjacent
|
||||
offset surfaces is filled by extending and intersecting them.
|
||||
|
||||
Parameters:
|
||||
theObject The base object for the offset.
|
||||
theOffset Offset value.
|
||||
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.GEOM_Object, containing the offset object.
|
||||
|
||||
Example of usage:
|
||||
box = geompy.MakeBox(20, 20, 20, 200, 200, 200)
|
||||
# create a new box extended by 70
|
||||
offset = geompy.MakeOffsetIntersectionJoin(box, 70.)
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
theOffset, Parameters = ParseParameters( theOffset )
|
||||
anObj = self.TrsfOp.OffsetShapeCopy( theObject, theOffset, False )
|
||||
RaiseIfFailed("OffsetShapeCopy", self.TrsfOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
self._autoPublish(anObj, theName, "offset")
|
||||
|
@ -58,26 +58,24 @@ TransformationGUI_OffsetDlg::TransformationGUI_OffsetDlg( GeometryGUI* theGeomet
|
||||
mainFrame()->RadioButton2->close();
|
||||
mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->RadioButton3->close();
|
||||
|
||||
|
||||
GroupPoints = new DlgRef_1Sel1Spin1Check( centralWidget() );
|
||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||
GroupPoints->TextLabel1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
GroupPoints->TextLabel2->setText( tr( "GEOM_OFFSET" ) );
|
||||
GroupPoints->CheckButton1->setText( tr( "GEOM_CREATE_COPY" ) );
|
||||
|
||||
// san -- modification of an exisitng object by offset is not allowed
|
||||
GroupPoints->CheckButton1->hide();
|
||||
GroupPoints->CheckButton1->setText( tr( "GEOM_JOIN_BY_PIPES" ) );
|
||||
GroupPoints->CheckButton1->setChecked( true );
|
||||
|
||||
GroupPoints->PushButton1->setIcon( image1 );
|
||||
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupPoints );
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
|
||||
setHelpFileName( "offset_operation_page.html" );
|
||||
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
@ -97,37 +95,33 @@ TransformationGUI_OffsetDlg::~TransformationGUI_OffsetDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_OffsetDlg::Init()
|
||||
{
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->LineEdit1->setReadOnly( true );
|
||||
|
||||
myObjects.clear();
|
||||
|
||||
|
||||
/* Get setting of step value from file configuration */
|
||||
double step = 1;
|
||||
|
||||
|
||||
/* min, max, step and decimals for spin boxes & initial values */
|
||||
initSpinBox( GroupPoints->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
|
||||
GroupPoints->SpinBox_DX->setValue( 1e-05 );
|
||||
|
||||
// Activate Create a Copy mode
|
||||
GroupPoints->CheckButton1->setChecked( true );
|
||||
CreateCopyModeChanged();
|
||||
|
||||
mainFrame()->GroupBoxPublish->show();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
|
||||
|
||||
connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
connect( myGeomGUI->getApp()->selectionMgr(),
|
||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
|
||||
connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
|
||||
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( CreateCopyModeChanged() ) );
|
||||
|
||||
connect( GroupPoints->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( JoinModeChanged() ) );
|
||||
|
||||
initName( tr( "GEOM_OFFSET" ) );
|
||||
|
||||
globalSelection( GEOM_ALLSHAPES );
|
||||
@ -271,10 +265,10 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
|
||||
|
||||
GEOM::GEOM_ITransformOperations_var anOper = GEOM::GEOM_ITransformOperations::_narrow(getOperation());
|
||||
|
||||
if ( GroupPoints->CheckButton1->isChecked() || IsPreview() ) {
|
||||
if ( true /*GroupPoints->CheckButton1->isChecked() || IsPreview()*/ ) {
|
||||
for ( int i = 0; i < myObjects.count(); i++ ) {
|
||||
|
||||
anObj = anOper->OffsetShapeCopy( myObjects[i].get(), GetOffset() );
|
||||
anObj = anOper->OffsetShapeCopy( myObjects[i].get(), GetOffset(), GetIsJoinByPipes() );
|
||||
if ( !anObj->_is_nil() ) {
|
||||
if(!IsPreview()) {
|
||||
anObj->SetParameters(GroupPoints->SpinBox_DX->text().toLatin1().constData());
|
||||
@ -285,7 +279,7 @@ bool TransformationGUI_OffsetDlg::execute( ObjectList& objects )
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < myObjects.count(); i++ ) {
|
||||
anObj = anOper->OffsetShape( myObjects[i].get(), GetOffset() );
|
||||
anObj = anOper->OffsetShape( myObjects[i].get(), GetOffset(), GetIsJoinByPipes() );
|
||||
if ( !anObj->_is_nil() )
|
||||
objects.push_back( anObj._retn() );
|
||||
}
|
||||
@ -320,13 +314,24 @@ double TransformationGUI_OffsetDlg::GetOffset() const
|
||||
return GroupPoints->SpinBox_DX->value();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetIsJoinByPipes
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
bool TransformationGUI_OffsetDlg::GetIsJoinByPipes() const
|
||||
{
|
||||
return GroupPoints->CheckButton1->isChecked();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : CreateCopyModeChanged()
|
||||
// function : JoinModeChanged()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void TransformationGUI_OffsetDlg::CreateCopyModeChanged()
|
||||
void TransformationGUI_OffsetDlg::JoinModeChanged()
|
||||
{
|
||||
mainFrame()->GroupBoxName->setEnabled( GroupPoints->CheckButton1->isChecked() );
|
||||
processPreview();
|
||||
//mainFrame()->GroupBoxName->setEnabled( GroupPoints->CheckButton1->isChecked() );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
|
@ -57,6 +57,7 @@ private:
|
||||
void Init();
|
||||
void enterEvent( QEvent* );
|
||||
double GetOffset() const;
|
||||
bool GetIsJoinByPipes() const;
|
||||
|
||||
private:
|
||||
QList<GEOM::GeomObjPtr> myObjects;
|
||||
@ -70,7 +71,7 @@ private slots:
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void ValueChangedInSpinBox();
|
||||
void CreateCopyModeChanged();
|
||||
void JoinModeChanged();
|
||||
};
|
||||
|
||||
#endif // TRANSFORMATIONGUI_OFFSETDLG_H
|
||||
|
@ -74,7 +74,7 @@ CORBA::Boolean XAOPlugin_IOperations_i::ExportXAO( GEOM::GEOM_Object_ptr shape,
|
||||
Handle(GEOM_Object) reference = GetObjectImpl( shape );
|
||||
|
||||
// Get the reference groups
|
||||
int ind = 0;
|
||||
CORBA::ULong ind = 0;
|
||||
std::list<Handle(GEOM_Object)> groupsObj;
|
||||
for (; ind < groups.length(); ind++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user