MCPcopy Create free account
hub / github.com/HeisenbergJY1/PySap2000 / _create

Method _create

loading/load_pattern.py:114–139  ·  view source on GitHub ↗

Create a load pattern. Args: model: SAP2000 SapModel object Returns: `0` if successful, `-1` if it already exists.

(self, model)

Source from the content-addressed store, hash-verified

112 _object_type: ClassVar[str] = "LoadPatterns"
113
114 def _create(self, model) -> int:
115 """
116 Create a load pattern.
117
118 Args:
119 model: SAP2000 SapModel object
120
121 Returns:
122 `0` if successful, `-1` if it already exists.
123 """
124 # Check whether the load pattern already exists.
125 if self.name:
126 try:
127 existing = self.get_name_list(model)
128 if self.name in existing:
129 return -1
130 except Exception:
131 pass
132
133 result = model.LoadPatterns.Add(
134 self.name,
135 int(self.load_type),
136 self.self_weight_multiplier,
137 self.add_load_case
138 )
139 return com_ret(result)
140
141 def _get(self, model) -> int:
142 """

Callers

nothing calls this directly

Calls 2

get_name_listMethod · 0.95
com_retFunction · 0.90

Tested by

no test coverage detected