Skip to content

Commit

Permalink
Merge branch 'release/v0.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepmanbc committed Mar 22, 2021
2 parents 8f592af + 2bd54bc commit 32b2aa3
Show file tree
Hide file tree
Showing 12 changed files with 187 additions and 143 deletions.
21 changes: 21 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,27 @@
History
=======

0.7.0 (2021-03-22)
------------------

Update for `Creoson 2.8.0 release`_.

* New functions:
* creo_set_creo_version (prevent Creo 7 problems)
* feature_list_selected
* Add parameters:
* feature_set_param: description
* parameter_set: description
* Documentation update:
* drawing_list: add *view_model*, *simp_rep* in Return
* feature_list_param: add *description* in Return
* feature_user_select_csys: add *file*, remove "feat_number* in Return object.
* parameter_list: add *description* in Return
* BugFix:
file_set_cur_material: now working with Creoson >2.8.0

.. _`Creoson 2.8.0 release`: https://github.com/SimplifiedLogic/creoson/releases/tag/v2.8.0

0.6.2 (2021-02-17)
------------------

Expand Down
6 changes: 5 additions & 1 deletion creopyson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__author__ = """Benjamin C."""
__email__ = "[email protected]"
__version__ = "__version__ = '0.6.2'"
__version__ = "__version__ = '0.7.0'"

from creopyson.connection import Client
from creopyson.objects import jlpoint
Expand All @@ -29,6 +29,7 @@
from creopyson.creo import pwd as creo_pwd
from creopyson.creo import rmdir as creo_rmdir
from creopyson.creo import set_config as creo_set_config
from creopyson.creo import set_creo_version as creo_set_creo_version
from creopyson.creo import set_std_color as creo_set_std_color

Client.creo_cd = creo_cd
Expand All @@ -41,6 +42,7 @@
Client.creo_pwd = creo_pwd
Client.creo_rmdir = creo_rmdir
Client.creo_set_config = creo_set_config
Client.creo_set_creo_version = creo_set_creo_version
Client.creo_set_std_color = creo_set_std_color


Expand Down Expand Up @@ -175,6 +177,7 @@
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_selected as feature_list_selected
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
Expand All @@ -188,6 +191,7 @@
Client.feature_list_params = feature_list_params
Client.feature_list_group_features = feature_list_group_features
Client.feature_list_pattern_features = feature_list_pattern_features
Client.feature_list_selected = feature_list_selected
Client.feature_param_exists = feature_param_exists
Client.feature_rename = feature_rename
Client.feature_resume = feature_resume
Expand Down
42 changes: 31 additions & 11 deletions creopyson/creo.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,16 +197,41 @@ def set_config(client, name, value, ignore_errors=None):
None.
"""
data = {
"name": name,
"value": value,
"ignore_errors": False
}
data = {"name": name, "value": value, "ignore_errors": False}
if ignore_errors:
data["ignore_errors"] = ignore_errors
return client._creoson_post("creo", "set_config", data)


def set_creo_version(client, version):
"""Set the version of Creo you are running.
This function only needs to be called once per creoson session.
This function must be called if you are doing certain functions
in Creo 7 due to deprecated config options.
Needed for functions:
familytable_replace
file_assemble
file_regenerate
feature_delete
feature_resume
feature_suppress
Args:
client (obj):
creopyson Client.
version (int):
Creo version.
Returns:
None.
"""
data = {"version": int(version)}
return client._creoson_post("creo", "set_creo_version", data)


def set_std_color(client, color_type, red, green, blue):
"""Set one of Creo's standard colors.
Expand All @@ -230,11 +255,6 @@ def set_std_color(client, color_type, red, green, blue):
None.
"""
data = {
"color_type": color_type,
"red": red,
"green": green,
"blue": blue
}
data = {"color_type": color_type, "red": red, "green": green, "blue": blue}
return client._creoson_post("creo", "rmdir", data)
# TODO: convert RGB to a tuple or hexa color?
8 changes: 7 additions & 1 deletion creopyson/drawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,11 +667,17 @@ def list_view_details(client, view=None, drawing=None):
View name.
sheet (int):
Sheet number.
location (dict) :
location (dict):
Coordonates
x (float): X-coordinate of the view
y (float): Y-coordinate of the view
z (float): Z-coordinate of the view
text_height (float):
Text Heigh in Drawing Units.
view_model (str):
View model name.
simp_rep (str):
View simplified rep name.
"""
data = {}
Expand Down
89 changes: 52 additions & 37 deletions creopyson/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,11 @@
"SIMP_REP_SUPPRESSED",
"PROGRAM_SUPPRESSED",
"SUPPRESSED",
"UNREGENERATED"
"UNREGENERATED",
]


def delete(
client,
name=None,
file_=None,
status=None,
type_=None,
clip=None
):
def delete(client, name=None, file_=None, status=None, type_=None, clip=None):
"""Delete one or more features that match criteria.
Args:
Expand Down Expand Up @@ -114,7 +107,7 @@ def list_(
paths=None,
no_datum=None,
inc_unnamed=None,
no_comp=None
no_comp=None,
):
"""List feature parameters that match criteria.
Expand Down Expand Up @@ -210,7 +203,7 @@ def list_params(
no_comp=None,
param=None,
value=None,
encoded=None
encoded=None,
):
"""List feature parameters that match criteria.
Expand Down Expand Up @@ -265,6 +258,8 @@ def list_params(
Owner ID.
owner_type (str):
Owner type.
description (str):
List of parameter information.
"""
data = {}
Expand Down Expand Up @@ -328,16 +323,10 @@ def list_group_features(client, group_name, type_=None, file_=None):
data["file"] = active_file["file"]
if type_:
data["type"] = type_
return client._creoson_post(
"feature", "list_group_features", data, "featlist")
return client._creoson_post("feature", "list_group_features", data, "featlist")


def list_pattern_features(
client,
patter_name,
type_=None,
file_=None
):
def list_pattern_features(client, patter_name, type_=None, file_=None):
"""List features in a Creo Pattern.
Args:
Expand Down Expand Up @@ -366,8 +355,37 @@ def list_pattern_features(
data["file"] = active_file["file"]
if type_:
data["type"] = type_
return client._creoson_post(
"feature", "list_group_features", data, "featlist")
return client._creoson_post("feature", "list_group_features", data, "featlist")


def list_selected(client):
"""List the currently selected features in Creo
Returns:
(list): List of feature informations.
[
{
'file' : model name (str)
'name' : feature name (str)
'status' : feature status (str)
'type' : feature type (str)
'feat_id' : feature ID (int)
'feat_number' : feature number (int)
'path' : feature's component path (list of ints)
},
]
"""
data = None
return client._creoson_post("feature", "list_selected", data, "featlist")


def param_exists(client, file_=None, name=None, param=None):
Expand Down Expand Up @@ -440,14 +458,7 @@ def rename(client, name, new_name, file_=None):
return client._creoson_post("feature", "rename", data)


def resume(
client,
file_=None,
name=None,
status=None,
type_=None,
with_children=None
):
def resume(client, file_=None, name=None, status=None, type_=None, with_children=None):
"""Resume one or more features that match criteria.
Will only resume visible features.
Expand Down Expand Up @@ -518,7 +529,8 @@ def set_param(
value=None,
encoded=None,
designate=None,
no_create=None
description=None,
no_create=None,
):
"""Set the value of a feature parameter.
Expand All @@ -544,6 +556,8 @@ def set_param(
designate (boolean, optional):
Set parameter to be designated/not designated, blank=do not set.
Defaults is `blank`.
description (str, optionnal):
Parameter description. If missing, leaves the currect description in place.
no_create (boolean, optional):
If parameter does not already exist, do not create it.
Defaults is False.
Expand Down Expand Up @@ -571,6 +585,8 @@ def set_param(
data["encoded"] = encoded
if designate:
data["designate"] = designate
if description:
data["description"] = description
if no_create:
data["no_create"] = no_create
return client._creoson_post("feature", "set_param", data)
Expand All @@ -583,7 +599,7 @@ def suppress(
status=None,
type_=None,
clip=None,
with_children=None
with_children=None,
):
"""Suppress one or more features that match criteria.
Expand Down Expand Up @@ -622,10 +638,7 @@ def suppress(
None
"""
data = {
"clip": True,
"with_children": True
}
data = {"clip": True, "with_children": True}
if file_ is not None:
data["file"] = file_
else:
Expand Down Expand Up @@ -681,8 +694,10 @@ def user_select_csys(client, file_=None, max_=None):
UNREGENERATED.
feat_id (int):
Feature ID.
feat_number (int):
Feature Number.
file (str):
File name containing the feature.
path (list:int):
Component Path to feature (optionnal)
"""
data = {
Expand Down
Loading

0 comments on commit 32b2aa3

Please sign in to comment.