}
else if ( myConstructorId == 1 ) { // ARC
GroupD2->setEnabled( false );
- MainWidget->RB_Dest1->setEnabled( false );
+ MainWidget->RB_Dest1->setEnabled( true );
MainWidget->RB_Dest2->setChecked( true );
DestClicked( 0 );
}
// Get setting of step value from file configuration
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
mySketchType = PT_ABS;
initSpinBox( Group2Spin->SpinBox_DX, COORD_MIN, COORD_MAX, step, "length_precision" );
}
}
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 ) {
myAngle = vx;
myRadius = vy;
}
}
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 ) {
myNewCommand = myNewCommand + "R " + QString::number( myAngle );
myNewCommand = myNewCommand + ":" + "C " + QString::number( myRadius ) + " " + QString::number( myLength );
#To Make Arc
#"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
#"WW" : Close Wire
#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
#Add In Study
else
move = none;
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':
{
if (n1 != 2) goto badargs;