Skip to content

Commit

Permalink
Added polyline simplification to import_odb_archive and import_ipc258…
Browse files Browse the repository at this point in the history
…1_archive (#212)
  • Loading branch information
ansys-pwalters authored Jan 17, 2024
1 parent f7a9b0c commit ebc3cac
Showing 1 changed file with 38 additions and 3 deletions.
41 changes: 38 additions & 3 deletions src/ansys/sherlock/core/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ def import_odb_archive(
ims_stackup=False,
project=None,
cca_name=None,
polyline_simplification=False,
polyline_tolerance=0.1,
polyline_tolerance_units="mm",
):
"""Import an ODB++ archive file.
Expand All @@ -110,6 +113,12 @@ def import_odb_archive(
cca_name : str, optional
Name of the CCA name. The default is ``None``, in which case the
name of the ODB++ archive file is used for the CCA name.
polyline_simplification: bool, optional
Whether to enable polyline simplification
polyline_tolerance: float, optional
Polyline simplification tolerance
polyline_tolerance_units: str, optional
Polyline simplification tolerance units
Returns
-------
Expand All @@ -124,7 +133,10 @@ def import_odb_archive(
True, True,
ims_stackup=True,
project="Tutorial",
cca_name="Card")
cca_name="Card",
polyline_simplification=True,
polyline_tolerance=0.1,
polyline_tolerance_units="mm")
"""
try:
if archive_file == "":
Expand All @@ -151,6 +163,9 @@ def import_odb_archive(
imsStackup=ims_stackup,
project=project,
ccaName=cca_name,
polylineSimplification=polyline_simplification,
polylineTolerance=polyline_tolerance,
polylineToleranceUnits=polyline_tolerance_units,
)

response = self.stub.importODBArchive(request)
Expand All @@ -166,7 +181,15 @@ def import_odb_archive(
raise e

def import_ipc2581_archive(
self, archive_file, include_other_layers, guess_part_properties, project=None, cca_name=None
self,
archive_file,
include_other_layers,
guess_part_properties,
project=None,
cca_name=None,
polyline_simplification=False,
polyline_tolerance=0.1,
polyline_tolerance_units="mm",
):
"""Import an IPC-2581 archive file.
Expand All @@ -184,6 +207,12 @@ def import_ipc2581_archive(
cca_name : str, optional
Name of the CCA. The default is ``None``, in which case the name of
the IPC-2581 archive file is used for the CCA name.
polyline_simplification: bool, optional
Whether to enable polyline simplification
polyline_tolerance: float, optional
Polyline simplification tolerance
polyline_tolerance_units: str, optional
Polyline simplification tolerance units
Returns
-------
Expand All @@ -196,7 +225,10 @@ def import_ipc2581_archive(
>>> sherlock = launch_sherlock()
>>> sherlock.project.import_ipc2581_archive("Tutorial.zip", True, True,
project="Tutorial",
cca_name="Card")
cca_name="Card",
polyline_simplification=True,
polyline_tolerance=0.1,
polyline_tolerance_units="mm")
"""
try:
if archive_file == "":
Expand All @@ -220,6 +252,9 @@ def import_ipc2581_archive(
guessPartProperties=guess_part_properties,
project=project,
ccaName=cca_name,
polylineSimplification=polyline_simplification,
polylineTolerance=polyline_tolerance,
polylineToleranceUnits=polyline_tolerance_units,
)

response = self.stub.importIPC2581Archive(request)
Expand Down

0 comments on commit ebc3cac

Please sign in to comment.