Skip to content

Initialization of self.self_weight Leads to Empty JSON input and Error #3

@Jeroen124

Description

@Jeroen124

Problemn

When a model is created, an empty self.self_weight model is assigned to the Model, which results in an erroneous JSON output and subsequent error.

model.py

class Model:

    def __init__(self, unit_system: Literal["metric", "imperial"], vertical_axis: Literal["Y", "Z"] = 'Y'):
        """Create an s3d_model object.

        Args:
            unit_system (str): {'metric' | 'imperial'}
            vertical_axis (str, optional): {"Y" | "Z"}. Defaults to 'Y'.

        Example: 
            Default for: metric | imperial::
            {
                "length": "m" | 'ft',
                 "section_length": "mm" | 'in',
                 "material_strength": "mpa" | 'ksi',
                 "density": "kg/m3" | 'lb/ft3',
                 "force": "kn" | 'kip',
                 "moment": "kn-m" | 'kip-ft',
                 "pressure": "kpa" | 'ksf',
                 "mass": "kg" | 'kip',
                 "translation": "mm" | 'in',
                 "stress": "mpa" | 'ksi'
            }
        """
        self.settings = Settings(unit_system, vertical_axis)
        self.nodes = Nodes()
        self.members = Members()
        self.plates = Plates()
        self.meshed_plates = MeshedPlates()
        self.sections = Sections()
        self.materials = Materials()
        self.supports = Supports()
        self.settlements = Settlements()
        self.point_loads = PointLoads()
        self.moments = Moments()
        self.distributed_loads = DistributedLoads()
        self.pressures = Pressures()
        self.area_loads = AreaLoads()
        self.member_prestress_loads = {}
        self.self_weight = SelfWeights()
        self.load_combinations = LoadCombinations()
        self.load_cases = {}
        self.nodal_masses = {}
        self.nodal_masses_conversion_map = {}
        self.spectral_loads = {}
        self.groups = []

This results in a json with an empty self_weight:
"self_weight": {},

This in turn results in the following error:
{"response": {"status": 1, "msg": "The function 'S3D.model.set' could not be completed for an unknown reason. Check screenshot for more information.",

Possible solution:

Initializing self.self_weight as an empty dictionary might be sufficient:

Initializing the self.load_combinations = {}
However, the implications of this change are not fully understood and require further investigation to ensure it does not introduce other issues.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions