PySimultan 0.1.54__py3-none-any.whl → 0.2.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (182) hide show
  1. PySimultan-0.2.1.dist-info/LICENSE.txt +17 -0
  2. PySimultan-0.2.1.dist-info/METADATA +36 -0
  3. PySimultan-0.2.1.dist-info/RECORD +82 -0
  4. {PySimultan-0.1.54.dist-info → PySimultan-0.2.1.dist-info}/WHEEL +1 -1
  5. PySimultan-0.2.1.dist-info/top_level.txt +1 -0
  6. {PySimultan → PySimultan2}/__init__.py +11 -6
  7. PySimultan2/config.py +52 -0
  8. PySimultan2/data_model.py +713 -0
  9. PySimultan2/default_types.py +507 -0
  10. PySimultan2/files.py +371 -0
  11. PySimultan2/geometry/__init__.py +4 -0
  12. PySimultan2/geometry/geometry_base.py +654 -0
  13. PySimultan2/geometry/utils.py +181 -0
  14. PySimultan2/multi_values.py +277 -0
  15. PySimultan2/object_mapper.py +200 -0
  16. PySimultan2/resources/AssimpNet.dll +0 -0
  17. PySimultan2/resources/AvalonDock.dll +0 -0
  18. PySimultan2/resources/BruTile.dll +0 -0
  19. PySimultan2/resources/ClosedXML.dll +0 -0
  20. PySimultan2/resources/ComponentBuilder.dll +0 -0
  21. PySimultan/resources/ComponentBuilder.exe.config → PySimultan2/resources/ComponentBuilder.dll.config +6 -2
  22. PySimultan2/resources/ComponentBuilder.runtimeconfig.json +18 -0
  23. {PySimultan → PySimultan2}/resources/ComponentBuilder.xml +11877 -6754
  24. PySimultan2/resources/ControlzEx.dll +0 -0
  25. PySimultan2/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
  26. PySimultan2/resources/DocumentFormat.OpenXml.dll +0 -0
  27. PySimultan2/resources/ExcelNumberFormat.dll +0 -0
  28. PySimultan2/resources/Fluent.dll +0 -0
  29. PySimultan2/resources/GeometryViewer.dll +0 -0
  30. {PySimultan → PySimultan2}/resources/GeometryViewer.xml +2201 -1155
  31. PySimultan2/resources/HelixToolkit.Core.Wpf.dll +0 -0
  32. PySimultan2/resources/HelixToolkit.SharpDX.Core.Wpf.dll +0 -0
  33. PySimultan2/resources/HelixToolkit.SharpDX.Core.dll +0 -0
  34. PySimultan2/resources/HelixToolkit.dll +0 -0
  35. PySimultan2/resources/MathNet.Numerics.dll +0 -0
  36. PySimultan2/resources/Microsoft.AspNetCore.Authorization.dll +0 -0
  37. PySimultan2/resources/Microsoft.AspNetCore.Metadata.dll +0 -0
  38. PySimultan2/resources/Microsoft.Extensions.DependencyInjection.Abstractions.dll +0 -0
  39. PySimultan2/resources/Microsoft.Extensions.Logging.Abstractions.dll +0 -0
  40. PySimultan2/resources/Microsoft.Extensions.Options.dll +0 -0
  41. PySimultan2/resources/Microsoft.Extensions.Primitives.dll +0 -0
  42. PySimultan2/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
  43. PySimultan2/resources/Microsoft.WindowsAPICodePack.dll +0 -0
  44. PySimultan2/resources/Microsoft.Xaml.Behaviors.dll +0 -0
  45. PySimultan2/resources/Newtonsoft.Json.Bson.dll +0 -0
  46. PySimultan2/resources/Newtonsoft.Json.dll +0 -0
  47. PySimultan2/resources/SIMULTAN.AutoUpdate.Client.dll +0 -0
  48. PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll +0 -0
  49. PySimultan2/resources/SIMULTAN.AutoUpdate.DataTransferLibrary.dll.config +15 -0
  50. PySimultan2/resources/SIMULTAN.Lang.dll +0 -0
  51. {PySimultan → PySimultan2}/resources/SIMULTAN.Lang.xml +5282 -3252
  52. PySimultan2/resources/SIMULTAN.Plugins.dll +0 -0
  53. {PySimultan → PySimultan2}/resources/SIMULTAN.Plugins.xml +110 -0
  54. PySimultan2/resources/SIMULTAN.UI.dll +0 -0
  55. {PySimultan → PySimultan2}/resources/SIMULTAN.UI.xml +10483 -4937
  56. PySimultan2/resources/SIMULTAN.dll +0 -0
  57. PySimultan2/resources/SIMULTAN.xml +34122 -0
  58. PySimultan2/resources/SharpDX.D3DCompiler.dll +0 -0
  59. PySimultan2/resources/SharpDX.DXGI.dll +0 -0
  60. PySimultan2/resources/SharpDX.Direct2D1.dll +0 -0
  61. PySimultan2/resources/SharpDX.Direct3D11.dll +0 -0
  62. PySimultan2/resources/SharpDX.Direct3D9.dll +0 -0
  63. {PySimultan → PySimultan2}/resources/SharpDX.Mathematics.dll +0 -0
  64. PySimultan2/resources/SharpDX.dll +0 -0
  65. {PySimultan → PySimultan2}/resources/SitePlanner.dll +0 -0
  66. {PySimultan → PySimultan2}/resources/SitePlanner.xml +959 -1110
  67. PySimultan2/resources/Sprache.dll +0 -0
  68. PySimultan2/resources/System.Data.OleDb.dll +0 -0
  69. PySimultan2/resources/System.Net.Http.Formatting.dll +0 -0
  70. PySimultan2/resources/XAMLMarkupExtensions.dll +0 -0
  71. PySimultan2/resources/assimp.dll +0 -0
  72. {PySimultan → PySimultan2}/resources/defaultsettings.xml +0 -0
  73. PySimultan2/simultan_object.py +366 -0
  74. PySimultan2/taxonomy_maps.py +169 -0
  75. PySimultan2/utils.py +1383 -0
  76. PySimultan/config.py +0 -57
  77. PySimultan/data_model.py +0 -376
  78. PySimultan/default_types.py +0 -1771
  79. PySimultan/geo_default_types.py +0 -763
  80. PySimultan/geometry.py +0 -309
  81. PySimultan/resources/AssimpNet.dll +0 -0
  82. PySimultan/resources/AssimpNet.xml +0 -12074
  83. PySimultan/resources/BruTile.dll +0 -0
  84. PySimultan/resources/BruTile.xml +0 -1845
  85. PySimultan/resources/ControlzEx.dll +0 -0
  86. PySimultan/resources/Cyotek.Drawing.BitmapFont.dll +0 -0
  87. PySimultan/resources/DXFImportExport.dll +0 -0
  88. PySimultan/resources/DotSpatial.Projections.xml +0 -5879
  89. PySimultan/resources/EXCELImportExport.dll +0 -0
  90. PySimultan/resources/Fluent.dll +0 -0
  91. PySimultan/resources/Fluent.xml +0 -9103
  92. PySimultan/resources/GeoJSON.Net.dll +0 -0
  93. PySimultan/resources/GeometryViewer.Data.dll +0 -0
  94. PySimultan/resources/GeometryViewer.Data.xml +0 -4443
  95. PySimultan/resources/GeometryViewer.Shared.dll +0 -0
  96. PySimultan/resources/GeometryViewer.Shared.xml +0 -588
  97. PySimultan/resources/GeometryViewer.dll +0 -0
  98. PySimultan/resources/HelixToolkit.Wpf.SharpDX.dll +0 -0
  99. PySimultan/resources/HelixToolkit.Wpf.SharpDX.xml +0 -43219
  100. PySimultan/resources/HelixToolkit.Wpf.dll +0 -0
  101. PySimultan/resources/HelixToolkit.Wpf.xml +0 -22363
  102. PySimultan/resources/HelixToolkit.dll +0 -0
  103. PySimultan/resources/HelixToolkit.xml +0 -144
  104. PySimultan/resources/ImportLog_SMART_CAMPUS_TU_WIEN_BIBLIOTHEK_20210305_ZONENMODELL_23_11_2021-06_54_54.txt +0 -1
  105. PySimultan/resources/LibGit2Sharp.dll +0 -0
  106. PySimultan/resources/LibGit2Sharp.dll.config +0 -4
  107. PySimultan/resources/LibGit2Sharp.xml +0 -13770
  108. PySimultan/resources/MathNet.Numerics.dll +0 -0
  109. PySimultan/resources/MathNet.Numerics.xml +0 -57152
  110. PySimultan/resources/Microsoft.WindowsAPICodePack.Shell.dll +0 -0
  111. PySimultan/resources/Microsoft.WindowsAPICodePack.Shell.xml +0 -25496
  112. PySimultan/resources/Microsoft.WindowsAPICodePack.dll +0 -0
  113. PySimultan/resources/Microsoft.WindowsAPICodePack.xml +0 -2934
  114. PySimultan/resources/Newtonsoft.Json.dll +0 -0
  115. PySimultan/resources/Newtonsoft.Json.xml +0 -11305
  116. PySimultan/resources/ParameterStructure.dll +0 -0
  117. PySimultan/resources/ParameterStructure.xml +0 -10750
  118. PySimultan/resources/SIMULTAN.AutoUpdate.Client.dll +0 -0
  119. PySimultan/resources/SIMULTAN.DataExchange.dll +0 -0
  120. PySimultan/resources/SIMULTAN.Lang.dll +0 -0
  121. PySimultan/resources/SIMULTAN.Legacy.dll +0 -0
  122. PySimultan/resources/SIMULTAN.Legacy.xml +0 -254
  123. PySimultan/resources/SIMULTAN.Plugins.dll +0 -0
  124. PySimultan/resources/SIMULTAN.Project.dll +0 -0
  125. PySimultan/resources/SIMULTAN.Project.dll.config +0 -11
  126. PySimultan/resources/SIMULTAN.UI.dll +0 -0
  127. PySimultan/resources/SIMULTAN.Util.dll +0 -0
  128. PySimultan/resources/SIMULTAN.Util.xml +0 -3430
  129. PySimultan/resources/SharpDX.D3DCompiler.dll +0 -0
  130. PySimultan/resources/SharpDX.D3DCompiler.xml +0 -5897
  131. PySimultan/resources/SharpDX.DXGI.dll +0 -0
  132. PySimultan/resources/SharpDX.DXGI.xml +0 -8737
  133. PySimultan/resources/SharpDX.Direct2D1.dll +0 -0
  134. PySimultan/resources/SharpDX.Direct2D1.xml +0 -46691
  135. PySimultan/resources/SharpDX.Direct3D11.dll +0 -0
  136. PySimultan/resources/SharpDX.Direct3D11.xml +0 -31826
  137. PySimultan/resources/SharpDX.Direct3D9.dll +0 -0
  138. PySimultan/resources/SharpDX.Direct3D9.xml +0 -36489
  139. PySimultan/resources/SharpDX.Mathematics.xml +0 -16449
  140. PySimultan/resources/SharpDX.dll +0 -0
  141. PySimultan/resources/Sprache.dll +0 -0
  142. PySimultan/resources/Sprache.xml +0 -1199
  143. PySimultan/resources/System.Net.Http.Formatting.dll +0 -0
  144. PySimultan/resources/System.Net.Http.Formatting.xml +0 -2094
  145. PySimultan/resources/System.Windows.Interactivity.dll +0 -0
  146. PySimultan/resources/TalkGit.dll +0 -0
  147. PySimultan/resources/TalkGit.dll.config +0 -11
  148. PySimultan/resources/WebServiceConnector.dll +0 -0
  149. PySimultan/resources/WebServiceConnector.dll.config +0 -11
  150. PySimultan/resources/XAMLMarkupExtensions.dll +0 -0
  151. PySimultan/resources/XAMLMarkupExtensions.xml +0 -862
  152. PySimultan/resources/Xceed.Wpf.AvalonDock.Themes.Aero.dll +0 -0
  153. PySimultan/resources/Xceed.Wpf.AvalonDock.Themes.Metro.dll +0 -0
  154. PySimultan/resources/Xceed.Wpf.AvalonDock.Themes.VS2010.dll +0 -0
  155. PySimultan/resources/Xceed.Wpf.AvalonDock.dll +0 -0
  156. PySimultan/resources/Xceed.Wpf.Toolkit.dll +0 -0
  157. PySimultan/resources/assimp.dll +0 -0
  158. PySimultan/resources/schema.yaml +0 -13
  159. PySimultan/resources/simultan_exception_07_10_2021-08_34_24.txt +0 -17
  160. PySimultan/resources/simultan_exception_07_10_2021-10_13_31.txt +0 -17
  161. PySimultan/resources/simultan_exception_11_10_2021-19_45_42.txt +0 -17
  162. PySimultan/resources/simultan_exception_22_11_2021-16_41_52.txt +0 -14
  163. PySimultan/resources/simultan_exception_22_11_2021-17_37_40.txt +0 -14
  164. PySimultan/simultan_geometry_utils.py +0 -81
  165. PySimultan/simultan_utils.py +0 -165
  166. PySimultan/slots.py +0 -51
  167. PySimultan/template_tools.py +0 -631
  168. PySimultan/utils.py +0 -298
  169. PySimultan-0.1.54.dist-info/LICENSE +0 -674
  170. PySimultan-0.1.54.dist-info/LICENSE.txt +0 -674
  171. PySimultan-0.1.54.dist-info/METADATA +0 -690
  172. PySimultan-0.1.54.dist-info/RECORD +0 -119
  173. PySimultan-0.1.54.dist-info/entry_points.txt +0 -3
  174. PySimultan-0.1.54.dist-info/top_level.txt +0 -1
  175. PySimultan-0.1.54.dist-info/zip-safe +0 -1
  176. {PySimultan → PySimultan2}/resources/DotSpatial.Projections.dll +0 -0
  177. {PySimultan → PySimultan2}/resources/GeometryViewer.dll.config +0 -0
  178. {PySimultan → PySimultan2}/resources/SIMULTAN.AutoUpdate.Client.dll.config +0 -0
  179. {PySimultan → PySimultan2}/resources/SitePlanner.dll.config +0 -0
  180. {PySimultan → PySimultan2}/resources/Sprache.Calc.dll +0 -0
  181. {PySimultan → PySimultan2}/resources/__init__.py +0 -0
  182. {PySimultan → PySimultan2}/resources/setup.bat +0 -0
@@ -1,763 +0,0 @@
1
- from weakref import WeakSet
2
- import numpy as np
3
- import colorlog
4
- from .utils import classproperty, get_obj_by_id, get_random_color
5
-
6
- from .config import cs_axis_up
7
-
8
- from System.Windows.Media.Media3D import Point3D
9
- from System import Array
10
- from GeometryViewer.Model.Geometry import Vertex, Edge, EdgeLoop, Face, Volume, Layer, PEdge, GeometricOrientation
11
- from GeometryViewer.Model import DerivedColor
12
- from ParameterStructure.Instances import SimInstanceType
13
- # from copy import deepcopy
14
- # from functools import lru_cache
15
- # from tqdm import tqdm
16
- from copy import copy
17
-
18
- logger = colorlog.getLogger('PySimultan')
19
-
20
-
21
- # class classproperty(object):
22
- #
23
- # def __init__(self, getter):
24
- # self.getter = getter
25
- #
26
- # def __get__(self, instance, owner):
27
- # return self.getter(owner)
28
- #
29
- #
30
- # class GeometryModel(object):
31
- #
32
- # _cls_instances = WeakSet() # weak set with all created objects
33
- # _create_all = False # if true all properties are evaluated to create python objects when initialized
34
- #
35
- # @classproperty
36
- # def _cls_instances_dict(cls):
37
- # return dict(zip([x.id for x in cls._cls_instances], [x() for x in cls._cls_instances]))
38
- #
39
- # @classproperty
40
- # def cls_instances(cls):
41
- # return list(cls._cls_instances)
42
- #
43
- # def __new__(cls, *args, **kwargs):
44
- # instance = super().__new__(cls)
45
- # if "_cls_instances" not in cls.__dict__:
46
- # cls._cls_instances = WeakSet()
47
- # try:
48
- # cls._cls_instances.add(instance)
49
- # except Exception as e:
50
- # logger.error(f'Error adding instance {instance} to _cls_instances: {e}')
51
- #
52
- # return instance
53
- #
54
- # def __init__(self, *args, **kwargs):
55
- # self._wrapped_obj = kwargs.get('wrapped_obj', None)
56
- #
57
- # self._vertices = kwargs.get('vertices', None)
58
- # self._edges = kwargs.get('edges', None)
59
- # self._edge_loops = kwargs.get('edge_loops', None)
60
- # self._faces = kwargs.get('faces', None)
61
- # self._volumes = kwargs.get('volumes', None)
62
- # self._layers = kwargs.get('layers', None)
63
- #
64
- # self.GeoBaseClass, self.LayerCls, self.VertexCls, self.EdgeCls, self.EdgeLoopCls, self.FaceCls, self.VolumeCls = create_geo_classes()
65
- # self.load_all()
66
- #
67
- # @property
68
- # def id(self):
69
- # return self._wrapped_obj.Id
70
- #
71
- # @property
72
- # def name(self):
73
- # if self._wrapped_obj is not None:
74
- # return self._wrapped_obj.Name
75
- #
76
- # @name.setter
77
- # def name(self, value):
78
- # if self._wrapped_obj is not None:
79
- # self._wrapped_obj.Name = value
80
- #
81
- # @property
82
- # def layers(self):
83
- # if self._layers is None:
84
- # self._layers = self.get_layers()
85
- # return self._layers
86
- #
87
- # @property
88
- # def vertices(self):
89
- # if self._vertices is None:
90
- # self._vertices = self.get_vertices()
91
- # return self._vertices
92
- #
93
- # @property
94
- # def edges(self):
95
- # if self._edges is None:
96
- # self._edges = self.get_edges()
97
- # return self._edges
98
- #
99
- # @property
100
- # def edge_loops(self):
101
- # if self._edge_loops is None:
102
- # self._edge_loops = self.get_edge_loops()
103
- # return self._edge_loops
104
- #
105
- # @property
106
- # def faces(self):
107
- # if self._faces is None:
108
- # self._faces = self.get_faces()
109
- # return self._faces
110
- #
111
- # @property
112
- # def volumes(self):
113
- # if self._volumes is None:
114
- # self._volumes = self.get_volumes()
115
- # return self._volumes
116
- #
117
- # def __getattribute__(self, attr):
118
- # try:
119
- # return object.__getattribute__(self, attr)
120
- # except KeyError:
121
- # wrapped = object.__getattribute__(self, '_wrapped_obj')
122
- # if wrapped is not None:
123
- # return object.__getattribute__(wrapped, attr)
124
- # else:
125
- # raise KeyError
126
- #
127
- # def __setattr__(self, attr, value):
128
- #
129
- # if hasattr(self, '_wrapped_obj'):
130
- #
131
- # if hasattr(self._wrapped_obj, attr) and (self._wrapped_obj is not None):
132
- # object.__setattr__(self._wrapped_obj, attr, value)
133
- # else:
134
- # object.__setattr__(self, attr, value)
135
- # else:
136
- # object.__setattr__(self, attr, value)
137
- #
138
- # def get_vertices(self):
139
- # return [self.VertexCls(wrapped_obj=x) for x in tqdm(self._wrapped_obj.Geometry.Vertices.Items)]
140
- #
141
- # def get_edges(self):
142
- # return [self.EdgeCls(wrapped_obj=x) for x in tqdm(self._wrapped_obj.Geometry.Edges.Items)]
143
- #
144
- # def get_edge_loops(self):
145
- # return [self.EdgeLoopCls(wrapped_obj=x) for x in tqdm(self._wrapped_obj.Geometry.EdgeLoops.Items)]
146
- #
147
- # def get_faces(self):
148
- # return [self.FaceCls(wrapped_obj=x) for x in tqdm(self._wrapped_obj.Geometry.Faces.Items)]
149
- #
150
- # def get_volumes(self):
151
- # return [self.VolumeCls(wrapped_obj=x) for x in tqdm(self._wrapped_obj.Geometry.Volumes.Items)]
152
- #
153
- # def get_layers(self):
154
- # return [self.LayerCls(wrapped_obj=x) for x in tqdm(self._wrapped_obj.Geometry.Layers.Items)]
155
- #
156
- # def get_face_by_id(self, id):
157
- #
158
- # face = self.FaceCls.get_obj_by_id(id)
159
- # if face is None:
160
- # _ = self.faces
161
- # face = self.FaceCls.get_obj_by_id(id)
162
- # return face
163
- #
164
- # def get_zone_by_id(self, id):
165
- #
166
- # zone = self.VolumeCls.get_obj_by_id(id)
167
- # if zone is None:
168
- # _ = self.volumes
169
- # zone = self.VolumeCls.get_obj_by_id(id)
170
- # return zone
171
- #
172
- # def load_all(self):
173
- #
174
- # logger.info(f'Geometry model: {self.name}: loading vertices')
175
- # _ = self.vertices
176
- # logger.info(f'Geometry model: {self.name}: loading edges')
177
- # _ = self.edges
178
- # logger.info(f'Geometry model: {self.name}: loading edge loops')
179
- # _ = self.edge_loops
180
- # logger.info(f'Geometry model: {self.name}: loading faces')
181
- # _ = self.faces
182
- # logger.info(f'Geometry model: {self.name}: loading volumes')
183
- # _ = self.volumes
184
- #
185
- # logger.info(f'\n\nGeometry model import info:\n----------------------------------------------')
186
- # logger.info(f'Geometry model: {self.name}')
187
- # logger.info(f'Number vertices: {self.vertices.__len__()}')
188
- # logger.info(f'Number edges: {self.edges.__len__()}')
189
- # logger.info(f'Number edge_loops: {self.edge_loops.__len__()}')
190
- # logger.info(f'Number faces: {self.faces.__len__()}')
191
- # logger.info(f'Number volumes: {self.volumes.__len__()}\n\n')
192
-
193
-
194
- # def get_obj_by_id(cls, id):
195
- # return cls._cls_instances_dict.get(id, None)
196
-
197
-
198
- class BaseGeoBaseClass(object):
199
-
200
- _cls_instances = WeakSet() # weak set with all created objects
201
- _create_all = False # if true all properties are evaluated to create python objects when initialized
202
- _cls_instances_dict_cache = None
203
-
204
- @classproperty
205
- def _cls_instances_dict(cls):
206
- if cls._cls_instances_dict_cache is None:
207
- cls._cls_instances_dict_cache = dict(zip([x.id for x in cls._cls_instances], [x for x in cls._cls_instances]))
208
- return cls._cls_instances_dict_cache
209
-
210
- @classmethod
211
- def get_obj_by_id(cls, id):
212
- # return cls._cls_instances_dict.get(id, None)
213
- return get_obj_by_id(cls, id)
214
-
215
- @classproperty
216
- def cls_instances(cls):
217
- return list(cls._cls_instances)
218
-
219
- @property
220
- def name(self):
221
- if self._wrapped_obj is not None:
222
- return self._wrapped_obj.Name
223
-
224
- @name.setter
225
- def name(self, value):
226
- if self._wrapped_obj is not None:
227
- self._wrapped_obj.Name = value
228
-
229
- @property
230
- def id(self):
231
- return self._wrapped_obj.Id
232
-
233
- def __new__(cls, *args, **kwargs):
234
- instance = super().__new__(cls)
235
- if "_cls_instances" not in cls.__dict__:
236
- cls._cls_instances = WeakSet()
237
- try:
238
- cls._cls_instances.add(instance)
239
- cls._cls_instances_dict_cache = None
240
- except Exception as e:
241
- logger.error(f'Error adding instance {instance} to _cls_instances: {e}')
242
-
243
- return instance
244
-
245
- def __init__(self, *args, **kwargs):
246
- self.geometry_model = kwargs.get('geometry_model', None)
247
- self._wrapped_obj = kwargs.get('wrapped_obj', None)
248
-
249
- # @lru_cache(maxsize=None)
250
- def __getattribute__(self, attr):
251
- try:
252
- return object.__getattribute__(self, attr)
253
- except KeyError:
254
- wrapped = object.__getattribute__(self, '_wrapped_obj')
255
- if wrapped is not None:
256
- return object.__getattribute__(wrapped, attr)
257
- else:
258
- raise KeyError
259
-
260
- def __setattr__(self, attr, value):
261
-
262
- if hasattr(self, '_wrapped_obj'):
263
- if hasattr(self._wrapped_obj, attr) and (self._wrapped_obj is not None):
264
- object.__setattr__(self._wrapped_obj, attr, value)
265
- else:
266
- object.__setattr__(self, attr, value)
267
- try:
268
- object.__getattribute__(self.__class__, attr).fget.cache_clear()
269
- except AttributeError:
270
- pass
271
- else:
272
- object.__setattr__(self, attr, value)
273
-
274
- def __del__(self):
275
- self.__class__._cls_instances_dict_cache = None
276
-
277
- def __repr__(self):
278
- return f'{self.name}: ' + object.__repr__(self)
279
-
280
- def __getstate__(self):
281
-
282
- logger.warning(f'__getstate__ in experimental state')
283
-
284
- obj_dict = dict()
285
- for key in dir(self.__class__):
286
- if type(getattr(self.__class__, key)) is property:
287
- print(key)
288
- obj_dict[key] = getattr(self, key)
289
-
290
- return obj_dict
291
-
292
- def __setstate__(self, state):
293
-
294
- logger.warning(f'__setstate__ in experimental state')
295
-
296
- for key, value in state.items():
297
- try:
298
- setattr(self, key, value)
299
- except AttributeError as e:
300
- pass
301
-
302
-
303
- class BaseGeometricLayer(BaseGeoBaseClass):
304
-
305
- @classmethod
306
- def create_new(cls, geometry_model, name: str, layer=None, **kwargs):
307
-
308
- l = Layer(geometry_model.Geometry, name)
309
-
310
- if layer is None:
311
- geometry_model.Geometry.Layers.Add(l)
312
- else:
313
- layer._wrapped_obj.Layers.Add(l)
314
-
315
- layer = cls(geometry_model=geometry_model,
316
- wrapped_obj=l)
317
-
318
- layer.color = DerivedColor(get_random_color())
319
-
320
- for key, value in kwargs.items():
321
- setattr(layer, key, value)
322
-
323
- return layer
324
-
325
- def __init__(self, *args, **kwargs):
326
- BaseGeoBaseClass.__init__(self, *args, **kwargs)
327
-
328
- @property
329
- def color(self):
330
- return self._wrapped_obj.Color
331
-
332
- @color.setter
333
- def color(self, value):
334
- self._wrapped_obj.Color = value
335
-
336
- @property
337
- def is_visible(self):
338
- return self._wrapped_obj.IsVisible
339
-
340
- @is_visible.setter
341
- def is_visible(self, value: bool):
342
- self._wrapped_obj.IsVisible = value
343
-
344
-
345
- class BaseGeometricVertex(BaseGeoBaseClass):
346
-
347
- @classmethod
348
- def create_new(cls, geometry_model, position, layer=None, **kwargs):
349
-
350
- if layer is None:
351
- layer = geometry_model.layers[0]._wrapped_obj
352
- if isinstance(layer, BaseGeometricLayer):
353
- layer = layer._wrapped_obj
354
-
355
- simultan_position = position
356
- if cs_axis_up == 1:
357
- simultan_position = np.array([position[0], position[1], position[2]])
358
- elif cs_axis_up == 2:
359
- simultan_position = np.array([-position[0], position[2], position[1]])
360
- elif cs_axis_up == 3:
361
- simultan_position = np.array([position[1], position[0], position[2]])
362
-
363
- v = Vertex(layer, Point3D(simultan_position[0], simultan_position[1], simultan_position[2]))
364
-
365
- vertex = cls(geometry_model=geometry_model,
366
- wrapped_obj=v)
367
-
368
- for key, value in kwargs.items():
369
- setattr(vertex, key, value)
370
-
371
- return vertex
372
-
373
- def __init__(self, *args, **kwargs):
374
- BaseGeoBaseClass.__init__(self, *args, **kwargs)
375
-
376
- @property
377
- def position(self):
378
- wrapped_obj = self._wrapped_obj
379
- if cs_axis_up == 1:
380
- return np.array([wrapped_obj.Position.X, wrapped_obj.Position.Y, wrapped_obj.Position.Z])
381
- elif cs_axis_up == 2:
382
- return np.array([-wrapped_obj.Position.X, wrapped_obj.Position.Z, wrapped_obj.Position.Y])
383
- elif cs_axis_up == 3:
384
- return np.array([wrapped_obj.Position.Y, wrapped_obj.Position.X, wrapped_obj.Position.Z])
385
-
386
- @position.setter
387
- def position(self, value):
388
- wrapped_obj = self._wrapped_obj
389
- if cs_axis_up == 1:
390
- wrapped_obj.Position.X = value[0]
391
- wrapped_obj.Position.Y = value[1]
392
- wrapped_obj.Position.Z = value[2]
393
- elif cs_axis_up == 2:
394
- wrapped_obj.Position.X = value[0]
395
- wrapped_obj.Position.Y = value[2]
396
- wrapped_obj.Position.Z = value[1]
397
- elif cs_axis_up == 3:
398
- wrapped_obj.Position.X = value[1]
399
- wrapped_obj.Position.Y = value[0]
400
- wrapped_obj.Position.Z = value[2]
401
-
402
-
403
- class BaseGeometricEdge(BaseGeoBaseClass):
404
-
405
- @classmethod
406
- def create_new(cls, geometry_model, v1, v2, layer=None, **kwargs):
407
-
408
- if layer is None:
409
- layer = geometry_model.layers[0]._wrapped_obj
410
- if isinstance(layer, BaseGeometricLayer):
411
- layer = layer._wrapped_obj
412
-
413
- e = Edge(layer, Array[Vertex]([v1._wrapped_obj, v2._wrapped_obj]))
414
-
415
- edge = cls(geometry_model=geometry_model,
416
- wrapped_obj=e)
417
-
418
- for key, value in kwargs.items():
419
- setattr(edge, key, value)
420
-
421
- return edge
422
-
423
- def __init__(self, *args, **kwargs):
424
- BaseGeoBaseClass.__init__(self, *args, **kwargs)
425
- self._vertices = kwargs.get('vertices', None)
426
-
427
- @property
428
- def vertices(self):
429
- if self._vertices is None:
430
- self._vertices = self.get_vertices()
431
- return self._vertices
432
-
433
-
434
- class BaseGeometricEdgeLoop(BaseGeoBaseClass):
435
-
436
- @classmethod
437
- def create_new(cls, geometry_model, edges, layer=None, **kwargs):
438
-
439
- if layer is None:
440
- layer = geometry_model.layers[0]._wrapped_obj
441
- if isinstance(layer, BaseGeometricLayer):
442
- layer = layer._wrapped_obj
443
-
444
- el = EdgeLoop(layer, Array[Edge]([x._wrapped_obj for x in edges]))
445
-
446
- edge_loop = cls(geometry_model=geometry_model,
447
- wrapped_obj=el)
448
-
449
- for key, value in kwargs.items():
450
- setattr(edge_loop, key, value)
451
-
452
- return cls(geometry_model=geometry_model,
453
- wrapped_obj=el)
454
-
455
- def __init__(self, *args, **kwargs):
456
- BaseGeoBaseClass.__init__(self, *args, **kwargs)
457
- self._edges = kwargs.get('edges', None)
458
-
459
- @property
460
- def edges(self):
461
- if self._edges is None:
462
- self._edges = self.get_edges()
463
- return self._edges
464
-
465
- @property
466
- def edge_orientations(self):
467
- return [x.Orientation for x in self._wrapped_obj.Edges.Items]
468
-
469
- @property
470
- def points(self):
471
-
472
- points = np.zeros([self.edges.__len__(), 3])
473
-
474
- if self.edge_orientations[0] == 1:
475
- points[0, :] = self.edges[0].vertices[0].position
476
- else:
477
- points[0, :] = self.edges[0].vertices[1].position
478
-
479
- for i, edge in enumerate(self.edges):
480
- if self.edge_orientations[i] == 1:
481
- points[i, :] = edge.vertices[1].position
482
- else:
483
- points[i, :] = edge.vertices[0].position
484
-
485
- return points
486
-
487
-
488
- class BaseGeometricFace(BaseGeoBaseClass):
489
-
490
- @classmethod
491
- def create_new(cls, geometry_model, edge_loop, orientation=None, openings=None, layer=None, **kwargs):
492
-
493
- if layer is None:
494
- layer = geometry_model.layers[0]._wrapped_obj
495
- if isinstance(layer, BaseGeometricLayer):
496
- layer = layer._wrapped_obj
497
-
498
- if openings is None:
499
- openings = []
500
-
501
- if orientation is None:
502
- orientation = GeometricOrientation.Forward
503
-
504
- if orientation == 'forward':
505
- orientation = GeometricOrientation.Forward
506
- elif orientation == 'backward':
507
- orientation = GeometricOrientation.Backward
508
- else:
509
- orientation = GeometricOrientation.Undefined
510
-
511
- f = Face(layer, edge_loop._wrapped_obj, orientation, Array[EdgeLoop]([x._wrapped_obj for x in openings]))
512
-
513
- new_obj = cls(geometry_model=geometry_model,
514
- wrapped_obj=f)
515
-
516
- for key, value in kwargs.items():
517
- setattr(new_obj, key, value)
518
-
519
- return new_obj
520
-
521
- def __init__(self, *args, **kwargs):
522
- BaseGeoBaseClass.__init__(self, *args, **kwargs)
523
-
524
- def __repr__(self):
525
- return f'Face {self.id}: {self.name}'
526
-
527
- @property
528
- def _components(self):
529
- return self.geometry_model.get_geo_components(self._wrapped_obj)
530
-
531
- @property
532
- def components(self):
533
- return self.geometry_model.get_py_geo_components(self._wrapped_obj)
534
-
535
- @property
536
- def construction_assignment(self):
537
- return next((x for x in self._components if x.InstanceType == SimInstanceType.Attributes2D), None)
538
-
539
- @property
540
- def construction(self):
541
- if self.construction_assignment is None:
542
- return
543
-
544
- if self.construction_assignment.ReferencedComponents.Items.__len__() == 0:
545
- return
546
-
547
- component = self.construction_assignment.ReferencedComponents.Items[0].Target
548
- return self.geometry_model.template_parser.create_python_object(component, template_name='BuildInConstruction')
549
-
550
- @property
551
- def normal(self):
552
- normal = self._wrapped_obj.get_Normal()
553
- normal_array = np.array([normal.X, normal.Y, normal.Z])
554
- if cs_axis_up == 1:
555
- return np.array([normal_array[0],normal_array[1], normal_array[2]])
556
- elif cs_axis_up == 2:
557
- return np.array([-normal_array[0], normal_array[2], normal_array[1]])
558
- elif cs_axis_up == 3:
559
- return np.array([normal_array[1], normal_array[0], normal_array[2]])
560
-
561
- @property
562
- def orientation(self):
563
- return self._wrapped_obj.get_Orientation()
564
-
565
- @property
566
- def hull_face(self):
567
- return None in [self.side_1_volume, self.side_2_volume]
568
-
569
- def associate_with_component(self, component, exch=None):
570
- """
571
-
572
- :param component: Instance of PySimultan.default_types.SimultanObject, PySimultan.default_types.List, PySimultan.default_types.ReferenceList
573
- :param exch: SIMULTAN.DataExchange import ComponentGeometryExchange
574
- """
575
- try:
576
- component.InstanceType = SimInstanceType.Attributes2D
577
- except Exception as e:
578
- raise e
579
-
580
- if exch is None:
581
- exch = self.geometry_model.template_parser.current_data_model.exch
582
- exch.Associate(component, self._wrapped_obj)
583
-
584
-
585
- class BaseGeometricVolume(BaseGeoBaseClass):
586
-
587
- @classmethod
588
- def create_new(cls, geometry_model, faces, layer=None, **kwargs):
589
-
590
- if layer is None:
591
- layer = geometry_model.layers[0]._wrapped_obj
592
- if isinstance(layer, BaseGeometricLayer):
593
- layer = layer._wrapped_obj
594
-
595
- v = Volume(layer, Array[Face]([x._wrapped_obj for x in faces]))
596
-
597
- new_obj = cls(geometry_model=geometry_model,
598
- wrapped_obj=v)
599
-
600
- for key, value in kwargs.items():
601
- setattr(new_obj, key, value)
602
-
603
- return new_obj
604
-
605
- def __init__(self, *args, **kwargs):
606
- BaseGeoBaseClass.__init__(self, *args, **kwargs)
607
- self._faces = kwargs.get('faces', None)
608
-
609
- @property
610
- def components(self):
611
- return self.geometry_model.get_py_geo_components(self._wrapped_obj)
612
-
613
- def associate_with_component(self, component):
614
- try:
615
- component.InstanceType = SimInstanceType.Entity3D
616
- except Exception as e:
617
- raise e
618
-
619
- exch = self.geometry_model.template_parser.current_data_model.exch
620
- exch.Associate(component, self._wrapped_obj)
621
-
622
-
623
- def create_geo_classes(geo_types):
624
- """
625
- Create new classes from geometric base classes
626
-
627
- :return:
628
- """
629
-
630
- logger.debug('creating base geo classes')
631
-
632
- class GeoBaseClass(geo_types['base']):
633
- pass
634
-
635
- class GeometricLayer(geo_types['layer']):
636
- pass
637
-
638
- class GeometricVertex(geo_types['vertex']):
639
- pass
640
-
641
- class GeometricEdge(geo_types['edge']):
642
- def get_vertices(self):
643
- return [GeometricVertex.get_obj_by_id(x.Id) for x in self._wrapped_obj.Vertices.Items]
644
-
645
- class GeometricEdgeLoop(geo_types['edge_loop']):
646
- def get_edges(self):
647
- return [GeometricEdge.get_obj_by_id(x.Edge.Id) for x in self._wrapped_obj.Edges.Items]
648
-
649
- class GeometricFace(geo_types['face']):
650
-
651
- @property
652
- def boundary(self):
653
- return GeometricEdgeLoop.get_obj_by_id(self._wrapped_obj.Boundary.Id)
654
-
655
- @property
656
- def holes(self):
657
- return [GeometricEdgeLoop.get_obj_by_id(x.Id) for x in self._wrapped_obj.Holes.Items]
658
-
659
- @property
660
- def hole_faces(self):
661
- hole_faces = []
662
- for hole in self.holes:
663
- try:
664
- hole_face = [x for x in hole._wrapped_obj.Faces if x.Boundary.Id == hole.id][0]
665
- hole_faces.append(hole_face)
666
- except IndexError:
667
- logger.warning(f'Face {self.name}, {self.id}: no hole_face found')
668
- except Exception as e:
669
- logger.error(f'Face {self.name}, {self.id}: error evaluating hole faces: {e}')
670
- return [GeometricFace.get_obj_by_id(x.Id) for x in hole_faces]
671
-
672
- @property
673
- def points(self):
674
- return self.boundary.points
675
-
676
- @property
677
- def side_1_volume(self):
678
- volume = None
679
- if not self._wrapped_obj.PFaces:
680
- boundary_faces = set(self._wrapped_obj.Boundary.Faces)
681
- if boundary_faces.__len__() == 2:
682
- try:
683
- boundary_faces.remove(self._wrapped_obj)
684
- except:
685
- pass
686
-
687
- if boundary_faces.__len__() == 1:
688
- volume = self.__class__.get_obj_by_id(list(boundary_faces)[0].Id).side_1_volume
689
- else:
690
- for p_face in self._wrapped_obj.PFaces:
691
- if p_face.Orientation == GeometricOrientation.Forward:
692
- volume = p_face.Volume
693
-
694
- if isinstance(volume, Volume):
695
- return GeometricVolume.get_obj_by_id(volume.Id)
696
- else:
697
- return volume
698
-
699
- @property
700
- def side_2_volume(self):
701
- volume = None
702
- if not self._wrapped_obj.PFaces:
703
- boundary_faces = set(self._wrapped_obj.Boundary.Faces)
704
- if boundary_faces.__len__() == 2:
705
- try:
706
- boundary_faces.remove(self._wrapped_obj)
707
- except:
708
- pass
709
- if boundary_faces.__len__() == 1:
710
- volume = self.__class__.get_obj_by_id(list(boundary_faces)[0].Id).side_2_volume
711
- else:
712
- for p_face in self._wrapped_obj.PFaces:
713
- if p_face.Orientation == GeometricOrientation.Backward:
714
- volume = p_face.Volume
715
- if isinstance(volume, Volume):
716
- return GeometricVolume.get_obj_by_id(volume.Id)
717
- else:
718
- return volume
719
-
720
- class GeometricVolume(geo_types['volume']):
721
-
722
- def __init__(self, *args, **kwargs):
723
- geo_types['volume'].__init__(self, *args, **kwargs)
724
- self._faces = kwargs.get('faces', None)
725
-
726
- @property
727
- def faces(self):
728
- if self._faces is None:
729
- _faces = [GeometricFace.get_obj_by_id(x.Face.Id) for x in self._wrapped_obj.Faces.Items]
730
- all_faces = copy(_faces)
731
- [all_faces.extend(x.hole_faces) for x in _faces]
732
- self._faces = all_faces
733
- return self._faces
734
-
735
- @faces.setter
736
- def faces(self, value):
737
- self._faces = value
738
-
739
- @property
740
- def adjacent_zones(self):
741
-
742
- adjacent_zones = set()
743
- adjacent_zones.update([x.side_1_volume for x in self.faces if x.side_1_volume is not None])
744
- adjacent_zones.update([x.side_2_volume for x in self.faces if x.side_2_volume is not None])
745
-
746
- return adjacent_zones
747
-
748
- return GeoBaseClass, GeometricLayer, GeometricVertex, GeometricEdge, GeometricEdgeLoop, GeometricFace, GeometricVolume
749
-
750
-
751
- class BuildInGeoTypes(object):
752
-
753
- def __init__(self):
754
- self.base = BaseGeoBaseClass
755
- self.layer = BaseGeometricLayer
756
- self.vertex = BaseGeometricVertex
757
- self.edge = BaseGeometricEdge
758
- self.edge_loop = BaseGeometricEdgeLoop
759
- self.face = BaseGeometricFace
760
- self.volume = BaseGeometricVolume
761
-
762
-
763
- geometry_types = BuildInGeoTypes()