forked from evereux/pycatia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_002.py
31 lines (22 loc) · 879 Bytes
/
example_002.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#! /usr/bin/python3.6
"""
Example 2:
Get all the points in the geometrical set 'Points' and output co-ordinate to console.
Create your own CATPart with a Geometrical Set called construction_points. Add some points to the Geometrical Set.
"""
from pycatia import catia
caa = catia()
documents = caa.documents
# this should be the path to your file.
documents.open(r'tests\cat_files\part_measurable.CATPart')
document = caa.active_document
part = document.part()
spa_workbench = document.spa_workbench()
hybrid_bodies = part.hybrid_bodies
hybrid_body = hybrid_bodies.get_item_by_name('construction_points')
shapes = hybrid_body.hybrid_shapes
for point in shapes:
reference = part.create_reference_from_object(point)
measurable = spa_workbench.get_measurable(reference)
coordinates = measurable.get_point()
print(f'{point.name}: {coordinates}')