mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-12-29 10:50:35 +05:00
IMP 0016656: EDF531: Default constructor in creation dialog of geometric objects.
This commit is contained in:
parent
f3d19bfb62
commit
a0e96fa432
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 24 KiB |
Binary file not shown.
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 25 KiB |
@ -15,6 +15,10 @@ Radius)</em>
|
|||||||
\n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
|
\n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
|
||||||
the direction) + Radius.
|
the direction) + Radius.
|
||||||
|
|
||||||
|
\note Passing None as <b>Center Point</b> means Origin of global
|
||||||
|
coordinate system, passing None as \b Vector means OZ axis of global
|
||||||
|
coordinate system.
|
||||||
|
|
||||||
\image html circle1.png
|
\image html circle1.png
|
||||||
|
|
||||||
\n Secondly, you can define a \b Circle by three \b Points that lie on it.
|
\n Secondly, you can define a \b Circle by three \b Points that lie on it.
|
||||||
|
@ -12,6 +12,10 @@ Vector giving its normal, and its <b>Major & Minor Radiuses</b>.
|
|||||||
\n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
|
\n <b>Arguments:</b> Name + 1 vertex (for the center) + 1 edge (for
|
||||||
the direction) + 1 X Radius + 1 Y Radius.
|
the direction) + 1 X Radius + 1 Y Radius.
|
||||||
|
|
||||||
|
\note Passing None as <b>Center Point</b> means Origin of global
|
||||||
|
coordinate system, passing None as \b Vector means OZ axis of global
|
||||||
|
coordinate system.
|
||||||
|
|
||||||
\image html ellipse.png
|
\image html ellipse.png
|
||||||
|
|
||||||
<b>Example:</b>
|
<b>Example:</b>
|
||||||
|
@ -69,8 +69,8 @@ BasicGUI_CircleDlg::BasicGUI_CircleDlg( GeometryGUI* theGeometryGUI, QWidget* pa
|
|||||||
GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() );
|
GroupPntVecR = new DlgRef_2Sel1Spin( centralWidget() );
|
||||||
GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
GroupPntVecR->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||||
|
|
||||||
GroupPntVecR->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) );
|
GroupPntVecR->TextLabel1->setText( tr( "GEOM_CENTER_POINT" ) + " (Origin by default)" );
|
||||||
GroupPntVecR->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
|
GroupPntVecR->TextLabel2->setText( tr( "GEOM_VECTOR" ) + " (Z axis by default)" );
|
||||||
GroupPntVecR->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
|
GroupPntVecR->TextLabel3->setText( tr( "GEOM_RADIUS" ) );
|
||||||
GroupPntVecR->PushButton1->setIcon( image1 );
|
GroupPntVecR->PushButton1->setIcon( image1 );
|
||||||
GroupPntVecR->PushButton2->setIcon( image1 );
|
GroupPntVecR->PushButton2->setIcon( image1 );
|
||||||
@ -248,6 +248,8 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId )
|
|||||||
|
|
||||||
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
|
connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
|
||||||
this, SLOT( SelectionIntoArgument() ) );
|
this, SLOT( SelectionIntoArgument() ) );
|
||||||
|
|
||||||
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -494,7 +496,10 @@ bool BasicGUI_CircleDlg::isValid( QString& msg )
|
|||||||
{
|
{
|
||||||
const int id = getConstructorId();
|
const int id = getConstructorId();
|
||||||
if ( id == 0 )
|
if ( id == 0 )
|
||||||
return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
|
//return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
|
||||||
|
//nil point means origin of global CS
|
||||||
|
//nil vector means Z axis
|
||||||
|
return getRadius() > 0;
|
||||||
else if ( id == 1 )
|
else if ( id == 1 )
|
||||||
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
|
return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
|
||||||
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
|
!isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
|
||||||
@ -548,7 +553,9 @@ void BasicGUI_CircleDlg::addSubshapesToStudy()
|
|||||||
|
|
||||||
switch ( getConstructorId() ) {
|
switch ( getConstructorId() ) {
|
||||||
case 0:
|
case 0:
|
||||||
|
if (!CORBA::is_nil(myPoint))
|
||||||
objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
|
objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
|
||||||
|
if (!CORBA::is_nil(myDir))
|
||||||
objMap[GroupPntVecR->LineEdit2->text()] = myDir;
|
objMap[GroupPntVecR->LineEdit2->text()] = myDir;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -69,8 +69,8 @@ BasicGUI_EllipseDlg::BasicGUI_EllipseDlg( GeometryGUI* theGeometryGUI, QWidget*
|
|||||||
|
|
||||||
GroupPoints = new DlgRef_2Sel2Spin( centralWidget() );
|
GroupPoints = new DlgRef_2Sel2Spin( centralWidget() );
|
||||||
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
GroupPoints->GroupBox1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||||
GroupPoints->TextLabel1->setText( tr( "GEOM_CENTER" ) );
|
GroupPoints->TextLabel1->setText( tr( "GEOM_CENTER" ) + " (Origin by default)" );
|
||||||
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) );
|
GroupPoints->TextLabel2->setText( tr( "GEOM_VECTOR" ) + " (Z axis by default)" );
|
||||||
GroupPoints->TextLabel3->setText( tr( "GEOM_RADIUS_MAJOR" ) );
|
GroupPoints->TextLabel3->setText( tr( "GEOM_RADIUS_MAJOR" ) );
|
||||||
GroupPoints->TextLabel4->setText( tr( "GEOM_RADIUS_MINOR" ) );
|
GroupPoints->TextLabel4->setText( tr( "GEOM_RADIUS_MINOR" ) );
|
||||||
GroupPoints->PushButton1->setIcon( image1 );
|
GroupPoints->PushButton1->setIcon( image1 );
|
||||||
@ -146,6 +146,8 @@ void BasicGUI_EllipseDlg::Init()
|
|||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||||
|
|
||||||
initName( tr( "GEOM_ELLIPSE" ) );
|
initName( tr( "GEOM_ELLIPSE" ) );
|
||||||
|
|
||||||
|
displayPreview();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -189,6 +191,7 @@ bool BasicGUI_EllipseDlg::ClickOnApply()
|
|||||||
//globalSelection(GEOM_POINT);
|
//globalSelection(GEOM_POINT);
|
||||||
globalSelection(); // close local contexts, if any
|
globalSelection(); // close local contexts, if any
|
||||||
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
|
||||||
|
displayPreview();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -368,7 +371,10 @@ bool BasicGUI_EllipseDlg::isValid( QString& msg )
|
|||||||
msg = tr( "GEOM_ELLIPSE_ERROR_1" );
|
msg = tr( "GEOM_ELLIPSE_ERROR_1" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return !myPoint->_is_nil() && !myDir->_is_nil();
|
//return !myPoint->_is_nil() && !myDir->_is_nil();
|
||||||
|
//nil point means origin of global CS
|
||||||
|
//nil vector means Z axis
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -395,7 +401,9 @@ void BasicGUI_EllipseDlg::addSubshapesToStudy()
|
|||||||
{
|
{
|
||||||
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
QMap<QString, GEOM::GEOM_Object_var> objMap;
|
||||||
|
|
||||||
|
if (!CORBA::is_nil(myPoint))
|
||||||
objMap[GroupPoints->LineEdit1->text()] = myPoint;
|
objMap[GroupPoints->LineEdit1->text()] = myPoint;
|
||||||
|
if (!CORBA::is_nil(myDir))
|
||||||
objMap[GroupPoints->LineEdit2->text()] = myDir;
|
objMap[GroupPoints->LineEdit2->text()] = myDir;
|
||||||
|
|
||||||
addSubshapesToFather( objMap );
|
addSubshapesToFather( objMap );
|
||||||
|
@ -162,7 +162,8 @@ void BasicGUI_VectorDlg::Init()
|
|||||||
|
|
||||||
initName( tr("GEOM_VECTOR") );
|
initName( tr("GEOM_VECTOR") );
|
||||||
|
|
||||||
ConstructorsClicked( 0 );
|
setConstructorId( 1 ); // simplest constructor
|
||||||
|
ConstructorsClicked( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -175,7 +175,8 @@ void BasicGUI_WorkingPlaneDlg::Init()
|
|||||||
|
|
||||||
initName( tr( "GEOM_WPLANE" ) );
|
initName( tr( "GEOM_WPLANE" ) );
|
||||||
|
|
||||||
ConstructorsClicked( 0 );
|
setConstructorId( 2 ); // simplest constructor
|
||||||
|
ConstructorsClicked( 2 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -556,7 +557,8 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview )
|
|||||||
|
|
||||||
if ( showPreview ) {
|
if ( showPreview ) {
|
||||||
GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() );
|
GEOM::GEOM_IBasicOperations_var aBasicOp = getGeomEngine()->GetIBasicOperations( getStudyId() );
|
||||||
GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(),
|
GEOM::GEOM_Object_var anObj = aBasicOp->MakeMarker
|
||||||
|
( myWPlane.Location().X(), myWPlane.Location().Y(), myWPlane.Location().Z(),
|
||||||
myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
|
myWPlane.XDirection().X(), myWPlane.XDirection().Y(), myWPlane.XDirection().Z(),
|
||||||
myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() );
|
myWPlane.YDirection().X(), myWPlane.YDirection().Y(), myWPlane.YDirection().Z() );
|
||||||
displayPreview( anObj );
|
displayPreview( anObj );
|
||||||
|
@ -77,24 +77,43 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const
|
|||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
if (aType == CIRCLE_PNT_VEC_R) {
|
if (aType == CIRCLE_PNT_VEC_R) {
|
||||||
|
// Center
|
||||||
|
gp_Pnt aP = gp::Origin();
|
||||||
Handle(GEOM_Function) aRefPoint = aCI.GetCenter();
|
Handle(GEOM_Function) aRefPoint = aCI.GetCenter();
|
||||||
Handle(GEOM_Function) aRefVector = aCI.GetVector();
|
if (!aRefPoint.IsNull()) {
|
||||||
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
||||||
|
if (aShapePnt.ShapeType() != TopAbs_VERTEX) {
|
||||||
|
Standard_ConstructionError::Raise
|
||||||
|
("Circle creation aborted: invalid center argument, must be a point");
|
||||||
|
}
|
||||||
|
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
|
||||||
|
}
|
||||||
|
// Normal
|
||||||
|
gp_Vec aV = gp::DZ();
|
||||||
|
Handle(GEOM_Function) aRefVector = aCI.GetVector();
|
||||||
|
if (!aRefVector.IsNull()) {
|
||||||
TopoDS_Shape aShapeVec = aRefVector->GetValue();
|
TopoDS_Shape aShapeVec = aRefVector->GetValue();
|
||||||
if (aShapePnt.ShapeType() == TopAbs_VERTEX &&
|
if (aShapeVec.ShapeType() != TopAbs_EDGE) {
|
||||||
aShapeVec.ShapeType() == TopAbs_EDGE) {
|
Standard_ConstructionError::Raise
|
||||||
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
|
("Circle creation aborted: invalid vector argument, must be a vector or an edge");
|
||||||
|
}
|
||||||
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
|
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
|
||||||
TopoDS_Vertex V1, V2;
|
TopoDS_Vertex V1, V2;
|
||||||
TopExp::Vertices(anE, V1, V2, Standard_True);
|
TopExp::Vertices(anE, V1, V2, Standard_True);
|
||||||
if (!V1.IsNull() && !V2.IsNull()) {
|
if (!V1.IsNull() && !V2.IsNull()) {
|
||||||
gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
|
aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
|
||||||
|
if (aV.Magnitude() < gp::Resolution()) {
|
||||||
|
Standard_ConstructionError::Raise
|
||||||
|
("Circle creation aborted: vector of zero length is given");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Axes
|
||||||
gp_Ax2 anAxes (aP, aV);
|
gp_Ax2 anAxes (aP, aV);
|
||||||
|
// Circle
|
||||||
gp_Circ aCirc (anAxes, aCI.GetRadius());
|
gp_Circ aCirc (anAxes, aCI.GetRadius());
|
||||||
aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
|
aShape = BRepBuilderAPI_MakeEdge(aCirc).Edge();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (aType == CIRCLE_CENTER_TWO_PNT) {
|
else if (aType == CIRCLE_CENTER_TWO_PNT) {
|
||||||
Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1();
|
Handle(GEOM_Function) aRefPoint1 = aCI.GetPoint1();
|
||||||
Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2();
|
Handle(GEOM_Function) aRefPoint2 = aCI.GetPoint2();
|
||||||
@ -102,7 +121,8 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const
|
|||||||
TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue();
|
TopoDS_Shape aShapePnt1 = aRefPoint1->GetValue();
|
||||||
TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue();
|
TopoDS_Shape aShapePnt2 = aRefPoint2->GetValue();
|
||||||
TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue();
|
TopoDS_Shape aShapePnt3 = aRefPoint3->GetValue();
|
||||||
if (aShapePnt1.ShapeType() == TopAbs_VERTEX && aShapePnt2.ShapeType() == TopAbs_VERTEX &&
|
if (aShapePnt1.ShapeType() == TopAbs_VERTEX &&
|
||||||
|
aShapePnt2.ShapeType() == TopAbs_VERTEX &&
|
||||||
aShapePnt3.ShapeType() == TopAbs_VERTEX)
|
aShapePnt3.ShapeType() == TopAbs_VERTEX)
|
||||||
{
|
{
|
||||||
gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1));
|
gp_Pnt aP1 = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt1));
|
||||||
@ -113,8 +133,10 @@ Standard_Integer GEOMImpl_CircleDriver::Execute(TFunction_Logbook& log) const
|
|||||||
aP1.Distance(aP3) < gp::Resolution() ||
|
aP1.Distance(aP3) < gp::Resolution() ||
|
||||||
aP2.Distance(aP3) < gp::Resolution())
|
aP2.Distance(aP3) < gp::Resolution())
|
||||||
Standard_ConstructionError::Raise("Circle creation aborted: coincident points given");
|
Standard_ConstructionError::Raise("Circle creation aborted: coincident points given");
|
||||||
|
|
||||||
if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular()))
|
if (gp_Vec(aP1, aP2).IsParallel(gp_Vec(aP1, aP3), Precision::Angular()))
|
||||||
Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line");
|
Standard_ConstructionError::Raise("Circle creation aborted: points lay on one line");
|
||||||
|
|
||||||
double x, y, z, x1, y1, z1, x2, y2, z2, dx, dy, dz, dx2, dy2, dz2, dx3, dy3, dz3, aRadius;
|
double x, y, z, x1, y1, z1, x2, y2, z2, dx, dy, dz, dx2, dy2, dz2, dx3, dy3, dz3, aRadius;
|
||||||
//Calculations for Radius
|
//Calculations for Radius
|
||||||
x = aP1.X(); y = aP1.Y(); z = aP1.Z();
|
x = aP1.X(); y = aP1.Y(); z = aP1.Z();
|
||||||
|
@ -71,24 +71,44 @@ Standard_Integer GEOMImpl_EllipseDriver::Execute(TFunction_Logbook& log) const
|
|||||||
TopoDS_Shape aShape;
|
TopoDS_Shape aShape;
|
||||||
|
|
||||||
if (aType == ELLIPSE_PNT_VEC_RR) {
|
if (aType == ELLIPSE_PNT_VEC_RR) {
|
||||||
|
// Center
|
||||||
|
gp_Pnt aP = gp::Origin();
|
||||||
Handle(GEOM_Function) aRefPoint = aCI.GetCenter();
|
Handle(GEOM_Function) aRefPoint = aCI.GetCenter();
|
||||||
Handle(GEOM_Function) aRefVector = aCI.GetVector();
|
if (!aRefPoint.IsNull()) {
|
||||||
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
TopoDS_Shape aShapePnt = aRefPoint->GetValue();
|
||||||
|
if (aShapePnt.ShapeType() != TopAbs_VERTEX) {
|
||||||
|
Standard_ConstructionError::Raise
|
||||||
|
("Circle creation aborted: invalid center argument, must be a point");
|
||||||
|
}
|
||||||
|
aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
|
||||||
|
}
|
||||||
|
// Normal
|
||||||
|
gp_Vec aV = gp::DZ();
|
||||||
|
Handle(GEOM_Function) aRefVector = aCI.GetVector();
|
||||||
|
if (!aRefVector.IsNull()) {
|
||||||
TopoDS_Shape aShapeVec = aRefVector->GetValue();
|
TopoDS_Shape aShapeVec = aRefVector->GetValue();
|
||||||
if (aShapePnt.ShapeType() == TopAbs_VERTEX &&
|
if (aShapeVec.ShapeType() != TopAbs_EDGE) {
|
||||||
aShapeVec.ShapeType() == TopAbs_EDGE) {
|
Standard_ConstructionError::Raise
|
||||||
gp_Pnt aP = BRep_Tool::Pnt(TopoDS::Vertex(aShapePnt));
|
("Circle creation aborted: invalid vector argument, must be a vector or an edge");
|
||||||
|
}
|
||||||
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
|
TopoDS_Edge anE = TopoDS::Edge(aShapeVec);
|
||||||
TopoDS_Vertex V1, V2;
|
TopoDS_Vertex V1, V2;
|
||||||
TopExp::Vertices(anE, V1, V2, Standard_True);
|
TopExp::Vertices(anE, V1, V2, Standard_True);
|
||||||
if (!V1.IsNull() && !V2.IsNull()) {
|
if (!V1.IsNull() && !V2.IsNull()) {
|
||||||
gp_Vec aV (BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
|
aV = gp_Vec(BRep_Tool::Pnt(V1), BRep_Tool::Pnt(V2));
|
||||||
|
if (aV.Magnitude() < gp::Resolution()) {
|
||||||
|
Standard_ConstructionError::Raise
|
||||||
|
("Circle creation aborted: vector of zero length is given");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Axes
|
||||||
gp_Ax2 anAxes (aP, aV);
|
gp_Ax2 anAxes (aP, aV);
|
||||||
|
// Ellipse
|
||||||
gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor());
|
gp_Elips anEll (anAxes, aCI.GetRMajor(), aCI.GetRMinor());
|
||||||
aShape = BRepBuilderAPI_MakeEdge(anEll).Edge();
|
aShape = BRepBuilderAPI_MakeEdge(anEll).Edge();
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
} else {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aShape.IsNull()) return 0;
|
if (aShape.IsNull()) return 0;
|
||||||
|
@ -266,7 +266,9 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
|
|||||||
{
|
{
|
||||||
SetErrorCode(KO);
|
SetErrorCode(KO);
|
||||||
|
|
||||||
if (thePnt.IsNull() || theVec.IsNull()) return NULL;
|
// Not set thePnt means origin of global CS,
|
||||||
|
// Not set theVec means Z axis of global CS
|
||||||
|
//if (thePnt.IsNull() || theVec.IsNull()) return NULL;
|
||||||
|
|
||||||
//Add a new Circle object
|
//Add a new Circle object
|
||||||
Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
|
Handle(GEOM_Object) aCircle = GetEngine()->AddObject(GetDocID(), GEOM_CIRCLE);
|
||||||
@ -281,13 +283,18 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeCirclePntVecR
|
|||||||
|
|
||||||
GEOMImpl_ICircle aCI (aFunction);
|
GEOMImpl_ICircle aCI (aFunction);
|
||||||
|
|
||||||
|
if (!thePnt.IsNull()) {
|
||||||
Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
|
Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
|
||||||
Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
|
if (aRefPnt.IsNull()) return NULL;
|
||||||
|
|
||||||
if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
|
|
||||||
|
|
||||||
aCI.SetCenter(aRefPnt);
|
aCI.SetCenter(aRefPnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!theVec.IsNull()) {
|
||||||
|
Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
|
||||||
|
if (aRefVec.IsNull()) return NULL;
|
||||||
aCI.SetVector(aRefVec);
|
aCI.SetVector(aRefVec);
|
||||||
|
}
|
||||||
|
|
||||||
aCI.SetRadius(theR);
|
aCI.SetRadius(theR);
|
||||||
|
|
||||||
//Compute the Circle value
|
//Compute the Circle value
|
||||||
@ -325,7 +332,9 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
|
|||||||
{
|
{
|
||||||
SetErrorCode(KO);
|
SetErrorCode(KO);
|
||||||
|
|
||||||
if (thePnt.IsNull() || theVec.IsNull()) return NULL;
|
// Not set thePnt means origin of global CS,
|
||||||
|
// Not set theVec means Z axis of global CS
|
||||||
|
//if (thePnt.IsNull() || theVec.IsNull()) return NULL;
|
||||||
|
|
||||||
//Add a new Ellipse object
|
//Add a new Ellipse object
|
||||||
Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE);
|
Handle(GEOM_Object) anEll = GetEngine()->AddObject(GetDocID(), GEOM_ELLIPSE);
|
||||||
@ -340,13 +349,18 @@ Handle(GEOM_Object) GEOMImpl_ICurvesOperations::MakeEllipse
|
|||||||
|
|
||||||
GEOMImpl_IEllipse aCI (aFunction);
|
GEOMImpl_IEllipse aCI (aFunction);
|
||||||
|
|
||||||
|
if (!thePnt.IsNull()) {
|
||||||
Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
|
Handle(GEOM_Function) aRefPnt = thePnt->GetLastFunction();
|
||||||
Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
|
if (aRefPnt.IsNull()) return NULL;
|
||||||
|
|
||||||
if (aRefPnt.IsNull() || aRefVec.IsNull()) return NULL;
|
|
||||||
|
|
||||||
aCI.SetCenter(aRefPnt);
|
aCI.SetCenter(aRefPnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!theVec.IsNull()) {
|
||||||
|
Handle(GEOM_Function) aRefVec = theVec->GetLastFunction();
|
||||||
|
if (aRefVec.IsNull()) return NULL;
|
||||||
aCI.SetVector(aRefVec);
|
aCI.SetVector(aRefVec);
|
||||||
|
}
|
||||||
|
|
||||||
aCI.SetRMajor(theRMajor);
|
aCI.SetRMajor(theRMajor);
|
||||||
aCI.SetRMinor(theRMinor);
|
aCI.SetRMinor(theRMinor);
|
||||||
|
|
||||||
|
@ -65,15 +65,22 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeCirclePntVecR
|
|||||||
//Set a not done flag
|
//Set a not done flag
|
||||||
GetOperations()->SetNotDone();
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
|
// Not set thePnt means origin of global CS,
|
||||||
|
// Not set theVec means Z axis of global CS
|
||||||
|
//if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
|
||||||
|
|
||||||
//Get the reference points
|
//Get the arguments
|
||||||
Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
|
Handle(GEOM_Object) aPnt, aVec;
|
||||||
|
if (!CORBA::is_nil(thePnt)) {
|
||||||
|
aPnt = GetOperations()->GetEngine()->GetObject
|
||||||
(thePnt->GetStudyID(), thePnt->GetEntry());
|
(thePnt->GetStudyID(), thePnt->GetEntry());
|
||||||
Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
|
if (aPnt.IsNull()) return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
if (!CORBA::is_nil(theVec)) {
|
||||||
|
aVec = GetOperations()->GetEngine()->GetObject
|
||||||
(theVec->GetStudyID(), theVec->GetEntry());
|
(theVec->GetStudyID(), theVec->GetEntry());
|
||||||
|
if (aVec.IsNull()) return aGEOMObject._retn();
|
||||||
if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
|
}
|
||||||
|
|
||||||
// Make Circle
|
// Make Circle
|
||||||
Handle(GEOM_Object) anObject =
|
Handle(GEOM_Object) anObject =
|
||||||
@ -167,15 +174,22 @@ GEOM::GEOM_Object_ptr GEOM_ICurvesOperations_i::MakeEllipse
|
|||||||
//Set a not done flag
|
//Set a not done flag
|
||||||
GetOperations()->SetNotDone();
|
GetOperations()->SetNotDone();
|
||||||
|
|
||||||
if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
|
// Not set thePnt means origin of global CS,
|
||||||
|
// Not set theVec means Z axis of global CS
|
||||||
|
//if (thePnt == NULL || theVec == NULL) return aGEOMObject._retn();
|
||||||
|
|
||||||
//Get the reference points
|
//Get the arguments
|
||||||
Handle(GEOM_Object) aPnt = GetOperations()->GetEngine()->GetObject
|
Handle(GEOM_Object) aPnt, aVec;
|
||||||
|
if (!CORBA::is_nil(thePnt)) {
|
||||||
|
aPnt = GetOperations()->GetEngine()->GetObject
|
||||||
(thePnt->GetStudyID(), thePnt->GetEntry());
|
(thePnt->GetStudyID(), thePnt->GetEntry());
|
||||||
Handle(GEOM_Object) aVec = GetOperations()->GetEngine()->GetObject
|
if (aPnt.IsNull()) return aGEOMObject._retn();
|
||||||
|
}
|
||||||
|
if (!CORBA::is_nil(theVec)) {
|
||||||
|
aVec = GetOperations()->GetEngine()->GetObject
|
||||||
(theVec->GetStudyID(), theVec->GetEntry());
|
(theVec->GetStudyID(), theVec->GetEntry());
|
||||||
|
if (aVec.IsNull()) return aGEOMObject._retn();
|
||||||
if (aPnt.IsNull() || aVec.IsNull()) return aGEOMObject._retn();
|
}
|
||||||
|
|
||||||
// Make Ellipse
|
// Make Ellipse
|
||||||
Handle(GEOM_Object) anObject =
|
Handle(GEOM_Object) anObject =
|
||||||
|
@ -500,12 +500,22 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
# @return New GEOM_Object, containing the created circle.
|
# @return New GEOM_Object, containing the created circle.
|
||||||
#
|
#
|
||||||
# @ref tui_creation_circle "Example"
|
# @ref tui_creation_circle "Example"
|
||||||
def MakeCircle(self,thePnt, theVec, theR):
|
def MakeCircle(self, thePnt, theVec, theR):
|
||||||
# Example: see GEOM_TestAll.py
|
# Example: see GEOM_TestAll.py
|
||||||
anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
|
anObj = self.CurvesOp.MakeCirclePntVecR(thePnt, theVec, theR)
|
||||||
RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
|
RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
|
## Create a circle with given radius.
|
||||||
|
# Center of the circle will be in the origin of global
|
||||||
|
# coordinate system and normal vector will be codirected with Z axis
|
||||||
|
# @param theR Circle radius.
|
||||||
|
# @return New GEOM_Object, containing the created circle.
|
||||||
|
def MakeCircleR(self, theR):
|
||||||
|
anObj = self.CurvesOp.MakeCirclePntVecR(None, None, theR)
|
||||||
|
RaiseIfFailed("MakeCirclePntVecR", self.CurvesOp)
|
||||||
|
return anObj
|
||||||
|
|
||||||
## Create a circle, passing through three given points
|
## Create a circle, passing through three given points
|
||||||
# @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
|
# @param thePnt1,thePnt2,thePnt3 Points, defining the circle.
|
||||||
# @return New GEOM_Object, containing the created circle.
|
# @return New GEOM_Object, containing the created circle.
|
||||||
@ -538,12 +548,23 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
# @return New GEOM_Object, containing the created ellipse.
|
# @return New GEOM_Object, containing the created ellipse.
|
||||||
#
|
#
|
||||||
# @ref tui_creation_ellipse "Example"
|
# @ref tui_creation_ellipse "Example"
|
||||||
def MakeEllipse(self,thePnt, theVec, theRMajor, theRMinor):
|
def MakeEllipse(self, thePnt, theVec, theRMajor, theRMinor):
|
||||||
# Example: see GEOM_TestAll.py
|
# Example: see GEOM_TestAll.py
|
||||||
anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
|
anObj = self.CurvesOp.MakeEllipse(thePnt, theVec, theRMajor, theRMinor)
|
||||||
RaiseIfFailed("MakeEllipse", self.CurvesOp)
|
RaiseIfFailed("MakeEllipse", self.CurvesOp)
|
||||||
return anObj
|
return anObj
|
||||||
|
|
||||||
|
## Create an ellipse with given radiuses.
|
||||||
|
# Center of the ellipse will be in the origin of global
|
||||||
|
# coordinate system and normal vector will be codirected with Z axis
|
||||||
|
# @param theRMajor Major ellipse radius.
|
||||||
|
# @param theRMinor Minor ellipse radius.
|
||||||
|
# @return New GEOM_Object, containing the created ellipse.
|
||||||
|
def MakeEllipseRR(self, theRMajor, theRMinor):
|
||||||
|
anObj = self.CurvesOp.MakeEllipse(None, None, theRMajor, theRMinor)
|
||||||
|
RaiseIfFailed("MakeEllipse", self.CurvesOp)
|
||||||
|
return anObj
|
||||||
|
|
||||||
## Create a polyline on the set of points.
|
## Create a polyline on the set of points.
|
||||||
# @param thePoints Sequence of points for the polyline.
|
# @param thePoints Sequence of points for the polyline.
|
||||||
# @return New GEOM_Object, containing the created polyline.
|
# @return New GEOM_Object, containing the created polyline.
|
||||||
|
@ -152,7 +152,8 @@ void PrimitiveGUI_BoxDlg::Init()
|
|||||||
|
|
||||||
initName( tr( "GEOM_BOX" ) );
|
initName( tr( "GEOM_BOX" ) );
|
||||||
|
|
||||||
ConstructorsClicked( 0 );
|
setConstructorId( 1 ); // simplest constructor
|
||||||
|
ConstructorsClicked( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -164,7 +164,8 @@ void PrimitiveGUI_ConeDlg::Init()
|
|||||||
|
|
||||||
initName( tr( "GEOM_CONE" ) );
|
initName( tr( "GEOM_CONE" ) );
|
||||||
|
|
||||||
ConstructorsClicked( 0 );
|
setConstructorId( 1 ); // simplest constructor
|
||||||
|
ConstructorsClicked( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,7 +159,9 @@ void PrimitiveGUI_CylinderDlg::Init()
|
|||||||
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||||
|
|
||||||
initName( tr( "GEOM_CYLINDER" ) );
|
initName( tr( "GEOM_CYLINDER" ) );
|
||||||
ConstructorsClicked( 0 );
|
|
||||||
|
setConstructorId( 1 ); // simplest constructor
|
||||||
|
ConstructorsClicked( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -139,7 +139,8 @@ void PrimitiveGUI_SphereDlg::Init()
|
|||||||
|
|
||||||
initName( tr( "GEOM_SPHERE" ) );
|
initName( tr( "GEOM_SPHERE" ) );
|
||||||
|
|
||||||
ConstructorsClicked( 0 );
|
setConstructorId( 1 ); // simplest constructor
|
||||||
|
ConstructorsClicked( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
@ -156,7 +156,8 @@ void PrimitiveGUI_TorusDlg::Init()
|
|||||||
|
|
||||||
initName( tr( "GEOM_TORUS" ) );
|
initName( tr( "GEOM_TORUS" ) );
|
||||||
|
|
||||||
ConstructorsClicked( 0 );
|
setConstructorId( 1 ); // simplest constructor
|
||||||
|
ConstructorsClicked( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
Loading…
Reference in New Issue
Block a user