Skip to content

Commit

Permalink
Merge branch 'release/v0.7.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Zepmanbc committed Mar 23, 2021
2 parents 32b2aa3 + 3d019a3 commit bc45241
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 162 deletions.
6 changes: 6 additions & 0 deletions HISTORY.rst
Expand Up @@ -2,6 +2,12 @@
History
=======

0.7.1 (2021-03-23)
------------------

* BugFix:
* `file_get_active` returns `{}` instead of `None` with Creoson 2.8.0

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

Expand Down
2 changes: 1 addition & 1 deletion creopyson/__init__.py
Expand Up @@ -4,7 +4,7 @@

__author__ = """Benjamin C."""
__email__ = "zepman@gmail.com"
__version__ = "__version__ = '0.7.0'"
__version__ = "__version__ = '0.7.1'"

from creopyson.connection import Client
from creopyson.objects import jlpoint
Expand Down
4 changes: 2 additions & 2 deletions creopyson/bom.py
Expand Up @@ -8,7 +8,7 @@ def get_paths(
skeletons=None,
top_level=None,
get_transforms=None,
exclude_inactive=None
exclude_inactive=None,
):
"""Get a hierarchy of components within an assembly.
Expand Down Expand Up @@ -57,7 +57,7 @@ def get_paths(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if paths:
data["paths"] = paths
Expand Down
35 changes: 10 additions & 25 deletions creopyson/dimension.py
Expand Up @@ -20,29 +20,19 @@ def copy(client, name, to_name, file_=None, to_file=None):
None
"""
data = {
"name": name,
"to_name": to_name
}
data = {"name": name, "to_name": to_name}
if file_ is not None:
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if to_file:
data["to_file"] = to_file
return client._creoson_post("dimension", "copy", data)


def list_(
client,
name=None,
file_=None,
dim_type=None,
encoded=None,
select=False
):
def list_(client, name=None, file_=None, dim_type=None, encoded=None, select=False):
"""Get a list of dimensions from a model.
If select is true, then the current selection in Creo will be cleared even
Expand Down Expand Up @@ -84,7 +74,7 @@ def list_(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
if isinstance(name, (str)):
Expand All @@ -101,12 +91,7 @@ def list_(


def list_detail(
client,
name=None,
file_=None,
dim_type=None,
encoded=None,
select=False
client, name=None, file_=None, dim_type=None, encoded=None, select=False
):
"""Get a list of dimension details from a model.
Expand Down Expand Up @@ -173,7 +158,7 @@ def list_detail(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
if isinstance(name, (str)):
Expand Down Expand Up @@ -227,7 +212,7 @@ def set_(client, name, value, file_=None, encoded=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if encoded:
data["encoded"] = encoded
Expand Down Expand Up @@ -261,7 +246,7 @@ def set_text(client, name, file_=None, text=None, encoded=False):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if text:
data["text"] = text
Expand Down Expand Up @@ -295,7 +280,7 @@ def show(client, name, file_=None, assembly=None, path=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if assembly:
data["assembly"] = assembly
Expand Down Expand Up @@ -338,7 +323,7 @@ def user_select(client, file_=None, maxi=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if maxi:
data["max"] = maxi
Expand Down
40 changes: 15 additions & 25 deletions creopyson/familytable.py
Expand Up @@ -23,7 +23,7 @@ def add_inst(client, instance, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "add_inst", data)

Expand All @@ -48,7 +48,7 @@ def create_inst(client, instance, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "create_inst", data, "name")

Expand All @@ -73,7 +73,7 @@ def delete_inst(client, instance, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "delete_inst", data)

Expand All @@ -97,7 +97,7 @@ def delete(client, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "delete", data)

Expand All @@ -124,7 +124,7 @@ def exists(client, instance, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "exists", data, "exists")

Expand Down Expand Up @@ -156,15 +156,12 @@ def get_cell(client, instance, colid, file_=None):
Column Type; a string corresponding to the Creo column type.
"""
data = {
"instance": instance,
"colid": colid
}
data = {"instance": instance, "colid": colid}
if file_ is not None:
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "get_cell", data)

Expand Down Expand Up @@ -196,7 +193,7 @@ def get_header(client, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "get_header", data, "columns")

Expand All @@ -222,7 +219,7 @@ def get_parents(client, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "get_parents", data, "parents")

Expand Down Expand Up @@ -255,7 +252,7 @@ def get_row(client, instance, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "get_row", data, "columns")

Expand All @@ -281,7 +278,7 @@ def list_(client, file_=None, instance=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if instance:
data["instance"] = instance
Expand Down Expand Up @@ -320,21 +317,14 @@ def list_tree(client, file_=None, erase=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if erase:
data["erase"] = erase
return client._creoson_post("familytable", "list_tree", data, "children")


def replace(
client,
cur_model,
new_inst,
file_=None,
cur_inst=None,
path=None
):
def replace(client, cur_model, new_inst, file_=None, cur_inst=None, path=None):
"""Replace a model in an assembly with another inst in the same family table.
You must specify either cur_inst or path.
Expand Down Expand Up @@ -366,7 +356,7 @@ def replace(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if cur_inst:
data["cur_inst"] = cur_inst
Expand Down Expand Up @@ -405,6 +395,6 @@ def set_cell(client, instance, colid, value, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
return client._creoson_post("familytable", "set_cell", data)
24 changes: 12 additions & 12 deletions creopyson/feature.py
Expand Up @@ -47,7 +47,7 @@ def delete(client, name=None, file_=None, status=None, type_=None, clip=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
if isinstance(name, (str)):
Expand Down Expand Up @@ -89,7 +89,7 @@ def delete_param(client, name=None, file_=None, param=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
data["name"] = name
Expand Down Expand Up @@ -172,7 +172,7 @@ def list_(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
data["name"] = name
Expand Down Expand Up @@ -267,7 +267,7 @@ def list_params(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
if isinstance(param, (str)):
Expand Down Expand Up @@ -319,7 +319,7 @@ def list_group_features(client, group_name, type_=None, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if type_:
data["type"] = type_
Expand Down Expand Up @@ -351,7 +351,7 @@ def list_pattern_features(client, patter_name, type_=None, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if type_:
data["type"] = type_
Expand Down Expand Up @@ -412,7 +412,7 @@ def param_exists(client, file_=None, name=None, param=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
data["name"] = name
Expand Down Expand Up @@ -447,7 +447,7 @@ def rename(client, name, new_name, file_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if isinstance(name, (str)):
data["name"] = name
Expand Down Expand Up @@ -500,7 +500,7 @@ def resume(client, file_=None, name=None, status=None, type_=None, with_children
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
if isinstance(name, (int)):
Expand Down Expand Up @@ -571,7 +571,7 @@ def set_param(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
data["name"] = name
Expand Down Expand Up @@ -643,7 +643,7 @@ def suppress(
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if name:
if isinstance(name, (int)):
Expand Down Expand Up @@ -707,7 +707,7 @@ def user_select_csys(client, file_=None, max_=None):
data["file"] = file_
else:
active_file = client.file_get_active()
if active_file is not None:
if active_file:
data["file"] = active_file["file"]
if max_:
data["max"] = max_
Expand Down

0 comments on commit bc45241

Please sign in to comment.