FEM-Design 0.0.6__tar.gz → 0.0.7__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.
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: FEM-Design
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: The FEM-Design API package
5
5
  Author-email: FEM-Design <femdesign.api@strusoft.com>
6
6
  Maintainer-email: Marco Pellegrino <marco.pellegrino@strusoft.com>, Illyés Zoltán <sinnach@strusoft.hu>
7
7
  Project-URL: Homepage, https://femdesign-api-docs.onstrusoft.com
8
- Project-URL: Repository, https://github.com/strusoft/femdesign-api
8
+ Project-URL: Repository, https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python
9
9
  Project-URL: Issues, https://github.com/strusoft/femdesign-api/issues
10
10
  Keywords: fem,fea,structures,strusoft,FEM-Design API
11
11
  Classifier: Programming Language :: Python :: 3
@@ -61,9 +61,8 @@ except Exception as err:
61
61
  raise err
62
62
  ```
63
63
 
64
- A wider list of examples can be found in [example](https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python/examples)
64
+ A wider list of examples can be found in [example](https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Examples/Python)
65
65
 
66
66
  ## Documentation
67
67
 
68
-
69
68
  https://femdesign-api-docs.onstrusoft.com/docs/intro
@@ -44,9 +44,8 @@ except Exception as err:
44
44
  raise err
45
45
  ```
46
46
 
47
- A wider list of examples can be found in [example](https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python/examples)
47
+ A wider list of examples can be found in [example](https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Examples/Python)
48
48
 
49
49
  ## Documentation
50
50
 
51
-
52
51
  https://femdesign-api-docs.onstrusoft.com/docs/intro
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "FEM-Design"
3
- version = "0.0.6"
3
+ version = "0.0.7"
4
4
  authors = [
5
5
  { name="FEM-Design", email="femdesign.api@strusoft.com" },
6
6
  ]
@@ -20,5 +20,5 @@ keywords = ["fem", "fea", "structures", "strusoft", "FEM-Design API"]
20
20
 
21
21
  [project.urls]
22
22
  Homepage = "https://femdesign-api-docs.onstrusoft.com"
23
- Repository = "https://github.com/strusoft/femdesign-api"
23
+ Repository = "https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python"
24
24
  Issues = "https://github.com/strusoft/femdesign-api/issues"
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: FEM-Design
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: The FEM-Design API package
5
5
  Author-email: FEM-Design <femdesign.api@strusoft.com>
6
6
  Maintainer-email: Marco Pellegrino <marco.pellegrino@strusoft.com>, Illyés Zoltán <sinnach@strusoft.hu>
7
7
  Project-URL: Homepage, https://femdesign-api-docs.onstrusoft.com
8
- Project-URL: Repository, https://github.com/strusoft/femdesign-api
8
+ Project-URL: Repository, https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python
9
9
  Project-URL: Issues, https://github.com/strusoft/femdesign-api/issues
10
10
  Keywords: fem,fea,structures,strusoft,FEM-Design API
11
11
  Classifier: Programming Language :: Python :: 3
@@ -61,9 +61,8 @@ except Exception as err:
61
61
  raise err
62
62
  ```
63
63
 
64
- A wider list of examples can be found in [example](https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Python/examples)
64
+ A wider list of examples can be found in [example](https://github.com/strusoft/femdesign-api/tree/master/FemDesign.Examples/Python)
65
65
 
66
66
  ## Documentation
67
67
 
68
-
69
68
  https://femdesign-api-docs.onstrusoft.com/docs/intro
@@ -0,0 +1 @@
1
+ __version__ = "0.0.7"
@@ -383,6 +383,30 @@ class CmdSaveDocx(Command):
383
383
  return cmd_save_docx
384
384
 
385
385
 
386
+ class CmdChild(Command):
387
+ """class to represent the fdscript cmdsavedocx command
388
+ """
389
+ def __init__(self, file_name : str):
390
+ """Constructor for the CmdChild class
391
+
392
+ Args:
393
+ file_name (str): path to the file to save
394
+ """
395
+ if not file_name.endswith(".dsc"):
396
+ raise ValueError("file_name must have suffix .dsc")
397
+
398
+ self.file_name = os.path.abspath(file_name)
399
+
400
+ def to_xml_element(self) -> ET.Element:
401
+ """Convert the CmdChild object to an xml element
402
+
403
+ Returns:
404
+ ET.Element: xml element representing the CmdChild object
405
+ """
406
+ cmd_child = ET.Element("cmdchild")
407
+ cmd_child.text = self.file_name
408
+
409
+ return cmd_child
386
410
 
387
411
 
388
412
  class CmdListGen:
@@ -442,4 +466,71 @@ class CmdListGen:
442
466
  guid_elem = ET.SubElement(cmd_listgen, "GUID")
443
467
  guid_elem.text = str(guid)
444
468
 
445
- return cmd_listgen
469
+ return cmd_listgen
470
+
471
+ class CmdConfig(Command):
472
+ """class to represent the fdscript cmdconfig command
473
+ """
474
+ def __init__(self, file_name : str):
475
+ """Constructor for the CmdConfig class
476
+
477
+ Args:
478
+ file_name (str): path to the config file
479
+ """
480
+ if not file_name.endswith(".xml"):
481
+ raise ValueError("file_name must have suffix .xml")
482
+
483
+ self.file_name = os.path.abspath(file_name)
484
+
485
+ def to_xml_element(self) -> ET.Element:
486
+ """Convert the CmdConfig object to an xml element
487
+
488
+ Returns:
489
+ ET.Element: xml element representing the CmdConfig object
490
+ """
491
+ cmd_config = ET.Element("cmdconfig")
492
+
493
+ attributes = {
494
+ "command": "$ MODULECOM APPLYCFG",
495
+ "file": self.file_name
496
+ }
497
+ cmd_config.attrib = attributes
498
+
499
+ return cmd_config
500
+
501
+ # <cmdinteractionsurface command="$ CODE_COM INTERACTIONSURFACE" guid="2e290437-e86a-4e36-af7d-acde6a6146c8" offset="0.0" fUlt="false" outfile="e:\res\a.txt" />
502
+ class CmdInteractionSurface(Command):
503
+ """class to represent the fdscript cmdinteraction surface command
504
+ """
505
+ def __init__(self, guid : uuid.UUID, outfile : str, offset : float = 0.0, fUlt : bool = False):
506
+ """Constructor for the CmdInteractionSurface class
507
+
508
+ Args:
509
+ guid (uuid.UUID): guid of an existing bar. make sure you pass the analytical bar!
510
+ outfile (str): path to the output file
511
+ offset (float): offset is cross-section position, measured along the bar from the starting point [m]
512
+ fUlt (bool): fUlt is true for Ultimate, false for Accidental or Seismic combination (different gammaC)
513
+ """
514
+ self.guid = guid
515
+ self.offset = offset
516
+ self.fUlt = fUlt
517
+ self.outfile = os.path.abspath(outfile)
518
+
519
+ def to_xml_element(self) -> ET.Element:
520
+ """Convert the CmdInteractionSurface object to an xml element
521
+
522
+ Returns:
523
+ ET.Element: xml element representing the CmdInteractionSurface object
524
+ """
525
+ cmd_interaction_surface = ET.Element("cmdinteractionsurface")
526
+
527
+ attributes = {
528
+ "command": "$ CODE_COM INTERACTIONSURFACE",
529
+ "guid": str(self.guid),
530
+ "offset": str(self.offset),
531
+ "fUlt": str(self.fUlt).lower(),
532
+ "outfile": self.outfile
533
+ }
534
+ cmd_interaction_surface.attrib = attributes
535
+
536
+ return cmd_interaction_surface
@@ -12,6 +12,9 @@ class FdscriptHeader:
12
12
  self.version = str(version)
13
13
  self.module = module
14
14
  self.logfile = os.path.abspath(log_file)
15
+
16
+ self.continue_on_error = True
17
+ self.ignore_Parse_error = True
15
18
 
16
19
 
17
20
  def to_xml_element(self) -> ET.Element:
@@ -21,7 +24,7 @@ class FdscriptHeader:
21
24
  ET.Element: xml element representing the FdscriptHeader object
22
25
  """
23
26
  fdscript_header = ET.Element("fdscriptheader")
24
-
27
+
25
28
  title_elem = ET.SubElement(fdscript_header, "title")
26
29
  title_elem.text = self.title
27
30
 
@@ -34,6 +37,13 @@ class FdscriptHeader:
34
37
  logfile_elem = ET.SubElement(fdscript_header, "logfile")
35
38
  logfile_elem.text = self.logfile
36
39
 
40
+ ## add attributes
41
+ attributes = {
42
+ "fContinueOnError" : int(self.continue_on_error).__str__(),
43
+ "fIgnoreParseError" : int(self.ignore_Parse_error).__str__()
44
+ }
45
+
46
+ fdscript_header.attrib = attributes
37
47
 
38
48
  return fdscript_header
39
49
 
@@ -74,7 +84,7 @@ class Fdscript:
74
84
  fdscript.append(command.to_xml_element())
75
85
 
76
86
  return fdscript
77
-
87
+
78
88
  def serialise_to_file(self, file_name : str):
79
89
  """Serialise the Fdscript object to a file
80
90
 
@@ -6,7 +6,7 @@ from enum import Enum
6
6
  from femdesign.calculate.analysis import Analysis, Design
7
7
  from femdesign.calculate.fdscript import Fdscript
8
8
  from femdesign.utilities.filehelper import OutputFileHelper
9
- from femdesign.calculate.command import DesignModule, CmdUser, CmdCalculation, CmdListGen, CmdOpen, CmdProjDescr, CmdSave
9
+ from femdesign.calculate.command import *
10
10
 
11
11
  import win32file
12
12
  import win32pipe
@@ -14,6 +14,8 @@ import win32pipe
14
14
  import os
15
15
  import shutil
16
16
 
17
+ import uuid
18
+
17
19
  """
18
20
  FEM - Design usage with pipe
19
21
 
@@ -294,9 +296,6 @@ class Verbosity(Enum):
294
296
  PROGRESS_WINDOW_TITLE = 32
295
297
 
296
298
 
297
- ## define a private class
298
-
299
-
300
299
  class FemDesignConnection(_FdConnect):
301
300
  def __init__(self,
302
301
  fd_path : str = r"C:\Program Files\StruSoft\FEM-Design 23\fd3dstruct.exe",
@@ -338,7 +337,6 @@ class FemDesignConnection(_FdConnect):
338
337
  self._output_dir = os.path.abspath(value)
339
338
  if not os.path.exists(value):
340
339
  os.makedirs(os.path.abspath(value))
341
-
342
340
 
343
341
  def RunScript(self, fdscript : Fdscript, file_name : str = "script"):
344
342
  """
@@ -440,7 +438,7 @@ class FemDesignConnection(_FdConnect):
440
438
  log = OutputFileHelper.GetLogFilePath(self.output_dir)
441
439
 
442
440
  if not file_name.endswith(".struxml") and not file_name.endswith(".str"):
443
- raise ValueError(f"File {file_name} must have extension .struxml or .str")
441
+ raise ValueError(f"file_name must have extension .struxml or .str")
444
442
  if not os.path.exists(file_name):
445
443
  raise FileNotFoundError(f"File {file_name} not found")
446
444
 
@@ -458,11 +456,86 @@ class FemDesignConnection(_FdConnect):
458
456
  fdscript = Fdscript(log, [cmd_results])
459
457
  self.RunScript(fdscript, "generate_list_tables")
460
458
 
459
+ def SaveDocx(self, file_name : str, template_file : str = None):
460
+ """Save the project as docx
461
+
462
+ Args:
463
+ file_name (str): name of the file to save
464
+
465
+ Examples
466
+ --------
467
+ >>> pipe = FemDesignConnection()
468
+ >>> pipe.SaveDocx(r"outputFile.docx")
469
+ """
470
+ log = OutputFileHelper.GetLogFilePath(self.output_dir)
471
+
472
+
473
+ if template_file:
474
+ self.ApplyDocumentationTemplate(template_file)
475
+
476
+ cmd_save_docx = CmdSaveDocx(file_name)
477
+
478
+
479
+ fdscript = Fdscript(log, [cmd_save_docx])
480
+ self.RunScript(fdscript, "save_docx")
481
+
482
+ def ApplyDocumentationTemplate(self, template_file : str):
483
+ """Apply documentation template
484
+
485
+ Args:
486
+ template_file (str): template file path
487
+ """
488
+ log = OutputFileHelper.GetLogFilePath(self.output_dir)
489
+
490
+ cmd_child = CmdChild(template_file)
491
+ fdscript = Fdscript(log, [cmd_child])
492
+ self.RunScript(fdscript, "apply_documentation_template")
493
+
494
+ def GenerateInteractionSurface(self, guid : uuid.UUID, outfile : str, offset : float = 0.0, fUlt : bool = True):
495
+ """Generate interaction surface
496
+
497
+ Args:
498
+ guid (uuid.UUID): guid of an existing bar. make sure you pass the analytical bar!
499
+ outfile (str): path to the output file
500
+ offset (float): offset is cross-section position, measured along the bar from the starting point [m]
501
+ fUlt (bool): fUlt is true for Ultimate, false for Accidental or Seismic combination (different gammaC)
502
+ """
503
+ log = OutputFileHelper.GetLogFilePath(self.output_dir)
504
+
505
+ cmd_interaction_surface = CmdInteractionSurface(guid, outfile, offset, fUlt)
506
+ fdscript = Fdscript(log, [cmd_interaction_surface])
507
+ self.RunScript(fdscript, "generate_interaction_surface")
508
+
509
+ def SetDesignParameters(self, file_path : str):
510
+ """Set design parameters
511
+
512
+ Args:
513
+ file_path (str): path to the file
514
+ """
515
+ log = OutputFileHelper.GetLogFilePath(self.output_dir)
516
+
517
+ cmd_design_parameters = CmdConfig(file_path)
518
+ fdscript = Fdscript(log, [cmd_design_parameters])
519
+ self.RunScript(fdscript, "set_design_parameters")
461
520
 
462
521
  ## it does not work
463
- def Disconnect(self):
522
+ # def DumpDesignParameters(self, file_path : str):
523
+ # """Dump calculation and design parameters
524
+
525
+ # Args:
526
+ # file_path (str): xml file path where the design and calculation parameters will be dumped
527
+ # """
528
+ # if not file_path.endswith(".xml"):
529
+ # raise ValueError("file_name must have suffix .xml")
530
+
531
+ # file_path = os.path.abspath(file_path)
532
+ # message = f"; CXL MODULECOM WXMLCFG:{file_path}"
533
+ # self.Send(message)
534
+
535
+ # ## it does not work
536
+ # def Disconnect(self):
464
537
  super().Detach()
465
538
  win32pipe.DisconnectNamedPipe(self.pipe_send)
466
539
 
467
540
  def Close(self):
468
- self.__exit__()
541
+ self.__exit__()
@@ -1 +0,0 @@
1
- version = "0.0.6"
File without changes
File without changes