1 // GEOM SKETCHER : basic sketcher
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : GEOM_Sketcher.cxx
25 // Author : Nicolas REJNERI
30 #include "GEOM_Sketcher.h"
31 #include "utilities.h"
35 #include <Geom_Axis1Placement.hxx>
36 #include <Geom_Circle.hxx>
37 #include <Geom_Line.hxx>
38 #include <Geom_CartesianPoint.hxx>
39 #include <BRep_Tool.hxx>
40 #include <BRepBuilderAPI_MakeEdge2d.hxx>
41 #include <BRepBuilderAPI_MakeEdge.hxx>
42 #include <BRepBuilderAPI_MakeVertex.hxx>
43 #include <gp_Lin2d.hxx>
47 #include <gp_Circ2d.hxx>
48 #include <gp_Vec2d.hxx>
49 #include <IntAna_IntConicQuad.hxx>
50 #include <BRepLib.hxx>
52 #include <ProjLib.hxx>
53 #include <Precision.hxx>
55 #include <BRepTools_WireExplorer.hxx>
56 #include <GccAna_Pnt2dBisec.hxx>
57 #include <GeomAPI.hxx>
58 #include <Geom2dAPI_ProjectPointOnCurve.hxx>
59 #include <Geom2d_TrimmedCurve.hxx>
60 #include <Geom2d_Circle.hxx>
61 #include <gce_MakeCirc2d.hxx>
62 #include <GccAna_Circ2d2TanRad.hxx>
63 #include <GccAna_Circ2d2TanOn.hxx>
65 #include <GccEnt_QualifiedLin.hxx>
66 #include <GccEnt_QualifiedCirc.hxx>
67 #include <GccAna_Lin2dTanPer.hxx>
68 #include <GccAna_Lin2dTanObl.hxx>
69 #include <gce_MakeLin2d.hxx>
70 #include <GCE2d_MakeArcOfCircle.hxx>
71 #include <Precision.hxx>
73 #include <AIS_Point.hxx>
74 #include <TColgp_HArray1OfPnt2d.hxx>
75 #include <Geom2dAPI_Interpolate.hxx>
76 #include <TColgp_Array1OfVec2d.hxx>
77 #include <TColStd_HArray1OfBoolean.hxx>
78 #include <GeomAPI_ProjectPointOnCurve.hxx>
79 #include <DsgPrs_ArrowSide.hxx>
80 #include <BRepBuilderAPI_Transform.hxx>
82 #include <AIS_Drawer.hxx>
83 #include <Prs3d_TextAspect.hxx>
84 #include <Prs3d_LineAspect.hxx>
85 #include <Graphic3d_NameOfFont.hxx>
87 #include <TopoDS_Wire.hxx>
90 \class GEOM_Sketcher GEOM_Sketcher.h
94 Standard_Real resol = 1.0;
118 Sketch::Sketch(const Handle(V3d_Viewer)& aViewer) :
119 myInteractiveContext(new AIS_InteractiveContext(aViewer)),
120 myAxisColor(Quantity_Color(Quantity_NOC_YELLOW)),
121 myCurrentColor(Quantity_Color(Quantity_NOC_GREEN)),
122 myWireColor(Quantity_Color(Quantity_NOC_RED))
131 \param Quantity_Color
132 \param Quantity_Color
133 \param Quantity_Color
135 Sketch::Sketch(const Handle(V3d_Viewer)& aViewer,
136 const Quantity_Color& anAxisColor,
137 const Quantity_Color& aCurrentColor,
138 const Quantity_Color& aWireColor):
139 myInteractiveContext(new AIS_InteractiveContext(aViewer)),
140 myAxisColor(anAxisColor),
141 myCurrentColor(aCurrentColor),
142 myWireColor(aWireColor)
148 Build the current edge in a graphic mode.
149 The first signature with view coordinates is used to connect to the move event from the user interface.
150 The second signature is used when the current point is known by 2d real coordinates.
156 void Sketch::MakeCurrentEdge(const Standard_Integer Xp ,
157 const Standard_Integer Yp ,
158 const Handle(V3d_View)& aView )
160 /* 3d coordinates of the picked point */
161 Standard_Real Xv,Yv,Zv;
162 aView->Convert(Xp,Yp,Xv,Yv,Zv);
163 /* computation of real 2d coordinates in plane of sketch */
164 Standard_Real Vx,Vy,Vz;
165 aView->Proj(Vx,Vy,Vz);
171 IntAna_IntConicQuad Int(L,myPlane->Pln(),Precision::Angular());
173 if (!Int.IsParallel()) {
174 if (Int.NbPoints() > 0 ) {
176 ElSLib::Parameters(myPlane->Pln(),Sol,X,Y);
180 MakeCurrentEdge(X,Y);
184 Build the current edge in a graphic mode.
185 The first signature with view coordinates is used to connect to the move event from the user interface.
186 The second signature is used when the current point is known by 2d real coordinates.
191 void Sketch::MakeCurrentEdge(const Standard_Real X, const Standard_Real Y)
193 /* Create the current edge depending on the active mode */
194 switch (myCurrentStatus) {
196 myCurrentEdge = BRepBuilderAPI_MakeVertex(ElCLib::To3d(myPlane->Pln().Position().Ax2(),gp_Pnt2d(X,Y)));
199 MakeCurrentSegment(X,Y);
202 MakeCurrentSegment(X,Y);
208 DisplayCurrentEdge();
212 Build the current edge in a graphic mode.
213 Function to connect to the input event from the user interface.
215 void Sketch::ValidateEdge()
219 switch (myCurrentStatus) {
222 myFirstPointSketch = TopoDS::Vertex(myCurrentEdge);
223 myPresentableWire = new AIS_Shape(myFirstPointSketch);
224 myPresentableWire->SetColor(myWireColor.Name());
225 myInteractiveContext->Display(myPresentableWire);
226 pt = BRep_Tool::Pnt(myFirstPointSketch);
227 pt2d = ProjLib::Project(myPlane->Pln(),pt);
230 myCurrentStatus = SEGMENT;
235 Standard_Real first,last;
237 Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,first,last);
238 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(Handle(Geom2d_Line)::DownCast(C)->Lin2d(),0.,myLengthDimension->Value());
239 if (myTransitionStatus == ANGLE ||
240 myTransitionStatus == LENGTH_FIXED ||
241 myTransitionStatus == X_FIXED ||
242 myTransitionStatus == Y_FIXED)
243 myTransitionStatus = NOCONSTRAINT;
249 myInteractiveContext->CloseLocalContext();
250 myInteractiveContext->OpenLocalContext();
251 gp_Pnt2d p1 (myLastX,myLastY);
252 pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myCurrentEdge)));
253 gp_Pnt2d p2 = ProjLib::Project(myPlane->Pln(),pt);
254 GccAna_Pnt2dBisec ComputeMediatrice(p1,p2);
255 if (ComputeMediatrice.HasSolution()) {
256 myMediatrice = new Geom2d_Line(ComputeMediatrice.ThisSolution());
257 Handle(Geom_Curve) aMediatrice3d = GeomAPI::To3d(myMediatrice,myPlane->Pln());
258 myPresentableMediatrice = new AIS_Axis(Handle(Geom_Line)::DownCast(aMediatrice3d));
259 myInteractiveContext->Display(myPresentableMediatrice);
261 TopoDS_Edge e = BRepBuilderAPI_MakeEdge2d(gce_MakeCirc2d(gp_Pnt2d(0.,0),1.));
262 BRepLib::BuildCurve3d(e);
263 myLengthDimension->SetText(TCollection_ExtendedString());
264 myInteractiveContext->Redisplay(myLengthDimension,Standard_False);
265 if (myEdgesNumber == 0)
266 myPreviousEdge = TopoDS::Edge(myCurrentEdge);
267 pt2d = ProjLib::Project(myPlane->Pln(),pt);
270 myTransitionStatus = NOCONSTRAINT;
271 myCurrentStatus = ARC_CHORD_END;
275 myCurrentStatus = ARC_CHORD;
282 Add edge to current wire on an edge validation .
284 void Sketch::AddEdgeToWire()
286 myPreviousEdge = TopoDS::Edge(myCurrentEdge);
287 BRepLib::BuildCurve3d(myPreviousEdge);
288 myCurrentWire.Add(TopoDS::Edge(myPreviousEdge));
290 myPresentableWire->Set( myCurrentWire.Wire() );
291 myInteractiveContext->Redisplay(myPresentableWire);
292 myConstructionMode.Append(myCurrentStatus);
293 myConstraintMode.Append(myTransitionStatus);
294 myInteractiveContext->CloseLocalContext();
296 if (myPreviousEdge.Orientation() == TopAbs_FORWARD )
297 pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myPreviousEdge)));
299 pt = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(myPreviousEdge)));
300 gp_Pnt2d pt2d= ProjLib::Project(myPlane->Pln(),pt);
306 Set the numeric dimension for the current edge and validate creation.
309 \return Standard_Boolean
311 Standard_Boolean Sketch::SetDimension(Standard_Real& aValue)
314 if (myCurrentStatus == SEGMENT ||
315 myCurrentStatus == ARC_CHORD){
316 Standard_Real first,last;
318 Handle(Geom2d_Curve) C =
319 BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,first,last);
321 BRepBuilderAPI_MakeEdge2d(Handle(Geom2d_Line)::DownCast(C)->Lin2d(),0.,aValue);
322 DisplayCurrentEdge();
323 if (myTransitionStatus == NOCONSTRAINT) {
324 mySegmentLength = aValue;
325 myTransitionStatus = LENGTH_FIXED;
329 return Standard_True;
332 else if( myCurrentStatus == ARC_CHORD_END){
333 if (myTransitionStatus == TANGENT) return Standard_False;
335 if (myEdgesNumber > 0) {
336 if (myPreviousEdge.Orientation() == TopAbs_FORWARD)
337 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge)));
339 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge)));
342 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(myFirstPointSketch));
343 GccAna_Circ2d2TanRad aSol(p, gp_Pnt2d(myLastX,myLastY),aValue,Precision::Confusion());
344 Standard_Real dist = RealLast();
345 if (aSol.NbSolutions() > 0) {
347 gp_Pnt2d pc = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopoDS::Vertex(myCenterCircle->Shape())));
348 for (Standard_Integer i =1; i<= aSol.NbSolutions(); i++) {
349 if (pc.Distance(aSol.ThisSolution(i).Location()) < dist)
350 CirSol = aSol.ThisSolution(i);
352 if (myCurrentEdge.Orientation() == TopAbs_FORWARD)
353 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),p,gp_Pnt2d(myLastX,myLastY));
355 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),gp_Pnt2d(myLastX,myLastY),p);
356 myCurrentEdge.Reverse();
358 DisplayCurrentEdge();
360 return Standard_True;
364 return Standard_False;
368 Set the numeric dimension for the current edge and validate creation.
373 void Sketch::SetDimension(Standard_Real& deltaX, Standard_Real& deltaY)
377 Standard_Real X = myLastX + deltaX;
378 Standard_Real Y = myLastY + deltaY;
379 MakeCurrentEdge(X,Y);
384 Set the numeric value of the X coordinate of current point giving a deltaX relative to previous point.
388 void Sketch::SetXDimension(Standard_Real& deltaX)
391 Standard_Real X = myLastX + deltaX;
392 Standard_Real Y = myLastY;
394 Y = Y + 100.0 * Precision::Confusion();
396 if (myTransitionStatus == NOCONSTRAINT) {
397 MakeCurrentEdge(X,Y);
398 myTransitionStatus = X_FIXED;
401 else if (myTransitionStatus == Y_FIXED) {
402 myTransitionStatus = NOCONSTRAINT;
403 MakeCurrentEdge(X,mySegmentY);
406 else if (myTransitionStatus == ANGLE) {
407 myTransitionStatus = NOCONSTRAINT;
409 if (0 <= mySegmentAngle && mySegmentAngle<= PI )
410 angle = PI - mySegmentAngle;
412 angle = mySegmentAngle - PI;
414 MakeCurrentEdge(X,Y);
418 myTransitionStatus = NOCONSTRAINT;
422 Set the numeric value of the Y coordinate of current point giving a deltaY relative to previous point.
426 void Sketch::SetYDimension(Standard_Real& deltaY)
429 Standard_Real X = myLastX;
430 Standard_Real Y = myLastY + deltaY;
433 X = X + 100.0 * Precision::Confusion();
435 if (myTransitionStatus == NOCONSTRAINT) {
436 MakeCurrentEdge(X,Y);
437 myTransitionStatus = Y_FIXED;
440 else if (myTransitionStatus == X_FIXED) {
441 myTransitionStatus = NOCONSTRAINT;
442 MakeCurrentEdge(mySegmentX,Y);
445 else if (myTransitionStatus == ANGLE) {
446 myTransitionStatus = NOCONSTRAINT;
448 if (0 <= mySegmentAngle && mySegmentAngle<= PI )
449 angle = PI - mySegmentAngle;
451 angle = mySegmentAngle - PI;
453 MakeCurrentEdge(X,Y);
457 myTransitionStatus = NOCONSTRAINT;
461 Set the numeric value of angle between 2 segments.
465 void Sketch::SetSegmentAngle(Standard_Real& aValue)
467 if (myEdgesNumber > 0) {
468 Standard_Real First,Last;
471 if (0 <= aValue && aValue<= PI )
475 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last);
476 if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) {
477 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last);
479 GccAna_Lin2dTanObl aSol(gp_Pnt2d(myLastX,myLastY),Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d(),angle);
480 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),0.,myLengthDimension->Value());
482 if (myTransitionStatus == LENGTH_FIXED) {
485 else if (myTransitionStatus == X_FIXED) {
486 Standard_Real length = mySegmentX/Cos(angle);
487 SetDimension(length);
490 else if (myTransitionStatus == Y_FIXED) {
491 Standard_Real length = mySegmentY/Sin(angle);
492 SetDimension(length);
496 mySegmentAngle = aValue;
497 myTransitionStatus = ANGLE;
503 Get the angle value between 2 segments.
505 \return Standard_Real
507 Standard_Real Sketch::GetSegmentAngle()
509 return mySegmentAngle;
513 Close automatically an open sketch.
515 \return TopoDS_Wire. Return null shape if not possible.
517 TopoDS_Wire Sketch::Close()
519 myCurrentStatus = END_SKETCH;
520 myInteractiveContext->CloseAllContexts();
521 myInteractiveContext->EraseAll(Standard_False);
522 if (myEdgesNumber >= 2) {
523 BRepTools_WireExplorer Ex(myCurrentWire.Wire());
525 if (myPreviousEdge.Orientation() == TopAbs_FORWARD)
526 V1 = TopExp::LastVertex(myPreviousEdge);
528 V1 = TopExp::FirstVertex(myPreviousEdge);
529 myCurrentWire.Add(BRepBuilderAPI_MakeEdge(V1,myFirstPointSketch).Edge());
531 return myCurrentWire.Wire();
534 return TopoDS_Wire();
540 Clear sketch presentation.
544 myCurrentStatus = END_SKETCH;
545 myInteractiveContext->CloseAllContexts();
546 myInteractiveContext->EraseAll(Standard_False);
550 Terminate sketch without closing.
552 \return TopoDS_Wire. Return null shape if not possible.
554 TopoDS_Wire Sketch::End()
556 myCurrentStatus = END_SKETCH;
557 myInteractiveContext->CloseAllContexts();
558 myInteractiveContext->EraseAll(Standard_False);
559 if (myCurrentWire.IsDone()) {
560 return myCurrentWire.Wire();
563 return TopoDS_Wire();
570 Standard_Boolean Sketch::Delete()
572 myInteractiveContext->Erase(myAngleDimension,Standard_True,Standard_False);
573 myInteractiveContext->Erase(myLengthDimension,Standard_True,Standard_False);
574 myInteractiveContext->Erase(myRadiusDimension,Standard_True,Standard_False);
575 myInteractiveContext->Erase(myCenterCircle,Standard_True,Standard_False);
576 myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False);
577 myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False);
579 if (myCurrentStatus == BEGIN_SKETCH) {
580 myCurrentStatus = END_SKETCH;
581 myInteractiveContext->CloseAllContexts();
582 myInteractiveContext->EraseAll(Standard_False);
585 else if(myCurrentStatus == SEGMENT ||
586 myCurrentStatus == ARC_CHORD ) {
589 else if(myCurrentStatus == ARC_CHORD_END) {
590 myCurrentStatus = ARC_CHORD;
591 myInteractiveContext->CloseAllContexts();
594 if (myEdgesNumber == 0) {
595 //myInteractiveContext->EraseAll(Standard_False);
596 ChangeMode(BEGIN_SKETCH); // DCQ
597 pt = BRep_Tool::Pnt(myFirstPointSketch);
600 if (myPreviousEdge.Orientation() == TopAbs_FORWARD )
601 pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myPreviousEdge)));
603 pt = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(myPreviousEdge)));
605 gp_Pnt2d pt2d= ProjLib::Project(myPlane->Pln(),pt);
613 Set a specific plane for sketch.
617 void Sketch::SetPlane(const Handle(Geom_Plane)& aPlane)
623 Set display parameters.
627 void Sketch::SetWireColor(const Quantity_Color& aColor)
629 myWireColor = aColor;
633 Set display parameters.
637 void Sketch::SetCurrentColor(const Quantity_Color& aColor)
639 myCurrentColor = aColor;
643 Set display parameters.
647 void Sketch::SetAxisColor(const Quantity_Color& aColor)
649 myAxisColor = aColor;
654 Change mode of construction line.
656 \param aMode : SEGMENT, ARC_CHORD.
658 void Sketch::ChangeMode(const SketchStatus aMode)
661 if (myEdgesNumber > 0) {
662 if (myPreviousEdge.Orientation() == TopAbs_FORWARD)
663 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge)));
665 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge)));
668 myInteractiveContext->CloseLocalContext(myInteractiveContext->IndexOfCurrentLocal());
670 if (!myCurrentStatus == BEGIN_SKETCH)
671 myCurrentStatus = aMode; /* change the mode only when the sketch is not in state BEGIN_SKETCH, i.d. fist point has been fixed */
676 Set transition constraint between consecutive edges.
678 \param aStatus : NOCONSTRAINT, TANGENT, PERPENDICULAR, ANGLE, LENGTH_FIXED, X_FIXED, Y_FIXED.
680 void Sketch::SetTransitionStatus(const TransitionStatus aStatus)
682 myTransitionStatus = aStatus;
686 Set or unset the display of dimensions.
691 void Sketch::SetParameterVisibility(const TypeOfParameter atype, const Standard_Boolean OnOff)
694 case ANGLE_PARAMETER:
695 myIsAngleDimensionVisible = OnOff;
696 if (!myIsAngleDimensionVisible && !myAngleDimension.IsNull())
697 myInteractiveContext->Erase(myAngleDimension,Standard_True,Standard_False);
699 // DisplayCurrentEdge();
701 case LENGTH_PARAMETER:
702 myIsLengthDimensionVisible = OnOff;
703 if (!myIsLengthDimensionVisible&& !myLengthDimension.IsNull())
704 myInteractiveContext->Erase(myLengthDimension,Standard_True,Standard_False);
706 // DisplayCurrentEdge();
708 case RADIUS_PARAMETER:
709 myIsRadiusDimensionVisible = OnOff;
710 if (!myIsRadiusDimensionVisible&& !myRadiusDimension.IsNull()){
711 myInteractiveContext->Erase(myRadiusDimension,Standard_True,Standard_False);
712 myInteractiveContext->Erase(myCenterCircle,Standard_True,Standard_False);
715 // DisplayCurrentEdge();
717 case XVALUE_PARAMETER:
718 myIsXDimensionVisible = OnOff;
719 if (!myIsXDimensionVisible&& !myXDimension.IsNull())
720 myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False);
722 case YVALUE_PARAMETER:
723 myIsYDimensionVisible = OnOff;
724 if (!myIsYDimensionVisible&& !myYDimension.IsNull())
725 myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False);
736 void Sketch::HiligthWithColor(const TypeOfParameter atype, const Quantity_NameOfColor acolor)
739 case ANGLE_PARAMETER:
740 myInteractiveContext->HilightWithColor(myAngleDimension, acolor);
742 case LENGTH_PARAMETER:
743 myInteractiveContext->HilightWithColor(myLengthDimension, acolor);
745 case RADIUS_PARAMETER:
746 myInteractiveContext->HilightWithColor(myRadiusDimension, acolor);
748 case XVALUE_PARAMETER:
749 myInteractiveContext->HilightWithColor(myXDimension, acolor);
751 case YVALUE_PARAMETER:
752 myInteractiveContext->HilightWithColor(myYDimension, acolor);
759 Unhilight parameters.
763 void Sketch::Unhiligth(const TypeOfParameter atype)
766 case ANGLE_PARAMETER:
767 myInteractiveContext->Unhilight(myAngleDimension);
769 case LENGTH_PARAMETER:
770 myInteractiveContext->Unhilight(myLengthDimension);
772 case RADIUS_PARAMETER:
773 myInteractiveContext->Unhilight(myRadiusDimension);
775 case XVALUE_PARAMETER:
776 myInteractiveContext->Unhilight(myXDimension);
778 case YVALUE_PARAMETER:
779 myInteractiveContext->Unhilight(myYDimension);
785 Check if the edition of a type of parameter is relevant depending on sketch current status.
788 \return Standard_Boolean
790 Standard_Boolean Sketch::IsValidCurrentParameter(const TypeOfParameter atype)
793 case ANGLE_PARAMETER:
794 if (myCurrentStatus != SEGMENT && myCurrentStatus != ARC_CHORD)
795 return Standard_False;
796 else if (myTransitionStatus == TANGENT || myTransitionStatus == PERPENDICULAR)
797 return Standard_False;
798 else if (myEdgesNumber < 1)
799 return Standard_False;
802 Standard_Real First,Last;
803 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last);
804 if (!PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line)))
805 return Standard_False;
808 case LENGTH_PARAMETER:
809 if (myCurrentStatus != SEGMENT &&
810 myCurrentStatus != ARC_CHORD /*&&
811 myCurrentStatus != CURVE_POINTS*/
813 return Standard_False;
814 else if (myTransitionStatus == LENGTH_FIXED)
815 return Standard_False;
817 case RADIUS_PARAMETER:
818 if (myCurrentStatus != ARC_CHORD_END)
819 return Standard_False;
821 case XVALUE_PARAMETER:
822 if (myCurrentStatus != SEGMENT &&
823 myCurrentStatus != ARC_CHORD /*&&
824 myCurrentStatus != CURVE_POINTS*/
826 return Standard_False;
827 else if (myTransitionStatus == X_FIXED)
828 return Standard_False;
830 case YVALUE_PARAMETER:
831 if (myCurrentStatus != SEGMENT &&
832 myCurrentStatus != ARC_CHORD /*&&
833 myCurrentStatus != CURVE_POINTS*/
835 return Standard_False;
836 else if (myTransitionStatus == Y_FIXED)
837 return Standard_False;
840 return Standard_True;
844 Set a parameter value.
849 void Sketch::SetParameterValue(const TypeOfParameter atype, Standard_Real aValue)
852 case ANGLE_PARAMETER:
853 SetSegmentAngle(aValue);
855 case LENGTH_PARAMETER:
856 SetDimension(aValue);
858 case RADIUS_PARAMETER:
859 SetDimension(aValue);
861 case XVALUE_PARAMETER:
862 SetXDimension(aValue);
864 case YVALUE_PARAMETER:
865 SetYDimension(aValue);
871 Initialisation of sketch parameters or options.
875 myPlane = new Geom_Plane (0.,0.,1.,0.);
877 BRepLib::Plane(myPlane);
879 myCurrentStatus = BEGIN_SKETCH;
880 /* In order to update the visulisation of current objects by using Redisplay method from InteractiveContext */
881 myCurrentEdge = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.));
882 myPresentableEdge = new AIS_Shape(myCurrentEdge);
883 myPresentableEdge->SetColor(myCurrentColor.Name());
884 myInteractiveContext->Display(myPresentableEdge);
885 myTransitionStatus = NOCONSTRAINT;
886 /* Init for display objects */
887 TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.));
888 TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(10.,0.,0.));
889 myLengthDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString());
890 myXDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString(),gp_Pnt(),DsgPrs_AS_NONE,
892 myYDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString(),gp_Pnt(),DsgPrs_AS_NONE,
894 myRadiusDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString());
895 myCenterCircle = new AIS_Shape(V1);
896 myIsLengthDimensionVisible = Standard_False;
897 myIsXDimensionVisible = Standard_False;
898 myIsYDimensionVisible = Standard_False;
899 myIsRadiusDimensionVisible = Standard_False;
903 Build the current segment.
908 void Sketch::MakeCurrentSegment(Standard_Real X, Standard_Real Y)
910 if (myTransitionStatus == NOCONSTRAINT)
911 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y));
912 else if (myTransitionStatus == X_FIXED)
913 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),gp_Pnt2d(mySegmentX,Y));
914 else if (myTransitionStatus == Y_FIXED)
915 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),gp_Pnt2d(X,mySegmentY));
916 else if (myTransitionStatus == TANGENT && myEdgesNumber > 0) {
917 Standard_Real first,last;
919 Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last);
922 if (myPreviousEdge.Orientation() == TopAbs_FORWARD)
926 gp_Lin2d aline(p1,Vt);
927 Geom2dAPI_ProjectPointOnCurve proj(gp_Pnt2d(X,Y),new Geom2d_Line(aline));
928 if (proj.NbPoints() > 0)
929 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(p1,proj.Point(1));
931 else if (myTransitionStatus == PERPENDICULAR && myEdgesNumber > 0) {
932 Standard_Real first,last;
934 Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last);
937 if (myPreviousEdge.Orientation() == TopAbs_FORWARD)
941 if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) {
942 GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Line)::DownCast(C)->Lin2d());
943 perpen = aSol.ThisSolution(1);
945 else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
946 GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Circle)::DownCast(C)->Circ2d());
947 perpen = aSol.ThisSolution(1);
949 Geom2dAPI_ProjectPointOnCurve proj(gp_Pnt2d(X,Y),new Geom2d_Line(perpen));
950 if (proj.NbPoints() > 0)
951 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(p1,proj.Point(1));
953 else if (myTransitionStatus == ANGLE && myEdgesNumber > 0) {
954 Standard_Real First,Last;
956 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last);
957 if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) {
958 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last);
960 if (0 <= mySegmentAngle && mySegmentAngle<= PI )
961 angle = PI - mySegmentAngle;
963 angle = mySegmentAngle - PI;
964 GccAna_Lin2dTanObl aSol(gp_Pnt2d(myLastX,myLastY),Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d(),angle);
965 Standard_Real dist = RealLast();
966 gp_Pnt2d pt(X,Y),ptproj;
967 for (Standard_Integer i =1; i<=aSol.NbSolutions(); i++) {
968 Geom2dAPI_ProjectPointOnCurve proj(pt,new Geom2d_Line(aSol.ThisSolution(i)));
969 if (pt.Distance(proj.Point(1)) < dist) {
970 dist = pt.Distance(proj.Point(1));
971 ptproj = proj.Point(1);
974 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),ptproj);
977 else if (myTransitionStatus == LENGTH_FIXED && myEdgesNumber > 0) {
978 Standard_Real First,Last;
980 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last);
981 if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) {
982 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last);
983 gp_Lin2d aline = gce_MakeLin2d(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y));
984 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aline,0.,mySegmentLength);
990 Build the current arc.
995 void Sketch::MakeCurrentArc(Standard_Real X, Standard_Real Y)
998 Standard_Boolean OK(Standard_False);
1000 if (myTransitionStatus == NOCONSTRAINT) {
1001 GccAna_Circ2d2TanOn aSol(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y),myMediatrice->Lin2d(),Precision::Confusion());
1002 if (aSol.NbSolutions() > 0){
1003 CircSol = aSol.ThisSolution(1);
1007 /* Tangency with previous edge */
1008 else if (myTransitionStatus == TANGENT && myEdgesNumber > 0) {
1009 Standard_Real first,last;
1011 Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last);
1012 if (C->IsKind(STANDARD_TYPE(Geom2d_Line))){
1013 GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(Handle(Geom2d_Line)::DownCast(C)->Lin2d()), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion());
1014 if (aSol.NbSolutions() > 0){
1015 CircSol = aSol.ThisSolution(1);
1019 else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
1020 GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(Handle(Geom2d_Circle)::DownCast(C)->Circ2d()), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion());
1021 if (aSol.NbSolutions() > 0){
1022 CircSol = aSol.ThisSolution(1);
1026 else if(C->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve))) {
1030 gp_Lin2d alin2d(pc,gp_Dir2d(Vt));
1031 GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(alin2d), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion());
1032 if (aSol.NbSolutions() > 0){
1033 CircSol = aSol.ThisSolution(1);
1038 /* Tangency with the perpendicular to the previous edge */
1039 else if (myTransitionStatus == PERPENDICULAR && myEdgesNumber > 0) {
1040 Standard_Real first,last;
1042 Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last);
1045 if (myPreviousEdge.Orientation() == TopAbs_FORWARD)
1049 if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) {
1050 GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Line)::DownCast(C)->Lin2d());
1051 perpen = aSol.ThisSolution(1);
1053 else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) {
1054 GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Circle)::DownCast(C)->Circ2d());
1055 perpen = aSol.ThisSolution(1);
1057 GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(perpen), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion());
1058 if (aSol.NbSolutions() > 0){
1059 CircSol = aSol.ThisSolution(1);
1065 if (myEdgesNumber > 0) {
1066 if (myPreviousEdge.Orientation() == TopAbs_FORWARD)
1067 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge)));
1069 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge)));
1072 p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(myFirstPointSketch));
1074 gp_Vec2d V1(p,gp_Pnt2d(X,Y));
1075 gp_Vec2d V2(p,gp_Pnt2d(myLastX,myLastY));
1076 if (V1.Angle(V2) > 0 )
1077 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(CircSol,p,gp_Pnt2d(myLastX,myLastY));
1079 myCurrentEdge = BRepBuilderAPI_MakeEdge2d(CircSol,gp_Pnt2d(myLastX,myLastY),p);
1080 myCurrentEdge.Reverse();
1084 myCurrentStatus = ARC_CHORD;
1087 myInteractiveContext->CloseLocalContext();
1093 Display the current edge under construction with it's dimension.
1095 void Sketch::DisplayCurrentEdge()
1097 myPresentableEdge->Set(myCurrentEdge);
1098 myInteractiveContext->Redisplay(myPresentableEdge);
1099 if (myCurrentStatus == SEGMENT ||
1100 myCurrentStatus == ARC_CHORD ) {
1101 /* Length dimension */
1102 TopoDS_Vertex V1 = TopExp::FirstVertex(TopoDS::Edge(myCurrentEdge));
1103 TopoDS_Vertex V2 = TopExp::LastVertex(TopoDS::Edge(myCurrentEdge));
1104 DisplayLengthDimension(V1,V2);
1105 /* Angular dimension */
1106 DisplayAngleDimension();
1107 DisplayXDimension(V1,V2);
1108 DisplayYDimension(V1,V2);
1110 else if (myCurrentStatus == ARC_CHORD_END )
1111 DisplayRadiusDimension();
1113 TopoDS_Vertex V1 = TopoDS::Vertex(myCurrentEdge);
1114 TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.));
1115 DisplayXDimension(V1,V2);
1116 DisplayYDimension(V1,V2);
1122 Display the current length dimension.
1127 void Sketch::DisplayLengthDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2)
1129 gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1));
1130 gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2));
1131 Standard_Real length = p1.Distance(p2);
1132 if (length <= Precision::Confusion()) return;
1133 myLengthDimension->SetFirstShape(V1);
1134 myLengthDimension->SetSecondShape(V2);
1136 myLengthDimension->SetValue(length);
1138 S.sprintf("%.1f",length);
1139 myLengthDimension->SetText(TCollection_ExtendedString(strdup(S)));
1140 if (myIsLengthDimensionVisible) {
1141 if (myInteractiveContext->IsDisplayed(myLengthDimension))
1142 myInteractiveContext->Redisplay(myLengthDimension);
1144 myInteractiveContext->Display(myLengthDimension);
1149 Display the current X dimension.
1154 void Sketch::DisplayXDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2)
1156 if (myTransitionStatus != X_FIXED) {
1157 gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1));
1158 gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2));
1160 gp_Lin aline(p1,myPlane->Pln().XAxis().Direction());
1161 GeomAPI_ProjectPointOnCurve proj(p2,new Geom_Line(aline));
1165 if (proj.NbPoints() > 0) {
1166 Standard_Real length = p1.Distance(proj.Point(1));
1167 if (length <= Precision::Confusion()) return;
1168 myXDimension->SetFirstShape(V1);
1169 myXDimension->SetSecondShape(V2);
1171 myXDimension->SetValue(length);
1173 S.sprintf("%.1f",length);
1174 myXDimension->SetText(TCollection_ExtendedString(strdup(S)));
1175 // myXDimension->SetPosition(proj.Point(1));
1176 pb.BaryCenter(5,proj.Point(1),5);
1177 myXDimension->SetPosition(pb);
1178 if (myIsXDimensionVisible) {
1179 if (myInteractiveContext->IsDisplayed(myXDimension))
1180 myInteractiveContext->Redisplay(myXDimension);
1182 myInteractiveContext->Display(myXDimension);
1186 myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False);
1190 Display the current Y dimension.
1195 void Sketch::DisplayYDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2)
1197 if (myTransitionStatus != Y_FIXED) {
1199 gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1));
1200 gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2));
1201 gp_Lin aline(p2 /*p1*/, myPlane->Pln().YAxis().Direction());
1202 gp_Pnt pb = p2 /*p1*/;
1203 GeomAPI_ProjectPointOnCurve proj(p1 /*p2*/,new Geom_Line(aline));
1204 if (proj.NbPoints() > 0) {
1205 Standard_Real length = /*p1*/ p2.Distance(proj.Point(1));
1206 if (length <= Precision::Confusion()) return;
1207 myYDimension->SetFirstShape(V1);
1208 myYDimension->SetSecondShape(V2);
1210 myYDimension->SetValue(length);
1212 S.sprintf("%.1f",length);
1213 myYDimension->SetText(TCollection_ExtendedString(strdup(S)));
1214 pb.BaryCenter(5,proj.Point(1),5);
1215 myYDimension->SetPosition(pb);
1216 // myYDimension->SetPosition(p2);
1217 if (myIsYDimensionVisible) {
1218 if (myInteractiveContext->IsDisplayed(myYDimension))
1219 myInteractiveContext->Redisplay(myYDimension);
1221 myInteractiveContext->Display(myYDimension);
1225 myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False);
1229 Display the current angle dimension.
1231 void Sketch::DisplayAngleDimension()
1233 if (!myIsAngleDimensionVisible)
1235 if (myEdgesNumber > 0) {
1236 Standard_Real First,Last;
1238 Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last);
1239 Handle (Geom2d_Curve) CurrentCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,First,Last);
1240 if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line)) && CurrentCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) {
1241 Standard_Real angle = Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d().Angle(Handle(Geom2d_Line)::DownCast(CurrentCurve)->Lin2d());
1243 if (0 <= angle && angle<= PI)
1247 CurrentCurve->D0((First+Last)/5.,apos);
1248 gp_Pnt apos3d = ElCLib::To3d(myPlane->Pln().Position().Ax2(),apos);
1249 Standard_Real angtext = angle*180./PI;
1250 mySegmentAngle = angle;
1251 BRepLib::BuildCurve3d(TopoDS::Edge(myCurrentEdge));
1252 fitInResol(angtext);
1255 S.sprintf("%.1f",angtext);
1256 if (myInteractiveContext->IndexOfCurrentLocal() == 0) {
1257 myInteractiveContext->OpenLocalContext();
1258 myAngleDimension = new AIS_AngleDimension(myPreviousEdge,TopoDS::Edge(myCurrentEdge),myPlane,angle,
1259 TCollection_ExtendedString(strdup(S)));
1260 myInteractiveContext->Display(myAngleDimension);
1263 myAngleDimension->SetSecondShape(myCurrentEdge);
1264 myAngleDimension->SetValue(angle);
1265 myAngleDimension->SetPosition(apos3d);
1266 myAngleDimension->SetText(TCollection_ExtendedString(strdup(S)));
1267 myInteractiveContext->Redisplay(myAngleDimension);
1274 Display the current radius dimension.
1276 void Sketch::DisplayRadiusDimension()
1278 if (! myIsRadiusDimensionVisible)
1280 BRepLib::BuildCurve3d(TopoDS::Edge(myCurrentEdge));
1281 Standard_Real First,Last;
1282 Handle (Geom_Circle) C = Handle (Geom_Circle)::DownCast(BRep_Tool::Curve(TopoDS::Edge(myCurrentEdge),First,Last));
1284 Standard_Real R = C->Radius();
1285 TopoDS_Shape V1 = BRepBuilderAPI_MakeVertex(C->Location());
1287 C->D0((First+Last)/2.,MidlePoint);
1288 TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(MidlePoint);
1289 myRadiusDimension->SetFirstShape(V1);
1290 myRadiusDimension->SetSecondShape(V2);
1291 myRadiusDimension->SetValue(R);
1294 S.sprintf("%.1f",R);
1295 myRadiusDimension->SetText(TCollection_ExtendedString(strdup(S)));
1296 if (myInteractiveContext->IsDisplayed(myRadiusDimension))
1297 myInteractiveContext->Redisplay(myRadiusDimension);
1299 myInteractiveContext->Display(myRadiusDimension);
1300 myCenterCircle->Set(V1);
1301 if (myInteractiveContext->IsDisplayed(myCenterCircle))
1302 myInteractiveContext->Redisplay(myCenterCircle);
1304 myInteractiveContext->Display(myCenterCircle);
1309 Remove last edge from the current wire.
1311 void Sketch::RemoveLastEdge()
1313 if (myEdgesNumber == 0) {
1314 myCurrentStatus = END_SKETCH;
1315 myInteractiveContext->CloseAllContexts();
1316 myInteractiveContext->EraseAll(Standard_False);
1320 BRepTools_WireExplorer Ex;
1321 BRepBuilderAPI_MakeWire MW;
1322 Standard_Integer index = 1;
1323 myCurrentEdge = myPreviousEdge;
1324 for (Ex.Init(myCurrentWire.Wire());Ex.More();Ex.Next()){
1325 if (index <= myEdgesNumber-1) {
1326 MW.Add(Ex.Current());
1327 myPreviousEdge = Ex.Current();
1332 myCurrentStatus = (SketchStatus)myConstructionMode(myEdgesNumber);
1333 myTransitionStatus = (TransitionStatus)myConstraintMode(myEdgesNumber);
1335 myConstructionMode.Remove(index);
1336 myConstraintMode.Remove(index);
1337 if (myEdgesNumber == 0)
1338 myPresentableWire->Set(myFirstPointSketch);
1340 myPresentableWire->Set(myCurrentWire.Wire());
1341 myInteractiveContext->Redisplay(myPresentableWire);
1342 myInteractiveContext->CloseLocalContext();
1343 myPresentableEdge->Set(myCurrentEdge);
1344 myInteractiveContext->Redisplay(myPresentableEdge);
1349 Create initial constraints.
1351 void Sketch::CreateConstraints()
1353 Handle(Geom_Axis1Placement) xAxis = new Geom_Axis1Placement(myPlane->Pln().XAxis());
1354 Handle(Geom_Axis1Placement) yAxis = new Geom_Axis1Placement(myPlane->Pln().YAxis());
1355 myHAxis = new AIS_Axis(xAxis);
1356 myVAxis = new AIS_Axis(yAxis);
1357 myAngularAxis = myVAxis;
1358 myHAxis->SetColor(myAxisColor.Name());
1359 myVAxis->SetColor(myAxisColor.Name());
1360 myAngularAxis->SetColor(myAxisColor.Name());
1369 void Sketch::fitInResol(Standard_Real &toFit, Standard_Boolean minIsResol)
1371 Standard_Real sign = (toFit < 0) ? -1. : +1.;
1372 Standard_Real value = toFit + sign * resol/2.0; /* why "+ resol/2.0" ? because if resol = 0.5, 3.3 is rounded to 3.5 */
1373 int nTimesResol = int(value/resol);
1374 if ((nTimesResol == 0) && (minIsResol)) nTimesResol = 1;
1375 toFit = nTimesResol*resol;
1378 SketchStatus Sketch::GetCurrentStatus()
1380 return myCurrentStatus;
1383 Standard_Integer Sketch::GetmyEdgesNumber()
1385 return myEdgesNumber;