NaxToPy 2.0.0__tar.gz → 2.1.0__tar.gz

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.
Files changed (52) hide show
  1. {naxtopy-2.0.0/src/NaxToPy.egg-info → naxtopy-2.1.0}/PKG-INFO +24 -9
  2. {naxtopy-2.0.0 → naxtopy-2.1.0}/README.md +23 -8
  3. {naxtopy-2.0.0 → naxtopy-2.1.0}/pyproject.toml +1 -1
  4. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PLoadCase.py +24 -4
  5. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PModelInputData.py +164 -11
  6. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PProperty.py +3 -0
  7. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PResult.py +16 -5
  8. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Constants/Constants.py +3 -3
  9. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/N2PLog.py +42 -0
  10. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/N2PModelContent.py +103 -11
  11. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Reference_Finder/__Reference_Finder.py +5 -4
  12. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PtoEXE/N2PtoEXE.py +26 -2
  13. {naxtopy-2.0.0 → naxtopy-2.1.0/src/NaxToPy.egg-info}/PKG-INFO +24 -9
  14. {naxtopy-2.0.0 → naxtopy-2.1.0}/LICENSE +0 -0
  15. {naxtopy-2.0.0 → naxtopy-2.1.0}/setup.cfg +0 -0
  16. {naxtopy-2.0.0 → naxtopy-2.1.0}/setup.py +0 -0
  17. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/AllClasses.py +0 -0
  18. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PComponent.py +0 -0
  19. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PConnector.py +0 -0
  20. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PCoord.py +0 -0
  21. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PElement.py +0 -0
  22. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PFreeBody.py +0 -0
  23. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PIncrement.py +0 -0
  24. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PMaterial.py +0 -0
  25. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PNode.py +0 -0
  26. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PReport.py +0 -0
  27. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PSection.py +0 -0
  28. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PSet.py +0 -0
  29. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/ProgresBar.py +0 -0
  30. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/__init__.py +0 -0
  31. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Constants/__init__.py +0 -0
  32. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Constants/librerias.py +0 -0
  33. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/N2PColors.py +0 -0
  34. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/N2PFileHandler.py +0 -0
  35. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/__init__.py +0 -0
  36. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/Reference_Finder/__init__.py +0 -0
  37. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/_AuxFunc/_NetToPython.py +0 -0
  38. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/_AuxFunc/__init__.py +0 -0
  39. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Core/__init__.py +0 -0
  40. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Modules/Fasteners/N2PUpdateFastener.py +0 -0
  41. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Modules/Fasteners/__init__.py +0 -0
  42. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PEnvelope/N2PEnvelope.py +0 -0
  43. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PEnvelope/__init__.py +0 -0
  44. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PtoEXE/__init__.py +0 -0
  45. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/Modules/__init__.py +0 -0
  46. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/NaxToPy.ico +0 -0
  47. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/__init__.py +0 -0
  48. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy/user_functions.txt +0 -0
  49. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy.egg-info/SOURCES.txt +0 -0
  50. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy.egg-info/dependency_links.txt +0 -0
  51. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy.egg-info/requires.txt +0 -0
  52. {naxtopy-2.0.0 → naxtopy-2.1.0}/src/NaxToPy.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: NaxToPy
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Package for postprocessing FEM results in Python
5
5
  Home-page: https://www.idaerosolutions.com/Home/NaxToPy
6
6
  Download-URL: https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US
@@ -135,9 +135,9 @@ Requires-Dist: setuptools>=67.8.0
135
135
 
136
136
  **NaxToPy** is the [**NaxTo**](https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US)
137
137
  library designed for Python, which allows reading and manipulating FEM
138
- analysis results files from the most common tools: Nastran (op2, xdb, h5), Abaqus (odb), Optistruct
139
- (h3d, op2) and Ansys (rst); and stores them in a user-friendly Python structure. Additionally, it
140
- can read input files from Nastran (bdf, fem) and change it contents.
138
+ analysis results files from the most common tools: Nastran (.op2, .xdb, .h5), Abaqus (odb), Optistruct
139
+ (.h3d, .op2) and Ansys (.rst); and stores them in a user-friendly Python structure. Additionally, it
140
+ can read input files from Nastran (.bdf, .fem) and change their contents.
141
141
 
142
142
  It could be easily combined with other Python packages as Matplotlib or Pandas. This provides access
143
143
  to the full coding power of Python to interpret and process the results, without the need to install
@@ -147,15 +147,18 @@ links on the left).
147
147
  **NaxToPy** is a powerful tool for FEM analysis post-processing!
148
148
 
149
149
  **CAUTION:** To use NaxToPy, [**NaxTo**](https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US) must be installed.
150
- This version is compatible with **NaxTo 2024.1**. It may be compatible with all the steps of this version (2024.1.0, 2024.1.1, 2024.1.2, etc.).
150
+ This version is compatible with **NaxTo 2024.2**. It is compatible with all the steps of this version (2024.2.0, 2024.2.1, 2024.2.2, etc.).
151
151
  Check in _Programs and Features_ the NaxTo version that is installed.
152
152
 
153
153
  ## Installation
154
154
 
155
+ If python is installed and `pip` is added to the PATH:
155
156
 
156
- If python is callable from the command line:
157
+ `pip install NaxToPy`
158
+
159
+ An alternative, if Python is callable from the command line:
157
160
 
158
- `py -m pip install NaxToPy`
161
+ `python -m pip install NaxToPy`
159
162
 
160
163
  For **Visual Studio** users:
161
164
  - Open "Python Environments" window
@@ -179,7 +182,7 @@ same directory. When ever you want to use the NaxToPy package add the following
179
182
 
180
183
  If python is callable from the command line:
181
184
 
182
- `py -m pip install -U NaxToPy`
185
+ `python -m pip install -U NaxToPy`
183
186
 
184
187
  For Visual Studio users:
185
188
  - Open "Python Environments" window
@@ -260,6 +263,18 @@ the LoadCases that are critical or the Increment that is critical instead of the
260
263
  2. New internal methods to look for the compatibility with low-level dependencies.
261
264
  3. The name of the .log is now NaxToPy_Year-Month-Day.log.
262
265
 
266
+ ### v.2.0.1
267
+ 1. The compatibility is extended to all NaxTo steps of the same version.
268
+ 2. The property N2PLoadCase.ActiveIncrement is subtitued by N2PLoadCase.ActiveN2PIncrement.
269
+ It uses an object instaed of an int.
270
+ 3. Update of the examples of some docstrings.
271
+
272
+ ### v.2.1.0
273
+ 1. Reading a Natran Input File: SPC and SCP1 are now supported.
274
+ 2. Bug fix. The order in the components in new_report() does not affect now.
275
+ 3. Formula check in new_derived_loadcase(), new_enevelope_loadcase() and new_derived_component().
276
+ 4. New optional arguments if n2ptoexe() to add extra libaries, packages or files.
277
+
263
278
  # Documentation
264
279
 
265
280
  **NaxToPy** is a package developed by Idaero Solutions© as a part of the **NaxTo** software.
@@ -339,7 +354,7 @@ loadcaseslist = model.LoadCases
339
354
  pressure_lc = model.get_load_case("pressure")
340
355
 
341
356
  # Change the active increment (by default is the last one):
342
- pressure_lc.ActiveIncrement = 10
357
+ pressure_lc.ActiveN2PIncrement = pressure_lc.get_increment(10)
343
358
 
344
359
  # Look for all results
345
360
  all_results = pressure_lc.Results
@@ -11,9 +11,9 @@
11
11
 
12
12
  **NaxToPy** is the [**NaxTo**](https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US)
13
13
  library designed for Python, which allows reading and manipulating FEM
14
- analysis results files from the most common tools: Nastran (op2, xdb, h5), Abaqus (odb), Optistruct
15
- (h3d, op2) and Ansys (rst); and stores them in a user-friendly Python structure. Additionally, it
16
- can read input files from Nastran (bdf, fem) and change it contents.
14
+ analysis results files from the most common tools: Nastran (.op2, .xdb, .h5), Abaqus (odb), Optistruct
15
+ (.h3d, .op2) and Ansys (.rst); and stores them in a user-friendly Python structure. Additionally, it
16
+ can read input files from Nastran (.bdf, .fem) and change their contents.
17
17
 
18
18
  It could be easily combined with other Python packages as Matplotlib or Pandas. This provides access
19
19
  to the full coding power of Python to interpret and process the results, without the need to install
@@ -23,15 +23,18 @@ links on the left).
23
23
  **NaxToPy** is a powerful tool for FEM analysis post-processing!
24
24
 
25
25
  **CAUTION:** To use NaxToPy, [**NaxTo**](https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US) must be installed.
26
- This version is compatible with **NaxTo 2024.1**. It may be compatible with all the steps of this version (2024.1.0, 2024.1.1, 2024.1.2, etc.).
26
+ This version is compatible with **NaxTo 2024.2**. It is compatible with all the steps of this version (2024.2.0, 2024.2.1, 2024.2.2, etc.).
27
27
  Check in _Programs and Features_ the NaxTo version that is installed.
28
28
 
29
29
  ## Installation
30
30
 
31
+ If python is installed and `pip` is added to the PATH:
31
32
 
32
- If python is callable from the command line:
33
+ `pip install NaxToPy`
34
+
35
+ An alternative, if Python is callable from the command line:
33
36
 
34
- `py -m pip install NaxToPy`
37
+ `python -m pip install NaxToPy`
35
38
 
36
39
  For **Visual Studio** users:
37
40
  - Open "Python Environments" window
@@ -55,7 +58,7 @@ same directory. When ever you want to use the NaxToPy package add the following
55
58
 
56
59
  If python is callable from the command line:
57
60
 
58
- `py -m pip install -U NaxToPy`
61
+ `python -m pip install -U NaxToPy`
59
62
 
60
63
  For Visual Studio users:
61
64
  - Open "Python Environments" window
@@ -136,6 +139,18 @@ the LoadCases that are critical or the Increment that is critical instead of the
136
139
  2. New internal methods to look for the compatibility with low-level dependencies.
137
140
  3. The name of the .log is now NaxToPy_Year-Month-Day.log.
138
141
 
142
+ ### v.2.0.1
143
+ 1. The compatibility is extended to all NaxTo steps of the same version.
144
+ 2. The property N2PLoadCase.ActiveIncrement is subtitued by N2PLoadCase.ActiveN2PIncrement.
145
+ It uses an object instaed of an int.
146
+ 3. Update of the examples of some docstrings.
147
+
148
+ ### v.2.1.0
149
+ 1. Reading a Natran Input File: SPC and SCP1 are now supported.
150
+ 2. Bug fix. The order in the components in new_report() does not affect now.
151
+ 3. Formula check in new_derived_loadcase(), new_enevelope_loadcase() and new_derived_component().
152
+ 4. New optional arguments if n2ptoexe() to add extra libaries, packages or files.
153
+
139
154
  # Documentation
140
155
 
141
156
  **NaxToPy** is a package developed by Idaero Solutions© as a part of the **NaxTo** software.
@@ -215,7 +230,7 @@ loadcaseslist = model.LoadCases
215
230
  pressure_lc = model.get_load_case("pressure")
216
231
 
217
232
  # Change the active increment (by default is the last one):
218
- pressure_lc.ActiveIncrement = 10
233
+ pressure_lc.ActiveN2PIncrement = pressure_lc.get_increment(10)
219
234
 
220
235
  # Look for all results
221
236
  all_results = pressure_lc.Results
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "NaxToPy"
7
- version = "2.0.0"
7
+ version = "2.1.0"
8
8
  license = {file = "LICENSE"}
9
9
  authors = [ { name = "Idaero Solutions", email = "manuel.sanchez@idaerosolutions.com" }, ]
10
10
  requires-python = ">=3.9"
@@ -119,15 +119,17 @@ class N2PLoadCase:
119
119
 
120
120
  # Metodo para obtener el incremento activo. Influye en la funcion de llamada a get_result_array
121
121
  @property
122
- def ActiveIncrement(self) -> str:
123
- ''' Returns the active increment of the load case. By default, is the last one.'''
122
+ def ActiveIncrement(self) -> int:
123
+ """DEPRECATED PROPERTY. Use ActiveN2PIncrement.ID instaed. Returns the active increment of the load case. By
124
+ default, is the last one."""
125
+ N2PLog.Warning.W206()
124
126
  return self.__activeIncrement__
125
127
  # ------------------------------------------------------------------------------------------------------------------
126
128
 
127
- # Metodo para obtener el incremento activo. Influye en la funcion de llamada a get_result_array
129
+ # Metodo para establecer el incremento activo. Influye en la funcion de llamada a get_result_array
128
130
  @ActiveIncrement.setter
129
131
  def ActiveIncrement(self, id: Union[int, str]) -> None:
130
- ''' Sets the active increment of the load case. By defult is the last one.
132
+ ''' DEPRECATED PROPERTY. Use ActiveN2PIncrement instead. Sets the active increment of the load case. By defult is the last one.
131
133
 
132
134
  Args:
133
135
  id: int | str -> ID or Name of the N2PIncrement
@@ -141,6 +143,24 @@ class N2PLoadCase:
141
143
  N2PLog.Error.E207(id)
142
144
  # ------------------------------------------------------------------------------------------------------------------
143
145
 
146
+ # Metodo para obtener el incremento activo. Influye en la funcion de llamada a get_result_array
147
+ @property
148
+ def ActiveN2PIncrement(self) -> N2PIncrement:
149
+ """Returns the active increment of the load case. By default, is the last one."""
150
+ return self.get_increments(self.__activeIncrement__)
151
+ # ------------------------------------------------------------------------------------------------------------------
152
+
153
+ # Metodo para establecer el incremento activo. Influye en la funcion de llamada a get_result_array
154
+ @ActiveN2PIncrement.setter
155
+ def ActiveN2PIncrement(self, incr: N2PIncrement) -> None:
156
+ """Sets the active increment of the load case. By defult is the last one.
157
+
158
+ Args:
159
+ incr: N2PIncrement -> ID or Name of the N2PIncrement
160
+ """
161
+ self.__activeIncrement__ = incr.ID
162
+ # ------------------------------------------------------------------------------------------------------------------
163
+
144
164
  # Metodo como propiedad que devuelve todos los N2PResult. Es igual que llamar a get_results sin
145
165
  # parametros
146
166
  @property
@@ -12415,18 +12415,168 @@ class RSPLINE(N2PCard):
12415
12415
  self.__cardinfo.C[i] = val
12416
12416
 
12417
12417
 
12418
+ class SPC(N2PCard):
12419
+
12420
+ def __init__(self, cardinfo):
12421
+ super().__init__(cardinfo)
12422
+ self.__cardinfo = cardinfo
12423
+
12424
+ @property
12425
+ def CharName(self) -> str:
12426
+ """
12427
+ Card code (SPC)
12428
+ """
12429
+ return self.__cardinfo.CharName
12430
+
12431
+ @CharName.setter
12432
+ def CharName(self, value: str) -> None:
12433
+ self.__cardinfo.CharName = value
12434
+
12435
+ @property
12436
+ def SID(self) -> int:
12437
+ """
12438
+ Identification number of the single-point constraint set
12439
+ """
12440
+ return self.__cardinfo.SID
12441
+
12442
+ @SID.setter
12443
+ def SID(self, value: int) -> None:
12444
+ self.__cardinfo.SID = value
12445
+
12446
+ @property
12447
+ def G1(self) -> int:
12448
+ """
12449
+ Grid point identification number of connection points. (Integer > 0)
12450
+ GA
12451
+ """
12452
+ return self.__cardinfo.G1
12453
+
12454
+ @G1.setter
12455
+ def G1(self, value: int) -> None:
12456
+ self.__cardinfo.G1 = value
12457
+
12458
+ @property
12459
+ def C1(self) -> int:
12460
+ """
12461
+ C1
12462
+ """
12463
+ return self.__cardinfo.C1
12464
+
12465
+ @C1.setter
12466
+ def C1(self, value: int) -> None:
12467
+ self.__cardinfo.C1 = value
12468
+
12469
+
12470
+ @property
12471
+ def D1(self) -> float:
12472
+ """
12473
+ D1: enforced motion for components C1 at G1
12474
+ """
12475
+ return self.__cardinfo.D1
12476
+
12477
+ @D1.setter
12478
+ def D1(self, value: float) -> None:
12479
+ self.__cardinfo.D1 = value
12480
+
12481
+ @property
12482
+ def G2(self) -> int:
12483
+ """
12484
+ Grid point identification number of connection points. (Integer > 0)
12485
+ GA
12486
+ """
12487
+ return self.__cardinfo.G2
12488
+
12489
+ @G2.setter
12490
+ def G2(self, value: int) -> None:
12491
+ self.__cardinfo.G2 = value
12492
+
12493
+ @property
12494
+ def C2(self) -> int:
12495
+ """
12496
+ C2
12497
+ """
12498
+ return self.__cardinfo.C2
12499
+
12500
+ @C2.setter
12501
+ def C2(self, value: int) -> None:
12502
+ self.__cardinfo.C2 = value
12503
+
12504
+
12505
+ @property
12506
+ def D2(self) -> float:
12507
+ """
12508
+ D2: enforced motion for components C2 at G2
12509
+ """
12510
+ return self.__cardinfo.D2
12511
+
12512
+ @D2.setter
12513
+ def D2(self, value: float) -> None:
12514
+ self.__cardinfo.D2 = value
12515
+
12516
+
12517
+ class SPC1(N2PCard):
12518
+
12519
+ def __init__(self, cardinfo):
12520
+ super().__init__(cardinfo)
12521
+ self.__cardinfo = cardinfo
12522
+
12523
+ @property
12524
+ def CharName(self) -> str:
12525
+ """
12526
+ Card code (SPC1)
12527
+ """
12528
+ return self.__cardinfo.CharName
12529
+
12530
+ @CharName.setter
12531
+ def CharName(self, value: str) -> None:
12532
+ self.__cardinfo.CharName = value
12533
+
12534
+ @property
12535
+ def SID(self) -> int:
12536
+ """
12537
+ Identification number of the single-point constraint set
12538
+ """
12539
+ return self.__cardinfo.SID
12540
+
12541
+ @SID.setter
12542
+ def SID(self, value: int) -> None:
12543
+ self.__cardinfo.SID = value
12544
+
12545
+ @property
12546
+ def C(self) -> int:
12547
+ """
12548
+ Component numbers: 123456
12549
+ """
12550
+ return self.__cardinfo.C
12551
+
12552
+ @C.setter
12553
+ def C(self, value: int) -> None:
12554
+ self.__cardinfo.C = value
12555
+
12556
+
12557
+ @property
12558
+ def Grids(self) -> list[int, ...]:
12559
+ """
12560
+ Grid or scalar point identification numbers
12561
+ """
12562
+ return self.__cardinfo.NodeArray
12563
+
12564
+ @C.setter
12565
+ def Grids(self, value: list[int, ...]) -> None:
12566
+ self.__cardinfo.NodeArray = value
12567
+
12418
12568
  # Diccionario con todas clases.
12419
12569
  CONSTRUCTDICT = {"CBAR": CBAR,
12420
- "CBEAM": CBEAM,
12421
- "CBUSH": CBUSH,
12422
- "CELAS1": CELAS1,
12423
- "CELAS2": CELAS2,
12424
- "CELAS3": CELAS3,
12425
- "CELAS4": CELAS4,
12426
- "CFAST": CFAST,
12427
- "CHEXA_NASTRAN": CHEXANAS,
12428
- "CHEXA_OPTISTRUCT": CHEXAOPT,
12429
- "CONM2": CONM2,
12570
+ "CBEAM": CBEAM,
12571
+ "CBUSH": CBUSH,
12572
+ "CELAS1": CELAS1,
12573
+ "CELAS2": CELAS2,
12574
+ "CELAS3": CELAS3,
12575
+ "CELAS4": CELAS4,
12576
+ "CFAST": CFAST,
12577
+ "CHEXA_NASTRAN": CHEXANAS,
12578
+ "CHEXA_OPTISTRUCT": CHEXAOPT,
12579
+ "CONM2": CONM2,
12430
12580
  "CORD1C": CORD1C,
12431
12581
  "CORD1R": CORD1R,
12432
12582
  "CORD1S": CORD1S,
@@ -12485,4 +12635,7 @@ CONSTRUCTDICT = {"CBAR": CBAR,
12485
12635
  "RBE2": RBE2,
12486
12636
  "RBE3": RBE3,
12487
12637
  "RSPLINE": RSPLINE,
12488
- "UNSUPPORTED": N2PCard}
12638
+ "SPC": SPC,
12639
+ "SPC1": SPC1,
12640
+ "UNSUPPORTED": N2PCard
12641
+ }
@@ -180,6 +180,9 @@ class N2PComp(N2PProperty):
180
180
  def QMatrix(self,i) -> np.ndarray:
181
181
  """
182
182
  Returns the lamina stiffness matrix (Q-Bar) as a numpy 2D array
183
+ | σx | | ε |
184
+ | σy | = [Q]*| ε |
185
+ | τxy| | γ/2 |
183
186
 
184
187
  """
185
188
 
@@ -1,6 +1,8 @@
1
1
  from NaxToPy.Core.Classes.N2PComponent import N2PComponent
2
2
  from NaxToPy.Core.Errors.N2PLog import N2PLog
3
3
  from NaxToModel import N2Component
4
+ from NaxToModel import N2ArithmeticSolver
5
+ from NaxToModel import N2ErrorWarnningHandling
4
6
  from System.Collections.Generic import List
5
7
 
6
8
 
@@ -162,17 +164,17 @@ class N2PResult:
162
164
 
163
165
  The `Result|Component` must have this structure: `<CMPT_Result:Component>` or `<CMPTD:Component>`.
164
166
 
165
- Examples:
166
- - formula = "<0.5*CMPT_DISPLACEMENTS:MAGNITUDE_D>+2*<CMPT_DISPLACEMENTS:MAGNITUDE_R>"
167
- - formula = "(<CMPTD:Example>-2*<CMPT_DISPLACEMENTS:MAGNITUDE_R>)^2"
168
- - formula = "sqrt(<CMPT_STRESSES:XX>^2+<CMPT_STRESSES:YY>^2-<CMPT_STRESSES:XX>*<CMPT_STRESSES:YY>+3*<CMPT_STRESSES:XY>^2)"
169
-
170
167
  Args:
171
168
  name (str): The name of the component.
172
169
  formula (str): String containing the Result:Component intended to be used and the arithmetic operations.
173
170
 
174
171
  Returns:
175
172
  N2PComponent: Derived load case.
173
+
174
+ Examples:
175
+ >>> N2PResult.new_derived_component("dev_comp1", formula="<0.5*CMPT_DISPLACEMENTS:MAGNITUDE_D>+2*<CMPT_DISPLACEMENTS:MAGNITUDE_R>")
176
+ >>> N2PResult.new_derived_component("dev_comp2", formula="(<CMPTD:Example>-2*<CMPT_DISPLACEMENTS:MAGNITUDE_R>)^2"
177
+ >>> N2PResult.new_derived_component("dev_comp3", formula="sqrt(<CMPT_STRESSES:XX>^2+<CMPT_STRESSES:YY>^2-<CMPT_STRESSES:XX>*<CMPT_STRESSES:YY>+3*<CMPT_STRESSES:XY>^2)")
176
178
  """
177
179
 
178
180
  # Recuperamos la instancia N2ModelModelContent
@@ -192,6 +194,15 @@ class N2PResult:
192
194
  # Call the method that recalculate the data.
193
195
  new_d_comp.RecalculateCMPTInfo2Formule()
194
196
 
197
+ # Este metodo de N2ArithmeticSolver en NaxToModel comprueba que la formula introducida es correcta.
198
+ # Devuelve False si está mal y True si está bien.
199
+ err = N2ArithmeticSolver.CheckExpression(new_d_comp.Formula, mc, N2ArithmeticSolver.ExpressionType.COMPONENT)
200
+ if int(err) == 0:
201
+ pass
202
+ else:
203
+ N2PLog.Error.E230(formula, (formula, str(N2ErrorWarnningHandling.GetDescription(err).upper())) ) # error
204
+ return "ERROR"
205
+
195
206
  # The N2PComponent is instanced and added to the dictionary of derived loadcases:
196
207
  self.__derived_comps__[new_d_comp.Name] = N2PComponent(new_d_comp.Name, new_d_comp.Sections, self)
197
208
 
@@ -1,14 +1,14 @@
1
1
  """Constants of the NaxToPy package"""
2
2
 
3
3
  # NaxToPy Version
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
 
6
6
  # Supported for Naxto:
7
- NAXTO_VERSION = '2024R1'
7
+ NAXTO_VERSION = '2024R2'
8
8
  NAXTO_STEP = "0"
9
9
 
10
10
  # Assembly version of NaxToModel.dll
11
- VIZZER_COMPATIBILITY = ("4.1.0.0", "4.1.0.1")
11
+ VIZZER_COMPATIBILITY = ("4.2.0.0")
12
12
  """Tuple with the compatible versions of NaxToModel.dll"""
13
13
 
14
14
  # PYTHON EXTERNO ----------------------------------------------------------------------------------
@@ -152,6 +152,12 @@ class N2PLog(ABC):
152
152
  message = f"The parallel processing has been set to {parallel}"
153
153
  N2PLog._N2PLog__logger.debug(message)
154
154
 
155
+ @staticmethod
156
+ def D200(assembly) -> None:
157
+ """Message that shows the assembly version of the core library"""
158
+ message = f"The assembly version is: {assembly}"
159
+ N2PLog._N2PLog__logger.debug(message)
160
+
155
161
  @staticmethod
156
162
  def D500(current_time,tinit) -> None:
157
163
  """ Information given for the extraction time.
@@ -443,6 +449,14 @@ own information message. Use the following structure as a standard message (I +
443
449
  message = f"W205: Initialize is a deprecated function. Please, use load_model instead"
444
450
  N2PLog._N2PLog__logger.warning(message)
445
451
 
452
+ @staticmethod
453
+ def W206() -> None:
454
+ """ Warning raised when there the Deprecated property "ActiveIncrement" is called.
455
+ """
456
+ message = f"W206: ActiveIncrement is a deprecated property. Please, ActiveN2pIncrement to obtain a " \
457
+ f"N2PIncrement or ActiveN2pIncrement.ID to obtain the ID"
458
+ N2PLog._N2PLog__logger.warning(message)
459
+
446
460
  @staticmethod
447
461
  def W300() -> None:
448
462
  """ Warning raised when there are more dimensions than points in n2p.envelope
@@ -567,6 +581,13 @@ own information message. Use the following structure as a standard message (I +
567
581
  message = f"E112: THE WINDOWS REGISTER COULDN'T BE MODIFIED. ERROR: {er}"
568
582
  N2PLog._N2PLog__logger.error(message)
569
583
 
584
+ @staticmethod
585
+ def E113(file) -> None:
586
+ """ Error raised when the Windows Register couldn't be modified
587
+ """
588
+ message = f"E113: THE FILE {file} DOESN'T EXIST OR COULDN'T BE FOUND"
589
+ N2PLog._N2PLog__logger.error(message)
590
+
570
591
  @staticmethod
571
592
  def E201(*args) -> None:
572
593
  ''' Error raised when the id of the node is not in the node dictionary.
@@ -769,6 +790,27 @@ own information message. Use the following structure as a standard message (I +
769
790
  message = f"E227: THE PROPERTY ID {-rep_id} IS REPEATED. ONE WILL BE SAVE WITH THE SIGN CHANGE"
770
791
  N2PLog._N2PLog__logger.error(message)
771
792
 
793
+ @staticmethod
794
+ def E228(formula, vz_msg) -> None:
795
+ ''' Error raised when the formula introduced for a new derived loadcase is wrong
796
+ '''
797
+ message = f"E228: THE FORMULA INTRODUCED TO CREATE A DERIVED LOAD CASE \"{formula}\" IS WRONG: {vz_msg}"
798
+ N2PLog._N2PLog__logger.error(message)
799
+
800
+ @staticmethod
801
+ def E229(formula, vz_msg) -> None:
802
+ ''' Error raised when the formula introduced for a new envelope loadcase is wrong
803
+ '''
804
+ message = f"E229: THE FORMULA INTRODUCED TO CREATE A ENVELOPE LOAD CASE \"{formula}\" IS WRONG: {vz_msg}"
805
+ N2PLog._N2PLog__logger.error(message)
806
+
807
+ @staticmethod
808
+ def E230(formula, vz_msg) -> None:
809
+ ''' Error raised when the formula introduced for a new derived component is wrong
810
+ '''
811
+ message = f"E230: THE FORMULA INTRODUCED TO CREATE DERIVED COMPONENT \"{formula}\" IS WRONG: {vz_msg}"
812
+ N2PLog._N2PLog__logger.error(message)
813
+
772
814
  @staticmethod
773
815
  def E300(args) -> None:
774
816
  ''' Error raised when the program fail to save the model (as a N2PModelContent object).
@@ -4,6 +4,8 @@ from NaxToModel.Classes import N2AdjacencyFunctions
4
4
  from NaxToModel.Classes import N2FreeEdges
5
5
  from NaxToModel import EnvelopGroup
6
6
  from NaxToModel import EnvelopCriteria
7
+ from NaxToModel import N2ArithmeticSolver
8
+ from NaxToModel import N2ErrorWarnningHandling
7
9
  from NaxToPy.Core.Classes.N2PLoadCase import N2PLoadCase
8
10
  from NaxToPy.Core.Classes.N2PIncrement import N2PIncrement
9
11
  from NaxToPy.Core.Classes.N2PElement import N2PElement
@@ -873,6 +875,14 @@ class N2PModelContent:
873
875
 
874
876
  Returns:
875
877
  freebody: N2PFreeBody
878
+
879
+ Example:
880
+ >>> model = load_model("model.op2")
881
+ >>> lc = model.get_load_case(5)
882
+ >>> incr = lc.ActiveN2PIncrement
883
+ >>> node_list = model.get_nodes([1000, 1001, 1002, 1003, 1004, 1005])
884
+ >>> elem_list = model.get_elements([1000, 1001, 1002, 1003, 1004])
885
+
876
886
  """
877
887
 
878
888
  if increment is None:
@@ -909,6 +919,13 @@ class N2PModelContent:
909
919
 
910
920
  Args:
911
921
  results_files: list[str, ...]
922
+
923
+ Example:
924
+ >>> model1 = load_model("model1_lc1.odb")
925
+ >>> model1.import_results_from_files(["model1_lc2.odb", "mode1l_lc3.odb"])
926
+
927
+ >>> model2 = load_model("model2.dat", "InputFileNastran")
928
+ >>> model2.import_results_from_files(["model2_lc1.op2", "model2_lc2.op2"])
912
929
  """
913
930
  if isinstance(results_files, str):
914
931
  results_files = [results_files]
@@ -930,6 +947,14 @@ class N2PModelContent:
930
947
  Args:
931
948
  cells: list[N2PElement, N2PConnector, ...]
932
949
  domain: list[N2PElement, N2PConnector, ...] -> Optional. Set the domain where to look for the adjacent elements
950
+
951
+ Returns:
952
+ list[N2PElement, N2PConnector, ...]
953
+
954
+ Example:
955
+ >>> model = load_model("model.odb")
956
+ >>> domain_S4 = [e for e in model.get_elements() if e.TypeElement == "S4"]
957
+ >>> elems_adj = model.get_elements_adjacent(model.get_elements(17500), domain=domain_S4)
933
958
  """
934
959
  if not isinstance(cells, list):
935
960
  cells = [cells]
@@ -962,6 +987,14 @@ class N2PModelContent:
962
987
  Args:
963
988
  cells: list[N2PElement, N2PConnector, ...]
964
989
  domain: list[N2PElement, N2PConnector, ...] -> Optional. Set the domain where to look for the adjacent elements
990
+
991
+ Returns:
992
+ list[N2PElement, N2PConnector, ...]
993
+
994
+ Example:
995
+ >>> model = load_model("model.h3d")
996
+ >>> domain_elems = model.get_elements()
997
+ >>> elems_att = model.get_elements_attached(model.get_elements(17500), domain=domain_elems)
965
998
  """
966
999
  if not isinstance(cells, list):
967
1000
  cells = [cells]
@@ -997,9 +1030,21 @@ class N2PModelContent:
997
1030
 
998
1031
  Args:
999
1032
  cells: list[N2PElement, N2PConnector, ...]
1033
+
1000
1034
  tolerance_angle: float -> Optional (30º by default). Max angle[º] between two elements to be considered in the same face
1035
+
1001
1036
  one_element_adjacent: bool -> Optional (True by default). If true, two elements are connected to arist of a selected element they will no be consisidered.
1037
+
1002
1038
  domain: list[N2PElement, N2PConnector, ...] -> Optional. Set the domain where to look for the adjacent elements
1039
+
1040
+ Returns:
1041
+ list[N2PElement, N2PConnector, ...]
1042
+
1043
+ Example:
1044
+ >>> model = load_model("model.op2")
1045
+ >>> elems1 = model.get_elements_by_face(model.get_elements(17500))
1046
+ >>> domain_cquad = [e for e in model.get_elements() if e.TypeElement == "CQUAD4"]
1047
+ >>> elems2 = model.get_elements_by_face(model.get_elements([17500, 17501]), 25, domain=domain_cquad)
1003
1048
  """
1004
1049
  if not isinstance(cells, list):
1005
1050
  cells = [cells]
@@ -1036,13 +1081,16 @@ class N2PModelContent:
1036
1081
  def get_free_edges(self,
1037
1082
  domain: list[N2PElement, N2PConnector, ...] = None) -> list[tuple[N2PElement, N2PNode, N2PNode], ...]:
1038
1083
 
1039
- """ Method of N2PModelContent that returns a list of tuples of N2PElement and two N2PNode of that element.
1084
+ """ Method of N2PModelContent that returns a list of tuples of a N2PElement and two N2PNode of that element.
1040
1085
  The two nodes define the edge of the element that is contained in the free edge of the mesh If a domain is selected,
1041
1086
  the tuple will only be searched in that domain. Notice that connectors, although they may be given in the domain,
1042
1087
  they are never included in the free edges.
1043
1088
 
1044
1089
  Args:
1045
- domain: list[N2PElement, N2PConnector, ...] -> Optional. Set the domain where to look for the adjacent elements
1090
+ domain: list[N2PElement, N2PConnector, ...] -> Optional. Set the domain where to look for the free edges
1091
+
1092
+ Returns:
1093
+ list[tuple[N2PElement, N2PNode, N2PNode], ...]
1046
1094
  """
1047
1095
 
1048
1096
  csharp_bool_array = System.Array.CreateInstance(System.Boolean,
@@ -1076,12 +1124,21 @@ class N2PModelContent:
1076
1124
  - formula = "0.5*<LC1:FR2>"
1077
1125
  - formula = "5*<LC2:FR3>-2*<LC3:FR3>"
1078
1126
 
1127
+ Note:
1128
+ The derived load cases will have only one frame/increment with id 0. So it is used in a formula the string
1129
+ will be "<LC-1:FR0>".
1130
+
1079
1131
  Args:
1080
1132
  name: str -> String with the name of the load case.
1081
1133
  formula: str -> String that must have the loadcase|frame is intended to use and the arithmetical opreations.
1082
1134
 
1083
1135
  Returns:
1084
1136
  N2PLoadCase -> Derived load case
1137
+
1138
+ Examples:
1139
+ >>> dev_lc1 = new_derived_loadcase("dev_lc1", "<LC1:FR1>+2*<LC2:FR1>+0.5*<LC5:FR3>")
1140
+ >>> dev_lc2 = new_derived_loadcase("dev_lc2", "0.5*<LC1:FR2>")
1141
+ >>> dev_lc3 = new_derived_loadcase("dev_lc3", "5*<LC-1:FR0>-2*<LC3:FR3>")
1085
1142
  """
1086
1143
  # Comprobamos que el nombre no se repite:
1087
1144
  i = 0
@@ -1101,6 +1158,15 @@ class N2PModelContent:
1101
1158
  # Método de N2LoadCase que pone todoo en su sitio
1102
1159
  cs_lc.RecalculateLCInfo2Formule()
1103
1160
 
1161
+ # Este metodo de N2ArithmeticSolver en NaxToModel comprueba que la formula introducida es correcta.
1162
+ # Devuelve False si está mal y True si está bien.
1163
+ err = N2ArithmeticSolver.CheckExpression(cs_lc.Formula, self.__vzmodel, N2ArithmeticSolver.ExpressionType.LOAD_CASE)
1164
+ if int(err) == 0:
1165
+ pass
1166
+ else:
1167
+ N2PLog.Error.E228(formula, str(N2ErrorWarnningHandling.GetDescription(err).upper())) # error
1168
+ return "ERROR"
1169
+
1104
1170
  # Se transforma el caso de carga de NaxToModel en un N2PLoadCase de python
1105
1171
  py_lc = N2PLoadCase(cs_lc.ID, cs_lc.IDOriginal, cs_lc.Increments, cs_lc.IncrementsNumberList, cs_lc.IsComplex,
1106
1172
  cs_lc.TypeLoadCase, cs_lc.Name, cs_lc.Results, cs_lc.SolutionType, cs_lc.Solver, self, cs_lc)
@@ -1147,6 +1213,10 @@ class N2PModelContent:
1147
1213
 
1148
1214
  Returns:
1149
1215
  N2PLoadCase
1216
+
1217
+ Examples:
1218
+ >>> env_lc1 = new_envelope_loadcase("env_lc1", formula="<LC1:FR1>,<LC2:FR1>")
1219
+ >>> env_lc2 = new_envelope_loadcase("env_lc2", formula="<LC1:FR1>,<LC2:FR8>,<LC-3:FR0>", criteria="Min", envelgroup="ByLoadCaseID")
1150
1220
  """
1151
1221
  # Comprobamos que el nombre no se repite:
1152
1222
  i = 0
@@ -1183,6 +1253,15 @@ class N2PModelContent:
1183
1253
  # Método de N2LoadCase que pone todoo en su sitio
1184
1254
  cs_lc.RecalculateLCInfo2Formule()
1185
1255
 
1256
+ # Este metodo de N2ArithmeticSolver en NaxToModel comprueba que la formula introducida es correcta.
1257
+ # Devuelve False si está mal y True si está bien.
1258
+ err = N2ArithmeticSolver.CheckExpression(cs_lc.Formula, self.__vzmodel, N2ArithmeticSolver.ExpressionType.LOAD_CASE)
1259
+ if int(err) == 0:
1260
+ pass
1261
+ else:
1262
+ N2PLog.Error.E229(formula, str(N2ErrorWarnningHandling.GetDescription(err).upper())) # error
1263
+ return "ERROR"
1264
+
1186
1265
  # Se transforma el caso de carga de NaxToModel en un N2PLoadCase de python
1187
1266
  py_lc = N2PLoadCase(cs_lc.ID, cs_lc.IDOriginal, cs_lc.Increments, cs_lc.IncrementsNumberList, cs_lc.IsComplex,
1188
1267
  cs_lc.TypeLoadCase, cs_lc.Name, cs_lc.Results, cs_lc.SolutionType, cs_lc.Solver, self, cs_lc)
@@ -1282,19 +1361,18 @@ class N2PModelContent:
1282
1361
  y=z^x.
1283
1362
 
1284
1363
  Examples:
1285
- report1 = model.new_report("<LC1:FR1>,<LC2:FR1>", False, "DISPLACEMNETS", "<X:NONE#>,<Y:NONE#>", False,
1286
- list_n2pnodes, "LC")
1364
+ >>> report1 = model.new_report("<LC1:FR1>,<LC2:FR1>", False, "DISPLACEMNETS", "<X:NONE#>,<Y:NONE#>", False, list_n2pnodes, "LC")
1287
1365
 
1288
- report2 = model.new_report("<LC1:FR1>,<LC1:FR2>,<LC4:FR6>", False, "STRESSES", "<VON_MISES:Z1#Z2#>,<MAX_SHEAR:Z1#Z2#>",
1289
- False, list_n2pelements, "IDS", aveSections=-4, coordsys=-1)
1366
+ >>> report2 = model.new_report("<LC1:FR1>,<LC1:FR2>,<LC4:FR6>", False, "STRESSES", "<VON_MISES:Z1#Z2#>,<MAX_SHEAR:Z1#Z2#>", \
1367
+ False, list_n2pelements, "IDS", aveSections=-4, coordsys=-1)
1290
1368
  """
1291
1369
  # Here it is checkd if the components, the loadcases and the result exist and the formula is right
1292
1370
  try:
1293
1371
  lcs = [int(lc.split(":")[0][3:]) for lc in lc_incr.split(",")]
1294
1372
  components = [c.split(":")[0][1:] for c in componentssections.split(",")]
1295
1373
  for lc in lcs:
1296
- all_comps = chain(self.get_load_case(lc).get_result(result).Components.keys(),
1297
- self.get_load_case(lc).get_result(result).DerivedComponents.keys())
1374
+ all_comps = list(self.get_load_case(lc).get_result(result).Components.keys()) + \
1375
+ list(self.get_load_case(lc).get_result(result).DerivedComponents.keys())
1298
1376
  if not all(c in all_comps for c in components):
1299
1377
  N2PLog.Error.E312(lc, result)
1300
1378
  return "ERROR"
@@ -1319,8 +1397,8 @@ class N2PModelContent:
1319
1397
  and the values are numpy arrays.
1320
1398
 
1321
1399
  Examples:
1322
- vonmises = .get_result_by_LCs_Incr([(1,2),(2,2)], "STRESSES", "VON_MISES")
1323
- XX = .get_result_by_LCs_Incr([(loadcase1, increment2), (loadcase2, increment2), "STRAINS", "XX"])
1400
+ >>> vonmises = N2PModelContent.get_result_by_LCs_Incr([(1,2),(2,2)], "STRESSES", "VON_MISES")
1401
+ >>> XX = N2PModelContent.get_result_by_LCs_Incr([(loadcase1, increment2), (loadcase2, increment2), "STRAINS", "XX"])
1324
1402
 
1325
1403
  Args:
1326
1404
 
@@ -1430,7 +1508,7 @@ def load_model(path: str, parallelprocessing: bool = False, file_type: str = Non
1430
1508
 
1431
1509
  Supports .op2, .xdb, .odb, .h5, .h3d and .rst file extensions read from a local filesystem or URL.
1432
1510
 
1433
- Supports Nastran input files. (Typically .bdf extension)
1511
+ Supports Nastran Input Files. (Typically .bdf extension)
1434
1512
 
1435
1513
  Args:
1436
1514
  path: str
@@ -1439,6 +1517,20 @@ def load_model(path: str, parallelprocessing: bool = False, file_type: str = Non
1439
1517
 
1440
1518
  Returns:
1441
1519
  model: N2PModelContent
1520
+
1521
+ Examples:
1522
+ >>> model1 = load_model(r"C:\MODELS\FEM\model1.dat")
1523
+
1524
+ >>> # file_type is not needed. It only helps the program and saves a checking
1525
+ >>> model2 = load_model(r"C:\MODELS\FEM\model2.dat", file_type="InputFileNastran")
1526
+
1527
+ >>> # parallelprocessing is only aviable for Binary files. It is helpful in some big files.
1528
+ >>> model3 = load_model(r"C:\MODELS\RESULTS\model1.op2", parallelprocessing=True)
1529
+
1530
+ >>> model4 = load_model(r"C:\MODELS\RESULTS\model2.xdb", file_type="Binary")
1531
+ >>> model5 = load_model(r"C:\MODELS\RESULTS\model5.h3d")
1532
+ >>> model6 = load_model(r"C:\MODELS\RESULTS\model6.odb", True, "Binary")
1533
+
1442
1534
  """
1443
1535
  if not os.path.exists(path):
1444
1536
  N2PLog.Critical.C108(path)
@@ -168,12 +168,13 @@ def compatible_vizzer(vizzer_libs: list) -> tuple[str, bool]:
168
168
  versionInfo = FileVersionInfo.GetVersionInfo(lib_path)
169
169
  assemblyVersion = versionInfo.FileVersion
170
170
 
171
- # Si la version es compatible se devuelve la ruta y un boleano indicando si es compatible
172
- if assemblyVersion in VIZZER_COMPATIBILITY:
173
- return lib_path, True
171
+ N2PLog.Debug.D200(assemblyVersion)
172
+
173
+ # Se va a suponer que la todos los steps de una version NaxTo son compatibles con todos los steps de
174
+ # una version de NaxToPy: NaxTo 2024.1.X <---> 2.0.Y
175
+ return lib_path, True
174
176
 
175
177
  N2PLog.Warning.W104(NAXTO_VERSION)
176
- # Aunque la version este bien, el assembly no. Puede que de un step a otro no haya compatibilidad.
177
178
  backup = ""
178
179
 
179
180
  # Comprobamos si hay alguna version que contenga una dll compatible
@@ -114,7 +114,7 @@ def __list_ext_libs(libs_path, solver, abq_ver) -> list[str]:
114
114
 
115
115
  # Funcion principal que usa PyInstaller para generar el .exe -----------------------------------------------------------
116
116
  def n2ptoexe(path: str, console: bool = True, solver: str = "ALL", abaqusversion: list[str] = None,
117
- splash: str="") -> None:
117
+ splash: str = "", extra_packages: list[str] = None, extra_files: list[str] = None) -> None:
118
118
  """Function that creates .exe files of programs that use NaxToPy
119
119
 
120
120
  Args:
@@ -133,6 +133,17 @@ def n2ptoexe(path: str, console: bool = True, solver: str = "ALL", abaqusversion
133
133
  splash: str -> Optional. Path to the splash image. If used, the user must introduce pyi_splash.close() at the
134
134
  beginning of the execution of the module. Import pyi_splash first. The splash image will appear during the
135
135
  .exe unpacking. Image should be png and smaller than 500x500 pixels.
136
+ extra_packages: list[str] -> If some packages are not imported correctly by the function, they can be added
137
+ manually. An example of a package that usually fails is 'sv_ttk'.
138
+ extra_files: list[str] -> Lis of path of extra dll, images or other files the user want to add the exe. The
139
+ files will be saved in the ./bin directory inside the exe. To acces to the files
140
+ use: path_file = os.path.join(sys._MEIPASS, r"bin\mylib.dll")
141
+
142
+ Examples:
143
+ >>> n2ptoexe(r"C:\Scripts\myscript1.py")
144
+ >>> n2ptoexe(r"C:\Scripts\myscript2.py", console=False, solver="NASTRAN")
145
+ >>> n2ptoexe(r"C:\Scripts\myscript3.py", console=True, solver="OPTISTRUCT", splash=r"C:\Scripts\mysplash.jpg")
146
+ >>> n2ptoexe(r"C:\Scripts\myscript4.py", extra_packages=["sv_ttk"], extra_files=[r"C:\Scripts\icon.png"])
136
147
  """
137
148
 
138
149
  # 0 ) Genera el archivo .log y añade los logs de la importación ------------------------------------------------
@@ -164,7 +175,7 @@ def n2ptoexe(path: str, console: bool = True, solver: str = "ALL", abaqusversion
164
175
  consl = "-w"
165
176
  else:
166
177
  N2PLog.Critical.C104()
167
- # sys.exit("C104: THE ARGUMENT CONSOLE MUST BE A BOOLEAN: True | False")
178
+ raise Exception()
168
179
 
169
180
 
170
181
  if __busca_n2p(path):
@@ -187,6 +198,19 @@ def n2ptoexe(path: str, console: bool = True, solver: str = "ALL", abaqusversion
187
198
  if splash:
188
199
  pyinstaller_cmd += ['--splash', splash]
189
200
 
201
+ if extra_files:
202
+ for file in extra_files:
203
+ if os.path.isfile(file):
204
+ pass
205
+ else:
206
+ N2PLog.Error.E113(file)
207
+ raise Exception()
208
+ pyinstaller_cmd += ["--add-data", f"{file};./bin"]
209
+
210
+ if extra_packages:
211
+ for package in extra_packages:
212
+ pyinstaller_cmd += ["--collect-data", package]
213
+
190
214
  PyIns.run(pyinstaller_cmd)
191
215
  N2PLog.Info.I201(os.getcwd())
192
216
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: NaxToPy
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Package for postprocessing FEM results in Python
5
5
  Home-page: https://www.idaerosolutions.com/Home/NaxToPy
6
6
  Download-URL: https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US
@@ -135,9 +135,9 @@ Requires-Dist: setuptools>=67.8.0
135
135
 
136
136
  **NaxToPy** is the [**NaxTo**](https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US)
137
137
  library designed for Python, which allows reading and manipulating FEM
138
- analysis results files from the most common tools: Nastran (op2, xdb, h5), Abaqus (odb), Optistruct
139
- (h3d, op2) and Ansys (rst); and stores them in a user-friendly Python structure. Additionally, it
140
- can read input files from Nastran (bdf, fem) and change it contents.
138
+ analysis results files from the most common tools: Nastran (.op2, .xdb, .h5), Abaqus (odb), Optistruct
139
+ (.h3d, .op2) and Ansys (.rst); and stores them in a user-friendly Python structure. Additionally, it
140
+ can read input files from Nastran (.bdf, .fem) and change their contents.
141
141
 
142
142
  It could be easily combined with other Python packages as Matplotlib or Pandas. This provides access
143
143
  to the full coding power of Python to interpret and process the results, without the need to install
@@ -147,15 +147,18 @@ links on the left).
147
147
  **NaxToPy** is a powerful tool for FEM analysis post-processing!
148
148
 
149
149
  **CAUTION:** To use NaxToPy, [**NaxTo**](https://apps.microsoft.com/detail/XP9MMH0KDKGRJN?hl=en-US&gl=US) must be installed.
150
- This version is compatible with **NaxTo 2024.1**. It may be compatible with all the steps of this version (2024.1.0, 2024.1.1, 2024.1.2, etc.).
150
+ This version is compatible with **NaxTo 2024.2**. It is compatible with all the steps of this version (2024.2.0, 2024.2.1, 2024.2.2, etc.).
151
151
  Check in _Programs and Features_ the NaxTo version that is installed.
152
152
 
153
153
  ## Installation
154
154
 
155
+ If python is installed and `pip` is added to the PATH:
155
156
 
156
- If python is callable from the command line:
157
+ `pip install NaxToPy`
158
+
159
+ An alternative, if Python is callable from the command line:
157
160
 
158
- `py -m pip install NaxToPy`
161
+ `python -m pip install NaxToPy`
159
162
 
160
163
  For **Visual Studio** users:
161
164
  - Open "Python Environments" window
@@ -179,7 +182,7 @@ same directory. When ever you want to use the NaxToPy package add the following
179
182
 
180
183
  If python is callable from the command line:
181
184
 
182
- `py -m pip install -U NaxToPy`
185
+ `python -m pip install -U NaxToPy`
183
186
 
184
187
  For Visual Studio users:
185
188
  - Open "Python Environments" window
@@ -260,6 +263,18 @@ the LoadCases that are critical or the Increment that is critical instead of the
260
263
  2. New internal methods to look for the compatibility with low-level dependencies.
261
264
  3. The name of the .log is now NaxToPy_Year-Month-Day.log.
262
265
 
266
+ ### v.2.0.1
267
+ 1. The compatibility is extended to all NaxTo steps of the same version.
268
+ 2. The property N2PLoadCase.ActiveIncrement is subtitued by N2PLoadCase.ActiveN2PIncrement.
269
+ It uses an object instaed of an int.
270
+ 3. Update of the examples of some docstrings.
271
+
272
+ ### v.2.1.0
273
+ 1. Reading a Natran Input File: SPC and SCP1 are now supported.
274
+ 2. Bug fix. The order in the components in new_report() does not affect now.
275
+ 3. Formula check in new_derived_loadcase(), new_enevelope_loadcase() and new_derived_component().
276
+ 4. New optional arguments if n2ptoexe() to add extra libaries, packages or files.
277
+
263
278
  # Documentation
264
279
 
265
280
  **NaxToPy** is a package developed by Idaero Solutions© as a part of the **NaxTo** software.
@@ -339,7 +354,7 @@ loadcaseslist = model.LoadCases
339
354
  pressure_lc = model.get_load_case("pressure")
340
355
 
341
356
  # Change the active increment (by default is the last one):
342
- pressure_lc.ActiveIncrement = 10
357
+ pressure_lc.ActiveN2PIncrement = pressure_lc.get_increment(10)
343
358
 
344
359
  # Look for all results
345
360
  all_results = pressure_lc.Results
File without changes
File without changes
File without changes
File without changes
File without changes