Structural UI - refactor common code to tool, fix bugs

Also revert previous change in UI - `draw_attributes` doesn't cover it and there indeed should be special handling.
This commit is contained in:
Andrej730
2025-07-10 17:59:21 +05:00
parent 76f0b57ff1
commit 0fcc47508a
4 changed files with 125 additions and 92 deletions
@@ -16,11 +16,28 @@
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell
from typing import Any
from typing import Any, TypedDict, Literal, Union
AttributeDict = TypedDict(
"AttributeDict",
{
"type": Union[
Literal[
"string",
"null",
],
str, # IFC Class.
],
"value": Any,
},
)
def edit_structural_boundary_condition(
file: ifcopenshell.file, condition: ifcopenshell.entity_instance, attributes: dict[str, Any]
file: ifcopenshell.file,
condition: ifcopenshell.entity_instance,
attributes: dict[str, AttributeDict],
) -> None:
"""Edits the attributes of an IfcBoundaryCondition
@@ -29,6 +46,7 @@ def edit_structural_boundary_condition(
:param condition: The IfcBoundaryCondition entity you want to edit
:param attributes: a dictionary of attribute names and values.
Each value is represented by a dictionary.
:return: None
"""
for name, data in attributes.items():