Skip to content

Commit cdb04c4

Browse files
committed
FIX a lot of minor fixes
1 parent a82a4c3 commit cdb04c4

File tree

15 files changed

+4443
-6892
lines changed

15 files changed

+4443
-6892
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,5 +247,3 @@ cython_debug/
247247

248248
# egg-info
249249
*.egg-info/
250-
deps/eigen
251-
deps/pybind11

deps/eigen

Submodule eigen updated from c29c800 to 3f06651

src/gh/components/DF_cloud_cloud_distance/code.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def RunScript(self,
5151
df_cloud_target_list = [df_cvt_bindings.cvt_rhcloud_2_dfcloud(i_cl_t) for i_cl_t in i_cloud_target]
5252

5353
# calculate distances
54-
o_results = df_error_estimation.cloud_2_cloud_comparison(df_cloud_source_list, df_cloud_target_list)
54+
o_results = df_error_estimation.df_cloud_2_df_cloud_comparison(df_cloud_source_list, df_cloud_target_list)
5555

5656
return o_results.distances, o_results.distances_rmse, o_results.distances_max_deviation, o_results.distances_min_deviation, o_results.distances_sd_deviation, o_results
5757

src/gh/components/DF_cloud_cloud_distance/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@
9292
"graft": false
9393
},
9494
{
95-
"name": "o_results",
96-
"nickname": "o_results",
95+
"name": "o_result",
96+
"nickname": "o_result",
9797
"description": "The result of the distance calculation.",
9898
"optional": false,
9999
"sourceCount": 0,

src/gh/components/DF_cloud_mesh_distance/code.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ def RunScript(self,
4444

4545
# conversion
4646
df_cloud_source_list = [df_cvt_bindings.cvt_rhcloud_2_dfcloud(i_cl_s) for i_cl_s in i_cloud_source]
47-
df_mesh_target_list = [beam.to_mesh(i_analysis_resolution) for beam in i_beams]
47+
rh_mesh_target_list = [beam.to_mesh(i_analysis_resolution) for beam in i_beams]
4848

4949
# calculate distances
50-
o_result = df_error_estimation.cloud_2_rhino_mesh_comparison(df_cloud_source_list, df_mesh_target_list, i_signed_flag, i_swap)
50+
o_result = df_error_estimation.df_cloud_2_rh_mesh_comparison(df_cloud_source_list, rh_mesh_target_list, i_signed_flag, i_swap)
5151

52-
return o_result.distances, o_result.distances_mse, o_result.distances_max_deviation, o_result.distances_min_deviation, o_result.distances_sd_deviation, o_result
52+
return o_result.distances, o_result.distances_rmse, o_result.distances_max_deviation, o_result.distances_min_deviation, o_result.distances_sd_deviation, o_result
5353

5454

5555
# if __name__ == "__main__":
5656
# com = CloudMeshDistance()
57-
# o_distances, o_mse, o_max_deviation, o_min_deviation, o_std_deviation, o_results = com.RunScript(
57+
# o_distances, o_rmse, o_max_deviation, o_min_deviation, o_std_deviation, o_results = com.RunScript(
5858
# i_cloud_source,
5959
# i_beams,
6060
# i_signed_flag,

src/gh/components/DF_cvs_exporter/code.py

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import Grasshopper as gh
1111
from Grasshopper.Kernel import GH_RuntimeMessageLevel as RML
12-
12+
from diffCheck.df_error_estimation import DFVizResults
1313
import csv
1414
import os
1515

@@ -18,29 +18,42 @@ class CsvExporter(component):
1818
def RunScript(self,
1919
i_dump: bool,
2020
i_export_dir: str,
21-
i_results):
21+
i_file_name: str,
22+
i_export_seperate_files: bool,
23+
i_result: DFVizResults):
2224
"""
2325
The csv-exporter component exports a list of values to a .csv file
2426
2527
:param i_dump: A flag indicating whether to perform the export.
2628
:param i_export_dir: The directory where the CSV file will be saved.
29+
:param i_file_name: The name of the file
30+
:param i_export_seperate_files: whether to export a different file for each part
2731
:param i_values: A list of values to be exported.
32+
33+
:return o_success: A string notifying the user for the successful export
2834
"""
2935
if i_dump:
3036
# Ensure the export directory exists
3137
os.makedirs(i_export_dir, exist_ok=True)
3238

33-
# Define the CSV file path
34-
file_path = os.path.join(i_export_dir, 'exported_values.csv')
39+
if i_export_seperate_files:
40+
# Export each list of values to a separate file
41+
for idx, list_of_values in enumerate(i_result.distances):
42+
file_name = f"{i_file_name}_{idx + 1}.csv"
43+
file_path = os.path.join(i_export_dir, file_name)
44+
with open(file_path, mode='w', newline='') as file:
45+
writer = csv.writer(file)
46+
writer.writerow([list_of_values])
47+
else:
48+
# Export all values to a single file
49+
file_path = os.path.join(i_export_dir, f"{i_file_name}.csv")
50+
with open(file_path, mode='w', newline='') as file:
51+
writer = csv.writer(file)
52+
for list_of_values in i_result.distances:
53+
writer.writerow([list_of_values])
3554

36-
# Write the values to the CSV file
37-
with open(file_path, mode='w', newline='') as file:
38-
writer = csv.writer(file)
39-
for list_of_values in i_results.distances:
40-
writer.writerow([list_of_values])
41-
4255
o_success = "Successfully exported the values"
43-
56+
4457
return o_success
4558

4659

@@ -49,5 +62,7 @@ def RunScript(self,
4962
# o_cvs = com.RunScript(
5063
# i_dump,
5164
# i_export_dir,
65+
# i_file_name,
66+
# i_export_seperate_files,
5267
# i_results
5368
# )

src/gh/components/DF_cvs_exporter/metadata.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,32 @@
3838
"typeHintID": "str"
3939
},
4040
{
41-
"name": "i_results",
42-
"nickname": "i_results",
41+
"name": "i_file_name",
42+
"nickname": "i_file_name",
43+
"description": "The name for the file.",
44+
"optional": true,
45+
"allowTreeAccess": true,
46+
"showTypeHints": true,
47+
"scriptParamAccess": "item",
48+
"wireDisplay": "default",
49+
"sourceCount": 0,
50+
"typeHintID": "str"
51+
},
52+
{
53+
"name": "i_export_seperate_files",
54+
"nickname": "i_export_seperate_file",
55+
"description": "Whether to export one single file or seperate files per element.",
56+
"optional": true,
57+
"allowTreeAccess": true,
58+
"showTypeHints": true,
59+
"scriptParamAccess": "item",
60+
"wireDisplay": "default",
61+
"sourceCount": 0,
62+
"typeHintID": "bool"
63+
},
64+
{
65+
"name": "i_result",
66+
"nickname": "i_result",
4367
"description": "The result of the distance calculation to export",
4468
"optional": false,
4569
"allowTreeAccess": true,

src/gh/components/DF_visualization/code.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
from diffCheck import df_visualization
1515
from diffCheck.df_visualization import DFVizSettings
1616
from diffCheck.df_error_estimation import DFVizResults
17+
from diffCheck import diffcheck_bindings
1718

1819
class Visualization(component):
1920
def RunScript(self,

src/gh/components/DF_visualization_settings/code.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@ def RunScript(self,
3838
:returns o_viz_settings: the results of the comparison all in one object
3939
"""
4040

41+
42+
if i_palette not in ["Jet", "Rainbow", "RdPu", "Viridis"]:
43+
ghenv.Component.AddRuntimeMessage(RML.Warning, "Possible values for i_palette are: Jet, Rainbow, RdPu, Viridis")
44+
return None
45+
46+
if i_value_type not in ["Dist", "RMSE", "MAX", "MIN", "STD"]:
47+
ghenv.Component.AddRuntimeMessage(RML.Warning, "Possible values for i_value_type are: dist, RMSE, MAX, MIN, STD")
48+
return None
49+
4150
# set default values
42-
if i_palette is None: i_palette = "Jet"
4351
if i_legend_height is None: i_legend_height = 10
4452
if i_legend_width is None: i_legend_width = 0.5
4553
if i_legend_plane is None: i_legend_plane = rg.Plane.WorldXY

0 commit comments

Comments
 (0)