mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-04-25 00:42:04 +05:00
RNC: EDF 1619, Added a constructor with end point for the arcs in the sketcher 2D.
This commit is contained in:
parent
cacfca6348
commit
85fb1ecd0d
@ -396,7 +396,7 @@ void EntityGUI_SketcherDlg::TypeClicked( int constructorId )
|
|||||||
}
|
}
|
||||||
else if ( myConstructorId == 1 ) { // ARC
|
else if ( myConstructorId == 1 ) { // ARC
|
||||||
GroupD2->setEnabled( false );
|
GroupD2->setEnabled( false );
|
||||||
MainWidget->RB_Dest1->setEnabled( false );
|
MainWidget->RB_Dest1->setEnabled( true );
|
||||||
MainWidget->RB_Dest2->setChecked( true );
|
MainWidget->RB_Dest2->setChecked( true );
|
||||||
DestClicked( 0 );
|
DestClicked( 0 );
|
||||||
}
|
}
|
||||||
@ -440,7 +440,7 @@ void EntityGUI_SketcherDlg::PointClicked( int constructorId )
|
|||||||
// Get setting of step value from file configuration
|
// Get setting of step value from file configuration
|
||||||
double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
|
double step = SUIT_Session::session()->resourceMgr()->doubleValue( "Geometry", "SettingsGeomStep", 100.0 );
|
||||||
|
|
||||||
if ( myConstructorId == 0 ) { // SEGMENT
|
if ( (myConstructorId == 0) || (myConstructorId == 1) ) { // SEGMENT OR ARC
|
||||||
if ( constructorId == 1 ) { // XY
|
if ( constructorId == 1 ) { // XY
|
||||||
mySketchType = PT_ABS;
|
mySketchType = PT_ABS;
|
||||||
initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
|
initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
|
||||||
@ -1214,6 +1214,18 @@ void EntityGUI_SketcherDlg::ValueChangedInSpinBox( double newValue )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( myConstructorId == 1 ) { // ARC
|
else if ( myConstructorId == 1 ) { // ARC
|
||||||
|
if ( mySketchType == PT_ABS ) {
|
||||||
|
myX = vx;
|
||||||
|
myY = vy;
|
||||||
|
myXStr = vxStr;
|
||||||
|
myYStr = vyStr;
|
||||||
|
}
|
||||||
|
else if ( mySketchType == PT_RELATIVE ) {
|
||||||
|
myDX = vx;
|
||||||
|
myDY = vy;
|
||||||
|
myDXStr = vxStr;
|
||||||
|
myDYStr = vyStr;
|
||||||
|
}
|
||||||
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
||||||
myAngle = vx;
|
myAngle = vx;
|
||||||
myRadius = vy;
|
myRadius = vy;
|
||||||
@ -1338,6 +1350,14 @@ QString EntityGUI_SketcherDlg::GetNewCommand( QString& theParameters )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( myConstructorId == 1 ) { // ARC
|
else if ( myConstructorId == 1 ) { // ARC
|
||||||
|
if ( mySketchType == PT_ABS || mySketchType == PT_SEL ) {
|
||||||
|
myNewCommand = myNewCommand + "AA " + QString::number( myX ) + " " + QString::number( myY );
|
||||||
|
theParameters = myXStr + ":" + myYStr;
|
||||||
|
}
|
||||||
|
if ( mySketchType == PT_RELATIVE) {
|
||||||
|
myNewCommand = myNewCommand + "A " + QString::number( myDX ) + " " + QString::number( myDY );
|
||||||
|
theParameters = myDXStr + ":" + myDYStr;
|
||||||
|
}
|
||||||
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
if ( mySketchType == DIR_ANGLE_LENGTH ) {
|
||||||
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
|
||||||
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
|
||||||
|
@ -47,12 +47,14 @@ import geompy
|
|||||||
|
|
||||||
#To Make Arc
|
#To Make Arc
|
||||||
#"C radius length" : Create by direction, radius and length(in degree)
|
#"C radius length" : Create by direction, radius and length(in degree)
|
||||||
|
#"AA x y": Create by point at X & Y
|
||||||
|
#"A dx dy" : Create by point with DX & DY
|
||||||
|
|
||||||
#To finish
|
#To finish
|
||||||
#"WW" : Close Wire
|
#"WW" : Close Wire
|
||||||
|
|
||||||
#Create Sketcher
|
#Create Sketcher
|
||||||
Cmd = "Sketch:F 0 0:TT 0 100:C 100 180:WW"
|
Cmd = "Sketch:F 0 0:TT 0 100:C 100 180:AA -100 100:WW"
|
||||||
Sketcher = geompy.MakeSketcher(Cmd) #(string)->GEOM_Shape_ptr
|
Sketcher = geompy.MakeSketcher(Cmd) #(string)->GEOM_Shape_ptr
|
||||||
|
|
||||||
#Add In Study
|
#Add In Study
|
||||||
|
@ -910,6 +910,8 @@ class geompyDC(GEOM._objref_GEOM_Gen):
|
|||||||
# .
|
# .
|
||||||
# \n
|
# \n
|
||||||
# - "C radius length" : Create arc by direction, radius and length(in degree)
|
# - "C radius length" : Create arc by direction, radius and length(in degree)
|
||||||
|
# - "AA x y": Create arc by point at X & Y
|
||||||
|
# - "A dx dy" : Create arc by point with DX & DY
|
||||||
# .
|
# .
|
||||||
# \n
|
# \n
|
||||||
# - "WW" : Close Wire (to finish)
|
# - "WW" : Close Wire (to finish)
|
||||||
|
@ -245,6 +245,35 @@ Sketcher_Profile::Sketcher_Profile(const char* aCmd)
|
|||||||
move = none;
|
move = none;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'A':
|
||||||
|
{
|
||||||
|
if (n1 != 3) goto badargs;
|
||||||
|
Standard_Real vx = a(1).RealValue();
|
||||||
|
Standard_Real vy = a(2).RealValue();
|
||||||
|
if (a(0) == "AA") {
|
||||||
|
vx -= x;
|
||||||
|
vy -= y;
|
||||||
|
}
|
||||||
|
Standard_Real det = (dx * vy - dy * vx);
|
||||||
|
if ( Abs(det) > Precision::Confusion()) {
|
||||||
|
Standard_Real c = (dx * vx + dy * vy) // Cosine of alpha = arc angle / 2
|
||||||
|
/ Sqrt((dx * dx + dy * dy)
|
||||||
|
* (vx * vx + vy * vy));
|
||||||
|
radius = (vx * vx + vy * vy) // radius = distance between start
|
||||||
|
* Sqrt(dx * dx + dy * dy) // and end point / 2 * sin(alpha)
|
||||||
|
/ (2.0 * det); // radius is > 0 or < 0
|
||||||
|
if (Abs(radius) > Precision::Confusion()) {
|
||||||
|
angle = 2.0 * acos(c); // angle in [0,Pi]
|
||||||
|
move = circle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
move = none;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
move = none;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 'I':
|
case 'I':
|
||||||
{
|
{
|
||||||
if (n1 != 2) goto badargs;
|
if (n1 != 2) goto badargs;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user