PySimultan 0.5.7__py3-none-any.whl → 0.5.9__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 CHANGED
@@ -1,3 +1,6 @@
1
+ Version 0.5.7 (11.12.2024)
2
+ - Added get_orientation_to_volume method to SimultanFace which returns the orientation of the face to the volume
3
+
1
4
  Version 0.5.3 (01.12.2024)
2
5
  - Added support for directories (Assets and FileInfo)
3
6
 
PySimultan2/__about__.py CHANGED
@@ -1 +1 @@
1
- version = '0.5.7'
1
+ version = '0.5.9'
PySimultan2/data_model.py CHANGED
@@ -532,6 +532,60 @@ class DataModel:
532
532
  )
533
533
  )
534
534
 
535
+ def add_resource_file(self,
536
+ filename: Union[str, FileInfo, PythonFileInfo],
537
+ target_dir: Union[ResourceDirectoryEntry, FileInfo, str] = None) -> ResourceEntry:
538
+
539
+ """
540
+ Add a file as resource to the project which already exists in the project folder
541
+ :param filename:
542
+ :param target_dir:
543
+ :return:
544
+ """
545
+
546
+ if isinstance(filename, str):
547
+ filename = FileInfo(filename)
548
+ elif isinstance(filename, PythonFileInfo):
549
+ filename = FileInfo(filename.full_path)
550
+
551
+ if target_dir is None:
552
+ # check if file is already in project folder
553
+ if not os.path.exists(os.path.join(str(self.project.ProjectUnpackFolder), filename.Name)):
554
+ raise FileNotFoundError(f'File {filename} not found in project folder {self.project.ProjectUnpackFolder}')
555
+
556
+ self.project.AddResourceFile(FileInfo(str(filename)),
557
+ self.project_data_manager)
558
+
559
+ full_filename = os.path.join(str(self.project.ProjectUnpackFolder), filename.Name)
560
+
561
+ return next(
562
+ (
563
+ x for x in self.project_data_manager.AssetManager.Resources if x.CurrentFullPath == full_filename
564
+ )
565
+ , None
566
+ )
567
+
568
+ else:
569
+ if isinstance(target_dir, str):
570
+ target_dir = DirectoryInfo(target_dir)
571
+ elif isinstance(target_dir, ResourceDirectoryEntry):
572
+ target_dir = DirectoryInfo(target_dir.CurrentFullPath)
573
+ elif isinstance(target_dir, FileInfo):
574
+ pass
575
+
576
+ # check if file is already in project folder
577
+ if not os.path.exists(os.path.join(target_dir.FullPath, filename.Name)):
578
+ raise FileNotFoundError(f'File {filename} not found in project folder {target_dir.FullPath}')
579
+
580
+ self.project.AddResourceFile(
581
+ FileInfo(os.path.join(target_dir.FullPath, filename.Name)),
582
+ self.project_data_manager)
583
+
584
+ # get added resource
585
+ return next((x for x in self.project_data_manager.AssetManager.Resources if
586
+ x.CurrentFullPath == os.path.join(target_dir.FullPath, filename.Name)), None)
587
+
588
+
535
589
  def add_resource(self,
536
590
  filename: Union[str, FileInfo],
537
591
  target_dir: Optional[Union[DirectoryInfo, ResourceDirectoryEntry, str]] = None,
PySimultan2/files.py CHANGED
@@ -281,6 +281,21 @@ class FileInfo(object, metaclass=MetaMock):
281
281
  file_info.write_content(content)
282
282
  return file_info
283
283
 
284
+ @classmethod
285
+ def from_existing_file(cls,
286
+ file_path: str,
287
+ *args,
288
+ **kwargs) -> FileInfo:
289
+
290
+ data_model = kwargs.get('data_model', config.get_default_data_model())
291
+ resource = data_model.add_resource_file(file_path)
292
+
293
+ return cls(resource_entry=resource,
294
+ data_model=data_model,
295
+ *args,
296
+ **kwargs)
297
+
298
+
284
299
  def __init__(self, file_path=None, *args, **kwargs):
285
300
  """
286
301
  Custom file info object to be used with the with statement. This object is used to open a file and close it
@@ -475,7 +490,10 @@ class FileInfo(object, metaclass=MetaMock):
475
490
  :return: None
476
491
  """
477
492
  if self.resource_entry is not None:
493
+ if self.resource_entry.Key in self._cls_instances:
494
+ del self._cls_instances[self.resource_entry.Key]
478
495
  self.data_model.delete_resource(self.resource_entry)
496
+
479
497
  os.remove(self.file_path)
480
498
 
481
499
  def to_json(self) -> dict:
@@ -471,6 +471,18 @@ class SimultanFace(ExtendedBaseGeometry):
471
471
 
472
472
  return vertices, triangles
473
473
 
474
+ def get_orientation_to_volume(self, volume: 'SimultanVolume') -> Optional[GeometricOrientation]:
475
+
476
+ p_face = next((x for x in volume._wrapped_object.Faces if x.Face.Id is self._wrapped_object.Id), None)
477
+
478
+ if p_face is None or p_face.Orientation == GeometricOrientation.Undefined:
479
+ return None
480
+
481
+ mul_1 = 1 if self.orientation == GeometricOrientation.Forward else -1
482
+ mul_2 = 1 if p_face.Orientation == GeometricOrientation.Forward else -1
483
+
484
+ return GeometricOrientation.Forward if mul_1 * mul_2 == 1 else GeometricOrientation.Backward
485
+
474
486
  def __repr__(self):
475
487
  return f"SimultanFace {self.id} ({self.boundary.id}, {[x.id for x in self.holes]})"
476
488
 
@@ -1,11 +1,12 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: PySimultan
3
- Version: 0.5.7
3
+ Version: 0.5.9
4
4
  Project-URL: Documentation, https://github.com/Bühler Maximilian/PySimultan2#readme
5
5
  Project-URL: Issues, https://github.com/Bühler Maximilian/PySimultan2/issues
6
6
  Project-URL: Source, https://github.com/Bühler Maximilian/PySimultan2
7
7
  Author-email: Bühler Maximilian <maximilian.buehler@tuwien.ac.at>
8
- License: MIT
8
+ License-Expression: MIT
9
+ License-File: LICENSE.txt
9
10
  Classifier: Development Status :: 4 - Beta
10
11
  Classifier: Programming Language :: Python
11
12
  Classifier: Programming Language :: Python :: 3.8
@@ -166,6 +167,13 @@ print(instances[0].param_1)
166
167
 
167
168
  # Change Log
168
169
 
170
+ ## [0.5.8] - 2024-12-17
171
+ - Added FileInfo.from_existing_file method to create FileInfo object from existing file in ProjectUnpackFolder
172
+
173
+ ## [0.5.7] - 2024-12-09
174
+ - Added support for different taxonomy for content
175
+ - Added support for numpy np.float32, np.float64 and np.int32, np.int64
176
+
169
177
  ## [0.4.20] - 2024-07-01
170
178
  - Fixed Bug in nested dictionary creation
171
179
 
@@ -1,9 +1,9 @@
1
- PySimultan2/CHANGELOG.md,sha256=LeVHBC6dGDwDwgXipNrwgvgews9QkyjsqtYa_jiLMm0,217
2
- PySimultan2/__about__.py,sha256=NWLby5oM381mpRW-BF0cOAskZDpkNYAHG1kf2Mr6xZE,19
1
+ PySimultan2/CHANGELOG.md,sha256=BBfCqgFQeigrlRQdHAksDz70-0fLKjzWkHbfFjJ2eDg,361
2
+ PySimultan2/__about__.py,sha256=qqSUxPPY_oV00hMzjB1sl4cBwwVOu75QAU3g1azPtlc,19
3
3
  PySimultan2/__init__.py,sha256=PGVR1uhY01dF5tHyad-znURUZ_LVB95vsjId2BT0aJM,3245
4
- PySimultan2/data_model.py,sha256=YYtfcR6jvGztng6Be8Vw9FQ02cPkl8ATHTZMoIu1ABQ,34140
4
+ PySimultan2/data_model.py,sha256=7rf1IT6jLKkCkpH9Zmkdy-wpPQXwt7wWl_RFw4sl2Co,36503
5
5
  PySimultan2/default_types.py,sha256=K-Eka5BCKk8DT3HU5761Ym_-ZFmu1_Dro0zW0LVGoHA,27157
6
- PySimultan2/files.py,sha256=BCETl4M8qedw7Bjt8QXvY6Rl3U6Lou36XqPY2ST1o9Q,22447
6
+ PySimultan2/files.py,sha256=jvjGB_yLvJbXBhtxy7-l9nTK4voRiuimr-w8Cq7XtI0,23053
7
7
  PySimultan2/multi_values.py,sha256=ZFXlTLuZo32x7_7diYAp2XEjp5uwgHLgNOzN7v74-5I,13650
8
8
  PySimultan2/object_mapper.py,sha256=_SQye38NmIr4m_-X9CuvUJnVDBmjmUDdPH2bnaxpzKY,18546
9
9
  PySimultan2/simultan_object.py,sha256=akaSUZZWIVfwx1wT5EdOgRR2UeShUthX-LE2Uk6w8CQ,19058
@@ -11,7 +11,7 @@ PySimultan2/taxonomy_maps.py,sha256=K8lwiBkEnQkx40YZxqSJAHdqwuo6ssvkXLL_GBxVYO0,
11
11
  PySimultan2/type_setter_lookup.py,sha256=PGa5_EtV7SM15w3uxy0fA3LiQ0TaS4Ys0LYR5zs8aNk,3748
12
12
  PySimultan2/utils.py,sha256=1e2sYW1ioV0L9NREbBr03Y2tK1Hx9HxQv1pdXnIPIGY,66740
13
13
  PySimultan2/geometry/__init__.py,sha256=nJolTD1i5J8qUkOQa-r3D20aq3Co3sN31Xc0n4wJpJo,248
14
- PySimultan2/geometry/geometry_base.py,sha256=nbb9U2W3vFviVLxISLHRi2CVyLEM-3zIKvoZ1uSYs_8,23420
14
+ PySimultan2/geometry/geometry_base.py,sha256=TwABfQEsqxAIGLqwvqVXEV-GA5sYGBJSJm7e58QmNzM,24015
15
15
  PySimultan2/geometry/utils.py,sha256=J25YsK8sso_UL7xRusItQZvyjtvxdOsSPelBQYFABhY,8519
16
16
  PySimultan2/resources/AssimpNet.dll,sha256=x8uwMHPRmEH9fDQihfEQLUdblM1u7RP-CCnUjOpXcLo,205312
17
17
  PySimultan2/resources/AvalonDock.dll,sha256=9tCcw7cpaVq0bh1H2sfcxb8EWhySmgujPs89lAqIPZs,500224
@@ -75,7 +75,7 @@ PySimultan2/resources/assimp.dll,sha256=HwfDwXqoPDTFRyoQpA3qmgZoUdFtziJkV5fNtktE
75
75
  PySimultan2/resources/componentmanager.user,sha256=hrzr1US4pqkFnLHXcvPkvrgGd7QvlxaV8mhS6fuikEs,760
76
76
  PySimultan2/resources/defaultsettings.xml,sha256=s6Tk1tubLz5UYqXZWpD42EDHzedemRY1nEneoIVcUfg,392
77
77
  PySimultan2/resources/setup.bat,sha256=fjvvYfVM6TalS-QTSiKAbAId5nTsk8kGGo06ba-wWaY,32
78
- pysimultan-0.5.7.dist-info/METADATA,sha256=6I6o-yu_L5IPQxveKqC9hpki0YXFmWdOfiH82iZhIsM,5815
79
- pysimultan-0.5.7.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
80
- pysimultan-0.5.7.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
- pysimultan-0.5.7.dist-info/RECORD,,
78
+ pysimultan-0.5.9.dist-info/METADATA,sha256=WyBbt76L0Bt4PjMpNYG_baQKQzFZtNBZqu5e2_iKpdc,6136
79
+ pysimultan-0.5.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
80
+ pysimultan-0.5.9.dist-info/licenses/LICENSE.txt,sha256=pmSr98k6N005KMojnZxzLGRuRlDjDx3PUrK1lFj53HA,1126
81
+ pysimultan-0.5.9.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.26.3
2
+ Generator: hatchling 1.27.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any