To create an \b Edge, in the <b>Main Menu</b> select <b>New Entity >
Build > Edge</b>
-There are two ways to create an edge. In both cases the \b Result
+There are three ways to create an edge. In all cases the \b Result
will be a \b GEOM_Object (EDGE).
-Firstly, you can create an \b Edge by specifying two points (\b Point1 and
+Firstly, you can create a linear \b Edge by specifying two points (\b Point1 and
\b Point2), which are the first and the last vertices of the edge.
<b>TUI Command:</b> <em>geompy.MakeEdge(Vertex1, Vertex2)</em><br>
\image html edge2.png "Create edge from wire"
+The third case allows building edges of desired length on any existing
+curve (selected existing edge). <b>Start Point</b> parameter is optional.
+Any point can be selected for it, the new edge will begin at the end
+of initial edge, close to the selected point. <b>Length</b> can exceed
+the initial edge's length or be negative to extrapolate existing edge
+along its curve (except bezier and b-spline curves).
+
+<b>TUI Command:</b> <em>geompy.MakeEdgeOnCurveByLength(Edge, Length, StartPoint = None)</em><br>
+<b>Arguments:</b> Name + 1 edge + Length + 1 Vertex
+(StartPoint parameter is optional, it allows switching from one end of
+initial edge to another. Length can exceed the initial edge's length or be negative).
+
+\image html edge3.png "Create edge on curve"
+
<b>Example:</b>
\image html edgesn.png "Edge"
\image html point3.png
Alternatively, it is possible to define the point by \b Edge and \b Length,
-the given length must not exceed the length of the edge. The orientation of the edge can be reversed.
-\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurveByLength(Edge,Length,Reverse).</em>
-\n <b>Arguments:</b> Name + 1 edge + 1 Length defining the
-position of the point on the given edge + 1 Reverse flag defining the direction for the
-calculation of the length (False = forward, True = reversed).
+the given length can exceed the length of the edge or be negative
+(except bezier and b-spline curves). The orientation of the edge can
+be reversed by the \b StartPoint selection.
+\n <b>TUI Command:</b> <em>geompy.MakeVertexOnCurveByLength(Edge,Length,StartPoint=None).</em>
+\n <b>Arguments:</b> Name + 1 edge + 1 Length defining the position
+of the point on the given edge + 1 Point defining the direction for
+the calculation of the length (if not defined, the first vertex of
+Edge is used, else the vertex of Edge closest to StartPoint is used).
\image html point3_3.png
It is also possible to define 3D coordinates of the point
# display an edge
gg.createAndDisplayGO(id_edge)
+#
+# create edge from existing curve and a length
+#
+
+# create a circle
+c = geompy.MakeCircle(None, None, 100)
+
+# create an edge of length 25.0 from the circle
+edge = geompy.MakeEdgeOnCurveByLength(c, 25.0)
+
+# add object in the study
+id_edge = geompy.addToStudy(edge,"Edge_3")
+
+# display an edge
+gg.createAndDisplayGO(id_edge)
+
\endcode
\anchor tui_creation_wire
/*!
* Create a point, corresponding to the given length on the given curve.
* \param theRefCurve The referenced curve.
- * \param theLength Length on the referenced curve.
- * \param theReverse Direction for the calculation of the length (false = forward or true = reversed).
+ * \param theLength Length on the referenced curve. It can be negative.
+ * \param theStartPoint Any vertex close to one of edge's
+ * ends to select start point among them.
+ * If NULL, fist vertex is used.
* \return New GEOM_Object, containing the created point.
*/
GEOM_Object MakePointOnCurveByLength (in GEOM_Object theRefCurve,
- in double theLength,
- in boolean theReverse);
+ in double theLength,
+ in GEOM_Object theStartPoint);
/*!
* Create a point on the given curve, projecting given point
*/
GEOM_Object MakeEdge (in GEOM_Object thePnt1, in GEOM_Object thePnt2);
+ /*!
+ * Create an edge on another edge, corresponding to the given length on the given edge.
+ * \param theRefCurve The referenced edge.
+ * \param theLength Length on the referenced edge. It can be
+ * negative for extrapolation on base curve.
+ * \param theStartPoint Any vertex close to one of edge's
+ * ends to select start point among them.
+ * If NULL, fist vertex is used.
+ * \return New GEOM_Object, containing the created edge.
+ */
+ GEOM_Object MakeEdgeOnCurveByLength (in GEOM_Object theRefCurve,
+ in double theLength,
+ in GEOM_Object theStartPoint);
+
/*!
* Create an edge from specified wire.
* \param theWire source Wire.
boolean CheckShapeWithGeometry (in GEOM_Object theShape,
out string theDescription);
+ /*!
+ * Check if the given shape can be an argument for MakeSolid operation
+ * \param theShape Shape to be described.
+ * \return Empty string if a solid can be made on this shape, error code otherwise.
+ */
+ string IsGoodForSolid (in GEOM_Object theShape);
+
/*!
* Obtain description of the given shape
* \param theShape Shape to be described.
*/
double GetAngle (in GEOM_Object theShape1, in GEOM_Object theShape2);
+ /*!
+ * Get angle between the given vectors.
+ * \param theShape1,theShape2 Vectors to find angle between.
+ * \return Value of the angle between the given vectors.
+ */
+ double GetAngleBtwVectors (in GEOM_Object theShape1, in GEOM_Object theShape2);
+
/*!
* Get point coordinates
*/
//-----------------------------------------------------------//
GEOM_Object MakePointXYZ (in double theX,
in double theY,
- in double theZ) ;
+ in double theZ);
GEOM_Object MakePointWithReference (in GEOM_Object theReference,
in double theX,
in double theY,
- in double theZ) ;
+ in double theZ);
GEOM_Object MakePointOnCurve (in GEOM_Object theRefCurve,
- in double theParameter) ;
+ in double theParameter);
+ GEOM_Object MakePointOnCurveByLength (in GEOM_Object theRefCurve,
+ in double theLength,
+ in GEOM_Object theStartPoint);
GEOM_Object MakeTangentOnCurve (in GEOM_Object theRefCurve,
in double theParameter);
//-----------------------------------------------------------//
GEOM_Object MakeEdge (in GEOM_Object thePnt1,
in GEOM_Object thePnt2) ;
+ GEOM_Object MakeEdgeOnCurveByLength (in GEOM_Object theRefCurve,
+ in double theLength,
+ in GEOM_Object theStartPoint);
GEOM_Object MakeWire (in GEOM_List theEdgesAndWires,
in double theTolerance) ;
GEOM_Object MakeFace (in GEOM_Object theWire,
boxdxyz.png \
build_compound.png \
build_edge.png \
-build_edge_wire.png \
+build_edge_wire.png \
+build_edge_curve.png \
build_face.png \
build_shell.png \
build_solid.png \
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : BasicGUI_PointDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+
#include "BasicGUI_PointDlg.h"
#include <SUIT_ResourceMgr.h>
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* parent,
- bool modal, Qt::WindowFlags fl )
- : GEOMBase_Skeleton( theGeometryGUI, parent, modal, fl ),
- myBusy ( false )
+BasicGUI_PointDlg::BasicGUI_PointDlg(GeometryGUI* theGeometryGUI, QWidget* parent,
+ bool modal, Qt::WindowFlags fl)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
+ myBusy (false)
{
- QPixmap image0( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT") ) );
- QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_EDGE" ) ) );
- QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
- QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) );
- QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_LINES") ) );
- QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_FACE" ) ) );
- QPixmap image6( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_LINE" ) ) );
- QPixmap image7( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICO_WIRE" ) ) );
-
- setWindowTitle( tr( "GEOM_POINT_TITLE" ) );
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_EDGE")));
+ QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_REF")));
+ QPixmap image4 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_LINES")));
+ QPixmap image5 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_POINT_FACE")));
+ QPixmap image6 (aResMgr->loadPixmap("GEOM", tr("ICO_LINE")));
+ QPixmap image7 (aResMgr->loadPixmap("GEOM", tr("ICO_WIRE")));
+
+ setWindowTitle(tr("GEOM_POINT_TITLE"));
/***************************************************************/
- mainFrame()->GroupConstructors->setTitle( tr( "GEOM_POINTS" ) );
- mainFrame()->RadioButton1->setIcon( image0 );
- mainFrame()->RadioButton2->setIcon( image3 );
- mainFrame()->RadioButton3->setIcon( image1 );
+ mainFrame()->GroupConstructors->setTitle(tr("GEOM_POINTS"));
+ mainFrame()->RadioButton1->setIcon(image0);
+ mainFrame()->RadioButton2->setIcon(image3);
+ mainFrame()->RadioButton3->setIcon(image1);
mainFrame()->RadioButton4->show();
- mainFrame()->RadioButton4->setIcon( image4 );
+ mainFrame()->RadioButton4->setIcon(image4);
mainFrame()->RadioButton5->show();
- mainFrame()->RadioButton5->setIcon( image5 );
-
- myParamGroup = new QGroupBox( centralWidget() );
- myParamCoord = new QButtonGroup( myParamGroup );
- QHBoxLayout* boxLayout = new QHBoxLayout( myParamGroup );
- boxLayout->setMargin( MARGIN ); boxLayout->setSpacing( SPACING );
- QRadioButton* btn = new QRadioButton( tr( "GEOM_PARAM_VALUE" ), myParamGroup );
- myParamCoord->addButton( btn, PARAM_VALUE );
- boxLayout->addWidget( btn );
- btn = new QRadioButton( tr( "GEOM_LENGTH_VALUE" ), myParamGroup );
- myParamCoord->addButton( btn, LENGTH_VALUE );
- boxLayout->addWidget( btn );
- btn = new QRadioButton( tr( "GEOM_COORD_VALUE" ), myParamGroup );
- myParamCoord->addButton( btn, COORD_VALUE );
- boxLayout->addWidget( btn );
- myParamCoord->setExclusive( true );
- myParamCoord->button( PARAM_VALUE )->setChecked( true );
-
- GroupXYZ = new DlgRef_3Spin( centralWidget() );
- GroupXYZ->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) );
- GroupXYZ->TextLabel1->setText( tr( "GEOM_X" ) );
- GroupXYZ->TextLabel2->setText( tr( "GEOM_Y" ) );
- GroupXYZ->TextLabel3->setText( tr( "GEOM_Z" ) );
-
- GroupOnCurve = new DlgRef_1Sel1Spin1Check( centralWidget() );
- GroupOnCurve->GroupBox1->setTitle( tr( "GEOM_POINT_ON_EDGE" ) );
- GroupOnCurve->TextLabel1->setText( tr( "GEOM_EDGE" ) );
- GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) );
- GroupOnCurve->CheckButton1->setText( tr( "GEOM_REVERSE" ) );
- GroupOnCurve->PushButton1->setIcon( image2 );
-
-
- GroupOnSurface = new DlgRef_1Sel2Spin( centralWidget() );
- GroupOnSurface->GroupBox1->setTitle( tr( "GEOM_POINT_ON_FACE" ) );
- GroupOnSurface->TextLabel1->setText( tr( "GEOM_FACE" ) );
- GroupOnSurface->TextLabel2->setText( tr( "GEOM_UPARAMETER" ) );
- GroupOnSurface->TextLabel3->setText( tr( "GEOM_VPARAMETER" ) );
- GroupOnSurface->PushButton1->setIcon( image2 );
-
- GroupRefPoint = new DlgRef_1Sel3Spin( centralWidget() );
- GroupRefPoint->GroupBox1->setTitle( tr( "GEOM_REF_POINT" ) );
- GroupRefPoint->TextLabel1->setText( tr( "GEOM_POINT" ) );
- GroupRefPoint->PushButton1->setIcon( image2 );
- GroupRefPoint->TextLabel2->setText( tr( "GEOM_DX" ) );
- GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) );
- GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) );
+ mainFrame()->RadioButton5->setIcon(image5);
+
+ myParamGroup = new QGroupBox(centralWidget());
+ myParamCoord = new QButtonGroup(myParamGroup);
+ QHBoxLayout* boxLayout = new QHBoxLayout(myParamGroup);
+ boxLayout->setMargin(MARGIN); boxLayout->setSpacing(SPACING);
+ QRadioButton* btn = new QRadioButton(tr("GEOM_PARAM_VALUE"), myParamGroup);
+ myParamCoord->addButton(btn, PARAM_VALUE);
+ boxLayout->addWidget(btn);
+ btn = new QRadioButton(tr("GEOM_LENGTH_VALUE"), myParamGroup);
+ myParamCoord->addButton(btn, LENGTH_VALUE);
+ boxLayout->addWidget(btn);
+ btn = new QRadioButton(tr("GEOM_COORD_VALUE"), myParamGroup);
+ myParamCoord->addButton(btn, COORD_VALUE);
+ boxLayout->addWidget(btn);
+ myParamCoord->setExclusive(true);
+ myParamCoord->button(PARAM_VALUE)->setChecked(true);
+
+ GroupXYZ = new DlgRef_3Spin(centralWidget());
+ GroupXYZ->GroupBox1->setTitle(tr("GEOM_COORDINATES"));
+ GroupXYZ->TextLabel1->setText(tr("GEOM_X"));
+ GroupXYZ->TextLabel2->setText(tr("GEOM_Y"));
+ GroupXYZ->TextLabel3->setText(tr("GEOM_Z"));
+
+ GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
+ GroupOnCurve->GroupBox1->setTitle(tr("GEOM_POINT_ON_EDGE"));
+ GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
+ GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
+ GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
+ GroupOnCurve->PushButton1->setIcon(image2);
+ GroupOnCurve->PushButton2->setIcon(image2);
+
+ GroupOnSurface = new DlgRef_1Sel2Spin(centralWidget());
+ GroupOnSurface->GroupBox1->setTitle(tr("GEOM_POINT_ON_FACE"));
+ GroupOnSurface->TextLabel1->setText(tr("GEOM_FACE"));
+ GroupOnSurface->TextLabel2->setText(tr("GEOM_UPARAMETER"));
+ GroupOnSurface->TextLabel3->setText(tr("GEOM_VPARAMETER"));
+ GroupOnSurface->PushButton1->setIcon(image2);
+
+ GroupRefPoint = new DlgRef_1Sel3Spin(centralWidget());
+ GroupRefPoint->GroupBox1->setTitle(tr("GEOM_REF_POINT"));
+ GroupRefPoint->TextLabel1->setText(tr("GEOM_POINT"));
+ GroupRefPoint->PushButton1->setIcon(image2);
+ GroupRefPoint->TextLabel2->setText(tr("GEOM_DX"));
+ GroupRefPoint->TextLabel3->setText(tr("GEOM_DY"));
+ GroupRefPoint->TextLabel4->setText(tr("GEOM_DZ"));
/* popup menu for line intersect buttons */
myBtnPopup = new QMenu(this);
- QIcon ico_line = QIcon( image6 );
- QIcon ico_wire = QIcon( image7 );
- myActions[myBtnPopup->addAction( ico_line, tr( "GEOM_EDGE" ) )] = SelectEdge;
- myActions[myBtnPopup->addAction( ico_wire, tr( "GEOM_WIRE" ) )] = SelectWire;
-
- GroupLineIntersection = new DlgRef_2Sel( centralWidget() );
- GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) );
- GroupLineIntersection->TextLabel1->setText( tr( "GEOM_LINE1" ) );
- GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) );
- GroupLineIntersection->PushButton1->setIcon( image2 );
- GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
- GroupLineIntersection->PushButton2->setIcon( image2 );
- GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
+ QIcon ico_line = QIcon(image6);
+ QIcon ico_wire = QIcon(image7);
+ myActions[myBtnPopup->addAction(ico_line, tr("GEOM_EDGE"))] = SelectEdge;
+ myActions[myBtnPopup->addAction(ico_wire, tr("GEOM_WIRE"))] = SelectWire;
+
+ GroupLineIntersection = new DlgRef_2Sel(centralWidget());
+ GroupLineIntersection->GroupBox1->setTitle(tr("GEOM_LINE_INTERSECTION"));
+ GroupLineIntersection->TextLabel1->setText(tr("GEOM_LINE1"));
+ GroupLineIntersection->TextLabel2->setText(tr("GEOM_LINE2"));
+ GroupLineIntersection->PushButton1->setIcon(image2);
+ GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
+ GroupLineIntersection->PushButton2->setIcon(image2);
+ GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
GroupLineIntersection->LineEdit2->setEnabled(false);
- myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES_RES" ), centralWidget() );
- QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp );
- myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), myCoordGrp ), 0, 0 );
- myX = new QLineEdit( myCoordGrp );
- myCoordGrpLayout->addWidget( myX, 0, 1 );
- myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Y" ), myCoordGrp ), 1, 0 );
- myY = new QLineEdit( myCoordGrp );
- myCoordGrpLayout->addWidget( myY, 1, 1 );
- myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_Z" ), myCoordGrp ), 2, 0 );
- myZ = new QLineEdit( myCoordGrp );
- myCoordGrpLayout->addWidget( myZ, 2, 1 );
-
- QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
- layout->setMargin( 0 ); layout->setSpacing( 6 );
- layout->addWidget( myParamGroup );
- layout->addWidget( GroupXYZ );
- layout->addWidget( GroupOnCurve );
- layout->addWidget( GroupOnSurface );
- layout->addWidget( GroupRefPoint );
- layout->addWidget( GroupLineIntersection );
- layout->addWidget( myCoordGrp );
-
- myX->setReadOnly( true );
- myY->setReadOnly( true );
- myZ->setReadOnly( true );
-
- myX->setEnabled( false );
- myY->setEnabled( false );
- myZ->setEnabled( false );
+ myCoordGrp = new QGroupBox(tr("GEOM_COORDINATES_RES"), centralWidget());
+ QGridLayout* myCoordGrpLayout = new QGridLayout(myCoordGrp);
+ myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_X"), myCoordGrp), 0, 0);
+ myX = new QLineEdit(myCoordGrp);
+ myCoordGrpLayout->addWidget(myX, 0, 1);
+ myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Y"), myCoordGrp), 1, 0);
+ myY = new QLineEdit(myCoordGrp);
+ myCoordGrpLayout->addWidget(myY, 1, 1);
+ myCoordGrpLayout->addWidget(new QLabel(tr("GEOM_Z"), myCoordGrp), 2, 0);
+ myZ = new QLineEdit(myCoordGrp);
+ myCoordGrpLayout->addWidget(myZ, 2, 1);
+
+ QVBoxLayout* layout = new QVBoxLayout(centralWidget());
+ layout->setMargin(0); layout->setSpacing(6);
+ layout->addWidget(myParamGroup);
+ layout->addWidget(GroupXYZ);
+ layout->addWidget(GroupOnCurve);
+ layout->addWidget(GroupOnSurface);
+ layout->addWidget(GroupRefPoint);
+ layout->addWidget(GroupLineIntersection);
+ layout->addWidget(myCoordGrp);
+
+ myX->setReadOnly(true);
+ myY->setReadOnly(true);
+ myZ->setReadOnly(true);
+
+ myX->setEnabled(false);
+ myY->setEnabled(false);
+ myZ->setEnabled(false);
QPalette aPal = myX->palette();
- aPal.setColor( QPalette::Disabled, QPalette::Text, QColor( 0, 0, 0 ) );
- myX->setPalette( aPal );
- myY->setPalette( aPal );
- myZ->setPalette( aPal );
+ aPal.setColor(QPalette::Disabled, QPalette::Text, QColor(0, 0, 0));
+ myX->setPalette(aPal);
+ myY->setPalette(aPal);
+ myZ->setPalette(aPal);
- setHelpFileName( "create_point_page.html" );
+ setHelpFileName("create_point_page.html");
Init();
}
//=================================================================================
void BasicGUI_PointDlg::Init()
{
- GroupOnCurve->LineEdit1->setReadOnly( true );
- GroupOnSurface->LineEdit1->setReadOnly( true );
- GroupRefPoint->LineEdit1->setReadOnly( true );
- GroupLineIntersection->LineEdit1->setReadOnly( true );
- GroupLineIntersection->LineEdit2->setReadOnly( true );
- GroupLineIntersection->LineEdit1->setEnabled( true );
- GroupLineIntersection->LineEdit2->setEnabled( false );
+ GroupOnCurve->LineEdit1->setReadOnly(true);
+ GroupOnCurve->LineEdit2->setReadOnly(true);
+ GroupOnSurface->LineEdit1->setReadOnly(true);
+ GroupRefPoint->LineEdit1->setReadOnly(true);
+ GroupLineIntersection->LineEdit1->setReadOnly(true);
+ GroupLineIntersection->LineEdit2->setReadOnly(true);
+ GroupLineIntersection->LineEdit1->setEnabled(true);
+ GroupLineIntersection->LineEdit2->setEnabled(false);
myEdge.nullify();
myFace.nullify();
/* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
+ double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
/* min, max, step and decimals for spin boxes */
- initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
- initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
- initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
- GroupXYZ->SpinBox_DX->setValue( 0.0 );
- GroupXYZ->SpinBox_DY->setValue( 0.0 );
- GroupXYZ->SpinBox_DZ->setValue( 0.0 );
-
- initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
- initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision" );
- initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision" );
- GroupRefPoint->SpinBox_DX->setValue( 0.0 );
- GroupRefPoint->SpinBox_DY->setValue( 0.0 );
- GroupRefPoint->SpinBox_DZ->setValue( 0.0 );
+ initSpinBox(GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
+ initSpinBox(GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision");
+ initSpinBox(GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision");
+ GroupXYZ->SpinBox_DX->setValue(0.0);
+ GroupXYZ->SpinBox_DY->setValue(0.0);
+ GroupXYZ->SpinBox_DZ->setValue(0.0);
+
+ initSpinBox(GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
+ initSpinBox(GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, "length_precision");
+ initSpinBox(GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, "length_precision");
+ GroupRefPoint->SpinBox_DX->setValue(0.0);
+ GroupRefPoint->SpinBox_DY->setValue(0.0);
+ GroupRefPoint->SpinBox_DZ->setValue(0.0);
step = 0.1;
- initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision" );
- GroupOnCurve->SpinBox_DX->setValue( 0.5 );
+ initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., step, "parametric_precision");
+ GroupOnCurve->SpinBox_DX->setValue(0.5);
- initSpinBox( GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision" );
- GroupOnSurface->SpinBox_DX->setValue( 0.5 );
- initSpinBox( GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision" );
- GroupOnSurface->SpinBox_DY->setValue( 0.5 );
+ initSpinBox(GroupOnSurface->SpinBox_DX, 0., 1., step, "parametric_precision");
+ GroupOnSurface->SpinBox_DX->setValue(0.5);
+ initSpinBox(GroupOnSurface->SpinBox_DY, 0., 1., step, "parametric_precision");
+ GroupOnSurface->SpinBox_DY->setValue(0.5);
/* signals and slots connections */
- connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
- connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
-
- connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
- connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
+ connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
+ connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect( myParamCoord, SIGNAL( buttonClicked( int ) ), this, SLOT( ClickParamCoord( int ) ) );
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
- connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupLineIntersection->PushButton1, SIGNAL( pressed() ), this, SLOT( SetEditCurrentArgument() ) );
- connect( GroupLineIntersection->PushButton2, SIGNAL( pressed() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect(myParamCoord, SIGNAL(buttonClicked(int)), this, SLOT(ClickParamCoord(int)));
- connect( myBtnPopup, SIGNAL( triggered( QAction* ) ), this, SLOT( onBtnPopup( QAction* ) ) );
+ connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupOnCurve->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupOnSurface->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupLineIntersection->PushButton1, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupLineIntersection->PushButton2, SIGNAL(pressed()), this, SLOT(SetEditCurrentArgument()));
- connect( GroupOnCurve->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupOnSurface->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupOnSurface->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupXYZ->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupXYZ->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupXYZ->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupRefPoint->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupRefPoint->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
- connect( GroupRefPoint->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect(myBtnPopup, SIGNAL(triggered(QAction*)), this, SLOT(onBtnPopup(QAction*)));
- connect( GroupOnCurve->CheckButton1, SIGNAL( stateChanged( int ) ), this, SLOT( CheckBoxClicked( int ) ) );
+ connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupOnSurface->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupOnSurface->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupXYZ->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupXYZ->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupXYZ->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupRefPoint->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupRefPoint->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
+ connect(GroupRefPoint->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
+ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
- this, SLOT(SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- initName( tr( "GEOM_VERTEX" ) );
+ initName(tr("GEOM_VERTEX"));
- ConstructorsClicked( 0 );
+ ConstructorsClicked(0);
}
//=================================================================================
// function : SetDoubleSpinBoxStep()
// purpose : Double spin box management
//=================================================================================
-void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step )
+void BasicGUI_PointDlg::SetDoubleSpinBoxStep(double step)
{
GroupOnCurve->SpinBox_DX->setSingleStep(step);
GroupXYZ->SpinBox_DX->setSingleStep(step);
//=================================================================================
void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
{
- switch ( constructorId ) {
+ switch (constructorId) {
case GEOM_POINT_XYZ:
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
GroupRefPoint->hide();
GroupOnCurve->hide();
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_VERTEX;
- localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
myEditCurrentArgument = GroupRefPoint->LineEdit1;
- myEditCurrentArgument->setText( "" );
+ myEditCurrentArgument->setText("");
myRefPoint.nullify();
GroupRefPoint->PushButton1->setDown(true);
myParamGroup->hide();
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_EDGE;
- localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
myEditCurrentArgument = GroupOnCurve->LineEdit1;
- myEditCurrentArgument->setText( "" );
+ myEditCurrentArgument->setText("");
myEdge.nullify();
+ myRefPoint.nullify();
GroupOnCurve->PushButton1->setDown(true);
GroupRefPoint->hide();
GroupLineIntersection->hide();
GroupOnSurface->hide();
myParamGroup->show();
- myParamCoord->button( LENGTH_VALUE )->show();
- myParamCoord->button( PARAM_VALUE )->setChecked( true );
+ myParamCoord->button(LENGTH_VALUE)->show();
+ myParamCoord->button(PARAM_VALUE)->setChecked(true);
GroupOnCurve->show();
myCoordGrp->show();
- updateParamCoord( false );
+ updateParamCoord(false);
break;
}
case GEOM_POINT_INTINT:
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_EDGE;
- localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
myEditCurrentArgument = GroupLineIntersection->LineEdit1;
- GroupLineIntersection->LineEdit1->setText( "" );
- GroupLineIntersection->LineEdit2->setText( "" );
- GroupLineIntersection->LineEdit1->setEnabled( true );
- GroupLineIntersection->LineEdit2->setEnabled( false );
+ GroupLineIntersection->LineEdit1->setText("");
+ GroupLineIntersection->LineEdit2->setText("");
+ GroupLineIntersection->LineEdit1->setEnabled(true);
+ GroupLineIntersection->LineEdit2->setEnabled(false);
myLine1.nullify();
myLine2.nullify();
GroupLineIntersection->PushButton1->setDown(true);
{
globalSelection(); // close local contexts, if any
myNeedType = TopAbs_FACE;
- localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
myEditCurrentArgument = GroupOnSurface->LineEdit1;
- myEditCurrentArgument->setText( "" );
+ myEditCurrentArgument->setText("");
myFace.nullify();
GroupOnSurface->PushButton1->setDown(true);
GroupRefPoint->hide();
GroupOnCurve->hide();
GroupLineIntersection->hide();
myParamGroup->show();
- myParamCoord->button( LENGTH_VALUE )->hide();
- myParamCoord->button( PARAM_VALUE )->setChecked(true);
+ myParamCoord->button(LENGTH_VALUE)->hide();
+ myParamCoord->button(PARAM_VALUE)->setChecked(true);
GroupOnSurface->show();
myCoordGrp->show();
- updateParamCoord( false );
+ updateParamCoord(false);
break;
}
}
- myX->setText( "" );
- myY->setText( "" );
- myZ->setText( "" );
+ myX->setText("");
+ myY->setText("");
+ myZ->setText("");
QTimer::singleShot(50, this, SLOT(updateSize()));
SelectionIntoArgument();
}
-
//=================================================================================
// function : ClickOnOk()
// purpose :
//=================================================================================
void BasicGUI_PointDlg::ClickOnOk()
{
- setIsApplyAndClose( true );
- if ( onAccept() )
+ setIsApplyAndClose(true);
+ if (onAccept())
ClickOnCancel();
}
-
//=================================================================================
// function : ClickOnApply()
// purpose :
//=================================================================================
bool BasicGUI_PointDlg::ClickOnApply()
{
- if ( !onAccept() )
+ if (!onAccept())
return false;
initName();
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
return true;
}
erasePreview();
const int id = getConstructorId();
- if ( ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) && myEditCurrentArgument != 0 )
+ if ((id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF)
+ && myEditCurrentArgument != 0)
{
- myEditCurrentArgument->setText( "" );
- myX->setText( "" );
- myY->setText( "" );
- myZ->setText( "" );
- myRefPoint.nullify();
- myEdge.nullify();
+ myEditCurrentArgument->setText("");
+ myX->setText("");
+ myY->setText("");
+ myZ->setText("");
myFace.nullify();
- } else if ( id == GEOM_POINT_INTINT ) {
- myEditCurrentArgument->setText( "" );
- if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 )
+ if (myEditCurrentArgument == GroupOnCurve->LineEdit1)
+ myEdge.nullify();
+ else if (myEditCurrentArgument == GroupOnCurve->LineEdit2)
+ myRefPoint.nullify();
+ }
+ else if (id == GEOM_POINT_INTINT) {
+ myEditCurrentArgument->setText("");
+ if (myEditCurrentArgument == GroupLineIntersection->LineEdit1)
myLine1.nullify();
- else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 )
+ else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2)
myLine2.nullify();
}
- GEOM::GeomObjPtr aSelectedObject = getSelected( myNeedType );
+ GEOM::GeomObjPtr aSelectedObject = getSelected(myNeedType);
TopoDS_Shape aShape;
- if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
- QString aName = GEOMBase::GetName( aSelectedObject.get() );
+ if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) {
+ QString aName = GEOMBase::GetName(aSelectedObject.get());
myBusy = true;
- if ( id == GEOM_POINT_XYZ ) {
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
- GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
- GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
- GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
+ if (id == GEOM_POINT_XYZ) {
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
+ GroupXYZ->SpinBox_DX->setValue(aPnt.X());
+ GroupXYZ->SpinBox_DY->setValue(aPnt.Y());
+ GroupXYZ->SpinBox_DZ->setValue(aPnt.Z());
}
- else if ( id == GEOM_POINT_REF ) {
+ else if (id == GEOM_POINT_REF) {
myRefPoint = aSelectedObject;
- GroupRefPoint->LineEdit1->setText( aName );
+ GroupRefPoint->LineEdit1->setText(aName);
}
- else if ( id == GEOM_POINT_EDGE ) {
- myEdge = aSelectedObject;
- GroupOnCurve->LineEdit1->setText( aName );
+ else if (id == GEOM_POINT_EDGE) {
+ myEditCurrentArgument->setText(aName);
+ if (myEditCurrentArgument == GroupOnCurve->LineEdit1) {
+ myEdge = aSelectedObject;
+ if (myEdge && !myRefPoint) {
+ GroupOnCurve->PushButton2->click();
+ }
+ }
+ else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) {
+ myRefPoint = aSelectedObject;
+ if (myRefPoint && !myEdge) {
+ GroupOnCurve->PushButton1->click();
+ }
+ }
}
- else if ( id == GEOM_POINT_INTINT ) {
- myEditCurrentArgument->setText( aName );
- if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
- myLine1 = aSelectedObject;
- if ( myLine1 && !myLine2 ) {
- GroupLineIntersection->PushButton2->setMenu( 0 );
- GroupLineIntersection->PushButton2->click();
- GroupLineIntersection->PushButton2->setDown(true);
- GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
- }
+ else if (id == GEOM_POINT_INTINT) {
+ myEditCurrentArgument->setText(aName);
+ if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
+ myLine1 = aSelectedObject;
+ if (myLine1 && !myLine2) {
+ GroupLineIntersection->PushButton2->setMenu(0);
+ GroupLineIntersection->PushButton2->click();
+ GroupLineIntersection->PushButton2->setDown(true);
+ GroupLineIntersection->PushButton2->setMenu(myBtnPopup);
+ }
}
- else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
- myLine2 = aSelectedObject;
- if ( myLine2 && !myLine1 ) {
- GroupLineIntersection->PushButton1->setMenu( 0 );
- GroupLineIntersection->PushButton1->click();
- GroupLineIntersection->PushButton1->setDown(true);
- GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
- }
+ else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
+ myLine2 = aSelectedObject;
+ if (myLine2 && !myLine1) {
+ GroupLineIntersection->PushButton1->setMenu(0);
+ GroupLineIntersection->PushButton1->click();
+ GroupLineIntersection->PushButton1->setDown(true);
+ GroupLineIntersection->PushButton1->setMenu(myBtnPopup);
+ }
}
}
- else if ( id == GEOM_POINT_SURF ) {
+ else if (id == GEOM_POINT_SURF) {
myFace = aSelectedObject;
- GroupOnSurface->LineEdit1->setText( aName );
+ GroupOnSurface->LineEdit1->setText(aName);
}
myBusy = false;
}
-
+
displayPreview(true);
}
{
QPushButton* send = (QPushButton*)sender();
- if ( send == GroupRefPoint->PushButton1 ) {
+ if (send == GroupRefPoint->PushButton1) {
GroupRefPoint->LineEdit1->setFocus();
myEditCurrentArgument = GroupRefPoint->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
}
- else if ( send == GroupOnCurve->PushButton1 ) {
+ else if (send == GroupOnCurve->PushButton1) {
GroupOnCurve->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnCurve->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ myNeedType = TopAbs_EDGE;
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ GroupOnCurve->PushButton2->setDown(false);
+ GroupOnCurve->LineEdit1->setEnabled(true);
+ GroupOnCurve->LineEdit2->setEnabled(false);
+ }
+ else if (send == GroupOnCurve->PushButton2) {
+ GroupOnCurve->LineEdit2->setFocus();
+ myEditCurrentArgument = GroupOnCurve->LineEdit2;
+ globalSelection(); // close local contexts, if any
+ myNeedType = TopAbs_VERTEX;
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
+ GroupOnCurve->PushButton1->setDown(false);
+ GroupOnCurve->LineEdit2->setEnabled(true);
+ GroupOnCurve->LineEdit1->setEnabled(false);
}
- else if ( send == GroupOnSurface->PushButton1 )
+ else if (send == GroupOnSurface->PushButton1)
{
GroupOnSurface->LineEdit1->setFocus();
myEditCurrentArgument = GroupOnSurface->LineEdit1;
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_FACE);
}
- else if ( send == GroupLineIntersection->PushButton1 ) {
+ else if (send == GroupLineIntersection->PushButton1) {
GroupLineIntersection->LineEdit1->setFocus();
myEditCurrentArgument = GroupLineIntersection->LineEdit1;
- GroupLineIntersection->PushButton2->setDown( false );
+ GroupLineIntersection->PushButton2->setDown(false);
GroupLineIntersection->LineEdit1->setEnabled(true);
GroupLineIntersection->LineEdit2->setEnabled(false);
}
- else if ( send == GroupLineIntersection->PushButton2 ) {
+ else if (send == GroupLineIntersection->PushButton2) {
GroupLineIntersection->LineEdit2->setFocus();
myEditCurrentArgument = GroupLineIntersection->LineEdit2;
- GroupLineIntersection->PushButton1->setDown( false );
+ GroupLineIntersection->PushButton1->setDown(false);
GroupLineIntersection->LineEdit1->setEnabled(false);
GroupLineIntersection->LineEdit2->setEnabled(true);
}
send->setDown(true);
- if ( ( send == GroupLineIntersection->PushButton1 ||
- send == GroupLineIntersection->PushButton2 ) && !myBusy )
+ if ((send == GroupLineIntersection->PushButton1 ||
+ send == GroupLineIntersection->PushButton2) && !myBusy)
SelectionIntoArgument();
}
// function : enterEvent()
// purpose : to reactivate this dialog box when mouse enter onto the window
//=================================================================================
-void BasicGUI_PointDlg::enterEvent( QEvent* )
+void BasicGUI_PointDlg::enterEvent(QEvent*)
{
- if ( !mainFrame()->GroupConstructors->isEnabled() )
+ if (!mainFrame()->GroupConstructors->isEnabled())
ActivateThisDialog();
}
// function : ActivateThisDialog()
// purpose :
//=================================================================================
-void BasicGUI_PointDlg::ActivateThisDialog( )
+void BasicGUI_PointDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
void BasicGUI_PointDlg::DeactivateActiveDialog()
{
- // myGeomGUI->SetState( -1 );
+ // myGeomGUI->SetState(-1);
GEOMBase_Skeleton::DeactivateActiveDialog();
}
// function : CheckBoxClicked()
// purpose : Check Boxes Management
//=================================================================================
-void BasicGUI_PointDlg::CheckBoxClicked( int State )
+void BasicGUI_PointDlg::CheckBoxClicked(int State)
{
displayPreview(true);
}
// function : OnPointSelected
// purpose :
//=================================================================================
-void BasicGUI_PointDlg::OnPointSelected( const gp_Pnt& thePnt )
+void BasicGUI_PointDlg::OnPointSelected(const gp_Pnt& thePnt)
{
- if ( getConstructorId() == GEOM_POINT_XYZ ) {
- GroupXYZ->SpinBox_DX->setValue( thePnt.X() );
- GroupXYZ->SpinBox_DY->setValue( thePnt.Y() );
- GroupXYZ->SpinBox_DZ->setValue( thePnt.Z() );
+ if (getConstructorId() == GEOM_POINT_XYZ) {
+ GroupXYZ->SpinBox_DX->setValue(thePnt.X());
+ GroupXYZ->SpinBox_DY->setValue(thePnt.Y());
+ GroupXYZ->SpinBox_DZ->setValue(thePnt.Z());
displayPreview(true);
}
//=================================================================================
GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
{
- return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
+ return myGeomGUI->GetGeomGen()->GetIBasicOperations(getStudyId());
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool BasicGUI_PointDlg::isValid( QString& msg )
+bool BasicGUI_PointDlg::isValid(QString& msg)
{
bool ok = false;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case GEOM_POINT_XYZ :
- ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
- GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
- GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() );
+ ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
+ GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
+ GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
break;
case GEOM_POINT_REF:
- ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) &&
- GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) &&
- GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
+ ok = GroupRefPoint->SpinBox_DX->isValid(msg, !IsPreview()) &&
+ GroupRefPoint->SpinBox_DY->isValid(msg, !IsPreview()) &&
+ GroupRefPoint->SpinBox_DZ->isValid(msg, !IsPreview()) &&
myRefPoint;
break;
case GEOM_POINT_EDGE:
- if ( myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE )
- ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() );
+ if (myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE)
+ ok = GroupOnCurve->SpinBox_DX->isValid(msg, !IsPreview());
else
- ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
- GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
- GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() );
+ ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
+ GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
+ GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
ok = myEdge && ok;
break;
case GEOM_POINT_INTINT:
ok = myLine1 && myLine2;
break;
case GEOM_POINT_SURF:
- if ( myParamCoord->checkedId() == PARAM_VALUE )
- ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) &&
- GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() );
+ if (myParamCoord->checkedId() == PARAM_VALUE)
+ ok = GroupOnSurface->SpinBox_DX->isValid(msg, !IsPreview()) &&
+ GroupOnSurface->SpinBox_DY->isValid(msg, !IsPreview());
else
- ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
- GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
- GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() );
+ ok = GroupXYZ->SpinBox_DX->isValid(msg, !IsPreview()) &&
+ GroupXYZ->SpinBox_DY->isValid(msg, !IsPreview()) &&
+ GroupXYZ->SpinBox_DZ->isValid(msg, !IsPreview());
ok = myFace && ok;
break;
default:
// function : execute
// purpose :
//=================================================================================
-bool BasicGUI_PointDlg::execute( ObjectList& objects )
+bool BasicGUI_PointDlg::execute(ObjectList& objects)
{
bool res = false;
GEOM::GEOM_Object_var anObj;
QStringList aParameters;
- GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() );
+ GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow(getOperation());
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case GEOM_POINT_XYZ :
{
double x = GroupXYZ->SpinBox_DX->value();
aParameters << GroupXYZ->SpinBox_DY->text();
aParameters << GroupXYZ->SpinBox_DZ->text();
- anObj = anOper->MakePointXYZ( x, y, z );
+ anObj = anOper->MakePointXYZ(x, y, z);
res = true;
break;
}
aParameters << GroupRefPoint->SpinBox_DY->text();
aParameters << GroupRefPoint->SpinBox_DZ->text();
- anObj = anOper->MakePointWithReference( myRefPoint.get(), dx, dy, dz );
+ anObj = anOper->MakePointWithReference(myRefPoint.get(), dx, dy, dz);
res = true;
break;
}
case GEOM_POINT_EDGE :
{
- if ( myParamCoord->checkedId() == PARAM_VALUE ) {
- anObj = anOper->MakePointOnCurve( myEdge.get(), getParameter() );
+ if (myParamCoord->checkedId() == PARAM_VALUE) {
+ anObj = anOper->MakePointOnCurve(myEdge.get(), getParameter());
+ aParameters<<GroupOnCurve->SpinBox_DX->text();
+ }
+ else if (myParamCoord->checkedId() == LENGTH_VALUE) {
+ anObj = anOper->MakePointOnCurveByLength(myEdge.get(), getParameter(), myRefPoint.get());
aParameters<<GroupOnCurve->SpinBox_DX->text();
- }
- else if ( myParamCoord->checkedId() == LENGTH_VALUE ) {
- bool reversed = GroupOnCurve->CheckButton1->isChecked();
- anObj = anOper->MakePointOnCurveByLength( myEdge.get(), getParameter(), reversed );
-
- aParameters<<GroupOnCurve->SpinBox_DX->text();
- aParameters<<QString::number( reversed );
}
- else if ( myParamCoord->checkedId() == COORD_VALUE ) {
+ else if (myParamCoord->checkedId() == COORD_VALUE) {
double x = GroupXYZ->SpinBox_DX->value();
double y = GroupXYZ->SpinBox_DY->value();
double z = GroupXYZ->SpinBox_DZ->value();
aParameters << GroupXYZ->SpinBox_DY->text();
aParameters << GroupXYZ->SpinBox_DZ->text();
- anObj = anOper->MakePointOnCurveByCoord( myEdge.get(), x, y, z );
+ anObj = anOper->MakePointOnCurveByCoord(myEdge.get(), x, y, z);
}
res = true;
break;
}
case GEOM_POINT_INTINT :
- anObj = anOper->MakePointOnLinesIntersection( myLine1.get(), myLine2.get() );
- if ( !anObj->_is_nil() ) {
+ anObj = anOper->MakePointOnLinesIntersection(myLine1.get(), myLine2.get());
+ if (!anObj->_is_nil()) {
QString aName = getNewObjectName();
- if ( anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex") )
- initName( tr( "GEOM_COMPOUND" ) );
- else if ( anObj->GetShapeType() == GEOM::VERTEX && aName.startsWith("Compound"))
- initName( tr( "GEOM_VERTEX" ) );
+ if (anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex"))
+ initName(tr("GEOM_COMPOUND"));
+ else if (anObj->GetShapeType() == GEOM::VERTEX && aName.startsWith("Compound"))
+ initName(tr("GEOM_VERTEX"));
}
res = true;
break;
case GEOM_POINT_SURF :
{
- if ( myParamCoord->checkedId() == PARAM_VALUE ) {
- anObj = anOper->MakePointOnSurface( myFace.get(), getUParameter(), getVParameter() );
+ if (myParamCoord->checkedId() == PARAM_VALUE) {
+ anObj = anOper->MakePointOnSurface(myFace.get(), getUParameter(), getVParameter());
aParameters<<GroupOnSurface->SpinBox_DX->text();
aParameters<<GroupOnSurface->SpinBox_DY->text();
} else {
aParameters << GroupXYZ->SpinBox_DY->text();
aParameters << GroupXYZ->SpinBox_DZ->text();
- anObj = anOper->MakePointOnSurfaceByCoord( myFace.get(), x, y, z );
+ anObj = anOper->MakePointOnSurfaceByCoord(myFace.get(), x, y, z);
}
res = true;
break;
if(!anObj->_is_nil() && !IsPreview() && (id == GEOM_POINT_XYZ ||
id == GEOM_POINT_REF ||
id == GEOM_POINT_EDGE ||
- id == GEOM_POINT_SURF) ) {
+ id == GEOM_POINT_SURF)) {
anObj->SetParameters(aParameters.join(":").toLatin1().constData());
}
- if ( id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF ) {
+ if (id == GEOM_POINT_REF || id == GEOM_POINT_EDGE || id == GEOM_POINT_SURF) {
TopoDS_Shape aShape;
- if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
- aShape.ShapeType() == TopAbs_VERTEX ) {
- gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+ if (GEOMBase::GetShape(anObj, aShape) && !aShape.IsNull() &&
+ aShape.ShapeType() == TopAbs_VERTEX) {
+ gp_Pnt aPnt = BRep_Tool::Pnt(TopoDS::Vertex(aShape));
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- int aPrecision = resMgr->integerValue( "Geometry", "length_precision", 6 );
- myX->setText( DlgRef::PrintDoubleValue( aPnt.X(), aPrecision ) );
- myY->setText( DlgRef::PrintDoubleValue( aPnt.Y(), aPrecision ) );
- myZ->setText( DlgRef::PrintDoubleValue( aPnt.Z(), aPrecision ) );
+ int aPrecision = resMgr->integerValue("Geometry", "length_precision", 6);
+ myX->setText(DlgRef::PrintDoubleValue(aPnt.X(), aPrecision));
+ myY->setText(DlgRef::PrintDoubleValue(aPnt.Y(), aPrecision));
+ myZ->setText(DlgRef::PrintDoubleValue(aPnt.Z(), aPrecision));
}
else {
- myX->setText( "" );
- myY->setText( "" );
- myZ->setText( "" );
+ myX->setText("");
+ myY->setText("");
+ myZ->setText("");
}
}
- if ( !anObj->_is_nil() ) {
- objects.push_back( anObj._retn() );
+ if (!anObj->_is_nil()) {
+ objects.push_back(anObj._retn());
}
return res;
//=================================================================================
void BasicGUI_PointDlg::addSubshapesToStudy()
{
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case GEOM_POINT_REF:
- GEOMBase::PublishSubObject( myRefPoint.get() );
+ GEOMBase::PublishSubObject(myRefPoint.get());
break;
case GEOM_POINT_EDGE:
- GEOMBase::PublishSubObject( myEdge.get() );
+ GEOMBase::PublishSubObject(myEdge.get());
break;
case GEOM_POINT_INTINT:
- GEOMBase::PublishSubObject( myLine1.get() );
- GEOMBase::PublishSubObject( myLine2.get() );
+ GEOMBase::PublishSubObject(myLine1.get());
+ GEOMBase::PublishSubObject(myLine2.get());
break;
case GEOM_POINT_SURF:
- GEOMBase::PublishSubObject( myFace.get() );
+ GEOMBase::PublishSubObject(myFace.get());
break;
default:
break;
// function : ClickParamCoord()
// purpose :
//=================================================================================
-void BasicGUI_PointDlg::ClickParamCoord( int id )
+void BasicGUI_PointDlg::ClickParamCoord(int id)
{
- updateParamCoord( true );
+ updateParamCoord(true);
displayPreview(true);
}
bool isLength = myParamCoord->checkedId() == LENGTH_VALUE;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
+ double step = resMgr->doubleValue("Geometry", "SettingsGeomStep", 100);
const int id = getConstructorId();
- if ( id == GEOM_POINT_EDGE ) {
- GroupOnCurve->TextLabel2->setVisible( isParam || isLength );
- GroupOnCurve->SpinBox_DX->setVisible( isParam || isLength );
- if ( isParam ){
- initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision" );
- GroupOnCurve->SpinBox_DX->setValue( 0.5 );
- GroupOnCurve->TextLabel2->setText(tr( "GEOM_PARAMETER" ));
- GroupOnCurve->CheckButton1->setVisible(false);
+ if (id == GEOM_POINT_EDGE) {
+ GroupOnCurve->TextLabel2->setVisible(isLength);
+ GroupOnCurve->PushButton2->setVisible(isLength);
+ GroupOnCurve->LineEdit2->setVisible(isLength);
+ GroupOnCurve->TextLabel3->setVisible(isParam || isLength);
+ GroupOnCurve->SpinBox_DX->setVisible(isParam || isLength);
+ if (isParam){
+ initSpinBox(GroupOnCurve->SpinBox_DX, 0., 1., 0.1, "parametric_precision");
+ GroupOnCurve->SpinBox_DX->setValue(0.5);
+ GroupOnCurve->TextLabel3->setText(tr("GEOM_PARAMETER"));
}
- else if ( isLength ){
- initSpinBox( GroupOnCurve->SpinBox_DX, 0.0, COORD_MAX, step, "length_precision" );
- GroupOnCurve->SpinBox_DX->setValue( 0.0 );
- GroupOnCurve->TextLabel2->setText(tr( "GEOM_LENGTH" ));
- GroupOnCurve->CheckButton1->setVisible(true);
+ else if (isLength){
+ initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
+ GroupOnCurve->SpinBox_DX->setValue(0.0);
+ GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH"));
}
- }
- else if ( id == GEOM_POINT_SURF ) {
- GroupOnSurface->TextLabel2->setShown( isParam );
- GroupOnSurface->TextLabel3->setShown( isParam );
- GroupOnSurface->SpinBox_DX->setShown( isParam );
- GroupOnSurface->SpinBox_DY->setShown( isParam );
}
-
- GroupXYZ->setShown( !isParam && !isLength );
+ else if (id == GEOM_POINT_SURF) {
+ GroupOnSurface->TextLabel2->setShown(isParam);
+ GroupOnSurface->TextLabel3->setShown(isParam);
+ GroupOnSurface->SpinBox_DX->setShown(isParam);
+ GroupOnSurface->SpinBox_DY->setShown(isParam);
+ }
+
+ GroupXYZ->setShown(!isParam && !isLength);
- if ( theIsUpdate )
+ if (theIsUpdate)
QTimer::singleShot(50, this, SLOT(updateSize()));
}
// function : onBtnPopup()
// purpose :
//=================================================================================
-void BasicGUI_PointDlg::onBtnPopup( QAction* a )
+void BasicGUI_PointDlg::onBtnPopup(QAction* a)
{
globalSelection(); // close local contexts, if any
myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE;
- localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
+ localSelection(GEOM::GEOM_Object::_nil(), myNeedType);
}
//=================================================================================
// function : updateSize
// purpose : adjust dialog size to minimum
//=================================================================================
-void BasicGUI_PointDlg::updateSize()
+void BasicGUI_PointDlg::updateSize()
{
qApp->processEvents();
updateGeometry();
- resize( minimumSizeHint() );
+ resize(minimumSizeHint());
}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : BasicGUI_PointDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+
#ifndef BASICGUI_POINTDLG_H
#define BASICGUI_POINTDLG_H
#include "GEOM_GenericObjPtr.h"
#include <QMap>
-class DlgRef_1Sel1Spin1Check;
+class DlgRef_2Sel1Spin;
class DlgRef_3Spin;
class DlgRef_2Sel;
class DlgRef_1Sel3Spin;
DlgRef_3Spin* GroupXYZ;
DlgRef_1Sel3Spin* GroupRefPoint;
- DlgRef_1Sel1Spin1Check* GroupOnCurve;
+ DlgRef_2Sel1Spin* GroupOnCurve;
DlgRef_2Sel* GroupLineIntersection;
DlgRef_1Sel2Spin* GroupOnSurface;
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : BuildGUI_EdgeDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+
#include "BuildGUI_EdgeDlg.h"
#include <DlgRef.h>
BuildGUI_EdgeDlg::BuildGUI_EdgeDlg (GeometryGUI* theGeometryGUI, QWidget* parent)
: GEOMBase_Skeleton(theGeometryGUI, parent)
{
- QPixmap image0 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
- QPixmap image1 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE")));
- QPixmap image2 (SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE_WIRE")));
+ SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
+ QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_SELECT")));
+ QPixmap image1 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE")));
+ QPixmap image2 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE_WIRE")));
+ QPixmap image3 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_BUILD_EDGE_CURVE")));
setWindowTitle(tr("GEOM_EDGE_TITLE"));
mainFrame()->GroupConstructors->setTitle(tr("GEOM_EDGE"));
mainFrame()->RadioButton1->setIcon(image1);
mainFrame()->RadioButton2->setIcon(image2);
- mainFrame()->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
- mainFrame()->RadioButton3->close();
+ mainFrame()->RadioButton3->setIcon(image3);
// two points
GroupWire->TextLabel1->setText(tr("GEOM_WIRE"));
GroupWire->PushButton1->setIcon(image0);
GroupWire->LineEdit1->setReadOnly(true);
- GroupWire->TextLabel2->setText( tr( "GEOM_LINEAR_TOLERANCE" ) );
- GroupWire->TextLabel3->setText( tr( "GEOM_ANGULAR_TOLERANCE" ) );
+ GroupWire->TextLabel2->setText(tr("GEOM_LINEAR_TOLERANCE"));
+ GroupWire->TextLabel3->setText(tr("GEOM_ANGULAR_TOLERANCE"));
double SpecificStep = 0.0001;
double prec1 = Precision::Confusion();
double prec2 = Precision::Angular();
- initSpinBox(GroupWire->SpinBox_DX, prec1, MAX_NUMBER, SpecificStep, "len_tol_precision" );
- initSpinBox(GroupWire->SpinBox_DY, prec2, MAX_NUMBER, SpecificStep, "ang_tol_precision" );
+ initSpinBox(GroupWire->SpinBox_DX, prec1, MAX_NUMBER, SpecificStep, "len_tol_precision");
+ initSpinBox(GroupWire->SpinBox_DY, prec2, MAX_NUMBER, SpecificStep, "ang_tol_precision");
GroupWire->SpinBox_DX->setValue(prec1);
GroupWire->SpinBox_DY->setValue(prec2);
+ // on curve
+
+ GroupOnCurve = new DlgRef_2Sel1Spin(centralWidget());
+ GroupOnCurve->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
+ GroupOnCurve->TextLabel1->setText(tr("GEOM_EDGE"));
+ GroupOnCurve->PushButton1->setIcon(image0);
+ GroupOnCurve->LineEdit1->setReadOnly(true);
+ GroupOnCurve->TextLabel2->setText(tr("GEOM_START_POINT"));
+ GroupOnCurve->PushButton2->setIcon(image0);
+ GroupOnCurve->LineEdit2->setReadOnly(true);
+ GroupOnCurve->TextLabel3->setText(tr("GEOM_LENGTH"));
+ double step = aResMgr->doubleValue("Geometry", "SettingsGeomStep", 100.0);
+ initSpinBox(GroupOnCurve->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision");
+ GroupOnCurve->SpinBox_DX->setValue(step);
+
// layout
QVBoxLayout* layout = new QVBoxLayout(centralWidget());
layout->setMargin(0); layout->setSpacing(6);
layout->addWidget(GroupPoints);
layout->addWidget(GroupWire);
+ layout->addWidget(GroupOnCurve);
/***************************************************************/
setHelpFileName("create_edge_page.html");
myPoint1.nullify();
myPoint2.nullify();
myWire.nullify();
+ myCurve.nullify();
+ myStartPoint.nullify();
+
myEditCurrentArgument = GroupPoints->LineEdit1;
GroupPoints->PushButton1->setDown(true);
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
// signals and slots connections
- connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
- connect( myGeomGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
+ connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel()));
- connect( this, SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
+ connect(this, SIGNAL(constructorsClicked(int)), this, SLOT(ConstructorsClicked(int)));
connect(buttonOk(), SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
- connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
- connect(GroupWire->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupWire->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupOnCurve->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+ connect(GroupOnCurve->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
+
+ connect(GroupOnCurve->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
initName(tr("GEOM_EDGE"));
- ConstructorsClicked( 0 );
+ ConstructorsClicked(0);
}
//=================================================================================
initName();
- myEditCurrentArgument->setText( "" );
- ConstructorsClicked( getConstructorId() );
+ myEditCurrentArgument->setText("");
+ ConstructorsClicked(getConstructorId());
return true;
}
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
-void BuildGUI_EdgeDlg::ConstructorsClicked( int constructorId )
+void BuildGUI_EdgeDlg::ConstructorsClicked(int constructorId)
{
- switch ( constructorId ) {
+ switch (constructorId) {
case 0:
{
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
myEditCurrentArgument = GroupPoints->LineEdit1;
- GroupPoints->LineEdit1->setText( "" );
- GroupPoints->LineEdit2->setText( "" );
+ GroupPoints->LineEdit1->setText("");
+ GroupPoints->LineEdit2->setText("");
myPoint1.nullify();
myPoint2.nullify();
GroupPoints->PushButton1->setDown(true);
GroupPoints->LineEdit2->setEnabled(false);
GroupPoints->show();
GroupWire->hide();
+ GroupOnCurve->hide();
break;
}
case 1:
{
globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_WIRE );
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_WIRE);
myEditCurrentArgument = GroupWire->LineEdit1;
GroupWire->LineEdit1->setText("");
GroupWire->PushButton1->setDown(true);
GroupWire->LineEdit1->setEnabled(true);
GroupPoints->hide();
+ GroupOnCurve->hide();
GroupWire->show();
break;
}
+ case 2:
+ {
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+
+ myEditCurrentArgument = GroupOnCurve->LineEdit1;
+ GroupOnCurve->LineEdit1->setText("");
+ GroupOnCurve->LineEdit2->setText("");
+ myCurve.nullify();
+ myStartPoint.nullify();
+ GroupOnCurve->PushButton1->setDown(true);
+ GroupOnCurve->PushButton2->setDown(false);
+ GroupOnCurve->LineEdit1->setEnabled(true);
+ GroupOnCurve->LineEdit2->setEnabled(false);
+ GroupPoints->hide();
+ GroupWire->hide();
+ GroupOnCurve->show();
+ break;
+ }
}
qApp->processEvents();
updateGeometry();
- resize( minimumSizeHint() );
+ resize(minimumSizeHint());
SelectionIntoArgument();
}
aSelMgr->selectedObjects(aSelList);
if (aSelList.Extent() != 1) {
- if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify();
- else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify();
- else if (myEditCurrentArgument == GroupWire->LineEdit1) myWire.nullify();
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify();
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify();
+ else if (myEditCurrentArgument == GroupWire->LineEdit1) myWire.nullify();
+ else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) myCurve.nullify();
+ else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) myStartPoint.nullify();
displayPreview(true);
return;
}
- TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupWire->LineEdit1 ? TopAbs_WIRE : TopAbs_VERTEX;
- GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+ TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+ if (myEditCurrentArgument == GroupWire->LineEdit1) aNeedType = TopAbs_WIRE;
+ else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) aNeedType = TopAbs_EDGE;
+ GEOM::GeomObjPtr aSelectedObject = getSelected(aNeedType);
+
TopoDS_Shape aShape;
- if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
- QString aName = GEOMBase::GetName( aSelectedObject.get() );
- myEditCurrentArgument->setText( aName );
+ if (aSelectedObject && GEOMBase::GetShape(aSelectedObject.get(), aShape) && !aShape.IsNull()) {
+ QString aName = GEOMBase::GetName(aSelectedObject.get());
+ myEditCurrentArgument->setText(aName);
globalSelection();
- localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+ localSelection(GEOM::GEOM_Object::_nil(), aNeedType);
- if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
+ if (myEditCurrentArgument == GroupPoints->LineEdit1) {
myPoint1 = aSelectedObject;
- if ( myPoint1 && !myPoint2 )
+ if (myPoint1 && !myPoint2)
GroupPoints->PushButton2->click();
}
- else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
+ else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
myPoint2 = aSelectedObject;
- if ( myPoint2 && !myPoint1 )
+ if (myPoint2 && !myPoint1)
GroupPoints->PushButton1->click();
}
- else if ( myEditCurrentArgument == GroupWire->LineEdit1 ) {
+ else if (myEditCurrentArgument == GroupWire->LineEdit1) {
myWire = aSelectedObject;
}
+ else if (myEditCurrentArgument == GroupOnCurve->LineEdit1) {
+ myCurve = aSelectedObject;
+ if (myCurve && !myStartPoint)
+ GroupOnCurve->PushButton2->click();
+ }
+ else if (myEditCurrentArgument == GroupOnCurve->LineEdit2) {
+ myStartPoint = aSelectedObject;
+ if (myStartPoint && !myCurve)
+ GroupOnCurve->PushButton1->click();
+ }
}
displayPreview(true);
else if (send == GroupWire->PushButton1) {
myEditCurrentArgument = GroupWire->LineEdit1;
}
+ else if (send == GroupOnCurve->PushButton1) {
+ myEditCurrentArgument = GroupOnCurve->LineEdit1;
+ GroupOnCurve->PushButton2->setDown(false);
+ GroupOnCurve->LineEdit2->setEnabled(false);
+
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
+ }
+ else if (send == GroupOnCurve->PushButton2) {
+ myEditCurrentArgument = GroupOnCurve->LineEdit2;
+ GroupOnCurve->PushButton1->setDown(false);
+ GroupOnCurve->LineEdit1->setEnabled(false);
+
+ globalSelection(); // close local contexts, if any
+ localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
+ }
// enable line edit
myEditCurrentArgument->setEnabled(true);
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
- this, SLOT( SelectionIntoArgument() ) );
+ connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+ this, SLOT(SelectionIntoArgument()));
- ConstructorsClicked( getConstructorId() );
+ ConstructorsClicked(getConstructorId());
}
//=================================================================================
ActivateThisDialog();
}
+//=================================================================================
+// function : ValueChangedInSpinBox()
+// purpose :
+//=================================================================================
+void BuildGUI_EdgeDlg::ValueChangedInSpinBox(double newValue)
+{
+ displayPreview(true);
+}
+
//=================================================================================
// function : createOperation
// purpose :
bool BuildGUI_EdgeDlg::isValid (QString& msg)
{
bool ok = false;
- switch ( getConstructorId() ) {
+ switch (getConstructorId()) {
case 0:
ok = myPoint1 && myPoint2;
break;
case 1:
- ok = GroupWire->SpinBox_DX->isValid( msg, !IsPreview() ) &&
- GroupWire->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+ ok = GroupWire->SpinBox_DX->isValid(msg, !IsPreview()) &&
+ GroupWire->SpinBox_DY->isValid(msg, !IsPreview()) &&
myWire;
break;
+ case 2:
+ ok = GroupOnCurve->SpinBox_DX->isValid(msg, !IsPreview()) &&
+ myCurve;
+ break;
default:
break;
}
bool res = false;
GEOM::GEOM_Object_var anObj;
- GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
+ GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow(getOperation());
- switch ( getConstructorId() ) {
- case 0 :
+ switch (getConstructorId()) {
+ case 0:
{
- anObj = anOper->MakeEdge( myPoint1.get(), myPoint2.get() );
+ anObj = anOper->MakeEdge(myPoint1.get(), myPoint2.get());
res = true;
break;
}
{
double aLinearTolerance = GroupWire->SpinBox_DX->value();
double anAngularTolerance = GroupWire->SpinBox_DY->value();
-
+
QStringList aParameters;
aParameters << GroupWire->SpinBox_DX->text();
aParameters << GroupWire->SpinBox_DY->text();
-
- anObj = anOper->MakeEdgeWire( myWire.get(), aLinearTolerance, anAngularTolerance );
-
- if ( !anObj->_is_nil() && !IsPreview() )
- anObj->SetParameters( aParameters.join(":").toLatin1().constData() );
-
+
+ anObj = anOper->MakeEdgeWire(myWire.get(), aLinearTolerance, anAngularTolerance);
+
+ if (!anObj->_is_nil() && !IsPreview())
+ anObj->SetParameters(aParameters.join(":").toLatin1().constData());
+
+ res = true;
+ break;
+ }
+ case 2:
+ {
+ double aLength = GroupOnCurve->SpinBox_DX->value();
+
+ anObj = anOper->MakeEdgeOnCurveByLength(myCurve.get(), aLength, myStartPoint.get());
+
+ if (!anObj->_is_nil() && !IsPreview())
+ anObj->SetParameters(GroupOnCurve->SpinBox_DX->text().toLatin1().constData());
+
res = true;
break;
}
}
- if ( !anObj->_is_nil() ) objects.push_back( anObj._retn() );
+ if (!anObj->_is_nil()) objects.push_back(anObj._retn());
return res;
}
//=================================================================================
void BuildGUI_EdgeDlg::addSubshapesToStudy()
{
- switch ( getConstructorId() ) {
- case 0 :
- GEOMBase::PublishSubObject( myPoint1.get() );
- GEOMBase::PublishSubObject( myPoint2.get() );
+ switch (getConstructorId()) {
+ case 0:
+ GEOMBase::PublishSubObject(myPoint1.get());
+ GEOMBase::PublishSubObject(myPoint2.get());
+ break;
+ case 1:
+ GEOMBase::PublishSubObject(myWire.get());
break;
- case 1 :
- GEOMBase::PublishSubObject( myWire.get() );
+ case 2:
+ GEOMBase::PublishSubObject(myCurve.get());
+ GEOMBase::PublishSubObject(myStartPoint.get());
break;
default:
break;
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : BuildGUI_EdgeDlg.h
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
-//
+
#ifndef BUILDGUI_EDGEDLG_H
#define BUILDGUI_EDGEDLG_H
class DlgRef_1Sel2Spin;
class DlgRef_2Sel;
+class DlgRef_2Sel1Spin;
//=================================================================================
// class : BuildGUI_EdgeDlg
Q_OBJECT
public:
- BuildGUI_EdgeDlg( GeometryGUI*, QWidget* = 0 );
+ BuildGUI_EdgeDlg (GeometryGUI*, QWidget* = 0);
~BuildGUI_EdgeDlg();
protected:
// redefined from GEOMBase_Helper
virtual GEOM::GEOM_IOperations_ptr createOperation();
- virtual bool isValid( QString& );
- virtual bool execute( ObjectList& );
+ virtual bool isValid (QString&);
+ virtual bool execute (ObjectList&);
virtual void addSubshapesToStudy();
private:
void Init();
- void enterEvent( QEvent* );
+ void enterEvent (QEvent*);
private:
- GEOM::GeomObjPtr myPoint1, myPoint2; /* Points containing the edge */
+ GEOM::GeomObjPtr myPoint1, myPoint2; /* Points */
GEOM::GeomObjPtr myWire; /* Wire */
+ GEOM::GeomObjPtr myCurve; /* Edge */
+ GEOM::GeomObjPtr myStartPoint; /* Point */
DlgRef_2Sel* GroupPoints;
DlgRef_1Sel2Spin* GroupWire;
+ DlgRef_2Sel1Spin* GroupOnCurve;
private slots:
- void ConstructorsClicked( int );
+ void ConstructorsClicked (int);
void ClickOnOk();
bool ClickOnApply();
void ActivateThisDialog();
void SelectionIntoArgument();
void SetEditCurrentArgument();
+ void ValueChangedInSpinBox (double);
};
#endif // BUILDGUI_EDGEDLG_H
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : BuildGUI_SolidDlg.cxx
// Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
#include "BuildGUI_SolidDlg.h"
#include <DlgRef.h>
#include <SalomeApp_Application.h>
#include <LightApp_SelectionMgr.h>
+#include <TColStd_MapOfInteger.hxx>
+
//=================================================================================
// class : BuildGUI_SolidDlg()
-// purpose : Constructs a BuildGUI_SolidDlg which is a child of 'parent', with the
+// purpose : Constructs a BuildGUI_SolidDlg which is a child of 'parent', with the
// name 'name' and widget flags set to 'f'.
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
setWindowTitle( tr( "GEOM_SOLID_TITLE" ) );
-
+
/***************************************************************/
mainFrame()->GroupConstructors->setTitle( tr( "GEOM_SOLID" ) );
mainFrame()->RadioButton1->setIcon( image0 );
GroupSolid->CheckButton1->setText( tr( "GEOM_CREATE_SINGLE_SOLID" ) );
GroupSolid->PushButton1->setIcon( image1 );
GroupSolid->LineEdit1->setReadOnly( true );
-
+
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupSolid );
GroupSolid->CheckButton1->setChecked( true );
myShells.clear();
-
- globalSelection( GEOM_SHELL );
+
+ //globalSelection( GEOM_SHELL );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_SHELL );
+ aMap.Add( GEOM_COMPOUNDFILTER );
+ QList<int> aSubShapes;
+ aSubShapes.append( GEOM_SHELL );
+ globalSelection( aMap, aSubShapes );
/* signals and slots connections */
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
{
myEditCurrentArgument->setText( "" );
- myShells = getSelected( TopAbs_SHELL, -1 );
+ //myShells = getSelected( TopAbs_SHELL, -1 );
+ QList<TopAbs_ShapeEnum> types;
+ types << TopAbs_SHELL << TopAbs_COMPOUND;
+ myShells = getSelected( types, -1 );
if ( !myShells.isEmpty() ) {
QString aName = myShells.count() > 1 ? QString( "%1_objects").arg( myShells.count() ) : GEOMBase::GetName( myShells[0].get() );
QPushButton* send = (QPushButton*)sender();
if ( send != GroupSolid->PushButton1 )
return;
-
- globalSelection( GEOM_SHELL );
+
+ //globalSelection( GEOM_SHELL );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_SHELL );
+ aMap.Add( GEOM_COMPOUNDFILTER );
+ QList<int> aSubShapes;
+ aSubShapes.append( GEOM_SHELL );
+ globalSelection( aMap, aSubShapes );
+
myEditCurrentArgument = GroupSolid->LineEdit1;
myEditCurrentArgument->setFocus();
GEOMBase_Skeleton::ActivateThisDialog();
connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
- globalSelection( GEOM_SHELL );
+
+ //globalSelection( GEOM_SHELL );
+ TColStd_MapOfInteger aMap;
+ aMap.Add( GEOM_SHELL );
+ aMap.Add( GEOM_COMPOUNDFILTER );
+ QList<int> aSubShapes;
+ aSubShapes.append( GEOM_SHELL );
+ globalSelection( aMap, aSubShapes );
}
//=================================================================================
void BuildGUI_SolidDlg::EnableNameField( bool toEnable )
{
- mainFrame()->GroupBoxName->setEnabled( toEnable );
+ mainFrame()->GroupBoxName->setEnabled( toEnable );
}
//=================================================================================
// function : isValid
// purpose :
//=================================================================================
-bool BuildGUI_SolidDlg::isValid( QString& msg )
+bool BuildGUI_SolidDlg::isValid (QString& msg)
{
bool ok = !myShells.isEmpty();
+
+ GEOM::MeasureOpPtr anOp;
+ anOp.take(myGeomGUI->GetGeomGen()->GetIMeasureOperations(getStudyId()));
+
for ( int i = 0, n = myShells.count(); i < n && ok; i++ ) {
- ok = isClosed( myShells[i].get() );
- if ( !ok )
- msg = QObject::tr("WRN_SHAPE_UNCLOSED").arg( GEOMBase::GetName( myShells[i].get() ) );
+ CORBA::String_var aRes = anOp->IsGoodForSolid(myShells[i].get());
+ if (strlen(aRes.in())) {
+ msg = QObject::tr(aRes.in()).arg(GEOMBase::GetName(myShells[i].get()));
+ ok = false;
+ }
}
return ok;
}
+/*
//=================================================================================
// function : isClosed
// purpose : Check the object 'i' in myShells list is closed or unclosed
if ( !CORBA::is_nil( shell ) ) {
GEOM::MeasureOpPtr anOp;
anOp.take( myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ) );
-
+
// Detect kind of shape and parameters
aKind = anOp->KindOfShape(shell, anInts, aDbls);
-
+
if ( anOp->IsDone() ) {
if ( anInts[0] == 1 )
- ok = true;
+ ok = true;
else if ( anInts[0] == 2 )
- ok = false;
+ ok = false;
}
else {
MESSAGE ("KindOfShape Operation is NOT DONE!!!");
return ok;
}
+*/
//=================================================================================
// function : execute
bool BuildGUI_SolidDlg::execute( ObjectList& objects )
{
GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
-
+
if ( GroupSolid->CheckButton1->isChecked() ) {
GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
objlist->length( myShells.count() );
return true;
}
-
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
// GEOM GEOMGUI : GUI for Geometry component
// File : BuildGUI_SolidDlg.h
// Author : Damien COQUERET, Open CASCADE S.A.S.
-//
+
#ifndef BUILDGUI_SOLIDDLG_H
#define BUILDGUI_SOLIDDLG_H
private:
void Init();
- bool isClosed( GEOM::GEOM_Object_ptr shell );
+ //bool isClosed( GEOM::GEOM_Object_ptr shell );
void enterEvent( QEvent* );
private:
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
// GEOM GEOMGUI : GUI for Geometry component
// File : EntityGUI_SubShapeDlg.cxx
// Author : Lucien PIGNOLONI, Open CASCADE S.A.S.
GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Vertex" );
GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shape" );
- if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
+ if ( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
!= OCCViewer_Viewer::Type() )
GroupPoints->CheckButton1->setEnabled( false );
bool EntityGUI_SubShapeDlg::ClickOnApply()
{
SUIT_Session::session()->activeApplication()->putInfo( "" );
-
+
/* Explode all sub shapes */
if ( isAllSubShapes() ) {
/* More than 30 subshapes : ask confirmation */
{
GroupPoints->LineEdit1->setFocus();
myEditCurrentArgument = GroupPoints->LineEdit1;
-
+
GroupPoints->CheckButton1->setChecked( false );
SubShapeToggled();
SelectionIntoArgument();
// purpose :
//=================================================================================
void EntityGUI_SubShapeDlg::LineEditReturnPressed()
-{
+{
QLineEdit* send = (QLineEdit*)sender();
if ( send == GroupPoints->LineEdit1 )
SetEditCurrentArgument();
GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Edge" );
GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Vertex" );
GroupPoints->ComboBox1->insertItem( GroupPoints->ComboBox1->count(), "Shape" );
-
+
myWithShape = true;
-
+
GroupPoints->ComboBox1->setCurrentIndex( 8 - count + SelectedShapeType );
ComboTextChanged();
//=================================================================================
// function : ComboTextChanged()
-// purpose :
+// purpose :
//=================================================================================
void EntityGUI_SubShapeDlg::ComboTextChanged()
{
/* Select sub shapes mode not checked */
updateButtonState();
- SubShapeToggled();
+ SubShapeToggled();
}
}
}
}
- }
+ }
else {
TopExp_Explorer Exp ( S, TopAbs_ShapeEnum( shapeType ) );
for ( ; Exp.More(); Exp.Next() ) {
if (!aList->length())
return false;
- // Throw away sub-shapes not selected by user if not in preview mode
+ // Throw away sub-shapes not selected by user if not in preview mode
// and manual selection is active
if (!isAllSubShapes()) {
LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
TColStd_IndexedMapOfInteger aMapIndex;
aSelMgr->GetIndexes(aSelList.First(), aMapIndex);
- GEOM::GEOM_ILocalOperations_var aLocOp =
+ GEOM::GEOM_ILocalOperations_var aLocOp =
getGeomEngine()->GetILocalOperations(getStudyId());
for (int i = 0, n = aList->length(); i < n; i++)
else
for (int i = 0, n = aList->length(); i < n; i++)
objects.push_back(GEOM::GEOM_Object::_duplicate(aList[i]));
-
+
return objects.size();
}
<source>ICON_DLG_BUILD_EDGE_WIRE</source>
<translation>build_edge_wire.png</translation>
</message>
+ <message>
+ <source>ICON_DLG_BUILD_EDGE_CURVE</source>
+ <translation>build_edge_curve.png</translation>
+ </message>
<message>
<source>ICON_DLG_BUILD_FACE</source>
<translation>build_face.png</translation>
<source>GEOM_POINT_TITLE</source>
<translation>Point Construction</translation>
</message>
+ <message>
+ <source>GEOM_START_POINT</source>
+ <translation>Start Point</translation>
+ </message>
<message>
<source>GEOM_POLYLINE</source>
<translation>Polyline</translation>
<source>WRN_SHAPE_UNCLOSED</source>
<translation>Unable to create solid from unclosed shape %1</translation>
</message>
+ <message>
+ <source>WRN_SHAPE_NOT_SHELL</source>
+ <translation>Unable to create solid from shape %1 as it is not a shell</translation>
+ </message>
+ <message>
+ <source>WRN_NULL_OBJECT_OR_SHAPE</source>
+ <translation>Shape %1 for solid creation is null</translation>
+ </message>
<message>
<source>GEOM_X</source>
<translation>X :</translation>
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
double theParam2,
double theParam3,
const PointLocation theLocation,
- bool theReverse)
+ Handle(GEOM_Object) theRefPoint)
{
SetErrorCode(KO);
case PointOn_CurveByLength:
aPI.SetCurve(aRefFunction);
aPI.SetLength(theParam1);
- aPI.SetReversed(theReverse);
+ if (!theRefPoint.IsNull()) {
+ Handle(GEOM_Function) aRefPoint = theRefPoint->GetLastFunction();
+ aPI.SetRef(aRefPoint);
+ }
break;
case PointOn_CurveByCoord:
aPI.SetCurve(aRefFunction);
break;
case PointOn_CurveByLength:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByLength("
- << theGeomObj << ", " << theParam1 << ", " << theReverse << ")";
+ << theGeomObj << ", " << theParam1 << ", " << theRefPoint << ")";
break;
case PointOn_CurveByCoord:
GEOM::TPythonDump(aFunction) << aPoint << " = geompy.MakeVertexOnCurveByCoord("
//=============================================================================
Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePointOnCurveByLength
(Handle(GEOM_Object) theCurve,
- double theLength,
- bool theReverse)
+ double theLength,
+ Handle(GEOM_Object) theStartPoint)
{
- return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theReverse);
+ return makePointOnGeom(theCurve, theLength, 0.0, 0.0, PointOn_CurveByLength, theStartPoint);
}
//=============================================================================
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOMImpl_IBasicOperations_HXX_
#define _GEOMImpl_IBasicOperations_HXX_
double theParameter);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByLength (Handle(GEOM_Object) theCurve,
- double theLength,
- bool theReverse);
+ double theLength,
+ Handle(GEOM_Object) theStartPoint);
Standard_EXPORT Handle(GEOM_Object) MakePointOnCurveByCoord (Handle(GEOM_Object) theCurve,
double theXParam,
double theParam2,
double theParam3,
const PointLocation theLocation,
- bool theReverse = false);
+ Handle(GEOM_Object) theRefPoint = 0);
};
#endif
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifdef WNT
#pragma warning( disable:4786 )
#include <GEOMImpl_IBlockTrsf.hxx>
#include <GEOMImpl_CopyDriver.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
+#include <GEOMImpl_IShapesOperations.hxx>
#include <GEOM_Function.hxx>
#include <GEOM_PythonDump.hxx>
TopTools_MapOfShape mapAcceptedEdges;
TCollection_AsciiString aListRes, anEntry;
+ // Sort shapes in current chain (Mantis issue 21053)
+ TopTools_DataMapOfShapeListOfShape aMapChains;
+ TopTools_ListOfShape aFirstInChains;
+
for (ie = 1; ie <= nbEdges; ie++) {
TopoDS_Shape curE = MEW.FindKey(ie);
listPrevEdges = listCurEdges;
} // while (listPrevEdges.Extent() > 0)
+ // Sort shapes in current chain (Mantis issue 21053)
+ GEOMImpl_IShapesOperations::SortShapes(currentChain, Standard_False);
+ aFirstInChains.Append(currentChain.First());
+ aMapChains.Bind(currentChain.First(), currentChain);
+ }
+
+ // Sort chains (Mantis issue 21053)
+ GEOMImpl_IShapesOperations::SortShapes(aFirstInChains, Standard_False);
+
+ // Store sorted chains in the document
+ TopTools_ListIteratorOfListOfShape aChainsIt (aFirstInChains);
+ for (; aChainsIt.More(); aChainsIt.Next()) {
+ TopoDS_Shape aFirstInChain = aChainsIt.Value();
+ const TopTools_ListOfShape& currentChain = aMapChains.Find(aFirstInChain);
+
// Store the chain in the document
Handle(TColStd_HArray1OfInteger) anArray =
new TColStd_HArray1OfInteger (1, currentChain.Extent());
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
#include <GProp_PrincipalProps.hxx>
#include <TopAbs.hxx>
+#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
if (aShape.IsNull()) return aKind;
int geom_type = theShape->GetType();
-
+
// check if it's advanced shape
if ( geom_type > ADVANCED_BASE ) {
SetErrorCode(OK);
return SK_ADVANCED;
}
-
+
// Call algorithm
GEOMAlgo_ShapeInfoFiller aSF;
aSF.SetShape(aShape);
return isValid;
}
+//=============================================================================
+/*!
+ * IsGoodForSolid
+ */
+//=============================================================================
+TCollection_AsciiString GEOMImpl_IMeasureOperations::IsGoodForSolid (Handle(GEOM_Object) theShape)
+{
+ SetErrorCode(KO);
+
+ TCollection_AsciiString aRes = "";
+
+ if (theShape.IsNull()) {
+ aRes = "WRN_NULL_OBJECT_OR_SHAPE";
+ }
+ else {
+ Handle(GEOM_Function) aRefShape = theShape->GetLastFunction();
+ if (aRefShape.IsNull()) {
+ aRes = "WRN_NULL_OBJECT_OR_SHAPE";
+ }
+ else {
+ TopoDS_Shape aShape = aRefShape->GetValue();
+ if (aShape.IsNull()) {
+ aRes = "WRN_NULL_OBJECT_OR_SHAPE";
+ }
+ else {
+ if (aShape.ShapeType() == TopAbs_COMPOUND) {
+ TopoDS_Iterator It (aShape, Standard_True, Standard_True);
+ if (It.More()) aShape = It.Value();
+ }
+ if (aShape.ShapeType() == TopAbs_SHELL) {
+ if (!aShape.Closed()) {
+ aRes = "WRN_SHAPE_UNCLOSED";
+ }
+ }
+ else {
+ aRes = "WRN_SHAPE_NOT_SHELL";
+ }
+ }
+ }
+ }
+
+ if (aRes.IsEmpty())
+ SetErrorCode(OK);
+
+ return aRes;
+}
+
//=============================================================================
/*!
* WhatIs
//S->Bounds(U1,U2,V1,V2); changed by
ShapeAnalysis::GetFaceUVBounds(TopoDS::Face(tmpSh1),U1,U2,V1,V2);
// end of changes for 020677 (dmv)
- Handle(Geom_RectangularTrimmedSurface) TrS1 =
+ Handle(Geom_RectangularTrimmedSurface) TrS1 =
new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2);
- Handle(Geom_RectangularTrimmedSurface) TrS2 =
+ Handle(Geom_RectangularTrimmedSurface) TrS2 =
new Geom_RectangularTrimmedSurface(S,(U1+U2)/2.,U2,V1,V2);
BRep_Builder B;
TopoDS_Face F1,F2;
double U1,U2,V1,V2;
//S->Bounds(U1,U2,V1,V2);
ShapeAnalysis::GetFaceUVBounds(TopoDS::Face(tmpSh2),U1,U2,V1,V2);
- Handle(Geom_RectangularTrimmedSurface) TrS1 =
+ Handle(Geom_RectangularTrimmedSurface) TrS1 =
new Geom_RectangularTrimmedSurface(S,U1,(U1+U2)/2.,V1,V2);
- Handle(Geom_RectangularTrimmedSurface) TrS2 =
+ Handle(Geom_RectangularTrimmedSurface) TrS2 =
new Geom_RectangularTrimmedSurface(S,(U1+U2)/2.,U2,V1,V2);
BRep_Builder B;
TopoDS_Face F1,F2;
*/
//=============================================================================
std::vector<bool> GEOMImpl_IMeasureOperations::AreCoordsInside(Handle(GEOM_Object) theShape,
- const std::vector<double>& coords,
- double tolerance)
+ const std::vector<double>& coords,
+ double tolerance)
{
std::vector<bool> res;
if (!theShape.IsNull()) {
if (!aRefShape.IsNull()) {
TopoDS_Shape aShape = aRefShape->GetValue();
if (!aShape.IsNull()) {
- BRepClass3d_SolidClassifier SC(aShape);
- unsigned int nb_points = coords.size()/3;
- for (int i = 0; i < nb_points; i++) {
- double x = coords[3*i];
- double y = coords[3*i+1];
- double z = coords[3*i+2];
- gp_Pnt aPnt(x, y, z);
- SC.Perform(aPnt, tolerance);
- res.push_back( ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ) );
- }
+ BRepClass3d_SolidClassifier SC(aShape);
+ unsigned int nb_points = coords.size()/3;
+ for (int i = 0; i < nb_points; i++) {
+ double x = coords[3*i];
+ double y = coords[3*i+1];
+ double z = coords[3*i+2];
+ gp_Pnt aPnt(x, y, z);
+ SC.Perform(aPnt, tolerance);
+ res.push_back( ( SC.State() == TopAbs_IN ) || ( SC.State() == TopAbs_ON ) );
+ }
}
}
}
anAngle = aLin1.Angle(aLin2);
anAngle /= PI180; // convert radians into degrees
+ if (anAngle > 90.0) {
+ anAngle = 180.0 - anAngle;
+ }
+
+ SetErrorCode(OK);
+ }
+ catch (Standard_Failure)
+ {
+ Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+ SetErrorCode(aFail->GetMessageString());
+ }
+
+ return anAngle;
+}
+
+//=======================================================================
+/*!
+ * Compute angle (in degrees) between two vectors
+ */
+//=======================================================================
+Standard_Real GEOMImpl_IMeasureOperations::GetAngleBtwVectors (Handle(GEOM_Object) theVec1,
+ Handle(GEOM_Object) theVec2)
+{
+ SetErrorCode(KO);
+
+ Standard_Real anAngle = -1.0;
+
+ if (theVec1.IsNull() || theVec2.IsNull())
+ return anAngle;
+
+ Handle(GEOM_Function) aRefVec1 = theVec1->GetLastFunction();
+ Handle(GEOM_Function) aRefVec2 = theVec2->GetLastFunction();
+ if (aRefVec1.IsNull() || aRefVec2.IsNull())
+ return anAngle;
+
+ TopoDS_Shape aVec1 = aRefVec1->GetValue();
+ TopoDS_Shape aVec2 = aRefVec2->GetValue();
+ if (aVec1.IsNull() || aVec2.IsNull() ||
+ aVec1.ShapeType() != TopAbs_EDGE ||
+ aVec2.ShapeType() != TopAbs_EDGE)
+ {
+ SetErrorCode("Two edges must be given");
+ return anAngle;
+ }
+
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ TopoDS_Edge aE1 = TopoDS::Edge(aVec1);
+ TopoDS_Edge aE2 = TopoDS::Edge(aVec2);
+
+ TopoDS_Vertex aP11, aP12, aP21, aP22;
+ TopExp::Vertices(aE1, aP11, aP12, Standard_True);
+ TopExp::Vertices(aE2, aP21, aP22, Standard_True);
+ if (aP11.IsNull() || aP12.IsNull() || aP21.IsNull() || aP22.IsNull()) {
+ SetErrorCode("Bad edge given");
+ return anAngle;
+ }
+
+ gp_Vec aV1 (BRep_Tool::Pnt(aP11), BRep_Tool::Pnt(aP12));
+ gp_Vec aV2 (BRep_Tool::Pnt(aP21), BRep_Tool::Pnt(aP22)) ;
+
+ anAngle = aV1.Angle(aV2);
+ anAngle /= PI180; // convert radians into degrees
+
SetErrorCode(OK);
}
catch (Standard_Failure)
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
- GeomLProp_CLProps Prop = GeomLProp_CLProps
+ GeomLProp_CLProps Prop = GeomLProp_CLProps
(aCurve, aP, 2, Precision::Confusion());
aRes = fabs(Prop.Curvature());
SetErrorCode(OK);
aRes = 1/aRes;
else
aRes = RealLast();
-
+
return aRes;
}
#endif
GeomAPI_ProjectPointOnCurve PPCurve(aPoint, aCurve, aFP, aLP);
if(PPCurve.NbPoints()>0) {
- GeomLProp_CLProps Prop = GeomLProp_CLProps
+ GeomLProp_CLProps Prop = GeomLProp_CLProps
(aCurve, PPCurve.LowerDistanceParameter(), 2, Precision::Confusion());
aRes = fabs(Prop.Curvature());
SetErrorCode(OK);
aRes = 1/aRes;
else
aRes = RealLast();
-
+
return aRes;
}
#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
OCC_CATCH_SIGNALS;
#endif
- GeomLProp_SLProps Prop = GeomLProp_SLProps
+ GeomLProp_SLProps Prop = GeomLProp_SLProps
(aSurf, theUParam, theVParam, 2, Precision::Confusion());
if(Prop.IsCurvatureDefined()) {
if(Prop.IsUmbilic()) {
aRes = 1/aRes;
else
aRes = RealLast();
-
+
return aRes;
}
ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2);
Standard_Real U = U1 + (U2-U1)*theUParam;
Standard_Real V = V1 + (V2-V1)*theVParam;
-
+
return getSurfaceCurvatures(aSurf, U, V, true);
}
ShapeAnalysis::GetFaceUVBounds(F,U1,U2,V1,V2);
Standard_Real U = U1 + (U2-U1)*theUParam;
Standard_Real V = V1 + (V2-V1)*theVParam;
-
+
return getSurfaceCurvatures(aSurf, U, V, false);
}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOMImpl_IMeasureOperations_HXX_
#define _GEOMImpl_IMeasureOperations_HXX_
const Standard_Boolean theIsCheckGeom,
TCollection_AsciiString& theDump);
+ Standard_EXPORT TCollection_AsciiString IsGoodForSolid (Handle(GEOM_Object) theShape);
+
Standard_EXPORT TCollection_AsciiString WhatIs (Handle(GEOM_Object) theShape);
Standard_EXPORT std::vector<bool> AreCoordsInside (Handle(GEOM_Object) theShape,
- const std::vector<double>& coords,
- double tolerance = Precision::Confusion());
+ const std::vector<double>& coords,
+ double tolerance = Precision::Confusion());
Standard_EXPORT Standard_Real GetMinDistance (Handle(GEOM_Object) theShape1,
Handle(GEOM_Object) theShape2,
Standard_EXPORT Standard_Real GetAngle (Handle(GEOM_Object) theLine1, Handle(GEOM_Object) theLine2);
+ Standard_EXPORT Standard_Real GetAngleBtwVectors (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2);
+
// Methods for recieving radiuses of curvature of curves and surfaces
// in the given point
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//NOTE: This is an intreface to a function for the point creation.
-//
+//NOTE: This is an interface to a function for the point creation.
+
#include "GEOM_Function.hxx"
#define ARG_X 1
#define ARG_LENGTH 11
-#define ARG_FLAG 12
+//#define ARG_FLAG 12
class GEOMImpl_IPoint
{
void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); }
void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); }
void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); }
- void SetReversed(bool theReversed) { _func->SetInteger(ARG_FLAG, theReversed); }
+ //void SetReversed(bool theReversed) { _func->SetInteger(ARG_FLAG, theReversed); }
double GetParameter() { return _func->GetReal(ARG_PARAM); }
double GetParameter2() { return _func->GetReal(ARG_PARAM2); }
double GetLength() { return _func->GetReal(ARG_LENGTH); }
- bool GetReversed() { return _func->GetInteger(ARG_FLAG); }
+ //bool GetReversed() { return _func->GetInteger(ARG_FLAG); }
private:
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// NOTE: This is an intreface to a function for the Shapes
-// (Wire, Face, Shell, Solid and Compound) creation.
-//
+// NOTE: This is an interface to a function for the Shapes
+// (Edge, Wire, Face, Shell, Solid and Compound) creation.
+
#include "GEOM_Function.hxx"
#include "TColStd_HSequenceOfTransient.hxx"
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
+
// File : GEOMImpl_IShapesOperations.cxx
// Created :
// Author : modified by Lioka RAZAFINDRAZAKA (CEA) 22/06/2007
return anEdge;
}
+//=============================================================================
+/*!
+ * MakeEdgeOnCurveByLength
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IShapesOperations::MakeEdgeOnCurveByLength
+ (Handle(GEOM_Object) theRefCurve,
+ const Standard_Real theLength,
+ Handle(GEOM_Object) theStartPoint)
+{
+ SetErrorCode(KO);
+
+ if (theRefCurve.IsNull()) return NULL;
+
+ //Add a new Edge object
+ Handle(GEOM_Object) anEdge = GetEngine()->AddObject(GetDocID(), GEOM_EDGE);
+
+ //Add a new Vector function
+ Handle(GEOM_Function) aFunction =
+ anEdge->AddFunction(GEOMImpl_ShapeDriver::GetID(), EDGE_CURVE_LENGTH);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_ShapeDriver::GetID()) return NULL;
+
+ GEOMImpl_IVector aPI (aFunction);
+
+ Handle(GEOM_Function) aRef1 = theRefCurve->GetLastFunction();
+ if (aRef1.IsNull()) return NULL;
+ aPI.SetPoint1(aRef1);
+
+ if (!theStartPoint.IsNull()) {
+ Handle(GEOM_Function) aRef2 = theStartPoint->GetLastFunction();
+ aPI.SetPoint2(aRef2);
+ }
+
+ aPI.SetParameter(theLength);
+
+ //Compute the Edge value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Vector 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) << anEdge << " = geompy.MakeEdgeOnCurveByLength("
+ << theRefCurve << ", " << theLength << ", " << theStartPoint << ")";
+
+ SetErrorCode(OK);
+ return anEdge;
+}
+
//=============================================================================
/*!
* MakeEdgeWire
TopoDS_Shape aSubShape;
TopTools_MapOfShape aMap;
- switch(aWhat.ShapeType()) {
+ if (aWhat.ShapeType() == TopAbs_COMPOUND || aWhat.ShapeType() == TopAbs_COMPSOLID) {
+ TopoDS_Iterator It (aWhat, Standard_True, Standard_True);
+ if (It.More()) aWhat = It.Value();
+ It.Next();
+ if (It.More()) {
+ SetErrorCode("Compounds of two or more shapes are not allowed for aWhat argument");
+ return NULL;
+ }
+ }
+
+ switch (aWhat.ShapeType()) {
case TopAbs_VERTEX: {
gp_Pnt P = BRep_Tool::Pnt(TopoDS::Vertex(aWhat));
TopExp_Explorer E(aWhere, TopAbs_VERTEX);
}
break;
}
- case TopAbs_FACE: {
- TopoDS_Face aFace = TopoDS::Face(aWhat);
- TopExp_Explorer E(aWhere, TopAbs_FACE);
+ case TopAbs_EDGE: {
+ TopoDS_Edge anEdge = TopoDS::Edge(aWhat);
+ TopExp_Explorer E(aWhere, TopAbs_EDGE);
for(; E.More(); E.Next()) {
if(!aMap.Add(E.Current())) continue;
- if(isSameFace(aFace, TopoDS::Face(E.Current()))) {
+ if(isSameEdge(anEdge, TopoDS::Edge(E.Current()))) {
aSubShape = E.Current();
isFound = true;
break;
}
break;
}
- case TopAbs_EDGE: {
- TopoDS_Edge anEdge = TopoDS::Edge(aWhat);
- TopExp_Explorer E(aWhere, TopAbs_EDGE);
+ case TopAbs_FACE: {
+ TopoDS_Face aFace = TopoDS::Face(aWhat);
+ TopExp_Explorer E(aWhere, TopAbs_FACE);
for(; E.More(); E.Next()) {
if(!aMap.Add(E.Current())) continue;
- if(isSameEdge(anEdge, TopoDS::Edge(E.Current()))) {
+ if(isSameFace(aFace, TopoDS::Face(E.Current()))) {
aSubShape = E.Current();
isFound = true;
break;
return NULL;
}
- if(isFound) {
+ if (isFound) {
TopTools_IndexedMapOfShape anIndices;
TopExp::MapShapes(aWhere, anIndices);
if (anIndices.Contains(aSubShape))
anIndex = anIndices.FindIndex(aSubShape);
}
- if(anIndex < 0) return NULL;
+ if (anIndex < 0) return NULL;
Handle(TColStd_HArray1OfInteger) anArray = new TColStd_HArray1OfInteger(1,1);
Standard_EXPORT Handle(GEOM_Object) MakeEdge (Handle(GEOM_Object) thePoint1,
Handle(GEOM_Object) thePoint2);
+
+ Standard_EXPORT Handle(GEOM_Object) MakeEdgeOnCurveByLength (Handle(GEOM_Object) theCurve,
+ const Standard_Real theLength,
+ Handle(GEOM_Object) theStartPoint);
+
Standard_EXPORT Handle(GEOM_Object) MakeEdgeWire (Handle(GEOM_Object) theWire,
const Standard_Real theLinearTolerance,
const Standard_Real theAngularTolerance);
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-//NOTE: This is an intreface to a function for the vector creation.
-//
+//NOTE: This is an interface to a function for the vector creation.
+
#include "GEOM_Function.hxx"
#define VEC_ARG_DX 1
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOM_Function.hxx>
+#include <ShapeAnalysis.hxx>
+
+#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
+#include <BRepAdaptor_Curve.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepExtrema_DistShapeShape.hxx>
-#include <BRep_Builder.hxx>
-#include <BRepAdaptor_Curve.hxx>
-#include <Precision.hxx>
+
#include <TopAbs.hxx>
+#include <TopExp.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
+#include <TopoDS_Face.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Compound.hxx>
+#include <GCPnts_AbscissaPoint.hxx>
+#include <IntTools.hxx>
+
#include <Geom_Curve.hxx>
#include <Geom_Surface.hxx>
+
#include <gp_Pnt.hxx>
-#include <TopoDS_Face.hxx>
-#include <ShapeAnalysis.hxx>
-#include <GCPnts_AbscissaPoint.hxx>
-#include <IntTools.hxx>
+#include <Precision.hxx>
+
+#include <Standard_NullObject.hxx>
//=======================================================================
//function : GetID
//purpose : local function
//=======================================================================
static Standard_Boolean getExtremaSolution
-(GEOMImpl_IPoint& thePI,
- TopoDS_Shape& theRefShape,
+(const gp_Pnt& theInitPnt,
+ const TopoDS_Shape& theRefShape,
gp_Pnt& thePnt)
{
- gp_Pnt anInitPnt( thePI.GetX(), thePI.GetY(), thePI.GetZ() );
- BRepBuilderAPI_MakeVertex mkVertex (anInitPnt);
+ BRepBuilderAPI_MakeVertex mkVertex (theInitPnt);
TopoDS_Vertex anInitV = TopoDS::Vertex(mkVertex.Shape());
- BRepExtrema_DistShapeShape anExt( anInitV, theRefShape );
+ BRepExtrema_DistShapeShape anExt (anInitV, theRefShape);
if ( !anExt.IsDone() || anExt.NbSolution() < 1 )
return Standard_False;
thePnt = anExt.PointOnShape2(1);
- Standard_Real aMinDist2 = anInitPnt.SquareDistance( thePnt );
+ Standard_Real aMinDist2 = theInitPnt.SquareDistance( thePnt );
for ( Standard_Integer j = 2, jn = anExt.NbSolution(); j <= jn; j++ )
{
gp_Pnt aPnt = anExt.PointOnShape2(j);
- Standard_Real aDist2 = anInitPnt.SquareDistance( aPnt );
+ Standard_Real aDist2 = theInitPnt.SquareDistance( aPnt );
if ( aDist2 > aMinDist2)
continue;
aMinDist2 = aDist2;
if (aType == POINT_XYZ) {
aPnt = gp_Pnt(aPI.GetX(), aPI.GetY(), aPI.GetZ());
-
}
else if (aType == POINT_XYZ_REF) {
-
Handle(GEOM_Function) aRefPoint = aPI.GetRef();
TopoDS_Shape aRefShape = aRefPoint->GetValue();
if (aRefShape.ShapeType() != TopAbs_VERTEX) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
}
- if (!getExtremaSolution( aPI, aRefShape, aPnt ) ) {
+ gp_Pnt anInitPnt (aPI.GetX(), aPI.GetY(), aPI.GetZ());
+ if (!getExtremaSolution(anInitPnt, aRefShape, aPnt)) {
Standard_ConstructionError::Raise
("Point On Curve creation aborted : cannot project point");
}
}
else if (aType == POINT_CURVE_LENGTH) {
+ // RefCurve
Handle(GEOM_Function) aRefCurve = aPI.GetCurve();
- Standard_Real theLength = aPI.GetLength();
- Standard_Integer theReversed = aPI.GetReversed();
- TopoDS_Shape aRefShape = aRefCurve->GetValue();
- Standard_Real UFirst = 0;
- Standard_Real ULast = 0;
- if (aRefShape.ShapeType() != TopAbs_EDGE) {
+ if (aRefCurve.IsNull()) {
+ Standard_NullObject::Raise
+ ("Point On Curve creation aborted : curve object is null");
+ }
+ TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
+ if (aRefShape1.ShapeType() != TopAbs_EDGE) {
Standard_TypeMismatch::Raise
("Point On Curve creation aborted : curve shape is not an edge");
- }
- Standard_Real theCurveLength = IntTools::Length(TopoDS::Edge(aRefShape));
- if (theLength > theCurveLength) {
- Standard_ConstructionError::Raise
- ("Point On Curve creation aborted : given length is greater than edges length");
}
- Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(TopoDS::Edge(aRefShape), UFirst, ULast);
+ TopoDS_Edge aRefEdge = TopoDS::Edge(aRefShape1);
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(aRefEdge, V1, V2, Standard_True);
+
+ // RefPoint
+ TopoDS_Vertex aRefVertex;
+ Handle(GEOM_Function) aRefPoint = aPI.GetRef();
+ if (aRefPoint.IsNull()) {
+ aRefVertex = V1;
+ }
+ else {
+ TopoDS_Shape aRefShape2 = aRefPoint->GetValue();
+ if (aRefShape2.ShapeType() != TopAbs_VERTEX) {
+ Standard_TypeMismatch::Raise
+ ("Point On Curve creation aborted : start point shape is not a vertex");
+ }
+ aRefVertex = TopoDS::Vertex(aRefShape2);
+ }
+ gp_Pnt aRefPnt = BRep_Tool::Pnt(aRefVertex);
+
+ // Length
+ Standard_Real aLength = aPI.GetLength();
+ //Standard_Real theCurveLength = IntTools::Length(aRefEdge);
+ //if (aLength > theCurveLength) {
+ // Standard_ConstructionError::Raise
+ // ("Point On Curve creation aborted : given length is greater than edges length");
+ //}
+
+ // Check orientation
+ Standard_Real UFirst, ULast;
+ Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(aRefEdge, UFirst, ULast);
Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
- if ( theReversed ) {
- ReOrientedCurve = EdgeCurve -> Reversed();
- UFirst = EdgeCurve -> ReversedParameter(ULast);
+
+ Standard_Real dU = ULast - UFirst;
+ Standard_Real par1 = UFirst + 0.1 * dU;
+ Standard_Real par2 = ULast - 0.1 * dU;
+
+ gp_Pnt P1 = EdgeCurve->Value(par1);
+ gp_Pnt P2 = EdgeCurve->Value(par2);
+
+ if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) {
+ ReOrientedCurve = EdgeCurve->Reversed();
+ UFirst = EdgeCurve->ReversedParameter(ULast);
}
+
+ // Get the point by length
GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
- GCPnts_AbscissaPoint anAbsPnt(AdapCurve, theLength, UFirst);
+ GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
Standard_Real aParam = anAbsPnt.Parameter();
aPnt = AdapCurve.Value(aParam);
}
Standard_TypeMismatch::Raise
("Point On Surface creation aborted : surface shape is not a face");
}
- if (!getExtremaSolution( aPI, aRefShape, aPnt ) ) {
+ gp_Pnt anInitPnt (aPI.GetX(), aPI.GetY(), aPI.GetZ());
+ if (!getExtremaSolution(anInitPnt, aRefShape, aPnt)) {
Standard_ConstructionError::Raise
("Point On Surface creation aborted : cannot project point");
}
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <GEOMImpl_ShapeDriver.hxx>
#include <GEOMImpl_IShapes.hxx>
+#include <GEOMImpl_IVector.hxx>
#include <GEOMImpl_Types.hxx>
#include <GEOMImpl_Block6Explorer.hxx>
#include <ShapeFix_Edge.hxx>
#include <ShapeFix_Shape.hxx>
-#include <BRep_Tool.hxx>
#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
+#include <BRepAdaptor_Curve.hxx>
#include <BRepAlgo_FaceRestrictor.hxx>
-#include <BRepBuilderAPI_Sewing.hxx>
#include <BRepBuilderAPI_Copy.hxx>
+#include <BRepBuilderAPI_Sewing.hxx>
+#include <BRepBuilderAPI_MakeWire.hxx>
+#include <BRepBuilderAPI_MakeEdge.hxx>
#include <BRepCheck.hxx>
#include <BRepCheck_Analyzer.hxx>
#include <BRepCheck_Shell.hxx>
#include <BRepClass3d_SolidClassifier.hxx>
-#include <BRepBuilderAPI_MakeWire.hxx>
-#include <BRepBuilderAPI_Sewing.hxx>
#include <BRepLib.hxx>
#include <BRepLib_MakeEdge.hxx>
#include <BRepTools_WireExplorer.hxx>
-#include <BRepAdaptor_Curve.hxx>
#include <ShapeAnalysis_FreeBounds.hxx>
-#include <ElCLib.hxx>
#include <TopAbs.hxx>
+#include <TopExp.hxx>
+#include <TopExp_Explorer.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Iterator.hxx>
-#include <TopExp.hxx>
-#include <TopExp_Explorer.hxx>
#include <TopTools_MapOfShape.hxx>
#include <TopTools_HSequenceOfShape.hxx>
+#include <ElCLib.hxx>
+
+#include <GCPnts_AbscissaPoint.hxx>
+
+#include <Geom_TrimmedCurve.hxx>
+#include <GeomAbs_CurveType.hxx>
+#include <GeomConvert_CompCurveToBSplineCurve.hxx>
+#include <GeomConvert.hxx>
+#include <GeomLProp.hxx>
+
#include <TColStd_SequenceOfReal.hxx>
#include <TColStd_HSequenceOfTransient.hxx>
#include <TColStd_Array1OfReal.hxx>
#include <TColGeom_Array1OfBSplineCurve.hxx>
#include <TColGeom_HArray1OfBSplineCurve.hxx>
-#include <GeomAbs_CurveType.hxx>
-#include <Geom_TrimmedCurve.hxx>
-#include <GeomConvert_CompCurveToBSplineCurve.hxx>
-#include <GeomConvert.hxx>
-#include <GeomLProp.hxx>
-
#include <Precision.hxx>
+
#include <Standard_NullObject.hxx>
#include <Standard_TypeMismatch.hxx>
#include <Standard_ConstructionError.hxx>
Handle(ShapeFix_Wire) aFW = new ShapeFix_Wire;
aFW->Load(aWire);
aFW->FixReorder();
-
+
if (aFW->StatusReorder(ShapeExtend_FAIL1)) {
Standard_ConstructionError::Raise("Wire construction failed: several loops detected");
} else if (aFW->StatusReorder(ShapeExtend_FAIL)) {
Standard_Real aTolerance = aCI.GetTolerance();
if (aTolerance < Precision::Confusion())
aTolerance = Precision::Confusion();
-
+
aFW->ClosedWireMode() = Standard_False;
aFW->FixConnected(aTolerance);
if (aFW->StatusConnected(ShapeExtend_FAIL)) {
if (!MW.IsDone()) {
Standard_ConstructionError::Raise("Wire construction failed");
}
- W = MW;
+ W = MW;
}
else {
Standard_NullObject::Raise
else if (aType == SOLID_SHELL) {
Handle(GEOM_Function) aRefShell = aCI.GetBase();
TopoDS_Shape aShapeShell = aRefShell->GetValue();
+ if (!aShapeShell.IsNull() && aShapeShell.ShapeType() == TopAbs_COMPOUND) {
+ TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
+ if (It.More()) aShapeShell = It.Value();
+ }
if (aShapeShell.IsNull() || aShapeShell.ShapeType() != TopAbs_SHELL) {
Standard_NullObject::Raise("Shape for solid construction is null or not a shell");
}
BRepCheck_Shell chkShell(TopoDS::Shell(aShapeShell));
- if(chkShell.Closed() == BRepCheck_NotClosed) return 0;
+ if (chkShell.Closed() == BRepCheck_NotClosed) return 0;
TopoDS_Solid Sol;
B.MakeSolid(Sol);
if (aShapeShell.IsNull()) {
Standard_NullObject::Raise("Shell for solid construction is null");
}
+ if (aShapeShell.ShapeType() == TopAbs_COMPOUND) {
+ TopoDS_Iterator It (aShapeShell, Standard_True, Standard_True);
+ if (It.More()) aShapeShell = It.Value();
+ }
if (aShapeShell.ShapeType() == TopAbs_SHELL) {
B.Add(Sol, aShapeShell);
ish++;
}
}
- if ( ish == 0 ) return 0;
+ if (ish == 0) return 0;
BRepClass3d_SolidClassifier SC (Sol);
SC.PerformInfinitePoint(Precision::Confusion());
if (SC.State() == TopAbs_IN)
case GeomAbs_Line:
{
gp_Lin aLine = BAcurve.Line();
- gp_Lin PrevLine = GAprevcurve.Line();
+ gp_Lin PrevLine = GAprevcurve.Line();
if (aLine.Contains(PrevLine.Location(), LinTol) &&
aLine.Direction().IsParallel(PrevLine.Direction(), AngTol))
{
Standard_Integer nb_curve = CurveSeq.Length(); //number of curves
TColGeom_Array1OfBSplineCurve tab(0,nb_curve-1); //array of the curves
TColStd_Array1OfReal tabtolvertex(0,nb_curve-1); //(0,nb_curve-2); //array of the tolerances
-
+
Standard_Integer i;
-
+
if (nb_curve > 1)
{
for (i = 1; i <= nb_curve; i++)
{
if (CurveSeq(i)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
CurveSeq(i) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve();
-
+
Handle(Geom_TrimmedCurve) aTrCurve = new Geom_TrimmedCurve(CurveSeq(i), FparSeq(i), LparSeq(i));
tab(i-1) = GeomConvert::CurveToBSplineCurve(aTrCurve);
tab(i-1)->Transform(LocSeq(i).Location().Transformation());
GeomConvert::C0BSplineToC1BSplineCurve(tab(i-1), Precision::Confusion());
if (LocSeq(i).Orientation() == TopAbs_REVERSED)
tab(i-1)->Reverse();
-
+
//Temporary
//char* name = new char[100];
//sprintf(name, "c%d", i);
//DrawTrSurf::Set(name, tab(i-1));
-
+
if (i > 1)
tabtolvertex(i-2) = TolSeq(i-1);
} // end for (i = 1; i <= nb_curve; i++)
tabtolvertex(nb_curve-1) = TolSeq(TolSeq.Length());
-
+
Standard_Boolean closed_flag = Standard_False;
Standard_Real closed_tolerance = 0.;
if (FirstVertex.IsSame(LastVertex) &&
closed_flag = Standard_True ;
closed_tolerance = BRep_Tool::Tolerance(FirstVertex);
}
-
+
Handle(TColGeom_HArray1OfBSplineCurve) concatcurve; //array of the concatenated curves
Handle(TColStd_HArray1OfInteger) ArrayOfIndices; //array of the remining Vertex
GeomConvert::ConcatC1(tab,
concatcurve,
closed_flag,
closed_tolerance); //C1 concatenation
-
+
if (concatcurve->Length() > 1)
{
GeomConvert_CompCurveToBSplineCurve Concat(concatcurve->Value(concatcurve->Lower()));
-
+
for (i = concatcurve->Lower()+1; i <= concatcurve->Upper(); i++)
Concat.Add( concatcurve->Value(i), LinTol, Standard_True );
-
+
concatcurve->SetValue(concatcurve->Lower(), Concat.BSplineCurve());
}
-
+
ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
FirstVertex, LastVertex);
}
{
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve();
-
+
CurveSeq(1)->Transform(LocSeq(1).Location().Transformation());
ResEdge = BRepLib_MakeEdge(CurveSeq(1),
FirstVertex, LastVertex,
FparSeq(1), LparSeq(1));
}
}
-
+
aShape = ResEdge;
}
+ else if (aType == EDGE_CURVE_LENGTH) {
+ GEOMImpl_IVector aVI (aFunction);
+
+ // RefCurve
+ Handle(GEOM_Function) aRefCurve = aVI.GetPoint1();
+ if (aRefCurve.IsNull()) Standard_NullObject::Raise("Argument Curve is null");
+ TopoDS_Shape aRefShape1 = aRefCurve->GetValue();
+ if (aRefShape1.ShapeType() != TopAbs_EDGE) {
+ Standard_TypeMismatch::Raise
+ ("Edge On Curve creation aborted : curve shape is not an edge");
+ }
+ TopoDS_Edge aRefEdge = TopoDS::Edge(aRefShape1);
+ TopoDS_Vertex V1, V2;
+ TopExp::Vertices(aRefEdge, V1, V2, Standard_True);
+
+ // RefPoint
+ TopoDS_Vertex aRefVertex;
+ Handle(GEOM_Function) aRefPoint = aVI.GetPoint2();
+ if (aRefPoint.IsNull()) {
+ aRefVertex = V1;
+ }
+ else {
+ TopoDS_Shape aRefShape2 = aRefPoint->GetValue();
+ if (aRefShape2.ShapeType() != TopAbs_VERTEX) {
+ Standard_TypeMismatch::Raise
+ ("Edge On Curve creation aborted : start point shape is not a vertex");
+ }
+ aRefVertex = TopoDS::Vertex(aRefShape2);
+ }
+ gp_Pnt aRefPnt = BRep_Tool::Pnt(aRefVertex);
+
+ // Length
+ Standard_Real aLength = aVI.GetParameter();
+ //Standard_Real aCurveLength = IntTools::Length(aRefEdge);
+ //if (aLength > aCurveLength) {
+ // Standard_ConstructionError::Raise
+ // ("Edge On Curve creation aborted : given length is greater than edges length");
+ //}
+ if (fabs(aLength) < Precision::Confusion()) {
+ Standard_ConstructionError::Raise
+ ("Edge On Curve creation aborted : given length is smaller than Precision::Confusion()");
+ }
+
+ // Check orientation
+ Standard_Real UFirst, ULast;
+ Handle(Geom_Curve) EdgeCurve = BRep_Tool::Curve(aRefEdge, UFirst, ULast);
+ Handle(Geom_Curve) ReOrientedCurve = EdgeCurve;
+
+ Standard_Real dU = ULast - UFirst;
+ Standard_Real par1 = UFirst + 0.1 * dU;
+ Standard_Real par2 = ULast - 0.1 * dU;
+
+ gp_Pnt P1 = EdgeCurve->Value(par1);
+ gp_Pnt P2 = EdgeCurve->Value(par2);
+
+ if (aRefPnt.SquareDistance(P2) < aRefPnt.SquareDistance(P1)) {
+ ReOrientedCurve = EdgeCurve->Reversed();
+ UFirst = EdgeCurve->ReversedParameter(ULast);
+ }
+
+ // Get the point by length
+ GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
+ GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
+ Standard_Real aParam = anAbsPnt.Parameter();
+
+ if (AdapCurve.IsClosed() && aLength < 0.0) {
+ Standard_Real aTmp = aParam;
+ aParam = UFirst;
+ UFirst = aTmp;
+ }
+
+ BRepBuilderAPI_MakeEdge aME (ReOrientedCurve, UFirst, aParam);
+ if (aME.IsDone())
+ aShape = aME.Shape();
+ }
+ else {
+ }
if (aShape.IsNull()) return 0;
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
//GEOM_Object types
-//
+
#define GEOM_COPY 0
#define GEOM_IMPORT 1
#define FACE_WIRES 9
#define REVERSE_ORIENTATION 10
#define EDGE_WIRE 11
+#define EDGE_CURVE_LENGTH 12
#define ARCHIMEDE_TYPE 1
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePointOnCurveByLength
(GEOM::GEOM_Object_ptr theCurve,
- CORBA::Double theLength,
- CORBA::Boolean theReverse)
+ CORBA::Double theLength,
+ GEOM::GEOM_Object_ptr theStartPoint)
{
GEOM::GEOM_Object_var aGEOMObject;
Handle(GEOM_Object) aReference = GetObjectImpl(theCurve);
if (aReference.IsNull()) return aGEOMObject._retn();
+ //Get the reference point (can be NULL)
+ Handle(GEOM_Object) aRefPoint;
+ if (!CORBA::is_nil(theStartPoint)) {
+ aRefPoint = GetObjectImpl(theStartPoint);
+ }
+
//Create the point
Handle(GEOM_Object) anObject =
- GetOperations()->MakePointOnCurveByLength(aReference, theLength,
- theReverse);
+ GetOperations()->MakePointOnCurveByLength(aReference, theLength, aRefPoint);
if (!GetOperations()->IsDone() || anObject.IsNull())
return aGEOMObject._retn();
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOM_IBasicOperations_i_HeaderFile
#define _GEOM_IBasicOperations_i_HeaderFile
CORBA::Double theParameter);
GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theCurve,
- CORBA::Double theLength,
- CORBA::Boolean theReverse);
+ CORBA::Double theLength,
+ GEOM::GEOM_Object_ptr theStartPoint);
GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theCurve,
CORBA::Double theXParameter,
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#include <Standard_Stream.hxx>
return 0;
}
+//=============================================================================
+/*!
+ * IsGoodForSolid
+ */
+//=============================================================================
+char* GEOM_IMeasureOperations_i::IsGoodForSolid (GEOM::GEOM_Object_ptr theShape)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference shape
+ Handle(GEOM_Object) aShape = GetObjectImpl(theShape);
+ if (aShape.IsNull()) return CORBA::string_dup("WRN_NULL_OBJECT_OR_SHAPE");
+
+ // Get shape parameters
+ TCollection_AsciiString aDescription = GetOperations()->IsGoodForSolid(aShape);
+ return CORBA::string_dup(aDescription.ToCString());
+}
+
//=============================================================================
/*!
* WhatIs
*/
//=============================================================================
GEOM::ListOfBool* GEOM_IMeasureOperations_i::AreCoordsInside (GEOM::GEOM_Object_ptr theShape,
- const GEOM::ListOfDouble& theCoords,
- CORBA::Double tolerance)
+ const GEOM::ListOfDouble& theCoords,
+ CORBA::Double tolerance)
{
//Set a not done flag
GetOperations()->SetNotDone();
return GetOperations()->GetAngle(aShape1, aShape2);
}
+//=============================================================================
+/*!
+ * GetAngle
+ */
+//=============================================================================
+CORBA::Double GEOM_IMeasureOperations_i::GetAngleBtwVectors (GEOM::GEOM_Object_ptr theShape1,
+ GEOM::GEOM_Object_ptr theShape2)
+{
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference shapes
+ Handle(GEOM_Object) aShape1 = GetObjectImpl(theShape1);
+ Handle(GEOM_Object) aShape2 = GetObjectImpl(theShape2);
+ if (aShape1.IsNull() || aShape2.IsNull()) return -1.0;
+
+ // Get the angle
+ return GetOperations()->GetAngleBtwVectors(aShape1, aShape2);
+}
+
//=============================================================================
/*!
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
#ifndef _GEOM_IMeasureOperations_i_HeaderFile
#define _GEOM_IMeasureOperations_i_HeaderFile
{
public:
GEOM_IMeasureOperations_i (PortableServer::POA_ptr thePOA, GEOM::GEOM_Gen_ptr theEngine,
- ::GEOMImpl_IMeasureOperations* theImpl);
+ ::GEOMImpl_IMeasureOperations* theImpl);
~GEOM_IMeasureOperations_i();
GEOM::GEOM_IKindOfShape::shape_kind KindOfShape (GEOM::GEOM_Object_ptr theShape,
- GEOM::ListOfLong_out theIntegers,
- GEOM::ListOfDouble_out theDoubles);
+ GEOM::ListOfLong_out theIntegers,
+ GEOM::ListOfDouble_out theDoubles);
void GetPosition (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz,
- CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz,
- CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz);
+ CORBA::Double& Ox, CORBA::Double& Oy, CORBA::Double& Oz,
+ CORBA::Double& Zx, CORBA::Double& Zy, CORBA::Double& Zz,
+ CORBA::Double& Xx, CORBA::Double& Xy, CORBA::Double& Xz);
void GetBasicProperties (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double& theLength,
- CORBA::Double& theSurfArea,
- CORBA::Double& theVolume);
+ CORBA::Double& theLength,
+ CORBA::Double& theSurfArea,
+ CORBA::Double& theVolume);
GEOM::GEOM_Object_ptr GetCentreOfMass (GEOM::GEOM_Object_ptr theShape);
GEOM::GEOM_Object_ptr GetNormal (GEOM::GEOM_Object_ptr theFace,
- GEOM::GEOM_Object_ptr theOptionalPoint);
+ GEOM::GEOM_Object_ptr theOptionalPoint);
- GEOM::GEOM_Object_ptr GetVertexByIndex (GEOM::GEOM_Object_ptr theObject,
+ GEOM::GEOM_Object_ptr GetVertexByIndex (GEOM::GEOM_Object_ptr theObject,
CORBA::Long theIndex);
void GetInertia (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13,
- CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23,
- CORBA::Double& I31, CORBA::Double& I32, CORBA::Double& I33,
- CORBA::Double& Ix , CORBA::Double& Iy , CORBA::Double& Iz);
+ CORBA::Double& I11, CORBA::Double& I12, CORBA::Double& I13,
+ CORBA::Double& I21, CORBA::Double& I22, CORBA::Double& I23,
+ CORBA::Double& I31, CORBA::Double& I32, CORBA::Double& I33,
+ CORBA::Double& Ix , CORBA::Double& Iy , CORBA::Double& Iz);
void GetBoundingBox (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double& Xmin, CORBA::Double& Xmax,
- CORBA::Double& Ymin, CORBA::Double& Ymax,
- CORBA::Double& Zmin, CORBA::Double& Zmax);
+ CORBA::Double& Xmin, CORBA::Double& Xmax,
+ CORBA::Double& Ymin, CORBA::Double& Ymax,
+ CORBA::Double& Zmin, CORBA::Double& Zmax);
void GetTolerance (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double& FaceMin, CORBA::Double& FaceMax,
- CORBA::Double& EdgeMin, CORBA::Double& EdgeMax,
- CORBA::Double& VertMin, CORBA::Double& VertMax);
+ CORBA::Double& FaceMin, CORBA::Double& FaceMax,
+ CORBA::Double& EdgeMin, CORBA::Double& EdgeMax,
+ CORBA::Double& VertMin, CORBA::Double& VertMax);
CORBA::Boolean CheckShape (GEOM::GEOM_Object_ptr theShape,
- CORBA::String_out theDescription);
+ CORBA::String_out theDescription);
CORBA::Boolean CheckShapeWithGeometry (GEOM::GEOM_Object_ptr theShape,
- CORBA::String_out theDescription);
+ CORBA::String_out theDescription);
+
+ char* IsGoodForSolid (GEOM::GEOM_Object_ptr theShape);
char* WhatIs (GEOM::GEOM_Object_ptr theShape);
GEOM::ListOfBool* AreCoordsInside (GEOM::GEOM_Object_ptr theShape,
- const GEOM::ListOfDouble& theCoords,
- CORBA::Double theTolerance);
+ const GEOM::ListOfDouble& theCoords,
+ CORBA::Double theTolerance);
CORBA::Double GetMinDistance (GEOM::GEOM_Object_ptr theShape1,
- GEOM::GEOM_Object_ptr theShape2,
+ GEOM::GEOM_Object_ptr theShape2,
CORBA::Double& X1, CORBA::Double& Y1, CORBA::Double& Z1,
CORBA::Double& X2, CORBA::Double& Y2, CORBA::Double& Z2);
void PointCoordinates (GEOM::GEOM_Object_ptr theShape,
- CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z);
+ CORBA::Double& X, CORBA::Double& Y, CORBA::Double& Z);
CORBA::Double GetAngle (GEOM::GEOM_Object_ptr theShape1,
- GEOM::GEOM_Object_ptr theShape2);
+ GEOM::GEOM_Object_ptr theShape2);
+
+ CORBA::Double GetAngleBtwVectors (GEOM::GEOM_Object_ptr theShape1,
+ GEOM::GEOM_Object_ptr theShape2);
// Methods for recieving radiuses of curvature of curves and surfaces
// in the given point
CORBA::Double CurveCurvatureByParam (GEOM::GEOM_Object_ptr theCurve,
- CORBA::Double theParam);
+ CORBA::Double theParam);
CORBA::Double CurveCurvatureByPoint (GEOM::GEOM_Object_ptr theCurve,
- GEOM::GEOM_Object_ptr thePoint);
+ GEOM::GEOM_Object_ptr thePoint);
CORBA::Double MaxSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf,
- CORBA::Double theUParam,
- CORBA::Double theVParam);
+ CORBA::Double theUParam,
+ CORBA::Double theVParam);
CORBA::Double MaxSurfaceCurvatureByPoint (GEOM::GEOM_Object_ptr theSurf,
- GEOM::GEOM_Object_ptr thePoint);
+ GEOM::GEOM_Object_ptr thePoint);
CORBA::Double MinSurfaceCurvatureByParam (GEOM::GEOM_Object_ptr theSurf,
- CORBA::Double theUParam,
- CORBA::Double theVParam);
+ CORBA::Double theUParam,
+ CORBA::Double theVParam);
CORBA::Double MinSurfaceCurvatureByPoint (GEOM::GEOM_Object_ptr theSurf,
- GEOM::GEOM_Object_ptr thePoint);
+ GEOM::GEOM_Object_ptr thePoint);
::GEOMImpl_IMeasureOperations* GetOperations()
{ return (::GEOMImpl_IMeasureOperations*)GetImpl(); }
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakeEdgeOnCurveByLength
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IShapesOperations_i::MakeEdgeOnCurveByLength
+ (GEOM::GEOM_Object_ptr theCurve,
+ CORBA::Double theLength,
+ GEOM::GEOM_Object_ptr theStartPoint)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the reference curve
+ Handle(GEOM_Object) aRefCurve = GetObjectImpl(theCurve);
+ if (aRefCurve.IsNull()) return aGEOMObject._retn();
+
+ //Get the reference point (can be NULL)
+ Handle(GEOM_Object) aRefPoint;
+ if (!CORBA::is_nil(theStartPoint)) {
+ aRefPoint = GetObjectImpl(theStartPoint);
+ }
+
+ //Create the point
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakeEdgeOnCurveByLength(aRefCurve, theLength, aRefPoint);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
//=============================================================================
/*!
* MakeEdgeWire
GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2);
+
+ GEOM::GEOM_Object_ptr MakeEdgeOnCurveByLength (GEOM::GEOM_Object_ptr theCurve,
+ CORBA::Double theLength,
+ GEOM::GEOM_Object_ptr theStartPoint);
+
GEOM::GEOM_Object_ptr MakeEdgeWire (GEOM::GEOM_Object_ptr theWire,
const CORBA::Double theLinearTolerance,
const CORBA::Double theAngularTolerance);
//=============================================================================
GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theLength,
- CORBA::Boolean theReverse)
+ GEOM::GEOM_Object_ptr theStartPoint)
{
beginService( " GEOM_Superv_i::MakePointOnCurveByLength" );
MESSAGE("GEOM_Superv_i::MakePointOnCurveByLength");
getBasicOp();
- GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theReverse);
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint);
endService( " GEOM_Superv_i::MakePointOnCurveByLength" );
return anObj;
}
return anObj;
}
+//=============================================================================
+// MakeEdgeOnCurveByLength:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakeEdgeOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
+ CORBA::Double theLength,
+ GEOM::GEOM_Object_ptr theStartPoint)
+{
+ beginService( " GEOM_Superv_i::MakeEdgeOnCurveByLength" );
+ MESSAGE("GEOM_Superv_i::MakeEdgeOnCurveByLength");
+ getShapesOp();
+ GEOM::GEOM_Object_ptr anObj = myShapesOp->MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint);
+ endService( " GEOM_Superv_i::MakeEdgeOnCurveByLength" );
+ return anObj;
+}
+
//=============================================================================
// MakeWire:
//=============================================================================
CORBA::Double theParameter);
GEOM::GEOM_Object_ptr MakePointOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theLength,
- CORBA::Boolean theReverse);
+ GEOM::GEOM_Object_ptr theStartPoint);
GEOM::GEOM_Object_ptr MakePointOnCurveByCoord (GEOM::GEOM_Object_ptr theRefCurve,
CORBA::Double theXParameter,
CORBA::Double theYParameter,
//-----------------------------------------------------------//
GEOM::GEOM_Object_ptr MakeEdge (GEOM::GEOM_Object_ptr thePnt1,
GEOM::GEOM_Object_ptr thePnt2);
+ GEOM::GEOM_Object_ptr MakeEdgeOnCurveByLength (GEOM::GEOM_Object_ptr theRefCurve,
+ CORBA::Double theLength,
+ GEOM::GEOM_Object_ptr theStartPoint);
GEOM::GEOM_Object_ptr MakeWire (GEOM::GEOM_List_ptr theEdgesAndWires,
CORBA::Double theTolerance);
GEOM::GEOM_Object_ptr MakeFace (GEOM::GEOM_Object_ptr theWire,
precision = 0.00001
#Create base points
- p0 = geompy.MakeVertex(0. , 0. , 0. ) #(3 Doubles)->GEOM_Object_ptr
+ p0 = geompy.MakeVertex(0. , 0. , 0. ) #(3 Doubles)->GEOM_Object
px = geompy.MakeVertex(100., 0. , 0. )
py = geompy.MakeVertex(0. , 100., 0. )
pz = geompy.MakeVertex(0. , 0. , 100.)
pxyz = geompy.MakeVertex(100., 100., 100.)
- p200 = geompy.MakeVertexWithRef(pxyz, 100., 100., 100.) #(GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr
+ p200 = geompy.MakeVertexWithRef(pxyz, 100., 100., 100.) #(GEOM_Object, 3 Doubles)->GEOM_Object
#Create base directions
- vx = geompy.MakeVector(p0, px) #(GEOM_Object_ptr, GEOM_Object_ptr)->GEOM_Object_ptr
+ vx = geompy.MakeVector(p0, px) #(GEOM_Object, GEOM_Object)->GEOM_Object
vy = geompy.MakeVector(p0, py)
vz = geompy.MakeVector(p0, pz)
vxy = geompy.MakeVector(px, py)
- vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.) #(3 Doubles)->GEOM_Object_ptr
+ vxyz = geompy.MakeVectorDXDYDZ(100., 100., 100.) #(3 Doubles)->GEOM_Object
#Create local coordinate systems
- cs1 = geompy.MakeMarker(50,50,50, 1,0,0, 0,1,0) #(9 Doubles)->GEOM_Object_ptr
- cs2 = geompy.MakeMarker(70,80,10, 1,0,1, 1,1,0) #(9 Doubles)->GEOM_Object_ptr
- cs3 = geompy.MakeMarkerPntTwoVec(pz, vxy, vz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
+ cs1 = geompy.MakeMarker(50,50,50, 1,0,0, 0,1,0) #(9 Doubles)->GEOM_Object
+ cs2 = geompy.MakeMarker(70,80,10, 1,0,1, 1,1,0) #(9 Doubles)->GEOM_Object
+ cs3 = geompy.MakeMarkerPntTwoVec(pz, vxy, vz) #(3 GEOM_Object)->GEOM_Object
#Create base geometry 2D
- Line = geompy.MakeLineTwoPnt(p0, pxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- Line1 = geompy.MakeLine(pz, vxy) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- Line2 = geompy.MakeLineTwoPnt(pxyz, pz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- Plane = geompy.MakePlane(pz, vxyz, trimsize) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
- Plane1 = geompy.MakePlaneThreePnt(px, pz, p200, trimsize) #(4 Doubles)->GEOM_Object_ptr
- Plane2 = geompy.MakePlane2Vec(vx, vz, trimsize) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
- Plane3 = geompy.MakePlaneLCS(cs1, trimsize, 3) #(1 GEOM_Object_ptr, 2 Double)->GEOM_Object_ptr
-
- Arc = geompy.MakeArc(py, pz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
- Arc3 = geompy.MakeArcOfEllipse(p0, px, pz) #(3 GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
- Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
- Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
- Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
- Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
- Interpol = geompy.MakeInterpol([px, py, p200, pxyz], True) #(List of GEOM_Object_ptr,Boolean)->GEOM_Object_ptr
+ Line = geompy.MakeLineTwoPnt(p0, pxyz) #(2 GEOM_Object)->GEOM_Object
+ Line1 = geompy.MakeLine(pz, vxy) #(2 GEOM_Object)->GEOM_Object
+ Line2 = geompy.MakeLineTwoPnt(pxyz, pz) #(2 GEOM_Object)->GEOM_Object
+ Plane = geompy.MakePlane(pz, vxyz, trimsize) #(2 GEOM_Object, Double)->GEOM_Object
+ Plane1 = geompy.MakePlaneThreePnt(px, pz, p200, trimsize) #(4 Doubles)->GEOM_Object
+ Plane2 = geompy.MakePlane2Vec(vx, vz, trimsize) #(2 GEOM_Object, Double)->GEOM_Object
+ Plane3 = geompy.MakePlaneLCS(cs1, trimsize, 3) #(1 GEOM_Object, 2 Double)->GEOM_Object
+
+ Arc = geompy.MakeArc(py, pz, px) #(3 GEOM_Object)->GEOM_Object
+ Arc2 = geompy.MakeArcCenter(py, pz, px,0) #(3 GEOM_Object,Boolean)->GEOM_Object
+ Arc3 = geompy.MakeArcOfEllipse(p0, px, pz) #(3 GEOM_Object,Boolean)->GEOM_Object
+ Circle = geompy.MakeCircle(p0, vz, radius1) #(2 GEOM_Object, Double)->GEOM_Object
+ Circle1 = geompy.MakeCircleThreePnt(p0, pxyz, px) #(3 GEOM_Object)->GEOM_Object
+ Circle2 = geompy.MakeCircleCenter2Pnt(p0, pxyz, py) #(3 GEOM_Object)->GEOM_Object
+ Ellipse = geompy.MakeEllipse(p0, vy, radius2, radius1) #(2 GEOM_Object, 2 Doubles)->GEOM_Object
+ Polyline = geompy.MakePolyline([p0, pz, py, p200]) #(List of GEOM_Object)->GEOM_Object
+ Bezier = geompy.MakeBezier([p0, pz, p200, px]) #(List of GEOM_Object)->GEOM_Object
+ Interpol = geompy.MakeInterpol([px, py, p200, pxyz], True) #(List of GEOM_Object,Boolean)->GEOM_Object
Sketcher = geompy.MakeSketcher("Sketcher:F -100 -100:TT 250 -100:R 0:C 100 150:R 0:L 300:WW",
- [100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object_ptr
+ [100,0,0, 1,1,1, -1,1,0]) #(String, List of Doubles)->GEOM_Object
Sketcher3d = geompy.Make3DSketcher([0,0,0, 50,50,50, 0,50,50, 10,0,0])
#Create local coordinate system from shape
cs4 = geompy.MakeMarkerFromShape(Plane)
#Test point on curve creation
- p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
- p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10 ) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
- p_on_arc3 = geompy.MakeVertexOnCurveByLength(Arc, 50, True) #(GEOM_Object_ptr, Double, Boolean)->GEOM_Object_ptr
+ p_on_arc = geompy.MakeVertexOnCurve(Arc, 0.25) #(GEOM_Object, Double)->GEOM_Object
+ p_on_arc2 = geompy.MakeVertexOnCurveByCoord(Arc, 100, -10, 10 ) #(GEOM_Object, Double)->GEOM_Object
+ p_on_arc3 = geompy.MakeVertexOnCurveByLength(Arc, 50, py) #(GEOM_Object, Double, GEOM_Object)->GEOM_Object
#Test point on lines intersection
- p_on_l1l2 = geompy.MakeVertexOnLinesIntersection(Line1, Line2) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
+ p_on_l1l2 = geompy.MakeVertexOnLinesIntersection(Line1, Line2) #(2 GEOM_Object)->GEOM_Object
#Test tangent on curve creation
- tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
+ tan_on_arc = geompy.MakeTangentOnCurve(Arc, 0.7) #(GEOM_Object, Double)->GEOM_Object
#Test tangent on face creation
tan_vertex_1 = geompy.MakeVertex(0, 0, 0)
tan_on_face = geompy.MakeTangentPlaneOnFace(tan_extrusion, 0.7, 0.5, 150)
#Create base geometry 3D
- Box = geompy.MakeBoxTwoPnt(p0, p200) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- Box1 = geompy.MakeBoxDXDYDZ(10, 20, 30) #(3 Doubles)->GEOM_Object_ptr
- Box2 = geompy.MakeBox(10,20,30, 15,25,35) #(6 Doubles)->GEOM_Object_ptr
- Cylinder = geompy.MakeCylinder(p0, vz, radius1, height) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
- Cyl1 = geompy.MakeCylinderRH(radius2, height) #(2 Doubles)->GEOM_Object_ptr
- Sphere = geompy.MakeSpherePntR(p0, radius1) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
- Sphere1 = geompy.MakeSphereR(radius) #(Double)->GEOM_Object_ptr
- Sphere2 = geompy.MakeSphere(50, 70, 30, radius) #(4 Doubles)->GEOM_Object_ptr
- Cone = geompy.MakeCone(p0, vz, radius2, radius, height) #(2 GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr
- Cone1 = geompy.MakeConeR1R2H(radius1, radius, height) #(3 Doubles)->GEOM_Object_ptr
- Torus = geompy.MakeTorus(p0, vz, radius2, radius) #(2 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
- Torus1 = geompy.MakeTorusRR(radius2, radius1) #(2 Doubles)->GEOM_Object_ptr
+ 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
#Boolean (Common, Cut, Fuse, Section)
- Common = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object_ptr, Short)->GEOM_Object_ptr
+ Common = geompy.MakeBoolean(Box, Sphere, 1) #(2 GEOM_Object, Short)->GEOM_Object
Cut = geompy.MakeBoolean(Box, Sphere, 2)
Fuse = geompy.MakeBoolean(Box, Sphere, 3)
Section = geompy.MakeBoolean(Box, Sphere, 4)
#Create base objects
- Edge = geompy.MakeEdge(p0, pxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- Wire = geompy.MakeWire([vxy, Arc]) #(List Of GEOM_Object_ptr)->GEOM_Object_ptr
- Face = geompy.MakeFace(Wire, WantPlanarFace) #(GEOM_Object_ptr, Boolean)->GEOM_Object_ptr
+ Edge = geompy.MakeEdge(p0, pxyz) #(2 GEOM_Object)->GEOM_Object
+ Edge1 = geompy.MakeEdgeOnCurveByLength(Arc, 50, px) #(GEOM_Object, Double, GEOM_Object)->GEOM_Object
+ Wire = geompy.MakeWire([vxy, Arc]) #(List Of GEOM_Object)->GEOM_Object
+ Face = geompy.MakeFace(Wire, WantPlanarFace) #(GEOM_Object, Boolean)->GEOM_Object
Face1 = geompy.MakeFaceWires([Wire, Sketcher],
- WantPlanarFace) #(List of GEOM_Object_ptr, Boolean)->GEOM_Object_ptr
+ WantPlanarFace) #(List of GEOM_Object, Boolean)->GEOM_Object
Face2 = geompy.MakeFace(Sketcher, WantPlanarFace)
- Face3 = geompy.MakeFaceHW (100., 200., 1) #(2 Doubles, 1 Int)->GEOM_Object_ptr
- Face4 = geompy.MakeFaceObjHW (vz, 200., 100.) #(1 GEOM_Object_ptr, 2 Doubles)->GEOM_Object_ptr
- Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object_ptr, 1 Double)->GEOM_Object_ptr
- Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object_ptr
- Shell = geompy.MakeShell([Face, Face1]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
-
- Prism1 = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
+ Face3 = geompy.MakeFaceHW (100., 200., 1) #(2 Doubles, 1 Int)->GEOM_Object
+ Face4 = geompy.MakeFaceObjHW (vz, 200., 100.) #(1 GEOM_Object, 2 Doubles)->GEOM_Object
+ Disk = geompy.MakeDiskPntVecR (p0, vz, radius) #(2 GEOM_Object, 1 Double)->GEOM_Object
+ Disk2 = geompy.MakeDiskThreePnt(p0, p200, pz) #(3 GEOM_Object)->GEOM_Object
+ Disk3 = geompy.MakeDiskR(100., 1) #(1 Doubles, 1 Int)->GEOM_Object
+ Shell = geompy.MakeShell([Face, Face1]) #(List of GEOM_Object)->GEOM_Object
+
+ Prism1 = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object)->GEOM_Object
prism1_faces = geompy.SubShapeAllSortedCentres(Prism1, geompy.ShapeType["FACE"])
Shell1 = geompy.MakeShell([prism1_faces[0], prism1_faces[1],
prism1_faces[3], prism1_faces[4],
prism1_faces[5], prism1_faces[2]])
- Solid = geompy.MakeSolid([Shell1]) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
+ Solid = geompy.MakeSolid([Shell1]) #(List of GEOM_Object)->GEOM_Object
ShapeListCompound = []
i = 0
S = geompy.MakeTranslation(Arc, i * 100., i * 100., i * 100.)
ShapeListCompound.append(S)
i = i + 1
- Compound = geompy.MakeCompound(ShapeListCompound) #(List of GEOM_Object_ptr)->GEOM_Object_ptr
+ Compound = geompy.MakeCompound(ShapeListCompound) #(List of GEOM_Object)->GEOM_Object
#Test point on surface creation
- p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object_ptr, Double, Double)->GEOM_Object_ptr
- p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object_ptr, Double, Double, Double)->GEOM_Object_ptr
+ p_on_face = geompy.MakeVertexOnSurface(Face, 0.1, 0.8) #(GEOM_Object, Double, Double)->GEOM_Object
+ p_on_face2 = geompy.MakeVertexOnSurfaceByCoord(Face, 0., 0., 0.) #(GEOM_Object, Double, Double, Double)->GEOM_Object
# Test plane from existing face creation
- Plane2 = geompy.MakePlaneFace(Face, trimsize) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
+ Plane2 = geompy.MakePlaneFace(Face, trimsize) #(GEOM_Object, Double)->GEOM_Object
#ShapeList for Sewing
S = geompy.MakeRotation(Face, vxy, angle1)
#Test Line on Faces Intersection
- Line3 = geompy.MakeLineTwoFaces(prism1_faces[0], prism1_faces[1]) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
+ Line3 = geompy.MakeLineTwoFaces(prism1_faces[0], prism1_faces[1]) #(2 GEOM_Object)->GEOM_Object
#Create advanced objects
- Copy = geompy.MakeCopy(Box) #(GEOM_Object_ptr)->GEOM_Object_ptr
- Prism = geompy.MakePrismVecH(Face, vz, 100.0) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
- Prism2Ways = geompy.MakePrismVecH2Ways(Face, vz, 10.0) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
- PrismTwoPnt = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- PrismTwoPnt2Ways = geompy.MakePrism2Ways(Face2, p0, pxyz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- PrismDXDYDZ = geompy.MakePrismDXDYDZ(Face2, 10, 20, 100)#(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
- PrismDXDYDZ2Ways = geompy.MakePrismDXDYDZ2Ways(Face, 30, -20, 200)#(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
+ Copy = geompy.MakeCopy(Box) #(GEOM_Object)->GEOM_Object
+ Prism = geompy.MakePrismVecH(Face, vz, 100.0) #(2 GEOM_Object, Double)->GEOM_Object
+ Prism2Ways = geompy.MakePrismVecH2Ways(Face, vz, 10.0) #(2 GEOM_Object, Double)->GEOM_Object
+ PrismTwoPnt = geompy.MakePrism(Face2, p0, pxyz) #(3 GEOM_Object)->GEOM_Object
+ PrismTwoPnt2Ways = geompy.MakePrism2Ways(Face2, p0, pxyz) #(3 GEOM_Object)->GEOM_Object
+ PrismDXDYDZ = geompy.MakePrismDXDYDZ(Face2, 10, 20, 100)#(2 GEOM_Object, Double)->GEOM_Object
+ PrismDXDYDZ2Ways = geompy.MakePrismDXDYDZ2Ways(Face, 30, -20, 200)#(2 GEOM_Object, Double)->GEOM_Object
Revolution = geompy.MakeRevolution(Face, vz, angle2) #
Revolution2Ways = geompy.MakeRevolution(Face, vz, angle1) #
Filling = geompy.MakeFilling(Compound, mindeg, maxdeg,
- tol2d, tol3d, nbiter) #(GEOM_Object_ptr, 4 Doubles, Short)->GEOM_Object_ptr
- Pipe = geompy.MakePipe(Wire, Edge) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- Sewing = geompy.MakeSewing([Face, S], precision) #(List Of GEOM_Object_ptr, Double)->GEOM_Object_ptr
+ tol2d, tol3d, nbiter) #(GEOM_Object, 4 Doubles, Short)->GEOM_Object
+ Pipe = geompy.MakePipe(Wire, Edge) #(2 GEOM_Object)->GEOM_Object
+ Sewing = geompy.MakeSewing([Face, S], precision) #(List Of GEOM_Object, Double)->GEOM_Object
#Transform objects
- Translation = geompy.MakeTranslationTwoPoints(Box, px, pz) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- TranslVect = geompy.MakeTranslationVector(Box, vxyz) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- TranslVectD = geompy.MakeTranslationVectorDistance(Box, vxyz, 50.0) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
- Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
- RotatPnt = geompy.MakeRotationThreePoints(Box, px, py, pz) #(4 GEOM_Object_ptr)->GEOM_Object_ptr
+ Translation = geompy.MakeTranslationTwoPoints(Box, px, pz) #(3 GEOM_Object)->GEOM_Object
+ TranslVect = geompy.MakeTranslationVector(Box, vxyz) #(2 GEOM_Object)->GEOM_Object
+ TranslVectD = geompy.MakeTranslationVectorDistance(Box, vxyz, 50.0) #(2 GEOM_Object)->GEOM_Object
+ Rotation = geompy.MakeRotation(Box, vz, angle1) #(2 GEOM_Object, Double)->GEOM_Object
+ RotatPnt = geompy.MakeRotationThreePoints(Box, px, py, pz) #(4 GEOM_Object)->GEOM_Object
#Scale by factor relatively given point
- Scale1 = geompy.MakeScaleTransform(Box, pxyz, factor) #(2 GEOM_Object_ptr, Double)->GEOM_Object_ptr
+ Scale1 = geompy.MakeScaleTransform(Box, pxyz, factor) #(2 GEOM_Object, Double)->GEOM_Object
#Scale by factor relatively the origin of global CS
Scale2 = geompy.MakeScaleTransform(Box, None, factor) #
#Scale along axes of global CS by different factors. Scale relatively given point
- Scale3 = geompy.MakeScaleAlongAxes(Box, pxyz, 1.5, 0.5, 3) #(2 GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr
+ Scale3 = geompy.MakeScaleAlongAxes(Box, pxyz, 1.5, 0.5, 3) #(2 GEOM_Object, 3 Doubles)->GEOM_Object
#Scale along axes of global CS by different factors. Scale relatively the origin of global CS
Scale4 = geompy.MakeScaleAlongAxes(Box, None, 1.5, 0.5, 3) #
- Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
+ Mirror = geompy.MakeMirrorByPlane(Box, Plane) #(2 GEOM_Object)->GEOM_Object
MirrorAxis = geompy.MakeMirrorByAxis(Box, Line1) #
MirrorPnt = geompy.MakeMirrorByPoint(Box, p200) #
- Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object_ptr)->GEOM_Object_ptr
- Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object_ptr, 1 Double, 2 Bool)->GEOM_Object_ptr
- Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object_ptr, Double)->GEOM_Object_ptr
+ Position = geompy.MakePosition(Box, cs1, cs2) #(3 GEOM_Object)->GEOM_Object
+ Position2 = geompy.PositionAlongPath(Box, Arc, 0.5, 1, 0) #(2 GEOM_Object, 1 Double, 2 Bool)->GEOM_Object
+ Offset = geompy.MakeOffset(Box, 10.) #(GEOM_Object, Double)->GEOM_Object
Orientation = geompy.ChangeOrientation(Box)
#IDList for Fillet/Chamfer
IDlist_f = [f_ind_1, f_ind_2]
#Local operations
- Fillet2d = geompy.MakeFillet2D(Face3, radius, [4, 7, 9]) #(GEOM_Object_ptr, Double, ListOfLong)->GEOM_Object_ptr
+ Fillet2d = geompy.MakeFillet2D(Face3, radius, [4, 7, 9]) #(GEOM_Object, Double, ListOfLong)->GEOM_Object
Fillet = geompy.MakeFillet (Prism, radius, geompy.ShapeType["EDGE"],
- IDlist_e) #(GEOM_Object_ptr, Double, Short, ListOfLong)->GEOM_Object_ptr
+ IDlist_e) #(GEOM_Object, Double, Short, ListOfLong)->GEOM_Object
Fillet2 = geompy.MakeFilletR1R2 (Prism, 7., 13., geompy.ShapeType["EDGE"],
- IDlist_e) #(GEOM_Object_ptr, Double, Double, Short, ListOfLong)->GEOM_Object_ptr
+ IDlist_e) #(GEOM_Object, Double, Double, Short, ListOfLong)->GEOM_Object
Chamfer = geompy.MakeChamferEdge(Prism, d1, d2,
- f_ind_1, f_ind_2) #(GEOM_Object_ptr, 2 Doubles, 2 Long)->GEOM_Object_ptr
+ f_ind_1, f_ind_2) #(GEOM_Object, 2 Doubles, 2 Long)->GEOM_Object
Chamfer2 = geompy.MakeChamferFaces(Prism, d1, d2,
- IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
+ IDlist_f) #(GEOM_Object, 2 Doubles, ListOfLong)->GEOM_Object
Chamfer3 = geompy.MakeChamferEdges(Prism, d1, d2,
- IDlist_e) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
+ IDlist_e) #(GEOM_Object, 2 Doubles, ListOfLong)->GEOM_Object
Chamfer4 = geompy.MakeChamferFacesAD(Prism, d1, 20. * math.pi / 180.,
- IDlist_f) #(GEOM_Object_ptr, 2 Doubles, ListOfLong)->GEOM_Object_ptr
+ IDlist_f) #(GEOM_Object, 2 Doubles, ListOfLong)->GEOM_Object
#End of Local operations
#Create Patterns
MultiRot2D = geompy.MultiRotate2D(Chamfer, vx, angle, nbtimes1, step1, nbtimes2)
#Create Informations objects
- CDG = geompy.MakeCDG(Prism) #(GEOM_Object_ptr)->GEOM_Object_ptr
+ CDG = geompy.MakeCDG(Prism) #(GEOM_Object)->GEOM_Object
Archimede = geompy.Archimede(Box, weight, waterdensity,
- meshingdeflection) #(GEOM_Object_ptr, 3 Doubles)->GEOM_Object_ptr
- mindist = geompy.MinDistanceComponents(TranslVect, Mirror) #(2 GEOM_Object_ptr)->4 Doubles
+ meshingdeflection) #(GEOM_Object, 3 Doubles)->GEOM_Object
+ mindist = geompy.MinDistanceComponents(TranslVect, Mirror) #(2 GEOM_Object)->4 Doubles
print "Minumal distance between TranslVect and Mirror is", mindist[0],
print "by components:", mindist[1], ",", mindist[2], ",", mindist[3]
- CheckShape = geompy.CheckShape(Prism) #(GEOM_Object_ptr)->Boolean
+ CheckShape = geompy.CheckShape(Prism) #(GEOM_Object)->Boolean
print "CheckShape(Prism) = ", CheckShape
#Partition objects
- Partition = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object_ptr)->GEOM_Object_ptr
- Partition1 = geompy.MakeHalfPartition(Box, Plane) #(2 GEOM_Object_ptr)->GEOM_Object_ptr
+ Partition = geompy.MakePartition([Box], [Plane]) #(2 Lists Of GEOM_Object)->GEOM_Object
+ Partition1 = geompy.MakeHalfPartition(Box, Plane) #(2 GEOM_Object)->GEOM_Object
#Add In Study
id_p0 = geompy.addToStudy(p0, "Vertex 0")
id_Sketcher3d = geompy.addToStudy(Sketcher3d, "Sketcher 3D")
id_p_on_arc = geompy.addToStudy(p_on_arc, "Vertex on Arc (0.25)")
- id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc at(100, -10, 10)" )
+ id_p_on_arc2 = geompy.addToStudy(p_on_arc2, "Vertex on Arc at(100, -10, 10)" )
+ id_p_on_arc3 = geompy.addToStudy(p_on_arc3, "Vertex on Arc length 50 from Vertex X" )
id_p_on_l1l2 = geompy.addToStudy(p_on_l1l2, "Vertex on Lines Intersection")
id_Section = geompy.addToStudy(Section, "Section")
id_Edge = geompy.addToStudy(Edge, "Edge")
+ id_Edge1 = geompy.addToStudy(Edge1, "Edge on Arc length 50 from Vertex Y")
id_Wire = geompy.addToStudy(Wire, "Wire")
id_Face = geompy.addToStudy(Face, "Face")
id_Face1 = geompy.addToStudy(Face1, "Face from two wires")
## Create a point, corresponding to the given length on the given curve.
# @param theRefCurve The referenced curve.
- # @param theLength Length on the referenced curve.
- # @param theReverse Flag allowing to choose the direction for the calculation of the length (False = forward or True = reversed).
+ # @param theLength Length on the referenced curve. It can be negative.
+ # @param theStartPoint Point allowing to choose the direction for the calculation
+ # of the length. If None, start from the first point of theRefCurve.
# @return New GEOM_Object, containing the created point.
#
# @ref tui_creation_point "Example"
- def MakeVertexOnCurveByLength(self,theRefCurve, theLength, theReverse = False):
+ def MakeVertexOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
# Example: see GEOM_TestAll.py
theLength, Parameters = ParseParameters(theLength)
- anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theReverse)
+ anObj = self.BasicOp.MakePointOnCurveByLength(theRefCurve, theLength, theStartPoint)
RaiseIfFailed("MakePointOnCurveByLength", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
RaiseIfFailed("MakeEdge", self.ShapesOp)
return anObj
+ ## Create a new edge, corresponding to the given length on the given curve.
+ # @param theRefCurve The referenced curve (edge).
+ # @param theLength Length on the referenced curve. It can be negative.
+ # @param theStartPoint Any point can be selected for it, the new edge will begin
+ # at the end of \a theRefCurve, close to the selected point.
+ # If None, start from the first point of \a theRefCurve.
+ # @return New GEOM_Object, containing the created edge.
+ #
+ # @ref tui_creation_edge "Example"
+ def MakeEdgeOnCurveByLength(self, theRefCurve, theLength, theStartPoint = None):
+ # Example: see GEOM_TestAll.py
+ theLength, Parameters = ParseParameters(theLength)
+ anObj = self.ShapesOp.MakeEdgeOnCurveByLength(theRefCurve, theLength, theStartPoint)
+ RaiseIfFailed("MakeEdgeOnCurveByLength", self.BasicOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
## Create an edge from specified wire.
# @param theWire source Wire.
# @param theLinearTolerance linear tolerance value.