1 // Copyright (c) 1999-2014 OPEN CASCADE SAS
2 //
3 // This file is part of Open CASCADE Technology software library.
4 //
5 // This library is free software; you can redistribute it and/or modify it under
6 // the terms of the GNU Lesser General Public License version 2.1 as published
7 // by the Free Software Foundation, with special exception defined in the file
8 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9 // distribution for complete text of the license and disclaimer of any warranty.
10 //
11 // Alternatively, this file may be used under the terms of Open CASCADE
12 // commercial license or contractual agreement.
13
14
15 #include <BRepOffsetAPI_MakeDraft.hxx>
16 #include <Geom_Surface.hxx>
17 #include <gp_Dir.hxx>
18 #include <Standard_NoSuchObject.hxx>
19 #include <StdFail_NotDone.hxx>
20 #include <TopoDS_Shape.hxx>
21 #include <TopoDS_Shell.hxx>
22
BRepOffsetAPI_MakeDraft(const TopoDS_Shape & Shape,const gp_Dir & Dir,const Standard_Real Angle)23 BRepOffsetAPI_MakeDraft::BRepOffsetAPI_MakeDraft(const TopoDS_Shape& Shape,
24 const gp_Dir& Dir,
25 const Standard_Real Angle)
26 : myDraft( Shape, Dir, Angle)
27 {
28 NotDone();
29 }
30
SetOptions(const BRepBuilderAPI_TransitionMode Style,const Standard_Real AngleMin,const Standard_Real AngleMax)31 void BRepOffsetAPI_MakeDraft::SetOptions(const BRepBuilderAPI_TransitionMode Style,
32 const Standard_Real AngleMin,
33 const Standard_Real AngleMax)
34 {
35 BRepFill_TransitionStyle style = BRepFill_Right;
36 if (Style == BRepBuilderAPI_RoundCorner) style = BRepFill_Round;
37 myDraft.SetOptions( style, AngleMin, AngleMax);
38 }
39
SetDraft(const Standard_Boolean IsInternal)40 void BRepOffsetAPI_MakeDraft::SetDraft(const Standard_Boolean IsInternal)
41 {
42 myDraft.SetDraft(IsInternal);
43 }
44
Perform(const Standard_Real LengthMax)45 void BRepOffsetAPI_MakeDraft::Perform(const Standard_Real LengthMax)
46 {
47 myDraft.Perform( LengthMax);
48 if (myDraft.IsDone()) {
49 Done();
50 myShape = myDraft.Shape();
51 }
52 }
53
Perform(const Handle (Geom_Surface)& Surface,const Standard_Boolean KeepInsideSurface)54 void BRepOffsetAPI_MakeDraft::Perform(const Handle(Geom_Surface)& Surface,
55 const Standard_Boolean KeepInsideSurface)
56 {
57 myDraft.Perform(Surface, KeepInsideSurface);
58 if (myDraft.IsDone()) {
59 Done();
60 myShape = myDraft.Shape();
61 }
62 }
63
Perform(const TopoDS_Shape & StopShape,const Standard_Boolean KeepOutSide)64 void BRepOffsetAPI_MakeDraft::Perform(const TopoDS_Shape& StopShape,
65 const Standard_Boolean KeepOutSide)
66 {
67 myDraft.Perform( StopShape, KeepOutSide);
68 if (myDraft.IsDone()) {
69 Done();
70 myShape = myDraft.Shape();
71 }
72 }
73
Shell() const74 TopoDS_Shell BRepOffsetAPI_MakeDraft::Shell() const
75 {
76 return myDraft.Shell();
77 }
78
Generated(const TopoDS_Shape & S)79 const TopTools_ListOfShape& BRepOffsetAPI_MakeDraft::Generated(const TopoDS_Shape& S)
80 {
81 return myDraft.Generated( S );
82 }
83
84