From 66845882cecc36a3d07c87ff4d44b7a54d408e1e Mon Sep 17 00:00:00 2001 From: tmartine Date: Mon, 8 Dec 2025 16:29:45 +0100 Subject: [PATCH 1/7] adding function to read tilt angle from HOD feature and put it in HOA feature --- ansys_optical_automation/application/HODtoHOA.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ansys_optical_automation/application/HODtoHOA.py b/ansys_optical_automation/application/HODtoHOA.py index 5374bf35..7dce9a4c 100644 --- a/ansys_optical_automation/application/HODtoHOA.py +++ b/ansys_optical_automation/application/HODtoHOA.py @@ -6,6 +6,7 @@ # Limits : # Works only if the HOD feature is located in the main assembly # Script only runs from Speos +# Works from 26R1 (request the display of Tilt Angle in the HOD feature) # Asking user to select the HOD feature result = InputHelper.PauseAndGetInput("Choose HOD element") @@ -151,11 +152,18 @@ break if not TiltAxisFound: Display = MessageBox.Show( - "Tilt axis can't be found, please select it manually and set the rotation values" + "Tilt axis can't be found, please select it manually" ) ApplicationHelper.ReportWarning( - "Tilt axis can't be found, please select it manually and set the rotation values" + "Tilt axis can't be found, please select it manually" ) + n = 0 + while n < eyebox_number: + AdvancedParameterName = "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[ + n].EBConfigName + hoaSim.Eyebox.EBConfigurations[n].TiltAngle = hodObject.AdvancedParameters[ + AdvancedParameterName] + n = n + 1 # PGU # PGU Center @@ -208,11 +216,9 @@ if MultiTicked: Display = MessageBox.Show( "HOA simulation created, do not forget to add warping, report and windshield outer face if needed. " - "Please set the mirrors rotation angle values" ) ApplicationHelper.ReportInformation( "HOA simulation created, do not forget to add warping, report and windshield outer face if needed. " - "Please set the mirrors rotation angle values" ) # Warping, report and windshield outer face doesn't exist in HOD feature so can't be retrieve else: From 7feec10895c47c50c02689ca6d5d265ff175f28f Mon Sep 17 00:00:00 2001 From: ThomasMartineauAnsys <149151020+ThomasMartineauAnsys@users.noreply.github.com> Date: Tue, 9 Dec 2025 12:05:48 +0100 Subject: [PATCH 2/7] Update HODtoHOA.py format update --- ansys_optical_automation/application/HODtoHOA.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/ansys_optical_automation/application/HODtoHOA.py b/ansys_optical_automation/application/HODtoHOA.py index 7dce9a4c..b3fb9db3 100644 --- a/ansys_optical_automation/application/HODtoHOA.py +++ b/ansys_optical_automation/application/HODtoHOA.py @@ -151,12 +151,8 @@ TiltAxisFound = True break if not TiltAxisFound: - Display = MessageBox.Show( - "Tilt axis can't be found, please select it manually" - ) - ApplicationHelper.ReportWarning( - "Tilt axis can't be found, please select it manually" - ) + Display = MessageBox.Show("Tilt axis can't be found, please select it manually") + ApplicationHelper.ReportWarning("Tilt axis can't be found, please select it manually") n = 0 while n < eyebox_number: AdvancedParameterName = "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[ From bb9d1db0c13f42170d44e859e1afee590196fd22 Mon Sep 17 00:00:00 2001 From: ThomasMartineauAnsys <149151020+ThomasMartineauAnsys@users.noreply.github.com> Date: Tue, 9 Dec 2025 12:11:01 +0100 Subject: [PATCH 3/7] Update HODtoHOA.py formating --- ansys_optical_automation/application/HODtoHOA.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ansys_optical_automation/application/HODtoHOA.py b/ansys_optical_automation/application/HODtoHOA.py index b3fb9db3..aa21008e 100644 --- a/ansys_optical_automation/application/HODtoHOA.py +++ b/ansys_optical_automation/application/HODtoHOA.py @@ -155,10 +155,12 @@ ApplicationHelper.ReportWarning("Tilt axis can't be found, please select it manually") n = 0 while n < eyebox_number: - AdvancedParameterName = "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[ - n].EBConfigName + AdvancedParameterName = ( ++ "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[n].EBConfigName ++ ) hoaSim.Eyebox.EBConfigurations[n].TiltAngle = hodObject.AdvancedParameters[ - AdvancedParameterName] + AdvancedParameterName ++ ] n = n + 1 # PGU From 82ee583afda32a09474240635a0835c78e0377f4 Mon Sep 17 00:00:00 2001 From: ThomasMartineauAnsys <149151020+ThomasMartineauAnsys@users.noreply.github.com> Date: Tue, 9 Dec 2025 14:04:00 +0100 Subject: [PATCH 4/7] Update ansys_optical_automation/application/HODtoHOA.py Co-authored-by: Pengyuan LU <89462462+pluAtAnsys@users.noreply.github.com> --- ansys_optical_automation/application/HODtoHOA.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ansys_optical_automation/application/HODtoHOA.py b/ansys_optical_automation/application/HODtoHOA.py index aa21008e..f72844bd 100644 --- a/ansys_optical_automation/application/HODtoHOA.py +++ b/ansys_optical_automation/application/HODtoHOA.py @@ -8,6 +8,10 @@ # Script only runs from Speos # Works from 26R1 (request the display of Tilt Angle in the HOD feature) +version = int(dir(SpaceClaim.Api)[0][1:]) +if not version >= 261: + raise TypeError("this example does not support running in version before 26R1") + # Asking user to select the HOD feature result = InputHelper.PauseAndGetInput("Choose HOD element") current_sel = result.PrimarySelection From e6a76c40dc73966742d8b23103beaefd59b3bd21 Mon Sep 17 00:00:00 2001 From: plu Date: Tue, 9 Dec 2025 16:10:39 +0000 Subject: [PATCH 5/7] pre-commit correction --- ansys_optical_automation/application/HODtoHOA.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansys_optical_automation/application/HODtoHOA.py b/ansys_optical_automation/application/HODtoHOA.py index f72844bd..f9b0af03 100644 --- a/ansys_optical_automation/application/HODtoHOA.py +++ b/ansys_optical_automation/application/HODtoHOA.py @@ -160,11 +160,11 @@ n = 0 while n < eyebox_number: AdvancedParameterName = ( -+ "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[n].EBConfigName -+ ) + "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[n].EBConfigName + ) hoaSim.Eyebox.EBConfigurations[n].TiltAngle = hodObject.AdvancedParameters[ AdvancedParameterName -+ ] + ] n = n + 1 # PGU From 61df8682d1e61394f0215bfed21d4ea076f024a2 Mon Sep 17 00:00:00 2001 From: tmartine Date: Wed, 10 Dec 2025 17:18:31 +0100 Subject: [PATCH 6/7] adding function to read tilt angle from HOD feature and put it in HOA feature --- .../application/HODtoHOA.py | 54 +++++++++---------- 1 file changed, 24 insertions(+), 30 deletions(-) diff --git a/ansys_optical_automation/application/HODtoHOA.py b/ansys_optical_automation/application/HODtoHOA.py index f9b0af03..eec7a3e0 100644 --- a/ansys_optical_automation/application/HODtoHOA.py +++ b/ansys_optical_automation/application/HODtoHOA.py @@ -6,11 +6,7 @@ # Limits : # Works only if the HOD feature is located in the main assembly # Script only runs from Speos -# Works from 26R1 (request the display of Tilt Angle in the HOD feature) - -version = int(dir(SpaceClaim.Api)[0][1:]) -if not version >= 261: - raise TypeError("this example does not support running in version before 26R1") +# Tilt angle function works from 26R1 (request the display of Tilt Angle in the HOD feature) # Asking user to select the HOD feature result = InputHelper.PauseAndGetInput("Choose HOD element") @@ -157,15 +153,23 @@ if not TiltAxisFound: Display = MessageBox.Show("Tilt axis can't be found, please select it manually") ApplicationHelper.ReportWarning("Tilt axis can't be found, please select it manually") - n = 0 - while n < eyebox_number: - AdvancedParameterName = ( - "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[n].EBConfigName - ) - hoaSim.Eyebox.EBConfigurations[n].TiltAngle = hodObject.AdvancedParameters[ - AdvancedParameterName - ] - n = n + 1 + + version = int(dir(SpaceClaim.Api)[0][1:]) + if not version >= 261: + Display = MessageBox.Show("Speos version is older than 2026R1, Tilt angles can't be retrieved," + " please add them manually") + ApplicationHelper.ReportWarning("Speos version is older than 2026R1, Tilt angles can't be " + "retrieved, please add them manually") + else: + n = 0 + while n < eyebox_number: + AdvancedParameterName = ( + "[" + hod_name + "]" + "_Tilt Angle " + hodObject.EBConfigurations[n].EBConfigName + ) + hoaSim.Eyebox.EBConfigurations[n].TiltAngle = hodObject.AdvancedParameters[ + AdvancedParameterName + ] + n = n + 1 # PGU # PGU Center @@ -213,23 +217,13 @@ hoaSim.PGU.PGUHorizontalSize = hodObject.PGUHorizontalSize hoaSim.PGU.PGUVerticalSize = hodObject.PGUVerticalSize - # in case of multieyebox mirrors, the tilt angle can't be retrieve from HOD feature, - # manual operation mandatory - if MultiTicked: - Display = MessageBox.Show( - "HOA simulation created, do not forget to add warping, report and windshield outer face if needed. " - ) - ApplicationHelper.ReportInformation( - "HOA simulation created, do not forget to add warping, report and windshield outer face if needed. " - ) # Warping, report and windshield outer face doesn't exist in HOD feature so can't be retrieve - else: - Display = MessageBox.Show( - "HOA simulation created, do not forget to add warping, report and windshield outer face if needed" - ) - ApplicationHelper.ReportInformation( - "HOA simulation created, do not forget to add warping, report and windshield outer face if needed" - ) + Display = MessageBox.Show( + "HOA simulation created, do not forget to add warping, report and windshield outer face if needed" + ) + ApplicationHelper.ReportInformation( + "HOA simulation created, do not forget to add warping, report and windshield outer face if needed" + ) else: Display = MessageBox.Show("Please select a HOD feature") ApplicationHelper.ReportError("Please select a HOD feature") From 156f521a09b1d6dba43a2271dff3afa289976fe3 Mon Sep 17 00:00:00 2001 From: tmartine Date: Wed, 10 Dec 2025 18:15:31 +0100 Subject: [PATCH 7/7] adding function to read tilt angle from HOD feature and put it in HOA feature --- ansys_optical_automation/application/HODtoHOA.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ansys_optical_automation/application/HODtoHOA.py b/ansys_optical_automation/application/HODtoHOA.py index eec7a3e0..b1211c90 100644 --- a/ansys_optical_automation/application/HODtoHOA.py +++ b/ansys_optical_automation/application/HODtoHOA.py @@ -156,10 +156,14 @@ version = int(dir(SpaceClaim.Api)[0][1:]) if not version >= 261: - Display = MessageBox.Show("Speos version is older than 2026R1, Tilt angles can't be retrieved," - " please add them manually") - ApplicationHelper.ReportWarning("Speos version is older than 2026R1, Tilt angles can't be " - "retrieved, please add them manually") + Display = MessageBox.Show( + "Speos version is older than 2026R1, Tilt angles can't be retrieved," + " please add them manually" + ) + ApplicationHelper.ReportWarning( + "Speos version is older than 2026R1, Tilt angles can't be " + "retrieved, please add them manually" + ) else: n = 0 while n < eyebox_number: