Skip to content

Commit

Permalink
Merge branch 'release/v0.6.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepmanbc committed Jul 16, 2020
2 parents 38fac67 + e6820f5 commit 732a5ba
Show file tree
Hide file tree
Showing 8 changed files with 138 additions and 111 deletions.
13 changes: 13 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
History
=======

0.6.0 (2020-07-16)
------------------

Update for `Creoson 2.7.0 release`_.

* New functions:
* file_get_accuracy
* Add parameters:
* interface_mapkey: delay
* interface_export_pdf interface_export_pdf3d : sheet_range

.. _`Creoson 2.7.0 release`: https://github.com/SimplifiedLogic/creoson/releases/tag/v2.7.0

0.5.2 (2020-07-09)
------------------

Expand Down
39 changes: 25 additions & 14 deletions creopyson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"""Top-level package for Creopyson."""

__author__ = """Benjamin C."""
__email__ = 'zepman@gmail.com'
__version__ = '0.5.2'
__email__ = "zepman@gmail.com"
__version__ = "__version__ = '0.6.0'"

from creopyson.connection import Client
from creopyson.objects import jlpoint
Expand All @@ -14,6 +14,7 @@

# Bom
from creopyson.bom import get_paths as bom_get_paths

Client.bom_get_paths = bom_get_paths


Expand All @@ -29,6 +30,7 @@
from creopyson.creo import rmdir as creo_rmdir
from creopyson.creo import set_config as creo_set_config
from creopyson.creo import set_std_color as creo_set_std_color

Client.creo_cd = creo_cd
Client.creo_delete_files = creo_delete_files
Client.creo_get_config = creo_get_config
Expand All @@ -50,6 +52,7 @@
from creopyson.dimension import set_text as dimension_set_text
from creopyson.dimension import show as dimension_show
from creopyson.dimension import user_select as dimension_user_select

Client.dimension_copy = dimension_copy
Client.dimension_list_detail = dimension_list_detail
Client.dimension_list = dimension_list
Expand Down Expand Up @@ -80,8 +83,7 @@
from creopyson.drawing import get_view_loc as drawing_get_view_loc
from creopyson.drawing import get_view_scale as drawing_get_view_scale
from creopyson.drawing import get_view_sheet as drawing_get_view_sheet
from creopyson.drawing import is_symbol_def_loaded as \
drawing_is_symbol_def_loaded
from creopyson.drawing import is_symbol_def_loaded as drawing_is_symbol_def_loaded
from creopyson.drawing import list_models as drawing_list_models
from creopyson.drawing import list_symbols as drawing_list_symbols
from creopyson.drawing import list_view_details as drawing_list_view_details
Expand All @@ -97,6 +99,7 @@
from creopyson.drawing import set_sheet_format as drawing_set_sheet_format
from creopyson.drawing import set_view_loc as drawing_set_view_loc
from creopyson.drawing import view_bound_box as drawing_view_bound_box

Client.drawing_add_model = drawing_add_model
Client.drawing_add_sheet = drawing_add_sheet
Client.drawing_create_gen_view = drawing_create_gen_view
Expand Down Expand Up @@ -149,6 +152,7 @@
from creopyson.familytable import list_tree as familytable_list_tree
from creopyson.familytable import replace as familytable_replace
from creopyson.familytable import set_cell as familytable_set_cell

Client.familytable_add_inst = familytable_add_inst
Client.familytable_create_inst = familytable_create_inst
Client.familytable_delete_inst = familytable_delete_inst
Expand All @@ -169,16 +173,15 @@
from creopyson.feature import delete_param as feature_delete_param
from creopyson.feature import list_ as feature_list
from creopyson.feature import list_params as feature_list_params
from creopyson.feature import list_group_features as \
feature_list_group_features
from creopyson.feature import list_pattern_features as \
feature_list_pattern_features
from creopyson.feature import list_group_features as feature_list_group_features
from creopyson.feature import list_pattern_features as feature_list_pattern_features
from creopyson.feature import param_exists as feature_param_exists
from creopyson.feature import rename as feature_rename
from creopyson.feature import resume as feature_resume
from creopyson.feature import set_param as feature_set_param
from creopyson.feature import suppress as feature_suppress
from creopyson.feature import user_select_csys as feature_user_select_csys

Client.feature_delete = feature_delete
Client.feature_delete_param = feature_delete_param
Client.feature_list = feature_list
Expand All @@ -203,6 +206,7 @@
from creopyson.file import erase_not_displayed as file_erase_not_displayed
from creopyson.file import exists as file_exists
from creopyson.file import get_active as file_get_active
from creopyson.file import get_accuracy as file_get_accuracy
from creopyson.file import get_cur_material as file_get_cur_material
from creopyson.file import get_cur_material_wildcard as file_get_cur_material_wildcard
from creopyson.file import get_fileinfo as file_get_fileinfo
Expand All @@ -220,10 +224,8 @@
from creopyson.file import massprops as file_massprops
from creopyson.file import open_errors as file_open_errors
from creopyson.file import open_ as file_open
from creopyson.file import postregen_relations_get as \
file_postregen_relations_get
from creopyson.file import postregen_relations_set as \
file_postregen_relations_set
from creopyson.file import postregen_relations_get as file_postregen_relations_get
from creopyson.file import postregen_relations_set as file_postregen_relations_set
from creopyson.file import refresh as file_refresh
from creopyson.file import regenerate as file_regenerate
from creopyson.file import relations_get as file_relations_get
Expand All @@ -234,6 +236,7 @@
from creopyson.file import set_cur_material as file_set_cur_material
from creopyson.file import set_length_units as file_set_length_units
from creopyson.file import set_mass_units as file_set_mass_units

Client.file_assemble = file_assemble
Client.file_backup = file_backup
Client.file_close_window = file_close_window
Expand All @@ -243,6 +246,7 @@
Client.file_erase_not_displayed = file_erase_not_displayed
Client.file_exists = file_exists
Client.file_get_active = file_get_active
Client.file_get_accuracy = file_get_accuracy
Client.file_get_cur_material = file_get_cur_material
Client.file_get_cur_material_wildcard = file_get_cur_material_wildcard
Client.file_get_fileinfo = file_get_fileinfo
Expand Down Expand Up @@ -278,6 +282,7 @@
from creopyson.geometry import bound_box as geometry_bound_box
from creopyson.geometry import get_edges as geometry_get_edges
from creopyson.geometry import get_surfaces as geometry_get_surfaces

Client.geometry_bound_box = geometry_bound_box
Client.geometry_get_edges = geometry_get_edges
Client.geometry_get_surfaces = geometry_get_surfaces
Expand All @@ -293,6 +298,7 @@
from creopyson.interface import import_program as interface_import_program
from creopyson.interface import mapkey as interface_mapkey
from creopyson.interface import plot as interface_plot

Client.interface_export_3dpdf = interface_export_3dpdf
Client.interface_export_file = interface_export_file
Client.interface_export_image = interface_export_image
Expand All @@ -309,6 +315,7 @@
from creopyson.layer import exists as layer_exists
from creopyson.layer import list_ as layer_list
from creopyson.layer import show as layer_show

Client.layer_delete = layer_delete
Client.layer_exists = layer_exists
Client.layer_list = layer_list
Expand All @@ -322,6 +329,7 @@
from creopyson.note import get as note_get
from creopyson.note import list_ as note_list
from creopyson.note import set_ as note_set

Client.note_copy = note_copy
Client.note_delete = note_delete
Client.note_exists = note_exists
Expand All @@ -337,6 +345,7 @@
from creopyson.parameter import list_ as parameter_list
from creopyson.parameter import set_ as parameter_set
from creopyson.parameter import set_designated as parameter_set_designated

Client.parameter_copy = parameter_copy
Client.parameter_delete = parameter_delete
Client.parameter_exists = parameter_exists
Expand All @@ -347,6 +356,7 @@

# Server
from creopyson.server import pwd as server_pwd

Client.server_pwd = server_pwd


Expand All @@ -355,6 +365,7 @@
from creopyson.view import list_exploded as view_list_exploded
from creopyson.view import list_ as view_list
from creopyson.view import save as view_save

Client.view_activate = view_activate
Client.view_list_exploded = view_list_exploded
Client.view_list = view_list
Expand All @@ -368,13 +379,13 @@
from creopyson.windchill import delete_workspace as windchill_delete_workspace
from creopyson.windchill import file_checked_out as windchill_file_checked_out
from creopyson.windchill import get_workspace as windchill_get_workspace
from creopyson.windchill import list_workspace_files as \
windchill_list_workspace_files
from creopyson.windchill import list_workspace_files as windchill_list_workspace_files
from creopyson.windchill import list_workspaces as windchill_list_workspaces
from creopyson.windchill import server_exists as windchill_server_exists
from creopyson.windchill import set_server as windchill_set_server
from creopyson.windchill import set_workspace as windchill_set_workspace
from creopyson.windchill import workspace_exists as windchill_workspace_exists

Client.windchill_authorize = windchill_authorize
Client.windchill_clear_workspace = windchill_clear_workspace
Client.windchill_create_workspace = windchill_create_workspace
Expand Down
30 changes: 30 additions & 0 deletions creopyson/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,36 @@ def exists(client, file_):
return client._creoson_post("file", "exists", data, "exists")


def get_accuracy(client, file_=None):
"""Get a solid's accuracy.
If the model has no accuracy value, this function will return null.
Args:
client (obj):
creopyson Client.
`file_` (str, optional):
File name.
Defaults is current active model
Returns:
(list):
accuracy (float):
Accuracy value.
relative (bool):
True = relative; False = absolute accuracy.
"""
data = {}
if file_ is not None:
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
data["file"] = active_file["file"]
return client._creoson_post("file", "get_accuracy", data)


def get_active(client):
"""Get the active model from Creo.
Expand Down
27 changes: 19 additions & 8 deletions creopyson/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"""
import re

# TODO : add STL export


def export_3dpdf(
client,
Expand All @@ -19,6 +17,7 @@ def export_3dpdf(
width=None,
dpi=None,
use_drawing_settings=None,
sheet_range="all",
):
"""Export a model to a 3D PDF file.
Expand All @@ -43,14 +42,17 @@ def export_3dpdf(
use_drawing_settings (boolean, optional):
Whether to use special settings for exporting drawings.
Defaut is False.
sheet_range (string):
Range of drawing sheets to export. Default vale is "all".
Valid values: "all", "current", range of sheet numbers (ex: "1,3-4")
Returns:
dict:
dirname (str): Directory of the output file
filename (str): Name of the output file
"""
data = {}
data = {"sheet_range": sheet_range}
if file_ is not None:
data["file"] = file_
else:
Expand Down Expand Up @@ -210,6 +212,7 @@ def export_pdf(
width=None,
dpi=None,
use_drawing_settings=None,
sheet_range="all",
):
"""Export a model to a PDF file.
Expand Down Expand Up @@ -237,14 +240,17 @@ def export_pdf(
use_drawing_settings (boolean, optional):
Whether to use special settings for exporting drawings.
Defaut is False.
sheet_range (string):
Range of drawing sheets to export. Default vale is "all".
Valid values: "all", "current", range of sheet numbers (ex: "1,3-4")
Returns:
dict:
dirname (str): Directory of the output file
filename (str): Name of the output file
"""
data = {}
data = {"sheet_range": sheet_range}
if file_ is not None:
data["file"] = file_
else:
Expand Down Expand Up @@ -393,21 +399,26 @@ def import_program(client, file_=None, filename=None, dirname=None):
return client._creoson_post("interface", "import_program", data, "file")


def mapkey(client, script):
def mapkey(client, script, delay=0):
"""Run a Mapkey script in Creo.
Make sure to remove any `mapkey(continued)` clauses from the script
argument. The tilde at the start of a line should occur immediately
after the semicolon at the end of the previous line.
Args:
client (obj): creopyson Client.
script (str): The mapkey script to run.
client (obj):
creopyson Client.
script (str):
The mapkey script to run.
delay (int):
Amount of time to wait after starting the mapkey, in milliseconds.
Default is 0.
Returns: None
"""
data = {"script": script.replace(" ", "")}
data = {"script": script.replace(" ", ""), "delay": delay}
return client._creoson_post("interface", "mapkey", data)


Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.5.2
current_version = 0.6.0
commit = True
tag = False

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/Zepmanbc/creopyson',
version='0.5.2',
version='0.6.0',
zip_safe=False,
)
Loading

0 comments on commit 732a5ba

Please sign in to comment.