1111class RhinoLoopBuilder (object ):
1212 """Builds a Brep loop.
1313
14+ Parameters
15+ ==========
16+ loop : :rhino:`Rhino.Geometry.BrepLoop`
17+ The loop currently being constructed.
18+ brep : :rhino:`Rhino.Geometry.Brep`
19+ The parent brep object.
20+
1421 Attributes
15- ----------
22+ ==========
1623 result : :rhino: Rhino.Geometry.BrepTrim
1724 The created loop.
1825
1926 """
2027
21- def __init__ (self , loop = None , instance = None ):
22- self .loop = loop
23- self .instance = instance
28+ def __init__ (self , loop = None , brep = None ):
29+ self ._loop = loop
30+ self ._brep = brep
2431
2532 def add_trim (self , curve , edge_index , is_reversed , iso_status ):
2633 """Add trim to the new Brep.
@@ -42,37 +49,44 @@ def add_trim(self, curve, edge_index, is_reversed, iso_status):
4249 The newly added BrepTrim instance.
4350
4451 """
45- c_index = self .instance .AddTrimCurve (curve )
46- edge = self .instance .Edges [edge_index ]
47- trim = self .instance .Trims .Add (edge , is_reversed , self .loop , c_index )
52+ c_index = self ._brep .AddTrimCurve (curve )
53+ edge = self ._brep .Edges [edge_index ]
54+ trim = self ._brep .Trims .Add (edge , is_reversed , self ._loop , c_index )
4855 trim .IsoStatus = iso_status
4956 trim .SetTolerances (TOLERANCE , TOLERANCE )
5057 return trim
5158
5259 @property
5360 def result (self ):
54- return self .loop
61+ return self ._loop
5562
5663
5764class RhinoFaceBuilder (object ):
5865 """Builds a BrepFace.
5966
6067 Serves as context for reconstructing the loop elements associated with this face.
6168
69+ Parameters
70+ ==========
71+ face : :rhino:`Rhino.Geometry.BrepFace`
72+ The face currently being constructed.
73+ brep : :rhino:`Rhino.Geometry.Brep`
74+ The parent brep.
75+
6276 Attributes
6377 ==========
6478 result : :rhino:`Rhino.Geometry.BrepFace`
6579 The resulting BrepFace.
6680
6781 """
6882
69- def __init__ (self , face = None , instance = None ):
70- self .face = face
71- self .instance = instance
83+ def __init__ (self , face = None , brep = None ):
84+ self ._face = face
85+ self ._brep = brep
7286
7387 @property
7488 def result (self ):
75- return self .face
89+ return self ._face
7690
7791 def add_loop (self , loop_type ):
7892 """Add a new loop to this face.
@@ -89,8 +103,8 @@ def add_loop(self, loop_type):
89103 :class:`compas_rhino.geometry.RhinoLoopBuilder`
90104
91105 """
92- loop = self .instance .Loops .Add (loop_type , self .face )
93- return RhinoLoopBuilder (loop , self .instance )
106+ loop = self ._brep .Loops .Add (loop_type , self ._face )
107+ return RhinoLoopBuilder (loop , self ._brep )
94108
95109
96110class RhinoBrepBuilder (object ):
@@ -104,14 +118,14 @@ class RhinoBrepBuilder(object):
104118 """
105119
106120 def __init__ (self ):
107- self ._instance = Rhino .Geometry .Brep ()
121+ self ._brep = Rhino .Geometry .Brep ()
108122
109123 @property
110124 def result (self ):
111- is_valid , log = self ._instance .IsValidWithLog ()
125+ is_valid , log = self ._brep .IsValidWithLog ()
112126 if not is_valid :
113127 raise BrepInvalidError ("Brep reconstruction failed!\n {}" .format (log ))
114- return self ._instance
128+ return self ._brep
115129
116130 def add_vertex (self , point ):
117131 """Add vertext to a new Brep
@@ -123,7 +137,7 @@ def add_vertex(self, point):
123137 :rhino:`Rhino.Geometry.BrepVertex`
124138
125139 """
126- return self ._instance .Vertices .Add (point_to_rhino (point ), TOLERANCE )
140+ return self ._brep .Vertices .Add (point_to_rhino (point ), TOLERANCE )
127141
128142 def add_edge (self , edge_curve , start_vertex , end_vertex ):
129143 """Add edge to the new Brep
@@ -139,10 +153,10 @@ def add_edge(self, edge_curve, start_vertex, end_vertex):
139153 :rhino:`Rhino.Geometry.BrepEdge`
140154
141155 """
142- curve_index = self ._instance .AddEdgeCurve (edge_curve )
143- s_vertex = self ._instance .Vertices [start_vertex ]
144- e_vertex = self ._instance .Vertices [end_vertex ]
145- return self ._instance .Edges .Add (s_vertex , e_vertex , curve_index , TOLERANCE )
156+ curve_index = self ._brep .AddEdgeCurve (edge_curve )
157+ s_vertex = self ._brep .Vertices [start_vertex ]
158+ e_vertex = self ._brep .Vertices [end_vertex ]
159+ return self ._brep .Edges .Add (s_vertex , e_vertex , curve_index , TOLERANCE )
146160
147161 def add_face (self , surface ):
148162 """Creates and adds a new face to the brep.
@@ -159,6 +173,6 @@ def add_face(self, surface):
159173 :class:`compas_rhino.geometry.RhinoFaceBuilder`
160174
161175 """
162- surface_index = self ._instance .AddSurface (surface .rhino_surface )
163- face = self ._instance .Faces .Add (surface_index )
164- return RhinoFaceBuilder (face = face , instance = self ._instance )
176+ surface_index = self ._brep .AddSurface (surface .rhino_surface )
177+ face = self ._brep .Faces .Add (surface_index )
178+ return RhinoFaceBuilder (face = face , brep = self ._brep )
0 commit comments