<li>\subpage create_curve_page</li>
<li>\subpage create_vector_page</li>
<li>\subpage create_plane_page</li>
-<li>\subpage create_wplane_page</li>
<li>\subpage create_lcs_page</li>
</ul>
\image html plane2.png
-\n Finally, you can define a \b Plane by another \b Plane or <b>Local
-Coordinate System</b> and a <b>Size of the Plane</b>. To change selection type cilck the corresponding
-radio button "Face" or "Local Coordinate System".
+\n Also, you can define a \b Plane by another \b Plane or <b>Face</b> and a <b>Size of the Plane</b>.
\n <b>TUI Command:</b> <em>geompy.MakePlaneFace(Face, TrimSize)</em>
-\n <b>Arguments:</b> Name + 1 face + 1 value (to define the size of
-the plane).
+\n <b>Arguments:</b> Name + 1 face + 1 value (to define the size of the plane).
\image html plane3.png
+\n Also, you can define a \b Plane by two Vectors. The first vector defines the center point and the direction,
+the second vector defines the normal to the Plane.
+\n <b>TUI Command:</b> <em>geompy.MakePlane2Vec(Vec1, Vec2, TrimSize)</em>
+\n <b>Arguments:</b> Name + 2 vectors + 1 value (to define the size of the plane).
+
+\image html plane4.png
+
+\n Finally, you can define a \b Plane by the Local Coordinate System and the orientation (OXY, OYZ, OZX).
+\n <b>TUI Command:</b> <em>geompy.MakePlaneLCS(LCS, TrimSize, [1, 2, or 3])</em>
+\n <b>Arguments:</b> Name + LCS + 1 value (to define the size of the plane) + 1 value (to define the orientation)
+
+\image html plane5.png
+
<b>Examples:</b>
\image html planes1.png
angle and radius of an arc.
\n Sketcher is able to create planar curves only. Therefore, it is
-necessary to select a working plane before starting a sketch (by
-default, XOY plane is used). Sketcher creates curves lying in the
-current working plane (New Entity -> Basic -> Working Plane).
+necessary to select coordinate system (Global or Local) before starting
+a sketch. Sketcher creates curves lying in the XOY plane of the selected Coordinate System.
\n This functionality is available from the main menu via <em>New
Entity / Sketch</em>.
the resulting wire or face will be arcs of circles and/or linear
segments.
\n \em Command is a string, defining the sketcher by the coordinates of
-points in the local working plane.
-\n <em>WorkingPlane</em> can be a plane or a planar face. The plane is
+points in the current LCS.
+\n <em>WorkingPlane</em> can be a Local CS, a plane, or a planar face. The plane is
defined by the XYZ coordinates of three non-coincident points. The
planar face is an existing GEOM_Object.
\n <b>Arguments:</b>
<ol>
+<li>Coordinate system (Local or Global CS can be selected)</li>
<li>Element type (segment or arc).</li>
<li>Destination type (point or direction).</li>
<li>Destination point by means of:</li>
+++ /dev/null
-/*!
-
-\page create_wplane_page Working Plane
-
-Definition of a <b>Working Plane</b> is necessary for work with
-\ref create_sketcher_page "Sketcher".
-
-\n To create a <b>Working Plane</b> in the <b>Main Menu</b> select
-<b>New Entity - > Basic - > Working Plane</b>
-
-\n There is a number of algorithms to set the <b>Working Plane</b> and the
-Camera Position.
-
-\n Firstly, you can select a \b Plane, a <b>Planar Face</b> or a <b>Local Coordinate System</b> to be your <b>Working Plane</b>.
-\n <b>Arguments:</b> Name + 1 selection (plane or planar face).
-
-\image html workplane4.png
-
-\n Secondly, you can define a <b>Working Plane</b> by two <b>Vectors</b>.
-\n <b>Arguments:</b> Name + 2 vectors.
-
-\image html workplane5.png
-
-\n Finally, you can select one of three basic projections of XYZ
-coordinate system to be your <b>Working Plane</b>.
-
-\image html workplane6.png
-
-<b>Reverse the plane normal</b> checkbox allows changing the direction
-of the working plane.
-
-<b>Example:</b> Working plane on the upper face of a box.
-
-\image html image36.gif
-<center>Normal Direction</center>
-
-\image html image47.gif
-<center>Reversed Direction</center>
-
-*/
p4 = geompy.MakeVertex(100., 100., 0.)
p5 = geompy.MakeVertex(0. , 100., 0.)
-# create a vector from the given components
-vector = geompy.MakeVectorDXDYDZ(100., 100., 100.)
+# create a vectors from the given components
+vector1 = geompy.MakeVectorDXDYDZ(100., 100., 100.)
+vector2 = geompy.MakeVectorDXDYDZ(-100., 0., 100.)
# create a vector from two points
vector_arc = geompy.MakeVector(p2, p5)
face = geompy.MakeFace(wire, isPlanarWanted)
trimsize = 1000.
+# create a Local Coordinate System
+
+LCS = geompy.MakeMarker(100., 100., 101., 1, 0, 0, 0, 1, 0)
+
# create a plane from a point, a vector and a trimsize
-plane1 = geompy.MakePlane(p1, vector, trimsize)
+plane1 = geompy.MakePlane(p1, vector1, trimsize)
# create a plane from three points and a trimsize
plane2 = geompy.MakePlaneThreePnt(p1, p2, p3, trimsize)
# create a plane from the given face
plane3 = geompy.MakePlaneFace(face, trimsize)
+# create a plane from two vectors and a trimsize
+plane4 = geompy.MakePlane2Vec(vector1, vector2, trimsize)
+
+# create a plane with the Local Coordinate System and a trimsize
+plane5 = geompy.MakePlaneLCS(LCS, trimsize, 1)
+
# add objects in the study
id_face = geompy.addToStudy(face, "Face")
id_plane1 = geompy.addToStudy(plane1,"Plane1")
id_plane2 = geompy.addToStudy(plane2,"Plane2")
id_plane3 = geompy.addToStudy(plane3,"Plane3")
+id_plane4 = geompy.addToStudy(plane4,"Plane4")
+id_plane5 = geompy.addToStudy(plane5,"Plane5")
# display the points and the vectors
gg.createAndDisplayGO(id_face)
gg.createAndDisplayGO(id_plane1)
gg.createAndDisplayGO(id_plane2)
gg.createAndDisplayGO(id_plane3)
+gg.createAndDisplayGO(id_plane4)
+gg.createAndDisplayGO(id_plane5)
gg.setDisplayMode(id_plane1,1)
gg.setTransparency(id_plane1,0.5)
gg.setDisplayMode(id_plane2,1)
gg.setTransparency(id_plane2,0.5)
gg.setDisplayMode(id_plane3,1)
-gg.setTransparency(id_plane3,0.5)
+gg.setTransparency(id_plane3,0.5)
+gg.setDisplayMode(id_plane4,1)
+gg.setTransparency(id_plane4,0.5)
+gg.setDisplayMode(id_plane5,1)
+gg.setTransparency(id_plane5,0.5)
\endcode
*/
*/
GEOM_Object MakePlaneFace (in GEOM_Object theFace,
in double theTrimSize);
+
+ /*!
+ * Create a plane, by two vectors.
+ * \param theVec1 Vector1, the plane has to pass through first point of this vector.
+ * \param theVec Vector2, defining the plane normal direction.
+ * \param theTrimSize Half size of a side of quadrangle face, representing the plane.
+ * \return New GEOM_Object, containing the created plane.
+ */
+ GEOM_Object MakePlane2Vec (in GEOM_Object theVec1,
+ in GEOM_Object theVec2,
+ in double theTrimSize);
+
+ /*!
+ * Create a plane, defined by local coordinate system.
+ * \param theLCS Referenced LCS(Marker).
+ * \param theTrimSize Half size of a side of quadrangle face, representing the plane.
+ * \param theOrientation OXY, OYZ or OZX orientation = (1, 2 or 3).
+ * \return New GEOM_Object, containing the created plane.
+ */
+ GEOM_Object MakePlaneLCS (in GEOM_Object theLCS,
+ in double theTrimSize,
+ in double theOrientation);
/*!
* Create a local coordinate system.
in double theTrimSize) ;
GEOM_Object MakePlaneFace (in GEOM_Object theFace,
in double theTrimSize) ;
+ GEOM_Object MakePlane2Vec (in GEOM_Object theVec1,
+ in GEOM_Object theVec2,
+ in double theTrimSize) ;
+ GEOM_Object MakePlaneLCS (in GEOM_Object theLCS,
+ in double theTrimSize,
+ in double theOrientation) ;
GEOM_Object MakeMarker (in double theOX , in double theOY , in double theOZ,
in double theXDX, in double theXDY, in double theXDZ,
in double theYDX, in double theYDY, in double theYDZ) ;
case 4017: // PLANE
aDlg = new BasicGUI_PlaneDlg( getGeometryGUI(), parent );
break;
- case 4018: // WORKING PLANE
+/* case 4018: // WORKING PLANE
aDlg = new BasicGUI_WorkingPlaneDlg( getGeometryGUI(), parent );
- break;
+ break;*/ // DEPRECATED!
case 4019: // CURVE
aDlg = new BasicGUI_CurveDlg( getGeometryGUI(), parent );
break;
QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_3PNTS" ) ) );
QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_PLANE_FACE" ) ) );
QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
+ QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_VECTOR" ) ) );
+ QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_WPLANE_ORIGIN" ) ) );
setWindowTitle( tr( "GEOM_PLANE_TITLE" ) );
mainFrame()->RadioButton1->setIcon( image0 );
mainFrame()->RadioButton2->setIcon( image1 );
mainFrame()->RadioButton3->setIcon( image2 );
+ mainFrame()->RadioButton4->show();
+ mainFrame()->RadioButton4->setIcon( image4 );
+ mainFrame()->RadioButton5->show();
+ mainFrame()->RadioButton5->setIcon( image5 );
GroupPntDir = new DlgRef_2Sel1Spin( centralWidget() );
GroupPntDir->GroupBox1->setTitle( tr( "GEOM_PLANE_PV" ) );
Group3Pnts->LineEdit2->setEnabled( false );
Group3Pnts->LineEdit3->setEnabled( false );
- GroupFace = new DlgRef_3Radio1Sel1Spin( centralWidget() );
- GroupFace->RadioButton1->setText(tr("GEOM_FACE"));
- GroupFace->RadioButton2->setText(tr("GEOM_LCS"));
- GroupFace->RadioButton3->setAttribute( Qt::WA_DeleteOnClose );
- GroupFace->RadioButton3->close();
- GroupFace->GroupBox1->setTitle( tr( "GEOM_FACE_OR_LCS" ) );
+ GroupFace = new DlgRef_1Sel1Spin( centralWidget() );
+ GroupFace->GroupBox1->setTitle( tr( "GEOM_FACE" ) );
GroupFace->TextLabel1->setText( tr( "GEOM_SELECTION" ) );
GroupFace->TextLabel2->setText( tr( "GEOM_PLANE_SIZE" ) );
GroupFace->PushButton1->setIcon( image3 );
GroupFace->LineEdit1->setReadOnly( true );
+ Group2Vec = new DlgRef_2Sel1Spin( centralWidget() );
+
+ Group2Vec->GroupBox1->setTitle( tr( "GEOM_WPLANE_VECTOR" ) );
+ Group2Vec->TextLabel1->setText( tr( "GEOM_WPLANE_VX" ) );
+ Group2Vec->TextLabel2->setText( tr( "GEOM_WPLANE_VZ" ) );
+ Group2Vec->PushButton1->setIcon( image3 );
+ Group2Vec->PushButton2->setIcon( image3 );
+ Group2Vec->LineEdit1->setReadOnly( true );
+ Group2Vec->LineEdit2->setReadOnly( true );
+ Group2Vec->PushButton1->setDown( true );
+ Group2Vec->LineEdit1->setEnabled( true );
+ Group2Vec->LineEdit2->setEnabled( false );
+ Group2Vec->TextLabel3->setText( tr( "GEOM_PLANE_SIZE" ) );
+
+ GroupLCS = new DlgRef_3Radio1Sel1Spin( centralWidget() );
+ GroupLCS->GroupBox1->setTitle( tr( "GEOM_LCS" ) );
+ GroupLCS->TextLabel1->setText( tr( "GEOM_SELECTION" ) );
+ GroupLCS->TextLabel2->setText( tr( "GEOM_PLANE_SIZE" ) );
+ GroupLCS->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) );
+ GroupLCS->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) );
+ GroupLCS->RadioButton3->setText( tr( "GEOM_WPLANE_OZX" ) );
+ GroupLCS->PushButton1->setIcon( image3 );
+ GroupLCS->PushButton1->setDown( true );
+
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
layout->setMargin( 0 ); layout->setSpacing( 6 );
layout->addWidget( GroupPntDir );
layout->addWidget( Group3Pnts );
layout->addWidget( GroupFace );
+ layout->addWidget( Group2Vec );
+ layout->addWidget( GroupLCS );
/***************************************************************/
setHelpFileName( "create_plane_page.html" );
{
/* init variables */
myEditCurrentArgument = GroupPntDir->LineEdit1;
- GroupFace->RadioButton1->setChecked(true);
myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
// myGeomGUI->SetState( 0 );
+ myOriginType = 1;
/* Get setting of step value from file configuration */
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
Group3Pnts->SpinBox_DX->setValue( aTrimSize );
initSpinBox( GroupFace->SpinBox_DX, 0.000001, COORD_MAX, aStep, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
GroupFace->SpinBox_DX->setValue( aTrimSize );
+ initSpinBox( Group2Vec->SpinBox_DX, 0.000001, COORD_MAX, aStep, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+ Group2Vec->SpinBox_DX->setValue( aTrimSize );
+ initSpinBox( GroupLCS->SpinBox_DX, 0.000001, COORD_MAX, aStep, 6 ); // VSR: TODO: DBL_DIGITS_DISPLAY
+ GroupLCS->SpinBox_DX->setValue( aTrimSize );
/* signals and slots connections */
connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
connect( GroupFace->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( Group2Vec->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+ connect( Group2Vec->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+
+ connect( GroupLCS->RadioButton1, SIGNAL( clicked() ), this, SLOT( GroupClicked() ) );
+ connect( GroupLCS->RadioButton2, SIGNAL( clicked() ), this, SLOT( GroupClicked() ) );
+ connect( GroupLCS->RadioButton3, SIGNAL( clicked() ), this, SLOT( GroupClicked() ) );
connect( GroupPntDir->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPntDir->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupFace->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
- connect( GroupFace->RadioButton1,SIGNAL( clicked() ), this, SLOT( SelectionTypeClicked() ) );
- connect( GroupFace->RadioButton2,SIGNAL( clicked() ), this, SLOT( SelectionTypeClicked() ) );
+ connect( Group2Vec->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+ connect( Group2Vec->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
connect( GroupPntDir->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( Group3Pnts->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( GroupFace->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( Group2Vec->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( GroupLCS->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
GroupPntDir->SpinBox_DX->setSingleStep(step);
Group3Pnts->SpinBox_DX->setSingleStep(step);
GroupFace->SpinBox_DX->setSingleStep(step);
+ Group2Vec->SpinBox_DX->setSingleStep(step);
+ GroupLCS->SpinBox_DX->setSingleStep(step);
}
-//=================================================================================
-// function : SelectionTypeClicked()
-// purpose : Selection type radio buttons managment
-//=================================================================================
-void BasicGUI_PlaneDlg::SelectionTypeClicked()
-{
- myFace = GEOM::GEOM_Object::_nil();
- if ( GroupFace->RadioButton1->isChecked()) {
- globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
- } else if ( GroupFace->RadioButton2->isChecked()) {
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_PLANE );
- aMap.Add( GEOM_MARKER );
- globalSelection( aMap );
- }
- displayPreview();
-}
-
-
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
Group3Pnts->hide();
GroupFace->hide();
GroupPntDir->show();
+ Group2Vec->hide();
+ GroupLCS->hide();
myEditCurrentArgument = GroupPntDir->LineEdit1;
GroupPntDir->LineEdit1->setText( "" );
GroupPntDir->hide();
GroupFace->hide();
Group3Pnts->show();
+ Group2Vec->hide();
+ GroupLCS->hide();
myEditCurrentArgument = Group3Pnts->LineEdit1;
Group3Pnts->LineEdit1->setText( "" );
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
break;
}
- case 2: /* plane from a planar face or LSC selection */
+ case 2: /* plane from a planar face */
{
GroupPntDir->hide();
Group3Pnts->hide();
GroupFace->show();
+ Group2Vec->hide();
+ GroupLCS->hide();
myEditCurrentArgument = GroupFace->LineEdit1;
GroupFace->LineEdit1->setText( "" );
GroupFace->PushButton1->setDown( true );
- if ( GroupFace->RadioButton1->isChecked()) {
- globalSelection(); // close local contexts, if any
- localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
- } else if ( GroupFace->RadioButton2->isChecked()) {
- TColStd_MapOfInteger aMap;
- aMap.Add( GEOM_PLANE );
- aMap.Add( GEOM_MARKER );
- globalSelection( aMap );
- }
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+ break;
+ }
+ case 3: /* plane from a 2 Vectors */
+ {
+ GroupPntDir->hide();
+ Group3Pnts->hide();
+ GroupFace->hide();
+ Group2Vec->show();
+ GroupLCS->hide();
+
+ myEditCurrentArgument = Group2Vec->LineEdit1;
+ Group2Vec->LineEdit1->setText( "" );
+ Group2Vec->PushButton1->setDown( true );
+
+ globalSelection(); // close local contexts, if any
+ localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+ break;
+ }
+ case 4: /* plane from a LCS */
+ {
+ GroupPntDir->hide();
+ Group3Pnts->hide();
+ GroupFace->hide();
+ Group2Vec->hide();
+ GroupLCS->show();
+
+ myEditCurrentArgument = GroupLCS->LineEdit1;
+ GroupLCS->LineEdit1->setText( "" );
+ GroupLCS->PushButton1->setDown( true );
+ GroupLCS->RadioButton1->setChecked( true );
+ myOriginType = 1;
+
+ globalSelection(GEOM_MARKER);
break;
}
}
myEditCurrentArgument->setFocus();
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
this, SLOT( SelectionIntoArgument() ) );
+ displayPreview();
}
return true;
}
+//=================================================================================
+// function : GroupClicked()
+// purpose : OX OY OZ Radio button management
+//=================================================================================
+void BasicGUI_PlaneDlg::GroupClicked()
+{
+ QRadioButton* send = (QRadioButton*)sender();
+
+ if ( send == GroupLCS->RadioButton1 )
+ myOriginType = 1;
+ else if ( send == GroupLCS->RadioButton2 )
+ myOriginType = 2;
+ else if ( send == GroupLCS->RadioButton3 )
+ myOriginType = 3;
+ displayPreview();
+}
+
//=================================================================================
// function : SelectionIntoArgument()
// purpose : Called when selection has changed
else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) myPoint2 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) myPoint3 = GEOM::GEOM_Object::_nil();
else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) myFace = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == Group2Vec->LineEdit1 ) myVec1 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == Group2Vec->LineEdit2 ) myVec2 = GEOM::GEOM_Object::_nil();
+ else if ( myEditCurrentArgument == GroupLCS->LineEdit1 ) myLCS = GEOM::GEOM_Object::_nil();
+ displayPreview();
return;
}
if ( !CORBA::is_nil( aSelectedObject ) && aRes ) {
QString aName = GEOMBase::GetName( aSelectedObject );
TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
- if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
+ if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2)
aNeedType = TopAbs_EDGE;
else if ( myEditCurrentArgument == GroupFace->LineEdit1 )
aNeedType = TopAbs_FACE;
+ else if ( myEditCurrentArgument == GroupLCS->LineEdit1 )
+ aNeedType = TopAbs_FACE;
TopoDS_Shape aShape;
if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
}
else if ( myEditCurrentArgument == GroupFace->LineEdit1 )
myFace = aSelectedObject;
+ else if ( myEditCurrentArgument == Group2Vec->LineEdit1 ) {
+ myVec1 = aSelectedObject;
+ if ( !myVec1->_is_nil() && myVec2->_is_nil() )
+ Group2Vec->PushButton2->click();
+ } else if ( myEditCurrentArgument == Group2Vec->LineEdit2 ) {
+ myVec2 = aSelectedObject;
+ if ( !myVec2->_is_nil() && myVec1->_is_nil() )
+ Group2Vec->PushButton1->click();
+ } else if ( myEditCurrentArgument == GroupLCS->LineEdit1 )
+ myLCS = aSelectedObject;
+
}
displayPreview();
else if ( send == GroupFace->PushButton1 ) {
myEditCurrentArgument = GroupFace->LineEdit1;
GroupFace->PushButton1->setDown( true );
+ } else if ( send == Group2Vec->PushButton1 ) {
+ myEditCurrentArgument = Group2Vec->LineEdit1;
+ Group2Vec->PushButton2->setDown( false );
+ Group2Vec->LineEdit1->setEnabled( true );
+ Group2Vec->LineEdit2->setEnabled( false );
+ } else if ( send == Group2Vec->PushButton2 ) {
+ myEditCurrentArgument = Group2Vec->LineEdit2;
+ Group2Vec->PushButton1->setDown( false );
+ Group2Vec->LineEdit1->setEnabled( false );
+ Group2Vec->LineEdit2->setEnabled( true );
+ } else if ( send == GroupLCS->PushButton1 ) {
+ myEditCurrentArgument = GroupLCS->LineEdit1;
+ GroupLCS->LineEdit1->setEnabled( true );
}
myEditCurrentArgument->setFocus();
- if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
+ if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ||
+ myEditCurrentArgument == Group2Vec->LineEdit1 ||
+ myEditCurrentArgument == Group2Vec->LineEdit2 ) {
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
- }
- else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
+ } else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
TColStd_MapOfInteger aMap;
aMap.Add( GEOM_PLANE );
aMap.Add( GEOM_MARKER );
globalSelection( aMap );
+ } else if ( myEditCurrentArgument == GroupLCS->LineEdit1 ) {
+ globalSelection( GEOM_MARKER );
}
else { // 3 Pnts
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
send == Group3Pnts->LineEdit1 ||
send == Group3Pnts->LineEdit2 ||
send == Group3Pnts->LineEdit3 ||
- send == GroupFace->LineEdit1 ) {
+ send == GroupFace->LineEdit1 ||
+ send == Group2Vec->LineEdit1 ||
+ send == Group2Vec->LineEdit2 ||
+ send == GroupLCS->LineEdit1 ) {
myEditCurrentArgument = send;
GEOMBase_Skeleton::LineEditReturnPressed();
}
this, SLOT( SelectionIntoArgument() ) );
ConstructorsClicked( getConstructorId() );
+ SelectionIntoArgument();
}
//=================================================================================
case 0 : return GroupPntDir->SpinBox_DX->value();
case 1 : return Group3Pnts->SpinBox_DX->value();
case 2 : return GroupFace->SpinBox_DX->value();
+ case 3 : return Group2Vec->SpinBox_DX->value();
+ case 4 : return GroupLCS->SpinBox_DX->value();
}
return 0.;
}
case 0 : return GroupPntDir->SpinBox_DX->text();
case 1 : return Group3Pnts->SpinBox_DX->text();
case 2 : return GroupFace->SpinBox_DX->text();
+ case 3 : return Group2Vec->SpinBox_DX->text();
}
return QString();
}
else if ( id == 2 ) {
bool ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() );
return !CORBA::is_nil( myFace ) && ok;
+ } else if ( id == 3 ) {
+ bool ok = Group2Vec->SpinBox_DX->isValid( msg, !IsPreview() );
+ return !CORBA::is_nil( myVec1 ) && !CORBA::is_nil( myVec2 ) && !isEqual( myVec1, myVec2 ) && ok;
+ } else if ( id == 4 ) {
+ bool ok = GroupLCS->SpinBox_DX->isValid( msg, !IsPreview() );
+ return ok;
}
return false;
}
anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneFace( myFace, getSize() );
res = true;
break;
+ case 3 :
+ anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlane2Vec( myVec1, myVec2, getSize() );
+ res = true;
+ break;
+ case 4 :
+ anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->MakePlaneLCS( myLCS, getSize(), myOriginType );
+ res = true;
+ break;
}
if ( !anObj->_is_nil() ) {
case 2:
objMap[GroupFace->LineEdit1->text()] = myFace;
break;
+ case 3:
+ objMap[Group2Vec->LineEdit1->text()] = myVec1;
+ objMap[Group2Vec->LineEdit2->text()] = myVec2;
+ break;
}
addSubshapesToFather( objMap );
}
void enterEvent( QEvent* );
double getSize() const;
QString getSizeAsString() const;
+ int myOriginType;
private:
- GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace;
+ GEOM::GEOM_Object_var myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace, myVec1, myVec2, myLCS;
DlgRef_2Sel1Spin* GroupPntDir;
DlgRef_3Sel1Spin* Group3Pnts;
- DlgRef_3Radio1Sel1Spin* GroupFace;
+ DlgRef_1Sel1Spin* GroupFace;
+ DlgRef_2Sel1Spin* Group2Vec;
+ DlgRef_3Radio1Sel1Spin* GroupLCS;
private slots:
void ClickOnOk();
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
void SelectionTypeClicked();
+ void GroupClicked();
};
#endif // BASICGUI_PLANEDLG_H
<string/>
</property>
<layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" colspan="3" >
+ <item row="3" column="0" colspan="4" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QRadioButton" name="RadioButton1" >
</item>
</layout>
</item>
- <item row="1" column="0" >
- <widget class="QLabel" name="TextLabel1" >
+ <item row="5" column="0" >
+ <widget class="QLabel" name="TextLabel2" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
</sizepolicy>
</property>
<property name="text" >
- <string>TL1</string>
+ <string>TL2</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="PushButton1" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
+ <item row="5" column="1" colspan="3" >
+ <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
+ </item>
+ <item row="6" column="3" >
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
</property>
- <property name="text" >
- <string/>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>256</width>
+ <height>19</height>
+ </size>
</property>
- </widget>
+ </spacer>
</item>
- <item row="1" column="2" >
+ <item row="1" column="3" >
<widget class="QLineEdit" name="LineEdit1" />
</item>
- <item row="2" column="0" >
- <widget class="QLabel" name="TextLabel2" >
+ <item row="1" column="0" >
+ <widget class="QLabel" name="TextLabel1" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
</sizepolicy>
</property>
<property name="text" >
- <string>TL2</string>
+ <string>TL1</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
- <item row="2" column="1" colspan="2" >
- <widget class="SalomeApp_DoubleSpinBox" name="SpinBox_DX" />
- </item>
- <item row="3" column="2" >
- <spacer name="verticalSpacer" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
+ <item row="1" column="1" >
+ <widget class="QPushButton" name="PushButton1" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>256</width>
- <height>19</height>
- </size>
+ <property name="text" >
+ <string/>
</property>
- </spacer>
+ </widget>
</item>
</layout>
+ <zorder>TextLabel2</zorder>
+ <zorder>SpinBox_DX</zorder>
+ <zorder>RadioButton1</zorder>
+ <zorder>RadioButton2</zorder>
+ <zorder>RadioButton3</zorder>
+ <zorder>LineEdit1</zorder>
+ <zorder>TextLabel1</zorder>
+ <zorder>PushButton1</zorder>
</widget>
</item>
</layout>
</customwidget>
</customwidgets>
<tabstops>
- <tabstop>PushButton1</tabstop>
- <tabstop>LineEdit1</tabstop>
<tabstop>SpinBox_DX</tabstop>
</tabstops>
<resources/>
#include <GEOMBase.h>
#include <GeometryGUI.h>
#include <GEOMImpl_Types.hxx>
+#include <Geom_Surface.hxx>
+#include <Geom_Plane.hxx>
#include <SUIT_Desktop.h>
#include <SUIT_Session.h>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <Sketcher_Profile.hxx>
+#include <SalomeApp_Study.h>
+
+#include <gp_Pln.hxx>
+
//=================================================================================
// class : EntityGUI_SketcherDlg()
// purpose : Constructs a EntityGUI_SketcherDlg which is a child of 'parent', with the
MainWidget = new EntityGUI_Skeleton( this );
QVBoxLayout* topLayout = new QVBoxLayout( this );
topLayout->setMargin( 9 ); topLayout->setSpacing( 6 );
- topLayout->addWidget( MainWidget );
MainWidget->buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) );
MainWidget->buttonEnd->setText( tr( "GEOM_BUT_END_SKETCH" ) );
MainWidget->RB_Dest2->setText( tr( "GEOM_SKETCHER_DIR" ) );
/***************************************************************/
+
+ GroupBox1 = new QGroupBox(tr("GEOM_CS"), this);
+ QGridLayout* OwnLayout = new QGridLayout(GroupBox1);
+ OwnLayout->setSpacing(6);
+ OwnLayout->setMargin(11);
+
+ ComboBox1 = new QComboBox(GroupBox1);
+ OwnLayout->addWidget(ComboBox1);
+
+ topLayout->addWidget(GroupBox1);
+ topLayout->addWidget( MainWidget );
+
GroupPt = new EntityGUI_Point( MainWidget->DestCnt );
GroupPt->GroupPoint->setTitle( tr( "GEOM_SKETCHER_POINT" ) );
connect( Group4Spin->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
connect( Group4Spin->SpinBox_DS, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+ connect( ComboBox1, SIGNAL( activated( int ) ), this, SLOT( SelectionIntoArgument() ) );
+
connect( myGeometryGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
connect( myGeometryGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
resize(100,100);
TypeClicked( 0 );
+ FindLocalCS();
+
GEOMBase_Helper::displayPreview( false, true, true, myLineWidth );
}
TopoDS_Shape aShape;
if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_VERTEX)) {
gp_Trsf aTrans;
- gp_Ax3 aWPlane = myGeometryGUI->GetWorkingPlane();
+ gp_Ax3 aWPlane = GetActiveLocalCS();
aTrans.SetTransformation(aWPlane);
BRepBuilderAPI_Transform aTransformation (aShape, aTrans, Standard_False);
}
}
- gp_Ax3 myWPlane = myGeometryGUI->GetWorkingPlane();
+ gp_Ax3 myWPlane = GetActiveLocalCS();
GEOM::ListOfDouble_var WPlane = new GEOM::ListOfDouble;
WPlane->length( 9 );
WPlane[0] = myWPlane.Location().X();
Group4Spin->SpinBox_DZ->setSingleStep(step);
Group4Spin->SpinBox_DS->setSingleStep(step);
}
+
+//=================================================================================
+// function : FindLocalCS()
+// purpose : Find All Coordinates systems in study
+//=================================================================================
+void EntityGUI_SketcherDlg::FindLocalCS()
+{
+ ComboBox1->clear();
+ myLCSList.clear();
+ SalomeApp_Application* app =
+ dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+ if ( !app )
+ return;
+
+ SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+ if ( !appStudy )
+ return;
+
+ _PTR(Study) aStudy = appStudy->studyDS();
+
+ //add Global CS
+ ComboBox1->addItem(tr("GEOM_GCS"));
+ gp_Pnt aOrigin = gp_Pnt(0, 0, 0);
+ gp_Dir aDirZ = gp_Dir(0, 0, 1);
+ gp_Dir aDirX = gp_Dir(1, 0, 0);
+ gp_Ax3 globalCS = gp_Ax3(aOrigin, aDirZ, aDirX);
+ myLCSList.push_back(globalCS);
+
+ // get GEOM component
+ CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
+ _PTR(SObject) obj = aStudy->FindObjectIOR( geomIOR.in() );
+ if (!obj)
+ return;
+ _PTR(SComponent) fc = obj->GetFatherComponent();
+ QString geomComp = fc->GetID().c_str();
+ _PTR(SObject) comp = aStudy->FindObjectID( geomComp.toLatin1().data() );
+ if ( !comp )
+ return;
+
+ // browse through all GEOM data tree
+ _PTR(ChildIterator) it ( aStudy->NewChildIterator( comp ) );
+ for ( it->InitEx( true ); it->More(); it->Next() ) {
+ _PTR(SObject) child( it->Value() );
+ CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( child );
+ GEOM::GEOM_Object_var geomObj = GEOM::GEOM_Object::_narrow( corbaObj );
+ if( CORBA::is_nil( geomObj ) )
+ continue;
+ if (geomObj->GetType() == GEOM_MARKER) {
+ ComboBox1->addItem(geomObj->GetName());
+ TopoDS_Shape aShape = GEOM_Client().GetShape(GeometryGUI::GetGeomGen(), geomObj);
+
+ gp_Ax3 aLCS;
+ aLCS.Transform(aShape.Location().Transformation());
+ if (aShape.ShapeType() == TopAbs_FACE) {
+ Handle(Geom_Surface) aGS = BRep_Tool::Surface(TopoDS::Face(aShape));
+ if (!aGS.IsNull() && aGS->IsKind(STANDARD_TYPE(Geom_Plane))) {
+ Handle(Geom_Plane) aGPlane = Handle(Geom_Plane)::DownCast(aGS);
+ gp_Pln aPln = aGPlane->Pln();
+ aLCS = aPln.Position();
+ }
+ }
+ myLCSList.push_back(aLCS);
+ }
+ }
+}
+
+//=================================================================================
+// function : GetActiveLocalCS()
+// purpose : Find All Coordinates systems in study
+//=================================================================================
+gp_Ax3 EntityGUI_SketcherDlg::GetActiveLocalCS()
+{
+ int ind = ComboBox1->currentIndex();
+ if (ind == -1)
+ return myGeometryGUI->GetWorkingPlane();
+
+ gp_Ax3 aLCS = myLCSList.at(ind);
+
+ myGeometryGUI->SetWorkingPlane( aLCS );
+ myGeometryGUI->ActiveWorkingPlane();
+ return aLCS;
+}
#include <GEOMBase_Helper.h>
+#include <QGroupBox>
+#include <QComboBox>
#include <QDialog>
+#include <gp_Ax3.hxx>
+
class QLineEdit;
class SalomeApp_DoubleSpinBox;
class EntityGUI_1Sel;
EntityGUI_3Spin* Group3Spin;
EntityGUI_4Spin* Group4Spin;
+ QGroupBox* GroupBox1;
+ QComboBox* ComboBox1;
+
GeometryGUI* myGeometryGUI;
QString myHelpFileName;
double myLineWidth;
+ QList<gp_Ax3> myLCSList;
+
private:
enum SketchState { FIRST_POINT, NEXT_POINT };
void Dir2Clicked( int );
void ValueChangedInSpinBox( double );
void SetDoubleSpinBoxStep( double );
+ void FindLocalCS();
+ gp_Ax3 GetActiveLocalCS();
};
#endif // ENTITYGUI_SKETCHERDLG_H
id == 4015 || // MENU BASIC - ARC
id == 4016 || // MENU BASIC - VECTOR
id == 4017 || // MENU BASIC - PLANE
- id == 4018 || // MENU BASIC - WPLANE
+// id == 4018 || // MENU BASIC - WPLANE // DEPRECATED
id == 4019 || // MENU BASIC - CURVE
id == 4020 ) { // MENU BASIC - REPAIR
#ifndef WNT
createGeomAction( 4019, "CURVE" );
createGeomAction( 4016, "VECTOR" );
createGeomAction( 4017, "PLANE" );
- createGeomAction( 4018, "WORK_PLANE" );
+// createGeomAction( 4018, "WORK_PLANE" ); DEPRECATED
createGeomAction( 4020, "LOCAL_CS" );
createGeomAction( 4021, "BOX" );
createMenu( separator(), basicId, -1 );
createMenu( 4016, basicId, -1 );
createMenu( 4017, basicId, -1 );
- createMenu( 4018, basicId, -1 );
+// createMenu( 4018, basicId, -1 ); DEPRECATED
createMenu( 4020, basicId, -1 );
int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 );
createTool( 4019, basicTbId );
createTool( 4016, basicTbId );
createTool( 4017, basicTbId );
- createTool( 4018, basicTbId );
+// createTool( 4018, basicTbId ); DEPRECATED
createTool( 4020, basicTbId );
int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
return aPlane;
}
+//=============================================================================
+/*!
+ * MakePlane2Vec
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlane2Vec
+ (Handle(GEOM_Object) theVec1, Handle(GEOM_Object) theVec2,
+ double theSize)
+{
+ SetErrorCode(KO);
+
+ if (theVec1.IsNull() || theVec2.IsNull()) return NULL;
+
+ //Add a new Plane object
+ Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+
+ //Add a new Plane function
+ Handle(GEOM_Function) aFunction =
+ aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_2_VEC);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
+
+ GEOMImpl_IPlane aPI (aFunction);
+
+ Handle(GEOM_Function) aRefVec1 = theVec1->GetLastFunction();
+ Handle(GEOM_Function) aRefVec2 = theVec2->GetLastFunction();
+ if (aRefVec1.IsNull() || aRefVec2.IsNull()) return NULL;
+
+ aPI.SetVector1(aRefVec1);
+ aPI.SetVector2(aRefVec2);
+ aPI.SetSize(theSize);
+
+ //Compute the Plane value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Plane 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) << aPlane << " = geompy.MakePlane2Vec("
+ << theVec1 << ", " << theVec2 << ", " << theSize << ")";
+
+ SetErrorCode(OK);
+ return aPlane;
+}
+
+//=============================================================================
+/*!
+ * MakePlaneLCS
+ */
+//=============================================================================
+Handle(GEOM_Object) GEOMImpl_IBasicOperations::MakePlaneLCS
+ (Handle(GEOM_Object) theLCS, double theSize, int theOrientation)
+{
+ SetErrorCode(KO);
+
+ //Add a new Plane object
+ Handle(GEOM_Object) aPlane = GetEngine()->AddObject(GetDocID(), GEOM_PLANE);
+
+ //Add a new Plane function
+ Handle(GEOM_Function) aFunction =
+ aPlane->AddFunction(GEOMImpl_PlaneDriver::GetID(), PLANE_LCS);
+
+ //Check if the function is set correctly
+ if (aFunction->GetDriverGUID() != GEOMImpl_PlaneDriver::GetID()) return NULL;
+
+ GEOMImpl_IPlane aPI (aFunction);
+
+ if ( !theLCS.IsNull() ) {
+ Handle(GEOM_Function) aRef = theLCS->GetLastFunction();
+ aPI.SetLCS(aRef);
+ }
+
+ aPI.SetSize(theSize);
+ aPI.SetOrientation(theOrientation);
+
+ //Compute the Plane value
+ try {
+#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100
+ OCC_CATCH_SIGNALS;
+#endif
+ if (!GetSolver()->ComputeFunction(aFunction)) {
+ SetErrorCode("Plane 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) << aPlane << " = geompy.MakePlaneLCS("
+ << theLCS << ", " << theSize << ", " << theOrientation << ")";
+
+ SetErrorCode(OK);
+ return aPlane;
+}
+
//=============================================================================
/*!
double theSize);
Standard_EXPORT Handle(GEOM_Object) MakePlaneFace (Handle(GEOM_Object) theFace, double theSize);
+
+ Standard_EXPORT Handle(GEOM_Object) MakePlane2Vec (Handle(GEOM_Object) theVec1,
+ Handle(GEOM_Object) theVec2,
+ double theSize);
+
+ Standard_EXPORT Handle(GEOM_Object) MakePlaneLCS (Handle(GEOM_Object) theFace, double theSize, int theOrientation);
// Marker
Standard_EXPORT Handle(GEOM_Object) MakeMarker (double theOX, double theOY, double theOZ,
#define PLN_ARG_PARAM_V 8
+#define PLN_ARG_VEC1 9
+#define PLN_ARG_VEC2 10
+
+#define PLN_ARG_ORIENT 11
+
+#define PLN_ARG_LCS 12
+
class GEOMImpl_IPlane
{
public:
void SetSize(double theSize) { _func->SetReal(PLN_ARG_SIZE, theSize); }
double GetSize() { return _func->GetReal(PLN_ARG_SIZE); }
+
+ void SetOrientation(double theOrientation) { _func->SetReal(PLN_ARG_ORIENT, theOrientation); }
+
+ double GetOrientation() { return _func->GetReal(PLN_ARG_ORIENT); }
void SetPoint (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT1, theRef); }
void SetVector(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_VEC , theRef); }
+ void SetVector1(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_VEC1 , theRef); }
+ void SetVector2(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_VEC2 , theRef); }
void SetFace (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_REF , theRef); }
+ void SetLCS (Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_LCS , theRef); }
void SetPoint1(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT1, theRef); }
void SetPoint2(Handle(GEOM_Function) theRef) { _func->SetReference(PLN_ARG_PNT2, theRef); }
Handle(GEOM_Function) GetPoint () { return _func->GetReference(PLN_ARG_PNT1); }
Handle(GEOM_Function) GetVector() { return _func->GetReference(PLN_ARG_VEC ); }
+ Handle(GEOM_Function) GetVector1() { return _func->GetReference(PLN_ARG_VEC1 ); }
+ Handle(GEOM_Function) GetVector2() { return _func->GetReference(PLN_ARG_VEC2 ); }
Handle(GEOM_Function) GetFace () { return _func->GetReference(PLN_ARG_REF ); }
+ Handle(GEOM_Function) GetLCS () { return _func->GetReference(PLN_ARG_LCS ); }
Handle(GEOM_Function) GetPoint1() { return _func->GetReference(PLN_ARG_PNT1); }
Handle(GEOM_Function) GetPoint2() { return _func->GetReference(PLN_ARG_PNT2); }
if(aTool.IsDone())
aShape = aTool.Shape();
}
+ else if (aType == PLANE_2_VEC) {
+ Handle(GEOM_Function) aRefVec1 = aPI.GetVector1();
+ Handle(GEOM_Function) aRefVec2 = aPI.GetVector2();
+ TopoDS_Shape aShape1 = aRefVec1->GetValue();
+ TopoDS_Shape aShape2 = aRefVec2->GetValue();
+ if (aShape1.ShapeType() != TopAbs_EDGE ||
+ aShape2.ShapeType() != TopAbs_EDGE) return 0;
+ TopoDS_Edge aVectX = TopoDS::Edge(aShape1);
+ TopoDS_Edge aVectZ = TopoDS::Edge(aShape2);
+
+ TopoDS_Vertex VX1, VX2, VZ1, VZ2;
+ TopExp::Vertices( aVectX, VX1, VX2, Standard_True );
+ TopExp::Vertices( aVectZ, VZ1, VZ2, Standard_True );
+
+ gp_Vec aVX = gp_Vec( BRep_Tool::Pnt( VX1 ), BRep_Tool::Pnt( VX2 ) );
+ gp_Vec aVZ = gp_Vec( BRep_Tool::Pnt( VZ1 ), BRep_Tool::Pnt( VZ2 ) );
+
+ if ( aVX.Magnitude() < Precision::Confusion() || aVZ.Magnitude() < Precision::Confusion())
+ Standard_TypeMismatch::Raise("Invalid vector selected");
+
+ gp_Dir aDirX = gp_Dir( aVX.X(), aVX.Y(), aVX.Z() );
+ gp_Dir aDirZ = gp_Dir( aVZ.X(), aVZ.Y(), aVZ.Z() );
+
+ if ( aDirX.IsParallel( aDirZ, Precision::Angular() ) )
+ Standard_TypeMismatch::Raise("Parallel vectors selected");
+
+ gp_Ax3 aPlane = gp_Ax3( BRep_Tool::Pnt( VX1 ), aDirZ, aDirX );
+ BRepBuilderAPI_MakeFace aTool(aPlane, -aSize, +aSize, -aSize, +aSize);
+ if(aTool.IsDone())
+ aShape = aTool.Shape();
+ } else if (aType == PLANE_LCS) {
+ Handle(GEOM_Function) aRef = aPI.GetLCS();
+ double anOrientation = aPI.GetOrientation();
+ gp_Ax3 anAx3;
+ if (aRef.IsNull()) {
+ gp_Ax2 anAx2 = gp::XOY();
+ anAx3 = gp_Ax3( anAx2 );
+ } else {
+ TopoDS_Shape aRefShape = aRef->GetValue();
+ if (aRefShape.ShapeType() != TopAbs_FACE)
+ return 0;
+ anAx3 = GEOMImpl_IMeasureOperations::GetPosition(aRefShape);
+ }
+
+ if ( anOrientation == 2)
+ anAx3 = gp_Ax3(anAx3.Location(), anAx3.XDirection(), anAx3.YDirection() );
+ else if ( anOrientation == 3 )
+ anAx3 = gp_Ax3(anAx3.Location(), anAx3.YDirection(), anAx3.XDirection() );
+
+ gp_Pln aPln(anAx3);
+ aShape = BRepBuilderAPI_MakeFace(aPln, -aSize, +aSize, -aSize, +aSize).Shape();
+ }
else {
}
#define VECTOR_TANGENT_CURVE_PAR 3
#define VECTOR_FACE_NORMALE 4
-#define PLANE_PNT_VEC 1
-#define PLANE_FACE 2
-#define PLANE_THREE_PNT 3
+#define PLANE_PNT_VEC 1
+#define PLANE_FACE 2
+#define PLANE_THREE_PNT 3
#define PLANE_TANGENT_FACE 4
+#define PLANE_2_VEC 5
+#define PLANE_LCS 6
#define LINE_TWO_PNT 1
#define LINE_PNT_DIR 2
return GetObject(anObject);
}
+//=============================================================================
+/*!
+ * MakePlane2Vec
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlane2Vec
+ (GEOM::GEOM_Object_ptr theVec1, GEOM::GEOM_Object_ptr theVec2,
+ CORBA::Double theTrimSize)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the references
+ Handle(GEOM_Object) aRef1 = GetObjectImpl(theVec1);
+ Handle(GEOM_Object) aRef2 = GetObjectImpl(theVec2);
+ if (aRef1.IsNull() || aRef2.IsNull()) return aGEOMObject._retn();
+
+ //Create the plane
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakePlane2Vec(aRef1, aRef2, theTrimSize);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
+
+//=============================================================================
+/*!
+ * MakePlaneLCS
+ */
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_IBasicOperations_i::MakePlaneLCS
+ (GEOM::GEOM_Object_ptr theLCS, CORBA::Double theTrimSize,
+ CORBA::Double theOrientation)
+{
+ GEOM::GEOM_Object_var aGEOMObject;
+
+ //Set a not done flag
+ GetOperations()->SetNotDone();
+
+ //Get the references
+ Handle(GEOM_Object) aRef1 = GetObjectImpl(theLCS);
+
+ //Create the plane
+ Handle(GEOM_Object) anObject =
+ GetOperations()->MakePlaneLCS(aRef1, theTrimSize, theOrientation);
+ if (!GetOperations()->IsDone() || anObject.IsNull())
+ return aGEOMObject._retn();
+
+ return GetObject(anObject);
+}
//=============================================================================
/*!
GEOM::GEOM_Object_ptr MakePlaneFace (GEOM::GEOM_Object_ptr theFace,
CORBA::Double theTrimSize);
+
+ GEOM::GEOM_Object_ptr MakePlane2Vec (GEOM::GEOM_Object_ptr theVec1,
+ GEOM::GEOM_Object_ptr theVec2,
+ CORBA::Double theTrimSize);
+
+ GEOM::GEOM_Object_ptr MakePlaneLCS (GEOM::GEOM_Object_ptr theLCS,
+ CORBA::Double theTrimSize,
+ CORBA::Double theOrientation );
GEOM::GEOM_Object_ptr MakeMarker (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ,
CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ,
return anObj;
}
+//=============================================================================
+// MakePlane2Vec:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlane2Vec (GEOM::GEOM_Object_ptr theVec1,
+ GEOM::GEOM_Object_ptr theVec2,
+ CORBA::Double theTrimSize)
+{
+ beginService( " GEOM_Superv_i::MakePlane2Vec" );
+ MESSAGE("GEOM_Superv_i::MakePlane2Vec");
+ getBasicOp();
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePlane2Vec(theVec1, theVec2, theTrimSize);
+ endService( " GEOM_Superv_i::MakePlane2Vec" );
+ return anObj;
+}
+
+//=============================================================================
+// MakePlaneLCS:
+//=============================================================================
+GEOM::GEOM_Object_ptr GEOM_Superv_i::MakePlaneLCS (GEOM::GEOM_Object_ptr theLCS,
+ CORBA::Double theTrimSize,
+ CORBA::Double theOrientation)
+{
+ beginService( " GEOM_Superv_i::MakePlaneLCS" );
+ MESSAGE("GEOM_Superv_i::MakePlaneLCS");
+ getBasicOp();
+ GEOM::GEOM_Object_ptr anObj = myBasicOp->MakePlaneLCS(theLCS, theTrimSize, theOrientation);
+ endService( " GEOM_Superv_i::MakePlaneLCS" );
+ return anObj;
+}
+
//=============================================================================
// MakeMarker:
//=============================================================================
CORBA::Double theTrimSize);
GEOM::GEOM_Object_ptr MakePlaneFace (GEOM::GEOM_Object_ptr theFace,
CORBA::Double theTrimSize);
+ GEOM::GEOM_Object_ptr MakePlane2Vec (GEOM::GEOM_Object_ptr theVec1,
+ GEOM::GEOM_Object_ptr theVec2,
+ CORBA::Double theTrimSize);
+ GEOM::GEOM_Object_ptr MakePlaneLCS (GEOM::GEOM_Object_ptr theLCS,
+ CORBA::Double theTrimSize,
+ CORBA::Double theOrientation);
GEOM::GEOM_Object_ptr MakeMarker (CORBA::Double theOX , CORBA::Double theOY , CORBA::Double theOZ,
CORBA::Double theXDX, CORBA::Double theXDY, CORBA::Double theXDZ,
CORBA::Double theYDX, CORBA::Double theYDY, CORBA::Double theYDZ);
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
id_Line3 = geompy.addToStudy(Line3, "Line on Two Faces Intersection")
id_Plane = geompy.addToStudy(Plane, "Plane")
id_Plane1 = geompy.addToStudy(Plane1, "Plane by 3 points")
+ id_Plane2 = geompy.addToStudy(Plane2, "Plane by 2 vectors")
+ id_Plane3 = geompy.addToStudy(Plane3, "Plane by LCS")
id_Arc = geompy.addToStudy(Arc, "Arc")
id_Arc2 = geompy.addToStudy(Arc2, "Arc2")
RaiseIfFailed("MakePlaneFace", self.BasicOp)
anObj.SetParameters(Parameters)
return anObj
+
+ ## Create a plane, passing through the 2 vectors
+ # with center in a start point of the first vector.
+ # @param theVec1 Vector, defining center point and plane direction.
+ # @param theVec2 Vector, defining the plane normal direction.
+ # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
+ # @return New GEOM_Object, containing the created plane.
+ #
+ # @ref tui_creation_plane "Example"
+ def MakePlane2Vec(self,theVec1, theVec2, theTrimSize):
+ # Example: see GEOM_TestAll.py
+ theTrimSize, Parameters = ParseParameters(theTrimSize);
+ anObj = self.BasicOp.MakePlane2Vec(theVec1, theVec2, theTrimSize)
+ RaiseIfFailed("MakePlane2Vec", self.BasicOp)
+ anObj.SetParameters(Parameters)
+ return anObj
+
+ ## Create a plane, based on a Local coordinate system.
+ # @param theLCS coordinate system, defining plane.
+ # @param theTrimSize Half size of a side of quadrangle face, representing the plane.
+ # @param theOrientation OXY, OYZ or OZX orientation - (1, 2 or 3)
+ # @return New GEOM_Object, containing the created plane.
+ #
+ # @ref tui_creation_plane "Example"
+ def MakePlaneLCS(self,theLCS, theTrimSize, theOrientation):
+ # Example: see GEOM_TestAll.py
+ theTrimSize, Parameters = ParseParameters(theTrimSize);
+ anObj = self.BasicOp.MakePlaneLCS(theLCS, theTrimSize, theOrientation)
+ RaiseIfFailed("MakePlaneLCS", self.BasicOp)
+ anObj.SetParameters(Parameters)
+ return anObj
## Create a local coordinate system.
# @param OX,OY,OZ Three coordinates of coordinate system origin.