NaxToPy 2.0.1__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.1/src/NaxToPy.egg-info → naxtopy-2.1.0}/PKG-INFO +8 -2
  2. {naxtopy-2.0.1 → naxtopy-2.1.0}/README.md +7 -1
  3. {naxtopy-2.0.1 → naxtopy-2.1.0}/pyproject.toml +1 -1
  4. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PModelInputData.py +164 -11
  5. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PProperty.py +3 -0
  6. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PResult.py +16 -5
  7. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Constants/Constants.py +4 -4
  8. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/N2PLog.py +28 -0
  9. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/N2PModelContent.py +22 -2
  10. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PtoEXE/N2PtoEXE.py +26 -2
  11. {naxtopy-2.0.1 → naxtopy-2.1.0/src/NaxToPy.egg-info}/PKG-INFO +8 -2
  12. {naxtopy-2.0.1 → naxtopy-2.1.0}/LICENSE +0 -0
  13. {naxtopy-2.0.1 → naxtopy-2.1.0}/setup.cfg +0 -0
  14. {naxtopy-2.0.1 → naxtopy-2.1.0}/setup.py +0 -0
  15. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/AllClasses.py +0 -0
  16. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PComponent.py +0 -0
  17. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PConnector.py +0 -0
  18. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PCoord.py +0 -0
  19. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PElement.py +0 -0
  20. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PFreeBody.py +0 -0
  21. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PIncrement.py +0 -0
  22. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PLoadCase.py +0 -0
  23. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PMaterial.py +0 -0
  24. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PNode.py +0 -0
  25. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PReport.py +0 -0
  26. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PSection.py +0 -0
  27. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/N2PSet.py +0 -0
  28. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/ProgresBar.py +0 -0
  29. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Classes/__init__.py +0 -0
  30. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Constants/__init__.py +0 -0
  31. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Constants/librerias.py +0 -0
  32. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/N2PColors.py +0 -0
  33. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/N2PFileHandler.py +0 -0
  34. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Errors/__init__.py +0 -0
  35. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Reference_Finder/__Reference_Finder.py +0 -0
  36. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/Reference_Finder/__init__.py +0 -0
  37. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/_AuxFunc/_NetToPython.py +0 -0
  38. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/_AuxFunc/__init__.py +0 -0
  39. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Core/__init__.py +0 -0
  40. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Modules/Fasteners/N2PUpdateFastener.py +0 -0
  41. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Modules/Fasteners/__init__.py +0 -0
  42. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PEnvelope/N2PEnvelope.py +0 -0
  43. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PEnvelope/__init__.py +0 -0
  44. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Modules/N2PtoEXE/__init__.py +0 -0
  45. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/Modules/__init__.py +0 -0
  46. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/NaxToPy.ico +0 -0
  47. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/__init__.py +0 -0
  48. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy/user_functions.txt +0 -0
  49. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy.egg-info/SOURCES.txt +0 -0
  50. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy.egg-info/dependency_links.txt +0 -0
  51. {naxtopy-2.0.1 → naxtopy-2.1.0}/src/NaxToPy.egg-info/requires.txt +0 -0
  52. {naxtopy-2.0.1 → 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.1
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
@@ -147,7 +147,7 @@ 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 is 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
@@ -269,6 +269,12 @@ the LoadCases that are critical or the Increment that is critical instead of the
269
269
  It uses an object instaed of an int.
270
270
  3. Update of the examples of some docstrings.
271
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
+
272
278
  # Documentation
273
279
 
274
280
  **NaxToPy** is a package developed by Idaero Solutions© as a part of the **NaxTo** software.
@@ -23,7 +23,7 @@ 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 is 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
@@ -145,6 +145,12 @@ the LoadCases that are critical or the Increment that is critical instead of the
145
145
  It uses an object instaed of an int.
146
146
  3. Update of the examples of some docstrings.
147
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
+
148
154
  # Documentation
149
155
 
150
156
  **NaxToPy** is a package developed by Idaero Solutions© as a part of the **NaxTo** software.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "NaxToPy"
7
- version = "2.0.1"
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"
@@ -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.1"
4
+ VERSION = "2.1.0"
5
5
 
6
6
  # Supported for Naxto:
7
- NAXTO_VERSION = '2024R1'
8
- NAXTO_STEP = "2"
7
+ NAXTO_VERSION = '2024R2'
8
+ NAXTO_STEP = "0"
9
9
 
10
10
  # Assembly version of NaxToModel.dll
11
- VIZZER_COMPATIBILITY = ("4.1.0.0", "4.1.0.1", "4.1.0.2")
11
+ VIZZER_COMPATIBILITY = ("4.2.0.0")
12
12
  """Tuple with the compatible versions of NaxToModel.dll"""
13
13
 
14
14
  # PYTHON EXTERNO ----------------------------------------------------------------------------------
@@ -581,6 +581,13 @@ own information message. Use the following structure as a standard message (I +
581
581
  message = f"E112: THE WINDOWS REGISTER COULDN'T BE MODIFIED. ERROR: {er}"
582
582
  N2PLog._N2PLog__logger.error(message)
583
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
+
584
591
  @staticmethod
585
592
  def E201(*args) -> None:
586
593
  ''' Error raised when the id of the node is not in the node dictionary.
@@ -783,6 +790,27 @@ own information message. Use the following structure as a standard message (I +
783
790
  message = f"E227: THE PROPERTY ID {-rep_id} IS REPEATED. ONE WILL BE SAVE WITH THE SIGN CHANGE"
784
791
  N2PLog._N2PLog__logger.error(message)
785
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
+
786
814
  @staticmethod
787
815
  def E300(args) -> None:
788
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
@@ -1156,6 +1158,15 @@ class N2PModelContent:
1156
1158
  # Método de N2LoadCase que pone todoo en su sitio
1157
1159
  cs_lc.RecalculateLCInfo2Formule()
1158
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
+
1159
1170
  # Se transforma el caso de carga de NaxToModel en un N2PLoadCase de python
1160
1171
  py_lc = N2PLoadCase(cs_lc.ID, cs_lc.IDOriginal, cs_lc.Increments, cs_lc.IncrementsNumberList, cs_lc.IsComplex,
1161
1172
  cs_lc.TypeLoadCase, cs_lc.Name, cs_lc.Results, cs_lc.SolutionType, cs_lc.Solver, self, cs_lc)
@@ -1242,6 +1253,15 @@ class N2PModelContent:
1242
1253
  # Método de N2LoadCase que pone todoo en su sitio
1243
1254
  cs_lc.RecalculateLCInfo2Formule()
1244
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
+
1245
1265
  # Se transforma el caso de carga de NaxToModel en un N2PLoadCase de python
1246
1266
  py_lc = N2PLoadCase(cs_lc.ID, cs_lc.IDOriginal, cs_lc.Increments, cs_lc.IncrementsNumberList, cs_lc.IsComplex,
1247
1267
  cs_lc.TypeLoadCase, cs_lc.Name, cs_lc.Results, cs_lc.SolutionType, cs_lc.Solver, self, cs_lc)
@@ -1351,8 +1371,8 @@ class N2PModelContent:
1351
1371
  lcs = [int(lc.split(":")[0][3:]) for lc in lc_incr.split(",")]
1352
1372
  components = [c.split(":")[0][1:] for c in componentssections.split(",")]
1353
1373
  for lc in lcs:
1354
- all_comps = chain(self.get_load_case(lc).get_result(result).Components.keys(),
1355
- 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())
1356
1376
  if not all(c in all_comps for c in components):
1357
1377
  N2PLog.Error.E312(lc, result)
1358
1378
  return "ERROR"
@@ -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.1
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
@@ -147,7 +147,7 @@ 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 is 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
@@ -269,6 +269,12 @@ the LoadCases that are critical or the Increment that is critical instead of the
269
269
  It uses an object instaed of an int.
270
270
  3. Update of the examples of some docstrings.
271
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
+
272
278
  # Documentation
273
279
 
274
280
  **NaxToPy** is a package developed by Idaero Solutions© as a part of the **NaxTo** software.
File without changes
File without changes
File without changes
File without changes
File without changes