INT PAL 0052642: Notebook variables are not dumped to script with Fillet1D, Fillet2D operations (improved)

This commit is contained in:
mpa 2015-03-27 15:46:09 +03:00
parent ecabd400f8
commit 55bf84458b
15 changed files with 129 additions and 58 deletions

View File

@ -1711,13 +1711,15 @@ module GEOM
* \param theHeight Prism dimension along the normal of the face. * \param theHeight Prism dimension along the normal of the face.
* \param theAngle Draft angel in degrees * \param theAngle Draft angel in degrees
* \param theFuse If true material is added else material is removed * \param theFuse If true material is added else material is removed
* \param theInvert If true material changes the direction
* \return New GEOM_Object, containing the modified shape * \return New GEOM_Object, containing the modified shape
*/ */
GEOM_Object MakeDraftPrism (in GEOM_Object theInitShape, GEOM_Object MakeDraftPrism (in GEOM_Object theInitShape,
in GEOM_Object theBase, in GEOM_Object theBase,
in double theHeight, in double theHeight,
in double theAngle, in double theAngle,
in boolean theFuse); in boolean theFuse,
in boolean theInvert);
/*! /*!
* \brief Create a shape by extrusion of the base shape along * \brief Create a shape by extrusion of the base shape along
@ -1865,13 +1867,15 @@ module GEOM
* It can be empty. * It can be empty.
* \param theThickness Value of the thickness * \param theThickness Value of the thickness
* \param isCopy To make a copy of \a theObject or to modify \a theObject * \param isCopy To make a copy of \a theObject or to modify \a theObject
* \param isInside If true the thickness is applied towards inside
* \return New GEOM_Object, containing the created pipe if isCopy = true * \return New GEOM_Object, containing the created pipe if isCopy = true
* or the modified object if isCopy = false * or the modified object if isCopy = false
*/ */
GEOM_Object MakeThickening (in GEOM_Object theObject, GEOM_Object MakeThickening (in GEOM_Object theObject,
in ListOfLong theFacesIDs, in ListOfLong theFacesIDs,
in double theThickness, in double theThickness,
in boolean isCopy); in boolean isCopy,
in boolean isInside);
/*! /*!

View File

@ -1367,7 +1367,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakePrismDXDYDZ2Ways
*/ */
//============================================================================= //=============================================================================
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
(Handle(GEOM_Object) theInitShape ,Handle(GEOM_Object) theBase, double theHeight, double theAngle, bool theFuse) (Handle(GEOM_Object) theInitShape ,Handle(GEOM_Object) theBase, double theHeight, double theAngle, bool theFuse, bool theInvert)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -1410,6 +1410,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
aCI.SetFuseFlag(1); aCI.SetFuseFlag(1);
else else
aCI.SetFuseFlag(0); aCI.SetFuseFlag(0);
aCI.SetInvertFlag(theInvert);
//Compute the Draft Prism Feature value //Compute the Draft Prism Feature value
try { try {
@ -1426,16 +1427,20 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDraftPrism
} }
//Make a Python command //Make a Python command
GEOM::TPythonDump pd (aFunction);
if(theFuse) if(theFuse)
{ {
GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedBoss(" pd << aPrism << " = geompy.MakeExtrudedBoss(" << theInitShape << ", " << theBase << ", "
<< theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")"; << theHeight << ", " << theAngle;
} }
else else
{ {
GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedCut(" pd << aPrism << " = geompy.MakeExtrudedCut(" << theInitShape << ", " << theBase << ", "
<< theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")"; << theHeight << ", " << theAngle;
} }
if (theInvert)
pd << ", " << theInvert;
pd << ")";
SetErrorCode(OK); SetErrorCode(OK);
return aPrism; return aPrism;
@ -2291,7 +2296,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening
(Handle(GEOM_Object) theObject, (Handle(GEOM_Object) theObject,
const Handle(TColStd_HArray1OfInteger) &theFacesIDs, const Handle(TColStd_HArray1OfInteger) &theFacesIDs,
double theOffset, double theOffset,
bool isCopy) bool isCopy,
bool theInside)
{ {
SetErrorCode(KO); SetErrorCode(KO);
@ -2320,6 +2326,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening
GEOMImpl_IOffset aTI (aFunction); GEOMImpl_IOffset aTI (aFunction);
aTI.SetShape(anOriginal); aTI.SetShape(anOriginal);
aTI.SetValue(theOffset); aTI.SetValue(theOffset);
aTI.SetParam(theInside);
if (theFacesIDs.IsNull() == Standard_False) { if (theFacesIDs.IsNull() == Standard_False) {
aTI.SetFaceIDs(theFacesIDs); aTI.SetFaceIDs(theFacesIDs);
@ -2352,19 +2359,21 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeThickening
aResult = theObject; aResult = theObject;
} }
pd << ", [";
if (theFacesIDs.IsNull() == Standard_False) { if (theFacesIDs.IsNull() == Standard_False) {
// Dump faces IDs. // Dump faces IDs.
Standard_Integer i; Standard_Integer i;
pd << ", [";
for (i = theFacesIDs->Lower(); i < theFacesIDs->Upper(); ++i) { for (i = theFacesIDs->Lower(); i < theFacesIDs->Upper(); ++i) {
pd << theFacesIDs->Value(i) << ", "; pd << theFacesIDs->Value(i) << ", ";
} }
// Dump the last value. // Dump the last value.
pd << theFacesIDs->Value(i) << "]"; pd << theFacesIDs->Value(i);
} }
pd << "]";
if (theInside)
pd << ", " << theInside;
pd << ")"; pd << ")";
SetErrorCode(OK); SetErrorCode(OK);

View File

@ -96,7 +96,7 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
double theDX, double theDY, double theDZ); double theDX, double theDY, double theDZ);
Standard_EXPORT Handle(GEOM_Object) MakeDraftPrism (Handle(GEOM_Object) theInitShape, Handle(GEOM_Object) theBase, Standard_EXPORT Handle(GEOM_Object) MakeDraftPrism (Handle(GEOM_Object) theInitShape, Handle(GEOM_Object) theBase,
double theHeight, double theAngle, bool theFuse); double theHeight, double theAngle, bool theFuse, bool theInvert = false );
Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase, Standard_EXPORT Handle(GEOM_Object) MakePipe (Handle(GEOM_Object) theBase,
Handle(GEOM_Object) thePath); Handle(GEOM_Object) thePath);
@ -148,7 +148,8 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
(Handle(GEOM_Object) theObject, (Handle(GEOM_Object) theObject,
const Handle(TColStd_HArray1OfInteger) &theFacesIDs, const Handle(TColStd_HArray1OfInteger) &theFacesIDs,
double theOffset, double theOffset,
bool isCopy); bool isCopy,
bool theInside = false);
Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape, Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape,
Handle(GEOM_Object) theBase1, Handle(GEOM_Object) theBase1,

View File

@ -28,6 +28,7 @@
#define OFF_ARG_SHAPE 1 #define OFF_ARG_SHAPE 1
#define OFF_ARG_VALUE 2 #define OFF_ARG_VALUE 2
#define OFF_ARG_IDS 3 #define OFF_ARG_IDS 3
#define OFF_ARG_PARAM 4
class GEOMImpl_IOffset class GEOMImpl_IOffset
{ {
@ -43,6 +44,10 @@ class GEOMImpl_IOffset
double GetValue() { return _func->GetReal(OFF_ARG_VALUE); } double GetValue() { return _func->GetReal(OFF_ARG_VALUE); }
void SetParam(Standard_Boolean theParam) { _func->SetInteger(OFF_ARG_PARAM, theParam ? 1 : 0); }
Standard_Boolean GetParam() { return _func->GetInteger(OFF_ARG_PARAM); }
void SetFaceIDs(const Handle(TColStd_HArray1OfInteger)& theFaceIDs) void SetFaceIDs(const Handle(TColStd_HArray1OfInteger)& theFaceIDs)
{ _func->SetIntegerArray(OFF_ARG_IDS, theFaceIDs); } { _func->SetIntegerArray(OFF_ARG_IDS, theFaceIDs); }

View File

@ -38,6 +38,7 @@
#define PRISM_ARG_FUSE 11 #define PRISM_ARG_FUSE 11
#define PRISM_ARG_INIT 12 #define PRISM_ARG_INIT 12
#define PRISM_ARG_MODE 13 #define PRISM_ARG_MODE 13
#define PRISM_ARG_INVERT 14
class GEOMImpl_IPrism class GEOMImpl_IPrism
{ {
@ -75,9 +76,11 @@ class GEOMImpl_IPrism
void SetFuseFlag(int theFlag) { _func->SetInteger(PRISM_ARG_FUSE, theFlag); } void SetFuseFlag(int theFlag) { _func->SetInteger(PRISM_ARG_FUSE, theFlag); }
// void SetMode(GEOMImpl_Mode theMode) { _func->SetInteger(PRISM_ARG_MODE, theMode); } //TEST // void SetMode(GEOMImpl_Mode theMode) { _func->SetInteger(PRISM_ARG_MODE, theMode); } //TEST
void SetInvertFlag(Standard_Boolean theInvert) { _func->SetInteger(PRISM_ARG_INVERT, theInvert ? 1 : 0);}
int GetFuseFlag() { return _func->GetInteger(PRISM_ARG_FUSE); } int GetFuseFlag() { return _func->GetInteger(PRISM_ARG_FUSE); }
// GEOMImpl_Mode GetMode() { return _func->GetInteger(PRISM_ARG_MODE); } //TEST // GEOMImpl_Mode GetMode() { return _func->GetInteger(PRISM_ARG_MODE); } //TEST
Standard_Boolean GetInvertFlag() { return _func->GetInteger(PRISM_ARG_INVERT); }
private: private:

View File

@ -73,8 +73,12 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const
Handle(GEOM_Function) aRefShape = aCI.GetShape(); Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue(); TopoDS_Shape aShapeBase = aRefShape->GetValue();
Standard_Real anOffset = aCI.GetValue(); Standard_Real anOffset = aCI.GetValue();
Standard_Boolean isInside = aCI.GetParam();
Standard_Real aTol = Precision::Confusion(); Standard_Real aTol = Precision::Confusion();
if (isInside)
anOffset = -anOffset;
if (Abs(anOffset) < aTol) { if (Abs(anOffset) < aTol) {
TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value ("); TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value (");
aMsg += TCollection_AsciiString(aTol); aMsg += TCollection_AsciiString(aTol);
@ -208,7 +212,7 @@ GetCreationInformation(std::string& theOperationName,
case OFFSET_THICKENING_COPY: case OFFSET_THICKENING_COPY:
theOperationName = "MakeThickening"; theOperationName = "MakeThickening";
AddParam( theParams, "Object", aCI.GetShape() ); AddParam( theParams, "Object", aCI.GetShape() );
AddParam( theParams, "Offset", aCI.GetValue() ); AddParam( theParams, "Offset", aCI.GetParam() ? -aCI.GetValue() : aCI.GetValue() );
{ {
Handle(TColStd_HArray1OfInteger) aFacesIDs = aCI.GetFaceIDs(); Handle(TColStd_HArray1OfInteger) aFacesIDs = aCI.GetFaceIDs();

View File

@ -196,6 +196,7 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const
Standard_Real aHeight = aCI.GetH(); // Height of the extrusion Standard_Real aHeight = aCI.GetH(); // Height of the extrusion
Standard_Real anAngle = aCI.GetDraftAngle(); // Draft angle Standard_Real anAngle = aCI.GetDraftAngle(); // Draft angle
Standard_Boolean isProtrusion = (aCI.GetFuseFlag()==1); Standard_Boolean isProtrusion = (aCI.GetFuseFlag()==1);
Standard_Boolean isInvert = aCI.GetInvertFlag();
// Flag to know wether the feature is a protrusion (fuse) or a depression (cut) // Flag to know wether the feature is a protrusion (fuse) or a depression (cut)
// history of the Base wire (RefBase) // history of the Base wire (RefBase)
@ -217,7 +218,7 @@ Standard_Integer GEOMImpl_PrismDriver::Execute(TFunction_Logbook& log) const
if(!aSuppObj.IsNull()) // If the wire has a support if(!aSuppObj.IsNull()) // If the wire has a support
aSupport = aSuppObj->GetValue(); aSupport = aSuppObj->GetValue();
aShape = MakeDraftPrism(anInitShape, aSketch, aHeight, anAngle, isProtrusion, aSupport); aShape = MakeDraftPrism(anInitShape, aSketch, aHeight, anAngle, isProtrusion, aSupport, isInvert);
} }
if (aShape.IsNull()) return 0; if (aShape.IsNull()) return 0;
@ -411,7 +412,8 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeDraftPrism ( const TopoDS_Shape& theInitS
const Standard_Real theHeight, const Standard_Real theHeight,
const Standard_Real theAngle, const Standard_Real theAngle,
bool isProtrusion, bool isProtrusion,
const TopoDS_Shape& theSupport) const TopoDS_Shape& theSupport,
bool isInvert)
{ {
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -470,11 +472,11 @@ TopoDS_Shape GEOMImpl_PrismDriver::MakeDraftPrism ( const TopoDS_Shape& theInitS
} }
// Invert height and angle if the operation is an extruded cut // Invert height and angle if the operation is an extruded cut
bool invert = !isProtrusion; bool invert = isInvert? isProtrusion : !isProtrusion;
// If the face has a reversed orientation invert for extruded boss operations // If the face has a reversed orientation invert for extruded boss operations
if(aFaceBase.Orientation() == TopAbs_REVERSED) if(aFaceBase.Orientation() == TopAbs_REVERSED)
invert = isProtrusion; invert = !invert;
Standard_Real anAngle = theAngle; Standard_Real anAngle = theAngle;
Standard_Real aHeight = theHeight; Standard_Real aHeight = theHeight;

View File

@ -93,7 +93,8 @@ public:
const Standard_Real theHeight, const Standard_Real theHeight,
const Standard_Real theAngle, const Standard_Real theAngle,
bool isProtrusion, bool isProtrusion,
const TopoDS_Shape& theSupport); const TopoDS_Shape& theSupport,
bool isInvert = false);
Standard_EXPORT virtual Standard_EXPORT virtual
bool GetCreationInformation(std::string& theOperationName, bool GetCreationInformation(std::string& theOperationName,

View File

@ -766,7 +766,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
(GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase, (GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase,
CORBA::Double theHeight, CORBA::Double theHeight,
CORBA::Double theAngle, CORBA::Double theAngle,
CORBA::Boolean theFuse) CORBA::Boolean theFuse,
CORBA::Boolean theInvert)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
@ -780,7 +781,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDraftPrism
if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn(); if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
//Create the Prism //Create the Prism
Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse); Handle(GEOM_Object) anObject = GetOperations()->MakeDraftPrism(aInit, aBase, theHeight, theAngle, theFuse, theInvert);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -1187,7 +1188,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
(GEOM::GEOM_Object_ptr theObject, (GEOM::GEOM_Object_ptr theObject,
const GEOM::ListOfLong &theFacesIDs, const GEOM::ListOfLong &theFacesIDs,
CORBA::Double theOffset, CORBA::Double theOffset,
CORBA::Boolean doCopy) CORBA::Boolean doCopy,
CORBA::Boolean theInside)
{ {
GEOM::GEOM_Object_var aGEOMObject; GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag //Set a not done flag
@ -1225,7 +1227,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
if (doCopy) if (doCopy)
{ {
Handle(GEOM_Object) anObject = GetOperations()->MakeThickening( Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
aBasicObject, aFaceIDs, theOffset, doCopy); aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
if (!GetOperations()->IsDone() || anObject.IsNull()) if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn(); return aGEOMObject._retn();
@ -1233,7 +1235,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeThickening
} }
else else
{ {
GetOperations()->MakeThickening(aBasicObject, aFaceIDs, theOffset, doCopy); GetOperations()->MakeThickening(aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
// Update GUI. // Update GUI.
UpdateGUIForObject(theObject); UpdateGUIForObject(theObject);

View File

@ -153,7 +153,8 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr theBase,
CORBA::Double theHeight, CORBA::Double theHeight,
CORBA::Double theAngle, CORBA::Double theAngle,
CORBA::Boolean theFuse); CORBA::Boolean theFuse,
CORBA::Boolean theInvert);
GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase, GEOM::GEOM_Object_ptr MakePipe (GEOM::GEOM_Object_ptr theBase,
GEOM::GEOM_Object_ptr thePath); GEOM::GEOM_Object_ptr thePath);
@ -201,7 +202,8 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject, GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject,
const GEOM::ListOfLong &theFacesIDs, const GEOM::ListOfLong &theFacesIDs,
CORBA::Double theOffset, CORBA::Double theOffset,
CORBA::Boolean isCopy); CORBA::Boolean isCopy,
CORBA::Boolean theInside);
GEOM::GEOM_Object_ptr RestorePath (GEOM::GEOM_Object_ptr theShape, GEOM::GEOM_Object_ptr RestorePath (GEOM::GEOM_Object_ptr theShape,
GEOM::GEOM_Object_ptr theBase1, GEOM::GEOM_Object_ptr theBase1,

View File

@ -4149,6 +4149,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @param theFacesIDs the list of face IDs to be removed from the # @param theFacesIDs the list of face IDs to be removed from the
# result. It is ignored if \a theShape is a face or a shell. # result. It is ignored if \a theShape is a face or a shell.
# It is empty by default. # It is empty by default.
# @param theInside If true the thickness is applied towards inside
# @param theName Object name; when specified, this parameter is used # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
@ -4158,7 +4159,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @ref tui_creation_thickness "Example" # @ref tui_creation_thickness "Example"
@ManageTransactions("PrimOp") @ManageTransactions("PrimOp")
def MakeThickSolid(self, theShape, theThickness, def MakeThickSolid(self, theShape, theThickness,
theFacesIDs=[], theName=None): theFacesIDs=[], theInside=False, theName=None):
""" """
Make a thick solid from a shape. If the input is a surface shape Make a thick solid from a shape. If the input is a surface shape
(face or shell) the result is a thick solid. If an input shape is (face or shell) the result is a thick solid. If an input shape is
@ -4171,6 +4172,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
theFacesIDs the list of face IDs to be removed from the theFacesIDs the list of face IDs to be removed from the
result. It is ignored if theShape is a face or a result. It is ignored if theShape is a face or a
shell. It is empty by default. shell. It is empty by default.
theInside If true the thickness is applied towards inside
theName Object name; when specified, this parameter is used theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
@ -4179,9 +4181,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
New GEOM.GEOM_Object, containing the created solid New GEOM.GEOM_Object, containing the created solid
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
theThickness,Parameters = ParseParameters(theThickness)
anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs, anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
theThickness, True) theThickness, True, theInside)
RaiseIfFailed("MakeThickSolid", self.PrimOp) RaiseIfFailed("MakeThickSolid", self.PrimOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "thickSolid") self._autoPublish(anObj, theName, "thickSolid")
return anObj return anObj
@ -4195,12 +4199,13 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @param theFacesIDs the list of face IDs to be removed from the # @param theFacesIDs the list of face IDs to be removed from the
# result. It is ignored if \a theShape is a face or a shell. # result. It is ignored if \a theShape is a face or a shell.
# It is empty by default. # It is empty by default.
# @param theInside If true the thickness is applied towards inside
# #
# @return The modified shape # @return The modified shape
# #
# @ref tui_creation_thickness "Example" # @ref tui_creation_thickness "Example"
@ManageTransactions("PrimOp") @ManageTransactions("PrimOp")
def Thicken(self, theShape, theThickness, theFacesIDs=[]): def Thicken(self, theShape, theThickness, theFacesIDs=[], theInside=False):
""" """
Modifies a shape to make it a thick solid. If the input is a Modifies a shape to make it a thick solid. If the input is a
surface shape (face or shell) the result is a thick solid. If surface shape (face or shell) the result is a thick solid. If
@ -4214,14 +4219,17 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
theFacesIDs the list of face IDs to be removed from the theFacesIDs the list of face IDs to be removed from the
result. It is ignored if \a theShape is a face or result. It is ignored if \a theShape is a face or
a shell. It is empty by default. a shell. It is empty by default.
theInside If true the thickness is applied towards inside
Returns: Returns:
The modified shape The modified shape
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
theThickness,Parameters = ParseParameters(theThickness)
anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs, anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
theThickness, False) theThickness, False, theInside)
RaiseIfFailed("Thicken", self.PrimOp) RaiseIfFailed("Thicken", self.PrimOp)
anObj.SetParameters(Parameters)
return anObj return anObj
## Build a middle path of a pipe-like shape. ## Build a middle path of a pipe-like shape.
@ -5835,8 +5843,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
Returns: Returns:
New GEOM.GEOM_Object, containing the created edge. New GEOM.GEOM_Object, containing the created edge.
""" """
theMin, theMax, Parameters = ParseParameters(theMin, theMax)
anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax) anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
RaiseIfFailed("ExtendEdge", self.ShapesOp) RaiseIfFailed("ExtendEdge", self.ShapesOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "edge") self._autoPublish(anObj, theName, "edge")
return anObj return anObj
@ -5883,9 +5893,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
Returns: Returns:
New GEOM.GEOM_Object, containing the created face. New GEOM.GEOM_Object, containing the created face.
""" """
theUMin, theUMax, theVMin, theVMax, Parameters = ParseParameters(theUMin, theUMax, theVMin, theVMax)
anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax, anObj = self.ShapesOp.ExtendFace(theFace, theUMin, theUMax,
theVMin, theVMax) theVMin, theVMax)
RaiseIfFailed("ExtendFace", self.ShapesOp) RaiseIfFailed("ExtendFace", self.ShapesOp)
anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "face") self._autoPublish(anObj, theName, "face")
return anObj return anObj
@ -10059,6 +10071,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @param theBase Closed edge or wire defining the base shape to be extruded. # @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase # @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees. # @param theAngle Draft angle in degrees.
# @param theInvert If true material changes the direction
# @param theName Object name; when specified, this parameter is used # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
@ -10067,7 +10080,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_creation_prism "Example" # @ref tui_creation_prism "Example"
@ManageTransactions("PrimOp") @ManageTransactions("PrimOp")
def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theName=None): def MakeExtrudedCut(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
""" """
Add material to a solid by extrusion of the base shape on the given distance. Add material to a solid by extrusion of the base shape on the given distance.
@ -10076,6 +10089,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
theBase Closed edge or wire defining the base shape to be extruded. theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees. theAngle Draft angle in degrees.
theInvert If true material changes the direction.
theName Object name; when specified, this parameter is used theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
@ -10084,10 +10098,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
New GEOM.GEOM_Object, containing the initial shape with removed material. New GEOM.GEOM_Object, containing the initial shape with removed material.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
#theH,Parameters = ParseParameters(theH) theH,theAngle,Parameters = ParseParameters(theH,theAngle)
anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False) anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp) RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
#anObj.SetParameters(Parameters) anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedCut") self._autoPublish(anObj, theName, "extrudedCut")
return anObj return anObj
@ -10097,6 +10111,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# @param theBase Closed edge or wire defining the base shape to be extruded. # @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase # @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees. # @param theAngle Draft angle in degrees.
# @param theInvert If true material changes the direction
# @param theName Object name; when specified, this parameter is used # @param theName Object name; when specified, this parameter is used
# for result publication in the study. Otherwise, if automatic # for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name. # publication is switched on, default value is used for result name.
@ -10105,7 +10120,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
# #
# @ref tui_creation_prism "Example" # @ref tui_creation_prism "Example"
@ManageTransactions("PrimOp") @ManageTransactions("PrimOp")
def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theName=None): def MakeExtrudedBoss(self, theInit, theBase, theH, theAngle, theInvert=False, theName=None):
""" """
Add material to a solid by extrusion of the base shape on the given distance. Add material to a solid by extrusion of the base shape on the given distance.
@ -10114,6 +10129,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
theBase Closed edge or wire defining the base shape to be extruded. theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees. theAngle Draft angle in degrees.
theInvert If true material changes the direction.
theName Object name; when specified, this parameter is used theName Object name; when specified, this parameter is used
for result publication in the study. Otherwise, if automatic for result publication in the study. Otherwise, if automatic
publication is switched on, default value is used for result name. publication is switched on, default value is used for result name.
@ -10122,10 +10138,10 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
New GEOM.GEOM_Object, containing the initial shape with added material. New GEOM.GEOM_Object, containing the initial shape with added material.
""" """
# Example: see GEOM_TestAll.py # Example: see GEOM_TestAll.py
#theH,Parameters = ParseParameters(theH) theH,theAngle,Parameters = ParseParameters(theH,theAngle)
anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True) anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp) RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
#anObj.SetParameters(Parameters) anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedBoss") self._autoPublish(anObj, theName, "extrudedBoss")
return anObj return anObj

View File

@ -717,15 +717,15 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
if(GroupThickening->checkButton1->isChecked()) if(GroupThickening->checkButton1->isChecked())
{ {
double aThickness = GroupThickening->SpinBox_DX->value(); double aThickness = GroupThickening->SpinBox_DX->value();
if (GroupThickening->checkButton2->isChecked()) bool isInside = GroupThickening->checkButton2->isChecked();
{
aThickness = -aThickness;
}
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong; GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
anObj = anotherOper->MakeThickening anObj = anotherOper->MakeThickening
(anObj, anArray, aThickness, /*copy=*/false); (anObj, anArray, aThickness, /*copy=*/false, isInside);
if (!anObj->_is_nil() && !IsPreview())
anObj->SetParameters(GroupThickening->SpinBox_DX->text().toUtf8().constData());
} }
if (!anObj->_is_nil()) if (!anObj->_is_nil())

View File

@ -421,6 +421,7 @@ bool GenerationGUI_ThicknessDlg::execute (ObjectList& objects)
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations_var anOper =
GEOM::GEOM_I3DPrimOperations::_narrow(getOperation()); GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
double aThickness = myThicknessSpin->value(); double aThickness = myThicknessSpin->value();
bool anInside = myInsideCheck->isChecked();
GEOM::ListOfLong_var anObjIDsList = new GEOM::ListOfLong(); GEOM::ListOfLong_var anObjIDsList = new GEOM::ListOfLong();
TopoDS_Shape aShape; TopoDS_Shape aShape;
@ -452,14 +453,15 @@ bool GenerationGUI_ThicknessDlg::execute (ObjectList& objects)
} }
} }
if (myInsideCheck->isChecked()) {
aThickness = -aThickness;
}
anObj = anOper->MakeThickening anObj = anOper->MakeThickening
(myObject.get(), anObjIDsList.in(), aThickness, true); (myObject.get(), anObjIDsList.in(), aThickness, true, anInside);
if (!anObj->_is_nil()) { if (!anObj->_is_nil()) {
if (!IsPreview()) {
QStringList aParameters;
aParameters << myThicknessSpin->text();
anObj->SetParameters(aParameters.join(":").toUtf8().constData());
}
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
} }

View File

@ -365,14 +365,9 @@ bool OperationGUI_ExtrudedFeatureDlg::execute (ObjectList& objects)
if (myGroup->PushButton3->isChecked()) if (myGroup->PushButton3->isChecked())
angle=myGroup->SpinBox_DY->value(); angle=myGroup->SpinBox_DY->value();
if (myGroup->PushButton4->isChecked())
{
aHeight = -aHeight;
angle = -angle;
}
bool isProtrusion = (myOperation == OperationGUI::BOSS); bool isProtrusion = (myOperation == OperationGUI::BOSS);
bool isInvert = myGroup->PushButton4->isChecked();
// Hide the initial shape in order to see the modifications on the preview // Hide the initial shape in order to see the modifications on the preview
erase(myObject1.get(),false); erase(myObject1.get(),false);
@ -380,9 +375,18 @@ bool OperationGUI_ExtrudedFeatureDlg::execute (ObjectList& objects)
GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(), GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(),
aHeight, aHeight,
angle, angle,
isProtrusion); isProtrusion,
if (!anObj->_is_nil()) isInvert);
if (!anObj->_is_nil()) {
if (!IsPreview()) {
QStringList aParameters;
aParameters << myGroup->SpinBox_DX->text();
if (myGroup->PushButton3->isChecked())
aParameters << myGroup->SpinBox_DY->text();
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
objects.push_back(anObj._retn()); objects.push_back(anObj._retn());
}
return true; return true;
} }

View File

@ -390,6 +390,13 @@ bool TransformationGUI_ExtensionDlg::execute(ObjectList& objects)
case 0: case 0:
anObj = anOper->ExtendEdge(myBase.get(), myUMinSpinBox->value(), anObj = anOper->ExtendEdge(myBase.get(), myUMinSpinBox->value(),
myUMaxSpinBox->value()); myUMaxSpinBox->value());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << myUMinSpinBox->text();
aParameters << myUMaxSpinBox->text();
anObj->SetParameters(aParameters.join(":").toUtf8().constData());
}
res = true; res = true;
break; break;
case 1: case 1:
@ -397,6 +404,15 @@ bool TransformationGUI_ExtensionDlg::execute(ObjectList& objects)
myUMaxSpinBox->value(), myUMaxSpinBox->value(),
myVMinSpinBox->value(), myVMinSpinBox->value(),
myVMaxSpinBox->value()); myVMaxSpinBox->value());
if (!anObj->_is_nil() && !IsPreview())
{
QStringList aParameters;
aParameters << myUMinSpinBox->text();
aParameters << myUMaxSpinBox->text();
aParameters << myVMinSpinBox->text();
aParameters << myVMaxSpinBox->text();
anObj->SetParameters(aParameters.join(":").toUtf8().constData());
}
res = true; res = true;
break; break;
default: default: