PySimultan 0.6.1__py3-none-any.whl → 0.6.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- PySimultan2/CHANGELOG.md +7 -0
- PySimultan2/__about__.py +1 -1
- PySimultan2/data_model.py +1 -1
- PySimultan2/default_types.py +8 -3
- PySimultan2/files.py +39 -5
- PySimultan2/multi_values.py +59 -2
- PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
- PySimultan2/resources/SIMULTAN.Lang.xml +398 -21
- PySimultan2/resources/SIMULTAN.Plugins.dll +0 -0
- PySimultan2/resources/SIMULTAN.Plugins.xml +367 -0
- PySimultan2/resources/SIMULTAN.dll +0 -0
- PySimultan2/resources/SIMULTAN.xml +521 -86
- PySimultan2/utils.py +3 -2
- {pysimultan-0.6.1.dist-info → pysimultan-0.6.4.dist-info}/METADATA +4 -1
- pysimultan-0.6.4.dist-info/RECORD +50 -0
- pysimultan-0.6.4.dist-info/licenses/LICENSE.txt +29 -0
- PySimultan2/resources/AssimpNet.dll +0 -0
- PySimultan2/resources/AvalonDock.dll +0 -0
- PySimultan2/resources/BruTile.dll +0 -0
- PySimultan2/resources/ComponentBuilder.dll +0 -0
- PySimultan2/resources/ComponentBuilder.dll.config +0 -56
- PySimultan2/resources/ComponentBuilder.runtimeconfig.json +0 -19
- PySimultan2/resources/ComponentBuilder.xml +0 -19291
- PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
- PySimultan2/resources/HelixToolkit.Core.Wpf.dll +0 -0
- PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll +0 -0
- PySimultan2/resources/HelixToolkit.SharpDX.Core.dll +0 -0
- PySimultan2/resources/HelixToolkit.dll +0 -0
- PySimultan2/resources/Python.Runtime.dll +0 -0
- PySimultan2/resources/SIMULTAN.UI.dll +0 -0
- PySimultan2/resources/SIMULTAN.UI.xml +0 -16079
- PySimultan2/resources/SharpDX.D3DCompiler.dll +0 -0
- PySimultan2/resources/SharpDX.DXGI.dll +0 -0
- PySimultan2/resources/SharpDX.Direct2D1.dll +0 -0
- PySimultan2/resources/SharpDX.Direct3D11.dll +0 -0
- PySimultan2/resources/SharpDX.Direct3D9.dll +0 -0
- PySimultan2/resources/SharpDX.dll +0 -0
- PySimultan2/resources/System.Collections.Immutable.dll +0 -0
- PySimultan2/resources/System.Reflection.Metadata.dll +0 -0
- PySimultan2/resources/XAMLMarkupExtensions.dll +0 -0
- PySimultan2/resources/assimp.dll +0 -0
- PySimultan2/resources/componentmanager.user +0 -0
- PySimultan2/resources/defaultsettings.xml +0 -0
- PySimultan2/resources/setup.bat +0 -1
- pysimultan-0.6.1.dist-info/RECORD +0 -76
- pysimultan-0.6.1.dist-info/licenses/LICENSE.txt +0 -9
- {pysimultan-0.6.1.dist-info → pysimultan-0.6.4.dist-info}/WHEEL +0 -0
PySimultan2/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
|
+
Version 0.6.2 (28.03.2024)
|
2
|
+
- Added extended functionality to ComponentDictionary
|
3
|
+
- Bugfixing
|
4
|
+
|
1
5
|
Version 0.6.1 (24.02.2024)
|
2
6
|
- Bugfixes in default_types and File/Directory handling
|
3
7
|
|
8
|
+
Version 0.6.0.7 (16.02.2024)
|
9
|
+
- Fixed Asset creation and deletion bugs
|
10
|
+
|
4
11
|
Version 0.6.0.3 (23.01.2024)
|
5
12
|
- Added sub_classes and super_classes to SimultanObject
|
6
13
|
|
PySimultan2/__about__.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
version = '0.6.
|
1
|
+
version = '0.6.4'
|
PySimultan2/data_model.py
CHANGED
@@ -603,7 +603,7 @@ class DataModel:
|
|
603
603
|
try:
|
604
604
|
act_filename = filename.replace('\\', os.sep)
|
605
605
|
except TypeError:
|
606
|
-
act_filename = filename
|
606
|
+
act_filename = str(filename)
|
607
607
|
|
608
608
|
if not act_filename.startswith(self.project.ProjectUnpackFolder.FullPath) and target_dir is None:
|
609
609
|
target_dir_str = self.project.ProjectUnpackFolder.FullPath
|
PySimultan2/default_types.py
CHANGED
@@ -520,11 +520,13 @@ class ComponentDictionary(SimultanObject):
|
|
520
520
|
|
521
521
|
def __setitem__(self, key, value):
|
522
522
|
|
523
|
-
if key in self._dict:
|
524
|
-
|
523
|
+
# if key in self._dict:
|
524
|
+
# del self._dict[key]
|
525
525
|
|
526
526
|
if key in self._taxonomy_map.content_dict.keys():
|
527
527
|
content = self._taxonomy_map.content_dict[key]
|
528
|
+
elif '__dict_key__' + key in self._taxonomy_map.content_dict.keys():
|
529
|
+
content = self._taxonomy_map.content_dict['__dict_key__' + key]
|
528
530
|
else:
|
529
531
|
content = Content(text_or_key=f'__dict_key__{key}',
|
530
532
|
property_name=key,
|
@@ -574,7 +576,10 @@ class ComponentDictionary(SimultanObject):
|
|
574
576
|
|
575
577
|
def __delitem__(self, key):
|
576
578
|
self[key] = None
|
577
|
-
|
579
|
+
try:
|
580
|
+
del self._dict[key]
|
581
|
+
except KeyError:
|
582
|
+
pass
|
578
583
|
|
579
584
|
def items(self):
|
580
585
|
if self._dict is None or not self._dict:
|
PySimultan2/files.py
CHANGED
@@ -307,6 +307,8 @@ class FileInfo(object, metaclass=MetaMock):
|
|
307
307
|
full_path = os.path.join(target_dir.CurrentFullPath, filename)
|
308
308
|
elif isinstance(target_dir, str):
|
309
309
|
full_path = os.path.join(target_dir, filename)
|
310
|
+
else:
|
311
|
+
raise ValueError(f'Unsupported target_dir format')
|
310
312
|
else:
|
311
313
|
if not filename.startswith(str(data_model.project.ProjectUnpackFolder)):
|
312
314
|
full_path = os.path.join(str(data_model.project.ProjectUnpackFolder), filename)
|
@@ -614,6 +616,15 @@ class DirectoryInfo(object, metaclass=DirectoryInfoMetaMock):
|
|
614
616
|
add_sub_directories: bool = True,
|
615
617
|
*args,
|
616
618
|
**kwargs) -> DirectoryInfo:
|
619
|
+
"""
|
620
|
+
Create a directory info object from an existing directory.
|
621
|
+
:param directory_path: the path to the directory
|
622
|
+
:param add_files:
|
623
|
+
:param add_sub_directories:
|
624
|
+
:param args:
|
625
|
+
:param kwargs:
|
626
|
+
:return:
|
627
|
+
"""
|
617
628
|
|
618
629
|
data_model = kwargs.get('data_model', config.get_default_data_model())
|
619
630
|
|
@@ -647,6 +658,33 @@ class DirectoryInfo(object, metaclass=DirectoryInfoMetaMock):
|
|
647
658
|
|
648
659
|
return directory_info
|
649
660
|
|
661
|
+
@classmethod
|
662
|
+
def from_existing_directory_copy(cls,
|
663
|
+
directory_path: str,
|
664
|
+
destination_path: str,
|
665
|
+
add_files: bool = True,
|
666
|
+
add_sub_directories: bool = True,
|
667
|
+
*args,
|
668
|
+
**kwargs) -> DirectoryInfo:
|
669
|
+
|
670
|
+
"""
|
671
|
+
Create a directory info object from an existing directory which is copied to a directory in the project.
|
672
|
+
:param directory_path:
|
673
|
+
:param destination_path: the path to the directory (in the project)
|
674
|
+
:param add_files:
|
675
|
+
:param add_sub_directories:
|
676
|
+
:param args:
|
677
|
+
:param kwargs:
|
678
|
+
:return:
|
679
|
+
"""
|
680
|
+
|
681
|
+
shutil.copytree(directory_path, destination_path)
|
682
|
+
return cls.from_existing_directory(destination_path,
|
683
|
+
add_files=add_files,
|
684
|
+
add_sub_directories=add_sub_directories,
|
685
|
+
*args,
|
686
|
+
**kwargs)
|
687
|
+
|
650
688
|
def __init__(self,
|
651
689
|
path: Optional[str] = None,
|
652
690
|
helper_file: Optional[FileInfo] = None,
|
@@ -781,11 +819,7 @@ class DirectoryInfo(object, metaclass=DirectoryInfoMetaMock):
|
|
781
819
|
|
782
820
|
def get_file(self, filename: str) -> Optional[FileInfo]:
|
783
821
|
resource = next((x for x in self.files if x.resource_entry.Name == filename), None)
|
784
|
-
|
785
|
-
return FileInfo(resource_entry=resource,
|
786
|
-
data_model=self.data_model)
|
787
|
-
else:
|
788
|
-
return None
|
822
|
+
return resource
|
789
823
|
|
790
824
|
def add_file(self,
|
791
825
|
filename: str,
|
PySimultan2/multi_values.py
CHANGED
@@ -129,7 +129,9 @@ def simultan_multi_value_big_table_to_pandas(field: SimMultiValueBigTable) -> pd
|
|
129
129
|
return df
|
130
130
|
|
131
131
|
|
132
|
-
def simultan_multi_value_field_3d_to_numpy(field: SimMultiValueField3D,
|
132
|
+
def simultan_multi_value_field_3d_to_numpy(field: SimMultiValueField3D,
|
133
|
+
assert_ordered=False,
|
134
|
+
squeeze: bool = True) -> np.ndarray:
|
133
135
|
"""
|
134
136
|
Convert a SimMultiValueField3D object to a numpy array.
|
135
137
|
:param field:
|
@@ -150,7 +152,10 @@ def simultan_multi_value_field_3d_to_numpy(field: SimMultiValueField3D, assert_o
|
|
150
152
|
for comb in product(range(len(field.XAxis)), range(len(field.YAxis)), range(len(field.ZAxis)), repeat=1):
|
151
153
|
array[comb[0], comb[1], comb[2]] = field[comb[0], comb[1], comb[2]]
|
152
154
|
|
153
|
-
|
155
|
+
if squeeze:
|
156
|
+
return np.squeeze(array)
|
157
|
+
else:
|
158
|
+
return array
|
154
159
|
|
155
160
|
|
156
161
|
def add_field_to_data_model(field: SimMultiValueField3D, data_model: 'SimultanObject') -> SimMultiValueField3D:
|
@@ -288,3 +293,55 @@ def create_field_parameter(value: Union[SimMultiValueField3D, np.ndarray, DataFr
|
|
288
293
|
)
|
289
294
|
|
290
295
|
return param
|
296
|
+
|
297
|
+
|
298
|
+
def add_row(field: SimMultiValueField3D,
|
299
|
+
dim: int = 0):
|
300
|
+
|
301
|
+
array = simultan_multi_value_field_3d_to_numpy(field, squeeze=False)
|
302
|
+
|
303
|
+
new_shape = list(array.shape)
|
304
|
+
if new_shape.__len__() - 1 < dim:
|
305
|
+
while new_shape.__len__() - 1 < dim:
|
306
|
+
new_shape.append(1)
|
307
|
+
new_shape[dim] += 1
|
308
|
+
|
309
|
+
# data = NetList[Double](Array[Double](array.astype(float).flatten(order='F')))
|
310
|
+
|
311
|
+
while field.XAxis.Count < new_shape[0]:
|
312
|
+
field.XAxis.Add(field.XAxis.Count+1)
|
313
|
+
while field.YAxis.Count < new_shape[1]:
|
314
|
+
field.YAxis.Add(field.YAxis.Count+1)
|
315
|
+
while field.ZAxis.Count < new_shape[2]:
|
316
|
+
field.ZAxis.Add(field.ZAxis.Count+1)
|
317
|
+
|
318
|
+
resized_array = np.resize(array, new_shape)
|
319
|
+
|
320
|
+
for i, j, k in zip(range(new_shape[0]), range(new_shape[1]), range(new_shape[2])):
|
321
|
+
field[i, j, k] = resized_array[i, j, k]
|
322
|
+
|
323
|
+
return field
|
324
|
+
|
325
|
+
|
326
|
+
def resize(field: SimMultiValueField3D,
|
327
|
+
new_shape: list[int]) -> SimMultiValueField3D:
|
328
|
+
"""
|
329
|
+
Resize a SimMultiValueField3D object to a new shape.
|
330
|
+
:param field: The SimMultiValueField3D object
|
331
|
+
:param new_shape: The new shape of the field, e.g. [10, 20, 30]
|
332
|
+
:return: SimMultiValueField3D
|
333
|
+
"""
|
334
|
+
array = simultan_multi_value_field_3d_to_numpy(field, squeeze=False)
|
335
|
+
resized_array = np.resize(array, new_shape)
|
336
|
+
|
337
|
+
while field.XAxis.Count < resized_array.shape[0]:
|
338
|
+
field.XAxis.Add(field.XAxis.Count+1)
|
339
|
+
while field.YAxis.Count < resized_array.shape[1]:
|
340
|
+
field.YAxis.Add(field.YAxis.Count+1)
|
341
|
+
while field.ZAxis.Count < resized_array.shape[2]:
|
342
|
+
field.ZAxis.Add(field.ZAxis.Count+1)
|
343
|
+
|
344
|
+
for i, j, k in zip(range(new_shape[0]), range(new_shape[1]), range(new_shape[2])):
|
345
|
+
field[i, j, k] = resized_array[i, j, k]
|
346
|
+
|
347
|
+
return field
|
Binary file
|