Skip to content

Commit acf07b3

Browse files
committed
Merge branch 'development'
2 parents e682065 + e4240dd commit acf07b3

File tree

10 files changed

+591
-8
lines changed

10 files changed

+591
-8
lines changed

CHANGELOG.md

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

3+
## 0.4.2
4+
* Added missing methods Parameter.rename(), Parameter.valuate_from_string(),
5+
and Parameter.value_as_string()
6+
* Added missing methods DrawingThread.is_linked().
7+
* Added the following missing methods from the class HybridShapeCurveSmooth
8+
* add_frozen_curve_segment()
9+
* add_frozen_point
10+
* get_frozen_curve_segment
11+
* get_frozen_curve_segments_size
12+
* get_frozen_point
13+
* get_frozen_points_size
14+
* remove_all_frozen_curve_segments
15+
* remove_all_frozen_points
16+
* remove_frozen_curve_segment
17+
* remove_frozen_point
18+
* set_maximum_deviation
19+
* set_tangency_threshold
20+
321
## 0.4.1
422
* Document.save_as() If overwrite is to true DisplayFileAlerts is set to False.
523
* Analyze added to Part().

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.4.1'
39+
version = '0.4.2'
4040
# The full version, including alpha/beta/rc tags
4141
release = version
4242

docs/examples.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,3 +239,15 @@ Example 25
239239
Write the contents of a product to a html file.
240240

241241
`Example 25 <https://github.com/evereux/pycatia/blob/master/example_025.py>`_
242+
243+
Example 26
244+
----------
245+
246+
Prompt the user to select a product and get it's bounding box parameters
247+
248+
.. warning:
249+
Currently there must be NO other existing Measure Inertias saved
250+
ANYWHERE in your product tree as these may be returned and not
251+
product you have selected.
252+
253+
`Example 26 <https://github.com/evereux/pycatia/blob/master/example_026.py>`_

example_025.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
Example 25:
66
7-
7+
Create a custom formatted html of the product tree.
88
99
"""
1010

example_026.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#! /usr/bin/python3.6
2+
3+
"""
4+
5+
Example 26:
6+
7+
Prompt the user to select a product and get it's bounding box parameters
8+
9+
.. warning:
10+
Currently there must be NO other existing Measure Inertias saved
11+
ANYWHERE in your product tree as these may be returned and not
12+
product you have selected.
13+
14+
"""
15+
16+
import win32con
17+
import win32gui
18+
from pycatia import catia
19+
20+
21+
def close_inertia_window():
22+
# for future debugging from https://stackoverflow.com/questions/55547940/how-to-get-a-list-of-the-name-of-every-open-window
23+
# def winEnumHandler(hwnd, ctx):
24+
# if win32gui.IsWindowVisible(hwnd):
25+
# print(hex(hwnd), win32gui.GetWindowText(hwnd))
26+
#
27+
# win32gui.EnumWindows(winEnumHandler, None)
28+
29+
handle = win32gui.FindWindow(None, "Measure Inertia")
30+
win32gui.PostMessage(handle, win32con.WM_CLOSE, 0, 0)
31+
32+
33+
caa = catia()
34+
document = caa.active_document
35+
product = document.product()
36+
selection = document.selection
37+
selection.clear()
38+
39+
c = True
40+
while c is True:
41+
input("Selection product to measure.\nPress <ENTER> when selection made.")
42+
selection = document.selection
43+
44+
caa.start_command("Measure Inertia")
45+
parameters = product.parameters
46+
print(f"BBOx = {parameters.item('BBOx').value_as_string()}.")
47+
print(f"BBOy = {parameters.item('BBOy').value_as_string()}.")
48+
print(f"BBOz = {parameters.item('BBOz').value_as_string()}.")
49+
print(f"BBLx = {parameters.item('BBLx').value_as_string()}.")
50+
print(f"BBLy = {parameters.item('BBLy').value_as_string()}.")
51+
print(f"BBLz = {parameters.item('BBLz').value_as_string()}.")
52+
selection.clear()
53+
close_inertia_window()
54+
55+
prompt = input("Continue? (Y/N):")
56+
57+
if prompt.lower()[0] == 'n':
58+
c = False
59+
else:
60+
c = True

pycatia/drafting_interfaces/drawing_thread.py

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
"""
1111

1212
from pycatia.system_interfaces.any_object import AnyObject
13+
from pycatia.types import cat_variant
1314

1415

1516
class DrawingThread(AnyObject):
16-
1717
"""
1818
.. note::
1919
:class: toggle
@@ -86,5 +86,32 @@ def type(self, value: int):
8686

8787
self.drawing_thread.Type = value
8888

89-
def __repr__(self):
90-
return f'DrawingThread(name="{ self.name }")'
89+
def is_linked_to(self) -> cat_variant:
90+
"""
91+
.. note::
92+
:class: toggle
93+
94+
CAA V5 Visual Basic Help (2020-09-25 14:34:21.593357))
95+
| o Func IsLinkedTo() As CatThreadLinkedTo
96+
|
97+
| Specifies which kind of objects the thread is linked to.
98+
|
99+
| Returns:
100+
| oLinkedType The type of thread link
101+
|
102+
| Example:
103+
| The following example retrieves the CatThreadLinkedTo in MyThread This view
104+
| belongs to the drawing view collection of the drawing
105+
| sheet
106+
|
107+
| ThreadLinkType = MyThread.IsLinkedTo
108+
109+
:return: enum cat_thread_linked_to
110+
:rtype: enum cat_thread_linked_to
111+
"""
112+
113+
return self.drawing_thread.IsLinkedTo()
114+
115+
116+
def __repr__(self):
117+
return f'DrawingThread(name="{self.name}")'

0 commit comments

Comments
 (0)