Skip to content

Commit 91e3d5c

Browse files
committed
fixed class methods ThreeDCuts. #285
1 parent 19f5a4a commit 91e3d5c

File tree

4 files changed

+80
-124
lines changed

4 files changed

+80
-124
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 0.9.2
4+
5+
* fixed ThreeDCuts methods. #285
6+
37
## 0.9.1
48

59
* fixed DrawingDimValue.get_bault_text() and DrawingDimValue.get_ps_text().

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __getattr__(cls, name):
3636
author = 'Paul Bourne'
3737

3838
# The short X.Y version
39-
version = '0.9.1'
39+
version = '0.9.2'
4040
# The full version, including alpha/beta/rc tags
4141
release = version
4242

pycatia/smt_interfaces/three_d_cuts.py

Lines changed: 74 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
The notes denoted "CAA V5 Visual Basic Help" are to be used as reference only.
77
They are there as a guide as to how the visual basic / catscript functions work
88
and thus help debugging in pycatia.
9-
9+
1010
"""
1111

1212
from pycatia.in_interfaces.document import Document
@@ -28,130 +28,98 @@ class ThreeDCuts(Collection):
2828
| System.CATBaseDispatch
2929
| System.Collection
3030
| ThreeDCuts
31-
|
31+
|
3232
| Interface to compute 3D cuts
33-
33+
3434
"""
3535

3636
def __init__(self, com_object):
3737
super().__init__(com_object)
3838
self.three_d_cuts = com_object
3939

40-
def compute_3d_cut(self, group_of_selected_products: Group, three_d_cut_document: Document) -> None:
40+
def compute_3d_cut(self, group_of_selected_products: Group) -> Document:
4141
"""
4242
.. note::
4343
:class: toggle
4444
45-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
45+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
4646
| o Sub Compute3DCut(Group GroupOfSelectedProducts,
4747
| Document ThreeDCutDocument)
48-
|
48+
|
4949
| Computes the 3DCut on the selected products.
50-
|
50+
|
5151
| Parameters:
52-
|
52+
|
5353
| GroupOfSelectedProducts
5454
| The selected products on which you want to perform the 3D cut.
55-
|
56-
|
55+
|
56+
|
5757
| Returns:
5858
| ThreeDCutDocument: Document containing the result.
5959
6060
:param Group group_of_selected_products:
61-
:param Document three_d_cut_document:
62-
:rtype: None
61+
:rtype: Document
6362
"""
64-
return self.three_d_cuts.Compute3DCut(group_of_selected_products.com_object, three_d_cut_document.com_object)
65-
# # # # Autogenerated comment:
66-
# # some methods require a system service call as the methods expects a vb array object
67-
# # passed to it and there is no way to do this directly with python. In those cases the following code
68-
# # should be uncommented and edited accordingly. Otherwise completely remove all this.
69-
# # vba_function_name = 'compute3_d_cut'
70-
# # vba_code = """
71-
# # Public Function compute3_d_cut(three_d_cuts)
72-
# # Dim GroupOfSelectedProducts (2)
73-
# # three_d_cuts.Compute3DCut GroupOfSelectedProducts
74-
# # compute3_d_cut = GroupOfSelectedProducts
75-
# # End Function
76-
# # """
77-
78-
# # system_service = SystemService(self.application.SystemService)
79-
# # return system_service.evaluate(vba_code, 0, vba_function_name, [self.com_object])
80-
81-
def compute3_d_cut_with_a_reference(
63+
return Document(self.three_d_cuts.Compute3DCut(group_of_selected_products.com_object))
64+
65+
def compute_3d_cut_with_reference(
8266
self,
8367
group_of_selected_products: Group,
8468
i_reference_product: Product,
85-
three_d_cut_document: Document
86-
) -> None:
69+
) -> Document:
8770
"""
8871
.. note::
8972
:class: toggle
9073
91-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
74+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
9275
| o Sub Compute3DCutWithAReference(Group
9376
| GroupOfSelectedProducts,
9477
| Product iReferenceProduct,
9578
| Document ThreeDCutDocument)
96-
|
79+
|
9780
| Computes the 3DCut on the selected products, according to a reference
9881
| product.
99-
|
82+
|
10083
| Parameters:
101-
|
84+
|
10285
| GroupOfSelectedProducts
10386
| The selected products on which you want to perform the 3D cut.
104-
|
87+
|
10588
| iReferenceProduct
106-
| Product taken as a reference.
107-
|
89+
| Product taken as a reference.
90+
|
10891
| Returns:
10992
| ThreeDCutDocument: Document containing the result.
11093
11194
:param Group group_of_selected_products:
11295
:param Product i_reference_product:
113-
:param Document three_d_cut_document:
114-
:rtype: None
96+
:rtype: Document
11597
"""
116-
return self.three_d_cuts.Compute3DCutWithAReference(
117-
group_of_selected_products.com_object,
118-
i_reference_product.com_object,
119-
three_d_cut_document.com_object
98+
return Document(
99+
self.three_d_cuts.Compute3DCutWithAReference(
100+
group_of_selected_products.com_object,
101+
i_reference_product.com_object,
102+
)
120103
)
121-
# # # # Autogenerated comment:
122-
# # some methods require a system service call as the methods expects a vb array object
123-
# # passed to it and there is no way to do this directly with python. In those cases the following code
124-
# # should be uncommented and edited accordingly. Otherwise completely remove all this.
125-
# # vba_function_name = 'compute3_d_cut_with_a_reference'
126-
# # vba_code = """
127-
# # Public Function compute3_d_cut_with_a_reference(three_d_cuts)
128-
# # Dim GroupOfSelectedProducts (2)
129-
# # three_d_cuts.Compute3DCutWithAReference GroupOfSelectedProducts
130-
# # compute3_d_cut_with_a_reference = GroupOfSelectedProducts
131-
# # End Function
132-
# # """
133-
134-
# # system_service = SystemService(self.application.SystemService)
135-
# # return system_service.evaluate(vba_code, 0, vba_function_name, [self.com_object])
136104

137105
def get_compute_3d_cut(self, group_of_selected_products: Group) -> Document:
138106
"""
139107
.. note::
140108
:class: toggle
141109
142-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
110+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
143111
| o Func GetCompute3DCut(Group GroupOfSelectedProducts) As
144112
| Document
145-
|
113+
|
146114
| Computes the 3DCut on the selected products (better
147115
| signature).
148-
|
116+
|
149117
| Parameters:
150-
|
118+
|
151119
| GroupOfSelectedProducts
152120
| The selected products on which you want to perform the 3D cut.
153-
|
154-
|
121+
|
122+
|
155123
| Returns:
156124
| ThreeDCutDocument: Document containing the result.
157125
@@ -169,22 +137,22 @@ def get_compute_3d_cut_with_a_reference(
169137
.. note::
170138
:class: toggle
171139
172-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
140+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
173141
| o Func GetCompute3DCutWithAReference(Group
174142
| GroupOfSelectedProducts,
175143
| Product iReferenceProduct) As Document
176-
|
144+
|
177145
| Computes the 3DCut on the selected products, according to a reference
178146
| product (better signature).
179-
|
147+
|
180148
| Parameters:
181-
|
149+
|
182150
| GroupOfSelectedProducts
183151
| The selected products on which you want to perform the 3D cut.
184-
|
152+
|
185153
| iReferenceProduct
186-
| Product taken as a reference.
187-
|
154+
| Product taken as a reference.
155+
|
188156
| Returns:
189157
| ThreeDCutDocument: Document containing the result.
190158
@@ -204,17 +172,17 @@ def set_box(self, origin_x: float, origin_y: float, origin_z: float, vx: float,
204172
.. note::
205173
:class: toggle
206174
207-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
175+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
208176
| o Sub SetBox(double OriginX,
209177
| double OriginY,
210178
| double OriginZ,
211179
| double VX,
212180
| double VY,
213181
| double VZ)
214-
|
182+
|
215183
| Sets the RELATIVE box used for the 3D cut computation.
216184
| Be aware of the behavior:
217-
|
185+
|
218186
| Vz
219187
| ^_________________
220188
| /| /|
@@ -229,32 +197,32 @@ def set_box(self, origin_x: float, origin_y: float, origin_z: float, vx: float,
229197
| | | |
230198
| | | | |
231199
| | * - - - - - + - -|> Vy
232-
| | Origin | /
200+
| | Origin | /
233201
| | / | /
234202
| | | /
235203
| |/ |/
236204
| /----------------/
237205
| <
238206
| Vx
239-
|
207+
|
240208
| In the relative referential, O is (0,0,0)
241-
|
209+
|
242210
| This method sets the RELATIVE box : the rotation and translation matrix will then set the absolute position of O.
243211
| Remember where the center of the relative referential lies!
244212
| Can have unexpected results if you don't use it properly.
245-
|
213+
|
246214
| Parameters:
247-
|
215+
|
248216
| OriginX
249-
| Origin coordinate (X)
217+
| Origin coordinate (X)
250218
| OriginY
251-
| Origin coordinate (Y)
219+
| Origin coordinate (Y)
252220
| OriginZ
253-
| Origin coordinate (Z)
221+
| Origin coordinate (Z)
254222
| VX
255-
| Length of the box (along X)
223+
| Length of the box (along X)
256224
| VY
257-
| Length of the box (along Y)
225+
| Length of the box (along Y)
258226
| VZ
259227
| Length of the box (along Z)
260228
@@ -273,49 +241,34 @@ def set_matrix(self, i_components: tuple) -> None:
273241
.. note::
274242
:class: toggle
275243
276-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
244+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
277245
| o Sub SetMatrix(CATSafeArrayVariant iComponents)
278-
|
246+
|
279247
| Sets the rotation AND translation matrix.
280248
| Beware : After a SetBox, the matrix is not changed.
281-
|
249+
|
282250
| Parameters:
283-
|
251+
|
284252
| iComponents
285253
| Components of the 4x4 matrix, placed in rows.
286254
287255
:param tuple i_components:
288256
:rtype: None
289257
"""
290258
return self.three_d_cuts.SetMatrix(i_components)
291-
# # # # Autogenerated comment:
292-
# # some methods require a system service call as the methods expects a vb array object
293-
# # passed to it and there is no way to do this directly with python. In those cases the following code
294-
# # should be uncommented and edited accordingly. Otherwise completely remove all this.
295-
# # vba_function_name = 'set_matrix'
296-
# # vba_code = """
297-
# # Public Function set_matrix(three_d_cuts)
298-
# # Dim iComponents (2)
299-
# # three_d_cuts.SetMatrix iComponents
300-
# # set_matrix = iComponents
301-
# # End Function
302-
# # """
303-
304-
# # system_service = SystemService(self.application.SystemService)
305-
# # return system_service.evaluate(vba_code, 0, vba_function_name, [self.com_object])
306259

307260
def set_on_borders(self, on_borders: int) -> None:
308261
"""
309262
.. note::
310263
:class: toggle
311264
312-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
265+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
313266
| o Sub SetOnBorders(long OnBorders)
314-
|
267+
|
315268
| Sets the behavior on borders.
316-
|
269+
|
317270
| Parameters:
318-
|
271+
|
319272
| Type
320273
| 0 : We keep partially included triangles
321274
| 1 : We keep entirely included triangles
@@ -325,41 +278,40 @@ def set_on_borders(self, on_borders: int) -> None:
325278
"""
326279
return self.three_d_cuts.SetOnBorders(on_borders)
327280

328-
def set_type(self, type: int) -> None:
281+
def set_type(self, type_: int) -> None:
329282
"""
330283
.. note::
331284
:class: toggle
332285
333-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
286+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
334287
| o Sub SetType(long Type)
335-
|
288+
|
336289
| Sets the type of cut we're doing.
337-
|
290+
|
338291
| Parameters:
339-
|
292+
|
340293
| Type
341294
| 0 : We keep the inner triangles
342295
| 1 : We keep the outer triangles
343296
344-
:param int type:
297+
:param int type_:
345298
:rtype: None
346299
"""
347-
return self.three_d_cuts.SetType(type)
300+
return self.three_d_cuts.SetType(type_)
348301

349-
def three_d_cut_shape_name(self, name: str) -> None:
302+
def three_d_cut_shape_name(self) -> str:
350303
"""
351304
.. note::
352305
:class: toggle
353306
354-
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
307+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357)
355308
| o Sub ThreeDCutShapeName(CATBSTR Name)
356-
|
309+
|
357310
| Returns the name of the associated shape.
358311
359-
:param str name:
360-
:rtype: None
312+
:rtype: str
361313
"""
362-
return self.three_d_cuts.ThreeDCutShapeName(name)
314+
return self.three_d_cuts.ThreeDCutShapeName()
363315

364316
def __repr__(self):
365317
return f'ThreeDCuts(name="{self.name}")'

0 commit comments

Comments
 (0)