Skip to content

Commit ce7ef71

Browse files
maxcapodi78pyansys-ci-botSamuelopez-ansys
authored andcommitted
FIX: Change default report resolution on VirtualCompliance (#6177)
Co-authored-by: pyansys-ci-bot <[email protected]> Co-authored-by: Samuel Lopez <[email protected]>
1 parent 20174a9 commit ce7ef71

File tree

3 files changed

+40
-15
lines changed

3 files changed

+40
-15
lines changed

doc/changelog.d/6177.fixed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Change default report resolution on VirtualCompliance

src/ansys/aedt/core/visualization/post/common.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ def export_report_to_csv(
924924
)
925925

926926
@pyaedt_function_handler(project_dir="project_path")
927-
def export_report_to_jpg(self, project_path, plot_name, width=0, height=0, image_format="jpg"):
927+
def export_report_to_jpg(self, project_path, plot_name, width=800, height=450, image_format="jpg"):
928928
"""Export plot to an image file.
929929
930930
Parameters
@@ -934,9 +934,9 @@ def export_report_to_jpg(self, project_path, plot_name, width=0, height=0, image
934934
plot_name : str
935935
Name of the plot to export.
936936
width : int, optional
937-
Image width. Default is ``0`` which takes Desktop size or 1980 pixel in case of non-graphical mode.
937+
Image width. Default is ``800`` which takes Desktop size or 800 pixel.
938938
height : int, optional
939-
Image height. Default is ``0`` which takes Desktop size or 1020 pixel in case of non-graphical mode.
939+
Image height. Default is ``450`` which takes Desktop size or 450 pixel.
940940
image_format : str, optional
941941
Format of the image file. The default is ``"jpg"``.
942942
@@ -950,11 +950,6 @@ def export_report_to_jpg(self, project_path, plot_name, width=0, height=0, image
950950
>>> oModule.ExportImageToFile
951951
"""
952952
file_name = os.path.join(project_path, plot_name + "." + image_format) # name of the image file
953-
if self._app.desktop_class.non_graphical: # pragma: no cover
954-
if width == 0:
955-
width = 1980
956-
if height == 0:
957-
height = 1020
958953
self.oreportsetup.ExportImageToFile(plot_name, file_name, width, height)
959954
return True
960955

src/ansys/aedt/core/visualization/post/compliance.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,26 @@ def __init__(self, desktop, template):
578578
self._summary_font = [["", None]]
579579
self.report_data = VirtualComplianceData()
580580
self.revision = "1.0"
581+
self._image_width = 800
582+
self._image_height = 450
583+
584+
@property
585+
def image_width(self):
586+
"""Image width resolution during export."""
587+
return self._image_width
588+
589+
@image_width.setter
590+
def image_width(self, val):
591+
self._image_width = val
592+
593+
@property
594+
def image_height(self):
595+
"""Image height resolution during export."""
596+
return self._image_height
597+
598+
@image_height.setter
599+
def image_height(self, val):
600+
self._image_height = val
581601

582602
@property
583603
def dut_image(self):
@@ -904,7 +924,9 @@ def _create_derived_reports(self):
904924
else:
905925
self._summary.append([template_report.name, "NO PASS/FAIL"])
906926
self._summary_font.append(["", None])
907-
out = _design.post.export_report_to_jpg(self._output_folder, aedt_report.plot_name)
927+
out = _design.post.export_report_to_jpg(
928+
self._output_folder, aedt_report.plot_name, width=self.image_width, height=self.image_height
929+
)
908930
if out:
909931
compliance_reports.add_image(
910932
{
@@ -1088,7 +1110,9 @@ def _create_derived_reports(self):
10881110
else:
10891111
self._summary.append([template_report.name, "NO PASS/FAIL"])
10901112
self._summary_font.append(["", None])
1091-
out = _design.post.export_report_to_jpg(self._output_folder, aedt_report.plot_name)
1113+
out = _design.post.export_report_to_jpg(
1114+
self._output_folder, aedt_report.plot_name, width=self.image_width, height=self.image_height
1115+
)
10921116
if out:
10931117
compliance_reports.add_image(
10941118
{
@@ -1184,7 +1208,9 @@ def _create_aedt_reports(self):
11841208
aedt_report.hide_legend()
11851209

11861210
time.sleep(1)
1187-
out = _design.post.export_report_to_jpg(self._output_folder, aedt_report.plot_name)
1211+
out = _design.post.export_report_to_jpg(
1212+
self._output_folder, aedt_report.plot_name, width=self.image_width, height=self.image_height
1213+
)
11881214
if tpx > 0:
11891215
compliance_reports.add_section()
11901216
compliance_reports.add_subchapter(f"{name}")
@@ -1251,7 +1277,9 @@ def _create_aedt_reports(self):
12511277
if report_type != "contour eye diagram" and "3D" not in local_config["report_type"]:
12521278
aedt_report.hide_legend()
12531279
time.sleep(1)
1254-
out = _design.post.export_report_to_jpg(self._output_folder, aedt_report.plot_name)
1280+
out = _design.post.export_report_to_jpg(
1281+
self._output_folder, aedt_report.plot_name, width=self.image_width, height=self.image_height
1282+
)
12551283
time.sleep(1)
12561284
if out:
12571285
if tpx + tpx1 > 0:
@@ -1460,7 +1488,7 @@ def _add_lna_violations(self, report, chapter, image_name, pass_fail_criteria):
14601488
test_value = limit_v["ypoints"][yy]
14611489
range_value, x_value, result_value = self._check_test_value(result_range, ypoints, hatch_above)
14621490
units = limit_v.get("yunits", "")
1463-
mystr = f"Zone {zones}"
1491+
mystr = f"Zone {zones}"
14641492
font_table.append([[255, 255, 255], [255, 0, 0]] if result_value == "FAIL" else ["", None])
14651493
pass_fail_table.append(
14661494
[
@@ -1692,12 +1720,12 @@ def create_compliance_report(self, file_name="compliance_test.pdf", close_projec
16921720
str
16931721
Path to the output file.
16941722
"""
1695-
self.report_data = VirtualComplianceData()
16961723
self.compute_report_data()
16971724
return self.create_pdf(file_name=file_name, close_project=close_project)
16981725

1699-
def compute_report_data(self):
1726+
def compute_report_data(self) -> VirtualComplianceData:
17001727
"""Compute the report data and exports all the images and table without creating the pdf."""
1728+
self.report_data = VirtualComplianceData()
17011729
if not self._project_name:
17021730
self.load_project()
17031731

@@ -1737,6 +1765,7 @@ def compute_report_data(self):
17371765
summary.add_table(
17381766
{"title": f"Simulation Summary", "content": self._summary, "formatting": self._summary_font}
17391767
)
1768+
return self.report_data
17401769

17411770
def create_pdf(self, file_name, close_project=True):
17421771
"""Create the PDF report after the method ``compute_report_data`` is called.

0 commit comments

Comments
 (0)