Commit Graph

385 Commits

Author SHA1 Message Date
Andrej730 65d419d5c7 fix test after 7dd0d7601 2024-04-18 10:48:23 +02:00
Andrej730 d35f2dd0e9 layer.unassign_layer - support batching #4474 2024-04-18 10:48:23 +02:00
Andrej730 a003bc0018 layer.assign_layer - support batching #4474 2024-04-18 10:48:23 +02:00
Andrej730 eebcc48238 group.unassign_group - support batching #4474 2024-04-18 10:48:23 +02:00
Andrej730 df9a306730 spatial.unassign_container - support batching #4474 2024-04-18 10:48:22 +02:00
Andrej730 52995d1cdd spatial.assign_container - support batching #4474 2024-04-18 10:48:22 +02:00
Andrej730 ee6c7a9fad black format 2024-04-18 10:48:22 +02:00
Andrej730 e5cfe5cf3c ifcopenshell.validate to check unique guids (IfcRoot.UR1) 2024-04-18 10:48:21 +02:00
Dion Moult 33f5db2e26 Use indices instead of WorkTimeDatesInterface
Checking start/end dates are done very, very often in date calculations (often looping through every day in a date range). So I'd prefer more opaque code but less overhead.
2024-04-18 10:48:06 +02:00
Dion Moult 7e689f2456 Fix #4305. Bug where importing spreadsheets into IFC didn't intelligently cast attribute data types 2024-04-18 10:47:36 +02:00
Andrej730 489e92da4e typing 2024-04-17 14:54:42 +02:00
Andrej730 088e1d07bf util.selector.set_element_value to work w/o preassigned placement #4439 2024-04-17 14:54:42 +02:00
Andrej730 67b657f2cb small fix 2024-04-17 14:54:41 +02:00
Andrej730 5ee0c4c967 ifccsv - support for assigning x/y/z coordinates from csv 2024-04-17 14:54:41 +02:00
Andrej730 edce320756 utils.filter_elements docs and tests 2024-04-17 14:46:06 +02:00
Andrej730 8d1559b486 small fixes after d209cc9ff, added a test 2024-04-17 14:46:06 +02:00
Andrej730 e5d1c8cfb9 add test for util.unit.calculate_unit_scale 2024-04-17 14:46:06 +02:00
Andrej730 ac4669f841 fix duplicated ifcstyleditems using append_asset
since we don't use `file.add` to add inverse items and we use `file.create_entity` it was duplicating new elements, added optional parameter that makes it possible to track already added relationships between `append_asset`s.
2024-04-17 14:42:55 +02:00
Andrej730 1d7c882231 append_asset - keep preexisting contexts valid #4280
issue occurred with ifcpatch ExtractElements - it was adding project from other ifc file (with the contexts) and then adding some elements from it using `append_asset`. During `append_asset` it was considering existing context with the duplicated one and was partially purging it.
2024-04-17 14:42:55 +02:00
Andrej730 a99fbbfdd8 reassign_class - cover with tests 2024-04-17 14:41:52 +02:00
Andrej730 1f532491ec fix pass-valid-selected-enumeration.ifc after 5270045
.ifc was failing during test_validate.py
1) Changed schema to rc2 as rc3-4 doesn't have IfcBridgePart
2) PredefinedType and UsageType were mixed up
3) With just `.DECK.` it was failing with error below
```
With attribute:
    <attribute PredefinedType: <select IfcFacilityPartTypeSelect: (<enumeration IfcBridgePartTypeEnum: (ABUTMENT, DECK, DECK_SEGMENT, FOUNDATION, NOTDEFINED, PIER, PIER_SEGMENT, PYLON, SUBSTRUCTURE, SUPERSTRUCTURE, SURFACESTRUCTURE, USERDEFINED)> | <enumeration IfcFacilityPartCommonTypeEnum: (ABOVEGROUND, BELOWGROUND, JUNCTION, LEVELCROSSING, NOTDEFINED, SEGMENT, SUBSTRUCTURE, SUPERSTRUCTURE, TERMINAL, USERDEFINED)> | <enumeration IfcMarinePartTypeEnum: (ABOVEWATERLINE, ANCHORAGE, APPROACHCHANNEL, BELOWWATERLINE, BERTHINGSTRUCTURE, CHAMBER, CILL_LEVEL, COPELEVEL, CORE, CREST, GATEHEAD, GUDINGSTRUCTURE, HIGHWATERLINE, LANDFIELD, LEEWARDSIDE, LOWWATERLINE, MANUFACTURING, NAVIGATIONALAREA, NOTDEFINED, PROTECTION, SHIPTRANSFER, STORAGE, USERDEFINED, VEHICLESERVICING, WATERFIELD, WEATHERSIDE)> | <enumeration IfcRailwayPartTypeEnum: (DILATATIONSUPERSTRUCTURE, LINESIDESTRUCTURE, LINESIDESTRUCTUREPART, NOTDEFINED, PLAINTRACKSUPESTRUCTURE, SUPERSTRUCTURE, TRACKSTRUCTURE, TRACKSTRUCTUREPART, TURNOUTSUPERSTRUCTURE, USERDEFINED)> | <enumeration IfcRoadPartTypeEnum: (BICYCLECROSSING, BUS_STOP, CARRIAGEWAY, CENTRALISLAND, CENTRALRESERVE, HARDSHOULDER, INTERSECTION, LAYBY, NOTDEFINED, PARKINGBAY, PASSINGBAY, PEDESTRIAN_CROSSING, RAILWAYCROSSING, REFUGEISLAND, ROADSEGMENT, ROADSIDE, ROADSIDEPART, ROADWAYPLATEAU, ROUNDABOUT, SHOULDER, SIDEWALK, SOFTSHOULDER, TOLLPLAZA, TRAFFICISLAND, TRAFFICLANE, USERDEFINED)>)>>
Value:
    DECK
Not valid
```
2024-04-17 14:41:52 +02:00
Andrej730 f381dce64d fix tests after a971860 2024-04-17 14:41:52 +02:00
Andrej730 a86ac68e0c Fix #4365
Allowing to add new properties with None values if should_purge is not set to True (and it's False by default)
2024-04-17 13:41:18 +02:00
Andrej730 4ac771a214 Fix #4342 2024-04-16 13:28:46 +02:00
Andrej730 dd27107be8 style.assign_representation_styles to replace previously assigned styles
as probably in the most cases user would want 1 style per 1 representation item

After this it's finally possible in BBIM to assign styles to representation items through the materials: https://imgur.com/a/cgiJ1KV
2024-04-16 13:28:46 +02:00
Andrej730 17da72232d unassign_material_style to handle constituents 2024-04-16 13:28:46 +02:00
Andrej730 c7ca87f9c4 api.unassign_representation_styles 2024-04-16 13:28:46 +02:00
Andrej730 f22369b960 assigning material styles to reuse existing styled item + tests 2024-04-16 13:28:46 +02:00
Andrej730 46eae7a7d2 assign_representation_styles to reuse existing styled item + tests 2024-04-16 13:28:46 +02:00
Andrej730 ec107d2f7f fixed bug migrating attributes to older ifc version (after 8728fa3) 2024-04-16 13:28:45 +02:00
Andrej730 356c81e80f black format 2024-04-16 13:28:45 +02:00
Andrej730 0077036716 Fix issues editing work time in ifc4x3 #4295 2024-04-16 13:28:45 +02:00
Andrej730 89da2b3b7d IFC4.3 test bootstrap 2024-04-16 13:28:45 +02:00
Andrej730 45a23d9371 style.assign_material_style to assign style to related shape aspects 2024-04-16 13:28:45 +02:00
Andrej730 c76a5a7ee7 promote get_shape_aspects to util.element method 2024-04-16 13:28:45 +02:00
Andrej730 3a9c023d33 Fix issue editing object placement that shares it's axis placement with other placements
If multiple object placements were reusing the same IfcAxis2Placement then editing one of them would remove IfcAxis2Placement ignoring it's inverse references making all other object placements invalid.
2024-04-16 11:38:49 +02:00
Andrej730 f522e2beb7 some typing 2024-04-16 11:38:20 +02:00
Andrej730 075b9e4775 Fix bug in ExtractElements recipe adding a lot unrelated products
if you'd add a type product and it had material that were used in bunch of ther products
example - https://community.osarch.org/discussion/1965/error-extracting-ifcslab-or-ifccolumn
2024-04-16 11:38:20 +02:00
Andrej730 e289f23c40 root.remove_product - fix some cases producing invalid ifc #4313
always remove IfcRelNests
1) if product is RelatingObject
2) if product is the only RelatedObject
2024-04-16 11:35:31 +02:00
Andrej730 e8055ec396 remove_representation to consider representation item's layers too
and purge layers if they are out of items as they become invalid
2024-04-16 11:28:59 +02:00
Andrej730 6d8de6425f shape builder polyline example and tests 2024-04-16 11:28:59 +02:00
Dion Moult 65c00f75dd Minor test fix 2024-04-16 11:26:36 +02:00
Dion Moult 608147c245 Fix #4195. Fix regressions from f840da3 and add support for "contains string" comparisons. 2024-04-16 11:26:36 +02:00
Dion Moult 33051c0139 Fix #4203. Fix bug where removing nested cost items left orphaned relationships. 2024-04-16 11:26:36 +02:00
Andrej730 3008599eec Clean up IfcIndexedColourMap removing representation #4138
Because we wasn't removing colour map, remove_representation was producing orphaned IfcPolygonalFaceSet that were referred by colour map.
2024-04-16 11:17:07 +02:00
krande f73a438d38 add test and update ci 2024-04-16 11:16:40 +02:00
Andrej730 eb30b30186 style.edit_surface_style to support editing IfcSurfaceStyleLighting
It was failing because api method wasn't supporting IfcColourRgb attributes edit in general but only for IfcSurfaceStyleShading.SurfaceColour
2024-04-16 11:16:07 +02:00
Andrej730 b6b0e958b5 style.add_surface_texture to work without blender material provided 2024-04-16 11:16:07 +02:00
Andrej730 518f054cbd edit_object_placement optimization for objects with subchildren #4035
1) We were iterating over same subchildren 2 or more times.
2) There is no need to change subchildren position at all since their parent position is already adjusted.

Explained here in detail - https://github.com/IfcOpenShell/IfcOpenShell/issues/4035#issuecomment-1822824352
2024-04-16 11:05:27 +02:00
Andrej730 6fd629f707 Fixed issue reassigning class to type class with userdefined type #4018
When PredefinedType is not found in the related enum reassign_class is considering it USERDEFINED and trying to set .ObjectType. The problem was it was doing for type classes also, when it should have set .ElementType instead.

Why it crashed BlenderBIM - in IfcClassData.data["has_entity"] we store currently active IFC entity which is recreated during `ifcopenshell.util.schema.reassign_class` making old entity invalid. Since `root.reassign_class` was failing in the process, related BBIM operator was failing too, IfcClassData wasn't updated and removed entity was accessed from UI leading to crash.
2024-04-16 11:05:27 +02:00