Skip to content
This repository was archived by the owner on May 19, 2025. It is now read-only.

Commit f90ff4c

Browse files
committed
Added example 04
1 parent 0376507 commit f90ff4c

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

examples/04_face_counting.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"""
2+
Examples for the Python 3 wrapper module for Spatial Corporation's 3D ACIS Modeler
3+
4+
ACIS and SAT are registered trademarks of Spatial Corporation.
5+
6+
The Python module is developed by Onur R. Bingol and released under MIT license.
7+
Please see the LICENSE file for details.
8+
"""
9+
10+
from ACIS import utilities as utils
11+
from ACIS import Modeler, Licensing, SaveRestore, Entity, Lists, GeometricAtoms, Query
12+
13+
# Start ACIS Modeler
14+
Modeler.api_start_modeller(0)
15+
16+
# Unlock ACIS Modeler components
17+
unlock_key = utils.read_spa_license_key("license.txt")
18+
Licensing.spa_unlock_products(unlock_key)
19+
20+
# Generate a truncated cone
21+
frustum = Entity.BODY()
22+
Modeler.api_make_frustum(50, 20, 30, 10, frustum)
23+
24+
# Assign attributes after generation
25+
frustum.name = "Truncated Cone"
26+
frustum.id = 1
27+
28+
# Loop through the face list and print out the name of the entity type
29+
face_list = Lists.ENTITY_LIST()
30+
Query.api_get_faces(frustum, face_list)
31+
32+
for f in face_list.array():
33+
fs = f.geometry()
34+
print(fs.type_name())
35+
36+
# Prepare for saving
37+
save_list = Lists.ENTITY_LIST()
38+
save_list.add(frustum)
39+
40+
# Set file name
41+
filename = "ACIS_Ex04.SAT"
42+
43+
# ACIS requires FileInfo object to be set before saving SAT files
44+
file_info = SaveRestore.FileInfo()
45+
file_info.set_product_id(filename)
46+
file_info.set_units(1.0) # milimeters
47+
48+
SaveRestore.api_set_file_info(file_info, product_id=True, units=True)
49+
50+
## Enable sequence numbers (i.e., pointers) in the SAT file for debugging (optional step)
51+
#Modeler.api_set_int_option("sequence_save_files", 1)
52+
53+
# Save the model as a SAT file
54+
SaveRestore.api_save_entity_list(filename, True, save_list)
55+
56+
# Stop ACIS Modeler
57+
Modeler.api_stop_modeller()

0 commit comments

Comments
 (0)