Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Optional 'Criteria' Parameter (Strength or Serviceability) to the 'add' Method in LoadCombinations Class #4

Open
Jeroen124 opened this issue Jun 25, 2024 · 0 comments

Comments

@Jeroen124
Copy link

Jeroen124 commented Jun 25, 2024

Problem

The add method of the LoadCombinations class currently lacks an optional parameter for specifying the criteria. This results in a discrepancy between the output generated by the Python package and the expected input format for the API solver.

class LoadCombinations(ModelCollectionComponent):
    """Creates an instance of the SkyCiv LoadCombinations class.
    """

    def add(self, name: str, combination_factors: dict) -> int:
        """Adds a new load combination.

        Args:
            name (str): The name of the load combination.
            combination_factors (dict): Key value pairs for the factors to apply to the load groups.

        Returns:
            int: The ID of the created load combination.

        Example::

            lcs = LoadCombinations()

            factors = {
                "SW": 1,
                "windCase": 1,
                "liveLoad": 1.5
            }

            lcs.add("LC1", factors)
        """
        next_index = next_object_key(self)

        lc = LoadCombination(name, combination_factors)
        setattr(self, str(next_index), lc)

        return next_index

This gives te following input for the solver, resulting from the python package.

                    "load_combinations": {
                        "1": {
                            "name": "ULS1",
                            "Dead_load": 1.35,
                            "Product_load_1": 1.5750000000000002
                        },

Whilst the api solver expects something like this:

        "1": {
            "name": "LC1",
            "criteria": "strength"
        },

Possible solution:

class LoadCombinations(ModelCollectionComponent):
    """Creates an instance of the SkyCiv LoadCombinations class.
    """

    def add(self, name: str, combination_factors: dict, criteria: str = None) -> int:
        """Adds a new load combination.

        Args:
            name (str): The name of the load combination.
            combination_factors (dict): Key value pairs for the factors to apply to the load groups.
            criteria (str, optional): The criteria for the load combination (e.g., 'strength', 'serviceability'). Defaults to None.

        Returns:
            int: The ID of the created load combination.

        Example::

            lcs = LoadCombinations()

            factors = {
                "SW": 1,
                "windCase": 1,
                "liveLoad": 1.5
            }

            lcs.add("LC1", factors, criteria="strength")
        """
        next_index = next_object_key(self)

        lc = LoadCombination(name, combination_factors, criteria)
        setattr(self, str(next_index), lc)

        return next_index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant