midas-civil 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl
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.
Potentially problematic release.
This version of midas-civil might be problematic. Click here for more details.
- midas_civil/_construction.py +565 -1
- midas_civil/_load.py +2 -0
- midas_civil/_mapi.py +57 -11
- midas_civil/_temperature.py +30 -0
- {midas_civil-0.1.6.dist-info → midas_civil-0.1.8.dist-info}/METADATA +1 -1
- {midas_civil-0.1.6.dist-info → midas_civil-0.1.8.dist-info}/RECORD +9 -9
- {midas_civil-0.1.6.dist-info → midas_civil-0.1.8.dist-info}/WHEEL +0 -0
- {midas_civil-0.1.6.dist-info → midas_civil-0.1.8.dist-info}/licenses/LICENSE +0 -0
- {midas_civil-0.1.6.dist-info → midas_civil-0.1.8.dist-info}/top_level.txt +0 -0
midas_civil/_construction.py
CHANGED
|
@@ -416,4 +416,568 @@ class CS:
|
|
|
416
416
|
def delete(cls):
|
|
417
417
|
"""Deletes all construction stages from the database and resets the class"""
|
|
418
418
|
cls.stages = []
|
|
419
|
-
return MidasAPI("DELETE", "/db/stag")
|
|
419
|
+
return MidasAPI("DELETE", "/db/stag")
|
|
420
|
+
|
|
421
|
+
#-----------------------------------------------------------Comp Section for CS--------------------------------------------------------------
|
|
422
|
+
|
|
423
|
+
class CompSec:
|
|
424
|
+
compsecs = []
|
|
425
|
+
|
|
426
|
+
def __init__(self,
|
|
427
|
+
activation_stage: str,
|
|
428
|
+
section_id: int,
|
|
429
|
+
comp_type: str = "GENERAL",
|
|
430
|
+
tapered_type: bool = False,
|
|
431
|
+
partinfo: list = None,
|
|
432
|
+
id: int = None):
|
|
433
|
+
"""
|
|
434
|
+
Parameters:
|
|
435
|
+
activation_stage: Active Stage name (required)
|
|
436
|
+
section_id: Section ID (required)
|
|
437
|
+
comp_type: Composite Type - "GENERAL" or "USER" (default "GENERAL")
|
|
438
|
+
tapered_type: Tapered Type - True or False (default False)
|
|
439
|
+
partinfo: List of part information lists (required)
|
|
440
|
+
id: The composite section ID (optional)
|
|
441
|
+
|
|
442
|
+
Part Info Format:
|
|
443
|
+
Each part should be a list with elements in order:
|
|
444
|
+
[part_number, material_type, material_id, composite_stage, age,
|
|
445
|
+
height, volume_surface_ratio, module_exposed_surface, area,
|
|
446
|
+
asy, asz, ixx, iyy, izz, warea, iw]
|
|
447
|
+
|
|
448
|
+
- part_number: Integer (required)
|
|
449
|
+
- material_type: "ELEM" or "MATL" (required)
|
|
450
|
+
- material_id: String (optional, blank for ELEM)
|
|
451
|
+
- composite_stage: String (optional, blank for active stage)
|
|
452
|
+
- age: Number (default 0)
|
|
453
|
+
- height: Number (default AUTO)
|
|
454
|
+
- volume_surface_ratio: Number (default 0)
|
|
455
|
+
- module_exposed_surface: Number (default 0)
|
|
456
|
+
- area: Number (default 1)
|
|
457
|
+
- asy: Number (default 1)
|
|
458
|
+
- asz: Number (default 1)
|
|
459
|
+
- ixx: Number (default 1)
|
|
460
|
+
- iyy: Number (default 1)
|
|
461
|
+
- izz: Number (default 1)
|
|
462
|
+
- warea: Number (default 1)
|
|
463
|
+
- iw: Number (default 1)
|
|
464
|
+
|
|
465
|
+
Examples:
|
|
466
|
+
```python
|
|
467
|
+
# Basic composite section
|
|
468
|
+
CompSec("CS1", 1, "GENERAL", False, [
|
|
469
|
+
[1, "ELEM", "", "", 2, 1.5, 1.5, 1, 1, 1, 1, 1, 1, 1, 1, 1],
|
|
470
|
+
[2, "MATL", "3", "CS2", 5, 0.245, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1]
|
|
471
|
+
])
|
|
472
|
+
|
|
473
|
+
# With minimal part info (using defaults)
|
|
474
|
+
CompSec("CS1", 2, "GENERAL", False, [
|
|
475
|
+
[1, "ELEM"],
|
|
476
|
+
[2, "MATL", "2","CS2"]
|
|
477
|
+
])
|
|
478
|
+
```
|
|
479
|
+
"""
|
|
480
|
+
|
|
481
|
+
self.ASTAGE = activation_stage
|
|
482
|
+
self.SEC = section_id
|
|
483
|
+
self.TYPE = comp_type
|
|
484
|
+
self.bTAP = tapered_type
|
|
485
|
+
|
|
486
|
+
# Set ID
|
|
487
|
+
if id is None:
|
|
488
|
+
self.ID = len(CS.CompSec.compsecs) + 1
|
|
489
|
+
else:
|
|
490
|
+
self.ID = id
|
|
491
|
+
|
|
492
|
+
# Process part information
|
|
493
|
+
self.vPARTINFO = []
|
|
494
|
+
|
|
495
|
+
if partinfo is None:
|
|
496
|
+
raise ValueError("Part information is required")
|
|
497
|
+
|
|
498
|
+
if not isinstance(partinfo, list):
|
|
499
|
+
raise ValueError("Part information must be a list of lists")
|
|
500
|
+
|
|
501
|
+
for part_data in partinfo:
|
|
502
|
+
if not isinstance(part_data, list) or len(part_data) < 2:
|
|
503
|
+
raise ValueError("Each part must be a list with at least part number and material type")
|
|
504
|
+
|
|
505
|
+
# Default values for part info
|
|
506
|
+
defaults = [
|
|
507
|
+
None, # PART (required)
|
|
508
|
+
None, # MTYPE (required)
|
|
509
|
+
"", # MAT
|
|
510
|
+
"", # CSTAGE
|
|
511
|
+
0, # AGE
|
|
512
|
+
"AUTO", # PARTINFO_H
|
|
513
|
+
0, # PARTINFO_VS
|
|
514
|
+
0, # PARTINFO_M
|
|
515
|
+
1, # AREA
|
|
516
|
+
1, # ASY
|
|
517
|
+
1, # ASZ
|
|
518
|
+
1, # IXX
|
|
519
|
+
1, # IYY
|
|
520
|
+
1, # IZZ
|
|
521
|
+
1, # WAREA
|
|
522
|
+
1 # IW
|
|
523
|
+
]
|
|
524
|
+
|
|
525
|
+
# Fill in provided values
|
|
526
|
+
for i, value in enumerate(part_data):
|
|
527
|
+
if i < len(defaults):
|
|
528
|
+
defaults[i] = value
|
|
529
|
+
|
|
530
|
+
# Validate required fields
|
|
531
|
+
if defaults[0] is None:
|
|
532
|
+
raise ValueError("Part number is required")
|
|
533
|
+
if defaults[1] is None:
|
|
534
|
+
raise ValueError("Material type is required")
|
|
535
|
+
if defaults[1] not in ["ELEM", "MATL"]:
|
|
536
|
+
raise ValueError("Material type must be 'ELEM' or 'MATL'")
|
|
537
|
+
|
|
538
|
+
# Create part info dictionary
|
|
539
|
+
part_info = {
|
|
540
|
+
"PART": defaults[0],
|
|
541
|
+
"MTYPE": defaults[1],
|
|
542
|
+
"MAT": defaults[2],
|
|
543
|
+
"CSTAGE": defaults[3],
|
|
544
|
+
"AGE": defaults[4],
|
|
545
|
+
"PARTINFO_H": defaults[5],
|
|
546
|
+
"PARTINFO_VS": defaults[6],
|
|
547
|
+
"PARTINFO_M": defaults[7],
|
|
548
|
+
"AREA": defaults[8],
|
|
549
|
+
"ASY": defaults[9],
|
|
550
|
+
"ASZ": defaults[10],
|
|
551
|
+
"IXX": defaults[11],
|
|
552
|
+
"IYY": defaults[12],
|
|
553
|
+
"IZZ": defaults[13],
|
|
554
|
+
"WAREA": defaults[14],
|
|
555
|
+
"IW": defaults[15]
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
self.vPARTINFO.append(part_info)
|
|
559
|
+
|
|
560
|
+
CS.CompSec.compsecs.append(self)
|
|
561
|
+
|
|
562
|
+
@classmethod
|
|
563
|
+
def json(cls):
|
|
564
|
+
"""
|
|
565
|
+
Converts Composite Section data to JSON format
|
|
566
|
+
Example:
|
|
567
|
+
# Get the JSON data for all composite sections
|
|
568
|
+
json_data = CS.CompSec.json()
|
|
569
|
+
print(json_data)
|
|
570
|
+
"""
|
|
571
|
+
json_data = {"Assign": {}}
|
|
572
|
+
|
|
573
|
+
for compsec in cls.compsecs:
|
|
574
|
+
section_data = {
|
|
575
|
+
"SEC": compsec.SEC,
|
|
576
|
+
"ASTAGE": compsec.ASTAGE,
|
|
577
|
+
"TYPE": compsec.TYPE,
|
|
578
|
+
"bTAP": compsec.bTAP,
|
|
579
|
+
"vPARTINFO": compsec.vPARTINFO
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
json_data["Assign"][str(compsec.ID)] = section_data
|
|
583
|
+
|
|
584
|
+
return json_data
|
|
585
|
+
|
|
586
|
+
@classmethod
|
|
587
|
+
def create(cls):
|
|
588
|
+
"""Creates composite sections in the database"""
|
|
589
|
+
return MidasAPI("PUT", "/db/cscs", cls.json())
|
|
590
|
+
|
|
591
|
+
@classmethod
|
|
592
|
+
def get(cls):
|
|
593
|
+
"""Gets composite section data from the database"""
|
|
594
|
+
return MidasAPI("GET", "/db/cscs")
|
|
595
|
+
|
|
596
|
+
@classmethod
|
|
597
|
+
def sync(cls):
|
|
598
|
+
"""Updates the CompSec class with data from the database"""
|
|
599
|
+
cls.compsecs = []
|
|
600
|
+
response = cls.get()
|
|
601
|
+
|
|
602
|
+
if response != {'message': ''}:
|
|
603
|
+
if "CSCS" in response:
|
|
604
|
+
cscs_data_dict = response["CSCS"]
|
|
605
|
+
else:
|
|
606
|
+
return
|
|
607
|
+
|
|
608
|
+
for cscs_id, cscs_data in cscs_data_dict.items():
|
|
609
|
+
# Basic section data
|
|
610
|
+
astage = cscs_data.get("ASTAGE")
|
|
611
|
+
sec = cscs_data.get("SEC")
|
|
612
|
+
comp_type = cscs_data.get("TYPE", "GENERAL")
|
|
613
|
+
tapered_type = cscs_data.get("bTAP", False)
|
|
614
|
+
partinfo_data = cscs_data.get("vPARTINFO", [])
|
|
615
|
+
|
|
616
|
+
# Convert partinfo from dict format to list format
|
|
617
|
+
partinfo = []
|
|
618
|
+
for part in partinfo_data:
|
|
619
|
+
part_list = [
|
|
620
|
+
part.get("PART"),
|
|
621
|
+
part.get("MTYPE"),
|
|
622
|
+
part.get("MAT", ""),
|
|
623
|
+
part.get("CSTAGE", ""),
|
|
624
|
+
part.get("AGE", 0),
|
|
625
|
+
part.get("PARTINFO_H", "AUTO"),
|
|
626
|
+
part.get("PARTINFO_VS", 0),
|
|
627
|
+
part.get("PARTINFO_M", 0),
|
|
628
|
+
part.get("AREA", 1),
|
|
629
|
+
part.get("ASY", 1),
|
|
630
|
+
part.get("ASZ", 1),
|
|
631
|
+
part.get("IXX", 1),
|
|
632
|
+
part.get("IYY", 1),
|
|
633
|
+
part.get("IZZ", 1),
|
|
634
|
+
part.get("WAREA", 1),
|
|
635
|
+
part.get("IW", 1)
|
|
636
|
+
]
|
|
637
|
+
partinfo.append(part_list)
|
|
638
|
+
|
|
639
|
+
# Create a new CompSec object
|
|
640
|
+
new_compsec = CS.CompSec(
|
|
641
|
+
activation_stage=astage,
|
|
642
|
+
section_id=sec,
|
|
643
|
+
comp_type=comp_type,
|
|
644
|
+
tapered_type=tapered_type,
|
|
645
|
+
partinfo=partinfo,
|
|
646
|
+
id=int(cscs_id)
|
|
647
|
+
)
|
|
648
|
+
|
|
649
|
+
# Remove the automatically added instance and replace with synced data
|
|
650
|
+
CS.CompSec.compsecs.pop()
|
|
651
|
+
CS.CompSec.compsecs.append(new_compsec)
|
|
652
|
+
|
|
653
|
+
@classmethod
|
|
654
|
+
def delete(cls):
|
|
655
|
+
"""Deletes all composite sections from the database and resets the class"""
|
|
656
|
+
cls.compsecs = []
|
|
657
|
+
return MidasAPI("DELETE", "/db/cscs")
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
#-----------------------------------------------------------------------------------------------------------------------------------
|
|
661
|
+
|
|
662
|
+
class TimeLoads:
|
|
663
|
+
timeloads = []
|
|
664
|
+
|
|
665
|
+
def __init__(self,
|
|
666
|
+
element_id: int,
|
|
667
|
+
day: int,
|
|
668
|
+
group: str = "",
|
|
669
|
+
id: int = None):
|
|
670
|
+
"""
|
|
671
|
+
Time Loads for Construction Stage define.
|
|
672
|
+
|
|
673
|
+
Parameters:
|
|
674
|
+
element_id: Element ID (required)
|
|
675
|
+
day: Time Loads in days (required)
|
|
676
|
+
group: Load Group Name (optional, default blank)
|
|
677
|
+
id: The time loads ID (optional)
|
|
678
|
+
|
|
679
|
+
Examples:
|
|
680
|
+
```python
|
|
681
|
+
CS.TimeLoads(10, 35, "DL")
|
|
682
|
+
```
|
|
683
|
+
"""
|
|
684
|
+
|
|
685
|
+
self.ELEMENT_ID = element_id
|
|
686
|
+
self.DAY = day
|
|
687
|
+
self.GROUP_NAME = group
|
|
688
|
+
|
|
689
|
+
# Set ID
|
|
690
|
+
if id is None:
|
|
691
|
+
self.ID = len(CS.TimeLoads.timeloads) + 1
|
|
692
|
+
else:
|
|
693
|
+
self.ID = id
|
|
694
|
+
|
|
695
|
+
CS.TimeLoads.timeloads.append(self)
|
|
696
|
+
|
|
697
|
+
@classmethod
|
|
698
|
+
def json(cls):
|
|
699
|
+
"""
|
|
700
|
+
Converts Time Loads data to JSON format
|
|
701
|
+
Example:
|
|
702
|
+
# Get the JSON data for all time loads
|
|
703
|
+
json_data = CS.TimeLoads.json()
|
|
704
|
+
print(json_data)
|
|
705
|
+
"""
|
|
706
|
+
json_data = {"Assign": {}}
|
|
707
|
+
|
|
708
|
+
for timeload in cls.timeloads:
|
|
709
|
+
items_data = {
|
|
710
|
+
"ITEMS": [
|
|
711
|
+
{
|
|
712
|
+
"ID": 1,
|
|
713
|
+
"GROUP_NAME": timeload.GROUP_NAME,
|
|
714
|
+
"DAY": timeload.DAY
|
|
715
|
+
}
|
|
716
|
+
]
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
json_data["Assign"][str(timeload.ELEMENT_ID)] = items_data
|
|
720
|
+
|
|
721
|
+
return json_data
|
|
722
|
+
|
|
723
|
+
@classmethod
|
|
724
|
+
def create(cls):
|
|
725
|
+
"""Creates time loads in the database"""
|
|
726
|
+
return MidasAPI("PUT", "/db/tmld", cls.json())
|
|
727
|
+
|
|
728
|
+
@classmethod
|
|
729
|
+
def get(cls):
|
|
730
|
+
"""Gets time loads data from the database"""
|
|
731
|
+
return MidasAPI("GET", "/db/tmld")
|
|
732
|
+
|
|
733
|
+
@classmethod
|
|
734
|
+
def sync(cls):
|
|
735
|
+
"""Updates the TimeLoads class with data from the database"""
|
|
736
|
+
cls.timeloads = []
|
|
737
|
+
response = cls.get()
|
|
738
|
+
|
|
739
|
+
if response != {'message': ''}:
|
|
740
|
+
if "TMLD" in response:
|
|
741
|
+
stbk_data_dict = response["TMLD"]
|
|
742
|
+
else:
|
|
743
|
+
return
|
|
744
|
+
|
|
745
|
+
for element_id, stbk_data in stbk_data_dict.items():
|
|
746
|
+
items = stbk_data.get("ITEMS", [])
|
|
747
|
+
|
|
748
|
+
for item in items:
|
|
749
|
+
group_name = item.get("GROUP_NAME", "")
|
|
750
|
+
day = item.get("DAY", 0)
|
|
751
|
+
item_id = item.get("ID", 1)
|
|
752
|
+
|
|
753
|
+
# Create a new TimeLoads object
|
|
754
|
+
new_timeload = CS.TimeLoads(
|
|
755
|
+
element_id=int(element_id),
|
|
756
|
+
day=day,
|
|
757
|
+
group=group_name,
|
|
758
|
+
id=item_id
|
|
759
|
+
)
|
|
760
|
+
|
|
761
|
+
# Remove the automatically added instance and replace with synced data
|
|
762
|
+
CS.TimeLoads.timeloads.pop()
|
|
763
|
+
CS.TimeLoads.timeloads.append(new_timeload)
|
|
764
|
+
|
|
765
|
+
@classmethod
|
|
766
|
+
def delete(cls):
|
|
767
|
+
"""Deletes all time loads from the database and resets the class"""
|
|
768
|
+
cls.timeloads = []
|
|
769
|
+
return MidasAPI("DELETE", "/db/tmld")
|
|
770
|
+
|
|
771
|
+
class CreepCoeff:
|
|
772
|
+
creepcoeffs = []
|
|
773
|
+
|
|
774
|
+
def __init__(self,
|
|
775
|
+
element_id: int,
|
|
776
|
+
creep: float,
|
|
777
|
+
group: str = "",
|
|
778
|
+
id: int = None):
|
|
779
|
+
"""
|
|
780
|
+
Creep Coefficient for Construction Stage define.
|
|
781
|
+
|
|
782
|
+
Parameters:
|
|
783
|
+
element_id: Element ID (required)
|
|
784
|
+
creep: Creep Coefficient value (required)
|
|
785
|
+
group: Load Group Name (optional, default blank)
|
|
786
|
+
id: The creep coefficient ID (optional)
|
|
787
|
+
|
|
788
|
+
Examples:
|
|
789
|
+
```python
|
|
790
|
+
# Basic creep coefficient
|
|
791
|
+
CS.CreepCoeff(25, 1.2)
|
|
792
|
+
|
|
793
|
+
# With specific ID & Group
|
|
794
|
+
CS.CreepCoeff(26, 1.5, "GR", id=2)
|
|
795
|
+
```
|
|
796
|
+
"""
|
|
797
|
+
|
|
798
|
+
self.ELEMENT_ID = element_id
|
|
799
|
+
self.CREEP = creep
|
|
800
|
+
self.GROUP_NAME = group
|
|
801
|
+
|
|
802
|
+
# Set ID
|
|
803
|
+
if id is None:
|
|
804
|
+
self.ID = len(CS.CreepCoeff.creepcoeffs) + 1
|
|
805
|
+
else:
|
|
806
|
+
self.ID = id
|
|
807
|
+
|
|
808
|
+
CS.CreepCoeff.creepcoeffs.append(self)
|
|
809
|
+
|
|
810
|
+
@classmethod
|
|
811
|
+
def json(cls):
|
|
812
|
+
"""
|
|
813
|
+
Converts Creep Coefficient data to JSON format
|
|
814
|
+
Example:
|
|
815
|
+
# Get the JSON data for all creep coefficients
|
|
816
|
+
json_data = CS.CreepCoeff.json()
|
|
817
|
+
print(json_data)
|
|
818
|
+
"""
|
|
819
|
+
json_data = {"Assign": {}}
|
|
820
|
+
|
|
821
|
+
for creepcoeff in cls.creepcoeffs:
|
|
822
|
+
items_data = {
|
|
823
|
+
"ITEMS": [
|
|
824
|
+
{
|
|
825
|
+
"ID": 1,
|
|
826
|
+
"GROUP_NAME": creepcoeff.GROUP_NAME,
|
|
827
|
+
"CREEP": creepcoeff.CREEP
|
|
828
|
+
}
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
json_data["Assign"][str(creepcoeff.ELEMENT_ID)] = items_data
|
|
833
|
+
|
|
834
|
+
return json_data
|
|
835
|
+
|
|
836
|
+
@classmethod
|
|
837
|
+
def create(cls):
|
|
838
|
+
"""Creates creep coefficients in the database"""
|
|
839
|
+
return MidasAPI("PUT", "/db/crpc", cls.json())
|
|
840
|
+
|
|
841
|
+
@classmethod
|
|
842
|
+
def get(cls):
|
|
843
|
+
"""Gets creep coefficient data from the database"""
|
|
844
|
+
return MidasAPI("GET", "/db/crpc")
|
|
845
|
+
|
|
846
|
+
@classmethod
|
|
847
|
+
def sync(cls):
|
|
848
|
+
"""Updates the CreepCoeff class with data from the database"""
|
|
849
|
+
cls.creepcoeffs = []
|
|
850
|
+
response = cls.get()
|
|
851
|
+
|
|
852
|
+
if response != {'message': ''}:
|
|
853
|
+
if "CRPC" in response:
|
|
854
|
+
crpc_data_dict = response["CRPC"]
|
|
855
|
+
else:
|
|
856
|
+
return
|
|
857
|
+
|
|
858
|
+
for element_id, crpc_data in crpc_data_dict.items():
|
|
859
|
+
items = crpc_data.get("ITEMS", [])
|
|
860
|
+
|
|
861
|
+
for item in items:
|
|
862
|
+
group_name = item.get("GROUP_NAME", "")
|
|
863
|
+
creep = item.get("CREEP", 0.0)
|
|
864
|
+
item_id = item.get("ID", 1)
|
|
865
|
+
|
|
866
|
+
# Create a new CreepCoeff object
|
|
867
|
+
new_creepcoeff = CS.CreepCoeff(
|
|
868
|
+
element_id=int(element_id),
|
|
869
|
+
creep=creep,
|
|
870
|
+
group=group_name,
|
|
871
|
+
id=item_id
|
|
872
|
+
)
|
|
873
|
+
|
|
874
|
+
# Remove the automatically added instance and replace with synced data
|
|
875
|
+
CS.CreepCoeff.creepcoeffs.pop()
|
|
876
|
+
CS.CreepCoeff.creepcoeffs.append(new_creepcoeff)
|
|
877
|
+
|
|
878
|
+
@classmethod
|
|
879
|
+
def delete(cls):
|
|
880
|
+
"""Deletes all creep coefficients from the database and resets the class"""
|
|
881
|
+
cls.creepcoeffs = []
|
|
882
|
+
return MidasAPI("DELETE", "/db/crpc")
|
|
883
|
+
|
|
884
|
+
class Camber:
|
|
885
|
+
cambers = []
|
|
886
|
+
|
|
887
|
+
def __init__(self,
|
|
888
|
+
node_id: int,
|
|
889
|
+
camber: float,
|
|
890
|
+
deform: float,
|
|
891
|
+
id: int = None):
|
|
892
|
+
"""
|
|
893
|
+
Camber for Construction Stage define.
|
|
894
|
+
|
|
895
|
+
Parameters:
|
|
896
|
+
node_id: Node ID (required)
|
|
897
|
+
camber: User camber value (required)
|
|
898
|
+
deform: Deformation value (required)
|
|
899
|
+
id: The camber ID (optional)
|
|
900
|
+
|
|
901
|
+
Examples:
|
|
902
|
+
```python
|
|
903
|
+
|
|
904
|
+
CS.Camber(25, 0.17, 0.1)
|
|
905
|
+
```
|
|
906
|
+
"""
|
|
907
|
+
|
|
908
|
+
self.NODE_ID = node_id
|
|
909
|
+
self.USER = camber
|
|
910
|
+
self.DEFORM = deform
|
|
911
|
+
|
|
912
|
+
# Set ID
|
|
913
|
+
if id is None:
|
|
914
|
+
self.ID = len(CS.Camber.cambers) + 1
|
|
915
|
+
else:
|
|
916
|
+
self.ID = id
|
|
917
|
+
|
|
918
|
+
CS.Camber.cambers.append(self)
|
|
919
|
+
|
|
920
|
+
@classmethod
|
|
921
|
+
def json(cls):
|
|
922
|
+
"""
|
|
923
|
+
Converts Camber data to JSON format
|
|
924
|
+
Example:
|
|
925
|
+
# Get the JSON data for all cambers
|
|
926
|
+
json_data = CS.Camber.json()
|
|
927
|
+
print(json_data)
|
|
928
|
+
"""
|
|
929
|
+
json_data = {"Assign": {}}
|
|
930
|
+
|
|
931
|
+
for camber in cls.cambers:
|
|
932
|
+
camber_data = {
|
|
933
|
+
"DEFORM": camber.DEFORM,
|
|
934
|
+
"USER": camber.USER
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
json_data["Assign"][str(camber.NODE_ID)] = camber_data
|
|
938
|
+
|
|
939
|
+
return json_data
|
|
940
|
+
|
|
941
|
+
@classmethod
|
|
942
|
+
def create(cls):
|
|
943
|
+
"""Creates cambers in the database"""
|
|
944
|
+
return MidasAPI("PUT", "/db/cmcs", cls.json())
|
|
945
|
+
|
|
946
|
+
@classmethod
|
|
947
|
+
def get(cls):
|
|
948
|
+
"""Gets camber data from the database"""
|
|
949
|
+
return MidasAPI("GET", "/db/cmcs")
|
|
950
|
+
|
|
951
|
+
@classmethod
|
|
952
|
+
def sync(cls):
|
|
953
|
+
"""Updates the Camber class with data from the database"""
|
|
954
|
+
cls.cambers = []
|
|
955
|
+
response = cls.get()
|
|
956
|
+
|
|
957
|
+
if response != {'message': ''}:
|
|
958
|
+
if "CMCS" in response:
|
|
959
|
+
cmcs_data_dict = response["CMCS"]
|
|
960
|
+
else:
|
|
961
|
+
return
|
|
962
|
+
|
|
963
|
+
for node_id, cmcs_data in cmcs_data_dict.items():
|
|
964
|
+
deform = cmcs_data.get("DEFORM", 0.0)
|
|
965
|
+
user = cmcs_data.get("USER", 0.0)
|
|
966
|
+
|
|
967
|
+
# Create a new Camber object
|
|
968
|
+
new_camber = CS.Camber(
|
|
969
|
+
node_id=int(node_id),
|
|
970
|
+
camber=user,
|
|
971
|
+
deform=deform,
|
|
972
|
+
id=len(cls.cambers) + 1
|
|
973
|
+
)
|
|
974
|
+
|
|
975
|
+
# Remove the automatically added instance and replace with synced data
|
|
976
|
+
CS.Camber.cambers.pop()
|
|
977
|
+
CS.Camber.cambers.append(new_camber)
|
|
978
|
+
|
|
979
|
+
@classmethod
|
|
980
|
+
def delete(cls):
|
|
981
|
+
"""Deletes all cambers from the database and resets the class"""
|
|
982
|
+
cls.cambers = []
|
|
983
|
+
return MidasAPI("DELETE", "/db/cmcs")
|
midas_civil/_load.py
CHANGED
|
@@ -96,10 +96,12 @@ class Load:
|
|
|
96
96
|
Sample: Load_SW("Self-Weight", "Z", -1, "DL")"""
|
|
97
97
|
data = []
|
|
98
98
|
def __init__(self, load_case, dir = "Z", value = -1, load_group = ""):
|
|
99
|
+
|
|
99
100
|
chk = 0
|
|
100
101
|
for i in Load_Case.cases:
|
|
101
102
|
if load_case in i.NAME: chk = 1
|
|
102
103
|
if chk == 0: Load_Case("D", load_case)
|
|
104
|
+
|
|
103
105
|
if load_group != "":
|
|
104
106
|
chk = 0
|
|
105
107
|
a = [v['NAME'] for v in Group.Load.json()["Assign"].values()]
|
midas_civil/_mapi.py
CHANGED
|
@@ -11,17 +11,63 @@ def Midas_help():
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
class
|
|
15
|
-
|
|
14
|
+
class MAPI_COUNTRY:
|
|
15
|
+
|
|
16
|
+
country = "US"
|
|
17
|
+
|
|
18
|
+
def __init__(self,country:str):
|
|
19
|
+
''' Define Civil NX country to automatically set Base URL and MAPI Key from registry.
|
|
20
|
+
```
|
|
21
|
+
MAPI_COUNTRY('US') # For english version
|
|
22
|
+
MAPI_COUNTRY('KR') # For Korean version
|
|
23
|
+
MAPI_COUNTRY('CN') # For Chinese version
|
|
24
|
+
```
|
|
25
|
+
'''
|
|
26
|
+
if country.lower() in ['us','cn','kr','jp']:
|
|
27
|
+
MAPI_COUNTRY.country = country.upper()
|
|
28
|
+
else:
|
|
29
|
+
MAPI_COUNTRY.country = 'US'
|
|
30
|
+
|
|
31
|
+
MAPI_BASEURL.set_url()
|
|
32
|
+
MAPI_KEY.get_key()
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class MAPI_BASEURL:
|
|
36
|
+
baseURL = "https://moa-engineers.midasit.com:443/civil"
|
|
37
|
+
|
|
38
|
+
def __init__(self, baseURL:str):
|
|
39
|
+
''' Define the Base URL for API connection.
|
|
40
|
+
```
|
|
41
|
+
MAPI_BASEURL('https://moa-engineers.midasit.com:443/civil')
|
|
42
|
+
```
|
|
43
|
+
'''
|
|
44
|
+
MAPI_BASEURL.baseURL = baseURL
|
|
45
|
+
|
|
46
|
+
@classmethod
|
|
47
|
+
def get_url(cls):
|
|
48
|
+
return MAPI_BASEURL.baseURL
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def set_url(cls):
|
|
52
|
+
try:
|
|
53
|
+
key_path = f"Software\\MIDAS\\CVLwNX_{MAPI_COUNTRY.country}\\CONNECTION"
|
|
54
|
+
registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path, 0, winreg.KEY_READ)
|
|
55
|
+
url_reg = winreg.QueryValueEx(registry_key, "URI")
|
|
56
|
+
url_reg_key = url_reg[0]
|
|
57
|
+
|
|
58
|
+
port_reg = winreg.QueryValueEx(registry_key, "PORT")
|
|
59
|
+
port_reg_key = port_reg[0]
|
|
16
60
|
|
|
17
|
-
|
|
18
|
-
"""Product 'civil' or 'gen'"""
|
|
19
|
-
if product.lower() == 'gen':
|
|
20
|
-
MAPI_PRODUCT.product = 'gen'
|
|
61
|
+
url_comb = f'https://{url_reg_key}:{port_reg_key}/civil'
|
|
21
62
|
|
|
63
|
+
print(f' 🌐 BASE URL is taken from Registry entry. >> {url_comb}')
|
|
64
|
+
MAPI_BASEURL(url_comb)
|
|
65
|
+
except:
|
|
66
|
+
print(" 🌐 BASE URL is not defined. Click on Apps > API Settings to copy the BASE URL Key.\nDefine it using MAPI_BASEURL('https://moa-engineers.midasit.com:443/civil')")
|
|
67
|
+
sys.exit(0)
|
|
22
68
|
|
|
23
69
|
class MAPI_KEY:
|
|
24
|
-
"""MAPI key from Civil NX.\n\nEg: MAPI_Key("eadsfjaks568wqehhf.
|
|
70
|
+
"""MAPI key from Civil NX.\n\nEg: MAPI_Key("eadsfjaks568wqehhf.ajkgj345qfhh")"""
|
|
25
71
|
data = ""
|
|
26
72
|
|
|
27
73
|
def __init__(self, mapi_key:str):
|
|
@@ -31,14 +77,14 @@ class MAPI_KEY:
|
|
|
31
77
|
def get_key(cls):
|
|
32
78
|
if MAPI_KEY.data == "":
|
|
33
79
|
try:
|
|
34
|
-
key_path =
|
|
80
|
+
key_path = f"Software\\MIDAS\\CVLwNX_{MAPI_COUNTRY.country}\\CONNECTION"
|
|
35
81
|
registry_key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, key_path, 0, winreg.KEY_READ)
|
|
36
82
|
value = winreg.QueryValueEx(registry_key, "Key")
|
|
37
83
|
my_key = value[0]
|
|
38
|
-
print(' 🔑
|
|
84
|
+
print(f' 🔑 MAPI-KEY is taken from Registry entry. >> {my_key[:35]}...')
|
|
39
85
|
MAPI_KEY(my_key)
|
|
40
86
|
except:
|
|
41
|
-
print(f"🔑 MAPI KEY is not defined. Click on Apps > API Settings to copy the MAPI Key
|
|
87
|
+
print(f"🔑 MAPI KEY is not defined. Click on Apps > API Settings to copy the MAPI Key.\n Define it using MAPI_KEY('xxxx')")
|
|
42
88
|
sys.exit(0)
|
|
43
89
|
else:
|
|
44
90
|
my_key = MAPI_KEY.data
|
|
@@ -57,7 +103,7 @@ def MidasAPI(method:str, command:str, body:dict={})->dict:
|
|
|
57
103
|
# Create a node
|
|
58
104
|
MidasAPI("PUT","/db/NODE",{{"Assign":{{"1":{{'X':0, 'Y':0, 'Z':0}}}}}})"""
|
|
59
105
|
|
|
60
|
-
base_url =
|
|
106
|
+
base_url = MAPI_BASEURL.baseURL
|
|
61
107
|
mapi_key = MAPI_KEY.get_key()
|
|
62
108
|
|
|
63
109
|
url = base_url + command
|
midas_civil/_temperature.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from ._mapi import *
|
|
2
2
|
from ._node import *
|
|
3
3
|
from ._group import *
|
|
4
|
+
from ._load import *
|
|
4
5
|
|
|
5
6
|
def convList(item):
|
|
6
7
|
if type(item) != list:
|
|
@@ -57,6 +58,11 @@ class Temperature:
|
|
|
57
58
|
temps = []
|
|
58
59
|
|
|
59
60
|
def __init__(self, temperature, lcname, group="", id=None):
|
|
61
|
+
chk = 0
|
|
62
|
+
for i in Load_Case.cases:
|
|
63
|
+
if lcname in i.NAME: chk = 1
|
|
64
|
+
if chk == 0: Load_Case("T", lcname)
|
|
65
|
+
|
|
60
66
|
if group:
|
|
61
67
|
chk = 0
|
|
62
68
|
try:
|
|
@@ -143,6 +149,12 @@ class Temperature:
|
|
|
143
149
|
temps = []
|
|
144
150
|
|
|
145
151
|
def __init__(self, element, temperature, lcname, group="", id=None):
|
|
152
|
+
|
|
153
|
+
chk = 0
|
|
154
|
+
for i in Load_Case.cases:
|
|
155
|
+
if lcname in i.NAME: chk = 1
|
|
156
|
+
if chk == 0: Load_Case("T", lcname)
|
|
157
|
+
|
|
146
158
|
if group:
|
|
147
159
|
chk = 0
|
|
148
160
|
try:
|
|
@@ -256,6 +268,12 @@ class Temperature:
|
|
|
256
268
|
temps = []
|
|
257
269
|
|
|
258
270
|
def __init__(self, element, type, lcname, tz, group="", id=None, hz=None, ty=0, hy=None):
|
|
271
|
+
|
|
272
|
+
chk = 0
|
|
273
|
+
for i in Load_Case.cases:
|
|
274
|
+
if lcname in i.NAME: chk = 1
|
|
275
|
+
if chk == 0: Load_Case("T", lcname)
|
|
276
|
+
|
|
259
277
|
if group:
|
|
260
278
|
chk = 0
|
|
261
279
|
try:
|
|
@@ -376,6 +394,12 @@ class Temperature:
|
|
|
376
394
|
temps = []
|
|
377
395
|
|
|
378
396
|
def __init__(self, node, temperature, lcname, group="", id=None):
|
|
397
|
+
|
|
398
|
+
chk = 0
|
|
399
|
+
for i in Load_Case.cases:
|
|
400
|
+
if lcname in i.NAME: chk = 1
|
|
401
|
+
if chk == 0: Load_Case("T", lcname)
|
|
402
|
+
|
|
379
403
|
if group:
|
|
380
404
|
chk = 0
|
|
381
405
|
try:
|
|
@@ -500,6 +524,12 @@ class Temperature:
|
|
|
500
524
|
raise ValueError("For 'Input' type, both 'elast' and 'thermal' parameters are required.")
|
|
501
525
|
|
|
502
526
|
# Handle load group creation
|
|
527
|
+
|
|
528
|
+
chk = 0
|
|
529
|
+
for i in Load_Case.cases:
|
|
530
|
+
if lcname in i.NAME: chk = 1
|
|
531
|
+
if chk == 0: Load_Case("T", lcname)
|
|
532
|
+
|
|
503
533
|
if group:
|
|
504
534
|
chk = 0
|
|
505
535
|
try:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
midas_civil/__init__.py,sha256=t0XkmZiEBYodUkU2gJWLQmqrpQdZc8ikPM3Z0xrSVPg,575
|
|
2
2
|
midas_civil/_boundary.py,sha256=s5mgZIc1b0-P7AdWuaPAQ5cIbHL5CR1YRKJA7KE4W_U,32958
|
|
3
|
-
midas_civil/_construction.py,sha256=
|
|
3
|
+
midas_civil/_construction.py,sha256=S8UosWTfVXLI5MmfULqsYw-Z9K5lQ5_34hvxZFVMlMM,40687
|
|
4
4
|
midas_civil/_construction_backup.py,sha256=Pj7V-NYCkkT-aMjKXfs1jKa9klsGh48UXDLwn3BLYTY,18225
|
|
5
5
|
midas_civil/_element.py,sha256=4IjJSlsXMr2llv7gC66KBxPoikt9rWbwGBePMaH9gYg,26935
|
|
6
6
|
midas_civil/_group.py,sha256=9EsPGW8lWpzJBW25Gfd-G5S_9oP8ER3zNzeqknDsfmw,11480
|
|
7
|
-
midas_civil/_load.py,sha256=
|
|
8
|
-
midas_civil/_mapi.py,sha256=
|
|
7
|
+
midas_civil/_load.py,sha256=kPDcgyd-D_HD59ABQuYmry92ruCovdYos65g06wMq84,30360
|
|
8
|
+
midas_civil/_mapi.py,sha256=Fabn3QX6OHJeV_s_01KMvOwkSye0kfgpiUUgPplAzxA,4597
|
|
9
9
|
midas_civil/_material.py,sha256=uJEIHJM9OhwTRWUI2mtd_0BQSxdlYhATYJu9P7tNNBA,69511
|
|
10
10
|
midas_civil/_model.py,sha256=G5Kh7u2DSodvKGQ0fOzAUx4Ilj8-rn-nGDTFeI6AkUU,16442
|
|
11
11
|
midas_civil/_movingload.py,sha256=_XgERsk5tkTx4u1vhe23kdz0xNr41X2tRaiyNaFNt84,79999
|
|
@@ -15,13 +15,13 @@ midas_civil/_result.py,sha256=ZJf2CQG2ZjlTKuWo3zBnG7W8EwI1UkhWhWJVWRzlXUU,7640
|
|
|
15
15
|
midas_civil/_result_extract.py,sha256=J-9eeWDbFeaDL-C41TAynYuooiHYsayAe3WbfGRO8sM,5537
|
|
16
16
|
midas_civil/_section.py,sha256=zhUkiIaRI9DqYHAdpmQvhFpg6SuTgAM7xPEz-3Wingg,32390
|
|
17
17
|
midas_civil/_settlement.py,sha256=U7lJYBqGbuCv7qziEEznDyA4M_SCjJeIjc0lDeGfE4Y,5125
|
|
18
|
-
midas_civil/_temperature.py,sha256=
|
|
18
|
+
midas_civil/_temperature.py,sha256=EfvivFWfxyM8yFCvWJgXLhaCofGwLKEBGFUuW8yHnfQ,24209
|
|
19
19
|
midas_civil/_tendon.py,sha256=qfkcRAZ8MKe36xCec4Nr5TQ17_zDCk2TMW4T5lc85e0,33308
|
|
20
20
|
midas_civil/_thickness.py,sha256=4xQsLA3Q_gIGCwLc_glFmiErdWdQUSwhlEhJ_IPJseA,3248
|
|
21
21
|
midas_civil/_utils.py,sha256=eymiqO8KaTKdhVY3saebqNS0BbUUmGmgw3-ELKqew0A,2611
|
|
22
22
|
midas_civil/_view.py,sha256=o7rkfoQzmgAb3dT0ujPIQLVwVlveo3rMRIbZU1UosZo,849
|
|
23
|
-
midas_civil-0.1.
|
|
24
|
-
midas_civil-0.1.
|
|
25
|
-
midas_civil-0.1.
|
|
26
|
-
midas_civil-0.1.
|
|
27
|
-
midas_civil-0.1.
|
|
23
|
+
midas_civil-0.1.8.dist-info/licenses/LICENSE,sha256=zrL4RwZC4rb-by_ZHKXwKdIwcs6ATy59TPZ9HxPHCrs,1071
|
|
24
|
+
midas_civil-0.1.8.dist-info/METADATA,sha256=5HVJZD3_IiGB-ZvpZLUXJ3-lpnEHxZ-u9rvwgH7zD7E,1709
|
|
25
|
+
midas_civil-0.1.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
26
|
+
midas_civil-0.1.8.dist-info/top_level.txt,sha256=_NFmrlN5V9OxJ-PAO4s_om8OA8uupXho3QqZcSsnbuI,12
|
|
27
|
+
midas_civil-0.1.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|