mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-24 06:40:33 +05:00
Update of the implementation of an option to create portion of cylinders in the cylinder primitive
This commit is contained in:
parent
882ffe16a5
commit
b9cd395cc3
@ -6,6 +6,7 @@ import GEOM
|
||||
from salome.geom import geomBuilder
|
||||
geompy = geomBuilder.New(salome.myStudy)
|
||||
|
||||
import math
|
||||
gg = salome.ImportComponentGUI("GEOM")
|
||||
|
||||
# create a vertex and a vector
|
||||
@ -18,16 +19,28 @@ height = 40
|
||||
|
||||
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
|
||||
cylinder2 = geompy.MakeCylinderRH(radius2, height)
|
||||
angle2 = 210.*math.pi / 180.
|
||||
cylinder2a = geompy.MakeCylinderRHA(radius2, height, angle2)
|
||||
geompy.TranslateDXDYDZ(cylinder2a,80.,0.,0.)
|
||||
|
||||
# add objects in the study
|
||||
id_cylinder1 = geompy.addToStudy(cylinder1,"Cylinder1")
|
||||
id_cylinder2 = geompy.addToStudy(cylinder2,"Cylinder2")
|
||||
id_cylinder1a = geompy.addToStudy(cylinder1a,"Cylinder1a")
|
||||
id_cylinder2a = geompy.addToStudy(cylinder2a,"Cylinder2a")
|
||||
|
||||
# display the cylinders
|
||||
gg.createAndDisplayGO(id_cylinder1)
|
||||
gg.setDisplayMode(id_cylinder1,1)
|
||||
gg.createAndDisplayGO(id_cylinder2)
|
||||
gg.setDisplayMode(id_cylinder2,1)
|
||||
gg.createAndDisplayGO(id_cylinder1a)
|
||||
gg.setDisplayMode(id_cylinder1a,1)
|
||||
gg.createAndDisplayGO(id_cylinder2a)
|
||||
gg.setDisplayMode(id_cylinder2a,1)
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Binary file not shown.
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 12 KiB |
@ -11,8 +11,12 @@ Entity - > Primitives - > Cylinder</b>
|
||||
\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),
|
||||
and its dimensions: the Radius and the Height.
|
||||
\n <b>Angle</b> checkbox and field allow defining an angle to build a portion of cylinder.
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeCylinder(Point, Axis, Radius, Height, Angle=2*pi)</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
|
||||
(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>Arguments:</b> Name + 1 vertex + 1 vector + 3 values
|
||||
(Dimensions: radius, height and angle).
|
||||
|
||||
@ -21,9 +25,14 @@ and its dimensions: the Radius and the Height.
|
||||
\n Secondly, you can define a \b Cylinder by the given radius and the
|
||||
height at the origin of coordinate system. The axis of the cylinder
|
||||
will be collinear to the OZ axis of the coordinate system.
|
||||
<b>Angle</b> checkbox and field allow defining an angle to build a portion of cylinder.
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeCylinderRH(Radius, Height, Angle=2*pi)</em>
|
||||
\n <b>Arguments:</b> Name + 2 values (Dimensions at origin: radius, height, angle).
|
||||
\n <b>TUI Command:</b> <em>geompy.MakeCylinderRH(Radius, Height)</em>
|
||||
\n <b>Arguments:</b> Name + 2 values (Dimensions at origin: radius and
|
||||
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>Arguments:</b> Name + 3 values
|
||||
(Dimensions at origin : radius, height and angle).
|
||||
|
||||
\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,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
@ -1471,7 +1471,18 @@ module GEOM
|
||||
GEOM_Object MakeDiskR (in double theR, in short theOrientation);
|
||||
|
||||
/*!
|
||||
* \brief Create a cylinder with given radius, height and angle (portion of cylinder) at
|
||||
* \brief Create a cylinder with given radius and height at
|
||||
* the origin of coordinate system.
|
||||
*
|
||||
* Axis of the cylinder will be collinear to the OZ axis of the coordinate system.
|
||||
* \param theR Cylinder radius.
|
||||
* \param theH Cylinder height.
|
||||
* \return New GEOM_Object, containing the created cylinder.
|
||||
*/
|
||||
GEOM_Object MakeCylinderRH (in double theR, in double theH);
|
||||
|
||||
/*!
|
||||
* \brief Create a portion of cylinder with given radius, height and angle at
|
||||
* the origin of coordinate system.
|
||||
*
|
||||
* Axis of the cylinder will be collinear to the OZ axis of the coordinate system.
|
||||
@ -1480,10 +1491,22 @@ module GEOM
|
||||
* \param theA Cylinder angle.
|
||||
* \return New GEOM_Object, containing the created cylinder.
|
||||
*/
|
||||
GEOM_Object MakeCylinderRH (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 (portion of cylinder).
|
||||
* \brief Create a cylinder with given base point, axis, radius, height and angle.
|
||||
* \param thePnt Central point of cylinder base.
|
||||
* \param theAxis Cylinder axis.
|
||||
* \param theR Cylinder radius.
|
||||
* \param theH Cylinder height.
|
||||
* \return New GEOM_Object, containing the created cylinder.
|
||||
*/
|
||||
GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt,
|
||||
in GEOM_Object theAxis,
|
||||
in double theR,
|
||||
in double theH);
|
||||
/*!
|
||||
* \brief Create a portion of cylinder with given base point, axis, radius, height and angle.
|
||||
* \param thePnt Central point of cylinder base.
|
||||
* \param theAxis Cylinder axis.
|
||||
* \param theR Cylinder radius.
|
||||
@ -1491,7 +1514,7 @@ module GEOM
|
||||
* \param theA Cylinder angle.
|
||||
* \return New GEOM_Object, containing the created cylinder.
|
||||
*/
|
||||
GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt,
|
||||
GEOM_Object MakeCylinderPntVecRHA (in GEOM_Object thePnt,
|
||||
in GEOM_Object theAxis,
|
||||
in double theR,
|
||||
in double theH,
|
||||
|
@ -158,9 +158,15 @@ module GEOM
|
||||
GEOM_Object MakeCylinderPntVecRH (in GEOM_Object thePnt,
|
||||
in GEOM_Object theAxis,
|
||||
in double theRadius,
|
||||
in double theHeight,
|
||||
in double theAngle) ;
|
||||
in double theHeight) ;
|
||||
GEOM_Object MakeCylinderRH (in double theR,
|
||||
in double theH) ;
|
||||
GEOM_Object MakeCylinderPntVecRHA (in GEOM_Object thePnt,
|
||||
in GEOM_Object theAxis,
|
||||
in double theRadius,
|
||||
in double theHeight,
|
||||
in double theAngle) ;
|
||||
GEOM_Object MakeCylinderRHA (in double theR,
|
||||
in double theH,
|
||||
in double theA) ;
|
||||
GEOM_Object MakeSphere (in double theX,
|
||||
|
@ -1335,11 +1335,6 @@
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
<inParameter>
|
||||
<inParameter-name>theAngle</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
</inParameter-list>
|
||||
<outParameter-list>
|
||||
<outParameter>
|
||||
@ -1367,6 +1362,43 @@
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
</inParameter-list>
|
||||
<outParameter-list>
|
||||
<outParameter>
|
||||
<outParameter-name>return</outParameter-name>
|
||||
<outParameter-type>GEOM_Object</outParameter-type>
|
||||
<outParameter-comment>unknown</outParameter-comment>
|
||||
</outParameter>
|
||||
</outParameter-list>
|
||||
<DataStream-list></DataStream-list>
|
||||
</component-service>
|
||||
<component-service>
|
||||
<service-name>MakeCylinderPntVecRHA</service-name>
|
||||
<service-author></service-author>
|
||||
<service-version></service-version>
|
||||
<service-comment>unknown</service-comment>
|
||||
<service-by-default>0</service-by-default>
|
||||
<inParameter-list>
|
||||
<inParameter>
|
||||
<inParameter-name>thePnt</inParameter-name>
|
||||
<inParameter-type>GEOM_Object</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
<inParameter>
|
||||
<inParameter-name>theAxis</inParameter-name>
|
||||
<inParameter-type>GEOM_Object</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
<inParameter>
|
||||
<inParameter-name>theRadius</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
<inParameter>
|
||||
<inParameter-name>theHeight</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
<inParameter>
|
||||
<inParameter-name>theAngle</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
@ -1382,6 +1414,38 @@
|
||||
</outParameter-list>
|
||||
<DataStream-list></DataStream-list>
|
||||
</component-service>
|
||||
<component-service>
|
||||
<service-name>MakeCylinderRHA</service-name>
|
||||
<service-author></service-author>
|
||||
<service-version></service-version>
|
||||
<service-comment>unknown</service-comment>
|
||||
<service-by-default>0</service-by-default>
|
||||
<inParameter-list>
|
||||
<inParameter>
|
||||
<inParameter-name>theR</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
<inParameter>
|
||||
<inParameter-name>theH</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
<inParameter>
|
||||
<inParameter-name>theA</inParameter-name>
|
||||
<inParameter-type>double</inParameter-type>
|
||||
<inParameter-comment>unknown</inParameter-comment>
|
||||
</inParameter>
|
||||
</inParameter-list>
|
||||
<outParameter-list>
|
||||
<outParameter>
|
||||
<outParameter-name>return</outParameter-name>
|
||||
<outParameter-type>GEOM_Object</outParameter-type>
|
||||
<outParameter-comment>unknown</outParameter-comment>
|
||||
</outParameter>
|
||||
</outParameter-list>
|
||||
<DataStream-list></DataStream-list>
|
||||
</component-service>
|
||||
<component-service>
|
||||
<service-name>MakeSphere</service-name>
|
||||
<service-author></service-author>
|
||||
|
@ -75,9 +75,9 @@ SET(_uic_files
|
||||
DlgRef_2Sel2Spin2Push_QTD.ui
|
||||
DlgRef_2Sel2Spin3Check_QTD.ui
|
||||
DlgRef_2Sel2Spin_QTD.ui
|
||||
DlgRef_2Sel3Spin1Check_QTD.ui
|
||||
DlgRef_2Sel3Spin2Rb_QTD.ui
|
||||
DlgRef_2Sel3Spin_QTD.ui
|
||||
DlgRef_2Sel3Spin1Check_QTD.ui
|
||||
DlgRef_2SelExt_QTD.ui
|
||||
DlgRef_2Sel_QTD.ui
|
||||
DlgRef_2Spin_QTD.ui
|
||||
|
186
src/DlgRef/DlgRef_2Sel3Spin1Check_QTD.ui
Normal file
186
src/DlgRef/DlgRef_2Sel3Spin1Check_QTD.ui
Normal file
@ -0,0 +1,186 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DlgRef_2Sel3Spin1Check_QTD</class>
|
||||
<widget class="QWidget" name="DlgRef_2Sel3Spin1Check_QTD">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>323</width>
|
||||
<height>223</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="GroupBox1">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout">
|
||||
<property name="margin">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="TextLabel4">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TL4</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="TextLabel3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TL3</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="TextLabel1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TL1</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="LineEdit1"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="TextLabel2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TL2</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="PushButton1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLineEdit" name="LineEdit2"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="PushButton2">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" colspan="2">
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX"/>
|
||||
</item>
|
||||
<item row="6" column="2" colspan="2">
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DZ"/>
|
||||
</item>
|
||||
<item row="5" column="2" colspan="2">
|
||||
<widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DY"/>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="TextLabel5">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TL5</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>CB</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>SalomeApp_DoubleSpinBox</class>
|
||||
<extends>QDoubleSpinBox</extends>
|
||||
<header location="global">SalomeApp_DoubleSpinBox.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>PushButton1</tabstop>
|
||||
<tabstop>LineEdit1</tabstop>
|
||||
<tabstop>PushButton2</tabstop>
|
||||
<tabstop>LineEdit2</tabstop>
|
||||
<tabstop>SpinBox_DX</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -75,14 +75,12 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
gp_Pnt aP;
|
||||
gp_Vec aV;
|
||||
|
||||
TopoDS_Shape aShape;
|
||||
|
||||
if (aType == CYLINDER_R_H) {
|
||||
if (aType == CYLINDER_R_H || aType == CYLINDER_R_H_A) {
|
||||
aP = gp::Origin();
|
||||
aV = gp::DZ();
|
||||
}
|
||||
else if (aType == CYLINDER_PNT_VEC_R_H) {
|
||||
else if (aType == CYLINDER_PNT_VEC_R_H || aType == CYLINDER_PNT_VEC_R_H_A) {
|
||||
Handle(GEOM_Function) aRefPoint = aCI.GetPoint();
|
||||
Handle(GEOM_Function) aRefVector = aCI.GetVector();
|
||||
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
||||
@ -111,21 +109,41 @@ Standard_Integer GEOMImpl_CylinderDriver::Execute(TFunction_Logbook& log) const
|
||||
|
||||
if (aCI.GetH() < 0.0) aV.Reverse();
|
||||
gp_Ax2 anAxes (aP, aV);
|
||||
aShape = BRepPrimAPI_MakeCylinder(anAxes, aCI.GetR(), Abs(aCI.GetH())).Shape();
|
||||
if(aCI.GetA() < 360. && aCI.GetA()> 0.){
|
||||
BRepPrimAPI_MakeCylinder MC(anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA()*M_PI/180.);
|
||||
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;
|
||||
|
||||
switch (switchAngleVar) {
|
||||
case false:
|
||||
{
|
||||
BRepPrimAPI_MakeCylinder MC (anAxes, aCI.GetR(), Abs(aCI.GetH()));
|
||||
MC.Build();
|
||||
if (!MC.IsDone()) {
|
||||
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters");
|
||||
}
|
||||
aShape = MC.Shape();
|
||||
}
|
||||
aShape = MC.Shape();
|
||||
break;
|
||||
}
|
||||
case true:
|
||||
{
|
||||
BRepPrimAPI_MakeCylinder MCA (anAxes, aCI.GetR(), Abs(aCI.GetH()), aCI.GetA());
|
||||
MCA.Build();
|
||||
if (!MCA.IsDone()) {
|
||||
StdFail_NotDone::Raise("Cylinder can't be computed from the given parameters. Failure.");
|
||||
return 0;
|
||||
}
|
||||
aShape = MCA.Shape();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
if (aShape.IsNull()) return 0;
|
||||
|
||||
aFunction->SetValue(aShape);
|
||||
|
||||
log.SetTouched(Label());
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeDiskR (double theR, int theO
|
||||
* MakeCylinderRH
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, double theH, double theA)
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, double theH)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
@ -504,6 +504,54 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
|
||||
|
||||
GEOMImpl_ICylinder aCI (aFunction);
|
||||
|
||||
aCI.SetR(theR);
|
||||
aCI.SetH(theH);
|
||||
|
||||
//Compute the Cylinder value
|
||||
try {
|
||||
#if OCC_VERSION_LARGE > 0x06010000
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Cylinder driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aCylinder
|
||||
<< " = geompy.MakeCylinderRH(" << theR << ", " << theH << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aCylinder;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeCylinderRHA
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRHA (double theR, double theH, double theA)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
//Add a new Cylinder object
|
||||
Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
|
||||
|
||||
//Add a new Cylinder function with R and H parameters
|
||||
Handle(GEOM_Function) aFunction = aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_R_H_A);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_ICylinder aCI (aFunction);
|
||||
|
||||
aCI.SetR(theR);
|
||||
aCI.SetH(theH);
|
||||
aCI.SetA(theA);
|
||||
@ -526,19 +574,78 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderRH (double theR, dou
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aCylinder
|
||||
<< " = geompy.MakeCylinderRH(" << theR << ", " << theH << ", " << theA << ")";
|
||||
<< " = geompy.MakeCylinderRHA(" << theR << ", " << theH << ", " << theA*180./M_PI << "*math.pi/180.)";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aCylinder;
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeCylinderPntVecRH
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
|
||||
Handle(GEOM_Object) theVec,
|
||||
double theR, double theH)
|
||||
{
|
||||
SetErrorCode(KO);
|
||||
|
||||
if (thePnt.IsNull() || theVec.IsNull()) return NULL;
|
||||
|
||||
//Add a new Cylinder object
|
||||
Handle(GEOM_Object) aCylinder = GetEngine()->AddObject(GetDocID(), GEOM_CYLINDER);
|
||||
|
||||
//Add a new Cylinder function for creation a cylinder relatively to point and vector
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
if (aFunction->GetDriverGUID() != GEOMImpl_CylinderDriver::GetID()) return NULL;
|
||||
|
||||
GEOMImpl_ICylinder aCI (aFunction);
|
||||
|
||||
Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
|
||||
Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
|
||||
|
||||
if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
|
||||
|
||||
aCI.SetPoint(aRefPnt);
|
||||
aCI.SetVector(aRefVec);
|
||||
aCI.SetR(theR);
|
||||
aCI.SetH(theH);
|
||||
|
||||
//Compute the Cylinder value
|
||||
try {
|
||||
#if OCC_VERSION_LARGE > 0x06010000
|
||||
OCC_CATCH_SIGNALS;
|
||||
#endif
|
||||
if (!GetSolver()->ComputeFunction(aFunction)) {
|
||||
SetErrorCode("Cylinder driver failed");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
catch (Standard_Failure) {
|
||||
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
|
||||
SetErrorCode(aFail->GetMessageString());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder("
|
||||
<< thePnt << ", " << theVec << ", " << theR << ", " << theH << ")";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aCylinder;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeCylinderPntVecRHA
|
||||
*/
|
||||
//=============================================================================
|
||||
Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
|
||||
Handle(GEOM_Object) theVec,
|
||||
double theR, double theH, double theA)
|
||||
{
|
||||
@ -551,7 +658,7 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
|
||||
|
||||
//Add a new Cylinder function for creation a cylinder relatively to point and vector
|
||||
Handle(GEOM_Function) aFunction =
|
||||
aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H);
|
||||
aCylinder->AddFunction(GEOMImpl_CylinderDriver::GetID(), CYLINDER_PNT_VEC_R_H_A);
|
||||
if (aFunction.IsNull()) return NULL;
|
||||
|
||||
//Check if the function is set correctly
|
||||
@ -587,8 +694,8 @@ Handle(GEOM_Object) GEOMImpl_I3DPrimOperations::MakeCylinderPntVecRH (Handle(GEO
|
||||
}
|
||||
|
||||
//Make a Python command
|
||||
GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinder("
|
||||
<< thePnt << ", " << theVec << ", " << theR << ", " << theH << ", " << theA << ")";
|
||||
GEOM::TPythonDump(aFunction) << aCylinder << " = geompy.MakeCylinderA("
|
||||
<< thePnt << ", " << theVec << ", " << theR << ", " << theH << ", " << theA*180./M_PI << "*math.pi/180.)";
|
||||
|
||||
SetErrorCode(OK);
|
||||
return aCylinder;
|
||||
|
@ -48,10 +48,14 @@ class GEOMImpl_I3DPrimOperations : public GEOM_IOperations {
|
||||
Handle(GEOM_Object) theVec,
|
||||
double theR);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeDiskR (double theR, int theOrientation);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH, double theA);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRH (double theR, double theH);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRH (Handle(GEOM_Object) thePnt,
|
||||
Handle(GEOM_Object) theVec,
|
||||
double theR, double theH, double theA);
|
||||
double theR, double theH);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderRHA (double theR, double theH, double theA);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeCylinderPntVecRHA (Handle(GEOM_Object) thePnt,
|
||||
Handle(GEOM_Object) theVec,
|
||||
double theR, double theH, double theA);
|
||||
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeConeR1R2H (double theR1, double theR2, double theH);
|
||||
Standard_EXPORT Handle(GEOM_Object) MakeConePntVecR1R2H (Handle(GEOM_Object) thePnt,
|
||||
|
@ -24,14 +24,12 @@
|
||||
//
|
||||
#include "GEOM_Function.hxx"
|
||||
|
||||
#define CYL_ARG_PNT 1
|
||||
#define CYL_ARG_VEC 2
|
||||
#define CYL_ARG_R 3
|
||||
#define CYL_ARG_H 4
|
||||
#define CYL_ARG_R 1
|
||||
#define CYL_ARG_H 2
|
||||
#define CYL_ARG_PNT 3
|
||||
#define CYL_ARG_VEC 4
|
||||
#define CYL_ARG_A 5
|
||||
|
||||
|
||||
|
||||
class GEOMImpl_ICylinder
|
||||
{
|
||||
public:
|
||||
@ -45,10 +43,6 @@ class GEOMImpl_ICylinder
|
||||
void SetH(double theH) { _func->SetReal(CYL_ARG_H, theH); }
|
||||
|
||||
double GetH() { return _func->GetReal(CYL_ARG_H); }
|
||||
|
||||
void SetA(double theA) { _func->SetReal(CYL_ARG_A, theA); }
|
||||
|
||||
double GetA() { return _func->GetReal(CYL_ARG_A); }
|
||||
|
||||
void SetPoint(Handle(GEOM_Function) theRefPoint) { _func->SetReference(CYL_ARG_PNT, theRefPoint); }
|
||||
|
||||
@ -57,6 +51,10 @@ class GEOMImpl_ICylinder
|
||||
void SetVector(Handle(GEOM_Function) theRefVector) { _func->SetReference(CYL_ARG_VEC, theRefVector); }
|
||||
|
||||
Handle(GEOM_Function) GetVector() { return _func->GetReference(CYL_ARG_VEC); }
|
||||
|
||||
void SetA(double theA) { _func->SetReal(CYL_ARG_A, theA); }
|
||||
|
||||
double GetA() { return _func->GetReal(CYL_ARG_A); }
|
||||
|
||||
private:
|
||||
|
||||
|
@ -206,7 +206,9 @@
|
||||
#define DISK_R 3
|
||||
|
||||
#define CYLINDER_R_H 1
|
||||
#define CYLINDER_PNT_VEC_R_H 2
|
||||
#define CYLINDER_PNT_VEC_R_H 2
|
||||
#define CYLINDER_R_H_A 3
|
||||
#define CYLINDER_PNT_VEC_R_H_A 4
|
||||
|
||||
#define CONE_R1_R2_H 1
|
||||
#define CONE_PNT_VEC_R1_R2_H 2
|
||||
|
@ -246,6 +246,27 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeDiskR (CORBA::Double theR,
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double theR,
|
||||
CORBA::Double theH)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Create the Cylinder
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeCylinderRHA
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRHA (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
CORBA::Double theA)
|
||||
{
|
||||
@ -255,7 +276,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Create the Cylinder
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRH(theR, theH, theA);
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderRHA(theR, theH, theA);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
@ -268,6 +289,34 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderRH (CORBA::Double th
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
|
||||
(GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
|
||||
CORBA::Double theR, CORBA::Double theH)
|
||||
{
|
||||
GEOM::GEOM_Object_var aGEOMObject;
|
||||
|
||||
//Set a not done flag
|
||||
GetOperations()->SetNotDone();
|
||||
|
||||
//Get the reference points
|
||||
Handle(GEOM_Object) aPnt = GetObjectImpl(thePnt);
|
||||
Handle(GEOM_Object) aVec = GetObjectImpl(theVec);
|
||||
|
||||
if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Create the Cylinder
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
return GetObject(anObject);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
/*!
|
||||
* MakeCylinderPntVecRHA
|
||||
*/
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRHA
|
||||
(GEOM::GEOM_Object_ptr thePnt, GEOM::GEOM_Object_ptr theVec,
|
||||
CORBA::Double theR, CORBA::Double theH, CORBA::Double theA)
|
||||
{
|
||||
@ -283,7 +332,7 @@ GEOM::GEOM_Object_ptr GEOM_I3DPrimOperations_i::MakeCylinderPntVecRH
|
||||
if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
|
||||
|
||||
//Create the Cylinder
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRH(aPnt, aVec, theR, theH, theA);
|
||||
Handle(GEOM_Object) anObject = GetOperations()->MakeCylinderPntVecRHA(aPnt, aVec, theR, theH, theA);
|
||||
if (!GetOperations()->IsDone() || anObject.IsNull())
|
||||
return aGEOMObject._retn();
|
||||
|
||||
|
@ -69,15 +69,23 @@ class GEOM_I_EXPORT GEOM_I3DPrimOperations_i :
|
||||
CORBA::Short theOrientation);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
CORBA::Double theA);
|
||||
|
||||
CORBA::Double theH);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt,
|
||||
GEOM::GEOM_Object_ptr theVec,
|
||||
CORBA::Double theR,
|
||||
CORBA::Double theH);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
CORBA::Double theA);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
||||
GEOM::GEOM_Object_ptr theVec,
|
||||
CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
CORBA::Double theA);
|
||||
|
||||
CORBA::Double theA);
|
||||
|
||||
GEOM::GEOM_Object_ptr MakeConeR1R2H (CORBA::Double theR1,
|
||||
CORBA::Double theR2,
|
||||
CORBA::Double theH);
|
||||
|
@ -1049,13 +1049,12 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeDiskR (CORBA::Double theR,
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt,
|
||||
GEOM::GEOM_Object_ptr theAxis,
|
||||
CORBA::Double theRadius,
|
||||
CORBA::Double theHeight,
|
||||
CORBA::Double theAngle)
|
||||
CORBA::Double theHeight)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeCylinderPntVecRH" );
|
||||
MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRH");
|
||||
get3DPrimOp();
|
||||
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderPntVecRH(thePnt, theAxis, theRadius, theHeight, theAngle);
|
||||
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderPntVecRH(thePnt, theAxis, theRadius, theHeight);
|
||||
endService( " GEOM_Superv_i::MakeCylinderPntVecRH" );
|
||||
return anObj;
|
||||
}
|
||||
@ -1064,17 +1063,48 @@ GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr
|
||||
// MakeCylinderRH:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRH (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
CORBA::Double theA)
|
||||
CORBA::Double theH)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeCylinderRH" );
|
||||
MESSAGE("GEOM_Superv_i::MakeCylinderRH");
|
||||
get3DPrimOp();
|
||||
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRH(theR, theH, theA);
|
||||
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRH(theR, theH);
|
||||
endService( " GEOM_Superv_i::MakeCylinderRH" );
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeCylinderPntVecRHA:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
||||
GEOM::GEOM_Object_ptr theAxis,
|
||||
CORBA::Double theRadius,
|
||||
CORBA::Double theHeight,
|
||||
CORBA::Double theAngle)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeCylinderPntVecRHA" );
|
||||
MESSAGE("GEOM_Superv_i::MakeCylinderPntVecRHA");
|
||||
get3DPrimOp();
|
||||
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderPntVecRHA(thePnt, theAxis, theRadius, theHeight, theAngle);
|
||||
endService( " GEOM_Superv_i::MakeCylinderPntVecRHA" );
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeCylinderRHA:
|
||||
//=============================================================================
|
||||
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeCylinderRHA (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
CORBA::Double theA)
|
||||
{
|
||||
beginService( " GEOM_Superv_i::MakeCylinderRHA" );
|
||||
MESSAGE("GEOM_Superv_i::MakeCylinderRHA");
|
||||
get3DPrimOp();
|
||||
GEOM::GEOM_Object_ptr anObj = my3DPrimOp->MakeCylinderRHA(theR, theH, theA);
|
||||
endService( " GEOM_Superv_i::MakeCylinderRHA" );
|
||||
return anObj;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// MakeSphere:
|
||||
//=============================================================================
|
||||
|
@ -241,13 +241,19 @@ public:
|
||||
GEOM::GEOM_Object_ptr MakeDiskR (CORBA::Double theR,
|
||||
CORBA::Short theOrientation);
|
||||
GEOM::GEOM_Object_ptr MakeCylinderPntVecRH (GEOM::GEOM_Object_ptr thePnt,
|
||||
GEOM::GEOM_Object_ptr theAxis,
|
||||
CORBA::Double theRadius,
|
||||
CORBA::Double theHeight);
|
||||
GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
|
||||
CORBA::Double theH);
|
||||
GEOM::GEOM_Object_ptr MakeCylinderPntVecRHA (GEOM::GEOM_Object_ptr thePnt,
|
||||
GEOM::GEOM_Object_ptr theAxis,
|
||||
CORBA::Double theRadius,
|
||||
CORBA::Double theHeight,
|
||||
CORBA::Double theAngle);
|
||||
GEOM::GEOM_Object_ptr MakeCylinderRH (CORBA::Double theR,
|
||||
GEOM::GEOM_Object_ptr MakeCylinderRHA (CORBA::Double theR,
|
||||
CORBA::Double theH,
|
||||
CORBA::Double theA);
|
||||
CORBA::Double theA);
|
||||
GEOM::GEOM_Object_ptr MakeSphere (CORBA::Double theX,
|
||||
CORBA::Double theY,
|
||||
CORBA::Double theZ,
|
||||
|
@ -147,18 +147,20 @@ def TestAll (geompy, math):
|
||||
tan_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
|
||||
|
||||
#Create base geometry 3D
|
||||
Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object)->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
|
||||
Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(2 GEOM_Object, 2 Doubles)->GEOM_Object
|
||||
Cyl1 = geompy.MakeCylinderRH(radius2, height) #(2 Doubles)->GEOM_Object
|
||||
Sphere = geompy.MakeSpherePntR(p0, radius1) #(GEOM_Object, Double)->GEOM_Object
|
||||
Sphere1 = geompy.MakeSphereR(radius) #(Double)->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
|
||||
Cone1 = geompy.MakeConeR1R2H(radius1, radius, height) #(3 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
|
||||
Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object)->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
|
||||
Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(2 GEOM_Object, 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
|
||||
Cyl2 = geompy.MakeCylinderRHA(radius2, height,angle2) #(2 Doubles)->GEOM_Object
|
||||
Sphere = geompy.MakeSpherePntR(p0, radius1) #(GEOM_Object, Double)->GEOM_Object
|
||||
Sphere1 = geompy.MakeSphereR(radius) #(Double)->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
|
||||
Cone1 = geompy.MakeConeR1R2H(radius1, radius, height) #(3 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
|
||||
|
||||
#Boolean (Common, Cut, Fuse, Section)
|
||||
Common = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object, Short)->GEOM_Object
|
||||
@ -372,6 +374,8 @@ def TestAll (geompy, math):
|
||||
id_Box2 = geompy.addToStudy(Box2, "Box (10,20,30)-(15,25,35)")
|
||||
id_Cylinder = geompy.addToStudy(Cylinder, "Cylinder")
|
||||
id_Cyl1 = geompy.addToStudy(Cyl1, "Cylinder RH")
|
||||
id_Cylinder1= geompy.addToStudy(Cylinder1,"CylinderA")
|
||||
id_Cyl2 = geompy.addToStudy(Cyl2, "Cylinder RHA")
|
||||
id_Sphere = geompy.addToStudy(Sphere, "Sphere Pnt R")
|
||||
id_Sphere1 = geompy.addToStudy(Sphere1, "Sphere R")
|
||||
id_Sphere2 = geompy.addToStudy(Sphere2, "Sphere")
|
||||
|
@ -2969,12 +2969,11 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
self._autoPublish(anObj, theName, "disk")
|
||||
return anObj
|
||||
|
||||
## Create a cylinder with given base point, axis, radius, height and angle (for a portion of cylinder).
|
||||
## Create a cylinder with given base point, axis, radius and height.
|
||||
# @param thePnt Central point of cylinder base.
|
||||
# @param theAxis Cylinder axis.
|
||||
# @param theR Cylinder radius.
|
||||
# @param theH Cylinder height.
|
||||
# @param theA Cylinder angle in radian.
|
||||
# @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.
|
||||
@ -2983,16 +2982,15 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
#
|
||||
# @ref tui_creation_cylinder "Example"
|
||||
@ManageTransactions("PrimOp")
|
||||
def MakeCylinder(self, thePnt, theAxis, theR, theH, theA=2*math.pi, theName=None):
|
||||
def MakeCylinder(self, thePnt, theAxis, theR, theH, theName=None):
|
||||
"""
|
||||
Create a cylinder with given base point, axis, radius, height and angle (for a portion of cylinder).
|
||||
Create a cylinder with given base point, axis, radius and height.
|
||||
|
||||
Parameters:
|
||||
thePnt Central point of cylinder base.
|
||||
theAxis Cylinder axis.
|
||||
theR Cylinder radius.
|
||||
theH Cylinder height.
|
||||
theA Cylinder angle in radian.
|
||||
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.
|
||||
@ -3001,20 +2999,19 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
New GEOM.GEOM_Object, containing the created cylinder.
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
|
||||
anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH, theA)
|
||||
|
||||
theR,theH,Parameters = ParseParameters(theR, theH)
|
||||
anObj = self.PrimOp.MakeCylinderPntVecRH(thePnt, theAxis, theR, theH)
|
||||
RaiseIfFailed("MakeCylinderPntVecRH", self.PrimOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
self._autoPublish(anObj, theName, "cylinder")
|
||||
return anObj
|
||||
|
||||
## Create a cylinder with given radius, height and angle (for a portion of cylinder) at
|
||||
# the origin of coordinate system. Axis of the cylinder
|
||||
# will be collinear to the OZ axis of the coordinate system.
|
||||
|
||||
## Create a portion of cylinder with given base point, axis, radius, height and angle.
|
||||
# @param thePnt Central point of cylinder base.
|
||||
# @param theAxis Cylinder axis.
|
||||
# @param theR Cylinder radius.
|
||||
# @param theH Cylinder height.
|
||||
# @param theA Cylinder angle in radian.
|
||||
# @param theA Cylinder angle in radians.
|
||||
# @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.
|
||||
@ -3023,16 +3020,16 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
#
|
||||
# @ref tui_creation_cylinder "Example"
|
||||
@ManageTransactions("PrimOp")
|
||||
def MakeCylinderRH(self, theR, theH, theA=2*math.pi, theName=None):
|
||||
def MakeCylinderA(self, thePnt, theAxis, theR, theH, theA, theName=None):
|
||||
"""
|
||||
Create a cylinder with given radius, height and angle (for a portion of cylinder)at
|
||||
the origin of coordinate system. Axis of the cylinder
|
||||
will be collinear to the OZ axis of the coordinate system.
|
||||
Create a a portion of cylinder with given base point, axis, radius, height and angle.
|
||||
|
||||
Parameters:
|
||||
thePnt Central point of cylinder base.
|
||||
theAxis Cylinder axis.
|
||||
theR Cylinder radius.
|
||||
theH Cylinder height.
|
||||
theA Cylinder angle in radian.
|
||||
theA Cylinder angle in radians.
|
||||
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.
|
||||
@ -3041,13 +3038,98 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
New GEOM.GEOM_Object, containing the created cylinder.
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
flag = False
|
||||
if isinstance(theA,str):
|
||||
flag = True
|
||||
theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
|
||||
anObj = self.PrimOp.MakeCylinderRH(theR, theH, theA)
|
||||
|
||||
if flag:
|
||||
theA = theA*math.pi/180.
|
||||
anObj = self.PrimOp.MakeCylinderPntVecRHA(thePnt, theAxis, theR, theH, theA)
|
||||
RaiseIfFailed("MakeCylinderPntVecRHA", self.PrimOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
self._autoPublish(anObj, theName, "cylinder")
|
||||
return anObj
|
||||
|
||||
## Create a cylinder with given radius and height at
|
||||
# the origin of coordinate system. Axis of the cylinder
|
||||
# will be collinear to the OZ axis of the coordinate system.
|
||||
# @param theR Cylinder radius.
|
||||
# @param theH Cylinder height.
|
||||
# @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 created cylinder.
|
||||
#
|
||||
# @ref tui_creation_cylinder "Example"
|
||||
@ManageTransactions("PrimOp")
|
||||
def MakeCylinderRH(self, theR, theH, theName=None):
|
||||
"""
|
||||
Create a cylinder with given radius and height at
|
||||
the origin of coordinate system. Axis of the cylinder
|
||||
will be collinear to the OZ axis of the coordinate system.
|
||||
|
||||
Parameters:
|
||||
theR Cylinder radius.
|
||||
theH Cylinder height.
|
||||
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 created cylinder.
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
theR,theH,Parameters = ParseParameters(theR, theH)
|
||||
anObj = self.PrimOp.MakeCylinderRH(theR, theH)
|
||||
RaiseIfFailed("MakeCylinderRH", self.PrimOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
self._autoPublish(anObj, theName, "cylinder")
|
||||
return anObj
|
||||
|
||||
## Create a portion of cylinder with given radius, height and angle at
|
||||
# the origin of coordinate system. Axis of the cylinder
|
||||
# will be collinear to the OZ axis of the coordinate system.
|
||||
# @param theR Cylinder radius.
|
||||
# @param theH Cylinder height.
|
||||
# @param theA Cylinder angle in radians.
|
||||
# @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 created cylinder.
|
||||
#
|
||||
# @ref tui_creation_cylinder "Example"
|
||||
@ManageTransactions("PrimOp")
|
||||
def MakeCylinderRHA(self, theR, theH, theA, theName=None):
|
||||
"""
|
||||
Create a portion of cylinder with given radius, height and angle at
|
||||
the origin of coordinate system. Axis of the cylinder
|
||||
will be collinear to the OZ axis of the coordinate system.
|
||||
|
||||
Parameters:
|
||||
theR Cylinder radius.
|
||||
theH Cylinder height.
|
||||
theA Cylinder angle in radians.
|
||||
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 created cylinder.
|
||||
"""
|
||||
# Example: see GEOM_TestAll.py
|
||||
flag = False
|
||||
if isinstance(theA,str):
|
||||
flag = True
|
||||
theR,theH,theA,Parameters = ParseParameters(theR, theH, theA)
|
||||
if flag:
|
||||
theA = theA*math.pi/180.
|
||||
anObj = self.PrimOp.MakeCylinderRHA(theR, theH, theA)
|
||||
RaiseIfFailed("MakeCylinderRHA", self.PrimOp)
|
||||
anObj.SetParameters(Parameters)
|
||||
self._autoPublish(anObj, theName, "cylinder")
|
||||
return anObj
|
||||
|
||||
## Create a sphere with given center and radius.
|
||||
# @param thePnt Sphere center.
|
||||
@ -7831,7 +7913,7 @@ class geomBuilder(object, GEOM._objref_GEOM_Gen):
|
||||
return anObj
|
||||
|
||||
## Rotate the given object around the given axis
|
||||
# on the given angle, creating its copy before the rotatation.
|
||||
# on the given angle, creating its copy before the rotation.
|
||||
# @param theObject The object to be rotated.
|
||||
# @param theAxis Rotation axis.
|
||||
# @param theAngle Rotation angle in radians.
|
||||
|
@ -89,7 +89,7 @@ PrimitiveGUI_CylinderDlg::PrimitiveGUI_CylinderDlg (GeometryGUI* theGeometryGUI,
|
||||
GroupDimensions->TextLabel3->setText(tr("GEOM_ANGLE"));
|
||||
GroupDimensions->checkBox->setText(tr(""));
|
||||
GroupDimensions->SpinBox_DZ->setDisabled(true);
|
||||
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
|
||||
layout->setMargin(0); layout->setSpacing(6);
|
||||
layout->addWidget(GroupPoints);
|
||||
@ -121,13 +121,14 @@ void PrimitiveGUI_CylinderDlg::Init()
|
||||
double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
|
||||
|
||||
// min, max, step and decimals for spin boxes & initial values
|
||||
double SpecificStep = 5;
|
||||
initSpinBox(GroupPoints->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
|
||||
initSpinBox(GroupPoints->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
|
||||
initSpinBox(GroupPoints->SpinBox_DZ, 0.00001, 360., step, "length_precision" );
|
||||
initSpinBox(GroupPoints->SpinBox_DZ, 0.00001, 359.99999, SpecificStep, "angle_precision" );
|
||||
|
||||
initSpinBox(GroupDimensions->SpinBox_DX, 0.00001, COORD_MAX, step, "length_precision" );
|
||||
initSpinBox(GroupDimensions->SpinBox_DY, 0.00001, COORD_MAX, step, "length_precision" );
|
||||
initSpinBox(GroupDimensions->SpinBox_DZ, 0.00001, 360., step, "length_precision" );
|
||||
|
||||
initSpinBox(GroupDimensions->SpinBox_DZ, 0.00001, 359.99999, SpecificStep, "angle_precision" );
|
||||
|
||||
// init variables
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
@ -139,7 +140,7 @@ void PrimitiveGUI_CylinderDlg::Init()
|
||||
myPoint.nullify();
|
||||
myDir.nullify();
|
||||
|
||||
double aRadius(100.0), aHeight(300.0), aAngle(360.);
|
||||
double aRadius(100.0), aHeight(300.0), aAngle(270.);
|
||||
GroupPoints->SpinBox_DX->setValue(aRadius);
|
||||
GroupPoints->SpinBox_DY->setValue(aHeight);
|
||||
GroupPoints->SpinBox_DZ->setValue(aAngle);
|
||||
@ -167,7 +168,7 @@ void PrimitiveGUI_CylinderDlg::Init()
|
||||
|
||||
connect(GroupPoints->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
|
||||
connect(GroupDimensions->checkBox, SIGNAL(toggled(bool)), this, SLOT(ActivateAngle()));
|
||||
|
||||
|
||||
initName(tr("GEOM_CYLINDER"));
|
||||
|
||||
setConstructorId(1); // simplest constructor
|
||||
@ -182,10 +183,8 @@ void PrimitiveGUI_CylinderDlg::SetDoubleSpinBoxStep (double step)
|
||||
{
|
||||
GroupPoints->SpinBox_DX->setSingleStep(step);
|
||||
GroupPoints->SpinBox_DY->setSingleStep(step);
|
||||
GroupPoints->SpinBox_DZ->setSingleStep(step);
|
||||
GroupDimensions->SpinBox_DX->setSingleStep(step);
|
||||
GroupDimensions->SpinBox_DY->setSingleStep(step);
|
||||
GroupDimensions->SpinBox_DZ->setSingleStep(step);
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
@ -418,6 +417,7 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
||||
{
|
||||
bool res = false;
|
||||
bool BAngle = false;
|
||||
|
||||
GEOM::GEOM_Object_var anObj;
|
||||
|
||||
GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
|
||||
@ -426,32 +426,56 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
|
||||
case 0:
|
||||
BAngle = GroupPoints->checkBox->isChecked();
|
||||
if ( myPoint && myDir ) {
|
||||
if(!BAngle) anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight(), 360.);
|
||||
else anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight(), getAngle());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupPoints->SpinBox_DX->text();
|
||||
aParameters << GroupPoints->SpinBox_DY->text();
|
||||
aParameters << GroupPoints->SpinBox_DZ->text();
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
if(!BAngle){
|
||||
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.);
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupPoints->SpinBox_DX->text();
|
||||
aParameters << GroupPoints->SpinBox_DY->text();
|
||||
aParameters << GroupPoints->SpinBox_DZ->text();
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
BAngle = GroupDimensions->checkBox->isChecked();
|
||||
if(!BAngle)anObj = anOper->MakeCylinderRH(getRadius(), getHeight(), 360.);
|
||||
else anObj = anOper->MakeCylinderRH(getRadius(), getHeight(), getAngle());
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||
aParameters << GroupDimensions->SpinBox_DZ->text();
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
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.);
|
||||
if (!anObj->_is_nil() && !IsPreview())
|
||||
{
|
||||
QStringList aParameters;
|
||||
aParameters << GroupDimensions->SpinBox_DX->text();
|
||||
aParameters << GroupDimensions->SpinBox_DY->text();
|
||||
aParameters << GroupDimensions->SpinBox_DZ->text();
|
||||
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
|
||||
}
|
||||
res = true;
|
||||
}
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -530,4 +554,4 @@ void PrimitiveGUI_CylinderDlg::ActivateAngle()
|
||||
GroupDimensions->SpinBox_DZ->setEnabled( GroupDimensions->checkBox->isChecked() );
|
||||
processPreview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user