* \param theHeight Prism dimension along the normal of the face.
* \param theAngle Draft angel in degrees
* \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
*/
GEOM_Object MakeDraftPrism (in GEOM_Object theInitShape,
in GEOM_Object theBase,
in double theHeight,
in double theAngle,
- in boolean theFuse);
+ in boolean theFuse,
+ in boolean theInvert);
/*!
* \brief Create a shape by extrusion of the base shape along
* It can be empty.
* \param theThickness Value of the thickness
* \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
* or the modified object if isCopy = false
*/
GEOM_Object MakeThickening (in GEOM_Object theObject,
in ListOfLong theFacesIDs,
in double theThickness,
- in boolean isCopy);
+ in boolean isCopy,
+ in boolean isInside);
/*!
*/
//=============================================================================
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);
aCI.SetFuseFlag(1);
else
aCI.SetFuseFlag(0);
+ aCI.SetInvertFlag(theInvert);
//Compute the Draft Prism Feature value
try {
}
//Make a Python command
+ GEOM::TPythonDump pd (aFunction);
if(theFuse)
{
- GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedBoss("
- << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
+ pd << aPrism << " = geompy.MakeExtrudedBoss(" << theInitShape << ", " << theBase << ", "
+ << theHeight << ", " << theAngle;
}
else
{
- GEOM::TPythonDump(aFunction) << aPrism << " = geompy.MakeExtrudedCut("
- << theInitShape << ", " << theBase << ", " << theHeight << ", " << theAngle << ")";
+ pd << aPrism << " = geompy.MakeExtrudedCut(" << theInitShape << ", " << theBase << ", "
+ << theHeight << ", " << theAngle;
}
+ if (theInvert)
+ pd << ", " << theInvert;
+ pd << ")";
SetErrorCode(OK);
return aPrism;
(Handle(GEOM_Object) theObject,
const Handle(TColStd_HArray1OfInteger) &theFacesIDs,
double theOffset,
- bool isCopy)
+ bool isCopy,
+ bool theInside)
{
SetErrorCode(KO);
GEOMImpl_IOffset aTI (aFunction);
aTI.SetShape(anOriginal);
aTI.SetValue(theOffset);
+ aTI.SetParam(theInside);
if (theFacesIDs.IsNull() == Standard_False) {
aTI.SetFaceIDs(theFacesIDs);
aResult = theObject;
}
+ pd << ", [";
if (theFacesIDs.IsNull() == Standard_False) {
// Dump faces IDs.
Standard_Integer i;
- pd << ", [";
-
for (i = theFacesIDs->Lower(); i < theFacesIDs->Upper(); ++i) {
pd << theFacesIDs->Value(i) << ", ";
}
-
// Dump the last value.
- pd << theFacesIDs->Value(i) << "]";
+ pd << theFacesIDs->Value(i);
}
+ pd << "]";
+
+ if (theInside)
+ pd << ", " << theInside;
pd << ")";
SetErrorCode(OK);
double theDX, double theDY, double theDZ);
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,
Handle(GEOM_Object) thePath);
(Handle(GEOM_Object) theObject,
const Handle(TColStd_HArray1OfInteger) &theFacesIDs,
double theOffset,
- bool isCopy);
+ bool isCopy,
+ bool theInside = false);
Standard_EXPORT Handle(GEOM_Object) RestorePath (Handle(GEOM_Object) theShape,
Handle(GEOM_Object) theBase1,
#define OFF_ARG_SHAPE 1
#define OFF_ARG_VALUE 2
#define OFF_ARG_IDS 3
+#define OFF_ARG_PARAM 4
class GEOMImpl_IOffset
{
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)
{ _func->SetIntegerArray(OFF_ARG_IDS, theFaceIDs); }
#define PRISM_ARG_FUSE 11
#define PRISM_ARG_INIT 12
#define PRISM_ARG_MODE 13
+#define PRISM_ARG_INVERT 14
class GEOMImpl_IPrism
{
void SetFuseFlag(int theFlag) { _func->SetInteger(PRISM_ARG_FUSE, theFlag); }
// 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); }
// GEOMImpl_Mode GetMode() { return _func->GetInteger(PRISM_ARG_MODE); } //TEST
+ Standard_Boolean GetInvertFlag() { return _func->GetInteger(PRISM_ARG_INVERT); }
private:
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
Standard_Real anOffset = aCI.GetValue();
+ Standard_Boolean isInside = aCI.GetParam();
Standard_Real aTol = Precision::Confusion();
+ if (isInside)
+ anOffset = -anOffset;
+
if (Abs(anOffset) < aTol) {
TCollection_AsciiString aMsg ("Absolute value of offset can not be less than the tolerance value (");
aMsg += TCollection_AsciiString(aTol);
case OFFSET_THICKENING_COPY:
theOperationName = "MakeThickening";
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();
Standard_Real aHeight = aCI.GetH(); // Height of the extrusion
Standard_Real anAngle = aCI.GetDraftAngle(); // Draft angle
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)
// history of the Base wire (RefBase)
if(!aSuppObj.IsNull()) // If the wire has a support
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;
const Standard_Real theHeight,
const Standard_Real theAngle,
bool isProtrusion,
- const TopoDS_Shape& theSupport)
+ const TopoDS_Shape& theSupport,
+ bool isInvert)
{
TopoDS_Shape aShape;
}
// 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(aFaceBase.Orientation() == TopAbs_REVERSED)
- invert = isProtrusion;
+ invert = !invert;
Standard_Real anAngle = theAngle;
Standard_Real aHeight = theHeight;
const Standard_Real theHeight,
const Standard_Real theAngle,
bool isProtrusion,
- const TopoDS_Shape& theSupport);
+ const TopoDS_Shape& theSupport,
+ bool isInvert = false);
Standard_EXPORT virtual
bool GetCreationInformation(std::string& theOperationName,
(GEOM::GEOM_Object_ptr theInitShape, GEOM::GEOM_Object_ptr theBase,
CORBA::Double theHeight,
CORBA::Double theAngle,
- CORBA::Boolean theFuse)
+ CORBA::Boolean theFuse,
+ CORBA::Boolean theInvert)
{
GEOM::GEOM_Object_var aGEOMObject;
if (aBase.IsNull() || aInit.IsNull()) return aGEOMObject._retn();
//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())
return aGEOMObject._retn();
(GEOM::GEOM_Object_ptr theObject,
const GEOM::ListOfLong &theFacesIDs,
CORBA::Double theOffset,
- CORBA::Boolean doCopy)
+ CORBA::Boolean doCopy,
+ CORBA::Boolean theInside)
{
GEOM::GEOM_Object_var aGEOMObject;
//Set a not done flag
if (doCopy)
{
Handle(GEOM_Object) anObject = GetOperations()->MakeThickening(
- aBasicObject, aFaceIDs, theOffset, doCopy);
+ aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
}
else
{
- GetOperations()->MakeThickening(aBasicObject, aFaceIDs, theOffset, doCopy);
+ GetOperations()->MakeThickening(aBasicObject, aFaceIDs, theOffset, doCopy, theInside);
// Update GUI.
UpdateGUIForObject(theObject);
GEOM::GEOM_Object_ptr theBase,
CORBA::Double theHeight,
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 thePath);
GEOM::GEOM_Object_ptr MakeThickening (GEOM::GEOM_Object_ptr theObject,
const GEOM::ListOfLong &theFacesIDs,
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 theBase1,
# @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.
# 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
# for result publication in the study. Otherwise, if automatic
# publication is switched on, default value is used for result name.
# @ref tui_creation_thickness "Example"
@ManageTransactions("PrimOp")
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
(face or shell) the result is a thick solid. If an input shape is
theFacesIDs the list of face IDs to be removed from the
result. It is ignored if theShape is a face or a
shell. It is empty by default.
+ theInside If true the thickness is applied towards inside
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.
New GEOM.GEOM_Object, containing the created solid
"""
# Example: see GEOM_TestAll.py
+ theThickness,Parameters = ParseParameters(theThickness)
anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
- theThickness, True)
+ theThickness, True, theInside)
RaiseIfFailed("MakeThickSolid", self.PrimOp)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "thickSolid")
return anObj
# @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.
# It is empty by default.
+ # @param theInside If true the thickness is applied towards inside
#
# @return The modified shape
#
# @ref tui_creation_thickness "Example"
@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
surface shape (face or shell) the result is a thick solid. If
theFacesIDs the list of face IDs to be removed from the
result. It is ignored if \a theShape is a face or
a shell. It is empty by default.
+ theInside If true the thickness is applied towards inside
Returns:
The modified shape
"""
# Example: see GEOM_TestAll.py
+ theThickness,Parameters = ParseParameters(theThickness)
anObj = self.PrimOp.MakeThickening(theShape, theFacesIDs,
- theThickness, False)
+ theThickness, False, theInside)
RaiseIfFailed("Thicken", self.PrimOp)
+ anObj.SetParameters(Parameters)
return anObj
## Build a middle path of a pipe-like shape.
Returns:
New GEOM.GEOM_Object, containing the created edge.
"""
+ theMin, theMax, Parameters = ParseParameters(theMin, theMax)
anObj = self.ShapesOp.ExtendEdge(theEdge, theMin, theMax)
RaiseIfFailed("ExtendEdge", self.ShapesOp)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "edge")
return anObj
Returns:
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,
theVMin, theVMax)
RaiseIfFailed("ExtendFace", self.ShapesOp)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "face")
return anObj
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theInvert If true material changes the direction
# @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.
#
# @ref tui_creation_prism "Example"
@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.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theInvert If true material changes the direction.
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.
New GEOM.GEOM_Object, containing the initial shape with removed material.
"""
# Example: see GEOM_TestAll.py
- #theH,Parameters = ParseParameters(theH)
- anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False)
+ theH,theAngle,Parameters = ParseParameters(theH,theAngle)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, False, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
- #anObj.SetParameters(Parameters)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedCut")
return anObj
# @param theBase Closed edge or wire defining the base shape to be extruded.
# @param theH Prism dimension along the normal to theBase
# @param theAngle Draft angle in degrees.
+ # @param theInvert If true material changes the direction
# @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.
#
# @ref tui_creation_prism "Example"
@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.
theBase Closed edge or wire defining the base shape to be extruded.
theH Prism dimension along the normal to theBase
theAngle Draft angle in degrees.
+ theInvert If true material changes the direction.
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.
New GEOM.GEOM_Object, containing the initial shape with added material.
"""
# Example: see GEOM_TestAll.py
- #theH,Parameters = ParseParameters(theH)
- anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True)
+ theH,theAngle,Parameters = ParseParameters(theH,theAngle)
+ anObj = self.PrimOp.MakeDraftPrism(theInit, theBase, theH, theAngle, True, theInvert)
RaiseIfFailed("MakeExtrudedBoss", self.PrimOp)
- #anObj.SetParameters(Parameters)
+ anObj.SetParameters(Parameters)
self._autoPublish(anObj, theName, "extrudedBoss")
return anObj
if(GroupThickening->checkButton1->isChecked())
{
double aThickness = GroupThickening->SpinBox_DX->value();
- if (GroupThickening->checkButton2->isChecked())
- {
- aThickness = -aThickness;
- }
+ bool isInside = GroupThickening->checkButton2->isChecked();
GEOM::ListOfLong_var anArray = new GEOM::ListOfLong;
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())
GEOM::GEOM_I3DPrimOperations_var anOper =
GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
double aThickness = myThicknessSpin->value();
+ bool anInside = myInsideCheck->isChecked();
GEOM::ListOfLong_var anObjIDsList = new GEOM::ListOfLong();
TopoDS_Shape aShape;
}
}
- if (myInsideCheck->isChecked()) {
- aThickness = -aThickness;
- }
-
anObj = anOper->MakeThickening
- (myObject.get(), anObjIDsList.in(), aThickness, true);
+ (myObject.get(), anObjIDsList.in(), aThickness, true, anInside);
if (!anObj->_is_nil()) {
+ if (!IsPreview()) {
+ QStringList aParameters;
+ aParameters << myThicknessSpin->text();
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
+ }
objects.push_back(anObj._retn());
}
if (myGroup->PushButton3->isChecked())
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
erase(myObject1.get(),false);
GEOM::GEOM_Object_var anObj = anOper->MakeDraftPrism(myObject1.get(), myObject2.get(),
aHeight,
angle,
- isProtrusion);
- if (!anObj->_is_nil())
+ isProtrusion,
+ 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());
+ }
return true;
}
case 0:
anObj = anOper->ExtendEdge(myBase.get(), myUMinSpinBox->value(),
myUMaxSpinBox->value());
+ if (!anObj->_is_nil() && !IsPreview())
+ {
+ QStringList aParameters;
+ aParameters << myUMinSpinBox->text();
+ aParameters << myUMaxSpinBox->text();
+ anObj->SetParameters(aParameters.join(":").toUtf8().constData());
+ }
res = true;
break;
case 1:
myUMaxSpinBox->value(),
myVMinSpinBox->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;
break;
default: