Commit | Line | Data |
---|---|---|

7fd59977 | 1 | -- File: BRepBuilderAPI_MakePolygon.cdl |

2 | -- Created: Thu Jul 29 11:39:48 1993 | |

3 | -- Author: Remi LEQUETTE | |

4 | -- <rle@phylox> | |

5 | ---Copyright: Matra Datavision 1993 | |

6 | ||

7 | ||

8 | class MakePolygon from BRepBuilderAPI inherits MakeShape from BRepBuilderAPI | |

9 | ||

10 | ---Purpose: Describes functions to build polygonal wires. A | |

11 | -- polygonal wire can be built from any number of points | |

12 | -- or vertices, and consists of a sequence of connected | |

13 | -- rectilinear edges. | |

14 | -- When a point or vertex is added to the polygon if | |

15 | -- it is identic to the previous point no edge is | |

16 | -- built. The method added can be used to test it. | |

17 | -- Construction of a Polygonal Wire | |

18 | -- You can construct: | |

19 | -- - a complete polygonal wire by defining all its points | |

20 | -- or vertices (limited to four), or | |

21 | -- - an empty polygonal wire and add its points or | |

22 | -- vertices in sequence (unlimited number). | |

23 | -- A MakePolygon object provides a framework for: | |

24 | -- - initializing the construction of a polygonal wire, | |

25 | -- - adding points or vertices to the polygonal wire under construction, and | |

26 | -- - consulting the result. | |

27 | ||

28 | uses | |

29 | Wire from TopoDS, | |

30 | Edge from TopoDS, | |

31 | Vertex from TopoDS, | |

32 | Pnt from gp, | |

33 | MakePolygon from BRepLib | |

34 | ||

35 | raises | |

36 | NotDone from StdFail | |

37 | ||

38 | is | |

39 | Create | |

40 | returns MakePolygon from BRepBuilderAPI; | |

41 | ---Purpose: Initializes an empty polygonal wire, to which points or | |

42 | -- vertices are added using the Add function. | |

43 | -- As soon as the polygonal wire under construction | |

44 | -- contains vertices, it can be consulted using the Wire function. | |

45 | ||

46 | Create(P1, P2 : Pnt from gp) | |

47 | ---Level: Public | |

48 | returns MakePolygon from BRepBuilderAPI; | |

49 | ||

50 | Create(P1, P2, P3 : Pnt from gp; | |

51 | Close : Boolean = Standard_False) | |

52 | ---Level: Public | |

53 | returns MakePolygon from BRepBuilderAPI; | |

54 | ||

55 | Create(P1, P2, P3, P4 : Pnt from gp; | |

56 | Close : Boolean = Standard_False) | |

57 | ---Level: Public | |

58 | returns MakePolygon from BRepBuilderAPI; | |

59 | ---Purpose: Constructs a polygonal wire from 2, 3 or 4 points. Vertices are | |

60 | -- automatically created on the given points. The polygonal wire is | |

61 | -- closed if Close is true; otherwise it is open. Further vertices can | |

62 | -- be added using the Add function. The polygonal wire under | |

63 | -- construction can be consulted at any time by using the Wire function. | |

64 | -- Example | |

65 | -- //an open polygon from four points | |

66 | -- TopoDS_Wire W = BRepBuilderAPI_MakePolygon(P1,P2,P3,P4); | |

67 | -- Warning: The process is equivalent to: | |

68 | -- - initializing an empty polygonal wire, | |

69 | -- - and adding the given points in sequence. | |

70 | -- Consequently, be careful when using this function: if the | |

71 | -- sequence of points p1 - p2 - p1 is found among the arguments of the | |

72 | -- constructor, you will create a polygonal wire with two | |

73 | -- consecutive coincident edges. | |

74 | ||

75 | Create(V1, V2 : Vertex from TopoDS) | |

76 | ---Level: Public | |

77 | returns MakePolygon from BRepBuilderAPI; | |

78 | ||

79 | Create(V1, V2, V3 : Vertex from TopoDS; | |

80 | Close : Boolean = Standard_False) | |

81 | ---Level: Public | |

82 | returns MakePolygon from BRepBuilderAPI; | |

83 | ||

84 | Create(V1, V2, V3, V4 : Vertex from TopoDS; | |

85 | Close : Boolean = Standard_False) | |

86 | ---Level: Public | |

87 | returns MakePolygon from BRepBuilderAPI; | |

88 | ---Purpose: Constructs a polygonal wire from | |

89 | -- 2, 3 or 4 vertices. The polygonal wire is closed if Close is true; | |

90 | -- otherwise it is open (default value). Further vertices can be | |

91 | -- added using the Add function. The polygonal wire under | |

92 | -- construction can be consulted at any time by using the Wire function. | |

93 | -- Example | |

94 | -- //a closed triangle from three vertices | |

95 | -- TopoDS_Wire W = BRepBuilderAPI_MakePolygon(V1,V2,V3,Standard_True); | |

96 | -- Warning | |

97 | -- The process is equivalent to: | |

98 | -- - initializing an empty polygonal wire, | |

99 | -- - then adding the given points in sequence. | |

100 | -- So be careful, as when using this function, you could create a | |

101 | -- polygonal wire with two consecutive coincident edges if | |

102 | -- the sequence of vertices v1 - v2 - v1 is found among the | |

103 | -- constructor's arguments. | |

104 | ||

105 | Add(me : in out; P : Pnt from gp) | |

106 | ---Level: Public | |

107 | is static; | |

108 | ||

109 | Add(me : in out; V : Vertex from TopoDS) | |

110 | ---Level: Public | |

111 | is static; | |

112 | --- Purpose: | |

113 | -- Adds the point P or the vertex V at the end of the | |

114 | -- polygonal wire under construction. A vertex is | |

115 | -- automatically created on the point P. | |

116 | -- Warning | |

117 | -- - When P or V is coincident to the previous vertex, | |

118 | -- no edge is built. The method Added can be used to | |

119 | -- test for this. Neither P nor V is checked to verify | |

120 | -- that it is coincident with another vertex than the last | |

121 | -- one, of the polygonal wire under construction. It is | |

122 | -- also possible to add vertices on a closed polygon | |

123 | -- (built for example by using a constructor which | |

124 | -- declares the polygon closed, or after the use of the Close function). | |

125 | -- Consequently, be careful using this function: you might create: | |

126 | -- - a polygonal wire with two consecutive coincident edges, or | |

127 | -- - a non manifold polygonal wire. | |

128 | -- - P or V is not checked to verify if it is | |

129 | -- coincident with another vertex but the last one, of | |

130 | -- the polygonal wire under construction. It is also | |

131 | -- possible to add vertices on a closed polygon (built | |

132 | -- for example by using a constructor which declares | |

133 | -- the polygon closed, or after the use of the Close function). | |

134 | -- Consequently, be careful when using this function: you might create: | |

135 | -- - a polygonal wire with two consecutive coincident edges, or | |

136 | -- - a non-manifold polygonal wire. | |

137 | ||

138 | Added(me) returns Boolean | |

139 | ---Purpose: Returns true if the last vertex added to the constructed | |

140 | -- polygonal wire is not coincident with the previous one. | |

141 | is static; | |

142 | ||

143 | Close(me : in out) | |

144 | ---Purpose: Closes the polygonal wire under construction. Note - this | |

145 | -- is equivalent to adding the first vertex to the polygonal | |

146 | -- wire under construction. | |

147 | is static; | |

148 | ||

149 | FirstVertex(me) returns Vertex from TopoDS | |

150 | ---C++: return const & | |

151 | ---Level: Public | |

152 | is static; | |

153 | ||

154 | LastVertex(me) returns Vertex from TopoDS | |

155 | ---C++: return const & | |

156 | ---Level: Public | |

157 | is static; | |

158 | ---Purpose: Returns the first or the last vertex of the polygonal wire under construction. | |

159 | -- If the constructed polygonal wire is closed, the first and the last vertices are identical. | |

160 | ||

161 | IsDone(me) returns Boolean | |

162 | ---Level: Public | |

163 | is redefined; | |

164 | ---Purpose: | |

165 | -- Returns true if this algorithm contains a valid polygonal | |

166 | -- wire (i.e. if there is at least one edge). | |

167 | -- IsDone returns false if fewer than two vertices have | |

168 | -- been chained together by this construction algorithm. | |

169 | ||

170 | Edge(me) returns Edge from TopoDS | |

171 | ---Purpose: Returns the edge built between the last two points or | |

172 | -- vertices added to the constructed polygonal wire under construction. | |

173 | -- Warning | |

174 | -- If there is only one vertex in the polygonal wire, the result is a null edge. | |

175 | ---C++: return const & | |

176 | ---C++: alias "Standard_EXPORT operator TopoDS_Edge() const;" | |

177 | raises | |

178 | NotDone from StdFail | |

179 | is static; | |

180 | ||

181 | Wire(me) returns Wire from TopoDS | |

182 | ---Purpose: | |

183 | -- Returns the constructed polygonal wire, or the already | |

184 | -- built part of the polygonal wire under construction. | |

185 | -- Exceptions | |

186 | -- StdFail_NotDone if the wire is not built, i.e. if fewer than | |

187 | -- two vertices have been chained together by this construction algorithm. | |

188 | ---C++: return const & | |

189 | ---C++: alias "Standard_EXPORT operator TopoDS_Wire() const;" | |

190 | raises | |

191 | NotDone from StdFail | |

192 | is static; | |

193 | ||

194 | fields | |

195 | ||

196 | myMakePolygon : MakePolygon from BRepLib; | |

197 | ||

198 | end MakePolygon; |