PySimultan 0.1.54__py3-none-any.whl → 0.2__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.dist-info/LICENSE.txt +17 -0
  2. PySimultan-0.2.dist-info/METADATA +36 -0
  3. PySimultan-0.2.dist-info/RECORD +82 -0
  4. {PySimultan-0.1.54.dist-info → PySimultan-0.2.dist-info}/WHEEL +1 -1
  5. PySimultan-0.2.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
@@ -0,0 +1,654 @@
1
+ import numpy as np
2
+
3
+ from numpy import array
4
+ from typing import Union, Optional
5
+ from weakref import WeakSet, WeakValueDictionary
6
+
7
+ from System import Array
8
+ from System.Collections.Generic import IEnumerable
9
+
10
+ from SIMULTAN.Data.Components import SimComponent, SimInstanceType
11
+
12
+ from SIMULTAN.Data.Geometry import (Layer, Vertex, Edge, PEdge, Face, Volume, EdgeLoop, OperationPermission,
13
+ GeometryModelOperationPermissions, GeometryOperationPermissions,
14
+ LayerOperationPermissions, GeometryModelData, GeometricOrientation,
15
+ BaseEdgeContainer)
16
+
17
+ from SIMULTAN.Data.Geometry import FaceAlgorithms
18
+
19
+ from SIMULTAN.Data.Geometry import GeometryModel as NetGeometryModel
20
+
21
+ # from SIMULTAN.Utils import IDispatcherTimerFactory
22
+
23
+ from SIMULTAN.Data.SimMath import SimPoint3D
24
+
25
+ from SIMULTAN.Data.Geometry import FaceAlgorithms
26
+ from SIMULTAN.Data.Geometry import EdgeAlgorithms
27
+ from SIMULTAN.Data.Geometry import VolumeAlgorithms
28
+
29
+
30
+ # from ..utils import create_mapped_python_object, create_python_object
31
+ # from ..files import create_asset_from_file, FileInfo, create_asset_from_string
32
+ from .. import config
33
+ from ..config import logger
34
+
35
+ from typing import TYPE_CHECKING
36
+ if TYPE_CHECKING:
37
+ from ..simultan_object import SimultanObject
38
+ from ..data_model import DataModel
39
+
40
+
41
+ class MetaMock(type):
42
+ def __call__(cls, *args, **kwargs):
43
+ wrapped_object = kwargs.get('wrapped_object', None)
44
+ if wrapped_object is not None and hasattr(wrapped_object, 'Id'):
45
+ obj = cls._cls_instances.get(wrapped_object.Id, None)
46
+ if obj is not None:
47
+ return obj
48
+
49
+ obj = cls.__new__(cls)
50
+ if wrapped_object is None:
51
+ wrapped_object = obj.create_simultan_instance(*args, **kwargs)
52
+ kwargs['wrapped_object'] = wrapped_object
53
+ obj.__init__(*args, **kwargs)
54
+ if hasattr(wrapped_object, 'Id'):
55
+ cls._cls_instances[wrapped_object.Id] = obj
56
+ return obj
57
+
58
+
59
+ class BaseGeometry(object, metaclass=MetaMock):
60
+
61
+ associate_instance_type = getattr(SimInstanceType, 'None')
62
+
63
+ def __init__(self, *args, **kwargs):
64
+ self._wrapped_object: Union[Vertex, Edge, Face, Volume, EdgeLoop, Layer] = kwargs.get('wrapped_object', None)
65
+ self._geometry_model: Optional[GeometryModel] = kwargs.get('geometry_model', None)
66
+ self._object_mapper = kwargs.get('object_mapper', config.default_mapper)
67
+ self._data_model = kwargs.get('data_model', None)
68
+
69
+ @property
70
+ def id(self):
71
+ return self._wrapped_object.Id
72
+
73
+ @property
74
+ def components(self):
75
+ return self.get_components()
76
+
77
+ def get_components(self) -> list[Union[SimComponent, 'SimultanObject']]:
78
+ if self._object_mapper is None:
79
+ return list(self._geometry_model.Exchange.GetComponents(self._wrapped_object))
80
+ else:
81
+ return [self._object_mapper.create_python_object(x,
82
+ data_model=self._data_model) for x in list(
83
+ self._geometry_model.Exchange.GetComponents(self._wrapped_object))]
84
+
85
+ def associate(self, component: Union[SimComponent, 'SimultanObject']):
86
+ wrapped_obj = component if isinstance(component, SimComponent) else component._wrapped_obj
87
+ wrapped_obj.InstanceType = self.associate_instance_type
88
+ self._geometry_model.Exchange.Associate(wrapped_obj, self._wrapped_object)
89
+
90
+ def disassociate(self, component: Union[SimComponent, 'SimultanObject']):
91
+ wrapped_obj = component if isinstance(component, SimComponent) else component._wrapped_obj
92
+ self._geometry_model.Exchange.Disassociate(self._wrapped_object, wrapped_obj)
93
+
94
+
95
+ class classproperty(object):
96
+
97
+ def __init__(self, getter):
98
+ self.getter = getter
99
+
100
+ def __get__(self, instance, owner):
101
+ return self.getter(owner)
102
+
103
+
104
+ class SimultanLayer(BaseGeometry):
105
+
106
+ _cls_instances = WeakValueDictionary() # weak set with all created objects
107
+
108
+ @classmethod
109
+ def create_simultan_instance(cls, *args, **kwargs) -> 'SimultanLayer':
110
+ """
111
+ Create a new SimultanLayer instance and add to the geometry model
112
+ :keyword geometry_model: GeometryModel
113
+ :keyword name: str
114
+ :return: SimultanLayer
115
+ """
116
+
117
+ layer = Layer(kwargs.get('geometry_model').GeometryModelData,
118
+ kwargs.get('name', 'Layer'))
119
+ geometry_model: GeometryModel = kwargs.get('geometry_model')
120
+ geometry_model.add_layer(layer)
121
+ return layer
122
+
123
+ def __init__(self, *args, **kwargs):
124
+ super(SimultanLayer, self).__init__(*args, **kwargs)
125
+
126
+ @property
127
+ def color(self):
128
+ return self._wrapped_object.Color
129
+
130
+
131
+ class ExtendedBaseGeometry(BaseGeometry):
132
+
133
+ def __init__(self, *args, **kwargs):
134
+ super(ExtendedBaseGeometry, self).__init__(*args, **kwargs)
135
+ self.layer = kwargs.get('layer', None)
136
+
137
+ @property
138
+ def name(self):
139
+ return self._wrapped_object.Name
140
+
141
+ @name.setter
142
+ def name(self, value: str):
143
+ self._wrapped_object.Name = value
144
+
145
+ @property
146
+ def layer(self):
147
+ cls = self._object_mapper.registered_geometry_classes[Layer]
148
+ return cls(wrapped_object=self._wrapped_object.Layer,
149
+ geometry_model=self._geometry_model,
150
+ object_mapper=self._object_mapper,
151
+ data_model=self._data_model)
152
+
153
+ @layer.setter
154
+ def layer(self, value: Union[SimultanLayer, Layer]):
155
+ if value is None:
156
+ return
157
+
158
+ if isinstance(value, SimultanLayer):
159
+ new_layer = value._wrapped_object
160
+ else:
161
+ new_layer = value
162
+
163
+ if self._wrapped_object.Layer.Id != new_layer.Id:
164
+ self._wrapped_object.Layer = new_layer
165
+
166
+ def add_to_model(self):
167
+ self._wrapped_object.AddToModel()
168
+
169
+ def remove_from_model(self):
170
+ self._wrapped_object.RemoveFromModel()
171
+
172
+
173
+ class SimultanVertex(ExtendedBaseGeometry):
174
+
175
+ associate_instance_type = SimInstanceType.AttributesPoint
176
+ _cls_instances = WeakValueDictionary() # weak set with all created objects
177
+
178
+ @classmethod
179
+ def create_simultan_instance(cls, *args, **kwargs):
180
+ k_pos: Optional[tuple[float, float, float]] = kwargs.get('position', None)
181
+ if k_pos is not None:
182
+ position = SimPoint3D(k_pos[0], k_pos[1], k_pos[2])
183
+ else:
184
+ position = SimPoint3D(kwargs.get('x', 0), kwargs.get('y', 0), kwargs.get('z', 0))
185
+
186
+ # layer
187
+ layer = kwargs.get('layer', None)
188
+ if layer is None:
189
+ layer = kwargs.get('geometry_model').default_layer
190
+
191
+ if isinstance(layer, SimultanLayer):
192
+ layer = layer._wrapped_object
193
+
194
+ wrapped_object = Vertex(layer, kwargs.get('name', 'vertex'), position)
195
+ return wrapped_object
196
+
197
+ def __init__(self, *args, **kwargs):
198
+ super(SimultanVertex, self).__init__(*args, **kwargs)
199
+ if self._wrapped_object is None:
200
+ self.x = kwargs.get('x', 0)
201
+ self.y = kwargs.get('y', 0)
202
+ self.z = kwargs.get('z', 0)
203
+
204
+ @property
205
+ def x(self):
206
+ return self._wrapped_object.Position.X
207
+
208
+ @x.setter
209
+ def x(self, value: float):
210
+ self._wrapped_object.Position.X = value
211
+
212
+ @property
213
+ def y(self):
214
+ return self._wrapped_object.Position.Y
215
+
216
+ @y.setter
217
+ def y(self, value: float):
218
+ self._wrapped_object.Position.Y = value
219
+
220
+ @property
221
+ def z(self):
222
+ return self._wrapped_object.Position.Z
223
+
224
+ @z.setter
225
+ def z(self, value: float):
226
+ self._wrapped_object.Position.Z = value
227
+
228
+ @property
229
+ def position(self):
230
+ return (self._wrapped_object.Position.X,
231
+ self._wrapped_object.Position.Y,
232
+ self._wrapped_object.Position.Z)
233
+
234
+ @position.setter
235
+ def position(self, value: tuple[float, float, float]):
236
+ self._wrapped_object.Position.X = value[0]
237
+ self._wrapped_object.Position.Y = value[1]
238
+ self._wrapped_object.Position.Z = value[2]
239
+
240
+ def __repr__(self):
241
+ return f"SimultanVertex {self.id} ({self.x}, {self.y}, {self.z})"
242
+
243
+
244
+ class SimultanEdge(ExtendedBaseGeometry):
245
+
246
+ associate_instance_type = SimInstanceType.AttributesEdge
247
+ _cls_instances = WeakValueDictionary() # weak set with all created objects
248
+
249
+ @classmethod
250
+ def create_simultan_instance(cls, *args, **kwargs):
251
+ # layer
252
+ layer = kwargs.get('layer', None)
253
+ if layer is None:
254
+ layer = kwargs.get('geometry_model').default_layer
255
+
256
+ if isinstance(layer, SimultanLayer):
257
+ layer = layer._wrapped_object
258
+
259
+ vertices = [x if isinstance(x, Vertex) else x._wrapped_object for x in kwargs.get('vertices', [])]
260
+
261
+ wrapped_object = Edge(layer,
262
+ kwargs.get('name', 'vertex'),
263
+ IEnumerable[Vertex](Array[Vertex](vertices)))
264
+ return wrapped_object
265
+
266
+ def __init__(self, *args, **kwargs):
267
+ super(SimultanEdge, self).__init__(*args, **kwargs)
268
+
269
+ @property
270
+ def length(self):
271
+ return EdgeAlgorithms.Length(self._wrapped_object)
272
+
273
+ @property
274
+ def vertices(self):
275
+ cls = self._object_mapper.registered_geometry_classes[Vertex]
276
+ return [cls(wrapped_object=x,
277
+ geometry_model=self._geometry_model,
278
+ object_mapper=self._object_mapper,
279
+ data_model=self._data_model) for x in self._wrapped_object.Vertices]
280
+
281
+ @property
282
+ def vertex_0(self):
283
+ cls = self._object_mapper.registered_geometry_classes[Vertex]
284
+ return cls(wrapped_object=self._wrapped_object.Vertices[0],
285
+ geometry_model=self._geometry_model,
286
+ object_mapper=self._object_mapper,
287
+ data_model=self._data_model)
288
+
289
+ @property
290
+ def vertex_1(self):
291
+ cls = self._object_mapper.registered_geometry_classes[Vertex]
292
+ return cls(wrapped_object=self._wrapped_object.Vertices[1],
293
+ geometry_model=self._geometry_model,
294
+ object_mapper=self._object_mapper,
295
+ data_model=self._data_model)
296
+
297
+ def __repr__(self):
298
+ return f"SimultanEdge {self.id} ({self.vertex_0.id}, {self.vertex_1.id})"
299
+
300
+
301
+ class SimultanPEdge(ExtendedBaseGeometry):
302
+
303
+ _cls_instances = WeakValueDictionary() # weak set with all created objects
304
+
305
+ @classmethod
306
+ def create_simultan_instance(cls, *args, **kwargs):
307
+
308
+ layer = kwargs.get('layer', None)
309
+ if layer is None:
310
+ layer = kwargs.get('geometry_model').default_layer
311
+ if isinstance(layer, SimultanLayer):
312
+ layer = layer._wrapped_object
313
+
314
+ edge = kwargs.get('edge', None)
315
+ edge = edge._wrapped_object if isinstance(edge, SimultanEdge) else edge
316
+
317
+ free_id = kwargs.get('geometry_model').get_free_id()
318
+
319
+ wrapped_object = PEdge(edge,
320
+ kwargs.get('geometric_orientation', GeometricOrientation.Undefined),
321
+ kwargs.get('base_edge_container', BaseEdgeContainer(free_id, layer))
322
+ )
323
+ return wrapped_object
324
+
325
+ @property
326
+ def id(self):
327
+ return self._wrapped_object.GetHashCode()
328
+
329
+ def __init__(self, *args, **kwargs):
330
+ super(SimultanPEdge, self).__init__(*args, **kwargs)
331
+
332
+ @property
333
+ def edges(self):
334
+ return [SimultanEdge(wrapped_object=x,
335
+ geometry_model=self._geometry_model,
336
+ object_mapper=self._object_mapper,
337
+ data_model=self._data_model) for x in self._wrapped_object.Edges]
338
+
339
+
340
+ class SimultanEdgeLoop(ExtendedBaseGeometry):
341
+
342
+ _cls_instances = WeakValueDictionary() # weak set with all created objects
343
+
344
+ @classmethod
345
+ def create_simultan_instance(cls, *args, **kwargs):
346
+ # layer
347
+ layer = kwargs.get('layer', None)
348
+ if layer is None:
349
+ layer = kwargs.get('geometry_model').default_layer
350
+
351
+ if isinstance(layer, SimultanLayer):
352
+ layer = layer._wrapped_object
353
+
354
+ edges = [x if isinstance(x, Edge) else x._wrapped_object for x in kwargs.get('edges', [])]
355
+
356
+ wrapped_object = EdgeLoop(layer,
357
+ kwargs.get('name', 'EdgeLoop'),
358
+ IEnumerable[Edge](Array[Edge](edges))
359
+ )
360
+ return wrapped_object
361
+
362
+ def __init__(self, *args, **kwargs):
363
+ super(SimultanEdgeLoop, self).__init__(*args, **kwargs)
364
+
365
+ @property
366
+ def edges(self):
367
+ cls = self._object_mapper.registered_geometry_classes[Edge]
368
+ return [cls(wrapped_object=x.Edge,
369
+ geometry_model=self._geometry_model,
370
+ object_mapper=self._object_mapper,
371
+ data_model=self._data_model) for x in self._wrapped_object.Edges]
372
+
373
+ @property
374
+ def vertices(self) -> list[SimultanVertex]:
375
+ vertices = []
376
+
377
+ for edge in self.edges:
378
+ vertices.append(edge.vertices[0])
379
+
380
+ return vertices
381
+
382
+ def __repr__(self):
383
+ return f"SimultanEdgeLoop {self.id} ({[x.id for x in self.edges]})"
384
+
385
+
386
+ class SimultanFace(ExtendedBaseGeometry):
387
+
388
+ associate_instance_type = SimInstanceType.AttributesFace
389
+ _cls_instances = WeakValueDictionary() # weak set with all created objects
390
+
391
+ @classmethod
392
+ def create_simultan_instance(cls, *args, **kwargs):
393
+ layer = kwargs.get('layer', None)
394
+ if layer is None:
395
+ layer = kwargs.get('geometry_model').default_layer
396
+ if isinstance(layer, SimultanLayer):
397
+ layer = layer._wrapped_object
398
+
399
+ edge_loop = kwargs.get('edge_loop', kwargs.get('boundary', None))
400
+ edge_loop = edge_loop if isinstance(edge_loop, EdgeLoop) else edge_loop._wrapped_object
401
+
402
+ holes = [x if isinstance(x, EdgeLoop) else x._wrapped_object for x in kwargs.get('holes', [])]
403
+ if len(holes) > 0:
404
+ holes = IEnumerable[EdgeLoop](Array[EdgeLoop](holes))
405
+ else:
406
+ holes = None
407
+
408
+ wrapped_object = Face(layer,
409
+ kwargs.get('name', 'Face'),
410
+ edge_loop,
411
+ kwargs.get('geometric_orientation', GeometricOrientation.Forward),
412
+ holes)
413
+
414
+ return wrapped_object
415
+
416
+ def __init__(self, *args, **kwargs):
417
+ super(SimultanFace, self).__init__(*args, **kwargs)
418
+
419
+ @property
420
+ def area(self) -> tuple[np.ndarray, np.ndarray]:
421
+ return FaceAlgorithms.Area(self._wrapped_object)
422
+
423
+ @property
424
+ def boundary(self):
425
+ cls = self._object_mapper.registered_geometry_classes[EdgeLoop]
426
+ return cls(wrapped_object=self._wrapped_object.Boundary,
427
+ geometry_model=self._geometry_model,
428
+ object_mapper=self._object_mapper,
429
+ data_model=self._data_model)
430
+
431
+ @property
432
+ def holes(self) -> list[SimultanEdgeLoop]:
433
+ cls = self._object_mapper.registered_geometry_classes[EdgeLoop]
434
+ return [cls(wrapped_object=x,
435
+ geometry_model=self._geometry_model,
436
+ object_mapper=self._object_mapper,
437
+ data_model=self._data_model) for x in self._wrapped_object.Holes]
438
+
439
+ @property
440
+ def orientation(self):
441
+ return self._wrapped_object.Orientation
442
+
443
+ @property
444
+ def normal(self):
445
+ return array([self._wrapped_object.Normal.X,
446
+ self._wrapped_object.Normal.Y,
447
+ self._wrapped_object.Normal.Z])
448
+
449
+ @property
450
+ def stl(self):
451
+ return self.create_stl_str()
452
+
453
+ @property
454
+ def vertices(self) -> list[SimultanVertex]:
455
+ vertices = self.boundary_vertices
456
+ for hole in self.holes:
457
+ vertices.append(hole.vertices[0])
458
+ return vertices
459
+
460
+ @property
461
+ def boundary_vertices(self) -> list[SimultanVertex]:
462
+ vertices = []
463
+ for edge in self.boundary.edges:
464
+ vertices.append(edge.vertices[0])
465
+ return vertices
466
+
467
+ def triangulate(self):
468
+ triangulation =FaceAlgorithms.Triangulate(self._wrapped_object, GeometricOrientation.Forward)
469
+ vertices = np.array([(x.X, x.Y, x.Z) for x in triangulation.Item1])
470
+ triangles = np.array(triangulation.Item3).reshape(int(triangulation.Item3.Count / 3), 3)
471
+
472
+ return vertices, triangles
473
+
474
+ def __repr__(self):
475
+ return f"SimultanFace {self.id} ({self.boundary.id}, {[x.id for x in self.holes]})"
476
+
477
+
478
+ class SimultanVolume(ExtendedBaseGeometry):
479
+
480
+ associate_instance_type = SimInstanceType.Entity3D
481
+ _cls_instances = WeakValueDictionary() # weak set with all created objects
482
+
483
+ @classmethod
484
+ def create_simultan_instance(cls, *args, **kwargs):
485
+ layer = kwargs.get('layer', None)
486
+ if layer is None:
487
+ layer = kwargs.get('geometry_model').default_layer
488
+
489
+ if isinstance(layer, SimultanLayer):
490
+ layer = layer._wrapped_object
491
+
492
+ faces = IEnumerable[Face](
493
+ Array[Face]([x if isinstance(x, Face) else x._wrapped_object for x in kwargs.get('faces', [])]))
494
+
495
+ wrapped_object = Volume(layer,
496
+ kwargs.get('name', 'Face'),
497
+ faces,
498
+ )
499
+
500
+ return wrapped_object
501
+
502
+ def __init__(self, *args, **kwargs):
503
+ super(SimultanVolume, self).__init__(*args, **kwargs)
504
+
505
+ @property
506
+ def faces(self):
507
+
508
+ face_cls = self._object_mapper.registered_geometry_classes[Face]
509
+ return [face_cls(wrapped_object=x.Face,
510
+ geometry_model=self._geometry_model,
511
+ object_mapper=self._object_mapper,
512
+ data_model=self._data_model) for x in self._wrapped_object.Faces]
513
+
514
+ @property
515
+ def vertices(self):
516
+ vertices = set()
517
+
518
+ for face in self.faces:
519
+ vertices.update(face.vertices)
520
+
521
+ return vertices
522
+
523
+ @property
524
+ def area_brutto_netto(self):
525
+ return VolumeAlgorithms.AreaBruttoNetto(self._wrapped_object)
526
+
527
+ @property
528
+ def volume(self):
529
+ return VolumeAlgorithms.Volume(self._wrapped_object)
530
+
531
+ def __repr__(self):
532
+ return f"SimultanVolume {self.id} ({[x.id for x in self.faces]})"
533
+
534
+
535
+ class GeometryModel(object, metaclass=MetaMock):
536
+
537
+ @classmethod
538
+ def create_simultan_instance(cls, *args, **kwargs):
539
+
540
+ data_model: DataModel = kwargs.get('data_model', config.default_data_model)
541
+ name = kwargs.get('name', 'GeometryModel')
542
+
543
+ new_geo_model, resource = data_model.create_new_geometry_model(name=name)
544
+ data_model.project_data_manager.GeometryModels.AddGeometryModel(new_geo_model)
545
+ data_model.models_dict[resource.Key] = new_geo_model
546
+
547
+ return new_geo_model
548
+
549
+ def __init__(self, *args, **kwargs):
550
+ self._wrapped_object: NetGeometryModel = kwargs.get('wrapped_object', None)
551
+ self._object_mapper = kwargs.get('object_mapper', config.default_mapper)
552
+ self._data_model = kwargs.get('data_model', config.default_data_model)
553
+
554
+ @property
555
+ def name(self):
556
+ return self._wrapped_object.Name
557
+
558
+ @name.setter
559
+ def name(self, value: str):
560
+ self._wrapped_object.Name = value
561
+
562
+ @property
563
+ def key(self):
564
+ if self.resource_file_entry is not None:
565
+ return self.resource_file_entry.Key
566
+
567
+ @property
568
+ def layers(self):
569
+ cls = self._object_mapper.registered_geometry_classes[Layer]
570
+ return [cls(wrapped_object=x,
571
+ geometry_model=self,
572
+ object_mapper=self._object_mapper,
573
+ data_model=self._data_model) for x in list(self._wrapped_object.Geometry.Layers)]
574
+
575
+ @property
576
+ def default_layer(self):
577
+ if self.layers:
578
+ return self.layers[0]
579
+ else:
580
+ cls = self._object_mapper.registered_geometry_classes[Layer]
581
+ cls(geometry_model=self,
582
+ data_model=self._data_model,
583
+ name='Default Layer')
584
+ return self.layers[0]
585
+
586
+ @property
587
+ def vertices(self):
588
+ cls = self._object_mapper.registered_geometry_classes[Vertex]
589
+ return [cls(wrapped_object=x,
590
+ geometry_model=self,
591
+ object_mapper=self._object_mapper,
592
+ data_model=self._data_model) for x in self._wrapped_object.Geometry.Vertices]
593
+
594
+ @property
595
+ def edges(self):
596
+ cls = self._object_mapper.registered_geometry_classes[Edge]
597
+ return [cls(wrapped_object=x,
598
+ geometry_model=self,
599
+ object_mapper=self._object_mapper,
600
+ data_model=self._data_model) for x in self._wrapped_object.Geometry.Edges]
601
+
602
+ @property
603
+ def edge_loops(self):
604
+ cls = self._object_mapper.registered_geometry_classes[EdgeLoop]
605
+ return [cls(wrapped_object=x,
606
+ geometry_model=self,
607
+ object_mapper=self._object_mapper,
608
+ data_model=self._data_model) for x in self._wrapped_object.Geometry.EdgeLoops]
609
+
610
+ @property
611
+ def faces(self):
612
+ cls = self._object_mapper.registered_geometry_classes[Face]
613
+ return [cls(wrapped_object=x,
614
+ geometry_model=self,
615
+ object_mapper=self._object_mapper,
616
+ data_model=self._data_model) for x in self._wrapped_object.Geometry.Faces]
617
+
618
+ @property
619
+ def volumes(self):
620
+ cls = self._object_mapper.registered_geometry_classes[Volume]
621
+ return [cls(wrapped_object=x,
622
+ geometry_model=self,
623
+ object_mapper=self._object_mapper,
624
+ data_model=self._data_model) for x in self._wrapped_object.Geometry.Volumes]
625
+
626
+ @property
627
+ def resource_file_entry(self):
628
+ return self._wrapped_object.File
629
+
630
+ @property
631
+ def geo_references(self):
632
+ return self._wrapped_object.Geometry.GeoReferences
633
+
634
+ @property
635
+ def Exchange(self):
636
+ return self._wrapped_object.Exchange
637
+
638
+ @property
639
+ def GeometryModelData(self):
640
+ return self._wrapped_object.Geometry
641
+
642
+ def add_layer(self, layer: Union[Layer, SimultanLayer]):
643
+ if isinstance(layer, SimultanLayer):
644
+ layer = layer._wrapped_object
645
+ self._wrapped_object.Geometry.Layers.Add(layer)
646
+
647
+ def get_geometry_by_id(self, geo_id):
648
+ return self._wrapped_object.Geometry.GeometryFromId(geo_id)
649
+
650
+ def get_layer_by_id(self, geo_id):
651
+ return self._wrapped_object.Geometry.LayerFromId(geo_id)
652
+
653
+ def get_free_id(self):
654
+ return self._wrapped_object.Geometry.GetFreeId(True)