mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-24 16:30:35 +05:00
0022667: EDF 7375 GEOM: Add angle argument to Create cylinder function.
Minor corrections to initial implementation.
This commit is contained in:
parent
69b2ec02a2
commit
ccf1c3dfbc
@ -1,46 +1,49 @@
|
|||||||
# Creation of a Cylinder
|
# Creation of a Cylinder
|
||||||
|
|
||||||
|
import math
|
||||||
|
|
||||||
import salome
|
import salome
|
||||||
salome.salome_init()
|
salome.salome_init()
|
||||||
import GEOM
|
import GEOM
|
||||||
from salome.geom import geomBuilder
|
from salome.geom import geomBuilder
|
||||||
geompy = geomBuilder.New(salome.myStudy)
|
geompy = geomBuilder.New(salome.myStudy)
|
||||||
|
|
||||||
import math
|
|
||||||
gg = salome.ImportComponentGUI("GEOM")
|
gg = salome.ImportComponentGUI("GEOM")
|
||||||
|
|
||||||
# create a vertex and a vector
|
# create a vertex and a vector
|
||||||
p1 = geompy.MakeVertex(25, 35, 45)
|
p1 = geompy.MakeVertex(25, 35, 45)
|
||||||
p2 = geompy.MakeVertex(70, 70, 70)
|
p2 = geompy.MakeVertex(70, 70, 70)
|
||||||
v = geompy.MakeVector(p1, p2)
|
v = geompy.MakeVector(p1, p2)
|
||||||
|
|
||||||
# create cylinders
|
# create cylinders
|
||||||
height = 40
|
height = 40
|
||||||
|
|
||||||
radius1 = 15
|
radius1 = 15
|
||||||
cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
|
|
||||||
angle1 = 45.*math.pi / 180.
|
|
||||||
cylinder1a = geompy.MakeCylinderA(p1, v, radius1, height, angle1)
|
|
||||||
geompy.TranslateDXDYDZ(cylinder1a,80.,0.,0.)
|
|
||||||
|
|
||||||
radius2 = 30
|
radius2 = 30
|
||||||
|
angle1 = 45. * math.pi / 180.
|
||||||
|
angle2 = 210. * math.pi / 180.
|
||||||
|
|
||||||
|
cylinder1 = geompy.MakeCylinder(p1, v, radius1, height)
|
||||||
|
|
||||||
cylinder2 = geompy.MakeCylinderRH(radius2, height)
|
cylinder2 = geompy.MakeCylinderRH(radius2, height)
|
||||||
angle2 = 210.*math.pi / 180.
|
|
||||||
cylinder2a = geompy.MakeCylinderRHA(radius2, height, angle2)
|
cylinder3 = geompy.MakeCylinderA(p1, v, radius1, height, angle1)
|
||||||
geompy.TranslateDXDYDZ(cylinder2a,80.,0.,0.)
|
geompy.TranslateDXDYDZ(cylinder3, 80., 0., 0.)
|
||||||
|
|
||||||
|
cylinder4 = geompy.MakeCylinderRHA(radius2, height, angle2)
|
||||||
|
geompy.TranslateDXDYDZ(cylinder4, 80., 0., 0.)
|
||||||
|
|
||||||
# add objects in the study
|
# add objects in the study
|
||||||
id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
|
id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
|
||||||
id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
|
id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
|
||||||
id_cylinder1a = geompy.addToStudy(cylinder1a,"Cylinder1a")
|
id_cylinder3 = geompy.addToStudy(cylinder3,"Cylinder3")
|
||||||
id_cylinder2a = geompy.addToStudy(cylinder2a,"Cylinder2a")
|
id_cylinder4 = geompy.addToStudy(cylinder4,"Cylinder4")
|
||||||
|
|
||||||
# display the cylinders
|
# display the cylinders
|
||||||
gg.createAndDisplayGO(id_cylinder1)
|
gg.createAndDisplayGO(id_cylinder1)
|
||||||
gg.setDisplayMode(id_cylinder1,1)
|
gg.setDisplayMode(id_cylinder1,1)
|
||||||
gg.createAndDisplayGO(id_cylinder2)
|
gg.createAndDisplayGO(id_cylinder2)
|
||||||
gg.setDisplayMode(id_cylinder2,1)
|
gg.setDisplayMode(id_cylinder2,1)
|
||||||
gg.createAndDisplayGO(id_cylinder1a)
|
gg.createAndDisplayGO(id_cylinder3)
|
||||||
gg.setDisplayMode(id_cylinder1a,1)
|
gg.setDisplayMode(id_cylinder3,1)
|
||||||
gg.createAndDisplayGO(id_cylinder2a)
|
gg.createAndDisplayGO(id_cylinder4)
|
||||||
gg.setDisplayMode(id_cylinder2a,1)
|
gg.setDisplayMode(id_cylinder4,1)
|
||||||
|
@ -10,29 +10,32 @@ Entity - > Primitives - > Cylinder</b>
|
|||||||
|
|
||||||
\n Firstly, you can define a \b Cylinder by the <b>Base Point</b> (the central
|
\n Firstly, you can define a \b Cylinder by the <b>Base Point</b> (the central
|
||||||
point of the cylinder base), the \b Vector (the axis of the cylinder),
|
point of the cylinder base), the \b Vector (the axis of the cylinder),
|
||||||
and its dimensions: the Radius and the Height.
|
and its dimensions: the \b Radius and the \b Height. Also, you can optionally specify
|
||||||
|
the \b Angle in order to create a portion of cylinder.
|
||||||
|
|
||||||
\n <b>TUI Command:</b> <em>geompy.MakeCylinder(Point, Axis, Radius, Height)</em>
|
\n <b>TUI Command:</b> <em>geompy.MakeCylinder(Point, Axis, Radius, Height)</em>
|
||||||
\n <b>Arguments:</b> Name + 1 vertex + 1 vector + 2 values
|
\n <b>Arguments:</b> Name + 1 vertex + 1 vector + 2 values
|
||||||
(Dimensions: radius and height).
|
(Dimensions: radius and height).
|
||||||
|
|
||||||
\n \b Angle checkbox and field allow defining an angle to create a portion of cylinder.
|
|
||||||
\n <b>TUI Command:</b> <em>geompy.MakeCylinderA(Point, Axis, Radius, Height, Angle)</em>
|
\n <b>TUI Command:</b> <em>geompy.MakeCylinderA(Point, Axis, Radius, Height, Angle)</em>
|
||||||
\n <b>Arguments:</b> Name + 1 vertex + 1 vector + 3 values
|
\n <b>Arguments:</b> Name + 1 vertex + 1 vector + 3 values
|
||||||
(Dimensions: radius, height and angle).
|
(Dimensions: radius, height and angle).
|
||||||
|
|
||||||
\image html cylinder1.png
|
\image html cylinder1.png
|
||||||
|
|
||||||
\n Secondly, you can define a \b Cylinder by the given radius and the
|
\n Secondly, you can define a \b Cylinder by the given \b Radius and
|
||||||
height at the origin of coordinate system. The axis of the cylinder
|
\b Height at the origin of coordinate system. The axis of the cylinder
|
||||||
will be collinear to the OZ axis of the coordinate system.
|
will be collinear to the OZ axis of the coordinate system.
|
||||||
|
Similarly to first constructor, you can optionally specify the \b Angle
|
||||||
|
in order to create a portion of cylinder.
|
||||||
|
|
||||||
\n <b>TUI Command:</b> <em>geompy.MakeCylinderRH(Radius, Height)</em>
|
\n <b>TUI Command:</b> <em>geompy.MakeCylinderRH(Radius, Height)</em>
|
||||||
\n <b>Arguments:</b> Name + 2 values (Dimensions at origin: radius and
|
\n <b>Arguments:</b> Name + 2 values (Dimensions at origin: radius and
|
||||||
height).
|
height).
|
||||||
|
|
||||||
\n \b Angle checkbox and field allow defining an angle to create a portion of cylinder at the origin of coordinate system.
|
|
||||||
\n <b>TUI Command:</b> <em>geompy.MakeCylinderRHA(Radius, Height, Angle)</em>
|
\n <b>TUI Command:</b> <em>geompy.MakeCylinderRHA(Radius, Height, Angle)</em>
|
||||||
\n <b>Arguments:</b> Name + 3 values
|
\n <b>Arguments:</b> Name + 3 values
|
||||||
(Dimensions at origin : radius, height and angle).
|
(Dimensions at origin: radius, height and angle).
|
||||||
|
|
||||||
\image html cylinder2.png
|
\image html cylinder2.png
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
|
// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
//
|
//
|
||||||
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
@ -1494,7 +1494,7 @@ module GEOM
|
|||||||
GEOM_Object MakeCylinderRHA (in double theR, in double theH, in double theA);
|
GEOM_Object MakeCylinderRHA (in double theR, in double theH, in double theA);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Create a cylinder with given base point, axis, radius, height and angle.
|
* \brief Create a cylinder with given base point, axis, radius and height.
|
||||||
* \param thePnt Central point of cylinder base.
|
* \param thePnt Central point of cylinder base.
|
||||||
* \param theAxis Cylinder axis.
|
* \param theAxis Cylinder axis.
|
||||||
* \param theR Cylinder radius.
|
* \param theR Cylinder radius.
|
||||||
@ -1518,7 +1518,7 @@ module GEOM
|
|||||||
in GEOM_Object theAxis,
|
in GEOM_Object theAxis,
|
||||||
in double theR,
|
in double theR,
|
||||||
in double theH,
|
in double theH,
|
||||||
in double theA);
|
in double theA);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Create a cone with given height and radiuses at
|
* \brief Create a cone with given height and radiuses at
|
||||||
|
@ -162,13 +162,13 @@ module GEOM
|
|||||||
GEOM_Object MakeCylinderRH (in double theR,
|
GEOM_Object MakeCylinderRH (in double theR,
|
||||||
in double theH) ;
|
in double theH) ;
|
||||||
GEOM_Object MakeCylinderPntVecRHA (in GEOM_Object thePnt,
|
GEOM_Object MakeCylinderPntVecRHA (in GEOM_Object thePnt,
|
||||||
in GEOM_Object theAxis,
|
in GEOM_Object theAxis,
|
||||||
in double theRadius,
|
in double theRadius,
|
||||||
in double theHeight,
|
in double theHeight,
|
||||||
in double theAngle) ;
|
in double theAngle) ;
|
||||||
GEOM_Object MakeCylinderRHA (in double theR,
|
GEOM_Object MakeCylinderRHA (in double theR,
|
||||||
in double theH,
|
in double theH,
|
||||||
in double theA) ;
|
in double theA) ;
|
||||||
GEOM_Object MakeSphere (in double theX,
|
GEOM_Object MakeSphere (in double theX,
|
||||||
in double theY,
|
in double theY,
|
||||||
in double theZ,
|
in double theZ,
|
||||||
|
@ -1372,7 +1372,7 @@
|
|||||||
</outParameter-list>
|
</outParameter-list>
|
||||||
<DataStream-list></DataStream-list>
|
<DataStream-list></DataStream-list>
|
||||||
</component-service>
|
</component-service>
|
||||||
<component-service>
|
<component-service>
|
||||||
<service-name>MakeCylinderPntVecRHA</service-name>
|
<service-name>MakeCylinderPntVecRHA</service-name>
|
||||||
<service-author></service-author>
|
<service-author></service-author>
|
||||||
<service-version></service-version>
|
<service-version></service-version>
|
||||||
@ -1399,7 +1399,7 @@
|
|||||||
<inParameter-type>double</inParameter-type>
|
<inParameter-type>double</inParameter-type>
|
||||||
<inParameter-comment>unknown</inParameter-comment>
|
<inParameter-comment>unknown</inParameter-comment>
|
||||||
</inParameter>
|
</inParameter>
|
||||||
<inParameter>
|
<inParameter>
|
||||||
<inParameter-name>theAngle</inParameter-name>
|
<inParameter-name>theAngle</inParameter-name>
|
||||||
<inParameter-type>double</inParameter-type>
|
<inParameter-type>double</inParameter-type>
|
||||||
<inParameter-comment>unknown</inParameter-comment>
|
<inParameter-comment>unknown</inParameter-comment>
|
||||||
@ -1431,7 +1431,7 @@
|
|||||||
<inParameter-type>double</inParameter-type>
|
<inParameter-type>double</inParameter-type>
|
||||||
<inParameter-comment>unknown</inParameter-comment>
|
<inParameter-comment>unknown</inParameter-comment>
|
||||||
</inParameter>
|
</inParameter>
|
||||||
<inParameter>
|
<inParameter>
|
||||||
<inParameter-name>theA</inParameter-name>
|
<inParameter-name>theA</inParameter-name>
|
||||||
<inParameter-type>double</inParameter-type>
|
<inParameter-type>double</inParameter-type>
|
||||||
<inParameter-comment>unknown</inParameter-comment>
|
<inParameter-comment>unknown</inParameter-comment>
|
||||||
|
@ -180,6 +180,9 @@
|
|||||||
<tabstop>PushButton2</tabstop>
|
<tabstop>PushButton2</tabstop>
|
||||||
<tabstop>LineEdit2</tabstop>
|
<tabstop>LineEdit2</tabstop>
|
||||||
<tabstop>SpinBox_DX</tabstop>
|
<tabstop>SpinBox_DX</tabstop>
|
||||||
|
<tabstop>SpinBox_DY</tabstop>
|
||||||
|
<tabstop>SpinBox_DZ</tabstop>
|
||||||
|
<tabstop>checkBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -117,6 +117,7 @@
|
|||||||
<tabstop>SpinBox_DX</tabstop>
|
<tabstop>SpinBox_DX</tabstop>
|
||||||
<tabstop>SpinBox_DY</tabstop>
|
<tabstop>SpinBox_DY</tabstop>
|
||||||
<tabstop>SpinBox_DZ</tabstop>
|
<tabstop>SpinBox_DZ</tabstop>
|
||||||
|
<tabstop>checkBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
@ -109,37 +109,36 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
|
|||||||
|
|
||||||
if (aCI.GetH() < 0.0) aV.Reverse();
|
if (aCI.GetH() < 0.0) aV.Reverse();
|
||||||
gp_Ax2 anAxes (aP, aV);
|
gp_Ax2 anAxes (aP, aV);
|
||||||
bool switchAngleVar;
|
|
||||||
if(aType == CYLINDER_R_H || aType == CYLINDER_PNT_VEC_R_H) switchAngleVar = false;
|
|
||||||
else if(aType == CYLINDER_R_H_A || aType == CYLINDER_PNT_VEC_R_H_A) switchAngleVar = true;
|
|
||||||
else return 0;
|
|
||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
switch (switchAngleVar) {
|
switch (aType) {
|
||||||
case false:
|
case CYLINDER_R_H:
|
||||||
{
|
case CYLINDER_PNT_VEC_R_H:
|
||||||
BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
|
{
|
||||||
MC.Build();
|
BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
|
||||||
if (!MC.IsDone()) {
|
MC.Build();
|
||||||
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
|
if (!MC.IsDone()) {
|
||||||
|
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
|
||||||
|
}
|
||||||
|
aShape = MC.Shape();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
aShape = MC.Shape();
|
case CYLINDER_R_H_A:
|
||||||
break;
|
case CYLINDER_PNT_VEC_R_H_A:
|
||||||
}
|
{
|
||||||
case true:
|
BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
|
||||||
{
|
MC.Build();
|
||||||
BRepPrimAPI_MakeCylinder MCA (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
|
if (!MC.IsDone()) {
|
||||||
MCA.Build();
|
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
|
||||||
if (!MCA.IsDone()) {
|
}
|
||||||
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
|
aShape = MC.Shape();
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
aShape = MCA.Shape();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
aFunction->SetValue(aShape);
|
aFunction->SetValue(aShape);
|
||||||
|
|
||||||
|
@ -646,8 +646,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
|
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
|
||||||
Handle(GEOM_Object) theVec,
|
Handle(GEOM_Object) theVec,
|
||||||
double theR, double theH, double theA)
|
double theR, double theH, double theA)
|
||||||
{
|
{
|
||||||
SetErrorCode(KO);
|
SetErrorCode(KO);
|
||||||
|
|
||||||
|
@ -50,17 +50,17 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
|||||||
Standard_EXPORT Handle(GEOM_Object) MakeDiskR (double theR, int theOrientation);
|
Standard_EXPORT Handle(GEOM_Object) MakeDiskR (double theR, int theOrientation);
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH);
|
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH);
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
|
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
|
||||||
Handle(GEOM_Object) theVec,
|
Handle(GEOM_Object) theVec,
|
||||||
double theR, double theH);
|
double theR, double theH);
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRHA (double theR, double theH, double theA);
|
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRHA (double theR, double theH, double theA);
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
|
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
|
||||||
Handle(GEOM_Object) theVec,
|
Handle(GEOM_Object) theVec,
|
||||||
double theR, double theH, double theA);
|
double theR, double theH, double theA);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H (double theR1, double theR2, double theH);
|
Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H (double theR1, double theR2, double theH);
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
|
Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
|
||||||
Handle(GEOM_Object) theVec,
|
Handle(GEOM_Object) theVec,
|
||||||
double theR1, double theR2, double theH);
|
double theR1, double theR2, double theH);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeSphereR (double theR);
|
Standard_EXPORT Handle(GEOM_Object) MakeSphereR (double theR);
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeSpherePntR (Handle(GEOM_Object) thePnt, double theR);
|
Standard_EXPORT Handle(GEOM_Object) MakeSpherePntR (Handle(GEOM_Object) thePnt, double theR);
|
||||||
@ -68,8 +68,8 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
|||||||
Standard_EXPORT Handle(GEOM_Object) MakeTorusRR (double theRMajor, double theRMinor);
|
Standard_EXPORT Handle(GEOM_Object) MakeTorusRR (double theRMajor, double theRMinor);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakeTorusPntVecRR (Handle(GEOM_Object) thePnt,
|
Standard_EXPORT Handle(GEOM_Object) MakeTorusPntVecRR (Handle(GEOM_Object) thePnt,
|
||||||
Handle(GEOM_Object) theVec,
|
Handle(GEOM_Object) theVec,
|
||||||
double theRMajor, double theRMinor);
|
double theRMajor, double theRMinor);
|
||||||
|
|
||||||
Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
|
Standard_EXPORT Handle(GEOM_Object) MakePrismVecH (Handle(GEOM_Object) theBase,
|
||||||
Handle(GEOM_Object) theVec,
|
Handle(GEOM_Object) theVec,
|
||||||
|
@ -267,8 +267,8 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
|
|||||||
*/
|
*/
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRHA (CORBA::Double theR,
|
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRHA (CORBA::Double theR,
|
||||||
CORBA::Double theH,
|
CORBA::Double theH,
|
||||||
CORBA::Double theA)
|
CORBA::Double theA)
|
||||||
{
|
{
|
||||||
GEOM::GEOM_Object_var aGEOMObject;
|
GEOM::GEOM_Object_var aGEOMObject;
|
||||||
|
|
||||||
|
@ -77,14 +77,14 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
|
|||||||
CORBA::Double theH);
|
CORBA::Double theH);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
|
GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
|
||||||
CORBA::Double theH,
|
CORBA::Double theH,
|
||||||
CORBA::Double theA);
|
CORBA::Double theA);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
||||||
GEOM::GEOM_Object_ptr theVec,
|
GEOM::GEOM_Object_ptr theVec,
|
||||||
CORBA::Double theR,
|
CORBA::Double theR,
|
||||||
CORBA::Double theH,
|
CORBA::Double theH,
|
||||||
CORBA::Double theA);
|
CORBA::Double theA);
|
||||||
|
|
||||||
GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1,
|
GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1,
|
||||||
CORBA::Double theR2,
|
CORBA::Double theR2,
|
||||||
|
@ -1077,10 +1077,10 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR,
|
|||||||
// MakeCylinderPntVecRHA:
|
// MakeCylinderPntVecRHA:
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
||||||
GEOM::GEOM_Object_ptr theAxis,
|
GEOM::GEOM_Object_ptr theAxis,
|
||||||
CORBA::Double theRadius,
|
CORBA::Double theRadius,
|
||||||
CORBA::Double theHeight,
|
CORBA::Double theHeight,
|
||||||
CORBA::Double theAngle)
|
CORBA::Double theAngle)
|
||||||
{
|
{
|
||||||
beginService( " GEOM_Superv_i::MakeCylinderPntVecRHA" );
|
beginService( " GEOM_Superv_i::MakeCylinderPntVecRHA" );
|
||||||
MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRHA");
|
MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRHA");
|
||||||
@ -1094,8 +1094,8 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRHA (GEOM::GEOM_Object_pt
|
|||||||
// MakeCylinderRHA:
|
// MakeCylinderRHA:
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRHA (CORBA::Double theR,
|
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRHA (CORBA::Double theR,
|
||||||
CORBA::Double theH,
|
CORBA::Double theH,
|
||||||
CORBA::Double theA)
|
CORBA::Double theA)
|
||||||
{
|
{
|
||||||
beginService( " GEOM_Superv_i::MakeCylinderRHA" );
|
beginService( " GEOM_Superv_i::MakeCylinderRHA" );
|
||||||
MESSAGE("GEOM_Superv_i::MakeCylinderRHA");
|
MESSAGE("GEOM_Superv_i::MakeCylinderRHA");
|
||||||
|
@ -247,13 +247,13 @@ public:
|
|||||||
GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
|
GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
|
||||||
CORBA::Double theH);
|
CORBA::Double theH);
|
||||||
GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
||||||
GEOM::GEOM_Object_ptr theAxis,
|
GEOM::GEOM_Object_ptr theAxis,
|
||||||
CORBA::Double theRadius,
|
CORBA::Double theRadius,
|
||||||
CORBA::Double theHeight,
|
CORBA::Double theHeight,
|
||||||
CORBA::Double theAngle);
|
CORBA::Double theAngle);
|
||||||
GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
|
GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
|
||||||
CORBA::Double theH,
|
CORBA::Double theH,
|
||||||
CORBA::Double theA);
|
CORBA::Double theA);
|
||||||
GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX,
|
GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX,
|
||||||
CORBA::Double theY,
|
CORBA::Double theY,
|
||||||
CORBA::Double theZ,
|
CORBA::Double theZ,
|
||||||
|
@ -147,20 +147,20 @@ def TestAll (geompy, math):
|
|||||||
tan_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
|
tan_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
|
||||||
|
|
||||||
#Create base geometry 3D
|
#Create base geometry 3D
|
||||||
Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object)->GEOM_Object
|
Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object)->GEOM_Object
|
||||||
Box1 = geompy.MakeBoxDXDYDZ(10, 20, 30) #(3 Doubles)->GEOM_Object
|
Box1 = geompy.MakeBoxDXDYDZ(10, 20, 30) #(3 Doubles)->GEOM_Object
|
||||||
Box2 = geompy.MakeBox(10,20,30, 15,25,35) #(6 Doubles)->GEOM_Object
|
Box2 = geompy.MakeBox(10,20,30, 15,25,35) #(6 Doubles)->GEOM_Object
|
||||||
Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(2 GEOM_Object, 2 Doubles)->GEOM_Object
|
Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(2 GEOM_Object, 2 Doubles)->GEOM_Object
|
||||||
Cyl1 = geompy.MakeCylinderRH(radius2, height) #(2 Doubles)->GEOM_Object
|
Cyl1 = geompy.MakeCylinderRH(radius2, height) #(2 Doubles)->GEOM_Object
|
||||||
Cylinder1= geompy.MakeCylinderA(p0, vz, radius1, height,angle1) #(2 GEOM_Object, 2 Doubles)->GEOM_Object
|
Cylinder1= geompy.MakeCylinderA(p0, vz, radius1, height, angle1) #(2 GEOM_Object, 3 Doubles)->GEOM_Object
|
||||||
Cyl2 = geompy.MakeCylinderRHA(radius2, height,angle2) #(2 Doubles)->GEOM_Object
|
Cyl2 = geompy.MakeCylinderRHA(radius2, height, angle2) #(3 Doubles)->GEOM_Object
|
||||||
Sphere = geompy.MakeSpherePntR(p0, radius1) #(GEOM_Object, Double)->GEOM_Object
|
Sphere = geompy.MakeSpherePntR(p0, radius1) #(GEOM_Object, Double)->GEOM_Object
|
||||||
Sphere1 = geompy.MakeSphereR(radius) #(Double)->GEOM_Object
|
Sphere1 = geompy.MakeSphereR(radius) #(Double)->GEOM_Object
|
||||||
Sphere2 = geompy.MakeSphere(50, 70, 30, radius) #(4 Doubles)->GEOM_Object
|
Sphere2 = geompy.MakeSphere(50, 70, 30, radius) #(4 Doubles)->GEOM_Object
|
||||||
Cone = geompy.MakeCone(p0, vz, radius2, radius, height) #(2 GEOM_Object, 3 Doubles)->GEOM_Object
|
Cone = geompy.MakeCone(p0, vz, radius2, radius, height) #(2 GEOM_Object, 3 Doubles)->GEOM_Object
|
||||||
Cone1 = geompy.MakeConeR1R2H(radius1, radius, height) #(3 Doubles)->GEOM_Object
|
Cone1 = geompy.MakeConeR1R2H(radius1, radius, height) #(3 Doubles)->GEOM_Object
|
||||||
Torus = geompy.MakeTorus(p0, vz, radius2, radius) #(2 GEOM_Object, 2 Doubles)->GEOM_Object
|
Torus = geompy.MakeTorus(p0, vz, radius2, radius) #(2 GEOM_Object, 2 Doubles)->GEOM_Object
|
||||||
Torus1 = geompy.MakeTorusRR(radius2, radius1) #(2 Doubles)->GEOM_Object
|
Torus1 = geompy.MakeTorusRR(radius2, radius1) #(2 Doubles)->GEOM_Object
|
||||||
|
|
||||||
#Boolean (Common, Cut, Fuse, Section)
|
#Boolean (Common, Cut, Fuse, Section)
|
||||||
Common = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object, Short)->GEOM_Object
|
Common = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object, Short)->GEOM_Object
|
||||||
|
@ -166,7 +166,7 @@ void PrimitiveGUI_CylinderDlg::Init()
|
|||||||
|
|
||||||
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
|
||||||
|
|
||||||
connect(GroupPoints->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
|
connect(GroupPoints->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
|
||||||
connect(GroupDimensions->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
|
connect(GroupDimensions->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
|
||||||
|
|
||||||
initName(tr("GEOM_CYLINDER"));
|
initName(tr("GEOM_CYLINDER"));
|
||||||
@ -399,9 +399,10 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
|
|||||||
{
|
{
|
||||||
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
|
ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
|
||||||
GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
|
GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
|
||||||
GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
|
( !GroupPoints->checkBox->isChecked() || GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) ) &&
|
||||||
myPoint && myDir;
|
myPoint && myDir;
|
||||||
if(GroupPoints->SpinBox_DZ->value()<=0. || GroupPoints->SpinBox_DZ->value()>=360.) {
|
if ( GroupPoints->checkBox->isChecked() &&
|
||||||
|
( GroupPoints->SpinBox_DZ->value() <= 0. || GroupPoints->SpinBox_DZ->value() >= 360. ) ) {
|
||||||
msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
|
msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
@ -410,10 +411,11 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
|
|||||||
{
|
{
|
||||||
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
|
ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
|
||||||
GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
|
GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
|
||||||
GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() );
|
( GroupDimensions->checkBox->isChecked() || GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) );
|
||||||
if(GroupDimensions->SpinBox_DZ->value()<=0. || GroupDimensions->SpinBox_DZ->value()>=360.) {
|
if ( GroupDimensions->checkBox->isChecked() &&
|
||||||
msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
|
( GroupDimensions->SpinBox_DZ->value() <= 0. || GroupDimensions->SpinBox_DZ->value() >= 360. ) ) {
|
||||||
ok = false;
|
msg += tr("GEOM_CYLINDER_ANGLE_ERR") + "\n";
|
||||||
|
ok = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ok = qAbs( getHeight() ) > Precision::Confusion() && ok;
|
ok = qAbs( getHeight() ) > Precision::Confusion() && ok;
|
||||||
@ -428,7 +430,6 @@ bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
|
|||||||
bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
||||||
{
|
{
|
||||||
bool res = false;
|
bool res = false;
|
||||||
bool BAngle = false;
|
|
||||||
|
|
||||||
GEOM::GEOM_Object_var anObj;
|
GEOM::GEOM_Object_var anObj;
|
||||||
|
|
||||||
@ -436,20 +437,8 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
|||||||
|
|
||||||
switch (getConstructorId()) {
|
switch (getConstructorId()) {
|
||||||
case 0:
|
case 0:
|
||||||
BAngle = GroupPoints->checkBox->isChecked();
|
|
||||||
if ( myPoint && myDir ) {
|
if ( myPoint && myDir ) {
|
||||||
if(!BAngle){
|
if ( GroupPoints->checkBox->isChecked() ) {
|
||||||
anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight());
|
|
||||||
if (!anObj->_is_nil() && !IsPreview())
|
|
||||||
{
|
|
||||||
QStringList aParameters;
|
|
||||||
aParameters << GroupPoints->SpinBox_DX->text();
|
|
||||||
aParameters << GroupPoints->SpinBox_DY->text();
|
|
||||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
|
||||||
}
|
|
||||||
res = true;
|
|
||||||
}
|
|
||||||
else if(BAngle){
|
|
||||||
anObj = anOper->MakeCylinderPntVecRHA(myPoint.get(), myDir.get(), getRadius(), getHeight(), getAngle()*M_PI/180.);
|
anObj = anOper->MakeCylinderPntVecRHA(myPoint.get(), myDir.get(), getRadius(), getHeight(), getAngle()*M_PI/180.);
|
||||||
if (!anObj->_is_nil() && !IsPreview())
|
if (!anObj->_is_nil() && !IsPreview())
|
||||||
{
|
{
|
||||||
@ -461,22 +450,21 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
|||||||
}
|
}
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight());
|
||||||
|
if (!anObj->_is_nil() && !IsPreview())
|
||||||
|
{
|
||||||
|
QStringList aParameters;
|
||||||
|
aParameters << GroupPoints->SpinBox_DX->text();
|
||||||
|
aParameters << GroupPoints->SpinBox_DY->text();
|
||||||
|
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||||
|
}
|
||||||
|
res = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
BAngle = GroupDimensions->checkBox->isChecked();
|
if ( GroupDimensions->checkBox->isChecked() ) {
|
||||||
if(!BAngle){
|
|
||||||
anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
|
|
||||||
if (!anObj->_is_nil() && !IsPreview())
|
|
||||||
{
|
|
||||||
QStringList aParameters;
|
|
||||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
|
||||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
|
||||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
|
||||||
}
|
|
||||||
res = true;
|
|
||||||
}
|
|
||||||
else if(BAngle){
|
|
||||||
anObj = anOper->MakeCylinderRHA(getRadius(), getHeight(), getAngle()*M_PI/180.);
|
anObj = anOper->MakeCylinderRHA(getRadius(), getHeight(), getAngle()*M_PI/180.);
|
||||||
if (!anObj->_is_nil() && !IsPreview())
|
if (!anObj->_is_nil() && !IsPreview())
|
||||||
{
|
{
|
||||||
@ -488,6 +476,17 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
|||||||
}
|
}
|
||||||
res = true;
|
res = true;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
anObj = anOper->MakeCylinderRH(getRadius(), getHeight());
|
||||||
|
if (!anObj->_is_nil() && !IsPreview())
|
||||||
|
{
|
||||||
|
QStringList aParameters;
|
||||||
|
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||||
|
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||||
|
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||||
|
}
|
||||||
|
res = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ private slots:
|
|||||||
void ConstructorsClicked( int );
|
void ConstructorsClicked( int );
|
||||||
void ValueChangedInSpinBox();
|
void ValueChangedInSpinBox();
|
||||||
void SetDoubleSpinBoxStep( double );
|
void SetDoubleSpinBoxStep( double );
|
||||||
void ActivateAngle();
|
void ActivateAngle();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PRIMITIVEGUI_CYLINDERDLG_H
|
#endif // PRIMITIVEGUI_CYLINDERDLG_H
|
||||||
|
Loading…
Reference in New Issue
Block a user