Compare commits

...

1075 Commits

Author SHA1 Message Date
Dion Moult 5db6738ac2 Test to see if this has any impact on reloading the add-on. 2025-02-08 19:27:34 +11:00
Dion Moult eabdb5d281 Consolidate selection and visibility tools in the spatial manager into a single location with a single function for filtering
There were a number of inconsistencies between the modes and how keyword
filtering affected results. This should resolve it.
2025-02-08 16:38:29 +11:00
Andrej730 59dd105e99 fix get_applicable_entities / get_applicable_types missing schema #6108 2025-02-08 07:54:49 +11:00
Andrej730 a28070afef Hide Edit Profile for material sets without profiles #6103 2025-02-08 07:54:49 +11:00
Andrej730 689e2718e5 Fix conversion to profile for breps #6103 2025-02-08 07:54:49 +11:00
Andrej730 a2ab3972c8 bim.update_representation - add note about about material unassignment 2025-02-08 07:54:49 +11:00
Andrej730 667223da8e typing 2025-02-08 07:54:49 +11:00
tim 1e58a517a0 Dark mode extend icon (#6112)
dm_extend.png icon was missing

Co-authored-by: tim <tjrhyder@gmail.com>
2025-02-08 07:51:33 +11:00
Dion Moult fcee54c572 Fix regression when removing an active representation.
Some tests removed since they no longer make sense with the new item
editing mode.
2025-02-08 00:21:38 +11:00
Dion Moult 889a9e3891 Tweak failing test to now allow assigning elements to scaled multi-user objects
Previously this was not allowed, but I don't see why not
2025-02-08 00:20:25 +11:00
Dion Moult 7bc1992963 Fix regression where adding a new occurrence should not change your active context back to body if you've switched it. 2025-02-07 23:52:55 +11:00
Dion Moult 49c3a55456 Fix failing pset_template tests. Regression in 5bd24b276 for editing pset template properties. 2025-02-07 23:33:33 +11:00
Dion Moult f11d79f8c1 Fix cost and drawing feature tests 2025-02-07 22:40:17 +11:00
Dion Moult 2cc4f96b7f Fix failing project feature tests. Fix regression where appending an asset might append a named style twice. 2025-02-07 22:02:44 +11:00
Dion Moult bb46a1659d Fix light and georeference feature tests
Not setting the year meant our date calc tests would fail every year :)
2025-02-07 17:19:27 +11:00
Dion Moult f09002c7e2 Fix regression in caeabe2 where actor data didn't load. 2025-02-07 16:58:45 +11:00
Dion Moult 9f75a14204 Update issue templates 2025-02-07 13:31:59 +11:00
Dion Moult c40d21d945 Fix #6106. True north must always be 2D. 2025-02-07 13:19:33 +11:00
Dion Moult 0d3245102f Fix remaining failing tool tests 2025-02-07 13:12:02 +11:00
Dion Moult 3aa4fa580b Fix regression where you couldn't upgrade schema of IFCs with invalid headers 2025-02-07 12:38:52 +11:00
Dion Moult 4c255cca43 Fix failing model tests and regression 0899a2a8 where switching geometry can invalidate old meshes
The fix in 0899a2a8 ensured that when you switched geometry, all other
elements (sharing the same type or representation) would also switch
alongside it. However it would lead to mesh invalidation which broke
some assumptions in the style code. The style code also repeated a lot
of the logic of switch representation (i.e. finding shared
representations) so this seems simpler.

In general the whole representation part of the code is messy and
hopefully over time it'll get better.
2025-02-07 12:35:08 +11:00
Dion Moult e603ebed04 Fix bug where loading a types ignored style assigned via a material
For occurrences, the iterator would populate ios_materials if there is a
material / style associated with it. However, for types we do
create_shape to the representation directly, so we need to do the
material / style check manually.
2025-02-07 12:29:17 +11:00
Andrej730 38e6f09c91 Fix #6096 2025-02-06 18:26:14 +05:00
Andrej730 6473fa4b67 Deprecate workaround for universal wheels
Tested on Blender 4.3.2 and universal wheels are now supported without this hack, see https://projects.blender.org/blender/blender/issues/125091
2025-02-06 18:26:14 +05:00
Andrej730 38adaf4d18 Fix running critical tests in ci 2025-02-06 18:26:14 +05:00
Dion Moult b7fb5c90bc Continue fixing failing tool tests. Fix regression where UV coordinates might have the wrong order. 2025-02-06 17:22:54 +11:00
Dion Moult 23efb09ba6 Add links to Linux packages 2025-02-06 09:46:59 +11:00
Dion Moult cf6280b928 Rename BlenderBIM to Bonsai in a few more spots 2025-02-06 09:24:25 +11:00
Andrej730 c16894cabf Fix bug in 124c028 saving defined unit as defining 2025-02-05 18:27:27 +05:00
Andrej730 5df297c23c Fix failing facet test after 124c028 2025-02-05 18:27:27 +05:00
Andrej730 b2b3a83463 ci - fix missing ifctester for tests 2025-02-05 18:27:27 +05:00
Andrej730 4b0b0191ba Test enabling/disabling Bonsai before uploading to unstable repo #6075 2025-02-05 18:27:27 +05:00
Dion Moult a92306d413 Fix #6097. Be more defensive against selection state when moving objects into new containers. 2025-02-05 20:28:29 +11:00
Dion Moult f457ce8270 Fix failing unit/system/geometry tool tests. Fix regression where object scales weren't applied in the new add element approach. 2025-02-05 18:50:37 +11:00
Dion Moult 590c2e120c Fix failing drawing tool tests. Also consolidate relative paths using tool.Ifc.get_uri.
The same issue of handling relative paths, doing as_posix, checking
drives, etc was solved again and again in slightly different ways. This
centralises it.
2025-02-05 17:17:09 +11:00
Dion Moult 13746eb55e Fix CI job a unique name so it can be used as a requirement for PRs
It seems as though the UI only selects by job name and we use the name
"build" everywhere.
2025-02-05 14:28:42 +11:00
Dion Moult 55b9c7d6bf Fix failing ifcpatch tests 2025-02-05 14:10:41 +11:00
Dion Moult e86624873b Fix segfault from editing a IFC2X3 georeferencing pset with a null map unit.
Doing createIfcIdentifier(None) segfaults.
2025-02-05 14:10:41 +11:00
Andrej730 ae11f205f3 Fix missing unregister for some tools #6075
PileTool, PlateTool, RampFlightTool, StairFlightTool were never unregistered leading to issues on Bonsai update
2025-02-04 17:37:57 +05:00
Andrej730 457f9c6aef Select pset template for the pset in pset template ui for editing
Example - https://imgur.com/a/h46Ewhk
2025-02-04 17:37:56 +05:00
Andrej730 cc88bd4a9d Fix issue adding project library if other library was already in edit 2025-02-04 17:37:56 +05:00
Andrej730 8f74f4d9f1 Change IfcProjectLibrary's parent library from UI
Example - https://imgur.com/a/4PZr0px
It's very clunky and mainly exposed just to be available in some way, it will all make more sense when we display project libraries as trees in project library ui.
2025-02-04 17:37:56 +05:00
Andrej730 56f0c19a85 append_asset to support IfcPresentationLayerAssignment #6023 2025-02-04 17:37:56 +05:00
Andrej730 76747bdf5a Recent files - dim button for filepaths that do not exist
Example - https://i.imgur.com/dwEBtG6.png
2025-02-04 17:37:56 +05:00
Andrej730 a4de196259 space module operators - remove unnecessary ifc operators 2025-02-04 17:37:56 +05:00
Andrej730 049b157c8a bim.toggle_space_visibility - description 2025-02-04 17:37:56 +05:00
Andrej730 7ec1bc5272 Fix error toggling boundary decorations after one was removed #6088 2025-02-04 17:37:56 +05:00
Andrej730 d4f44cb0a1 typing 2025-02-04 17:37:55 +05:00
Andrej730 ecd7282150 black . 2025-02-04 17:37:55 +05:00
Dion Moult bd2c3a0ca1 Continue fixing tool tests.
Just chipping away at it give me time.
2025-02-04 17:04:29 +11:00
Louis Trümpler f0f2dda40e Add assign constituent fractions recipe (#5979)
* Add AssignConstituentFractions recipe

* license, units & added context description

* removed src, using better unit handling and several other small improvements based on feedback
2025-02-04 14:23:08 +11:00
Dion Moult 0c41f0c32c Fix #6094. Fix failing core tests. 2025-02-04 13:36:28 +11:00
Dion Moult a35ef32ee6 Forgot to commit docs for serialiser settings 2025-02-04 07:35:34 +11:00
Andrej730 00eff23b74 Rename bim_boundary_properties -> BIMBoundaryProperties for consistency 2025-02-03 17:43:01 +05:00
Andrej730 88af3eb1a6 Explicitly enable Bonsai in the second Blender instance #6092
To cover cases when Bonsai was enabled in current Blender sesssion and user prefs are not saved.
2025-02-03 17:28:48 +05:00
Andrej730 a48d774337 typing 2025-02-03 17:28:47 +05:00
Andrej730 734cd47ea5 black . 2025-02-03 17:28:47 +05:00
Dion Moult 5159a69225 Fix #6070. Button was pointing to the wrong function to confirm/cancel editing an extrusion profile.
Probably a copy paste mistake during the UI refactor.
2025-02-03 23:07:16 +11:00
Dion Moult 2f2072cf7f Fix #6080. Bug where renaming introduced suffixes during bulk reassignment of classes. 2025-02-03 23:00:04 +11:00
Andrej730 8c47f2a72f Fix issue infinitely adding new ports on bim.show_ports #6074 2025-02-03 16:37:51 +05:00
Andrej730 a6632167be system module operators - remove unnecessary ifc operator 2025-02-03 16:37:46 +05:00
Andrej730 12d1fd221d Clean up orphaned curves creating new elevation/section annotations 2025-02-03 13:45:54 +05:00
Andrej730 10642618e5 Fix error entering item mode for elevation/section annotations #6081 2025-02-03 13:45:54 +05:00
Andrej730 be4f6ac222 small fix for 3eaf4367ad 2025-02-03 12:45:05 +05:00
Andrej730 3eaf4367ad Fix #6082 2025-02-03 12:40:36 +05:00
Andrej730 305b4c27b5 fix a typo 2025-02-03 11:45:41 +05:00
Andrej730 b56f2d7514 black . - ignore simple_spf submodule 2025-02-03 11:43:08 +05:00
Andrej730 cf026dccc2 bump ios build #5987 2025-02-03 11:43:08 +05:00
Dion Moult c5185aaf54 Fix #6085. Failing unit test. 2025-02-03 16:33:04 +11:00
Dion Moult 50ed756353 Found out layer names don't exist in IFC2X3 that's incredible 2025-02-03 16:04:56 +11:00
tim 0f0578e1c5 Geographic Element Tool (#6089)
New icon tool for adding landscape elements

Co-authored-by: tim <tjrhyder@gmail.com>
2025-02-03 15:38:10 +11:00
Herlianto 0d086fda33 delete unused import (#6093) 2025-02-03 15:35:55 +11:00
Dion Moult f3f7510b48 Fix #6087. (again)
I don't know why depress was used. To make it colour in blue?
2025-02-03 12:36:18 +11:00
Thomas Krijnen b2a4529904 Don't fail on empty build deps cache #6054 2025-02-02 10:00:56 +01:00
Thomas Krijnen 7de50ff0c5 Don't fail on empty build deps cache #6054 2025-02-02 09:46:13 +01:00
Thomas Krijnen 7b0a7e51bb Try 'Build IfcOpenShell Linux ARM' workflow #6054 2025-02-02 09:35:15 +01:00
Thomas Krijnen 507d13363d delete obsolete files 2025-02-02 09:21:01 +01:00
Thomas Krijnen 9713b06d75 delete obsolete files 2025-02-02 09:01:24 +01:00
Dion Moult be6a4de6f0 Fix #6087. High CPU usage due to function in draw call.
I assume this is the problem.
2025-02-02 17:05:56 +11:00
Dion Moult ea85a4247a Fix #6079. Regression in editing space boundaries due to leftover line in commit. 2025-02-01 16:42:06 +11:00
tim f377d794a0 Unify icon modes to work with default Blender Light theme (#6078)
Force the color of the icons in the Properties-Scene tab to match Regular Text
Use the icon display mode function to detect where to use dm_ifc.png or lm_ifc.png

Co-authored-by: tim <tjrhyder@gmail.com>
2025-02-01 16:18:48 +11:00
tim 16d077f1cb Rename dm_IFC.png to dm_ifc.png (#6076)
renaming to lowercase to match lm_ifc presidents.
2025-02-01 16:18:26 +11:00
Dion Moult 3f62f72f35 See #2981. First attempt at having the door generator also do shape aspects, material constituents, and styles all simultaneously 2025-02-01 16:15:58 +11:00
Dion Moult dc79e9e005 More utility functions to jump between representations, styles, and shape aspects
It's a bit uncertain where these belong best, we'll find out over time
2025-02-01 16:11:37 +11:00
Dion Moult d25f57ec40 See #2981. Adding a door representation now also adds associated shape aspects
It doesn't add materials though, that's a separate responsibility right
now
2025-02-01 16:02:57 +11:00
Dion Moult 9f93779ac2 Adding set items can now specify a name at creation for convenience 2025-02-01 16:00:43 +11:00
Dion Moult 8436817408 Update incorrect docs and raise suspicion about how shape aspect styles are assigned 2025-02-01 15:55:34 +11:00
Dion Moult 1a98504328 Fix bug and typo where getting shape aspects for non-geometric types (e.g. walls) would fail
This caused an error when updating a style of a material used in a wall
type
2025-02-01 15:54:57 +11:00
Bruno Postle 1680c3135a Update to latest ifcmerge on Windows
Handle missing IfcRelationship - eg. if all sofas are deleted the
IfcRelDefinesByType is deleted too, but we reincarnate as an empty list
so it can be merged.

Sanity check internal graph - If an entity is deleted in one branch but
has a new usage in another branch, merging would break the graph leaving
a dangling reference. ie.  now you can't delete types, materials etc..
in one branch while using them for new objects in another and still
expect the merge to succeed.
2025-01-31 15:05:34 +00:00
Dion Moult 79e4ba5b19 New usecase to add shape aspect with tests 2025-02-01 00:46:00 +11:00
Andrej730 d6d1f7714f black . to ignore ifcconvert's cityjson submodule 2025-01-31 18:21:23 +05:00
Andrej730 68543c7f05 Simplify types used in debug module express methods #6071 2025-01-31 18:21:14 +05:00
Andrej730 135655f8a0 bim.add_pset - remove unnecessary ifc operator 2025-01-31 17:12:32 +05:00
Andrej730 df49356104 Support adding a new IfcProjectLibrary from UI
Example - https://imgur.com/a/NUQkvHf
2025-01-31 17:12:31 +05:00
Andrej730 04bcf8e2a9 Fix error switching between libraries 2025-01-31 17:12:31 +05:00
Andrej730 9f17ec5bf5 Support editing project library attributes
Example - https://imgur.com/a/MFtLDlh
2025-01-31 17:12:31 +05:00
Andrej730 67aa8f1413 Update project library enum on changing library file 2025-01-31 17:12:31 +05:00
Andrej730 8469d10c85 Project library UI - make filter optional and allow assigning to different libraries 2025-01-31 17:12:31 +05:00
Andrej730 87cbc66c99 typing 2025-01-31 17:12:31 +05:00
Andrej730 c2ae3dcb08 append_asset - extend existing rels matching them by project guid
Mentioned in #6039
2025-01-31 17:12:31 +05:00
Andrej730 089f15a5cc fix a typo 2025-01-31 15:06:37 +05:00
Thomas Krijnen 919df92888 Virtual inheritance configurable at codegen time 2025-01-30 13:12:42 +01:00
Andrej730 553872ced2 append_asset - fix issue appending elements that have as_entity() -> None #6037 #6039 2025-01-30 16:06:19 +05:00
Andrej730 bc33cb6391 append_asset - remove unnecessary partial 2025-01-30 16:06:19 +05:00
Dion Moult d010d4e1b5 Fix #6067. Bug where adding a door ignored the Z offset option. 2025-01-30 19:52:33 +11:00
Andrej730 af29f264a8 Show info message when trying to edit presentation layer and project has no layers #6051
Instead of the error.
Also fix a bug with update callback was attached to the wrong prop.
2025-01-30 13:42:01 +05:00
Dion Moult 2570864f58 Fix #6066. Bug where spatial manager didn't toggle visibility correctly for spaces.
Previously I was only toggling Blender collections which is an
optimisation for large projects but will result in incorrect behaviour
if things aren't in the collection you think they're in. So for now it's
slower but more correct. We can optimise it later.
2025-01-30 19:17:12 +11:00
Dion Moult 2ad48aba36 Fix bug where download CSV icon would disappear on web interface after refreshing table data 2025-01-30 18:55:05 +11:00
Dion Moult 4e17a2d6de The shape builder can now create half space solids for convenience 2025-01-30 18:44:38 +11:00
Dion Moult eaaec4a12d Fix ridiculous bug where util.element.get_container didn't consider all parents and therefore didn't correctly contain feature elements in the spatial hierarchy 2025-01-30 18:44:27 +11:00
Dion Moult abec29af7f Fix attribute tests. Turns out latest pytest-bdd is stricter when parsing feature files and fails when encountering our blank demo tutorial file. 2025-01-30 17:59:13 +11:00
Dion Moult 838e22d27c Fix #6060. Updating long name in spatial manager now also edits attribute for convenience.
Editing attributes now also refreshes the spatial manager (i.e. vice
versa), and so does bulk attribute copying.
2025-01-30 17:47:29 +11:00
Dion Moult 8f78fe56de Prevent copying globalids to selected objects as it makes no sense 2025-01-30 17:46:23 +11:00
Andrej730 e435863500 Fix missing pset templates after 5e93097 #6049 2025-01-30 11:30:52 +05:00
Dion Moult 15d43e9166 Fix bug where spatial object may not exist when renaming from the spatial tree (e.g. partial loads), and also refresh UI (to see updated attributes) 2025-01-30 17:07:57 +11:00
Dion Moult 1768026891 Fix #5854. Update docs with new IOS v0.8 settings. 2025-01-30 15:32:14 +11:00
sboddy d6443e46f6 Update debugging guide to deal with MS's Marketplace changes. (#6035) 2025-01-30 08:08:28 +11:00
tim 77722fcf89 New Tools (#5983)
* New tools wip

- New icons: Opening, Furniture, Roof, Railing
- New groupings
- New tools: Opening tools (not working), Furniture (needs default), Roof
- New defaults: Railing, Roof (Hip Roof doesn't work)

* WIP on (no branch)

* Railing icon fixed

* New icons added, old icons tweaked

* Working version

* Just updating some wip - not ready for review yet

* Tool icon update

- New: pile, plate, ramp, ramp flight, stair, stair flight, roof, railing, footing, member, curtain wall
- Updated: wall, window, door, cable
- Expanded tool descriptions to include predefined types
- Added relevant default types
- Revised tool grouping

* IfcStairType and IfcRampType icon's removed

* Curtain wall removed

---------

Co-authored-by: tim <tjrhyder@gmail.com>
2025-01-30 08:07:54 +11:00
Thomas Krijnen 241329325d Update ci.yml - 22.04 2025-01-29 20:10:19 +01:00
Bruno Perdigão 2e70544bb8 Adjust offset in "change_extrusion_x_angle" to maintain position relative to the slab's top face. 2025-01-29 14:01:23 -03:00
Bruno Perdigão 03267a441a Fix #6058 2025-01-29 14:01:23 -03:00
Kipre 4bee713455 Fix transform matrix computation in Axis2Placement3D 2025-01-29 15:37:59 +01:00
Andrej730 1d6e560b4f Change entire material category name from UI #6061
Example - https://imgur.com/a/LJUkC2l
2025-01-29 18:16:05 +05:00
Andrej730 71a6ad8cb0 Display assets count for the loaded library
Example - https://imgur.com/a/yZTkZgu
2025-01-29 18:16:05 +05:00
Andrej730 83d7cda26b Select IfcProjectLibrary to display for the loaded library
Example - https://imgur.com/a/14LOL0J
2025-01-29 18:16:05 +05:00
Andrej730 8bddde49a2 Hide assign/unassign library declaration button for elements that cannot be declared
E.g. IfcMaterials, IfcProfileDefs
2025-01-29 18:16:05 +05:00
Andrej730 909a7ad7a2 Project libraries UI - use cached project library data
instead of accessing IFC directly on every draw call
2025-01-29 18:16:05 +05:00
Andrej730 c9da643fe1 typing 2025-01-29 18:16:04 +05:00
Andrej730 0599138bca Fix #6050 after 5e93097 2025-01-29 17:25:30 +05:00
Andrej730 871710a0aa Fix remove_representation error #6059
After to_delete was explicitly added as an attribute to ifcopenshell.file (previously it was kind of hacky assigned during batch remove).
2025-01-29 16:02:50 +05:00
Andrej730 85e0fa9147 assign/unassign layer - mention representations 2025-01-29 16:02:50 +05:00
Dion Moult 5d3dc84556 Tabbing now works consistently on all elements including those with usage
This means that seeing the extrusion type graphically is now possible,
adding booleans is now through a consistent interface. It's still
possible to immediately edit the axis via Alt-E and profile via Shift-E.
This helps consoliate code too.
2025-01-29 21:38:01 +11:00
Dion Moult a9abf1e993 Forgot to remove these mentions
Still need to update tests
2025-01-29 21:32:26 +11:00
Dion Moult c2b00e09cf Remove elements menu and purge the "potential" openings feature as this is now properly integrated in the new element menu 2025-01-29 19:55:42 +11:00
Dion Moult 121af475a7 The collector should be responsible for handling global fixed display settings too perhaps 2025-01-29 19:54:25 +11:00
Dion Moult 424cd96fef Add warning that api.run is deprecated 2025-01-29 19:53:50 +11:00
Bruno Postle 84392f1457 Typo: strucutural > structural 2025-01-28 21:20:20 +00:00
raj-open 1b3b74127a guid-stdlibs > v0.8.0: linting 2025-01-28 21:46:34 +01:00
raj-open 85308133e2 guid-stdlibs > v0.8.0: added unit tests
NOTE: added in prefix-cases post PR review
2025-01-28 21:46:34 +01:00
raj-open 64a027cfba guid-stdlibs > v0.8.0: linting 2025-01-28 21:46:34 +01:00
raj-open 285c4bff67 guid-stdlibs > v0.8.0: used underlying base64-to-hex to speed up computations
NOTE: The conversions remain exactly as before. But by using standard libraries for conversion, we clean up computations.
2025-01-28 21:46:34 +01:00
Bruno Perdigão c2c2d2d8f3 Revert 87c7309724. I misunderstood the expected behavior. 2025-01-28 17:37:20 -03:00
Bruno Perdigão 87c7309724 See #5938. Fix bug where x_angle where changing the wall thickness. 2025-01-28 16:28:23 -03:00
Bruno Perdigão d9903e93f2 See #5938. This commit starts fixing this issue by:
- Fix wall decorator with obtuse angles.
- Preventing slabs from using obtuse angles, for now.
2025-01-28 16:10:17 -03:00
Andrej730 ab0549daa6 Support editing representation's presentation layers from UI
Example - https://imgur.com/a/QgtSUoq
2025-01-28 17:22:26 +05:00
Andrej730 f43e33b969 apped_asset - fix passed removed elements after 3ffc0bc #6044
Before 3ffc0bc checking identities were handled by file.add but now it's handled append_asset, therefore should be a way to clean removed entities.
2025-01-28 17:22:26 +05:00
Andrej730 cc014e9792 Change message when no object queries in a linked model
to give a hint for new users
2025-01-28 17:22:26 +05:00
Andrej730 c0306fc729 typing 2025-01-28 17:22:26 +05:00
Andrej730 7b94a8d1f5 black . 2025-01-28 17:22:25 +05:00
Andrej730 7bfe844d53 Rename void to feature in code 03bfd828e2 2025-01-28 15:23:43 +05:00
Andrej730 23648ef221 remove duplicated add_feature method
It was moved to feature module in 03bfd828e2
2025-01-28 15:23:43 +05:00
Dion Moult 693244e20e Fix bug in SetFalseOrigin which incorrectly handled z height and also add ability to handle non-mapconversion based transformations.
I can't believe I accidentally left out the minus sign. The ability to
handle simple remapping of location A --> B is useful for software that
doesn't support map conversion properly.
2025-01-28 17:33:15 +11:00
Dion Moult 03bfd828e2 See #5919. API now has support for features, not just openings. Void module is renamed to feature. 2025-01-28 14:18:17 +11:00
Dion Moult 5300f4c78f Fix failing tests 2025-01-28 10:54:37 +11:00
Dion Moult 8e29e7cdee Be a bit more forgiving in calculate unit scale to not glitch out on models with no project.
It's technically invalid but useful for small snippets.
2025-01-28 10:46:24 +11:00
Dion Moult 6e0954e855 Purge constants file that came from PR. 2025-01-28 10:45:54 +11:00
Dion Moult 4d052ba864 Fix bug where decorator had errors if the 3D location was outside the 2D window.
Checking for none for `location_3d_to_region_2d` should always be done.
2025-01-28 10:33:08 +11:00
Bruno Perdigão 562c32b96e Fix issue where area measurement lines where not showing correctly. 2025-01-27 18:58:02 -03:00
Bruno Perdigão 818ad536af Small fix after a4a52d6576 2025-01-27 18:49:19 -03:00
Bruno Perdigão a4a52d6576 Make slab's editing profile to horizontal orientation when x_angle is present. 2025-01-27 15:16:22 -03:00
Bruno Perdigão 47b2a00614 Fix Z location for wall axis decorator 2025-01-27 10:59:21 -03:00
Andrej730 ff4d3adf0b Select Layer In Layers UI
Example - https://imgur.com/a/bXctIxc
2025-01-27 17:41:32 +05:00
Andrej730 13a182cd95 Representation Items UI - support editing layers
Example - https://imgur.com/a/3fn051N
2025-01-27 17:41:31 +05:00
Andrej730 56af23b89f revert possible empty layer names in ui 2025-01-27 17:41:31 +05:00
Andrej730 605cf8d99a Styles UI - add indicator for currently edited style
Example - https://i.imgur.com/YT0a63S.png
2025-01-27 17:41:31 +05:00
Andrej730 744487c786 fix test_element after 7b62b03 2025-01-27 17:41:31 +05:00
Andrej730 b735ce74ad Bonsai - Select By Profile operator
Location - https://imgur.com/a/gInY1sl
2025-01-27 17:41:31 +05:00
Andrej730 5fe77b659a ifcopenshell.util.element.get_elements_by_profile 2025-01-27 17:41:31 +05:00
Andrej730 e71a220f21 typing 2025-01-27 17:41:30 +05:00
Andrej730 5bd24b2760 Enable pset template prop editing on adding a new one #6019 2025-01-27 17:41:30 +05:00
Andrej730 14a792a1e7 Enable pset template editing on adding a new one #6019 2025-01-27 17:41:30 +05:00
Andrej730 7b4fa6b5c0 black . 2025-01-27 17:41:30 +05:00
Gorgious56 378086ac7b Fix bug when trying to delete an opening object that was already deleted 2025-01-27 12:56:27 +01:00
Dion Moult c4dbbe85fc Fix bug where library wasn't actually removed when unlinking an IFC.
Previously the collection and scene object was removed, but this is
obviously not sufficient since the bpy.data.library still exists (which
meant that if you relinked it, regardless of your cache setting, it'd
just load the existing Blender file which is completely useless).
2025-01-27 20:41:26 +11:00
Dion Moult 559db259a3 See #6030. Add isolate, show, and hide operators to group manager. 2025-01-27 17:14:13 +11:00
Dion Moult 3582dc43d9 Add tests for PR #5257 (using cache for fetching units) 2025-01-27 14:40:15 +11:00
Dion Moult c0aaebcbe9 Fix bug where assigning units didn't necessarily assign to the project, and also didn't overwrite existing units of the same type. 2025-01-27 14:23:02 +11:00
Dion Moult 4af6c24314 Completely untested refactor of #5257.
Removes dependency of file to util (util should depend on file, not vice
versa). Removes auxiliary method.
2025-01-26 21:11:11 +11:00
Dion Moult ecd72912aa Purge constants from PR #5257.
I'm not sure I agree here, considering that types are dynamic based on
schema version.
2025-01-26 19:07:02 +11:00
Raj 124c02897c Feature faster unit method ---> Main (#5257)
* feature_faster_unit_method > main: added constants

* feature_faster_unit_method > main: extended `file` class to dynamically save unit information

* feature_faster_unit_method > main: refactored `get_property_unit` method

1. split out case that returns the wrong type (dictionary of units) into its own method

2. cleaned up (but preserved) logic

3. refactored common part of all cases (the method which prioritises unit then value-entity then measure_class)

---------

Co-authored-by: raj-open <raj-open@users.noreply.github.com>
Co-authored-by: Dion Moult <dion@thinkmoult.com>
2025-01-26 19:04:49 +11:00
Raj 3b1e893d34 Linting-Workflow ---> v0.8.0 | Make wf only fail on syntax errors instead of unformatted code (#6041)
* linting-workflow > v0.8.0: make QA only throw warning instead of error on unprettified code with no syntax errors

Without a Linting policy, the workflow should only fail if code base contains syntax errors.

* linting-workflow > v0.8.0: better logging

* linting-workflow > v0.8.0: changed instruction to notice-type

---------

Co-authored-by: raj-open <raj-open@users.noreply.github.com>
2025-01-26 18:54:46 +11:00
Bruno Perdigão 2b1a59a4f8 Refactor how offset and direction sense interact for wall and slabs. 2025-01-25 16:05:04 -03:00
Dion Moult c49ca699eb Forgot to commit new feature tool 2025-01-25 21:39:54 +11:00
Dion Moult 75c6505121 See #5919. You can now add openings through "Add Element" just like everything else.
This means that openings can (and default to) start with extrusions. It
also starts to open up the possibility to add other types of feature
elements. Still really incomplete.
2025-01-25 20:43:08 +11:00
Dion Moult 2c531501c3 Fix #5614. Fix bug where removing an object that had voids showing didn't also remove the voids. 2025-01-25 16:36:57 +11:00
Dion Moult eab527e7a2 Fix #6033. Add tools for generate slab from wall and vice versa in the toolbox. Still needs a nice icon. 2025-01-25 15:59:11 +11:00
Dion Moult 83368d7ee1 Fix #6014. Incorrect units used for position matrix when detecting profiles. Fix by @brunoperdigao 2025-01-25 15:20:01 +11:00
Dion Moult 38835a4092 See #6030. You can now select elements in groups recursively. 2025-01-25 14:11:42 +11:00
Dion Moult a2a4da596f Fix #6030. Consolidate group management into single UI and allow for bulk assign / unassign. 2025-01-25 14:01:56 +11:00
Bruno Perdigão 5fbb496818 Improve wall axis decorator.
- Blue: base
- White: side
- Green: reference
- Arrow: direction
See: https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcMaterialLayerSetUsage.htm
2025-01-24 16:46:03 -03:00
Bruno Perdigão 8b3bf8200f Add wall and slab regeneration when editing layer set usage, after 755d178b6b 2025-01-24 16:36:24 -03:00
Andrej730 fbab13339c set_material_name to prevent triggering name callback if it's not necessary 2025-01-24 18:45:14 +05:00
Andrej730 57150e9f63 deprecate style.edit_presentation_style listener 2025-01-24 18:45:14 +05:00
Andrej730 e4ded8c477 Fix editing IfcSurfaceStyle attributes
Apparently it was broken for a while now...
2025-01-24 18:45:14 +05:00
Andrej730 d21c24b070 Bonsai - support editing IfcPresentationLayerWithStyle attributes
Example - https://imgur.com/a/JRs8RZm
2025-01-24 18:45:13 +05:00
Andrej730 e3ea12a517 Reuse export_attributes for layers, groups, constraints, classifications 2025-01-24 18:45:13 +05:00
Andrej730 60f8044820 Support adding IfcPresentationLayerWithStyle from UI
Example - https://i.imgur.com/0mssU2s.png
2025-01-24 18:45:13 +05:00
Andrej730 d5b1b6f66a Reuse draw_attributes for groups, layers, structures and systems 2025-01-24 18:45:13 +05:00
Andrej730 f3fc55f246 Change <logical> primitive data type from bool to enum
As it also has a third value "UNKNOWN" which has it's own meanig in IFC and therefore IfcLogical cannot be represented by simple booleans.

Example in Bonsai - https://i.imgur.com/xuPMcwA.png
2025-01-24 18:45:13 +05:00
Andrej730 d37caedda7 layer.add_layer_with_style 2025-01-24 18:45:12 +05:00
Andrej730 d1082897b1 bim.select_representation_item - add poll message 2025-01-24 18:45:12 +05:00
Andrej730 c12636f4cc black . 2025-01-24 18:45:12 +05:00
Andrej730 35d20e649d button to open pset templates user folder
to make it more discoverable

Example - https://i.imgur.com/BKN3rkj.png
2025-01-24 12:57:41 +05:00
Andrej730 5c7bea6dea bim.open_path - utility operator 2025-01-24 12:57:40 +05:00
Andrej730 d979c6a044 bim.open_uri - display url in description 2025-01-24 12:57:40 +05:00
Andrej730 65f2da4beb Fix creating pset templates after 5e930972d6 #6017 2025-01-24 12:34:36 +05:00
Dion Moult 755d178b6b Fix bug where adding / removing layers never triggered a regeneration of walls.
Continue our slow, ongoing purge of listeners.
2025-01-24 17:28:45 +11:00
Dion Moult f1187e33d9 Don't show IFC product selection in the type manager since it's assumed to be IfcElementType from context 2025-01-24 16:36:07 +11:00
Dion Moult 2ec7882c57 Fix #6034. Boundary module now uses the collector tool like everything else. 2025-01-24 09:57:33 +11:00
Dion Moult 1083651d0a Bump IOS back up to 2024-12-14 2025-01-24 09:49:44 +11:00
Dion Moult 03bd34d98c Workaround for speed regression in advanced brep models. See #5999. 2025-01-24 09:47:17 +11:00
Bruno Perdigão fa174feaae Refactor wall offset and direction after f724bb692 2025-01-23 15:33:39 -03:00
Bruno Perdigão 5ec5594c69 Polyline slab tool - You can now change offset and direction
As it was implemented in Polyline wall tool, the user can press "O" to
change offset and "F" to flip the direction
2025-01-23 15:33:39 -03:00
Bruno Perdigão 4f77df99a5 Add slab preview decorator 2025-01-23 15:33:39 -03:00
Thomas Krijnen fa191e44f2 cgal kernel: Move orientation logic #5987 2025-01-23 16:35:51 +01:00
Thomas Krijnen 638b2c59ea Catch string encoding errors and set status #5992 2025-01-23 16:20:06 +01:00
Bruno Perdigão 4aff6ac842 Fix profile tool after 8b678309f 2025-01-23 11:21:29 -03:00
Andrej730 f67e3f35c7 Fix error tabbing into point cloud representations 2025-01-23 18:14:17 +05:00
Andrej730 1ea6d2a194 Add IfcStructuralPointConnection to reimport_element_representations 2025-01-23 18:14:17 +05:00
Andrej730 3c96ad2965 Fix error tabbing into IfcStructuralPointConnections 2025-01-23 18:14:17 +05:00
Andrej730 4ee8176654 Bonsai to display units for force measure props
Example - https://i.imgur.com/EhcyIxp.png
2025-01-23 18:14:17 +05:00
Andrej730 4717dffcdc Bonsai - assign/unassign structural model for all selected elements 2025-01-23 18:14:17 +05:00
Andrej730 3eeb58dded assign_structural_analysis_model to support batching 2025-01-23 18:14:17 +05:00
Andrej730 70f17c2094 Structural operators - remove unnecessary Ifc Operators 2025-01-23 18:14:17 +05:00
Andrej730 2e71765f4f Fix structural operator names for consistency with Blender naming 2025-01-23 18:14:16 +05:00
Andrej730 582476cabe Fix LoadGroupDecorationData data item name for consistency 2025-01-23 18:14:16 +05:00
Andrej730 8f9417a59a Fix UI errors in Structural Analysis panel when project has no IfcStructuralAnalysisModel 2025-01-23 18:14:16 +05:00
Andrej730 e18475e1ef Use cancel icon for disabling operators for consistency 2025-01-23 18:14:16 +05:00
Andrej730 d38608ea04 Fix UI errors with not unset active library id after disabling editing
It lead to UI errors when library was removed and Bonsai was still trying to get it from active_library_id.
2025-01-23 18:14:16 +05:00
Andrej730 42d01ac222 Fix append_asset conversion issue after 3ffc0bc #6012
Custom file.add wasn't considering IfcLengthMeasure attributes...
2025-01-23 18:14:16 +05:00
Andrej730 5bc91ec4e4 append_asset - fix bug identifying None profiles as equivalent 2025-01-23 18:14:16 +05:00
Andrej730 ad99990f17 typing 2025-01-23 18:14:15 +05:00
Andrej730 8dce7b9f68 black . 2025-01-23 18:14:15 +05:00
Bruno Perdigão d8342134a0 Wall polyline tool - refactor offset functionality 2025-01-23 09:31:28 -03:00
Bruno Perdigão 8b678309fd Refactor polyline tool instructions.
Follows 8fc0d7a808
2025-01-23 09:31:28 -03:00
Bruno Perdigão 88dc9d7633 Enable "shift + mouse wheel" to function before locking angle. 2025-01-23 09:31:28 -03:00
Bruno Perdigão 09dbae7c56 Replace hard-coded unit scale with ifcopenshell.util.unit.calculate_unit_scale 2025-01-23 09:31:28 -03:00
Dion Moult c6b64baccb Fix #6028. Deprecate schema dir as it's basically just data. 2025-01-23 23:10:40 +11:00
Dion Moult 15bc968179 Remove dead code from schema.py
Slowly getting to a point where we can completely delete this legacy
file.
2025-01-23 22:59:41 +11:00
Dion Moult b7e4904905 Change gitkeep into gitignore and move ignore up to root gitignore
I kept on getting confused on why things were being ignored in the data
dir and didn't know where to look.
2025-01-23 22:48:25 +11:00
Kipre 039b7ef4ca Fix issue with eliminate_touching_operands 2025-01-23 11:23:34 +01:00
Dion Moult e2f10a5784 Minor UI improvement to keep the right alignment of total elements in the material manager 2025-01-23 20:54:43 +11:00
Dion Moult adff44febd Snaps are on by default
Users can still turn them off. We are a precision modeling app after all
:)
2025-01-23 20:44:20 +11:00
Dion Moult 35d2791657 Fix warning when aggregate decorator cannot be drawn on the screen. 2025-01-23 20:29:21 +11:00
Scott Lecher a7a9fcc73a adds calculations for projected_length of gradient curve segments (#6006) 2025-01-22 15:37:29 -08:00
Andrej730 5c3045b4db Temporarily disable 3ffc0bc due to a bug with units conversion 2025-01-22 20:45:06 +05:00
Andrej730 b812d21282 Fix non-existent name argument in add_si_unit docs 2025-01-22 19:07:44 +05:00
Andrej730 083aa4da85 Fix error after 5e93097 2025-01-22 19:07:44 +05:00
Andrej730 605a29786c Fix tests after 7b62b03
Since calculate_unit_scale now requires a project.

    def calculate_unit_scale(ifc_file: ifcopenshell.file, unit_type: str = "LENGTHUNIT") -> float:
        """Returns a unit scale factor to convert to and from IFC project units and SI units.

        Example:

        .. code:: python

            ifc_project_length * unit_scale = si_meters
            si_meters / unit_scale = ifc_project_length

        :param ifc_file: The IFC file.
        :param unit_type: The type of SI unit, defaults to "LENGTHUNIT"
        :returns: The scale factor
        """
>       if not (units := ifc_file.by_type("IfcProject")[0].UnitsInContext):
E       IndexError: list index out of range
2025-01-22 18:24:52 +05:00
Dion Moult 3dfc7097b2 Fix #6013. Fix bug where Blender object names weren't updated when using copy attributes. 2025-01-22 22:54:58 +11:00
Andrej730 4adca79301 Fix edit_attributes triggering name_callback and adding indices to names #6013
It was triggering name_callback, adding indices to the names and writing the name with index to ifc.

Also now check previous and new object name explicitly instead of relying on `obj.name` as it may have Blender indices (Blender doesn't support multiple objects sharing the same name).
2025-01-22 16:35:23 +05:00
Andrej730 a8672bc5cb root.set_object_name to reuse loader.get_name 2025-01-22 16:35:23 +05:00
Andrej730 882bacf91a bim.copy_attribute_to_selection - add info message
It's important to have somewhere information on how many elements were actually affected since some of the selected objects may not support the used attribute.

Example - https://i.imgur.com/UrLNWcF.png
2025-01-22 16:35:23 +05:00
Andrej730 23a6721f8e Fix bim.copy_attribute_to_selection missing undo 2025-01-22 16:35:23 +05:00
Andrej730 db93ca1067 bim.inspect_from_object - support representation items 2025-01-22 16:35:22 +05:00
Andrej730 f02fd69934 Bonsai - deprecate bpy.app.version checks
As we support only Blender 4.2+
2025-01-22 16:35:22 +05:00
Andrej730 74a9669fa8 Fix error tabbing into IfcRevolvedAreaSolid with a boolean + add resolve_base_items
resolve_items couldn't find IfcRevolvedAreaSolid inside a boolean result
2025-01-22 16:35:22 +05:00
Andrej730 6ce4b5d0e8 Fix error selecting boolean (RepresentationItemObject missing ifc_definition_id) 2025-01-22 16:35:22 +05:00
Andrej730 391091ad12 typing 2025-01-22 16:34:58 +05:00
Andrej730 a774a75509 black . 2025-01-22 16:00:11 +05:00
Andrej730 06f25b9846 bim.select_boolean - fix operator name 2025-01-22 11:50:49 +05:00
Andrej730 b752f798bd bim.enable_editing_booleans - add poll message 2025-01-22 11:50:48 +05:00
Andrej730 5ca615114f Also support changing profile for other sweptsolids
E.g. changing it for IfcRevolvedAreaSolid - https://imgur.com/a/jHOC8rt
2025-01-22 11:50:48 +05:00
Bruno Perdigão c72f17068c Add support for direction sense and offset in slabs with x_angle 2025-01-21 10:49:29 -03:00
Bruno Perdigão 372654267c Fix issues with add/remove layer handler when using "Quick Create Type". 2025-01-21 10:49:29 -03:00
Bruno Perdigão 5cf4740f8e Add direction sense and offset support for slabs 2025-01-21 10:49:29 -03:00
Bruno Perdigão 3740b86678 Add handlers to update layer when adding and removing material layer 2025-01-21 10:49:29 -03:00
Bruno Perdigão 325d6138d3 Add more options to Bonsai snap target. Follow 5649708ca4 2025-01-21 10:10:57 -03:00
Gorgious56 fc58b1769c Improve logic for https://github.com/IfcOpenShell/IfcOpenShell/commit/bced62bd5c6615ec1ff8c3a6af3334e469e5f9fa 2025-01-21 13:56:32 +01:00
Dion Moult 82fbec68d1 Fix #5973. You can now select the item from the item panel. 2025-01-21 23:52:33 +11:00
Andrej730 bb1ec569bc Option to name existing used unnamed profiles
Example - https://imgur.com/a/IhMbs6K
2025-01-21 17:31:21 +05:00
Andrej730 5a766e79bd Show error message trying to edit not supported type of profile
E.g. previously if you would tab into editing IfcExtrudedAreaSolid that was using not supported profile type (e.g. IFCCSHAPEPROFILEDEF) it would import it as empty geometry and tabbing out then would save it corrupting the original profile. Now there is an error message that it's not yet supported - https://i.imgur.com/NzksYVP.png
2025-01-21 17:31:21 +05:00
Andrej730 ff337bc849 Change currently edited item's profile
Example - https://imgur.com/a/2yiVIW5
2025-01-21 17:31:20 +05:00
Andrej730 992424c748 Update item decorator when moving item in viewport
Before this fix - https://imgur.com/a/mhpBvCG
2025-01-21 17:31:20 +05:00
Andrej730 0268f140ad typing 2025-01-21 17:31:20 +05:00
Andrej730 59c0719b03 black . 2025-01-21 17:31:20 +05:00
Andrej730 c91fbc4d40 Setup user data dir
Create some empty folders in the user data directory to hint the user.
2025-01-21 17:30:38 +05:00
Gorgious56 bced62bd5c When switching between ElementType and Element, keep the same class and predefined type if possible 2025-01-21 13:29:25 +01:00
Dion Moult b809bc89f0 See #5973. Representation items UI now works in item mode. 2025-01-21 23:28:33 +11:00
Dion Moult 2452b1be50 See #5973. Only show shape aspect attributes if creating a new shape aspect to make it clearer how to use the UI.
Previously the UI for creating new aspects and reusing an existing
aspect showed simultaneously which was confusing.
2025-01-21 23:21:07 +11:00
John Yani 7de8427a28 [Bonsai docs] Update version switching logic (#6005)
* Create brand.html

* Update custom.css for version switcher

* Update brand.html

* Update brand.html

Improve select box logic
2025-01-21 11:06:24 +11:00
John Yani ee0adf2fff [Bonsai docs] Add version switcher to sidebar and update custom styles (#6004)
* Create brand.html

* Update custom.css for version switcher

* Update brand.html
2025-01-21 10:24:53 +11:00
John Yani 2ce420ef6f Follow up #5994 (#6003)
* Create docs-deployment.yml

* Update docs-deployment.yml

Add CNAME

* Update docs-deployment.yml

* Create docs-deployment-unstable.yml

* Add requirements.txt

* Change trigger branch
2025-01-21 08:45:39 +11:00
Bruno Perdigão 290849d43a Fix snap to axis after 5649708ca 2025-01-20 14:59:04 -03:00
Andrej730 5e930972d6 User 'data' folder #5564
Bonsai now creates a user data folder that allows you overriding Bonsai data files. E.g. you can put you own `default.css` as `data/assets/default.css` in that folder and it will override the `default.css` Bonsai is using for the drawings. Previously you could have change internal `default.css` but Bonsai would always restore the original one on every update / reinstallation.

You can also store your .ifc files in data/libraries or data/templates and Bonsai will ensure they're loaded and you won't need to worry about Bonsai removing them later.

E.g. on Windows this path is `C:\Users\xxx\AppData\Roaming\bonsai\bonsai\data`/

You can also find path in the preferences - https://i.imgur.com/kwMc0JU.png
2025-01-20 19:32:59 +05:00
Bruno Perdigão c08d25de42 Change Bonsai snap target UI to column. 2025-01-20 11:31:58 -03:00
Bruno Perdigão 5649708ca4 Add support and UI for Bonsai snap target.
The user can now select snap target for Bonsai polyline tool.
The options are shown in the bottom of Blender's Snapping panel.
2025-01-20 10:56:22 -03:00
Bruno Perdigão 9e81a3da17 Rename "Edge-Intersection" to "Edge Intersection" 2025-01-20 10:56:22 -03:00
Bruno Perdigão b509374c27 Add initial curve snapping functionality 2025-01-20 10:56:22 -03:00
Gorgious56 704bb27cf5 You can now user ALT + Click to ensure an object is unlinked from non-IFC collections when assigning a new container 2025-01-20 14:25:55 +01:00
Dion Moult 7b62b035c9 Fix #5964. Only get the unit assignment from the project to prevent ambiguity.
I really don't know why I didn't do this before.
2025-01-20 23:50:03 +11:00
Dion Moult c5fe80db7b Make georeferencing decorator use soft limits. Don't scale font. 2025-01-20 23:48:51 +11:00
Andrej730 3ffc0bc39c append_asset to use custom file.add to prevent duplicating profiles and materials #5925 2025-01-20 16:23:31 +05:00
Andrej730 0a266bba5d Fix #6000 2025-01-20 16:16:39 +05:00
Andrej730 ecf0d255f7 Roll back build from a65aa92 #6001 2025-01-20 16:16:39 +05:00
Andrej730 c0499a2c88 black . 2025-01-20 16:16:38 +05:00
John Yani 3ad247b9a7 Automatic build and deploy bonsai docs on push (#5994)
* Create docs-deployment.yml

* Update docs-deployment.yml

Add CNAME

* Update docs-deployment.yml

* Create docs-deployment-unstable.yml

* Add requirements.txt
2025-01-20 21:13:21 +11:00
Bruno Postle 13b93a9ea8 Move cache_dir from site-packages to local folder (#5856)
Previously cache_dir was located under site-packages, which is managed
by blender and could be read-only. Now location defaults to eg.
~/.cache/bonsai or equivalent location on other platforms. See #5564

Note this adds a dependency on the platformdirs python module
2025-01-20 13:14:51 +05:00
Dion Moult ebdfe2bccd Fix #5319. Workaround for upstream bpypolyskel bug where dormer ridges were not flat. 2025-01-20 17:17:37 +11:00
Dion Moult 942c3fec87 Add missing bin directory 2025-01-20 14:35:50 +11:00
Dion Moult 651c24bbfe See #5799. Fix segfault in upstream Blender when unlinking material objects in specific scenario.
I can't explain this one so I'm pretty embarrassed to commit this, but
it crashes (see situation in #5799) on my machine and I can't recreate
it outside this scenario. In any case I think as a general strategy we
should:

 1. Minimise reliance on msgbus
 2. Msgbus listeners themselves should be wary of invalid state (e.g. if
object is now unlinked)
 3. Not clear listeners (don't overreach)
2025-01-20 14:01:11 +11:00
Dion Moult b2213592ea Fix #5799. Also purge presentation style assignment when purging unused styles. 2025-01-20 13:59:00 +11:00
Dion Moult c311b65af5 See #5799. Allow merging unnamed styles.
Styles are special because their names aren't critically semantic. It's
more to do with the style definition.
2025-01-20 13:58:39 +11:00
Dion Moult e8b097e2cb See #5799. Remove slow / unnecessary material criticals that also have a risk of crashing
In general Blender on my machine at least sometimes has huge lag with
material previews.
2025-01-20 13:57:07 +11:00
Dion Moult 193ff1cd0c Mention builds website in docs. 2025-01-20 12:15:49 +11:00
Dion Moult a65aa92c87 See #5999. Revert to older bot build before speed regression. 2025-01-20 12:15:36 +11:00
Dion Moult 6af19bc98d Fix 3x slower major speed regression introduced in 98a9550260
The commit that introduced the problem was trying to optimise rendering
dense meshes with the opening decorator. However, it introduced more
calculation in the initial project load and stored more data on every
object. This resulted in models loading 3x slower for me which is pretty
major. The original problem needs further investigation.
2025-01-20 11:24:19 +11:00
Dion Moult 5769c0d442 Fix #5754. Cosmetic bug where UI was not refreshed when using advanced mode causing incomplete decorators to be drawn. 2025-01-20 00:25:29 +11:00
Dion Moult 5c058dff3e Fix #5766. Bump IOS. 2025-01-19 21:49:51 +11:00
Dion Moult f86e414055 Forgot to add a placement for new elements which is invalid. 2025-01-19 21:38:52 +11:00
Dion Moult c17febac0c Fix #5996. Bug where getting selected or active objects was not clear.
Sometimes we want to fetch selected objects, and that includes the
active object, even if the active object isn't actually highlighted in
the viewport (albiet rare, I think?).

Conversely sometimes we want to get the active object, even if it isn't
actually highlighted. The tool.Blender functions now have kwargs to
distinguish between these.
2025-01-19 17:17:56 +11:00
Dion Moult 2d811a6786 Fix fetching layers in item mode. Apparently the inverse name changes slightly.
Maybe because an item has a single layer whereas the shape is meant to
have many layers?
2025-01-19 17:09:32 +11:00
Dion Moult 6eed5607c4 Fix #5972. Purge old non-item-based boolean code 2025-01-19 17:09:02 +11:00
Dion Moult 0b46a31c25 Add item menu is now tailored for CSG representations.
I find this a bit of a strange behaviour in IFC. Imagine you start with
a Tessellation representation type. You're only allowed meshy things, no
solid extrusion. And vice versa if you have a SweptSolid representation
type.

Now imagine you suddenly create a boolean. Now, you can mix both
tessellations and solids together.
2025-01-19 16:58:10 +11:00
Dion Moult 4d7f078f8b Ensure item decorator is updated when editing things in item mode. 2025-01-19 16:56:31 +11:00
Dion Moult 046f7cbfd2 See #5972. You can now select booleans recursively. 2025-01-19 13:54:40 +11:00
Bruno Postle 4152641d1f Ensure files in libs/bin are executable
When blender extracts wheels it doesn't preserve executable permissions
2025-01-18 21:17:43 +00:00
Bruno Postle ec55c8183f remove duplicate 'libs' folder
The Bonsai installer contained a 'libs' folder in both the ZIP bundle
and the bonsai wheel, but only the one in the wheel was actually used
2025-01-18 19:59:57 +00:00
Bruno Postle b54741dd0b Merge branch 'v0.8.0' of github.com:IfcOpenShell/IfcOpenShell into v0.8.0 2025-01-18 19:18:15 +00:00
Bruno Postle b4190876b0 Actually put ifcmerge in the linux ZIP installer 2025-01-18 19:16:50 +00:00
Bruno Perdigão 864eeb42e9 Add filling objectcs to OverrideMove 2025-01-18 15:15:54 -03:00
Bruno Perdigão 7fcb7c6433 Allow moving the current aggregate/nest when aggregate/nest mode is active 2025-01-18 12:17:28 -03:00
Bruno Perdigão 015d8f6722 Add nest mode operators to workspace UI. 2025-01-18 12:06:00 -03:00
Bruno Perdigão c07c2d7692 Complement changes from abd05e939a 2025-01-18 11:48:37 -03:00
Dion Moult a57a0eb4eb See #5972. Prioritise clipping results where possible. 2025-01-19 01:09:11 +11:00
Dion Moult e40644c4f6 See #5972. You can now remove boolean operations in the stack without deleting operands. 2025-01-19 01:08:47 +11:00
Dion Moult 8c746b1a2c Validate representation type items when leaving item mode. 2025-01-19 00:30:30 +11:00
Dion Moult 8e98aecc0b Document add boolean API 2025-01-19 00:30:30 +11:00
Bruno Postle 34a2d95524 Bonsai offers to install Git and ifcmerge (#5961)
The ZIP installer now contains a `libs/bin` folder that contains
`ifcmerge`. Bonsai on `register()` adds this folder to the system `PATH`
for the current Blender session. Advantage of this is that we don't have
to fiddle with the registry on windows, or install files to
`~/.local/bin` on Linux, it _should_ work on Darwin, updates are
automatic, and we have a mechanism to ship other executables if
required.

(Note that ifcmerge.exe increases the size of the Windows Bonsai ZIP
download by about 7MB)

If Git isn't installed on Windows, the Git panel now offers to install
it from the Windows Package Manager Community Repository using `winget`.
2025-01-18 10:22:45 +00:00
Dion Moult a12427e44a See #5972. Add tests for adding boolean and check against recursive booleans and invalid boolean items. 2025-01-18 21:13:54 +11:00
Dion Moult 35734f4b67 Guess representation type from items based on where rule
Previously we never implemented this in a very strict way so it was
prone to mistakes.
2025-01-18 18:35:13 +11:00
Dion Moult c54ea1e5d2 Shape builder can now create blocks 2025-01-18 18:34:40 +11:00
Bruno Perdigão abd05e939a Add nest decorator 2025-01-17 23:00:05 -03:00
Bruno Perdigão d02c5ca1e6 Rename OverridaAggregateMove to OverrideMove.
It now deals with nests too.
2025-01-17 22:58:29 -03:00
Bruno Perdigão a5afba03ab Add "nest mode" similar to "aggregate mode". 2025-01-17 22:47:11 -03:00
Bruno Perdigão 3f914cdf27 Remove unused handler from AggregateModeDecorator 2025-01-17 22:43:05 -03:00
Bruno Perdigão 1d03e916f3 Fix after c4f85dffa4 2025-01-17 17:45:21 -03:00
Bruno Perdigão fd279234f3 Fix #5818 2025-01-17 16:41:01 -03:00
Bruno Perdigão a44439655c Install Bonsai decorators from Viewport Overlays in load_post. 2025-01-17 16:23:40 -03:00
Bruno Perdigão c4f85dffa4 Fix OverrideMoveAggregate to work for multiple layers of aggregates. 2025-01-17 15:51:26 -03:00
Bruno Perdigão 8d63845f3d Change AddSlabFromWalls to consistently create walls in a counterclockwise direction.
This guarantees that the external face of the walls aligns with the edges of the slab.
2025-01-17 15:09:57 -03:00
Thomas Krijnen e0e24948be Update build_rocky.yml - safe.directory 2025-01-17 14:07:36 +01:00
Thomas Krijnen 84420a8973 Don't allow empty sha for add_commit_sha 2025-01-17 13:57:14 +01:00
Dion Moult 7ee055f4f3 See #5972. You can now add half space solid items in item mode. 2025-01-17 23:02:32 +11:00
Andrej730 1f436bcec6 replace date picker util operators with wm.context_set_string
Since they were just setting a scene property which can be done by a default operator.
2025-01-17 17:00:06 +05:00
Andrej730 468c1a2580 Highlight currently selected date in date picker
Example - https://imgur.com/a/ItNg9sZ
2025-01-17 17:00:06 +05:00
Andrej730 e8cb9e7f3c Date picker to support IfcDateTime
See https://imgur.com/a/9a7JfMO
2025-01-17 17:00:06 +05:00
Andrej730 fa98a7e8f7 black . 2025-01-17 17:00:06 +05:00
Andrej730 686a5e7387 Fix #5988 after 6fb0f5e63a 2025-01-17 15:24:02 +05:00
Dion Moult e1da08579c See #5972. You can now add booleans in item editing mode, with support for all three boolean operators. 2025-01-17 20:55:27 +11:00
Dion Moult 0a87e92dcf Move geoference visualisation UI into panel header to be consistent. 2025-01-17 20:54:06 +11:00
Dion Moult 24b3cfc067 Fix #5897. Fix #5488. Fix #5498. Bug where you couldn't edit newly added annotation.
The annotation adding code was a bit of a mess, spread around
create_annotation, create_annotation_occurrence, and
bpy.ops.bim.add_annotation. I've now consolidated it all into
core.add_annotation and updated it to work with the new item editing
mode (basically new objects need to reload their representation to
populate item_ids). Things are still messy, but a bit less now.
2025-01-17 20:53:29 +11:00
Thomas Krijnen c163b260cf Try solve #5989 2025-01-17 10:45:21 +01:00
Andrej730 9e50c89c01 Work schedule UI - use cached data instead of accesing IFC 2025-01-16 18:30:44 +05:00
Andrej730 b28a3b6e32 Basic header for work schedule panel header #5928
Example - https://i.imgur.com/9thZQCX.png
2025-01-16 18:30:44 +05:00
Andrej730 9573628bf6 fix typo in sequence/prop.py and use more consistent name for props
Issue was that taskcolumns_enum doesn't exist
2025-01-16 18:30:44 +05:00
Andrej730 5f034bf4a9 bim.copy_railing_parameters - add poll message 2025-01-16 17:36:12 +05:00
Andrej730 de6e54040a FilledOpeningGenerator - update only parts instead of the full decomposition
similar to 0662b0c
2025-01-16 17:36:12 +05:00
Andrej730 50b39fdd10 bim.clone_opening - update affected representations 2025-01-16 17:36:12 +05:00
Andrej730 eef04fb91c bim.clone_opening - always show in opening's ui
Otherwise it was hidden until user guesses that 2 objects need to be selected for it to appear.
Also, not sure if it's useful operator anymore - it seems just duplicating an opening and then adding it does the same thing.
2025-01-16 17:36:11 +05:00
Andrej730 a383f60915 Show voided elements in UI
E.g. show voided wall when window or wall's opening is selected.
Example - https://i.imgur.com/jxjWPeE.png
2025-01-16 17:36:11 +05:00
Andrej730 44131a7fe5 Select filling objects from UI
Example - https://i.imgur.com/BijTwgo.png
2025-01-16 17:36:11 +05:00
Andrej730 c66f2131e2 bim.select_entity - move to bim module
as it can be generally useful, not just in tester
2025-01-16 17:36:11 +05:00
Andrej730 035999d0c3 bim.update_openings_focus - remove unnecessary ifc operator 2025-01-16 17:36:11 +05:00
Andrej730 61d68b74ca bim.add_filled_opening - remove unused operator 2025-01-16 17:36:10 +05:00
Andrej730 133459faec typo 2025-01-16 17:36:10 +05:00
Andrej730 6fb0f5e63a typing 2025-01-16 17:36:10 +05:00
Andrej730 2859e9632e black . 2025-01-16 17:36:10 +05:00
Andrej730 521a8183e7 Fix #5953 after d6e6a6d 2025-01-16 17:36:09 +05:00
Dion Moult a63f67ad32 Fix #5841. Incorrect axis usage when generating LAYER2 elements from polyline. 2025-01-16 23:19:11 +11:00
Dion Moult aeba2885e4 Fix #5984. Incorrect axis usage when generating slabs. 2025-01-16 23:11:51 +11:00
Dion Moult f50ae2faa5 See #5972. You can now load a hierarchy to visualise the boolean result tree. 2025-01-16 22:58:17 +11:00
Dion Moult bd739f8bfd Fix undo bug when marking booleans as manual 2025-01-16 22:39:37 +11:00
Dion Moult 5b2243089d See #5972. You can now delete boolean operands in item editing mode. 2025-01-16 22:10:28 +11:00
Dion Moult 2fe4680ca1 See #5972. Boolean operands are now loaded in item editing mode and are editable. 2025-01-16 21:28:05 +11:00
Taku Makoni 21624d6065 Wrong Import Package (#5982) 2025-01-16 12:20:59 +11:00
Taku Makoni b9f40342b2 Grammatical error 2025-01-16 11:52:09 +11:00
Bruno Perdigão 3e879c6156 Change how new objects added are handled in aggregate mode.
When in aggregate mode, new objects will now be automatically assigned to
the current aggregate.
2025-01-15 16:11:27 -03:00
Bruno Perdigão c360b91f4a Remove constraints from the aggregates. 2025-01-15 16:11:27 -03:00
Andrej730 23b1a71cba Support adding duplicated existing boolean
Example - https://imgur.com/a/rRQz9dx
2025-01-15 18:41:21 +05:00
Andrej730 5d17554d04 bim.add_boolean - support adding multiple booleans at once
Example - https://imgur.com/a/IWDqMRT
2025-01-15 18:41:20 +05:00
Andrej730 1f3fc3c2b9 bim.add_openings - display in UI if multiple potential openings are selected 2025-01-15 18:41:20 +05:00
Andrej730 d6da8a7ee1 Support duplicating potential openings and potential/existing booleans 2025-01-15 18:41:20 +05:00
Andrej730 cfb4cd8af9 bim.add_potential_opening - remove unused code
draw_settings() was never used
2025-01-15 18:41:20 +05:00
Andrej730 7eff4db4eb reuse add_tracked_opening 2025-01-15 18:41:19 +05:00
Andrej730 689688c76b Fix error selecting material usage in Materials UI
Previously it would error, now it selects related profile / layer set.
2025-01-15 18:41:19 +05:00
Andrej730 0ea513818b Support assigning material sets as usages from UI #5933
It's on alt+click in Materials UI, see example - https://imgur.com/a/8gP7iAZ
2025-01-15 18:41:19 +05:00
Andrej730 2fdcb41c4e black . 2025-01-15 18:41:19 +05:00
Dion Moult 65c99c57cd Prefill class / product type if using a particular BIM tool for convenience, and hide fields. 2025-01-15 22:04:58 +11:00
Dion Moult fe54b24f5f Fix bug where box decoration when adding empty geometry failed 2025-01-15 22:04:24 +11:00
Dion Moult 7fdfdbf8b4 Fix #5971. You can now specify a name and description when adding objects. Clean naming and description is critical! 2025-01-15 20:57:19 +11:00
Dion Moult 53906d824a Fix #5977. Silly mistake I forgot all([]) is still True. 2025-01-15 20:47:56 +11:00
Thomas Krijnen a687a90039 Break out multiple tasks per representation when rep is directly reused #5978 2025-01-15 10:24:52 +01:00
Thomas Krijnen c37fd6ae0b Don't throw exception but set to $ when encountering invalid instance name #5680 2025-01-15 10:08:31 +01:00
Dion Moult 06e8e2b35c Remove obsolete separate_verts_layer when marking edge angles for roofs
New roof system automatically handles this scenario (using poke
operator) so no need to mark it.
2025-01-15 19:46:34 +11:00
Dion Moult fd51b9a9e9 Fix #5968. Fix #4040. Rewrote roof generation using per face extrusions and cutting planes instead of edge sliding.
WARNING! The roof generation is now quite significantly different. This
WILL change your geometry when you refresh roofs from existing models.

 - The roof profile now always represents the top of eave. This better
represents how things are built rather than bottom of eave which was
previous.
 - The roof therefore always grows down from the profile. The rafter
edge angle can only be acute. This means that the roof will never grow
larger than the footprint profile that you've drawn. (before, the
footprint was not guaranteed to match).
 - The roof thickness is now the actual thickness of the roof, not the
"vertical dimension" of the roof. This means that the roof thickness can
now match intended layer thicknesses instead of you needing to do math
to work it out.

I've rewritten the internals of how roofs were generated to be hopefully
a lot simpler but as a tradeoff it's more restrictive. After the
skeleton is generated, non-uniform angles would be handled through
vertex splitting and moving. This works in simple scenarios but fails in
more complex ones. The new approach only handles non-uniform angles on
triangular faces. These faces are really easy to handle compared to
ngons, but are also more robust. The rafter edge angle is also now
handled using a clipping plane, which is a lot, lot simpler than vertex
sliding math.

Each face is now processed separately and then merged at the end. This
means that if a face has a different angle, it will now correctly
represent the different thickness at that portion of the roof.

In the process consistent roof thickness / rafter angle bugs were fixed.
2025-01-15 19:43:39 +11:00
Andrej730 3f2f296d5f Fix error with Shift-E #5975
E.g. two objects are selected - tesselation and profile and tesellation being active object. Using s-e with deselect tesselation object as it doens't have a usage but Bonsai would still try to run bim.enable_editing_extrusion_profile on it leading to the error.

Also fix possible issues for hotkey executed without active object (it seems all operators in hotkey do require active object)
2025-01-14 17:42:03 +05:00
Andrej730 020937835a Fix issue enabling ifcsverchok if sverchok installed under a different name #5913 2025-01-14 17:42:03 +05:00
Andrej730 a52e3615d6 Map ifc2x3 IfcAnnotationOccurrence to IfcStyledItems in ifc4 #5917 2025-01-14 17:41:58 +05:00
Andrej730 adb61c5a16 bonsai makefile - use new option for old no-clobber behaviour
Apparently (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62572) coreutils have changed `mv -n` to throw an error now instead of working silently, therefore our build was failing on Mac when Github Action switched from Ubuntu 22 to 24.
`--update=none` seems to restore the old behaviour.
2025-01-14 17:41:58 +05:00
Andrej730 a50973ede7 typing 2025-01-14 17:41:58 +05:00
Andrej730 74ca86678a ifcfm cobie - color code ods file tabs too 2025-01-14 13:48:50 +05:00
Gorgious56 ac2e69bd66 Don't close type manager when using the enum search feature while adding a new type
Also reduce the attribute name a bit
2025-01-14 08:44:21 +01:00
Dion Moult 595a3b3f87 Preselect IFC class when adding elements for convenience. 2025-01-14 14:22:15 +11:00
Dion Moult 48f534e7c1 Say "Type" instead of None in the general BIM tool. 2025-01-14 14:13:39 +11:00
Dion Moult 1ed770d454 Fix #5921. Bug when parsing IDS XML of facets with no attributes. 2025-01-14 13:36:33 +11:00
Dion Moult ec600ec72e IfcTester can now read from XML strings in addition to opening files on disk 2025-01-14 13:35:45 +11:00
Dion Moult adcc23541a Fix bug where starting a new file in an existing session would prompt an error.
Bpy.context.active_object is not available in-between loading / starting
a new file.
2025-01-14 13:35:01 +11:00
Dion Moult 9a77c94758 Fix #5967. Incorrect logic in the for/else block when adding new elements.
The for/else block was too greedy, meaning that if nothing was selected,
it would still try to create slabs from walls. I find for/else confusing
so I restructured the section to do more early returns and unindent the
logic.
2025-01-14 12:20:22 +11:00
Moritz Amberger e89d195f9b moved full_schema, is_strcit, should_expand, should_get_inverse, should_get_psets. should_get_geometry and should_skip_geometry_data to the Patcher class definition. deleted those parameters from the patch definition so that users are able to set them by themselves. removed the hardcoded tmp-File for the db_file name 2025-01-14 09:30:34 +11:00
tim 228e9d0571 Refactor detect_icon_color_mode to accept attribute path suffix
•	Removed bpy.context.preferences.themes[0] from the input and hardcoded it in the function.
	•	color_path now only requires the attribute path suffix (e.g., "user_interface.wcol_regular.text").
	•	Updated error handling to default to "dm" instead of "lm".
2025-01-14 09:22:53 +11:00
tim 7280669725 Typo 2025-01-14 09:22:53 +11:00
tim 83b8bb153d One function for model and cad custom icons
Apply detect_icon_color_mode function to model and cad workspaces
2025-01-14 09:22:53 +11:00
tim 88891409fd New icon color mode function
New function for determining which icon color mode to use: dark (dm) or light (lm)
2025-01-14 09:22:53 +11:00
tim b6ba1aaa8c Hide shortcuts from header 2025-01-14 09:22:22 +11:00
ti ffb3d2d6e9 check for None 2025-01-14 09:22:03 +11:00
Dion Moult efede9eb03 No idea why Github actions is failing for MacOS. All code looks good to me. 2025-01-14 00:14:03 +11:00
Andrej730 ac315e8a55 ifcfm cobie 2.4 - color code excel tabs
example - https://i.imgur.com/tSeqyjj.png
2025-01-13 17:53:02 +05:00
Andrej730 b7c18221f4 get_bbox - optimize by using numpy arrays 2025-01-13 17:53:02 +05:00
Andrej730 7a49f1611e get_shape_matrix - small optimization
reuse existing matrix instead of recreating new
2025-01-13 17:53:02 +05:00
Andrej730 5c0a7af830 cobie24 - implement Coordinate tab #5926 2025-01-13 17:53:02 +05:00
Andrej730 a968b61d02 np_matrix_to_euler, np_matrix_normalized 2025-01-13 17:53:01 +05:00
Andrej730 0ac9d739f8 remove unused code 2025-01-13 17:53:01 +05:00
Andrej730 74c6480808 bim.add_element to select added object 2025-01-13 17:53:01 +05:00
Andrej730 0601802005 typing 2025-01-13 17:53:01 +05:00
Dion Moult 9784fb1c49 Pyodide example app should use IfcShapeRepresentation to be valid 2025-01-13 23:12:49 +11:00
Gorgious56 039dcbaefa Stair Modifier : You can now set a total length target that will update individual tread runs automatically. You can lock the total length target and modify tread run or number of treads to keep the same global dimensions. 2025-01-13 12:04:13 +01:00
Gorgious56 1cd17fd5f8 Merge pull request #5947 from IfcOpenShell/update_type_manager
Update Type Manager
2025-01-13 09:40:42 +01:00
Gorgious56 2f0f9fe08b Merge branch 'v0.8.0' of https://github.com/IfcOpenShell/IfcOpenShell into update_type_manager 2025-01-13 09:38:41 +01:00
Gorgious56 50ed75fcc2 Fix potential bug where a class doesn't have a predefined type 2025-01-13 09:32:23 +01:00
Gorgious56 9eaf41c9f0 The filter search field now also filters description and predefined type 2025-01-13 09:28:56 +01:00
Dion Moult 581a674654 Fix #5952. Aggressively block scaling of IFC elements to prevent user confusion. 2025-01-13 18:01:25 +11:00
Dion Moult e29f686d3f Update setting literal from old name of "debug" to new name "debug-boolean". 2025-01-13 15:45:27 +11:00
Dion Moult 8cf7057abc Fix #5954. Special automatic movement of features shouldn't then also move children of those features.
If you move a wall, and that wall has features (e.g. openings), it's
desirable to also move those openings (because they are invisible). This
is a special exception to `should_transform_children` because the
definition of the feature (opening) is inherently tied to the parent
(wall).

What wasn't considered is that this would typically then also move
subchildren of the features (e.g. fills like doors). I'm surprised
nobody caught this earlier.

I did also consider another approach where if you move a wall, it moves
all unfilled openings, and if you move a door which fills a opening, it
moves the opening too. Intuitively it sounds nice, but it doesn't work
because:

 - Openings can have multiple fillings. If you move all fillings, they
all fight to move the openings.
 - All logic about children goes one way: a placement may have child
placements relative to it. This breaks the convention (if moving a door
instead moves its opening) which can make brains explode.
 - It starts to conflate rules about relative / referenced placements
with spatial decomposition. We assume all IFCs are valid and follows the
convention of relative placement but we cannot guarantee this. This also
leads to brain explosion.
2025-01-13 15:44:52 +11:00
Dion Moult 316b9554d4 Fix #5959. Bug where default selection basket in selector query was not added per facet list.
Previously the code looked for additive facets (entity, instance)
anywhere in the query, and then only added the default basket once at
the beginning of the query. This change makes it look for additive
facets in order (that way you could start with a default selection, and
then later use an additive facet) and does it per facet list (so you can
omit the additive facet at the beginning of each list).
2025-01-13 12:46:44 +11:00
tim 95fa6f39c4 New furniture icon
Chair icon for furniture
2025-01-13 10:47:35 +11:00
Thomas Krijnen 65ffbe081b Pyodide app readme 2025-01-12 15:50:19 +01:00
Thomas Krijnen 936984dd31 Update publish-pyodide-demo-app.yml 2025-01-12 15:16:57 +01:00
Thomas Krijnen 590c6eed0a Update publish-pyodide-demo-app.yml 2025-01-12 15:12:44 +01:00
Thomas Krijnen a696c7bbb5 Update publish-pyodide-demo-app.yml 2025-01-12 15:10:59 +01:00
Thomas Krijnen 6ff1d06938 Create publish-pyodide-demo-app.yml 2025-01-12 15:07:44 +01:00
Thomas Krijnen 6deb7121cc demo-app/CNAME 2025-01-12 15:00:54 +01:00
Thomas Krijnen 6aec2f7a02 pyodide/app-demo 2025-01-12 14:50:20 +01:00
Dion Moult 0eb987fc07 Black 2025-01-12 22:43:41 +11:00
Dion Moult 04092d19be Refactor common function for parametric objects into tool.Model 2025-01-12 22:43:34 +11:00
Dion Moult 8364c87777 Fix #5941. Context override when adding objects should only have one object. This is a temporary fix.
The proper fix is to refactor add_door and friends into core. That way
it can be properly reused instead of this hacky context override.
2025-01-12 22:39:32 +11:00
Dion Moult 2d38d8520c Fix regression where you couldn't move spatial elements from the new aggregate move override. 2025-01-12 21:47:42 +11:00
Dion Moult 03d3b1e52c Changed my mind, remove AssignConstituentFractions patch. See #5441. 2025-01-12 17:51:32 +11:00
Dion Moult 79fe1bfcfc Minor fix from new patch recipe in PR #5441 (src no longer required) 2025-01-12 17:45:43 +11:00
Louis Trümpler 59c1d7fa54 Add AssignConstituentFractions recipe 2025-01-12 17:41:50 +11:00
tim f0e1be765d New Roof and Railing icons
https://github.com/IfcOpenShell/IfcOpenShell/issues/5375
2025-01-12 17:38:57 +11:00
Lucas Nascimento a2bfc006b7 black formatting 2025-01-12 17:25:21 +11:00
Lucas Nascimento dff9f56ce3 black formatting and changes in shader typing 2025-01-12 17:25:21 +11:00
LM-Nascimento 80996dee1f Update unit.py 2025-01-12 17:25:21 +11:00
Lucas Nascimento a329de9f71 licence comment 2025-01-12 17:25:21 +11:00
Lucas Nascimento 1918138f68 cleanup 2025-01-12 17:25:21 +11:00
Lucas Nascimento aa21fe9060 separate shader file from decoration data 2025-01-12 17:25:21 +11:00
Lucas Nascimento 6eee445502 Cleaning up and type hints 2025-01-12 17:25:21 +11:00
Lucas Nascimento 3eb29af496 seems to be working 2025-01-12 17:25:21 +11:00
Lucas Nascimento 2912580087 shit ton of changes 2025-01-12 17:25:21 +11:00
Lucas Nascimento 477725529b now with shader for point loads 2025-01-12 17:25:21 +11:00
Lucas Nascimento d915dc9df0 update decorator to match shader + changes to text rendering 2025-01-12 17:25:21 +11:00
Lucas Nascimento 53a2b87c97 updates to shader class 2025-01-12 17:25:21 +11:00
Lucas Nascimento d10b327c5f Initial commit, able to show structural curve action on the sample file of IFC documentation 2025-01-12 17:25:21 +11:00
Radek Hlaváček 293cd83a9c Update report.html
Adding "Skipped" grey colored container for specification and requirement if no applicable element is found
2025-01-12 17:14:22 +11:00
ti 07817ec6fc updated restriction types 2025-01-12 17:13:36 +11:00
c4rlosdias d1ad082979 Add derived unit 2025-01-12 17:12:20 +11:00
Thomas Krijnen ba9693519b Remove mathutils import from shape_builder.py 2025-01-12 17:05:32 +11:00
Dion Moult 41362e1582 Fix #5950. IfcTester now considers optional requirement facets as per latest documentation.
The IDS documentation used to state that "optional" on requirement
facets was "for information only" and didn't affect the pass / fail
state. This was changed a while ago (which I missed) to a new behaviour:
both no values and passing values will pass.
2025-01-12 16:28:14 +11:00
Dion Moult 8e77011dda Fix #5949. Remove material set psets panel in favour of merging into material manager psets panel.
Previously, to edit a single IfcMaterial pset, you'd do so in the
material manager. In contrast, to edit a IfcMaterialSet pset, you'd do
so only when assigned to an object. Not only is it bad to edit psets in
two locations, it also means you can't edit psets until you've first
assigned the material set to an object which is bad. Now it's less code,
and material / material set psets are in the same spot.

There still more consolidation work to do, to allow editing of sets in
the material manager and to figure out how to show item psets, but it's
a step in the right direction.
2025-01-12 15:45:02 +11:00
Dion Moult 02632440b0 See #5949. Only show material psets and classifications if actually editing in the material manager.
Previously, you could disable editing and it would still show irrelevant
psets or classifications.
2025-01-12 15:45:02 +11:00
Bruno Postle 0a4ab32810 Fix missing carriage return
SyntaxWarning: invalid escape sequence '\I'
2025-01-11 13:36:54 +00:00
Dion Moult c446aab9a0 Fix #5951. Regression when removing mathutils dependency from shape builder and parametric stairs were expecting Vector and instead got numpy. 2025-01-11 15:39:13 +11:00
Dion Moult 2e7cbb759e Fix #5955. Regression in 0983f812fd where you couldn't remove a style that wasn't being edited. 2025-01-11 14:51:18 +11:00
Gorgious56 68f175fc71 Fix bug when trying to add an ifc type occurence from the toolbar in the properties editor 2025-01-10 15:42:37 +01:00
Gorgious56 a428169a13 Fix bug when duplicating an ifc type 2025-01-10 15:29:31 +01:00
Gorgious56 7db0196791 Fix bug where the thumbnail of the active class wasn't updated 2025-01-10 15:17:26 +01:00
Gorgious56 4f4c557f61 Another attempt.
Went back to previous toolbar : icon + type name + dot grid icon which all launch the type manager.
    Validating the type manager popup now only closes it. Functionally is the same thing as clicking Cancel. Don't really know what to do to fix it. Does cancel make sense in the type manager ? Do we want to be able to undo what is possible to be done from within the type manager ?
    You can change the active type either with the dropdown in the popup and in the grid flow. I changed it so that changing the type in the dropdown jumps to the corresponding page. BTW first time using github copilot to figure out the maths and it worked magically :) . I'm not against removing the dropdown but I feel like it's nice to see a plain list to choose from.
    You can input a specific page number or scrub the page number field. Might be usefull if user has dozens of pages to flip through.
    Right now the search is very simple, it does not implement fuzzy search or anything fancy with *
2025-01-10 14:24:33 +01:00
Dion Moult d88adf2d02 See #5938. Correctly detect negative extrusion depths and directions. 2025-01-10 22:48:11 +11:00
Dion Moult 956b7dcb92 Fix #5941. Regression in ae22eec9 where active object wasn't considered when adding a parametric door. 2025-01-10 21:50:52 +11:00
Dion Moult 0a32149be3 Fix #5944. You can now tab / edit IfcAnnotationFillArea with the new item editing mode. 2025-01-10 19:49:04 +11:00
Gorgious56 aafb6fc426 Add search bar with simple filter function to the type manager 2025-01-10 09:44:12 +01:00
Dion Moult cac3d7f699 Fix #5939. Fix #2751. IfcPatch no longer needs the (rarely used) input src arg by default. 2025-01-10 16:59:45 +11:00
Dion Moult 83add56e6c Fix #5949. When duplicating objects, copy over IFC links (shape representation ID, item_ids, edge_item_ids) in a more reliable way 2025-01-10 15:22:53 +11:00
Dion Moult e4412e2f51 Black 2025-01-10 15:21:18 +11:00
Dion Moult 4a1422d292 New annotations should not go into the unsorted collection 2025-01-10 14:13:28 +11:00
Stephen Boddy 1e448cb170 Add mini-guide to setting up IDE for debugging 2025-01-10 12:34:56 +11:00
Bruno Perdigão 07bb7e68dd Fix #5932 2025-01-09 16:14:11 -03:00
Bruno Perdigão cf054e11a1 Refactor: improve preview decorators for other products, following 420a4cfdc 2025-01-09 15:59:15 -03:00
Bruno Perdigão 6b8024f835 Refactor: Improve profile preview decorator to prevent GPU context errors 2025-01-09 15:59:15 -03:00
Bruno Perdigão 66577fd30d Prevent polyline profile from being called by Column Tool 2025-01-09 15:59:15 -03:00
Bruno Perdigão 0124b7a0e9 Allow polyline profile for IfcCoveringType 2025-01-09 15:59:15 -03:00
Bruno Perdigão 737402cae4 Fix profile scale issue in profile preview decorator. 2025-01-09 15:59:15 -03:00
Bruno Perdigão 8b1d4ca5d4 Implement polyline tool for profiles. 2025-01-09 15:59:15 -03:00
Gorgious56 a6e953a550 Update Type Manager
Add back the type dropdown and looking glass icon in the toolbar
Clicking on a type in the manager no longer closes the popup anymore.
A visual indictor is displayed on the active type
Changed the parameters icon in the individual type interface

Fix bug in "Slab from Walls" Shift + A code
2025-01-09 17:45:40 +01:00
Dion Moult 40dcfd450f See #5940. Fix bug where using preserve existing in IfcCSV didn't fully purge extra rows, possibly leading to orphaned data (which LibreOffice will render as 0 if it is a number value type) 2025-01-09 18:25:00 +11:00
Dion Moult e220b6981e See #5940. Fix bug where ODS and XLSX didn't correctly check for whether summaries existed and sometimes printed out "None" rows 2025-01-09 18:24:09 +11:00
Dion Moult 84931fbbd2 See #5941. Don't show mode changes if an object is unselectable.
Unselectable things should be uneditable. That's what the lock/unlock is
for.
2025-01-09 17:40:52 +11:00
Gorgious56 2d5bc49ee0 Going in and out of AGGREGATE mode doesn't overwrite other objects' display type anymore 2025-01-08 16:53:59 +01:00
Gorgious56 d4ff789688 You can now mass enable edition, disable edition and validate edition of Ifc Entity Attributes.
This highlights a potential bug that already existed due to the way the attribute system is designed. Where the user mass-edits attributes from different IFC types, resulting in discrepancies due to the same attributes having a different index. eg IfcWindow has the Tag attribute at index 3, IfcDoor at index 4. So using the ALT modifier feature from vanilla Blender to mass-modify similarly named attributes on the Tag attribute of the IfcWindow will modify the PredefinedType attribute on the IfcDoor (index 3). For this reason I added the ALT modifier to the buttons so mass-operations are a conscious effort for more knowledgeable users. Might reconsider if problems arise but this is IMO a good QOL feature.

Also fix floating point precision errors on Pset float values stored as strings (re last commit)
2025-01-08 11:29:06 +01:00
Gorgious56 5c3f0f0df9 Fix floating precision artifacts when displaying float values in the Attributes panel
Minor fixes on previous commit
2025-01-08 10:28:27 +01:00
Bruno Perdigão 519e667464 Fix bug with bim.aggregate_assign_new_objects_in_aggregate_mode. 2025-01-07 18:17:32 -03:00
Bruno Perdigão e3abfd60cb Typo. 2025-01-07 18:16:59 -03:00
Bruno Perdigão 864e8d3a48 Typo. 2025-01-07 18:05:23 -03:00
Bruno Perdigão d2b05ea3dc Fix bug related to constraints and aggregate duplication 2025-01-07 18:00:47 -03:00
Thomas Krijnen d063bdbbf1 wasm wheel fixes 2025-01-07 20:56:16 +01:00
Thomas Krijnen a42a49e088 wasm wheel fixes 2025-01-07 20:47:25 +01:00
Gorgious56 ae22eec958 Door modifier operators now apply to all elligible selected objects. This makes it way easier to modify a single attribute in several unrelated parametric doors thanks to the ALT + input feature from vanilla Blender. This allows for mass-removing, mass-removing, mass-editing, mass-validating, and mass-cancelling edition of door modifiers.
Also allow UNDO for some door operators which seems like they should support it
And Fix #5937 : minor typo
2025-01-07 17:43:43 +01:00
Bruno Perdigão b657eee564 Change extrusion direction when converting to extrusion in Representation Utilities. 2025-01-07 12:41:15 -03:00
Thomas Krijnen 9d1daa4dc5 ifcpatch - try both out of tree and subpackage imports #5939 2025-01-07 15:43:44 +01:00
Bruno Perdigão dbf33283ab Add Bonsai decorators toggle to Blender Viewport Overlays.
https://imgur.com/auQcp2Y
2025-01-07 11:32:14 -03:00
Gorgious56 0983f812fd You can now use the Asset Browser to set a Material Asset as an external style.
To do so Right Click on a material in the Asset Browser then `Set To External Style`. The style editor must be loaded in the properties editor.

Also run black on a file from previous commit and fix a bug soft-locking the style editor when removing a style that is being edited
2025-01-07 14:55:17 +01:00
Thomas Krijnen 3ced6e7bb1 wasm wheel fixes 2025-01-07 13:23:10 +01:00
Richard Brice 933d845472 Fixes IfcPolynomialCurve when used as IfcCurveSegment.ParentCurve in horizontal alignments 2025-01-06 14:36:37 -08:00
Gorgious56 8313c05884 Merge pull request #5930 from Gorgious56/improve_modifiers
Modifiers QOL
2025-01-06 12:10:26 +01:00
Gorgious56 f6e588b48c You can now copy roof parameters from active to selected objects 2025-01-06 11:35:17 +01:00
Gorgious56 547c5fb8a9 TAB now applies modifier parameters on the active object. ESCAPE now cancels editing modifier parameters on the active object. 2025-01-06 11:06:41 +01:00
Gorgious56 570e29cfe4 Add operator to copy railing modifier parameters (#3413)
* You can now copy railing properties from active to selected

Hitting ESCAPE cancels editing railing path
2025-01-06 10:10:54 +01:00
Thomas Krijnen 2e35b07fa6 Fetch boost from github releases in build scripts 2025-01-06 10:05:59 +01:00
Thomas Krijnen 1b6ee26854 Don't fail on empty ReferencedSource in IfcTester 2025-01-05 14:40:27 +01:00
Thomas Krijnen 7b21858cd4 Inform about supported reporter types in IfcTester 2025-01-05 14:37:41 +01:00
Thomas Krijnen 12800bbeee IFCPATCH_RECIPE_DIR to allow loading out of tree recipes 2025-01-05 11:07:48 +01:00
Gorgious56 3a7488d54b Fix #3261 : You can now purge unused openings that do not intersect with their related building element.
It's a naive implementation and very inefficient. Moreover there may be false positives because it's testing overlapping the evaluated mesh element with all openings applied.
2025-01-03 17:37:46 +01:00
Gorgious56 7bfa926e6d Fix error when instantiating a wire mesh 2025-01-03 16:41:05 +01:00
Gorgious56 fd7a7d44c3 Special geometry data on meshes are also loaded as geometry attributes.
No functional change apart from in dissolve_triangulated_edges where it will try to load the attribute if it can. I believe it will be easier in the long term to use the builtin Attributes system. Unfortunately Curves don't support Attributes yet. Also, attributes are more lightweight compared to custom properties.
2025-01-03 16:12:51 +01:00
Gorgious56 fe6a6d1a0d You can now disable aggregate mode with ESCAPE in the 3D Viewport
- Fix minor typo
2025-01-03 15:04:28 +01:00
Gorgious56 98a9550260 Fix slowness when rendering dense meshes with the opening decorator
It uses a custom boolean attribute on the mesh to decide whether an edge should be displayed or not. I think later on it can be used to get rid of the dictionary accessors which make the blend file size skyrocket.
2025-01-03 14:12:16 +01:00
Gorgious56 fe253af5ae Don't draw triangulation artifact edges in the opening decorator 2025-01-03 13:04:37 +01:00
Gorgious56 e933ff08f8 Use relevant tool.Geometry functions for querying openings relations 2025-01-03 12:22:08 +01:00
Gorgious56 25af639dae Fix memory leaks due to orphaned meshes in the opening and boolean operations 2025-01-03 11:30:42 +01:00
Gorgious56 5b3e3fc646 Fix not being able to apply or hide specific openings 2025-01-03 10:54:54 +01:00
Gorgious56 57dbea2974 Fix #3854 : Assigning a class to a potential opening removes it from the openings pool
Also fix an error in previous commit
2025-01-03 10:33:41 +01:00
Gorgious56 cc3074cdcc #5919 : Add an option to set the opacity of the rest of the model when modifying openings
Option is located in the preferences
2025-01-03 10:01:36 +01:00
Gorgious56 4c9697d260 Consolidate logic for toggling display of openings 2025-01-03 09:59:47 +01:00
Gorgious56 8dfcea0e24 Fix internal openings list not being cleared when applying an opening 2025-01-03 09:42:55 +01:00
Gorgious56 f0fac7ad8b Reorganize addon preferences layout
Hopefully it's a little bit less daunting
2025-01-03 09:40:08 +01:00
Bruno Perdigão f6c34ac196 Refactor enable_constraints for performance reasons.
`context.view_layer.update()` was being called for every object in the loop.
Now it is just called after all the constraints are enabled.
2025-01-02 17:11:43 -03:00
Bruno Perdigão 5ebaaa6c8c Minor fix to disable_aggregate_mode(). 2025-01-02 17:11:43 -03:00
Bruno Perdigão 9838a54173 Minor fix in aggregate decorator. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 2c3c0b9d95 Improve performance for TAB into aggregate mode.
Use disable/enable constraint instead of `constraint.apply`. It keeps the
parts location with matrix calculation
2025-01-02 17:11:43 -03:00
Bruno Perdigão 548f6e0566 Improve performance for bim.aggregate_assing_new_objects_in_aggregate_mode()
Add constrain only to new objects instead of rebuilding all constraints from scratch.
2025-01-02 17:11:43 -03:00
Bruno Perdigão 3874d19caa Allow aggregate to me moved while in aggregate mode without moving its parts. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 87fee0b850 Add features for handling newly created objects in aggregate mode
- Highlight new objects in red when in aggregate mode
- Introduce an operator to add new objects to the current aggregate, accessible via a button in the header menu
2025-01-02 17:11:43 -03:00
Bruno Perdigão 3bccc993b7 Small fix in aggregate decorator. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 31ae2c5437 Create UI operators for aggregate mode in model workspace. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 85c48f6a63 Small refactor of aggregate decorator. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 833cc0604c Improve performance in aggregate mode by removing hide_select.
Additionally, update rendering of objects outside the aggregate to use
 'WIRE' instead of 'BOUNDS'.
2025-01-02 17:11:43 -03:00
Bruno Perdigão 3dd83598e9 Prevent TAB from editing objects outside the aggregate in aggregate mode. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 3050abdb87 Small fix. 2025-01-02 17:11:43 -03:00
Bruno Perdigão f7c4b13d0a Aggregate decorator refactor. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 91d3b8161e Integrate aggregate mode toggle with Bonsai's TAB edit mode override. 2025-01-02 17:11:43 -03:00
Bruno Perdigão e9cc205ddd Enable aggregate decorator by default on file startup. 2025-01-02 17:11:43 -03:00
Bruno Perdigão c48f50a67e Small fix in aggregate move selection. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 6d9ee8828e Small fix 2025-01-02 17:11:43 -03:00
Bruno Perdigão 28c95a7d9a Remove debug print statements. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 9a6ff7c37c Add bounding box decorator over aggregates. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 226ea10de8 Add aggregate mode decorator. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 3c590f097a Prevent aggregate objects to be edited by TAB when not in aggregate mode. 2025-01-02 17:11:43 -03:00
Bruno Perdigão cbdbd5bd83 Add operator to toggle aggregate mode on and off. 2025-01-02 17:11:43 -03:00
Bruno Perdigão ccdf1cee0a Hide selection of objects outside the aggregate when in "aggregate edit mode". 2025-01-02 17:11:43 -03:00
Bruno Perdigão 21d3b1d472 Small fix 2025-01-02 17:11:43 -03:00
Bruno Perdigão 0c7a0a6bda Add aggregate decorator. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 3dcded819f Add new way to move objects that are a part of an aggregate.
Now, when trying to move an object that is a part of an aggregate, the
`OverrideMoveAggregate` will be called, meaning that it will move the whole
aggregation. It works by creating constraints and moving the aggregate instead
of the selected object.

It also introduces the idea of editing an aggregate (no hotkey yet). When active, the user
will be able to move the parts of the aggregate instead of the whole aggregation: https://imgur.com/IcCGtPN
2025-01-02 17:11:43 -03:00
Bruno Perdigão 6f11f74aac Apply aggregate constraints instead of removing. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 0daf4c9324 Remove constraints when object is unassigned from the aggregate. 2025-01-02 17:11:43 -03:00
Bruno Perdigão 7f838f81b4 Add aggregate constraints to import_ifc.py 2025-01-02 17:11:43 -03:00
Bruno Perdigão cf9446c4a5 Constrain part objects to aggregate object when creating aggregations. 2025-01-02 17:11:43 -03:00
Richard Brice 26ba761c68 Refactors alignment geometry 2025-01-02 11:10:56 -08:00
Gorgious56 bb9be861c8 Fix blend file being saved twice in a row with CTRL-S
This caused a noticeable hiccup when a large file is saved twice on a network drive. Also it messed up the backup system.
2025-01-02 14:32:29 +01:00
Gorgious56 ad815b697e Fix #5570 : Regen button now appears in the toolbar for windows and doors 2025-01-02 14:12:26 +01:00
Gorgious56 ca90ddc0b4 Fix 3134 : Flip shortcut is now displayed in the toolbar for doors and windows 2025-01-02 14:02:00 +01:00
Gorgious56 fb35e80be0 Editing the representation of an opening now updates the gpu shader accordingly 2025-01-02 13:06:14 +01:00
Gorgious56 21a62116a8 You can now hide all openings by pressing ESCAPE in the 3D Viewport
- Also fix CTD on UNDO after pressing ESCAPE due to previous commit
2025-01-02 11:17:48 +01:00
Gorgious56 c2708b13d9 Minor fix on previous commit to correctly go out of ifc edit mode without saving representation 2025-01-02 10:54:55 +01:00
Gorgious56 b949efe8ba Fix #5849 : Use Keymap item instead of modal operator for override escape in 3D viewport
- Enables the vanilla Blender autosave feature back, since a running modal operator deactivates it
- ESC is not used by any other vanilla keymap in the 3D viewport (may be conflict with other addons)
- Hitting ESC over another type of editor (eg enum field in the properties editor) will not trigger disabling ifc item mode
- You can now hit ESC in IFC edit mode to cancel editing the geometry and go back to ifc object mode
2025-01-02 10:27:52 +01:00
Thomas Krijnen 463289e462 pyodide build (#5916) 2024-12-31 16:09:54 +01:00
Thomas Krijnen 2fbb47d797 build_pyodide.yml 2024-12-30 17:07:40 +01:00
Thomas Krijnen 6d3612bd5b WASM build updates 2024-12-30 16:47:59 +01:00
Thomas Krijnen 3592e3f9c0 cityjson off by default 2024-12-30 16:44:47 +01:00
Andrej730 8fc0d7a808 Polyline tool - use Blender icons for status bar text
To make it similar to default Blender operators.
Example - https://i.imgur.com/wUEQeQL.png
2024-12-30 17:28:01 +05:00
Andrej730 9454d281fc handle_snap_selection - disable in input mode
As it's used in mouse mode and in input mode it just recalculates the values.
2024-12-30 17:28:01 +05:00
Andrej730 64e4f00f19 Left mouse to cancel input mode in polyline tool
Previously it would just have no effect, now it should be more natural.
2024-12-30 17:07:53 +05:00
Andrej730 0f25701967 validate_input - add basic tests 2024-12-30 17:07:53 +05:00
Andrej730 80fec36b98 validate_input - allow typing feet value without feet symbol
Similar to how we don't require to specify meters when project is in meters.
2024-12-30 17:07:53 +05:00
Andrej730 1065239501 validate_input - add rounding to remove float garbage 2024-12-30 17:07:53 +05:00
Andrej730 8f4b0f1fd6 Fix error refresh linked aggregate with 2+ levels of aggregates #5911
Error occurred if IfcElementAssembly, that was currently refreshed, had another IfcElementAssembly as it's part. Then, it was removed twice - once during delete_objects and another time during delete_ifc_object, leading to the error.
2024-12-30 17:07:52 +05:00
Andrej730 6965399b2a typing 2024-12-30 17:07:52 +05:00
Andrej730 da9cbbc61b black . 2024-12-30 11:58:35 +05:00
Ryan Schultz b506b72d9f Toggle openings for part's aggregate as well. 2024-12-29 17:05:21 -06:00
Ryan Schultz 78afcf9c7a Be able to close openings no matter what is selected. 2024-12-29 16:07:56 -06:00
Ryan Schultz c562a2c2ac closes #5876: be able to 'apply void' no matter which order you select the wall (or any other class object) and void. 2024-12-29 12:49:38 -06:00
Thomas Krijnen f3c52c5cbf Quick wrapper clean-up 2024-12-29 15:53:21 +01:00
Thomas Krijnen 9fa44fdc3c Setting rename 2024-12-29 15:53:07 +01:00
Bruno Perdigão 973dd818c4 Add slab direction decorator.
It's useful when working with angled slabs. There is no UI for it yet.
2024-12-27 21:02:47 -03:00
Andrej730 f362ba4edc Fix typo
Co-Authored-By: sboddy <12862430+sboddy@users.noreply.github.com>
2024-12-27 21:21:54 +05:00
Andrej730 2b1126d24d Hide list attributes from attributes UI
As they're more internal and not very useful to users.
Example of list attributes popping up before this commit - https://i.imgur.com/Nxcb10O.png
2024-12-27 19:43:30 +05:00
Andrej730 227f315746 Support quantity take-off for element types
Previously it would ignore any element types and work only on occurrences though quantity sets do support product types in general.
2024-12-27 19:43:30 +05:00
Andrej730 d55a291589 get_top_area to calculate area for the roof #5899 2024-12-27 19:43:30 +05:00
Andrej730 6c6e40b07c get_side_area - add angle argument 2024-12-27 19:43:30 +05:00
Andrej730 810ad58c06 Fix get top area doc-string
It says that angles lower than the provided angle are ignored when it actually works the opposite way.
2024-12-27 19:43:29 +05:00
Andrej730 19c1394d94 typing 2024-12-27 19:43:29 +05:00
Andrej730 c770776228 Quantity take-off - add a fallback option #5899
If current set of rules (e.g. IfcOpenShell) doesn't provide a way to quantify some type of element, then user now have an option to fallback to other calculator (Blender).

Location - https://i.imgur.com/csIPOuo.png
2024-12-27 19:43:29 +05:00
Andrej730 00ba54f5f2 blender qto calculator - simplify x, y, z calculations 2024-12-27 19:43:29 +05:00
Andrej730 845ebb8543 Fix bug in Blender quantities calculator ignoring openings from an aggregate
It wasn't considering that object's geometry might be also altered by opening added not directly but to it's aggregate.
2024-12-27 19:43:29 +05:00
Andrej730 5ef10073cd black . 2024-12-27 19:43:28 +05:00
Bruno Perdigão b9423b191a Add AddWallsFromSlab operator.
This operator allows users to create walls from a slab.
When the wall tool is active, pressing `Shift + A` will generate walls based on the exterior polygon of the selected slab.
2024-12-27 11:27:30 -03:00
Bruno Perdigão ba5e968b8f Fix bug caused by refactor a6a8a0f4b. 2024-12-27 09:40:59 -03:00
Bruno Perdigão 5e77453d1d Add "Edge Intersection" option to snapping points. 2024-12-26 18:25:43 -03:00
Bruno Perdigão a6a8a0f4b7 Small refactor in snapping system. 2024-12-26 18:17:39 -03:00
Bruno Perdigão e65af4425e Add decorator for "Edge Intersection" snapping point. 2024-12-26 18:17:39 -03:00
Andrej730 a4aaf9b4c3 Add info message if some elements were skipped from quantification #5905
Example - https://i.imgur.com/DwklNFS.png
2024-12-26 18:27:55 +05:00
Andrej730 51c9e1eaa2 Save loaded paths to linked IFC models in IFC #5899
Short demo - https://imgur.com/a/3LIt9Sr
2024-12-26 18:26:26 +05:00
Andrej730 f8828d3853 If models linked using relative path - store path as relative to ifc, not blend
As now we do support storing the list of linked models in IFC.
2024-12-26 18:26:26 +05:00
Andrej730 03793db75f Keep IfcStore.path as empty string if file is not saved
Previously it would get cwd value in that case as bpy.path.abspath("//") returns cwd if .blend is not saved.
2024-12-26 18:26:26 +05:00
Thomas Krijnen faa13a938d Preliminary file existance check before attempting mapping 2024-12-26 14:03:36 +01:00
Thomas Krijnen 457f441187 Fix comparison in destructor 2024-12-26 14:03:36 +01:00
Andrej730 6486a8947c Fix macos builds 2024-12-26 15:36:51 +05:00
Andrej730 3b10d8a9c4 Fix error loading document references in ifc2x3 after 1655341 2024-12-25 17:40:52 +05:00
Andrej730 60d6252fe7 Change documents name/identification from UI
Example - https://imgur.com/a/TAkxxSF
2024-12-25 17:40:51 +05:00
Andrej730 ff147a4c24 Fallback for queries if no elements filter is provided #5901 2024-12-25 17:40:51 +05:00
Andrej730 e3aaf5defa dev_environment - stop script execution on errors 2024-12-25 15:21:00 +05:00
Andrej730 6aaaf99314 dev_environment - move wild cards out of quotation marks #5904 2024-12-25 15:21:00 +05:00
Andrej730 1e4420d824 dev_environment - remove redundant slash at the end of BLENDER_PATH
Co-Authored-By: tim <59872808+trhyder@users.noreply.github.com>
2024-12-25 15:21:00 +05:00
Andrej730 769025e084 typing 2024-12-25 15:20:40 +05:00
Andrej730 f62b8073c6 black . 2024-12-25 15:20:40 +05:00
Bruno Perdigão 75483edb22 Fix limitations in AddSlabFromWalls operator.
- The operator is now unaffected by the order in which walls are joined.
- It has been updated to support split walls.
2024-12-23 18:12:29 -03:00
Bruno Perdigão d44942fbae Typo 2024-12-23 18:10:35 -03:00
Bruno Perdigão 051da8e481 Allow mitre join to create a connection between contiguous walls. 2024-12-23 18:10:35 -03:00
Bruno Perdigão 46c7981842 Change "Split" function to create connection between the new walls. 2024-12-23 18:10:35 -03:00
Bruno Perdigão 7dbfe91b4b Allow intersect_edges_v2 to work with 2d vectors. 2024-12-23 18:10:35 -03:00
Andrej730 7e8094aaa0 bim.load_linked_project - move processing chunk code to common method 2024-12-23 18:59:56 +05:00
Andrej730 20172a29c2 small optimization
avoid copying arrays of data if not necessary
2024-12-23 18:59:56 +05:00
Andrej730 39b64775be bim.load_linked_project - add invoke for debugging purposes 2024-12-23 18:59:56 +05:00
Andrej730 170b6fc67e typing 2024-12-23 18:59:55 +05:00
Andrej730 6dfb25862c black . 2024-12-23 18:59:55 +05:00
Andrej730 f1080a8278 ifcopenshell.open - more robust file existence check 2024-12-23 16:19:56 +05:00
Andrej730 6b0b7989b0 Fix error appending elements without type #5902 2024-12-23 15:48:53 +05:00
Andrej730 9128bf2d47 Fix missing line after f22636d #5896 2024-12-23 15:32:15 +05:00
Andrej730 6edc6cec71 Fix Migrate not migrating ifc file header #5903 2024-12-23 12:33:32 +05:00
Andrej730 d0e2995a84 bim.copy_text_to_clipboard - more detailed tooltip
Now it will show the text being copied (e.g. attribute name).
2024-12-23 12:33:17 +05:00
Andrej730 31069d6643 Fix error creating polylines in ifc2x3 after 9fbcb39
By accident it was providing numpy array instead of ifc points entities.
2024-12-23 12:33:17 +05:00
Andrej730 09b4681413 Fix #5892
By accident not commited `attr = context.button_pointer` line that was leading to console errors
2024-12-23 11:35:55 +05:00
Ryan Schultz cb0fdbec66 Quick way to get search strings from selections: https://community.osarch.org/discussion/comment/23305/#Comment_23305 2024-12-22 11:25:42 -06:00
Bruno Perdigão 40f1055ac3 Add AddSlabFromWalls operator.
This operator allows users to create a slab from a selected closed loop of walls.
When the slab tool is active, pressing `Shift + A` will generate a slab based on the exterior polygon of the selected walls.
2024-12-20 17:42:13 -03:00
Bruno Perdigão 44ef07c43e Add WallAxisDecorator. 2024-12-20 17:42:13 -03:00
Andrej730 1f68464d46 Bonsai Attribute to support copying it's name to clipboard #5892
Example - https://i.imgur.com/Jf1jofZ.png
2024-12-20 19:39:47 +05:00
Andrej730 f7395ccd52 Fix misleading CAD Fillet hotkey, add some CAD hotkeys descriptions #5893
It was misleadingly displayed in UI as shift+v while it was shift+f.
2024-12-20 18:59:22 +05:00
Andrej730 a79c4b1ace typing 2024-12-20 18:59:22 +05:00
Thomas Krijnen 579628fcb1 Properly handle taxonomy::loft with curved edges coming from ExSolidTapered #5891 2024-12-20 13:49:33 +01:00
Andrej730 74fe1b4eb9 append_asset - ensure to update existing rels appending second asset
E.g. in #5890 pset was shared by 2 elements and they it worked is
1) it appended first element and it's rel to pset
2) it appended second element and skipped updating it's rel as it was appended before. Now it's going to update it to ensure it encludes second element too.

I believe, issue occurred after 8c28f52 when we stopped duplicating inverses and started to reuse them.
2024-12-20 12:47:10 +05:00
Bruno Perdigão 8c6eddfb66 Disable LEFTMOUSE when input mode is on, in polyline tool. 2024-12-19 20:02:39 -03:00
Andrej730 284ec46b81 add_door_representation - remove mathutils dependency #5192 2024-12-19 18:31:49 +05:00
Andrej730 d6e6a6d559 add_railing_representation - remove mathutils dependency #5192 2024-12-19 18:31:49 +05:00
Andrej730 f22636d880 add_window_representation - remove mathutils dependency #5192 2024-12-19 18:31:49 +05:00
Andrej730 eae92b55bb shape_builder - np utils 2024-12-19 18:31:49 +05:00
Andrej730 5b315bfa8f shape_builder - add test for mirror 2024-12-19 18:31:49 +05:00
Andrej730 5cd769e5b4 shape_builder tests - remove mathutils dependency #5192 2024-12-19 18:31:49 +05:00
Andrej730 e2b550f7af regenerate furniture library after migrating to numpy 2024-12-19 18:31:48 +05:00
Andrej730 bf892a6a06 Furniture library - small change after #4989 2024-12-19 18:31:48 +05:00
Andrej730 0e8eeb18ac shape_builder - remove mathutils dependency completely #5192 2024-12-19 18:31:48 +05:00
Andrej730 b4a0a5df6c mathutils deprecation - mep_bend_shape #5192 2024-12-19 18:31:48 +05:00
Andrej730 5469d3f9d5 mathutils deprecation - mep_transition_shape #5192 2024-12-19 18:31:48 +05:00
Andrej730 4a68285d1f mathutils deprecation - meshes #5192 2024-12-19 18:31:48 +05:00
Andrej730 01c2edfd16 mathutils deprecation - extrude #5192 2024-12-19 18:31:47 +05:00
Andrej730 c32616faca mathutils deprecation - mirror #5192 2024-12-19 18:31:47 +05:00
Andrej730 6e8815eacc mathutils deprecation - rotate #5192 2024-12-19 18:31:47 +05:00
Andrej730 8250f02866 mahtutils deprecation - translate #5192 2024-12-19 18:31:47 +05:00
Andrej730 c1ec42c95b mathutils deprecation - circle, plane, placements, curves #5192 2024-12-19 18:31:47 +05:00
Andrej730 63f56d2f21 mathutils -> numpy - polyline, rectangle #5192 2024-12-19 18:31:47 +05:00
Andrej730 bd0cf6cf3f black . 2024-12-19 18:31:46 +05:00
Andrej730 7be21bf02e mep - fix errors adding a bend/a transition
mesh is already removed by replace_object_ifc_representation
2024-12-19 18:31:46 +05:00
Thomas Krijnen 352e361ea5 Check for nullptr before resolving inverses 2024-12-19 10:40:59 +01:00
Thomas Krijnen 9efc9d2044 Fix iteration over indeterminate in rule execution 2024-12-18 11:45:47 +01:00
Thomas Krijnen d271fd1779 Fail faster on representation map not suitable for reuse #5672 2024-12-17 20:58:10 +01:00
Thomas Krijnen bd7c19a861 Defensiveness #5683 2024-12-17 20:57:01 +01:00
Thomas Krijnen abb1fe6f60 #5684 Ignore singular object placement 2024-12-17 13:30:21 +01:00
Thomas Krijnen 243e974866 Fetch when already cloned in nix build script 2024-12-17 12:28:32 +01:00
Ryan Schultz 07cf701e90 tweaks to a9defb94d0
thanks @Andrej730 for the direction.
2024-12-14 13:07:53 -06:00
Thomas Krijnen 1d271611c4 Try work-around brew install issue on OSX build 2024-12-14 15:34:42 +01:00
Thomas Krijnen 559ef3086a Only manual dispatch for full builds due to LFS quota 2024-12-14 15:34:15 +01:00
Andrej730 7f1b234045 Fix #5871 2024-12-13 19:07:58 +05:00
Andrej730 2251679479 Skip parts without polygons converting mesh to tessellation #5870
As IFC doesn't allow mixed geometry types anyway.
2024-12-13 19:07:57 +05:00
Andrej730 34e8e8911d geometry test - IfcSweptDiskSolid 2024-12-13 19:07:57 +05:00
Andrej730 c4945970e3 test IfcCircle values 2024-12-13 19:07:57 +05:00
Andrej730 99c752904a Fallback to add_representation for mesh curves #5870 (after 42f32e3) 2024-12-12 18:16:12 +05:00
Andrej730 8574057340 bim.hide_booleans to hide all selected booleans, not just active
short demo - https://imgur.com/a/1h2glfj
2024-12-12 17:44:55 +05:00
Andrej730 363c3b0010 bim.show_booleans to show booleans for all selected objects 2024-12-12 17:44:55 +05:00
Andrej730 e098a7c4fc Add option to disable loading index maps #5848
As currently it might still might take too long
2024-12-12 16:55:56 +05:00
Andrej730 ae61f28df7 Optimize loading index map - finding closest vert index #5848 2024-12-12 16:55:56 +05:00
Andrej730 d8cfc017d4 Optimize loading index map #5848
Use dict of face sets so we can get face data in O(1) instead of going through all of O(n).
2024-12-12 16:55:56 +05:00
Bruno Perdigão 4e0a813eb4 Fix Solar Analysis UI after changes in Sun Position Add-on.
Changes in this file: https://projects.blender.org/pioverfour/sun_position/src/branch/main/sun_calc.py
2024-12-11 16:39:12 -03:00
Bruno Perdigão a447776fd7 Change georeference decorator UI. 2024-12-11 16:38:24 -03:00
Thomas Krijnen eb68264bed Support inner loops in occt sweep_along_curve #5859 2024-12-11 10:54:01 +01:00
Thomas Krijnen a84a5815d6 Don't check for BOPAlgo_AlertAcquiredSelfIntersection at all for now 2024-12-10 21:45:39 +01:00
Thomas Krijnen 139b83ea0c Re-enable remove_duplicate_points_from_loop 2024-12-10 21:30:43 +01:00
Thomas Krijnen ab17c8ffd9 Re-enable force_close in profile curve handling 2024-12-10 21:26:58 +01:00
Thomas Krijnen 0708f49973 Re-enable wire self-intersection handling 2024-12-10 21:26:06 +01:00
Thomas Krijnen a728470b76 Allow BOPAlgo_AlertAcquiredSelfIntersection when its our final fuzziness attempt 2024-12-10 21:18:20 +01:00
Thomas Krijnen 72eed36313 Rework debug flags in settings 2024-12-10 21:17:37 +01:00
Andrej730 fc9bcb0b82 Support reloading disk solids representation that use Blender curves 2024-12-10 18:09:27 +05:00
Andrej730 5df93cbb52 Support InnerRadius for disk imported as Blender curves #5859 2024-12-10 18:09:26 +05:00
Andrej730 1e0ca1d891 convert-back-units test #5864 2024-12-10 18:09:26 +05:00
Andrej730 9cd4ff9de4 Fix error adding an occurrence with no type selected #5863 2024-12-10 18:09:26 +05:00
Andrej730 b1231b74e2 Save texture style without textures to remove texture style
Mentioned in 618ba51, it probably will be more natural this way - if there are no textures, we hide UV attribute to indicate that it won't be saved and on save we either do nothing, if texture style wasn't saved before, or remove it.
2024-12-10 18:09:26 +05:00
Thomas Krijnen ea68f90693 Fix other unit conversion issues #5864 2024-12-10 11:19:43 +01:00
Thomas Krijnen 064ccf8ab6 Always apply shape healing to faces with inner bounds for wrong orientation 2024-12-10 09:24:29 +01:00
Thomas Krijnen db865ec88f Revert submodule change in 586f9be077 2024-12-10 09:24:29 +01:00
Ryan Schultz 91a061325d Perform quantity take off near object's QTO. https://imgur.com/a/kzBA1GB 2024-12-09 15:13:13 -06:00
Andrej730 ce6a5080cd Added headers for resources and cost schedule
Need to polish it and readjust it, just adding some headers to make tables more readable.
https://i.imgur.com/5Lb8Vrc.png
https://i.imgur.com/UYysZF1.png
2024-12-09 18:30:12 +05:00
Andrej730 8039fcd6f7 Fix invalid ifc saving texture style without any textures / option to remove surface style
Now it won't allow saving texture style without textures and there is a button to remove part of surface style.
2024-12-09 18:30:05 +05:00
Andrej730 194e033662 Fix error editing lighting style attributes 08e38c6 2024-12-09 18:30:05 +05:00
Andrej730 77a4145dcf Fix error message creating texture style without render style
It was suggesting that it's possible to create it with just shading style though it's not currently supported.

Now it also appears when user is about to enable texture style editing, not when they're already trying to save the changes.
2024-12-09 18:30:05 +05:00
Andrej730 365d82f1d5 Loading texture maps - fallback to absolute paths
If it's not possible to get relative path, fallback to absolute path and show an info message.
2024-12-09 18:30:05 +05:00
Andrej730 618ba5187c Readable error trying to create a texture style without textures #5855 2024-12-09 18:30:04 +05:00
Andrej730 6090c1c669 typing 2024-12-09 18:30:04 +05:00
Andrej730 1572bf36a7 Add descriptions to style/material selection operators 2024-12-09 16:56:15 +05:00
Andrej730 2e0ca32653 black . 2024-12-09 16:56:14 +05:00
Ryan Schultz 5086fcc35a small fix to previous commit. 2024-12-08 20:12:03 -06:00
Ryan Schultz a9defb94d0 Improved UI for BIM_PT_object_material
also can run `bim.select_by_material` by clicking on material name
2024-12-08 20:01:49 -06:00
Ryan Schultz 586f9be077 When toggling openings, voids are wireframe.
Discussed: https://community.osarch.org/discussion/2592/any-objections-of-changing-voids-to-wireframe-when-you-toggle-openings
Also, if you keep hitting tab, it cycles in and out of edit mode.
2024-12-07 15:31:37 -06:00
civilx64 ad35ceef2a add missing import for ifcopenshell.api.georeference 2024-12-07 18:17:36 +01:00
Ryan Schultz 93ec1cbfc2 closes #5086: a preference to assign which classes display as wireframe upon opening the IFC file 2024-12-07 10:58:58 -06:00
Thomas Krijnen 8bba25497b Add material name in gltF 2024-12-07 16:36:40 +01:00
Thomas Krijnen 9160038359 Reuse more existing api in cgal face self-intersection detection #5820 2024-12-07 16:26:59 +01:00
Andrej730 c4ffc06a88 Bonsai - extract elements from selection #4316
Demo - https://imgchest.com/p/xny8qvox5yb
You can also now reuse 'bpy.data.texts['globalid-filter-3UvnD5Ml95zBDEcwAkAUIp']' kind of queries from Search in ExtractElements query.
2024-12-06 18:57:55 +05:00
Andrej730 2a713846ce bonsai ifcpatch - add warning for unsupported patches
For patches that require filepath to be provided explicitly (they are still supported with "Load from memory" unchecked).
2024-12-06 18:57:55 +05:00
Andrej730 c306014190 ifcpatch - input and file arguments #2751
documented when input is currently required
2024-12-06 18:57:55 +05:00
Andrej730 2da5f2d61e set_element_value - optimizations setting enum values
1) Identify from previous pset value whether prop was an enum (by checking if previous value is a list), instead of searching through prop templates

2) Compare previous and new enum values - if they match, skip editing IFC.
2024-12-06 18:57:54 +05:00
Andrej730 c7af55183b set_element_value for enums - add a test 2024-12-06 18:57:54 +05:00
Andrej730 6fe5af3170 Fix regression for switching to Point/PointCloud representations 2024-12-06 18:57:54 +05:00
Andrej730 73185293df Fix long time missing create_cog_representation
It was used in the code but method wasn't defined. I believe it was lost during 8b7d968 😁
2024-12-06 18:57:54 +05:00
Andrej730 6d01d71c60 add_representation.create_cartesian_point - fix missing z offset for 0 values 2024-12-06 18:57:54 +05:00
Andrej730 848af67fbb typing 2024-12-06 18:57:53 +05:00
Andrej730 8609bd12cc Fix default container label not updating #5817 2024-12-06 15:42:23 +05:00
Andrej730 3446643816 bim.switch_representation to handle representations with the same context
1) If object had multiple representations for the same context, then switch simply wouldn't work as it would always pick up the first representation it could find. Now it prioritizes the one user is selecting in UI.

2) If some object is selected and it also has multiple representations for the same context, then switch representation would switch it to any representation in that context it first finds. As user doesn't provide representation explicitly in that case, now it will stick to the already active representation on selected object if it matches the context, to avoid accident switches.

Notcied by working with example from #5824
2024-12-05 18:32:54 +05:00
Andrej730 1b61cbba8f typing 2024-12-05 18:28:45 +05:00
Andrej730 8d2b783b4a fix small bug in 939cc63ca 2024-12-05 17:24:33 +05:00
Andrej730 538365885b Hide output path for ifcpatch without output #4721 2024-12-05 17:24:33 +05:00
Andrej730 939cc63cae SplitByBuildingStorey - fix errors, fix Bonsai UI #4721
- The patch was failed when executed from Bonsai since self.src wasn't provided, fixed now.
- Added a temporary hack to diplsay file selector for this patch.
- small refactor.
2024-12-05 17:16:26 +05:00
Andrej730 13106d255c int formatting function #5039
Example - https://i.imgur.com/wDGFNci.png
2024-12-05 15:52:27 +05:00
Andrej730 9cf34f9d8c Select profile for profile type objects #5814
Demo - https://imgchest.com/p/9rydjxwanyk
2024-12-05 15:21:28 +05:00
Andrej730 eb87e7e866 Fix UI errors when selecting directories in file browser
It was only checking if it's existing path but wasn't checking whether it's a file, therefore directories with suffixes were slipping in and then failing during `IfcHeaderExtractor(filepath)`.
2024-12-04 17:46:55 +05:00
Andrej730 e4597708d7 simplify getting view 3d space
If area is VIEW_3D then area.spaces.active is always VIEW_3D too.
2024-12-04 17:46:55 +05:00
Andrej730 bb441ade3f Fix error loading external shader styles
Mentioned in logs from #5820
Turned out, `area.spaces` also contain all other spaces this area used (e.g. it used be view3d before it became a nodegraph) leading to errors. Simplifying it with `area.spaces.active`.
2024-12-04 17:46:55 +05:00
Andrej730 00a509aa0b typing 2024-12-04 17:46:55 +05:00
Andrej730 69fb486778 black . 2024-12-04 17:12:36 +05:00
Thomas Krijnen aef38bd869 Fix matrix access in XmlSerializer #5840 2024-12-04 10:39:01 +01:00
Andrej730 7b09c9ad3b Bonsai - handle invalid authorization None value in the header #5834 2024-12-04 14:16:51 +05:00
Richard Brice eadf35f031 Fixes unit conversion for polynomial coefficients 2024-12-02 14:45:05 -08:00
Thomas Krijnen f425794182 submodule 2024-12-01 20:26:18 +01:00
Thomas Krijnen 4d90684778 empty 2024-12-01 20:03:16 +01:00
Thomas Krijnen 049173286a Bump precision in wkt output 2024-12-01 19:05:22 +01:00
Thomas Krijnen 1ecf722111 Assert single polygon in arrange-spaces and no need for the closing point 2024-12-01 19:04:59 +01:00
Thomas Krijnen 85c0992975 submodule 2024-12-01 19:04:08 +01:00
Thomas Krijnen b9f790217e Initialize only_valid_ 2024-12-01 11:21:58 +01:00
Thomas Krijnen 4bb112ce71 Manually parse SVG polygons for space arrangement 2024-12-01 11:21:38 +01:00
Thomas Krijnen efd05158c4 Propagate unit settings 2024-12-01 11:21:15 +01:00
Thomas Krijnen 3a687fecda SVG reliance on UseElemHierarchy for storey decomposition 2024-12-01 11:20:37 +01:00
Thomas Krijnen df060d7f60 submodule 2024-12-01 11:19:34 +01:00
Ryan Schultz e3317af56d fix #5806: When unlocking spatial objects, that it turns on select-ability as well. 2024-11-30 15:40:26 -06:00
Thomas Krijnen da78a1107d Fix validation error in non-aggregate aggregate #5830 2024-11-30 17:49:29 +01:00
Ryan Schultz b52edcea40 Use Top/Bottom when LayerSetDirection = AXIS3 2024-11-29 09:55:42 -06:00
Thomas Krijnen 4ec8ceb134 Reintroduce --center-model and --center-model-geometry 2024-11-29 13:03:56 +01:00
Thomas Krijnen 8edbb37121 Fix latebound entity inheritance hierarchy wrt id() #5822 - not ideal, because BaseEntity.declation now returns declaration 2024-11-28 12:57:08 +01:00
Andrej730 c9847caa6a ifccsv - support importing enum values #4608 2024-11-27 18:30:37 +05:00
Andrej730 b7db3da017 ifctester - save results to temp directory
the way it was intended to originally but absolute paths of ifc and ids got in the way
Replaced TemporaryDirectory with mkdtemp as sometimes .html report doesn't open fast enough and directory gets deleted. Also need to keep the directory to make sure .ods is not removed.
2024-11-27 18:30:37 +05:00
Andrej730 eca71032bf black . 2024-11-27 18:30:37 +05:00
Andrej730 ab069f431a typing 2024-11-27 18:30:37 +05:00
Andrej730 25eecded4e ifcopenshell.validate to validate guids #5808 2024-11-27 15:42:03 +05:00
Andrej730 cc014bb7ec ifcopenshell.write check if file was saved successfully #5809
will help only for the cases if file didn't existed before
2024-11-27 12:59:06 +05:00
Ryan Schultz ba7b0d5c4f When using queries in an IfcAnnotation tag surround with backticks 2024-11-26 21:48:46 -06:00
Bruno Perdigão 4f6e2586e1 Fix #5727 2024-11-26 10:42:26 -03:00
Andrej730 dea3722ca5 bim.select_failed_entities - add info message 2024-11-26 18:12:05 +05:00
Andrej730 268cbe9a69 remove debug print 2024-11-26 18:12:05 +05:00
Andrej730 85b7249a77 Fix error using cwd for titleblock path #5769
The titleblock is ifc relative, not .blend/cwd relative.

e.g. if you open Blender in C:\ and then would open .ifc from c:\path\to\project.ifc, it would try to create layouts folder in C:\layouts instead of c:\path\to\layouts
2024-11-26 18:12:05 +05:00
Andrej730 12c08b0697 typing 2024-11-26 18:12:05 +05:00
Andrej730 fb70374876 black . 2024-11-26 18:12:04 +05:00
Andrej730 a4145ecec2 Fix errors using shared path for drawing underlay #5803 2024-11-26 17:06:00 +05:00
Andrej730 4da9f12960 BIMMeshProperties.obj - document 2024-11-26 16:16:29 +05:00
Andrej730 04d3903ee2 bim.hide_boolean to apply changes to booleans transforms #5800
Example - https://imgchest.com/p/ljyq8zvwey2
2024-11-26 16:16:29 +05:00
Andrej730 c8e5b8f028 bim.show_booleans - not to load same booleans multiple twice #5800
Now it's checking whether they were reloaded before and removing previous instances.
2024-11-26 16:16:29 +05:00
Andrej730 b8468cb19c Mesh.subshape_type - replace with enum 2024-11-26 16:16:28 +05:00
Andrej730 e6f0f54c93 Mesh.ifc_definition - remove unused property
Introduced in 6cc4ce4, seems to be gone for a while now.
2024-11-26 16:16:28 +05:00
Andrej730 2ff7401803 ifc join to reuse poly curve points if possible 2024-11-26 12:39:19 +05:00
Andrej730 22009973a8 Support ifc joining curve sets of poly curves #5793
Will resolve 'Unsupported representation item type for joining: IfcGeometricCurveSet' kind of errors on IFC join.
2024-11-26 12:39:19 +05:00
Andrej730 c228866f51 Add error message on representation type mismatch #5793
Instead of failing silently
2024-11-26 12:39:19 +05:00
Andrej730 3856b281ea Fix sheets related poll errors 2024-11-26 12:39:19 +05:00
Ryan Schultz 6f7565f6f9 select objects within a certain tolerance--which is set in the preferences. 2024-11-25 22:12:27 -06:00
Ryan Schultz 65a8ae1093 Fix #5802, Thanks @sboddy! 2024-11-25 18:49:50 -06:00
Jesse Roodhorst e6f8ef992e tooltips for the drawing module added (#5798) 2024-11-25 18:21:41 +05:00
Andrej730 dd0355c539 Fix drawing activation if drawing properties are using temp window #5791 2024-11-25 18:07:45 +05:00
Andrej730 7475a8f989 add_slab_representation - add api description #5792 2024-11-25 17:30:31 +05:00
Andrej730 4d44ec7174 Fix creating arbitrary profile without object after e74adcb
Error: Python: Traceback (most recent call last):
  File "\bonsai\bim\ifc.py", line 443, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\bonsai\bim\module\profile\operator.py", line 172, in _execute
    if not indices:
           ^^^^^^^
UnboundLocalError: cannot access local variable 'indices' where it is not associated with a value
2024-11-25 16:52:57 +05:00
Andrej730 29f9f04d92 Change profile object UI #5796
example - https://imgchest.com/p/qb4zwj6ad4j
1) moved profile object selection to the same row as the profile type selection, so it will more noticable that they're related
2) added object requirements in the description
3) filtered only mesh objects to appear in the dropdown
2024-11-25 16:45:55 +05:00
Ryan Schultz fc736f725c tweaks to 812e3dc6df 2024-11-24 09:58:44 -06:00
Thomas Krijnen ba92e3140c Fix installation of some header files 2024-11-24 15:12:44 +01:00
Bruno Perdigão 99ad9ac305 Fix snap system (#5782) by changing the priorities.
The priority now follows this order:
1. Polyline
2. Measure
3. Faceless objects
4. Objects
5. Axis
6. Viewport plane
2024-11-23 12:53:44 -03:00
Bruno Perdigão dc6078a416 Small fix in model decorator 2024-11-23 10:52:39 -03:00
Bruno Perdigão 0267e2b5e0 Add option to change the size of the georeference decorator. 2024-11-22 14:48:57 -03:00
Thomas Krijnen 352a2e2eb8 Quotes 2024-11-22 14:00:30 +01:00
Andrej730 091ed3bb8d Fix possible crash removing resource after 1f21e96 2024-11-22 17:13:05 +05:00
Andrej730 69eca15195 resources import/export - support resource quantities 2024-11-22 17:13:05 +05:00
Andrej730 a551ea36df related_object_type - use enum instead of stringproperty 2024-11-22 17:13:05 +05:00
Andrej730 1116bcc296 bim.assign_cost_item_quantity - add dynamic description
Example:
- https://i.imgur.com/J3LFiYu.png
- https://i.imgur.com/ufC2LzD.png
2024-11-22 17:13:05 +05:00
Andrej730 4ef1afa8bb resources - support importing/exporting ScheduleUsage 2024-11-22 16:57:54 +05:00
Andrej730 164e5c69ca bim.export_resources #5760
Simple export for resources to csv file, supports just the same fields that import currently does.
Location - https://i.imgur.com/Ssz7BwZ.png
2024-11-22 16:57:26 +05:00
Thomas Krijnen 8420823342 Only package exes for one entry in matrix 2024-11-22 12:18:55 +01:00
Andrej730 71637f120a Fix "Restart Blender" button for Microsoft Store Blender #5582 2024-11-22 14:32:01 +05:00
Thomas Krijnen 1d6cbc4b76 Add --with-filesystem to boost build (for voxelization toolkit) 2024-11-22 09:31:23 +01:00
Thomas Krijnen faf5c0ab30 Submodule 2024-11-22 09:21:16 +01:00
Thomas Krijnen e86b419414 Empty 2024-11-21 19:57:20 +01:00
Thomas Krijnen c3154b3755 Transfer build output repo 2024-11-21 15:40:34 +01:00
Thomas Krijnen a37b5c5b62 Github Action build scripts! 2024-11-21 15:40:34 +01:00
Thomas Krijnen f91fedf69c Win build script - check for installed deps 2024-11-21 15:26:14 +01:00
Thomas Krijnen 7028d67e00 nix boost 1.86, diskcleanup option 2024-11-21 15:25:47 +01:00
Thomas Krijnen 957369219c More verbosity on invalid enumeration literals 2024-11-21 15:16:56 +01:00
Stephen Boddy 04e84f7aed Fix #5770 so sheet subitems can be opened using svg command too, not just the main sheet. I was a little overzealous adding poll methods in 099703f 2024-11-21 18:18:36 +05:00
Andrej730 4bde423c50 Date picker UI for IfcDate type attributes
Example - https://imgchest.com/p/5xy2bekl3yl

set_prop_from_path method got from https://blenderartists.org/t/set-property-using-path-from-path-from-id-prop-path-resolve/1559166
2024-11-21 18:11:59 +05:00
Andrej730 4891e4ffed Fix not applying transforms in case if there's only parent or only constraints 2024-11-21 18:11:58 +05:00
Andrej730 8a31e8d149 Auto update cost item rates when enabling editing non-sor cost schedule
There was an issue that it wouldn't load until you manually select it in the "Cost Item Rates" enum - otherwise items didn't appear the first time cost schedule opened and didn't not update when you makes changes to the active schedule of rates.
2024-11-21 18:11:58 +05:00
Andrej730 6e56fe8f9b bim.load_schedule_of_rates_tree - remove dead code
This operator is unused anymore since d3b176e and it's using non-existent core method.
2024-11-21 18:11:58 +05:00
Andrej730 15354d2e06 bim.assign_cost_value - add description 2024-11-21 18:11:58 +05:00
Andrej730 37141c89ac bim.assign_cost_item_quantity - to show error if no related objects were found
Just to make UI more responsive - e.g. if some objects are selected but they are not products.
2024-11-21 18:11:58 +05:00
Andrej730 610665d732 Fix bug with TEXT annotations types showing up in TEXT_LEADER annotation types list 2024-11-21 18:11:38 +05:00
Andrej730 2381e9e4e6 bim.import_resources - add info message about imported resources
Example - https://i.imgur.com/NlZRIzw.png
2024-11-21 18:11:38 +05:00
Andrej730 670a85fd8c Hide class assignment panel for handles from linked models 2024-11-21 18:11:37 +05:00
Andrej730 b2e3a4dd82 typing 2024-11-21 18:11:37 +05:00
Andrej730 ec521916da black . 2024-11-21 18:11:37 +05:00
Thomas Krijnen 2f7412d0c1 install serializer libs 2024-11-21 09:15:04 +01:00
Andrej730 3b6128b2df bim.assign_class to apply transform from parents and constraints
To avoid confusing situations when user would assign a class, move object around and save ifc file, then to realize that it was saved using just local transforms which can be completely different.
2024-11-20 15:47:41 +05:00
Andrej730 857dd3aa60 Fix linking ifc using relative paths #5768 2024-11-20 14:48:23 +05:00
Andrej730 1a72089b3b Blender 4.3 - fix not hidden Blender scene panels #5767
No idea what happened but in Blender <4.3 `type(bpy.types.SCENE_PT_rigid_body_world_settings.bl_rna)` is `<class 'bl_ui.properties_scene.SCENE_PT_rigid_body_world_settings'>` which is `bpy.types.Panel` but in Blender 4.3 it's now is `bpy.types.Struct`. Using `.base` seems to work for both versions.
2024-11-20 12:02:04 +05:00
Andrej730 361e0419cf Bump Blender to 4.3 in tests 2024-11-20 12:02:04 +05:00
Andrej730 351bc3f364 Bump dev_environment Blender version to 4.3 2024-11-20 12:02:04 +05:00
Ryan Schultz bf717622a0 Assign the render engine via shading_styles.json instead of hardcoding it. 2024-11-19 14:39:49 -06:00
Andrej730 6cc75c1164 Fix error assigning product to non-text annotations (e.g. dimension)
Error: Python: Traceback (most recent call last):
  File "\bonsai\bim\ifc.py", line 443, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\bonsai\bim\module\drawing\operator.py", line 2960, in _execute
    core.edit_assigned_product(tool.Ifc, tool.Drawing, obj=context.active_object, product=product)
  File "\bonsai\core\drawing.py", line 66, in edit_assigned_product
    drawing.update_text_value(obj)
  File "\bonsai\tool\drawing.py", line 983, in update_text_value
    cls.import_text_attributes(obj)
  File "\bonsai\tool\drawing.py", line 904, in import_text_attributes
    props.font_size = str(text_data["FontSize"])
2024-11-19 20:15:44 +05:00
Andrej730 d032f75e61 Fix error updating decorations removing active drawing
should_draw_decorations is updated as part of regular refresh_ui_data.
'removed_drawings' line was a dead code

Traceback (most recent call last):
  File \bonsai\bim\module\drawing\prop.py", line 252, in update_should_draw_decorations
    collection = context.scene.camera.BIMObjectProperties.collection
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'BIMObjectProperties'
File \bonsai\bim\module\drawing\prop.py", line 249, in update_should_draw_decorations
2024-11-19 20:15:44 +05:00
Thomas Krijnen 9bbf345fd7 https://github.com/IfcOpenShell/svgfill/pull/8 2024-11-19 15:50:31 +01:00
Thomas Krijnen 75d7fcdc4b Submodule 2024-11-19 15:34:23 +01:00
Thomas Krijnen 2b3af4cddb Move issue content to test case #5752 2024-11-19 12:51:11 +01:00
Thomas Krijnen 96d6d5bfbe Fix validation false positive on Number #5752 2024-11-19 12:49:10 +01:00
sboddy c7e7031ee5 Fix #5725: Remember DPI and drawing modes (#5762) 2024-11-19 15:32:08 +05:00
Thomas Krijnen 1c54be84ba Fix #5763 use OuterWire 2024-11-19 11:05:20 +01:00
Andrej730 213b6ed3c3 Fix errors reregistering Bonsai
Items generators were exhausted at the first register leading to errors like 'TypeError: EnumProperty(..., default='-'): not found in enum members' preventing reregistration.
2024-11-19 12:53:56 +05:00
Ryan Schultz 837f9e82e2 whoops 2024-11-19 00:42:21 -06:00
Ryan Schultz 1f9e3ffe50 have move_elements_to_top work with Freestyle as well.
Also assign ordering preference.
2024-11-19 00:27:16 -06:00
Ryan Schultz 6201ea7144 small tweak to previous 2024-11-18 23:15:43 -06:00
Ryan Schultz 06d947f869 Some fixes for 812e3dc6df 2024-11-18 22:55:31 -06:00
Andrej730 362c5a17a7 Fix bonsai build
fonttols is now using universal build for the arm64 instead of x86_64
2024-11-18 15:15:53 +05:00
Andrej730 5a4326eb0f Fix calculating cost item resource value ignoring resource inheritance
Mentioned in #5744
2024-11-18 15:01:49 +05:00
Andrej730 68208d88ea Migrate - convert IfcQuantityCounts using float values to IfcQuantityNumber in ifc4x3 #5752
Traceback:
Traceback (most recent call last):
File "\bonsai\bim\module\patch\operator.py", line 187, in execute
core.run_migrate_patch(tool.Patch, infile=self.infile, outfile=self.outfile, schema=self.schema)
File "\bonsai\core\patch.py", line 30, in run_migrate_patch
patch.run_migrate_patch(infile, outfile, schema)
File "\bonsai\tool\patch.py", line 28, in run_migrate_patch
output = ifcpatch.execute(
^^^^^^^^^^^^^^^^^
File "\ifcpatch\__init__.py", line 85, in execute
patcher.patch()
File "\ifcpatch\recipes\Migrate.py", line 58, in patch
new_element = migrator.migrate(element, self.file_patched)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\util\schema.py", line 363, in migrate
new_element = self.migrate_attributes(element, new_file, new_element, new_element_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\util\schema.py", line 393, in migrate_attributes
self.migrate_attribute(attribute, element, new_file, new_element, new_element_schema)
File "\ifcopenshell\util\schema.py", line 494, in migrate_attribute
new_value.append(self.migrate(item, new_file))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\util\schema.py", line 363, in migrate
new_element = self.migrate_attributes(element, new_file, new_element, new_element_schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "\ifcopenshell\util\schema.py", line 393, in migrate_attributes
self.migrate_attribute(attribute, element, new_file, new_element, new_element_schema)
File "\ifcopenshell\util\schema.py", line 497, in migrate_attribute
setattr(new_element, attribute.name(), value)
File "\ifcopenshell\entity_instance.py", line 325, in __setattr__
self[index] = value
~~~~^^^^^^^
File "\ifcopenshell\entity_instance.py", line 363, in __setitem__
raise TypeError(
TypeError: attribute 'CountValue' for entity 'IFC4X3_ADD2.IfcQuantityCount' is expecting value of type 'INT', got 'float'.
Error: Python: Traceback (most recent call last):
File "\ifcopenshell\entity_instance.py", line 361, in __setitem__
self.method_list[idx](self.wrapped_data, idx, entity_instance.unwrap_value(value))
File "\ifcopenshell\ifcopenshell_wrapper.py", line 9271, in setArgumentAsInt
return _ifcopenshell_wrapper.entity_instance_setArgumentAsInt(self, i, v)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'entity_instance_setArgumentAsInt', argument 3 of type 'int'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "\ifcopenshell\entity_instance.py", line 325, in __setattr__
self[index] = value
~~~~^^^^^^^
File "\ifcopenshell\entity_instance.py", line 363, in __setitem__
raise TypeError(
TypeError: attribute 'CountValue' for entity 'IFC4X3_ADD2.IfcQuantityCount' is expecting value of type 'INT', got 'float'.
2024-11-18 15:01:49 +05:00
Andrej730 818c2714e8 Migrate - convert IfcCountMeasures using float values to IfcNumericMeasure in ifc4x3 #5752
Traceback:

Traceback (most recent call last):
  File "\bonsai\bim\module\patch\operator.py", line 187, in execute
    core.run_migrate_patch(tool.Patch, infile=self.infile, outfile=self.outfile, schema=self.schema)
  File "\bonsai\core\patch.py", line 30, in run_migrate_patch
    patch.run_migrate_patch(infile, outfile, schema)
  File "\bonsai\tool\patch.py", line 28, in run_migrate_patch
    output = ifcpatch.execute(
             ^^^^^^^^^^^^^^^^^
  File "\ifcpatch\__init__.py", line 85, in execute
    patcher.patch()
  File "\ifcpatch\recipes\Migrate.py", line 58, in patch
    new_element = migrator.migrate(element, self.file_patched)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\util\schema.py", line 358, in migrate
    new_element = self.migrate_attributes(element, new_file, new_element, new_element_schema)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\util\schema.py", line 388, in migrate_attributes
    self.migrate_attribute(attribute, element, new_file, new_element, new_element_schema)
  File "\ifcopenshell\util\schema.py", line 489, in migrate_attribute
    new_value.append(self.migrate(item, new_file))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\util\schema.py", line 358, in migrate
    new_element = self.migrate_attributes(element, new_file, new_element, new_element_schema)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\util\schema.py", line 388, in migrate_attributes
    self.migrate_attribute(attribute, element, new_file, new_element, new_element_schema)
  File "\ifcopenshell\util\schema.py", line 484, in migrate_attribute
    value = self.migrate(value, new_file)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\util\schema.py", line 346, in migrate
    return new_file.create_entity(element.is_a(), element.wrappedValue)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\file.py", line 400, in create_entity
    e[idx] = arg
    ~^^^^^
  File "\ifcopenshell\entity_instance.py", line 363, in __setitem__
    raise TypeError(
TypeError: attribute 'wrappedValue' for entity 'IFC4X3_ADD2.IfcCountMeasure' is expecting value of type 'INT', got 'float'.
Error: Python: Traceback (most recent call last):
  File "\ifcopenshell\entity_instance.py", line 361, in __setitem__
    self.method_list[idx](self.wrapped_data, idx, entity_instance.unwrap_value(value))
  File "\ifcopenshell\ifcopenshell_wrapper.py", line 9271, in setArgumentAsInt
    return _ifcopenshell_wrapper.entity_instance_setArgumentAsInt(self, i, v)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'entity_instance_setArgumentAsInt', argument 3 of type 'int'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "\ifcopenshell\file.py", line 400, in create_entity
    e[idx] = arg
    ~^^^^^
  File "\ifcopenshell\entity_instance.py", line 363, in __setitem__
    raise TypeError(
TypeError: attribute 'wrappedValue' for entity 'IFC4X3_ADD2.IfcCountMeasure' is expecting value of type 'INT', got 'float'.
2024-11-18 15:01:48 +05:00
Andrej730 545431d95d shapebuilder - fix issue creating profiles on ifc2x3
Position argument was only required for IfcParameterizedProfileDef, not for IfcArbitraryClosedProfileDef
2024-11-18 15:01:48 +05:00
Andrej730 7d087064ab Fix for e0f4fc075
Traceback
2024-11-18:11:09:15,441 ERROR   [log.py:69] Uncaught exception
Traceback (most recent call last):
  File "\bonsai\bim\module\pset_template\ui.py", line 66, in draw
    self.draw_pset_template()
  File "\bonsai\bim\module\pset_template\ui.py", line 110, in draw_pset_template
    value_name = self.props.active_prop_template.get_value_name()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\bonsai\bim\module\pset_template\prop.py", line 175, in get_value_name
    ifc_data_type = IfcStore.get_schema().declaration_by_name(self.primary_measure_type)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\ifcopenshell_wrapper.py", line 10119, in declaration_by_name
    return _ifcopenshell_wrapper.schema_definition_declaration_by_name(self, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Entity with name '-' not found in schema 'IFC4'
2024-11-18 15:01:48 +05:00
Andrej730 3c320960c8 pset templates UI - hide primary measure type for quantitiy props.
As they're used only for psets.
2024-11-18 15:01:48 +05:00
Ryan Schultz 812e3dc6df Automatically introducing \n (newlines) after some designated character count.
as discussed: https://community.osarch.org/discussion/2485/automatically-introducing-n-newlines-after-some-designated-character-count
2024-11-17 17:08:10 -06:00
Ryan Schultz bc2f6b61e0 small UI change for consistency, and misspelling. 2024-11-17 10:08:47 -06:00
Andrej730 e0f4fc0759 Fix error editing prop templates with None PrimaryMeasureType
E.g. all qto props have it's None

Error traceback:
Error: Python: Traceback (most recent call last):
  File "\bonsai\bim\module\pset_template\operator.py", line 135, in execute
    props.active_prop_template.primary_measure_type = template.PrimaryMeasureType
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: bpy_struct: item.attr = val: expected a string enum, not NoneType
2024-11-15 18:25:48 +05:00
Andrej730 934869af98 add_prop_template - consider pset template type for prop/measure types 2024-11-15 18:25:48 +05:00
Andrej730 dad89cfabd Narrow down pset prop template enum items
Depending on whether we're currently editing pset or qto.
Before - https://i.imgur.com/w95q7UC.png
Now - https://i.imgur.com/0uyHPVC.png
2024-11-15 18:25:48 +05:00
Andrej730 3b4cd4eab5 Fix error editing IfcQuantityCounts in IFC4X3
Full error traceback:
Error: Python: Traceback (most recent call last):
  File "\ifcopenshell\entity_instance.py", line 361, in __setitem__
    self.method_list[idx](self.wrapped_data, idx, entity_instance.unwrap_value(value))
  File "\ifcopenshell\ifcopenshell_wrapper.py", line 9271, in setArgumentAsInt
    return _ifcopenshell_wrapper.entity_instance_setArgumentAsInt(self, i, v)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: in method 'entity_instance_setArgumentAsInt', argument 3 of type 'int'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "\bonsai\bim\ifc.py", line 443, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\bonsai\bim\module\pset\operator.py", line 142, in _execute
    ifcopenshell.api.run(
  File "\ifcopenshell\api\__init__.py", line 92, in run
    return usecase_function(ifc_file, should_run_listeners=should_run_listeners, **settings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\__init__.py", line 258, in wrapper
    raise e
  File "\ifcopenshell\api\__init__.py", line 252, in wrapper
    result = usecase(*args, **settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\pset\edit_qto.py", line 135, in edit_qto
    return usecase.execute()
           ^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\pset\edit_qto.py", line 149, in execute
    self.update_existing_properties()
  File "\ifcopenshell\api\pset\edit_qto.py", line 166, in update_existing_properties
    self.update_existing_property(prop)
  File "\ifcopenshell\api\pset\edit_qto.py", line 180, in update_existing_property
    prop[3] = float(value)
    ~~~~^^^
  File "\ifcopenshell\entity_instance.py", line 363, in __setitem__
    raise TypeError(
TypeError: attribute 'CountValue' for entity 'IFC4X3_ADD2.IfcQuantityCount' is expecting value of type 'INT', got 'float'.
2024-11-15 18:25:47 +05:00
Andrej730 43aa6c971a pset.edit_qto - document editing complex quantities 2024-11-15 18:25:47 +05:00
Andrej730 9f372017bc Bonsai - document qset prop type inference from prop name
In "add new prop" operator description - https://i.imgur.com/ODeMDL8.png
2024-11-15 18:25:47 +05:00
Andrej730 de17736002 Bonsai to detect Blender types for added qset props
Example - https://imgchest.com/p/bp452xxbx45

cc @steverugi @DimitriosThe maybe you'll find useful too if you use custom quantity sets for products in 4d/5d
2024-11-15 18:25:47 +05:00
Andrej730 a29b1072e4 Add error trying to add non-numeric custom quantity set value
Example - https://i.imgur.com/NUFN1sR.png
2024-11-15 18:25:47 +05:00
Andrej730 8e4e12ba21 active_pset_type - replace with EnumProperty 2024-11-15 18:25:47 +05:00
Andrej730 ff86bba562 Bonsai to detect Blender types for custom psets/qsets
Previously it was detecting types only if pset/qset had a template, now it will detect length/area/volume props for non-templated psets/qsets too.

Before - https://i.imgur.com/hacuYfx.png
Now - https://i.imgur.com/baA0KBT.png
2024-11-15 18:25:47 +05:00
Andrej730 da70c46c48 editing quantity set to guess type based on name if template is not found
E.g. all props with "Area" in it's name will automatically get IfcQuantityArea type, "Volume" - IfcQuantityVolume, see edit_qto documentation.
2024-11-15 18:25:47 +05:00
Andrej730 b860a8eaad edit_qto - remove dead code from edit_pset 2024-11-15 18:25:46 +05:00
Andrej730 dd0d0ed1af typing 2024-11-15 18:25:46 +05:00
Andrej730 7f40491e41 black . 2024-11-15 18:25:46 +05:00
Thomas Krijnen fd9485e7ea C++ file_open_status not handled in python 2024-11-14 22:00:11 +01:00
Thomas Krijnen dbdc2add81 Parsing file with trailing comment fails 2024-11-14 21:57:27 +01:00
Thomas Krijnen 229e2daa42 submodule 2024-11-14 17:00:18 +01:00
Thomas Krijnen 2a853ee8aa Only install header files, not .cpp 2024-11-14 15:34:48 +01:00
Andrej730 d0b3ecad42 csv2ifc - add header validation 2024-11-14 18:30:47 +05:00
Andrej730 2c9c3e6c7f ConvertPropertiesToQuantities - add test 2024-11-14 18:30:47 +05:00
Andrej730 3c32c9b6ed ConvertPropertiesToQuantities - ifc4x3 support 2024-11-14 18:30:47 +05:00
Andrej730 02621305c9 ConvertPropertiesToQuantities - small fix
Prevent calling add_qto if quantity set was already found in 'qtos'.
2024-11-14 18:30:47 +05:00
Andrej730 3911f51d89 Fix broken ConvertPropertiesToQuantities #5747
Name and Properties arguments were renamed and lowercased.
2024-11-14 18:30:47 +05:00
Andrej730 dfb0f1e828 typing 2024-11-14 18:30:47 +05:00
Andrej730 3270006d8e black . 2024-11-14 18:30:47 +05:00
Thomas Krijnen 54eb83f080 CGAL 6 compatibility regarding aabb_traits_3 and stdlib usage 2024-11-14 13:30:19 +01:00
Thomas Krijnen e7d88ba851 cityjson submodule 2024-11-14 13:29:47 +01:00
Thomas Krijnen e31d164ab2 Merge branch 'v0.8.0' of https://github.com/IfcOpenShell/IfcOpenShell into v0.8.0 2024-11-14 13:28:39 +01:00
Thomas Krijnen 63796aef3b cityjson submodule 2024-11-14 13:28:36 +01:00
Andrej730 ceb49bac0e Note in UI derived schedule work explicitly
There is "*" mark but since we don't have a documentation for this UI section it may be hard for new users to guess what it means.
2024-11-14 16:38:01 +05:00
Andrej730 9f49cbe0c9 bim.calculate_resource_quantity #5744
Added operator to calculate resource quantity based on the output products and the quantity Name.
See video demo - https://imgchest.com/p/9rydjlbmnyk
2024-11-14 16:38:01 +05:00
Andrej730 6c26403b9c resource.remove_resource - fix bug removing IfcRelAssignsToResource
tuple(resource) was resulting in (GlobalId, OwnerHistory, Name, ...) instead of (resource,), so the check never passed and orphaned IfcRelAssignsToResource was never removed.
2024-11-14 16:38:01 +05:00
Andrej730 1f21e96887 resource.remove_resource - fix bug not removing orphaned ifcrelnests 2024-11-14 16:38:01 +05:00
Andrej730 77bc704563 assign/unassign process - add descriptions 2024-11-14 16:38:00 +05:00
Andrej730 2be6afa411 Productivity data operators - remove confusing descriptions 2024-11-14 16:38:00 +05:00
Andrej730 a8d8600087 calculate resource usage/work - add poll messages 2024-11-14 16:38:00 +05:00
Andrej730 6a20ecb2a0 Fix #5746 2024-11-14 11:35:02 +05:00
Bruno Perdigão e74adcbba3 Improve f4cbd13 and add option for profile with voids.
Fix rebase conflict
2024-11-13 11:58:50 -03:00
sboddy 099703fda7 UI drawing improvements (#5677)
* Fix Shift-clicking SVG-DXF conversion

* Fix Schedules and References not incrementing the ID number properly

* Remove the superfluous Create and Open buttons from the Active Drawing pane

* Add active camera indicator to the Drawing list

* Improved enable/disabled icon behaviour

As many operators as possible now use polling method to set enabled/disabled state.
Icons set their enabled/disabled state intelligently depending on what is selected.
When an operator is disabled it says why it is disabled in the tooltip.

* Rename core open_sheet, operator OpenSheet/bim.open_sheet to better reflect what it actually does, i.e. open_layout

* Added selection checkmarks to Sheets, and operator to select all/none, to do batch ops on sheets

* Missed adding the renamed operator to __init__ in commit 4cfc0bd9f3

* Decouple creating and viewing drawings/sheets to avoid focus stealing popups polluting display on long batch runs

* Improve drawing selections in OpenDrawing operator

* Add the Shift+click power move to Create Sheet

* Add the Open Sheet + Shift+click power move

* Improve drawing selections in RemoveDrawing operator

* All operators are now documented with standardised language and terms.

* Add status bar Info messages for feedback on create tasks that now don't have visual feedback

* Fix enable/disable for ActivateDrawing operator icons.

This was a strange one. They have common invoke and execute methods,
but the polling has different conditions.
I tried subclassing the original ActivateDrawing for the Sheets version,
but something about Blenders operators breaks the classmethod decorated
poll. This was the cleanest solution I found, but maybe there's a better
one.

* Placeholder operator for DuplicateSheet function.

Does nothing but report Not Implemented. Could be omitted if this
kind of thing is frowned upon.

* Change icons to be more consistent

* Final changes to toolbars

Change button order and spacing for better usability.
Add a checkmark all/none button, to do batch ops on sheets.
Moved Bonsai Web UI button up to sheets toolbar.
Some general cleanup of unnecessary clutter in the toolbar code.

* Sheet/Drawing checkmarks remember their state properly

* Adjust sheet/drawing operators to view after singular create, but not when batch creating more than one.

* By special request, add back the opening windows when creating, but requiring Ctrl to be pressed.

* black the files

* Second attempt at blacking ui.py because I used an old black

* Change method of getting active drawing to use one in tool import as requested

* Fix for incorrect d1fc5158d - actually checked it this time
2024-11-13 18:38:26 +05:00
Andrej730 6fb7445610 Set blender materials for imported IfcSweptDiskSolids #5687 2024-11-13 18:20:31 +05:00
Andrej730 a7caee14b0 Remove fallback from ca96815 since bonsai build is already updated 2024-11-13 18:20:31 +05:00
Andrej730 2845071621 Fix error switching from different type of representations
E.g. from curve representation to mesh representation and vice versa. Mentioned in #5687.
2024-11-13 18:20:31 +05:00
Andrej730 5913fe881e Fix missing BIM tool UI when just spatial element is active
Noticed by "select decomposition" button missing, spatial elements are unselectable by default - they're just active.

cc @trhyder
2024-11-13 18:20:31 +05:00
Andrej730 659c3295bc Remove unnecessary IFC operators 2024-11-13 18:20:31 +05:00
Andrej730 3bbbfd2351 Show errors if failing to parse false origin / project north 2024-11-13 18:20:30 +05:00
Andrej730 0004689841 typing 2024-11-13 18:20:30 +05:00
Andrej730 e2bf611c17 black . 2024-11-13 18:20:30 +05:00
Andrej730 77fc2a89d0 Oops, fix broken #4771 by mistake 2024-11-13 16:18:56 +05:00
Andrej730 5b63b00e98 Workaround for Blender 4.3 #5743 2024-11-13 15:28:01 +05:00
Thomas Krijnen a522c9a5c9 Submodule 2024-11-13 11:15:15 +01:00
Andrej730 d3333fed96 select decomposition to work on unselectable elements #5739
E.g. ifcspaces or other spatial elements are unselectable by default.
2024-11-13 11:11:34 +05:00
Ryan Schultz a8efc5b1d9 small fix to f4cbd13748 2024-11-12 15:05:28 -06:00
Bruno Perdigão b51a417065 Fix #5726 2024-11-12 17:21:47 -03:00
Bruno Perdigão f4cbd13748 Add the option to create IfcArbitraryClosedProfileDef from an object.
Reference: https://imgur.com/a/E5YhgqV
2024-11-12 16:52:30 -03:00
Andrej730 cba0b79dc0 Cost schedule UI - optimize selecting cost items
On large projects selecting cost items is very slow due to all data that needs to be loaded. On the project I was testing, it was taking about 0.8sec, now this time is reduced to 0.17sec.
2024-11-12 18:40:43 +05:00
Andrej730 26e63c8427 Fix edit_pset for enum props without reference #5707
Similar to fb081e3cf but now we cover case when IfcPropertyEnumeratedValue is passed to properties argument.
2024-11-12 15:38:41 +05:00
Andrej730 ecff7980b3 PsetQto - interpret IFC4X3 as IFC4X3_ADD2 #5732 2024-11-12 14:52:47 +05:00
Andrej730 be6e9200b6 calculate_cost_item_resource_value - remove rounding to preserve the original quantities #5706
Removed 'quantity is None' check since it's never none after c409258ff.
2024-11-12 14:52:47 +05:00
Bruno Perdigão 204a1b1dc6 Measure tool - Add UI button to clear measurement from the screen 2024-11-11 21:15:06 -03:00
Andrej730 d74a0d05fd calculate_cost_item_resource_value - fix bug when 0 resource cost value would be misinterpreted as parent's cost value 2024-11-11 18:30:57 +05:00
Andrej730 70e75f5ed2 calculate_cost_item_resource_value not to skip 0 costs/quantities
That way all assigned resources will be added as cost values to cost items and it will be more apparent what resources were used for the last calculation and what costs/quantities they had at the time.
2024-11-11 18:30:56 +05:00
Andrej730 8ffa208ca7 Increase rounding precision for updating cost item resource values #5706
Co-Authored-By: DimitriosThe <169245599+DimitriosThe@users.noreply.github.com>
2024-11-11 18:30:55 +05:00
Andrej730 c409258ff3 calculate_cost_item_resource_value not to skip resources without quantities
Noticed the discrepancies for total cost value for resources in Resource UI and in Cost Schedule UI when the same resources assigned to the item. In Resource UI it was considering omitted quantity as 1.0 (https://github.com/IfcOpenShell/IfcOpenShell/blob/c61e3670a8cf248aa5a229bae2dc29eef041fe47/src/ifcopenshell-python/ifcopenshell/util/cost.py#L53-L55) and in Cost Schedule UI it was skipping those resources completely.

For cost items it is documented in ifc that if quantity is omitted then costs are considered to be total. Perhaps it's just not documented for the resources? Anyway, not sure if this way is completly correct but making sure resource quantity to be treated similarly in different parts of the codebase.

Related to - https://github.com/buildingSMART/IFC4.3.x-development/issues/910
cc @myoualid
2024-11-11 18:30:55 +05:00
Andrej730 de414313d3 Fix cost values for resources not updating properly 2024-11-11 18:30:55 +05:00
Andrej730 0f421da6e3 Multifile properties to show selected paths
Before - https://i.imgur.com/AkPvTy3.png
After - https://i.imgur.com/znxLqb7.png
2024-11-11 18:30:55 +05:00
Andrej730 478dcb8d78 Fix UI errors selecting empty ifcpatch ("-") 2024-11-11 18:30:55 +05:00
Andrej730 37d9cade92 black . 2024-11-11 18:30:55 +05:00
Andrej730 004488533f typing 2024-11-11 18:30:55 +05:00
Thomas Krijnen 088bc207ab Don't fail on untyped enumerations 2024-11-11 13:57:36 +01:00
Andrej730 c61e3670a8 fix test_removing_existing_element_representations_and_mapping_type_representations
Started failing after 8061e22. Test was instantiating abstract IfcProductRepresentation
2024-11-11 16:31:14 +05:00
Andrej730 c5aad82e3d typing - add missing settings 2024-11-11 16:31:14 +05:00
Andrej730 acd93ead4d Fix crash during test_remove_fill_area_with_fill_area_style_hatching 2024-11-11 16:31:14 +05:00
Andrej730 8070338087 fix test_remove_non_surface_styles
.FillStyles is not optional for IfcFillAreaStyles
2024-11-11 16:31:14 +05:00
Andrej730 05542ca6ec Fix failing ifcopenshell ci tests due missing ifcpatch (56de208) 2024-11-11 16:31:13 +05:00
Thomas Krijnen 8932d8758e validate.py distinguish internal errors from invalid files 2024-11-11 11:09:26 +01:00
Thomas Krijnen 130afac752 Revert back to github occt uri due to persistent 500 2024-11-11 08:58:01 +01:00
Andrej730 67f8c74c70 Fix processing ifcpatch docs after fe8c396e1
bim.update_ifc_patch_arguments in Bonsai wasn't ready for list[xxx] generic and was throwing errors and not showing browse file button.
2024-11-11 12:48:43 +05:00
Thomas Krijnen 6ece1648ab Update entity_instance.py after 8ae951d
cc @Andrej730 we need this for validate.buildingsmart.org because for express rule evaluation we depend on include_id=False and entity_instance.__eq__ has been changed to get_info_2.
2024-11-10 15:06:41 +01:00
Bruno Perdigão 2165dbb3fa Minor fix after 10aad5a531 2024-11-08 17:04:07 -03:00
Bruno Perdigão 10aad5a531 Change hotkey for angle lock in polyline tool, from "L" to "A". 2024-11-08 17:00:47 -03:00
Bruno Perdigão 23c30e7642 Implement #3083 2024-11-08 16:25:21 -03:00
Bruno Perdigão f08959aaa9 Fix - Measure tool plane method now works with object snap. 2024-11-08 16:06:28 -03:00
Bruno Perdigão b416df538a Add AuthoringData.data["relating_type_id_current"] to model data. 2024-11-08 11:20:17 -03:00
Bruno Perdigão 084c2aa25a Add AuthoringData.data["ifc_class_current"] to model data. 2024-11-08 11:20:17 -03:00
Bruno Perdigão 66ded3fc41 Partially fix an issue with BIMModelProperties ifc_class enum. 2024-11-08 11:20:17 -03:00
Bruno Perdigão 4b558604cc Remove mathutils dependency from add_slab_representation.py 2024-11-08 10:34:11 -03:00
Bruno Perdigão 024566887d Minor fix 2024-11-08 10:34:11 -03:00
Andrej730 916c6a94f1 bim.remove_cost_value - fix misleading label 2024-11-08 18:32:20 +05:00
Andrej730 af1f3cad34 bim.calculate_cost_item_resource_value - tooltip 2024-11-08 18:32:20 +05:00
Andrej730 534355cd33 Fix for 1acf8f1 2024-11-08 18:32:20 +05:00
Andrej730 a0226eb0a1 document double tags for fill-bg #5719
It seems we lost this comment at some point.
2024-11-08 18:32:20 +05:00
Andrej730 1fa3478a9d bim.execute_ifc_tester - remove unnecessary ifc operator 2024-11-08 18:32:20 +05:00
Andrej730 f7a7626575 ifctester to fail more gracefully meeting invalid .ids file
Previously Bonsai would show a wall of errors, now it's show a simple error message and redirecting to system console for the details.

Example error - https://i.imgur.com/uJJfjUW.png
Example validation error details in console - https://i.imgur.com/3mcVBUh.png

Same details but in text:
Validation error details:

failed validating {'dataType': 'IFCBOOLEAN', 'ursi': 'https://google.com', 'cardinality': 'required', 'instructions': "Make sure it's true"} with XsdAttributeGroup(['dataType', 'uri', 'cardinality', 'instructions']):

Reason: 'ursi' attribute not allowed for element

Schema component:

  <xs:extension xmlns:xs="http://www.w3.org/2001/XMLSchema" base="ids:propertyType">
      <xs:attribute name="uri" type="xs:anyURI" use="optional" />
      <xs:attribute name="cardinality" type="ids:conditionalCardinality" use="optional" default="required" />
      <xs:attribute name="instructions" type="xs:string" use="optional">
          <xs:annotation>
              <xs:documentation>Author of the IDS can leave instructions for the authors of the IFC. This text could/should be displayed in the BIM/IFC authoring tool.</xs:documentation>
          </xs:annotation>
      </xs:attribute>
  </xs:extension>

Instance type: <class 'xml.etree.ElementTree.Element'>

Instance:

  <ids:property xmlns:ids="http://standards.buildingsmart.org/IDS" dataType="IFCBOOLEAN" ursi="https://google.com" cardinality="required" instructions="Make sure it's true">
    <ids:propertySet>
      <ids:simpleValue>Pset_WallCommon</ids:simpleValue>
    </ids:propertySet>
    <ids:baseName>
      <ids:simpleValue>Combustible</ids:simpleValue>
    </ids:baseName>
    <ids:value>
      <ids:simpleValue>false</ids:simpleValue>
    </ids:value>
  </ids:property>

Path: /ids:ids/ids:specifications/ids:specification/ids:requirements/ids:property[1]
2024-11-08 18:32:20 +05:00
Andrej730 0a7ee4e360 ifctester.main - fail more gracefully for invalid files 2024-11-08 18:32:20 +05:00
Andrej730 466ba6c159 get_components - add test 2024-11-08 18:32:20 +05:00
Andrej730 1a19864e82 get_contained - add test 2024-11-08 18:32:20 +05:00
Andrej730 36f12b5145 Fix get_pset tests after 832ad6d31 2024-11-08 18:32:20 +05:00
Andrej730 eed4985957 get_parts - add test 2024-11-08 18:32:20 +05:00
Andrej730 5597095198 util.element - check schema version explicitly 2024-11-08 18:32:19 +05:00
Andrej730 1b2508f8de Fix util.element for cases with multiple rels #5713
Got report that there was an issue with get_parts not returning all parts if there are multiple IfcRelAggregates involved though it is valid ifc. Fixed the same possible issue for ContainsElements, IsNestedBy
2024-11-08 18:32:19 +05:00
Andrej730 77e6ab3b8b MergeProjects - temporary handle old way of passing files to merge 2024-11-08 18:32:19 +05:00
Andrej730 fe8c396e12 typing 2024-11-08 18:32:19 +05:00
Blender Defender 1d3ca475d9 fix: Rename the "MergeProject" recipe to "MergeProjects" (#5187)
* fix: Rename the "MergeProject" recipe to "MergeProjects"

This rename, alongside renaming "filepath" to "filepaths" and adjusting the docstring has been done to clarify, that this patch can be used to merge multiple IFC files into one (and not just two)

* fix: Fix `test_Merge_Project.py`, which was broken due to renaming the patch recipe
2024-11-08 10:51:47 +05:00
Andrej730 09fcd32b7a Fix error duplicating array item after c415767 #5705
error traceback
```
Traceback (most recent call last):
  File "bonsai\bim\module\geometry\operator.py", line 909, in execute
    return OverrideDuplicateMove.execute_duplicate_operator(self, context, linked=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bonsai\bim\module\geometry\operator.py", line 918, in execute_duplicate_operator
    IfcStore.execute_ifc_operator(self, context)
  File "bonsai\bim\ifc.py", line 443, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bonsai\bim\module\geometry\operator.py", line 912, in _execute
    return OverrideDuplicateMove.execute_ifc_duplicate_operator(self, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "bonsai\bim\module\geometry\operator.py", line 1021, in execute_ifc_duplicate_operator
    tool.Model.handle_array_on_copied_element(new, array_data)
  File "bonsai\tool\model.py", line 673, in handle_array_on_copied_element
    array_pset_data = array_pset["Data"]
                      ~~~~~~~~~~^^^^^^^^
KeyError: 'Data'
```
2024-11-07 17:38:39 +05:00
Andrej730 fb081e3cf2 pset.edit_pset - fix issue editing enum props without EnumerationReference #5707
Traceback
```
Error: Python: Traceback (most recent call last):
  File "\bonsai\bim\ifc.py", line 443, in execute_ifc_operator
    result = getattr(operator, "_execute")(context)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\bonsai\bim\module\pset\operator.py", line 126, in _execute
    ifcopenshell.api.run(
  File "\ifcopenshell\api\__init__.py", line 92, in run
    return usecase_function(ifc_file, should_run_listeners=should_run_listeners, **settings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\__init__.py", line 252, in wrapper
    result = usecase(*args, **settings)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\pset\edit_pset.py", line 166, in edit_pset
    return usecase.execute()
           ^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\pset\edit_pset.py", line 176, in execute
    existing_props = self.update_existing_properties()
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\pset\edit_pset.py", line 225, in update_existing_properties
    prop = self.update_existing_prop_enum(prop)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "\ifcopenshell\api\pset\edit_pset.py", line 251, in update_existing_prop_enum
    primary_measure_type = prop.EnumerationReference.EnumerationValues[
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'EnumerationValues'
```
2024-11-07 17:09:57 +05:00
Andrej730 b0cc2e30a9 Fix error starting to edit pset without enum reference/enum values #5707
Traceback
Error: Python: Traceback (most recent call last):
  File "\bonsai\bim\module\pset\operator.py", line 62, in execute
    core.enable_pset_editing(tool.Pset, pset, self.pset_name, self.pset_type, self.obj, self.obj_type)
  File "\bonsai\core\pset.py", line 86, in enable_pset_editing
    pset_tool.import_pset_from_existing(pset, props)
  File "\bonsai\tool\pset.py", line 121, in import_pset_from_existing
    metadata.set_value(prop.EnumerationReference.EnumerationValues[0].wrappedValue)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'EnumerationValues'
2024-11-07 17:09:56 +05:00
Andrej730 d9186bce11 Bonsai to show different error for Python 3.12 users #5704 2024-11-07 17:09:56 +05:00
Andrej730 cc15e6b3c1 typing 2024-11-07 17:09:56 +05:00
Andrej730 832ad6d318 Prioritize existing data types for templates props for safety
Noticed working on #5596 and #5708 a few issue when pset template is changing the prop types.

E.g. prop had string data type and now template suggests that it should be a float.
Previously, it might error trying to cast a string to a float. Now it will show a float until user will set it to null, then next time it will be loaded from the template data type.

Another example - prop was a string and now it's a boolean. Previously, it would be cast to boolean implicitly. E.g. "test" -> bool("test") -> True. And if user wouldn't be paying attention then enabling pset editing and saving it would make them lose "test" value.

Now - https://imgchest.com/p/na7ke99wb78
Before - https://imgchest.com/p/5xy23rr3z4l
2024-11-07 16:21:12 +05:00
Andrej730 3ad713d5c6 Patch Ifc4 psets that missing IfcThermalTransmittanceMeasure type in ThermalTransmittance props
Similar to #5708
Affected psets: Pset_RampCommon, Pset_StairCommon.
2024-11-07 16:21:12 +05:00
Andrej730 822107a6ed Patch Ifc4 psets that missing IfcBoolean type in LoadBearing props #5708
Affected psets: Pset_RoofCommon, Pset_RampCommon, Pset_StairCommon.
Also fixed the missing description for that prop.
2024-11-07 16:21:12 +05:00
Andrej730 90d5509046 Add min 0 value to IFC props in UI
Basically it won't allow setting values below 0 by accident (especially important for representation item props as it may lead to a crash).

1) IfcPositiveLengthMeasure will affect bunch of props like Depth in IfcExtrudedAreaSolid.
2) IfcNonNegativeLengthMeasure will affect MaterialLayer and some profiles attributes.
2024-11-07 16:21:11 +05:00
Andrej730 f0a6906d73 Use helper.import_attributes for representation item attributes 2024-11-07 16:21:11 +05:00
Andrej730 bbca07d535 Edit other representation item attributes besides IfcSweptSolid depth
Examples:
- https://imgchest.com/p/qb4zjgbklyj
- https://imgchest.com/p/lqye68r2k4d

Added this feature in a very experiment way, I'm sure it will break very soon and we'll be able to refine it.
2024-11-06 18:26:57 +05:00
Andrej730 9a77222017 Option to add IfcEllipse as representation item
Example - https://i.imgur.com/PADKlAq.png
2024-11-06 18:06:51 +05:00
Andrej730 19cbf6d140 ifcfm - move preset searching logic from ifcm to bonsai
So anyone using 'python -m ifcfm' will get more readable error for invalid presets.
2024-11-06 18:06:51 +05:00
Andrej730 9821c343ca Keep bim.select_container available for IfcProjects too
As it's the quicker way to select it than searching it in outliner - https://i.imgur.com/p2NVcdR.png
Couldn't find a simpler a way to do it in UI and had to create bunch of columns. Tried to use splits but they end up readjusting the buttons.
2024-11-06 18:06:50 +05:00
Andrej730 a3845c2b5c Reload decorator after item attributes are updated and it's representation is reloaded 2024-11-06 18:06:50 +05:00
Andrej730 5c33a66548 Hide assign class panel for representation items 2024-11-06 18:06:50 +05:00
Andrej730 ecdbcff1aa ifcfm operators - add info message when it's finished 2024-11-06 17:51:04 +05:00
Andrej730 47853bc551 Prevent user from selecting unavailable tabs from dropdown if ifc project is not loaded 2024-11-06 17:51:04 +05:00
Andrej730 41fc0cf8c1 BIMTabProperties fixes
1) Fixed non-existent tool.Blender.get_screen
2) ui.py - remove try/except for the case when tabs are not loaded yet as it's covered by BIMTabProperties
3) removed previous_tab, alt_tab props never used in ui
4) general method for getting area properties that includes BIMTabProperties automatically
2024-11-06 17:51:04 +05:00
Andrej730 e3de9c3ea4 bim.set_tab / bim.switch_tab not to create undo steps
To avoid unnecessary steps in undo history like on the screenshot - https://i.imgur.com/vEpsYa5.png
2024-11-06 17:51:04 +05:00
Andrej730 c594bc2c1a bim.execute_ifcfm_federate - small fixes 2024-11-06 17:51:03 +05:00
Andrej730 d89be97bcd ifcclash docs - small fix 2024-11-06 17:51:03 +05:00
Andrej730 c63469f85e ifcm - fix missing ifcopenshell import 2024-11-06 17:51:03 +05:00
Andrej730 cf68c5755b ifcfm - add example 2024-11-06 17:51:03 +05:00
Andrej730 3d79ae53ad ifcfm - fix bug exporting csvs to folder that didn't yet existed 2024-11-06 17:51:03 +05:00
Andrej730 681b89d95c Bonsai - improve error message if ifc file fails to open #5694 2024-11-06 17:51:03 +05:00
Andrej730 4fdb313449 typing 2024-11-06 17:50:47 +05:00
Andrej730 4e070545ae black . 2024-11-06 16:04:03 +05:00
Andrej730 36bd89bb40 ifcopenshell.util.element.get_type to be less strict again after d443c5e
I guess by accident in d443c5e I've made this method too strict and it broke get_references using it for IfcPropertySets. Maybe it's a good idea to make it more strict in the future, for now just restoring the previous behaviour.
2024-11-06 16:04:02 +05:00
Thomas Krijnen e70bc04915 Update draw.py with provisionary access to arrange_spaces 2024-11-06 09:17:32 +01:00
Thomas Krijnen 585821d763 Update wrapper for svgfill::arrange_polygons() 2024-11-06 09:15:59 +01:00
Andrej730 262fca95e3 Bump IOS build #5661 2024-11-06 10:52:43 +05:00
Thomas Krijnen a2538fdd35 Update ci.yml 2024-11-05 16:13:47 +01:00
Thomas Krijnen 3c174e3dc9 svgfill submodule with arrange_polygons API 2024-11-05 15:43:37 +01:00
Richard Brice 3672ce90d0 Minor tweak for cant with IfcCosineSpiral and IfcSineSpiral 2024-11-04 15:00:27 -08:00
Bruno Perdigão 6729739ee8 Fix a bug where the product decorator displays the incorrect position when type origin is not at world origin. 2024-11-04 10:48:11 -03:00
Bruno Perdigão 4a8710efd8 Fix product decorator to be uninstalled after mouse right click. 2024-11-04 10:27:49 -03:00
Ryan Schultz f2c96b65e0 If perspective, don't add scale to the view title 2024-11-03 09:29:11 -06:00
Richard Brice bf8c3530a1 Fixes piecewise function evaluation in alignment api 2024-11-02 14:42:44 -07:00
Andrej730 caeabe2cd5 Optimize enums by moving them to data.py 2024-11-01 16:13:16 +05:00
Andrej730 9c0256165e Use static enum items instead of dynamic 2024-11-01 16:13:16 +05:00
Andrej730 1acf8f1ed8 deprecate some prop.purge 2024-11-01 16:13:16 +05:00
Andrej730 0944f8a7cb Fix unsafe enum items #5673 2024-11-01 16:13:15 +05:00
Andrej730 3debf62ca6 Mark unsafe enums #5673 2024-11-01 16:13:15 +05:00
Andrej730 f3019e4d7a Store enum items strings references to be safe #5673 2024-11-01 16:13:15 +05:00
Andrej730 33b7c0a76f small optimizations for enum props 2024-11-01 16:13:15 +05:00
Andrej730 ae18590893 typing 2024-11-01 16:13:15 +05:00
Dawid Huczyński 7517414552 add favicon to ifcopenshell-python and bonsaibim docs 2024-11-01 15:19:08 +05:00
Thomas Krijnen 63e98e69e9 Test whether polygonal boundary is simple #5665 2024-11-01 11:15:09 +01:00
Bruno Perdigão 4c08eaf953 Add a proposal to #3692 2024-10-31 17:43:30 -03:00
Bruno Perdigão 05b32b3c32 Fix #4298 2024-10-31 15:38:57 -03:00
Richard Brice f3ce57480a Fixes unit conversion problem in IfcCurveSegment 2024-10-31 08:55:01 -07:00
Andrej730 08e38c65f5 Display Ifc length attributes as Blender length properties
Basically now all length ifc attributes should be displayed in UI as Blender length properties - they display the units and allow math, typing different units, etc.

Example - https://imgchest.com/p/dl7p93gz64o
2024-10-31 18:40:14 +05:00
Andrej730 3e44f0f37b Quick way to select profile in profiles UI
Example - https://imgchest.com/p/9rydakllwyk
2024-10-31 18:40:14 +05:00
Andrej730 bd7ca78a37 bonsai - print number of voids for elements that hit void_limit 2024-10-31 18:40:13 +05:00
Andrej730 c53885f642 bonsai ifcclash - add separate property for export path
Example - https://i.imgur.com/bCRHx9q.png
Needed so it will be easier to rerun ifc clash without providing the same filepath each time.
2024-10-31 18:40:13 +05:00
Andrej730 e56589d544 ifcclash - fix broken list 2024-10-31 18:40:13 +05:00
Andrej730 380e791c59 ifcpatch - add pip installation to readme 2024-10-31 18:40:13 +05:00
Andrej730 904eb9fae8 Fix undo bugs with edited_objs
Now it's stored as a collection property in the project properties, so in the most cases we delegate to Blender to ensure it's handled properly on undo and redo.
2024-10-31 18:40:13 +05:00
Andrej730 09df81ab15 typing 2024-10-31 18:40:13 +05:00
Andrej730 b35ef2f101 black . 2024-10-31 18:40:13 +05:00
Andrej730 fb5d37b04b Fix support for python 3.10 #5662 2024-10-31 18:28:24 +05:00
Andrej730 06a6c2d79b Option to apply openings to the geometry #5666
Button location - https://i.imgur.com/6zSv8vV.png
Now it's possible to "bake" openings to the geometry, The openings representation will be marked as "Reference".
2024-10-31 17:00:43 +05:00
Andrej730 b39f96e2ee Fix bug duplicating edited object
It was losing original object representation on project save as it wasn't marked as edited.
2024-10-31 15:50:21 +05:00
Andrej730 64b3101cef Skip applying scale to geometry on duplicate #5663 2024-10-31 15:50:21 +05:00
Thomas Krijnen 4cd8428d1d Update unit.py 2024-10-31 11:00:02 +01:00
Thomas Krijnen 0446befefa More permissive interval overlap test for 2d opening evaluation #5661 2024-10-31 10:35:30 +01:00
Andrej730 037b5d1bc1 Spatial container drop down to show only spatial objects
Example - https://i.imgur.com/v8p4D57.png (it's ignoring walls).
Since we now filter valid elements in poll_container_obj, then there is no need to check it twice in update_container_obj.
2024-10-30 18:45:50 +05:00
Andrej730 e463407de7 void_limit - document 2024-10-30 18:07:34 +05:00
Andrej730 28f81496dd Small refactor for sync_edited_objects
1) remove materials if-branch as they're never edited
2) validate object explicitly
2024-10-30 18:07:34 +05:00
Andrej730 ccb223be94 Remove unnecessary ifc.finish_edits
Unused since we do not use fc.edit anymore for parametric geometry
2024-10-30 18:07:34 +05:00
Andrej730 33ed7e5234 typing 2024-10-30 18:07:34 +05:00
Andrej730 0662b0c5b6 Optimize updating representations adding/removing openings
No need to update all possible elements from decomposition because openings affect only related objects from IfcRelAggregate. For example, see #5639.
2024-10-30 18:07:34 +05:00
Andrej730 59e0dbae2c Fix 8ac9612 for IfcMaterials 2024-10-30 15:32:45 +05:00
Andrej730 e757c42204 Quick way to select style in Styles UI
Example - https://imgchest.com/p/ej7mkxp9ayd
2024-10-30 15:32:45 +05:00
Andrej730 b6da13c504 Fix hiding by accident object class asignment section in 86d0139f4 2024-10-30 15:32:45 +05:00
Andrej730 a66cffddb8 ifcopenshell-python - note about supported glibc versions 2024-10-30 15:32:45 +05:00
Andrej730 4dfb3cac51 bump ios build in bonsai
e8eb397 fixes #5658
2024-10-30 11:42:34 +05:00
Thomas Krijnen 3d4988349a Remove self-intersecting faces #5650 2024-10-29 15:43:02 +01:00
Andrej730 fa07f184c3 ifctester - indicate optionality in report message
Previously for both cardinality optional/required ifctester would show same results.

E.g.
<ids:property dataType="IFCBOOLEAN" cardinality="required">
<ids:property dataType="IFCBOOLEAN" cardinality="optional">

Were resulting in something like
LoadBearing data shall be true and in the dataset Pset_WallCommon
LoadBearing data shall be true and in the dataset Pset_WallCommon

Now it will result in
LoadBearing data shall be true and in the dataset Pset_WallCommon
LoadBearing data may be true and in the dataset Pset_WallCommon
2024-10-29 18:16:54 +05:00
Andrej730 067203cb9a ifctester webapp - add some tooltips 2024-10-29 18:16:06 +05:00
Andrej730 e9731f3047 ifctester webapp - fix issue with launching audit 2024-10-29 18:16:05 +05:00
Andrej730 fa0805fe29 ifctester webapp - fix for latest ids version 2024-10-29 18:16:05 +05:00
Andrej730 14bac88aca ifctester.webapp - add to readme 2024-10-29 18:16:05 +05:00
Andrej730 edafb722e4 Fix ifctester readme 2024-10-29 18:16:05 +05:00
Andrej730 8ac96124c9 Fix UI errors opening non-IfcMaterials in Materials UI
There was UI errors because ui data wasn't updated, now ui data update is tied to load_materials
2024-10-29 18:16:05 +05:00
Andrej730 bb23d74ce3 Fix bug in 4c93270ad for IfcMaterialLayers 2024-10-29 18:16:05 +05:00
Andrej730 ff0fe0db06 Small optimization for materials UI 2024-10-29 18:16:05 +05:00
Andrej730 834be2d6a8 geometry.add_wall_representation - document 2024-10-29 18:16:05 +05:00
Andrej730 af01f6b6c7 geometry.create_2p_wall - document 2024-10-29 18:16:05 +05:00
Andrej730 87d185fef1 Lock scale for aggregate parts too if aggregate has openings 2024-10-29 18:16:05 +05:00
Andrej730 bfa2852ca9 typing 2024-10-29 18:16:04 +05:00
Cristian Ritter cf0a4e2bde Handle with lowercase hexadecimals #5620 2024-10-28 19:58:43 +01:00
Andrej730 fd6a541689 bonsai bcf v3 - fix issue activating camera in some cases 2024-10-28 20:10:39 +05:00
Andrej730 4c3bb54f98 bim.update_representation to detect openings from it's aggregate and show an error
Previously it would apply scale and geometry with opening to the representation, basically corrupting it.
2024-10-28 18:22:11 +05:00
Andrej730 6a4167e234 bim.add_opening to sync representations before adding an opening
E.g. if object was scaled or edited. Previously geometry changes were either lost or applied in a weird way (to the object without scale).
2024-10-28 18:21:43 +05:00
Andrej730 147f0bfc9a Sync parts positions before applying the opening
To avoid issues like this - https://imgchest.com/p/bp45zlzen45
2024-10-28 18:21:43 +05:00
Andrej730 a4979a74b2 Fix bug object position wouldn't be synced on project save
If project had scale and openings then bim.update_representation wouldn't apply it's position leading to unsynced position.
2024-10-28 18:21:42 +05:00
Andrej730 850c16c745 Fix bug when object scale wouldn't be applied on project save if object wasn't moved 2024-10-28 18:21:42 +05:00
Andrej730 b96e275251 Fix bim.update_representation not apply scales if object wasn't moved
Was also creating same issue when project was saved
2024-10-28 18:21:42 +05:00
Andrej730 48a7af76ad Bump Blender build and simplify sun_position installation 2024-10-28 18:21:42 +05:00
Andrej730 3f4a0128c7 ifcsverchok - fix poll error opening operator search 2024-10-28 18:21:42 +05:00
Andrej730 bdbe91f043 typing 2024-10-28 18:21:42 +05:00
Andrej730 86d0139f41 Hide object related panels when there is no object active 2024-10-28 16:23:35 +05:00
Andrej730 f2e9f2beb9 Fix error adding custom pset to material set item when no item currently edited
Error traceback posted in #5647
2024-10-28 16:23:35 +05:00
Andrej730 4c93270adc Select material in materials UI #5647
Example - https://imgchest.com/p/6eyr8j8ag7p
2024-10-28 16:07:23 +05:00
Andrej730 320142f8e2 Hide material sets panels if there is no material set #5647 2024-10-28 16:07:23 +05:00
Andrej730 88d133b4cc Fix ifc calls on every draw call for material set pset names enum 2024-10-28 16:07:23 +05:00
Andrej730 7fef81c0b9 black . 2024-10-28 16:06:27 +05:00
Thomas Krijnen 92b63a0ef2 Update build-all.py - add 3.13.0 2024-10-27 06:55:38 +01:00
Ryan Schultz fc57a7bbf4 Fix #5078: A way to quickly sum up a qto value of multiple selected objects 2024-10-26 14:26:25 -05:00
Thomas Krijnen 68062f54d8 Gracefully handle missing aggregate header fields #5626 2024-10-26 17:21:15 +02:00
Thomas Krijnen d6ed28e504 Update build-all.py - add rhel-related comment 2024-10-26 17:11:23 +02:00
civilx64 8ff4cef7ec lint with black 2024-10-26 17:06:24 +02:00
civilx64 8d001d0120 cleanup from original python alignment prototyping
`transition_curve.py` is now obsolete and has been removed.
A python port of IfcAlignmentHelper.cpp has also been started.
It needs further development to accommodate vertical alignment.
2024-10-26 17:06:24 +02:00
694 changed files with 30423 additions and 12934 deletions
+20
View File
@@ -0,0 +1,20 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
Replace this text describing what problem occurred and what you expected to happen instead.
1. To reproduce this, open file '...'
2. Click on '....'
3. See error
**Attachments**
If applicable, add screenshots to help explain your problem. Please also drag-drop any files necessary to show the error (rename the file extension from .ifc to .txt to upload). Private files can be uploaded to https://ifcopenshell.org/upload.html - only viewed by core developers and will be deleted afterwards.
**Debug information**
If this is in Bonsai, paste the output from the Copy Debug Information option in Bonsai. It can be found under Quality and Coordination -> Quality Control -> Debug. If this is a general software issue, if relevant include details about IfcOpenShell version, operating system, Python version, etc.
+10
View File
@@ -0,0 +1,10 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
Replace this text and describe a feature you'd like us to add. If it's not obvious, explain why this feature is awesome. Note that feature requests must be specific and measurable.
+138
View File
@@ -0,0 +1,138 @@
name: Build IfcOpenShell OSX
on:
workflow_dispatch:
jobs:
build_ifcopenshell:
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- os: macos
runner: macos-13
arch: x64
oldarch:
- os: macos
runner: macos-14
arch: arm64
oldarch: m1
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Checkout Build Repository
uses: actions/checkout@v3
with:
repository: IfcOpenShell/build-outputs
path: ./build
ref: ${{ matrix.os }}-${{ matrix.arch }}
lfs: true
token: ${{ secrets.BUILD_REPO_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install Dependencies
run: |
brew update
brew install git bison autoconf automake libffi cmake findutils
echo "$(brew --prefix findutils)/libexec/gnubin" >> $GITHUB_PATH
- name: Unpack Dependencies
run: |
install_root=$(find ./build -maxdepth 4 -name install)
find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \;
- name: ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${GITHUB_WORKFLOW}-${{ matrix.os }}
- name: Run Build Script
run: |
if [ "${{ matrix.os }}" == "macos" ]; then
DARWIN_C_SOURCE=-D_DARWIN_C_SOURCE
fi
CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release python3 ./nix/build-all.py --diskcleanup
- name: Pack Dependencies
run: |
cd build
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do
test -f $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz || tar -czf $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz -C $(dirname "$install_dir") $(basename "$install_dir");
done
- name: Commit and Push Changes to Build Repository
run: |
cd build
git config user.name "IfcOpenBot"
git config user.email "ifcopenbot@ifcopenshell.org"
git add "$(find . -maxdepth 4 -name install)/*.tar.gz"
git commit -m "Update build artifacts [skip ci]" || echo "No changes to commit"
git push || true
- name: Package .zip archives
run: |
VERSION=v`cat VERSION`
cd ./build/`uname`/*/10.9/install/ifcopenshell
mkdir ~/output
ls -d python-* | while read py_version; do
postfix=`echo ${py_version: -1} | sed s/[0-9]//`
numbers=`echo $py_version | grep -oE '[0-9]+\.[0-9]+' | tr -d '.'`
py_version_major=python-${numbers}$postfix
pushd . > /dev/null
cd $py_version
if [ ! -d ifcopenshell ]; then
mkdir ../ifcopenshell_
mv * ../ifcopenshell_
mv ../ifcopenshell_ ifcopenshell
fi
[ -d ifcopenshell/__pycache__ ] && rm -rf ifcopenshell/__pycache__
find ifcopenshell -name "*.pyc" -delete
zip -r -qq ifcopenshell-${py_version_major}-${VERSION}-${GITHUB_SHA:0:7}-macos${{ matrix.oldarch }}64.zip ifcopenshell/*
mv *.zip ~/output
popd > /dev/null
done
cd bin
rm *.zip || true
ls | while read exe; do
zip -qq -r ${exe}-${VERSION}-${GITHUB_SHA:0:7}-macos${{ matrix.oldarch }}64.zip $exe
done
mv *.zip ~/output
cd ..
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Overwrite aws cli
run: |
# Error: The `brew link` step did not complete successfully
# The formula built, but is not symlinked into /usr/local
# Could not symlink bin/idle3
# Target /usr/local/bin/idle3
# already exists. You may want to remove it:
# rm '/usr/local/bin/idle3'
#
# To force the link and overwrite all conflicting files:
# brew link --overwrite python@3.13
brew link --overwrite python@3.12
brew link --overwrite python@3.13
# https://github.com/rust-lang/rustup/pull/3989/files
brew install --overwrite awscli
- name: Upload .zip archives to S3
run: |
aws s3 cp ~/output s3://ifcopenshell-builds/ --recursive
+54
View File
@@ -0,0 +1,54 @@
name: Build IfcOpenShell WASM / Pyodide
on:
workflow_dispatch:
jobs:
build_ifcopenshell:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
path: IfcOpenShell
- name: Checkout Pyodide
uses: actions/checkout@v3
with:
submodules: recursive
repository: pyodide/pyodide
ref: '0.26.4'
token: ${{ secrets.BUILD_REPO_TOKEN }}
path: pyodide
- name: Build
run: |
VERSION=`cat IfcOpenShell/VERSION`
sed -i s/0.8.0/$VERSION/g IfcOpenShell/pyodide/meta.yaml
sed -i s/0.8.0/$VERSION/g IfcOpenShell/pyodide/setup.py
echo '#!/usr/bin/bash' > script.sh
echo 'cd pyodide' > script.sh
echo 'make && pip install ./pyodide-build' >> script.sh
echo 'cd ..' >> script.sh
echo 'mkdir -p packages/ifcopenshell' >> script.sh
echo 'cp IfcOpenShell/pyodide/meta.yaml packages/ifcopenshell' >> script.sh
echo 'PYODIDE_ROOT=/src/pyodide \' >> script.sh
echo 'PATH=/src/pyodide/emsdk/emsdk:/src/pyodide/emsdk/emsdk/node/20.18.0_64bit/bin:/src/pyodide/emsdk/emsdk/upstream/emscripten:$PATH \' >> script.sh
echo 'pyodide build-recipes ifcopenshell --install' >> script.sh
chmod +x script.sh
sed -i s/--tty// pyodide/run_docker
pyodide/run_docker ./script.sh
mv dist/ifcopenshell-$VERSION-py3-none-any.whl dist/ifcopenshell-$VERSION+${GITHUB_SHA:0:7}-cp312-cp312-emscripten_3_1_58_wasm32.whl
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload .zip archives to S3
run: |
aws s3 cp dist s3://ifcopenshell-builds/ --recursive --exclude "*" --include "*.whl"
+116
View File
@@ -0,0 +1,116 @@
name: Build IfcOpenShell Linux
on:
workflow_dispatch:
jobs:
build_ifcopenshell:
runs-on: ubuntu-20.04
container: rockylinux:8
steps:
- name: Install Dependencies
run: |
yum update -y
yum install -y gcc gcc-c++ git autoconf automake bison make zip cmake python3 \
bzip2 patch mesa-libGL-devel libffi-devel fontconfig-devel \
sqlite-devel bzip2-devel zlib-devel openssl-devel xz-devel \
readline-devel ncurses-devel libffi-devel libuuid-devel git-lfs \
findutils
git config --global --add safe.directory '*'
- name: Install aws cli
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
rm -rf awscliv2.zip aws
aws --version
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Checkout Build Repository
uses: actions/checkout@v3
with:
repository: IfcOpenShell/build-outputs
path: ./build
ref: rockylinux8-x64
lfs: true
token: ${{ secrets.BUILD_REPO_TOKEN }}
- name: Unpack Dependencies
run: |
install_root=$(find ./build -maxdepth 4 -name install)
find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \;
# Not supported on docker
# - name: ccache
# uses: hendrikmuhs/ccache-action@v1
# with:
# key: ${GITHUB_WORKFLOW}-rockylinux8-x64
- name: Run Build Script
run: |
CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release python3 ./nix/build-all.py --diskcleanup
- name: Pack Dependencies
run: |
cd build
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do
test -f $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz || tar -czf $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz -C $(dirname "$install_dir") $(basename "$install_dir");
done
- name: Commit and Push Changes to Build Repository
run: |
cd build
git config user.name "IfcOpenBot"
git config user.email "ifcopenbot@ifcopenshell.org"
git add "$(find . -maxdepth 4 -name install)/*.tar.gz"
git commit -m "Update build artifacts [skip ci]" || echo "No changes to commit"
git push || true
- name: Package .zip archives
run: |
VERSION=v`cat VERSION`
cd ./build/`uname`/*/install/ifcopenshell
mkdir ~/output
ls -d python-* | while read py_version; do
postfix=`echo ${py_version: -1} | sed s/[0-9]//`
numbers=`echo $py_version | grep -oE '[0-9]+\.[0-9]+' | tr -d '.'`
py_version_major=python-${numbers}$postfix
pushd . > /dev/null
cd $py_version
if [ ! -d ifcopenshell ]; then
mkdir ../ifcopenshell_
mv * ../ifcopenshell_
mv ../ifcopenshell_ ifcopenshell
fi
[ -d ifcopenshell/__pycache__ ] && rm -rf ifcopenshell/__pycache__
find ifcopenshell -name "*.pyc" -delete
zip -r -qq ifcopenshell-${py_version_major}-${VERSION}-${GITHUB_SHA:0:7}-linux64.zip ifcopenshell/*
mv *.zip ~/output
popd > /dev/null
done
cd bin
rm *.zip || true
ls | while read exe; do
zip -qq -r ${exe}-${VERSION}-${GITHUB_SHA:0:7}-linux64.zip $exe
done
mv *.zip ~/output
cd ..
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload .zip archives to S3
run: |
aws s3 cp ~/output s3://ifcopenshell-builds/ --recursive
+116
View File
@@ -0,0 +1,116 @@
name: Build IfcOpenShell Linux ARM
on:
workflow_dispatch:
jobs:
build_ifcopenshell:
runs-on: ubuntu-22.04-arm
container: arm64v8/rockylinux:8
steps:
- name: Install Dependencies
run: |
yum update -y
yum install -y gcc gcc-c++ git autoconf automake bison make zip cmake python3 \
bzip2 patch mesa-libGL-devel libffi-devel fontconfig-devel \
sqlite-devel bzip2-devel zlib-devel openssl-devel xz-devel \
readline-devel ncurses-devel libffi-devel libuuid-devel git-lfs \
findutils
git config --global --add safe.directory '*'
- name: Install aws cli
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
./aws/install
rm -rf awscliv2.zip aws
aws --version
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Checkout Build Repository
uses: actions/checkout@v3
with:
repository: IfcOpenShell/build-outputs
path: ./build
ref: rockylinux8-arm64
lfs: true
token: ${{ secrets.BUILD_REPO_TOKEN }}
- name: Unpack Dependencies
run: |
install_root=$(find ./build -maxdepth 4 -name install)
[ -n "$install_root" ] && find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \; || true
# Not supported on docker
# - name: ccache
# uses: hendrikmuhs/ccache-action@v1
# with:
# key: ${GITHUB_WORKFLOW}-rockylinux8-x64
- name: Run Build Script
run: |
CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release python3 ./nix/build-all.py --diskcleanup
- name: Pack Dependencies
run: |
cd build
for install_dir in $(find $(find . -maxdepth 4 -name install) -mindepth 1 -maxdepth 1 -type d); do
test -f $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz || tar -czf $(dirname "$install_dir")/cache-$(basename "$install_dir").tar.gz -C $(dirname "$install_dir") $(basename "$install_dir");
done
- name: Commit and Push Changes to Build Repository
run: |
cd build
git config user.name "IfcOpenBot"
git config user.email "ifcopenbot@ifcopenshell.org"
git add "$(find . -maxdepth 4 -name install)/*.tar.gz"
git commit -m "Update build artifacts [skip ci]" || echo "No changes to commit"
git push || true
- name: Package .zip archives
run: |
VERSION=v`cat VERSION`
cd ./build/`uname`/*/install/ifcopenshell
mkdir ~/output
ls -d python-* | while read py_version; do
postfix=`echo ${py_version: -1} | sed s/[0-9]//`
numbers=`echo $py_version | grep -oE '[0-9]+\.[0-9]+' | tr -d '.'`
py_version_major=python-${numbers}$postfix
pushd . > /dev/null
cd $py_version
if [ ! -d ifcopenshell ]; then
mkdir ../ifcopenshell_
mv * ../ifcopenshell_
mv ../ifcopenshell_ ifcopenshell
fi
[ -d ifcopenshell/__pycache__ ] && rm -rf ifcopenshell/__pycache__
find ifcopenshell -name "*.pyc" -delete
zip -r -qq ifcopenshell-${py_version_major}-${VERSION}-${GITHUB_SHA:0:7}-linuxarm64.zip ifcopenshell/*
mv *.zip ~/output
popd > /dev/null
done
cd bin
rm *.zip || true
ls | while read exe; do
zip -qq -r ${exe}-${VERSION}-${GITHUB_SHA:0:7}-linuxarm64.zip $exe
done
mv *.zip ~/output
cd ..
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload .zip archives to S3
run: |
aws s3 cp ~/output s3://ifcopenshell-builds/ --recursive
+122
View File
@@ -0,0 +1,122 @@
name: Build IfcOpenShell Windows
on:
workflow_dispatch:
jobs:
build_ifcopenshell:
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
python: ['3.9.11', '3.10.3', '3.11.8', '3.12.1', '3.13.0']
arch: ['x64']
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Checkout Build Repository
uses: actions/checkout@v3
with:
repository: IfcOpenShell/build-outputs
path: _deps-vs2019-x64-installed
ref: windows-${{ matrix.arch }}
lfs: true
token: ${{ secrets.BUILD_REPO_TOKEN }}
- name: Install Dependencies
run: |
choco install -y sed 7zip.install awscli
- name: Install Python
run: |
$installer = "python-${{ matrix.python }}-amd64.exe"
$url = "https://www.python.org/ftp/python/${{ matrix.python }}/$installer"
Invoke-WebRequest -Uri $url -OutFile $installer
Start-Process -Wait -FilePath .\$installer -ArgumentList '/quiet InstallAllUsers=0 PrependPath=0 Include_test=0 TargetDir=C:\Python\${{ matrix.python }}'
Remove-Item .\$installer
- name: Unpack Dependencies
run: |
cd _deps-vs2019-x64-installed
Get-ChildItem -Path . -Filter 'cache-*.zip' | ForEach-Object {
7z x $_.FullName
}
- name: Run Build Script
shell: cmd
run: |
setlocal EnableDelayedExpansion
SET PYTHON_VERSION=${{ matrix.python }}
for /f "tokens=1,2,3 delims=." %%a in ("%PYTHON_VERSION%") do (
set PY_VER_MAJOR_MINOR=%%a%%b
)
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
SET IFCOS_INSTALL_PYTHON=FALSE
cd win
echo y | call build-deps.cmd vs2019-x64 Release
SET PYTHONHOME=C:\Python\${{ matrix.python }}
call run-cmake.bat vs2019-x64 -DENABLE_BUILD_OPTIMIZATIONS=On -DGLTF_SUPPORT=ON -DADD_COMMIT_SHA=ON -DVERSION_OVERRIDE=ON
call install-ifcopenshell.bat vs2019-x64 Release
- name: Pack Dependencies
run: |
cd _deps-vs2019-x64-installed
Get-ChildItem -Path . -Directory | ForEach-Object {
$cacheFile = "cache-$($_.Name).zip"
echo $cacheFile
if (!(Test-Path $cacheFile)) {
7z a $cacheFile $_.FullName
}
}
- name: Commit and Push Changes to Build Repository
run: |
cd _deps-vs2019-x64-installed
git config user.name "IfcOpenBot"
git config user.email "ifcopenbot@ifcopenshell.org"
git add *.zip
git commit -m "Update build artifacts [skip ci]" || echo "No changes to commit"
git push || echo "Push failed"
- name: Package .zip Archives
run: |
$VERSION = 'v' + ((Get-Content VERSION).Trim())
$SHA = ${env:GITHUB_SHA}.Substring(0, 7)
$OUTPUT_DIR = "$env:USERPROFILE\output"
New-Item -ItemType Directory -Force -Path $OUTPUT_DIR
if ("${{ matrix.python }}" -eq "3.9.11") {
# only for the first python version the executables are assembled for upload
cd _installed-vs2019-x64/bin
Get-ChildItem -Path . | ForEach-Object {
echo $_
$exe = $_.Name
$baseName = $exe.Substring(0, $exe.Length - 4)
$zipName = "${baseName}-$VERSION-$SHA-win64.zip"
7z a $zipName $exe
}
mv *.zip $OUTPUT_DIR
}
$pyVersion = "${{ matrix.python }}"
$pyVersionMajor = ($pyVersion -split '\.')[0..1] -join ''
cd C:\Python\${{ matrix.python }}\Lib\site-packages
Remove-Item -Recurse -Force ifcopenshell\__pycache__ -ErrorAction SilentlyContinue
Get-ChildItem -Path ifcopenshell -Filter "*.pyc" -Recurse | Remove-Item -Force
$zipName = "ifcopenshell-python-$pyVersionMajor-$VERSION-$SHA-win64.zip"
7z a $zipName ifcopenshell
mv $zipName $OUTPUT_DIR
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_UPLOAD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_UPLOAD_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Upload .zip Archives to S3
run: |
aws s3 cp $env:USERPROFILE\output s3://ifcopenshell-builds/ --recursive
@@ -0,0 +1,73 @@
name: ci-black-formatting
on:
push:
pull_request:
env:
PYTHON_VERSION: "3.12"
jobs:
lint-formatting:
runs-on: ubuntu-latest
steps:
- name: Action - checkout repository
uses: actions/checkout@v4.2.2
- name: Action - install python
uses: actions/setup-python@v5.3.0
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Step 1 - install dependencies
shell: bash
run: |
python3 -m pip install --upgrade pip
python3 -m pip install 'black>=24.10.0'
# NOTE: This would suffice, however it is less informative in terms of the 3 possible outcomes
# - name: QA Step - check linting
# shell: bash
# id: linting
# run: |
# python3 -m black .
# QA STEP
- name: QA Step - check linting
shell: bash
id: linting
run: |
python3 -m black --check . \
&& exit 0 \
|| (echo "exit_code=$?" >> "$GITHUB_OUTPUT" && exit 1);
continue-on-error: true
# OUTCOME 1 of QA STEP
- name: QA Step - no linting errors
if: steps.linting.outcome == 'success'
shell: bash
run: |-
echo "::notice::QA step linting succeeded"
exit 0;
# OUTCOME 2i of QA STEP
- name: QA Step - unprettified code with no syntax errors
if: steps.linting.outputs.exit_code == 1
shell: bash
run: |-
echo "::group::QA step succeeded with warnings"
echo "::warning::one or more files contains unformatted code but no syntax errors";
echo "::notice::please run the linter before pushing!";
echo "::endgroup::"
exit 0;
# OUTCOME 2ii of QA STEP
- name: QA Step - code contains syntax errors
if: steps.linting.outputs.exit_code == 123
shell: bash
run: |-
echo "::group::QA step failed"
echo "::error::one or more files contains syntax errors";
echo "::notice::please run the linter and fix syntax errors before pushing!";
echo "::endgroup::"
exit 1;
-12
View File
@@ -1,12 +0,0 @@
name: ci-black-formatting
on:
push:
pull_request:
jobs:
lint-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
+42 -20
View File
@@ -99,12 +99,12 @@ jobs:
token: ${{ secrets.IOS_TO_BLENDER_REPO }}
path: bonsai_unstable_repo
- name: Update index.json on extensions repo
- name: Download Blender and run critical tests
run: |
set -x -e
# Ensure Bonsai and ifcsverchok enable/disable works before uploading to extensions repo.
# Download Blender.
wget -q -O blender.tar.xz https://ftp.nluug.nl/pub/graphics/blender/release/Blender4.2/blender-4.2.0-linux-x64.tar.xz
wget -q -O blender.tar.xz https://ftp.nluug.nl/pub/graphics/blender/release/Blender4.3/blender-4.3.0-linux-x64.tar.xz
tar -xf blender.tar.xz
# Setup Blender.
@@ -112,25 +112,25 @@ jobs:
export PATH="$PATH:$BLENDER_PATH"
blender --version
# Setup unstable repo to get Bonsai build.
cd bonsai_unstable_repo
pip install -r requirements.txt
python setup_extensions_repo.py --last-tag
git config --global user.name 'IfcOpenBot'
git config --global user.email 'IfcOpenBot@users.noreply.github.com'
git add index.json
git add readme.md
git commit -m "Update index.json"
git push
- name: Run bonsai tests
run: |
set -x -e
BLENDER_PATH=$(find blender-*/ -maxdepth 0 -exec readlink -f {} \;)
export PATH="$PATH:$BLENDER_PATH"
cd ..
bonsai_zip="$(pwd)/$(ls bonsai_unstable_repo/bonsai_py311*-linux-x64.zip)"
blender --version
# Install Bonsai.
blender --command extension install-file -r user_default -e $bonsai_zip
blender --command extension list
git clone https://github.com/IfcOpenShell/IfcOpenShell.git IfcOpenShell
# Reregister Bonsai.
# Note that running it in background might miss some errors
# (e.g. tools are not registered in background mode).
blender --background --python IfcOpenShell/src/bonsai/scripts/reregister_bonsai.py
# Install sverchok.
wget -q -O sverchok.zip https://github.com/nortikin/sverchok/archive/refs/heads/master.zip
# ifcsverchok expecting sverchok to be named "sverchok" and not "sverchok-master".
unzip -q sverchok.zip
@@ -139,19 +139,41 @@ jobs:
rm -r sverchok
blender --command extension install-file -r user_default sverchok.zip
git clone https://github.com/IfcOpenShell/IfcOpenShell.git IfcOpenShell
# Install ifcsverchok.
cd IfcOpenShell/src/ifcsverchok
make dist
sverchok_zip="$(pwd)/dist/$(ls dist)"
blender --command extension install-file -r user_default $sverchok_zip
- name: Update index.json on extensions repo
run: |
set -x -e
# Setup Blender.
BLENDER_PATH=$(find blender-*/ -maxdepth 0 -exec readlink -f {} \;)
export PATH="$PATH:$BLENDER_PATH"
blender --version
cd bonsai_unstable_repo
git config --global user.name 'IfcOpenBot'
git config --global user.email 'IfcOpenBot@users.noreply.github.com'
git add index.json
git add readme.md
git commit -m "Update index.json"
git push
- name: Run bonsai tests
run: |
set -x -e
BLENDER_PATH=$(find blender-*/ -maxdepth 0 -exec readlink -f {} \;)
export PATH="$PATH:$BLENDER_PATH"
blender --version
# Install Sun Position extension.
blender --online-mode --command extension sync
blender --online-mode --background --python-expr "import bpy; \
bpy.ops.extensions.package_install(repo_index=0, pkg_id='sun_position'); \
bpy.ops.preferences.addon_enable(module='bl_ext.blender_org.sun_position'); bpy.ops.wm.save_userpref()"
blender --online-mode --command extension install --enable --sync sun_position
cd ../bonsai
cd IfcOpenShell/src/bonsai
pip install pytest-blender
blender --background --python scripts/setup_pytest.py
blender --python-expr "import bonsai; print(bonsai.bbim_semver); import ifcopenshell; print(ifcopenshell.version)" --background
+6 -3
View File
@@ -15,6 +15,7 @@ on:
- 'src/ifcparse/**'
- 'src/ifcwrap/**'
- 'src/qtviewer/**'
- 'src/svgfill/**'
- 'src/serializers/**'
- 'conda/**'
- 'cmake/**'
@@ -23,15 +24,15 @@ on:
jobs:
activate:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
if: |
github.repository == 'IfcOpenShell/IfcOpenShell' &&
!contains(github.event.head_commit.message, 'skip ci')
steps:
- run: echo ok go
build:
runs-on: ubuntu-latest
compile-and-test:
runs-on: ubuntu-22.04
needs: activate
steps:
- uses: actions/checkout@v4
@@ -126,6 +127,7 @@ jobs:
python tests.py
cd ../src/ifcopenshell-python
mv ifcopenshell ifcopenshell-local # Force testing on installed module
pip install -e ../ifcpatch --no-deps # Needed for sql.py tests.
make test
cd ../bcf && make test
pip install requests
@@ -133,4 +135,5 @@ jobs:
pip install deepdiff
cd ../ifcdiff && make test
cd ../ifcpatch && make test
pip install -e ../ifctester --no-deps
cd ../ifctester && make test
@@ -0,0 +1,38 @@
name: Build and Deploy Unstable Documentation
on:
push:
branches:
- v0.8.0 # Trigger the workflow on pushes to the default branch which is currently v0.8.0
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
cd src/bonsai/docs # Navigate to the docs directory
pip install -r requirements.txt # Install dependencies from requirements.txt
- name: Build documentation
run: |
cd src/bonsai/docs # Navigate to the docs directory
make html # Build the documentation
- name: Deploy to GitHub Pages (Unstable)
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }} # SSH key for deployment
external_repository: IfcOpenShell/bonsaibim_org_docs_unstable # Target repository
publish_branch: main # Branch to deploy to
cname: docs-unstable.bonsaibim.org # Custom domain for unstable docs
publish_dir: src/bonsai/docs/_build/html # Directory containing built docs
+36
View File
@@ -0,0 +1,36 @@
name: Build and Deploy Stable Documentation
on:
workflow_dispatch: # Manual trigger
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
cd src/bonsai/docs
pip install -r requirements.txt # Run pip install from the docs directory
- name: Build documentation
run: |
cd src/bonsai/docs
make html
- name: Deploy to GitHub Pages (Stable)
uses: peaceiris/actions-gh-pages@v4
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: IfcOpenShell/bonsaibim_org_docs
publish_branch: main
cname: docs.bonsaibim.org
publish_dir: src/bonsai/docs/_build/html
@@ -0,0 +1,48 @@
name: Deploy Pyodide Demo App to GitHub Pages
permissions:
id-token: write
pages: write
on:
push:
paths:
- 'src/pyodide/**'
- '.github/workflows/publish-pyodide-demo-app.yml'
jobs:
activate:
runs-on: ubuntu-latest
if: |
github.repository == 'IfcOpenShell/IfcOpenShell'
steps:
- name: Set env
run: echo ok go
build:
needs: activate
runs-on: ubuntu-latest
steps:
- name: Checkout (recursive)
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: src/pyodide/demo-app/
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+9
View File
@@ -81,6 +81,12 @@ src/bonsai/test/files/temp
src/bonsai/test/files/basic.ifc.cache.blend
src/bonsai/test/files/basic.ifc.cache.sqlite
# bonsai data
src/bonsai/bonsai/bim/data/build/
src/bonsai/bonsai/bim/data/gantt/index.html
src/bonsai/bonsai/bim/data/gantt/jsgantt.js
src/bonsai/bonsai/bim/data/gantt/jsgantt.css
src/bonsai/drawings
src/bonsai/layouts
@@ -98,3 +104,6 @@ src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.py
# Brickschema
src/bonsai/bonsai/bim/schema/Brick.ttl
bonsaiDecoratorForLoads.code-workspace
dev_environment.bat
+6
View File
@@ -17,3 +17,9 @@
[submodule "docs/cpp-api/assets/doxygen-awesome-css"]
path = docs/cpp-api/assets/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
[submodule "src/ifcopenshell-python/ifcopenshell/simple_spf"]
path = src/ifcopenshell-python/ifcopenshell/simple_spf
url = https://github.com/IfcOpenShell/step-file-parser
[submodule "src/pyodide/demo-app/wheels"]
path = src/pyodide/demo-app/wheels
url = https://github.com/IfcOpenShell/wasm-wheels
+1
View File
@@ -6,6 +6,7 @@ IfcOpenShell
<img src="https://github.com/IfcOpenShell/IfcOpenShell/assets/88302/34901387-e2dd-4a0c-8e38-9ffc32a66cde">
</p>
IfcOpenShell is an open source ([LGPL]) software library for working with Industry Foundation Classes ([IFC]). Complete
parsing support is provided for [IFC2x3 TC1], [IFC4 Add2 TC1], IFC4x1, IFC4x2, and [IFC4x3 Add2]. Extensive geometric support
is implemented for the IFC releases [IFC2x3 TC1] and [IFC4 Add2 TC1]. Extending with support for arbitrary IFC schemas
+55 -13
View File
@@ -77,7 +77,7 @@ option(HDF5_SUPPORT "Enable HDF5 support (requires HDF5, zlib)" ON)
option(WITH_PROJ "Enable output of Earth-Centered Earth-Fixed glTF output using the PROJ library" OFF)
option(IFCXML_SUPPORT "Build IfcParse with ifcXML support (requires libxml2)." ON)
option(USD_SUPPORT "Build IfcConvert with USD support (requires pixar's USD library)." OFF)
option(CITYJSON_SUPPORT "Build IfcConvert with CityJSON support (requires CityJSON library)." ON)
option(CITYJSON_SUPPORT "Build IfcConvert with CityJSON support (requires CityJSON library)." OFF)
option(WITH_RELATIONSHIP_VALIDATION "Build IfcConvert with option to validate geometrical relationships." OFF)
option(USERSPACE_PYTHON_PREFIX "Installs IfcPython for the current user only instead of system-wide." OFF)
@@ -196,13 +196,25 @@ foreach(option_flag IN LISTS option_flags)
convert_env_var_to_bool("${option_flag}")
endforeach()
set(CMAKE_FIND_ROOT_PATH_BACKUP "${CMAKE_FIND_ROOT_PATH}")
macro(clear_wasm_sysroot)
if(WASM_BUILD)
# when using the nix/build-all.py build script we should not
# look into the sysroot for most of the dependencies but rather
# in the designated build/ folder created by the script.
set(CMAKE_FIND_ROOT_PATH_BACKUP "${CMAKE_FIND_ROOT_PATH}")
set(CMAKE_FIND_ROOT_PATH "")
endif()
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
endmacro()
macro(restore_wasm_sysroot)
if(WASM_BUILD)
# reset to use sysroot
set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH_BACKUP}")
endif()
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endmacro()
if(WITH_CGAL)
add_definitions(-DIFOPSH_WITH_CGAL)
@@ -223,7 +235,9 @@ endif()
if(GLTF_SUPPORT OR CITYJSON_SUPPORT)
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
clear_wasm_sysroot()
find_path(json_header_path "nlohmann/json.hpp" HINTS ${JSON_INCLUDE_DIR})
restore_wasm_sysroot()
set(JSON_INCLUDE_DIR ${json_header_path})
if(json_header_path)
@@ -330,13 +344,17 @@ if(USE_MMAP)
add_definitions(-DUSE_MMAP)
endif()
clear_wasm_sysroot()
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
restore_wasm_sysroot()
message(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}")
message(STATUS "Boost libraries found in ${Boost_LIBRARY_DIRS}")
if(NOT MINIMAL_BUILD)
# libxml2 is required for IFCXML (optional) and SVGFILL (mandatory)
clear_wasm_sysroot()
find_package(LibXml2 REQUIRED)
restore_wasm_sysroot()
endif()
if(IFCXML_SUPPORT)
@@ -352,6 +370,7 @@ if(BUILD_IFCGEOM)
# Open CASCADE
if(WITH_OPENCASCADE)
if("${OCC_INCLUDE_DIR}" STREQUAL "")
clear_wasm_sysroot()
find_path(OCC_INCLUDE_DIR Standard_Version.hxx
PATHS
/usr/include/occt
@@ -359,6 +378,7 @@ if(BUILD_IFCGEOM)
/usr/include/opencascade
REQUIRED
)
restore_wasm_sysroot()
if(OCC_INCLUDE_DIR)
message(STATUS "Found Open CASCADE include files in: ${OCC_INCLUDE_DIR}")
@@ -418,7 +438,9 @@ if(BUILD_IFCGEOM)
message(STATUS "Looking for Open CASCADE library files in: ${OCC_LIBRARY_DIR}")
endif()
clear_wasm_sysroot()
find_library(libTKernel NAMES TKernel TKerneld PATHS ${OCC_LIBRARY_DIR} NO_DEFAULT_PATH)
restore_wasm_sysroot()
if(libTKernel)
message(STATUS "Required Open Cascade Library files found")
@@ -641,11 +663,6 @@ if(HDF5_SUPPORT)
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_HDF5)
endif(HDF5_SUPPORT)
if(WASM_BUILD)
# reset to use sysroot
set(CMAKE_FIND_ROOT_PATH "${CMAKE_FIND_ROOT_PATH_BACKUP}")
endif()
if(ENABLE_BUILD_OPTIMIZATIONS)
if(MSVC)
# NOTE: RelWithDebInfo and Release use O2 (= /Ox /Gl /Gy/ = Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy) by default,
@@ -925,8 +942,10 @@ endif()
if(BUILD_IFCGEOM)
if(WITH_CGAL)
clear_wasm_sysroot()
find_library(libGMP NAMES gmp mpir PATHS ${GMP_LIBRARY_DIR} NO_DEFAULT_PATH)
find_library(libMPFR NAMES mpfr PATHS ${MPFR_LIBRARY_DIR} NO_DEFAULT_PATH)
restore_wasm_sysroot()
if(NOT libGMP)
message(FATAL_ERROR "Unable to find GMP library files, aborting")
endif()
@@ -1129,6 +1148,7 @@ if(ADD_COMMIT_SHA)
message("git found: ${GIT_EXECUTABLE} with version ${GIT_VERSION_STRING}")
execute_process(
COMMAND ${GIT_EXECUTABLE} branch -a --contains HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE git_branches
OUTPUT_STRIP_TRAILING_WHITESPACE
)
@@ -1146,11 +1166,18 @@ if(ADD_COMMIT_SHA)
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE git_sha
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "IfcOpenShell branch: \"${git_branch}\"")
message(STATUS "IfcOpenShell commit: \"${git_sha}\"")
if ("${git_branch}" STREQUAL "" OR "${git_sha}" STREQUAL "")
message(FATAL_ERROR "Unable to determine commit sha and/or branch")
endif()
add_definitions(-DIFCOPENSHELL_BRANCH=${git_branch})
add_definitions(-DIFCOPENSHELL_COMMIT=${git_sha})
endif()
@@ -1201,13 +1228,20 @@ install(TARGETS IfcParse
)
if(BUILD_IFCGEOM)
install(FILES ${IFCGEOM_H_FILES}
# install(FILES ${IFCGEOM_H_FILES}
# DESTINATION ${INCLUDEDIR}/ifcgeom
# )
install(FILES ${SCHEMA_AGNOSTIC_H_FILES}
DESTINATION ${INCLUDEDIR}/ifcgeom
)
install(FILES ${SCHEMA_AGNOSTIC_H_FILES}
DESTINATION ${INCLUDEDIR}/ifcgeom_schema_agnostic
)
foreach(kernel ${GEOMETRY_KERNELS})
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/kernels/${kernel}/*.h)
install(FILES ${IFCGEOM_H_FILES}
DESTINATION ${INCLUDEDIR}/ifcgeom/kernels/${kernel}
)
endforeach()
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} ${kernel_libraries} IfcGeom
ARCHIVE DESTINATION ${LIBDIR}
@@ -1223,15 +1257,23 @@ if(BUILD_CONVERT)
RUNTIME DESTINATION ${BINDIR}
)
install(FILES ${SERIALIZERS_FILES}
install(FILES ${SERIALIZERS_H_FILES}
DESTINATION ${INCLUDEDIR}/serializers/
)
install(FILES ${SERIALIZERS_S_FILES}
install(FILES ${SERIALIZERS_S_H_FILES}
DESTINATION ${INCLUDEDIR}/serializers/schema_dependent
)
endif(BUILD_CONVERT)
if(BUILD_CONVERT OR BUILD_IFCPYTHON)
install(TARGETS geometry_serializer ${geometry_serializer_libraries}
ARCHIVE DESTINATION ${LIBDIR}
LIBRARY DESTINATION ${LIBDIR}
RUNTIME DESTINATION ${BINDIR}
)
endif(BUILD_CONVERT OR BUILD_IFCPYTHON)
# Cmake uninstall target
if(NOT TARGET uninstall)
configure_file(
+23 -9
View File
@@ -48,6 +48,10 @@
# on OS X El Capitan with homebrew: #
# $ brew install git bison autoconf automake libffi cmake #
# #
# on RHEL-related distros: #
# $ yum install git gcc gcc-c++ autoconf bison make cmake #
# mesa-libGL-devel libffi-devel fontconfig-devel bzip2 #
# automake patch #
###############################################################################
import logging
import os
@@ -78,11 +82,11 @@ PROJECT_NAME = "IfcOpenShell"
USE_CURRENT_PYTHON_VERSION = os.getenv("USE_CURRENT_PYTHON_VERSION")
ADD_COMMIT_SHA = os.getenv("ADD_COMMIT_SHA")
PYTHON_VERSIONS = ["3.9.11", "3.10.3", "3.11.8", "3.12.1"]
PYTHON_VERSIONS = ["3.9.11", "3.10.3", "3.11.8", "3.12.1", "3.13.0"]
JSON_VERSION = "v3.6.1"
OCE_VERSION = "0.18.3"
OCCT_VERSION = "7.8.1"
BOOST_VERSION = "1.80.0"
BOOST_VERSION = "1.86.0"
PCRE_VERSION = "8.41"
LIBXML2_VERSION = "2.9.11"
SWIG_VERSION = "4.0.2"
@@ -303,7 +307,7 @@ if platform.system() == "Darwin":
BOOST_VERSION_UNDERSCORE = BOOST_VERSION.replace(".", "_")
OCE_LOCATION = f"https://github.com/tpaviot/oce/archive/OCE-{OCE_VERSION}.tar.gz"
BOOST_LOCATION = f"https://boostorg.jfrog.io/artifactory/main/release/{BOOST_VERSION}/source/"
BOOST_LOCATION = f"https://github.com/boostorg/boost/releases/download/boost-{BOOST_VERSION}/"
# Helper functions
@@ -346,6 +350,7 @@ def git_clone_or_pull_repository(clone_url, target_dir, revision=None):
run([git, "clone", "--recursive", clone_url, target_dir])
else:
logger.info(f"directory '{target_dir}' already cloned. Pulling latest changes.")
run([git, "-C", target_dir, "fetch", "--all", "--tags"])
# detect whether we are on a branch and pull
if run([git, "rev-parse", "--abbrev-ref", "HEAD"], cwd=target_dir) != "HEAD":
@@ -460,6 +465,9 @@ def build_dependency(name, mode, build_tool_args, download_url, download_name, d
shutil.copytree(os.path.join(extract_dir, "boost"), os.path.join(DEPS_DIR, "install", f"boost-{BOOST_VERSION}", "boost"))
logger.info(f"\rInstalled {name} \n")
if "diskcleanup" in flags:
shutil.rmtree(build_dir, ignore_errors=True)
cecho("Collecting dependencies:", GREEN)
# Set compiler flags for 32bit builds on 64bit system
@@ -471,7 +479,7 @@ if platform.system() == "Darwin":
ADDITIONAL_ARGS = [f"-mmacosx-version-min={TOOLSET}"] + ADDITIONAL_ARGS
if "wasm" in flags:
ADDITIONAL_ARGS.extend(("-sWASM_BIGINT", "-fexceptions"))
ADDITIONAL_ARGS.extend(("-sWASM_BIGINT", "-fwasm-exceptions"))
# If the linker supports GC sections, set it up to reduce binary file size
# -fPIC is required for the shared libraries to work
@@ -520,7 +528,7 @@ if 'hdf5' in targets:
# not supported
orig = [os.environ[f] for f in compiler_flags]
for f in compiler_flags:
os.environ[f] = re.sub("-flto(=\w+)?", "", os.environ[f])
os.environ[f] = re.sub(r"-flto(=\w+)?", "", os.environ[f])
HDF5_MAJOR = ".".join(HDF5_VERSION.split(".")[:-1])
build_dependency(
@@ -610,7 +618,7 @@ if USE_OCCT and "occ" in targets:
"-DBUILD_RELEASE_DISABLE_EXCEPTIONS=Off",
f"-D3RDPARTY_FREETYPE_DIR={DEPS_DIR}/install/freetype"
],
download_url = "https://git.dev.opencascade.org/repos/occt.git",
download_url = "https://github.com/Open-Cascade-SAS/OCCT",
download_name = "occt",
download_tool=download_tool_git,
patch=patches,
@@ -730,14 +738,16 @@ if "boost" in targets:
"--with-thread",
"--with-date_time",
"--with-iostreams",
"--with-filesystem",
f"link={LINK_TYPE}",
*toolset,
*map(str_concat("cxxflags"), CXXFLAGS.strip().split(' ')),
*map(str_concat("linkflags"), LDFLAGS.strip().split(' ')),
"stage", "-s", "NO_BZIP2=1"],
download_url=BOOST_LOCATION,
patch="./patches/boost/boostorg_regex_62.patch",
download_name=f"boost_{BOOST_VERSION_UNDERSCORE}.tar.bz2"
# don't remember what this is, but fail on 1.86
# patch="./patches/boost/boostorg_regex_62.patch",
download_name=f"boost-{BOOST_VERSION}-b2-nodocs.tar.gz"
)
if "wasm" in flags:
# only supported on nix for now
@@ -980,7 +990,11 @@ if "IfcOpenShell-Python" in targets:
if platform.system() != "Darwin":
if BUILD_CFG == "Release":
# TODO: This symbol name depends on the Python version?
run([strip, "-s", "-K", "PyInit__ifcopenshell_wrapper", glob.glob(os.path.join(module_dir, "_ifcopenshell_wrapper*.so"))[0]], cwd=module_dir)
so = glob.glob(os.path.join(module_dir, "_ifcopenshell_wrapper*.so"))[0]
if "wasm" in flags:
run(['wasm-strip', so, '-k', "dylink.0"])
else:
run([strip, "-s", "-K", "PyInit__ifcopenshell_wrapper", so], cwd=module_dir)
return module_dir
+3 -2
View File
@@ -3,11 +3,12 @@ package:
version: 0.8.0
source:
path: IfcOpenShell
path: ../../IfcOpenShell
build:
script: |
python nix/build-all.py --without-hdf5 --without-opencollada --without-swig --without-pcre -v --wasm --py310 IfcOpenShell-Python
BUILD_CFG=Release python nix/build-all.py --without-hdf5 --without-opencollada --without-swig --without-pcre -v --wasm --py312 IfcOpenShell-Python
mv package/ifcopenshell .
cp pyodide/setup.py .
about:
+2 -2
View File
@@ -1,11 +1,11 @@
from setuptools import setup, find_packages
setup(name='IfcOpenShell',
setup(name='ifcopenshell',
version='0.8.0',
description='IfcOpenShell is an open source (LGPL) software library for working with the Industry Foundation Classes (IFC) file format.',
author='Thomas Krijnen',
author_email='thomas@aecgeeks.com',
url='http://ifcopenshell.org',
packages=find_packages(),
package_data={'': ['*.so']},
package_data={'': ['*.so', '*.json']},
)
+2
View File
@@ -27,7 +27,9 @@ include = '''
extend-exclude = '''
src/ifcopenshell-python/ifcopenshell/express/*
|src/ifcopenshell-python/ifcopenshell/mvd/*
|src/ifcopenshell-python/ifcopenshell/simple_spf/*
|src/ifc2ca/templates/*
|src/ifcconvert/cityjson/*
'''
[tool.pyright]
+25 -51
View File
@@ -85,7 +85,7 @@ BLENDER_PLATFORM:=windows-x64
endif
# Current build commit hash.
OLD:=0e5008d
OLD:=463289e
.PHONY: bump
bump:
ifndef NEW
@@ -177,6 +177,8 @@ endif
# Is not platform specific but has platform specific dependencies.
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download python-socketio[asyncio_client] $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download aiohttp $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
# Required to access platform specific paths
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download platformdirs --dest=./wheels
# Required by light module
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download pytz --dest=./wheels
cd build && . env/$(VENV_ACTIVATE) && $(PIP) download tzfpy $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
@@ -212,7 +214,7 @@ endif
# Brickschema requires pkg_resources which is provided by Blender.
# Provides Brickschema functionality
# For now lets bundle the latest nightly schema
cd build/bonsai/bim/schema && wget https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
cd build/bonsai/bim/data/brick/ && wget https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
# Required for hipped roof generation
cd build && wget https://github.com/prochitecture/bpypolyskel/archive/refs/heads/master.zip
@@ -226,8 +228,16 @@ endif
)" bdist_wheel
cp -r build/bpypolyskel-master/dist/*.whl build/wheels/
# Required for Desktop icon and file association
cp -r bonsai/libs/desktop build/bonsai/libs/
# folder for executable files
mkdir -p build/bonsai/libs/bin
# required for three-way git merging
ifeq ($(PLATFORM), win)
cd build/bonsai/libs/bin && wget https://github.com/brunopostle/ifcmerge/releases/download/2025-01-26/ifcmerge.zip
cd build/bonsai/libs/bin && unzip ifcmerge.zip && rm ifcmerge.zip
else
cd build/bonsai/libs/bin && wget https://raw.githubusercontent.com/brunopostle/ifcmerge/main/ifcmerge && chmod +x ifcmerge
endif
# Generate translations module for Bonsai build
git clone https://github.com/IfcOpenShell/bonsai-translations.git build/working
@@ -268,54 +278,11 @@ endif
fi
mv build/wheels/*.whl build/bonsai/wheels/
# Ugly patch to accomodate MacOS universal builds not being recognized by Blender.
# Blender doesn't look into the wheel contents, it just checks the name.
# So this hack works without working out some way to repack those wheels.
# See: https://projects.blender.org/blender/blender/issues/125091
ifeq ($(PLATFORM), macosm1)
# Has universal and x86_64 builds.
prev_whl_name=$$(find build/bonsai/wheels/lxml-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed "s/_universal2/_arm64/"); \
mv "$$prev_whl_name" "$$whl_name";
# Temporary workaround for Blender not handling non-3.11 wheels #5743.
# Use '-n' as on macos x86-64 doesn't have a binary wheel and it autoincludes 'cp311'.
prev_whl_name=$$(find build/bonsai/wheels/tzfpy-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed -E "s/macosx_10_([0-9]+)_x86_64\.macosx_11_0_arm64\.macosx_10_\1_universal2/macosx_10_\1_arm64/"); \
mv "$$prev_whl_name" "$$whl_name";
# Has only universal build.
prev_whl_name=$$(find build/bonsai/wheels/greenlet-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed "s/_universal2/_arm64/"); \
mv "$$prev_whl_name" "$$whl_name";
endif
ifeq ($(PLATFORM), macos)
# Has universal and arm64 builds.
prev_whl_name=$$(find build/bonsai/wheels/MarkupSafe-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed "s/_universal2/_x86_64/"); \
mv "$$prev_whl_name" "$$whl_name";
prev_whl_name=$$(find build/bonsai/wheels/tzfpy-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed -E "s/macosx_10_([0-9]+)_x86_64\.macosx_11_0_arm64\.macosx_10_\1_universal2/macosx_10_\1_x86_64/"); \
mv "$$prev_whl_name" "$$whl_name";
prev_whl_name=$$(find build/bonsai/wheels/greenlet-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed "s/_universal2/_x86_64/"); \
mv "$$prev_whl_name" "$$whl_name";
# has universal and arm builds.
prev_whl_name=$$(find build/bonsai/wheels/fonttools-*.whl); \
whl_name=$$(echo $$prev_whl_name | sed "s/_universal2/_x86_64/"); \
mv "$$prev_whl_name" "$$whl_name";
endif
# Safeguard for unhandled universal files.
wheels=$$(find build/bonsai/wheels/*universal2*.whl); \
if [ -n "$$wheels" ]; then \
echo "Found universal2 wheel files:"; \
echo "$$wheels"; \
echo "Error: universal2 wheel files are not supported by Blender!"; \
exit 1; \
fi
whl_name=$$(echo $$prev_whl_name | sed "s/-cp39-/-cp$(PYNUMBER)-/"); \
mv --update=none "$$prev_whl_name" "$$whl_name";
ifneq ($(PLATFORM), linux)
# Safeguard: in case one of `pip download` will break,
@@ -333,6 +300,7 @@ endif
rm -rf build/bonsai/bim/
rm -rf build/bonsai/core/
rm -rf build/bonsai/tool/
rm -rf build/bonsai/libs/
ifeq ($(IS_STABLE), TRUE)
cd build && zip -r bonsai_$(PYVERSION)-$(VERSION)-$(BLENDER_PLATFORM).zip ./bonsai
@@ -376,6 +344,12 @@ else
pytest test/tool/test_$(MODULE).py
endif
# Reregistering test is not added to the standard test suite because during unregister
# Blender removes all Bonsai dependencies breaking dev-environment symlinks.
.PHONY: test-reregister
test-reregister:
blender --python scripts/reregister_bonsai.py
.PHONY: qa
qa:
black .
Binary file not shown.
+8 -2
View File
@@ -317,7 +317,7 @@ if IN_BLENDER:
# But Blender currently doesn't support separate builds for different Python version,
# so those issues might still slip in.
box.label(text="Bonsai installed for wrong Python version.")
box.label(text=f"Expected: {py}. Got: {binary_py}.")
box.label(text=f"Expected binary version: {py}. Got: {binary_py}.")
# On reinstallation, dependencies versions doesn't change, so Blender will just ignore new dependencies.
# So, we need to make user will disable an extension (just uninstallation won't remove dependencies).
# Blender restart doesn't seem to be required in that case
@@ -325,7 +325,13 @@ if IN_BLENDER:
box.label(text="Try reinstalling with the correct Python version.")
box.label(text="Before reinstallation make sure to")
box.label(text="DISABLE Bonsai (uninstallation won't help).")
box.label(text="You can download correct version below.")
if py == "3.11":
box.label(text="You can download correct version below.")
else:
box.label(text="Since you're using Python >3.11,")
box.label(text="installation from Blender extensions platform")
box.label(text="is not supported and you need to download")
box.label(text="and install Bonsai from the link below.")
layout.operator("bim.copy_debug_information", text="Copy Error Message To Clipboard")
op = layout.operator("bim.open_uri", text="How Can I Fix This?")
-2
View File
@@ -1,2 +0,0 @@
# addon writes tmp stuff directly to its dir
/data/
+17 -2
View File
@@ -20,8 +20,7 @@ import os
import bpy
import bpy.utils.previews
import importlib
from pathlib import Path
from . import handler, ui, prop, operator, helper
from . import handler, ui, prop, operator
from typing import Callable, Union
try:
@@ -99,21 +98,25 @@ classes = [
operator.BIM_OT_add_section_plane,
operator.BIM_OT_delete_object,
operator.BIM_OT_remove_section_plane,
operator.BIM_OT_select_entity,
operator.BIM_OT_select_object,
operator.BIM_OT_show_description,
operator.BIM_OT_multiple_file_selector,
operator.ClippingPlaneCutWithCappings,
operator.CloseBlendWarning,
operator.CloseError,
operator.CopyTextToClipboard,
operator.EditBlenderCollection,
operator.FileAssociate,
operator.FileUnassociate,
operator.OpenPath,
operator.OpenUpstream,
operator.OpenUri,
operator.ReloadIfcFile,
operator.RemoveIfcFile,
operator.RevertClippingPlaneCut,
operator.SelectDataDir,
operator.SelectCacheDir,
operator.SelectIfcFile,
operator.SelectSchemaDir,
operator.SelectURIAttribute,
@@ -135,6 +138,8 @@ classes = [
prop.BIMMeshProperties,
prop.BIMFacet,
prop.BIMFilterGroup,
prop.BIMSnapProperties,
prop.BIMSnapGroups,
ui.BIM_UL_clipping_plane,
ui.BIM_UL_generic,
ui.BIM_UL_topics,
@@ -190,6 +195,8 @@ classes = [
# TODO: move this somewhere else and clean it up
ui.BIM_PT_section_plane,
ui.BIM_PT_section_with_cappings,
ui.BIM_PT_decorators_overlay,
ui.BIM_PT_snappping,
]
for mod in modules.values():
@@ -222,6 +229,8 @@ def register():
bpy.app.handlers.load_post.append(handler.load_post)
bpy.app.handlers.load_post.append(handler.loadIfcStore)
bpy.types.Scene.BIMProperties = bpy.props.PointerProperty(type=prop.BIMProperties)
bpy.types.Scene.BIMSnapProperties = bpy.props.PointerProperty(type=prop.BIMSnapProperties)
bpy.types.Scene.BIMSnapGroups = bpy.props.PointerProperty(type=prop.BIMSnapGroups)
bpy.types.Screen.BIMAreaProperties = bpy.props.CollectionProperty(type=prop.BIMAreaProperties)
bpy.types.Screen.BIMTabProperties = bpy.props.PointerProperty(type=prop.BIMTabProperties)
bpy.types.Collection.BIMCollectionProperties = bpy.props.PointerProperty(type=prop.BIMCollectionProperties)
@@ -256,6 +265,12 @@ def register():
icons = icon_preview
bpy.app.translations.register("bonsai", translations_dict)
import bonsai.tool as tool
tool.Blender.ensure_bin_in_path()
# RestrictedContext doesn't allow accessing scene attribute, postpone it for a bit.
bpy.app.timers.register(tool.Blender.setup_user_data_dir, first_interval=0.1)
def unregister():
global icons
@@ -0,0 +1,3 @@
*
!.gitignore
!README.md
@@ -0,0 +1 @@
This directory stores Brickschema definitions in TTL format.
@@ -0,0 +1,3 @@
*
!.gitignore
!README.md
@@ -0,0 +1 @@
This directory stores generated drawings in SVG format.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

File diff suppressed because it is too large Load Diff
@@ -5,7 +5,7 @@ FILE_NAME('EPset_Drawing.ifc','2020-01-01T00:00:00',(),(),'EPset_Drawing','EPset
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCPROPERTYSETTEMPLATE('2JhNIvqZrFnAgxfhK0XVQX',$,'EPset_Drawing','',.PSET_OCCURRENCEDRIVEN.,'IfcAnnotation/DRAWING',(#2,#3,#4,#5,#6,#7,#8,#9,#10,#11,#12,#13,#14,#15,#16,#17,#18,#19,#20,#21,#22,#23));
#1=IFCPROPERTYSETTEMPLATE('2JhNIvqZrFnAgxfhK0XVQX',$,'EPset_Drawing','',.PSET_OCCURRENCEDRIVEN.,'IfcAnnotation/DRAWING',(#2,#3,#4,#5,#6,#7,#8,#9,#10,#11,#12,#13,#14,#15,#16,#17,#18,#19,#20,#21,#22,#23,#24,#25,#26,#27));
#2=IFCSIMPLEPROPERTYTEMPLATE('23JavTMk98ZxXhrUEnjAcf',$,'TargetView','',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#3=IFCSIMPLEPROPERTYTEMPLATE('1yVWUt5H9DAOuu0OaMMLpe',$,'Scale','The scale of this drawing represented as a numerator and denominator, such as 1/100',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#4=IFCSIMPLEPROPERTYTEMPLATE('3gsuPBtU93b8f0gg1pjkq6',$,'HumanScale','The scale of this drawing in human readable format, such as 1:100',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
@@ -28,5 +28,9 @@ DATA;
#21=IFCSIMPLEPROPERTYTEMPLATE('0nYMT3OSj5gArVniCWZRtv',$,'ShadingStyles','',.P_SINGLEVALUE.,'IfcText',$,$,$,$,$,.READWRITE.);
#22=IFCSIMPLEPROPERTYTEMPLATE('3VWG22eZXBdQwdKlzMeVQH',$,'CurrentShadingStyle','',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#23=IFCSIMPLEPROPERTYTEMPLATE('28mJ$GDxb7kBbKFH_rACMQ',$,'AngleDecimalPlaces','',.P_SINGLEVALUE.,'IfcInteger',$,$,$,$,$,.READWRITE.);
#24=IFCSIMPLEPROPERTYTEMPLATE('0EP4WR7eb1IR$rqEJ_XRVX',$,'DPI','DPI of rasterized underlays',.P_SINGLEVALUE.,'IfcInteger',$,$,$,$,$,.READWRITE.);
#25=IFCSIMPLEPROPERTYTEMPLATE('3LHwCrOcb6Y8ozfJZ7Ay$c',$,'LineworkMode','Method to use for line work',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#26=IFCSIMPLEPROPERTYTEMPLATE('2iwERDOW55Pf4hCbuFRe1Q',$,'FillMode','Method to fill areas seen in projection',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#27=IFCSIMPLEPROPERTYTEMPLATE('1YF$qLzBzF19Io8aB2N8cE',$,'CutMode','Method for cutting geometry',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
ENDSEC;
END-ISO-10303-21;
@@ -1,11 +1,11 @@
ISO-10303-21;
HEADER;
FILE_DESCRIPTION((),'2;1');
FILE_NAME('Psets_BBIM_Annotation.ifc','2020-01-01T00:00:00',(),(),'Psets_BBIM_Annotation','Psets_BBIM_Annotation',$);
FILE_DESCRIPTION($,'2;1');
FILE_NAME('Psets_BBIM_Annotation.ifc','2020-01-01T00:00:00',$,$,'Psets_BBIM_Annotation','Psets_BBIM_Annotation',$);
FILE_SCHEMA(('IFC4'));
ENDSEC;
DATA;
#1=IFCPROPERTYSETTEMPLATE('3VuPUwdCD2Qx3XDDRs0R1N',$,'EPset_Annotation','',.PSET_TYPEDRIVENOVERRIDE.,'IfcAnnotation,IfcTypeProduct',(#2,#3,#4));
#1=IFCPROPERTYSETTEMPLATE('3VuPUwdCD2Qx3XDDRs0R1N',$,'EPset_Annotation','',.PSET_TYPEDRIVENOVERRIDE.,'IfcAnnotation,IfcTypeProduct',(#2,#3,#4,#29));
#2=IFCSIMPLEPROPERTYTEMPLATE('2P7JN79n96Q9pElZ83LKe4',$,'ZIndex','',.P_SINGLEVALUE.,'IfcInteger',$,$,$,$,$,.READWRITE.);
#3=IFCSIMPLEPROPERTYTEMPLATE('1Wpx_r2xj1_9w5JpI0QRJy',$,'Symbol','',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#4=IFCSIMPLEPROPERTYTEMPLATE('3q0oxMUKP47vZ4jnyG$dDb',$,'Classes','Classes separarated by spaces that end up in classes for this element in svg. Can be used to specify the text font size: small - 1.8mm; regular - 2.5mm; large - 3.5mm; header - 5mm; title - 7mm. By default regular size is used.',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
@@ -33,6 +33,6 @@ DATA;
#26=IFCSIMPLEPROPERTYTEMPLATE('0SVyOfB0rC2xNfdRYf3XvY',$,'SuppressZeroInches','Suppress 0 inch values in dimension annotation text (for example: 12'' - 0" -> 12'')',.P_SINGLEVALUE.,'IfcBoolean',$,$,$,$,$,.READWRITE.);
#27=IFCSIMPLEPROPERTYTEMPLATE('2bUmj458PBqPAtUoI3MXsb',$,'TextPrefix','Text to add before annotation measurement value',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#28=IFCSIMPLEPROPERTYTEMPLATE('0bnzttUb9BPuN597uNTXOE',$,'TextSuffix','Text to add after annotation measurement value',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);
#29=IFCSIMPLEPROPERTYTEMPLATE('2pJmUDpB50VBdCOib1zcJJ',$,'Newline_At','',.P_SINGLEVALUE.,'IfcInteger',$,$,$,$,$,.READWRITE.);
ENDSEC;
END-ISO-10303-21;
@@ -0,0 +1,3 @@
*
!.gitignore
!README.md
@@ -0,0 +1 @@
This directory stores generated tabular schedules in SVG format.
@@ -0,0 +1,3 @@
*
!.gitignore
!README.md
@@ -0,0 +1 @@
This directory stores generated sheets in SVG format. Sheets typically contain drawings and schedules.
@@ -18,11 +18,7 @@ import xml.etree.ElementTree as ET
sio_port = 8080 # default port
sio = socketio.AsyncServer(
cors_allowed_origins="*",
async_mode="aiohttp",
max_http_buffer_size=10000000
)
sio = socketio.AsyncServer(cors_allowed_origins="*", async_mode="aiohttp", max_http_buffer_size=10000000)
app = web.Application()
sio.attach(app)
@@ -269,13 +269,7 @@ function addTableElement(blenderId, csvData, filename) {
},
});
var downloadCsv = $('<a><i class="fa-solid fa-file-csv"></i></a>')
.css("margin-left", "10px")
.css("cursor", "pointer");
tableTitle.append(downloadCsv);
downloadCsv.on("click", function () {
table.download("csv", "data.csv");
});
createDownloadIcon(blenderId);
table.on("rowSelected", function (row) {
var index = row.getIndex(); // the guid of the object
@@ -301,6 +295,18 @@ function addTableElement(blenderId, csvData, filename) {
});
}
function createDownloadIcon(blenderId) {
const table = Tabulator.findTable("#table-" + blenderId)[0];
const tableTitle = $("#title-" + blenderId);
var downloadCsv = $('<a><i class="fa-solid fa-file-csv"></i></a>')
.css("margin-left", "10px")
.css("cursor", "pointer");
tableTitle.append(downloadCsv);
downloadCsv.on("click", function () {
table.download("csv", "data.csv");
});
}
// Function to update table and filename
function updateTableElement(blenderId, csvData, filename) {
// check if the headers are the same
@@ -329,6 +335,7 @@ function updateTableElement(blenderId, csvData, filename) {
}
}
$("#title-" + blenderId).text(filename);
createDownloadIcon(blenderId);
}
}
+14 -15
View File
@@ -20,7 +20,6 @@ from __future__ import annotations
import os
import bpy
import json
import numpy as np
import datetime
import zipfile
import tempfile
@@ -49,6 +48,7 @@ class IfcExporter:
IfcStore.update_cache()
self.sync_all_objects()
self.sync_edited_objects()
tool.Project.save_linked_models_to_ifc()
extension = self.ifc_export_settings.output_file.split(".")[-1].lower()
if extension == "ifczip":
with tempfile.TemporaryDirectory() as unzipped_path:
@@ -115,17 +115,12 @@ class IfcExporter:
for obj in IfcStore.edited_objs.copy():
if not obj:
continue
try:
if isinstance(obj, bpy.types.Material):
# TODO: do we add materials to edited_objs?
continue
else:
element = tool.Ifc.get_entity(obj)
if element:
results.append(element)
bpy.ops.bim.update_representation(obj=obj.name)
except ReferenceError:
pass # The object is likely deleted
if not tool.Blender.is_valid_data_block(obj):
continue
element = tool.Ifc.get_entity(obj)
if element:
results.append(element)
bpy.ops.bim.update_representation(obj=obj.name)
IfcStore.edited_objs.clear()
return results
@@ -142,8 +137,6 @@ class IfcExporter:
def sync_object_placement(self, obj: bpy.types.Object) -> Union[ifcopenshell.entity_instance, None]:
element = self.file.by_id(obj.BIMObjectProperties.ifc_definition_id)
if not tool.Ifc.is_moved(obj):
return
if tool.Geometry.is_scaled(obj):
bpy.ops.bim.update_representation(obj=obj.name)
# update_representation might not apply scale if the object has openings
@@ -151,7 +144,13 @@ class IfcExporter:
if tool.Geometry.is_scaled(obj):
print(f"WARNING. Object '{obj.name}' scales ({obj.scale[:]}) are reset during project save.")
obj.scale = (1.0, 1.0, 1.0)
return element
else:
# Return and don't handle is_moved as
# updata_representation will run edit_object_placement if object is scaled
# and had no openings.
return element
if not tool.Ifc.is_moved(obj):
return
if element.is_a("IfcGridAxis"):
return self.sync_grid_axis_object_placement(obj, element)
if not hasattr(element, "ObjectPlacement"):
+36 -5
View File
@@ -30,6 +30,10 @@ from bonsai.bim.ifc import IfcStore
from bonsai.bim.module.owner.prop import get_user_person, get_user_organisation
from bonsai.bim.module.model.data import AuthoringData
from bonsai.bim.module.model.workspace import LIST_OF_TOOLS, TOOLS_TO_CLASSES_MAP
from bonsai.bim.module.aggregate.decorator import AggregateDecorator
from bonsai.bim.module.georeference.decorator import GeoreferenceDecorator
from bonsai.bim.module.model.decorator import WallAxisDecorator, SlabDirectionDecorator
from bonsai.bim.module.nest.decorator import NestDecorator
from mathutils import Vector
from math import cos, degrees
from typing import Union, Callable
@@ -52,9 +56,13 @@ def name_callback(obj: Union[bpy.types.Object, bpy.types.Material], data: str) -
return
if isinstance(obj, bpy.types.Material):
if ifc_definition_id := obj.BIMStyleProperties.ifc_definition_id:
props = obj.BIMStyleProperties
if ifc_definition_id := props.ifc_definition_id:
if props.is_renaming:
props.is_renmaing = False
return
IfcStore.get_file().by_id(ifc_definition_id).Name = obj.name
refresh_ui_data()
refresh_ui_data()
return
if not obj.BIMObjectProperties.ifc_definition_id:
@@ -134,7 +142,7 @@ def update_bim_tool_props():
if AuthoringData.data["active_material_usage"] == "LAYER2":
x_angle = get_x_angle(extrusion)
axis = tool.Model.get_wall_axis(obj)["reference"]
props.extrusion_depth = extrusion.Depth * si_conversion * cos(x_angle)
props.extrusion_depth = abs(extrusion.Depth * si_conversion * cos(x_angle))
props.length = (axis[1] - axis[0]).length
props.x_angle = x_angle
@@ -180,6 +188,9 @@ def refresh_ui_data():
and it need to be refreshed manually if needed.
"""
from bonsai.bim import modules
import bonsai.bim.ui
bonsai.bim.ui.refresh()
for name, value in modules.items():
try:
@@ -305,8 +316,6 @@ def load_post(scene):
# After appending the workspace to ensure BIM viewport is affected.
subscribe_to_viewport_shading_changes()
bpy.ops.bim.override_escape("INVOKE_DEFAULT")
# To improve usability for new users, we hijack the scene properties
# tab. We override default scene properties panels with our own poll
# to hide them unless the user has chosen to view Blender properties.
@@ -318,3 +327,25 @@ def load_post(scene):
if tool.Ifc.get() and bpy.data.is_saved:
bpy.context.scene.BIMProperties.has_blend_warning = True
# Bonsai overlays
georeference_props = bpy.context.scene.BIMGeoreferenceProperties
aggregate_props = bpy.context.scene.BIMAggregateProperties
nest_props = bpy.context.scene.BIMNestProperties
model_props = bpy.context.scene.BIMModelProperties
if georeference_props.should_visualise:
GeoreferenceDecorator.install(bpy.context)
if aggregate_props.aggregate_decorator:
AggregateDecorator.install(bpy.context)
if nest_props.nest_decorator:
NestDecorator.install(bpy.context)
if model_props.show_wall_axis:
WallAxisDecorator.install(bpy.context)
if model_props.show_slab_direction:
SlabDirectionDecorator.install(bpy.context)
if scene := bpy.context.scene:
# Snapping is off by default in Blender, but in BIM, it's more useful to be on
scene.tool_settings.use_snap = True
# Match default Bonsai snaps
scene.tool_settings.snap_elements_base = {"EDGE", "EDGE_PERPENDICULAR", "VERTEX", "EDGE_MIDPOINT", "FACE"}
+78 -27
View File
@@ -20,21 +20,19 @@ from __future__ import annotations
import importlib
import bpy
import json
import math
import ifcopenshell
import ifcopenshell.ifcopenshell_wrapper as W
import ifcopenshell.util.attribute
import ifcopenshell.util.element
import ifcopenshell.util.unit
from ifcopenshell.util.doc import get_attribute_doc, get_predefined_type_doc, get_property_doc
from mathutils import geometry
from mathutils import Vector
import bonsai.tool as tool
from bonsai.bim.ifc import IfcStore
from typing import Optional, Callable, Any, Union, Iterable, TYPE_CHECKING
if TYPE_CHECKING:
import bonsai.bim.prop
from bonsai.bim.prop import Attribute
# ImportCallback return values:
# - None - property should be imported by default workflow
@@ -48,12 +46,15 @@ if TYPE_CHECKING:
def draw_attributes(
props: list[bonsai.bim.prop.Attribute],
props: bpy.types.bpy_prop_collection_idprop[Attribute],
layout: bpy.types.UILayout,
copy_operator: Optional[str] = None,
popup_active_attribute: Optional[bonsai.bim.prop.Attribute] = None,
callback: Optional[Callable[[bonsai.bim.prop.Attribute, bpy.types.UILayout], None]] = None,
) -> None:
"""you can set attribute active in popup with `active_attribute`
"""Draw editable UI for prop.Attributes.
You can set attribute active in popup with `active_attribute`
meaning you will be able to type into attribute's field without having to click
on it first
"""
@@ -62,20 +63,19 @@ def draw_attributes(
if attribute == popup_active_attribute:
row.activate_init = True
draw_attribute(attribute, row, copy_operator)
if callback:
callback(attribute, row)
def draw_attribute(
attribute: bonsai.bim.prop.Attribute, layout: bpy.types.UILayout, copy_operator: Optional[str] = None
) -> None:
value_name = attribute.get_value_name()
if not value_name:
layout.label(text=attribute.name)
return
value_name = attribute.get_value_name(display_only=True)
if value_name == "enum_value":
prop_with_search(layout, attribute, "enum_value", text=attribute.name)
elif value_name == "filepath_value":
attribute.filepath_value.layout_file_select(layout, filter_glob=attribute.filter_glob, text=attribute.name)
elif attribute.name in ["ScheduleDuration", "ActualDuration", "FreeFloat", "TotalFloat"]:
elif attribute.name in ("ScheduleDuration", "ActualDuration", "FreeFloat", "TotalFloat"):
propis = bpy.context.scene.BIMWorkScheduleProperties
for item in propis.durations_attributes:
if item.name == attribute.name:
@@ -92,26 +92,30 @@ def draw_attribute(
layout.prop(
attribute,
value_name,
text=attribute.name,
text=attribute.display_name,
)
if attribute.is_uri:
op = layout.operator("bim.select_uri_attribute", text="", icon="FILE_FOLDER")
op.data_path = attribute.path_from_id("string_value")
elif attribute.special_type in ("DATE", "DATETIME"):
op = layout.operator("bim.datepicker", text="", icon="TIME")
op.target_prop = attribute.path_from_id("string_value")
op.include_time = attribute.special_type == "DATETIME"
if attribute.is_optional:
layout.prop(attribute, "is_null", icon="RADIOBUT_OFF" if attribute.is_null else "RADIOBUT_ON", text="")
if attribute.name == "GlobalId":
layout.operator("bim.generate_global_id", icon="FILE_REFRESH", text="")
if copy_operator:
elif copy_operator:
op = layout.operator(f"{copy_operator}", text="", icon="COPYDOWN")
op.name = attribute.name
def import_attributes(
ifc_class: str,
props: bpy.types.bpy_prop_collection,
props: bpy.types.bpy_prop_collection_idprop[Attribute],
data: dict[str, Any],
callback: Optional[ImportCallback] = None,
) -> None:
@@ -122,7 +126,7 @@ def import_attributes(
# A more elegant attribute importer signature, intended to supersede import_attributes
def import_attributes2(
element: Union[str, ifcopenshell.entity_instance],
props: bpy.types.bpy_prop_collection,
props: bpy.types.bpy_prop_collection_idprop[Attribute],
callback: Optional[ImportCallback] = None,
) -> None:
if isinstance(element, str):
@@ -138,7 +142,7 @@ def import_attributes2(
def import_attribute(
attribute: W.attribute,
props: bpy.types.bpy_prop_collection,
props: bpy.types.bpy_prop_collection_idprop[Attribute],
data: dict[str, Any],
callback: Optional[ImportCallback] = None,
) -> None:
@@ -147,7 +151,7 @@ def import_attribute(
if isinstance(data_type, tuple) or data_type == "entity":
callback(attribute.name(), None, data) if callback else None
return
new = props.add()
new: bonsai.bim.prop.Attribute = props.add()
new.name = attribute.name()
new.is_null = data[attribute.name()] is None
new.is_optional = attribute.optional()
@@ -164,31 +168,57 @@ def import_attribute(
new.string_value = "" if new.is_null else str(data[attribute.name()]).replace("\n", "\\n")
if attribute.type_of_attribute().declared_type().name() == "IfcURIReference":
new.is_uri = True
elif attribute.type_of_attribute()._is("IfcDate"):
new.special_type = "DATE"
elif attribute.type_of_attribute()._is("IfcDateTime"):
new.special_type = "DATETIME"
elif data_type == "boolean":
new.bool_value = False if new.is_null else bool(data[attribute.name()])
elif data_type == "integer":
new.int_value = 0 if new.is_null else int(data[attribute.name()])
elif data_type == "float":
attribute_type = attribute.type_of_attribute()
if attribute_type._is("IfcLengthMeasure"):
new.special_type = "LENGTH"
elif attribute_type._is("IfcForceMeasure"):
new.special_type = "FORCE"
new.float_value = 0.0 if new.is_null else float(data[attribute.name()])
elif data_type == "enum":
enum_items = ifcopenshell.util.attribute.get_enum_items(attribute)
new.enum_items = json.dumps(enum_items)
add_attribute_enum_items_descriptions(new, enum_items)
if data[new.name]:
new.enum_value = data[new.name]
attribute_type = attribute.type_of_attribute()
is_logical = str(attribute_type) == "<type IfcLogical: <logical>>"
enum_value = data[new.name]
if is_logical:
new.special_type = "LOGICAL"
enum_items = ("TRUE", "FALSE", "UNKNOWN")
new.enum_items = json.dumps(enum_items)
if enum_value is not None and enum_value != "UNKNOWN":
# IfcOpenShell returns bool if IfcLogical is True/False.
enum_value = "TRUE" if enum_value else "FALSE"
else:
enum_items = ifcopenshell.util.attribute.get_enum_items(attribute)
new.enum_items = json.dumps(enum_items)
add_attribute_enum_items_descriptions(new, enum_items)
if enum_value is not None:
new.enum_value = enum_value
add_attribute_description(new, data)
add_attribute_min_max(new)
add_attribute_min_max(attribute, new)
ATTRIBUTE_MIN_MAX_CONSTRAINTS = {"IfcMaterialLayer": {"Priority": {"value_min": 0, "value_max": 100}}}
def add_attribute_min_max(attribute_blender: bonsai.bim.prop.Attribute) -> None:
def add_attribute_min_max(attribute: W.attribute, attribute_blender: bonsai.bim.prop.Attribute) -> None:
if attribute_blender.ifc_class in ATTRIBUTE_MIN_MAX_CONSTRAINTS:
constraints = ATTRIBUTE_MIN_MAX_CONSTRAINTS[attribute_blender.ifc_class].get(attribute_blender.name, {})
for constraint, value in constraints.items():
setattr(attribute_blender, constraint, value)
setattr(attribute_blender, constraint + "_constraint", True)
attribute_type = attribute.type_of_attribute()
if attribute_type._is("IfcPositiveLengthMeasure") or attribute_type._is("IfcNonNegativeLengthMeasure"):
attribute_blender.value_min = 0.0
attribute_blender.value_min_constraint = True
def add_attribute_enum_items_descriptions(
@@ -226,7 +256,7 @@ def add_attribute_description(attribute_blender: bonsai.bim.prop.Attribute, attr
def export_attributes(
props: bpy.types.bpy_prop_collection,
props: bpy.types.bpy_prop_collection_idprop[Attribute],
callback: Optional[ExportCallback] = None,
) -> dict[str, Any]:
attributes: dict[str, Any] = {}
@@ -241,11 +271,25 @@ def export_attributes(
ENUM_ITEMS_DATA = Union[bpy.types.PropertyGroup, bpy.types.ID, bpy.types.Operator, bpy.types.OperatorProperties]
def get_display_value(value: str, float_decimal_precision: int = 6) -> str:
"""
This will get rid of the floating point precision artifacts in float values stored as a string
"""
try:
digits = len(value.split(".")[1])
value = float(value)
if digits > 6: # Maximal decimal float precision
value = round(value, float_decimal_precision)
except (ValueError, IndexError): # Not castable to a float or no decimal places (eg integer)
pass
return str(value)
def prop_with_search(
layout: bpy.types.UILayout,
data: ENUM_ITEMS_DATA,
prop_name: str,
should_click_ok_to_validate: bool = False,
should_click_ok: bool = False,
original_operator_path: Optional[str] = None,
**kwargs: Any,
):
@@ -258,7 +302,7 @@ def prop_with_search(
row.context_pointer_set(name="data", data=data)
op = row.operator("bim.enum_property_search", text="", icon="VIEWZOOM")
op.prop_name = prop_name
op.should_click_ok_to_validate = should_click_ok_to_validate
op.should_click_ok = should_click_ok
op.original_operator_path = original_operator_path or ""
except TypeError: # Prop is not iterable
pass
@@ -302,6 +346,13 @@ def get_enum_items(
return items
def draw_expandable_panel(layout, context, label: str, ui_func, default_closed: bool = True):
header, panel = layout.panel(label, default_closed=default_closed)
header.label(text=label)
if panel:
ui_func(panel, context)
def convert_property_group_from_si(property_group: bpy.types.PropertyGroup, skip_props: tuple[str, ...] = ()) -> None:
"""Method converts property group values from si to current ifc project units
+34 -10
View File
@@ -33,7 +33,7 @@ import bonsai.bim.handler
import bonsai.tool as tool
from pathlib import Path
from bonsai.tool.brick import BrickStore
from typing import Set, Union, Optional, TypedDict, Callable, NotRequired
from typing import Set, Union, Optional, TypedDict, Callable, NotRequired, cast
IFC_CONNECTED_TYPE = Union[bpy.types.Material, bpy.types.Object]
@@ -45,10 +45,14 @@ class OperationData(TypedDict):
obj: str
class EditObjectOperationData(TypedDict):
obj: str
class Operation(TypedDict):
rollback: Callable
commit: Callable
data: Union[OperationData, None]
data: Union[OperationData, EditObjectOperationData, None]
class TransactionStep(TypedDict):
@@ -101,8 +105,9 @@ class IfcStore:
@staticmethod
def get_file():
if IfcStore.file is None:
IfcStore.path = bpy.context.scene.BIMProperties.ifc_file
if not os.path.isabs(IfcStore.path):
IfcStore.path = cast(str, bpy.context.scene.BIMProperties.ifc_file)
# Interpret relative paths as relative to .blend file.
if IfcStore.path and not os.path.isabs(IfcStore.path):
IfcStore.path = os.path.abspath(os.path.join(bpy.path.abspath("//"), IfcStore.path))
if IfcStore.path:
try:
@@ -116,7 +121,8 @@ class IfcStore:
if IfcStore.cache is None and IfcStore.path:
ifc_key = IfcStore.path + IfcStore.file.wrapped_data.header.file_name.time_stamp
ifc_hash = hashlib.md5(ifc_key.encode("utf-8")).hexdigest()
IfcStore.cache_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "cache", f"{ifc_hash}.h5")
os.makedirs(bpy.context.scene.BIMProperties.cache_dir, exist_ok=True)
IfcStore.cache_path = os.path.join(bpy.context.scene.BIMProperties.cache_dir, f"{ifc_hash}.h5")
cache_path = Path(IfcStore.cache_path)
cache_settings = ifcopenshell.geom.settings()
serializer_settings = ifcopenshell.geom.serializer_settings()
@@ -156,7 +162,7 @@ class IfcStore:
assert IfcStore.file
ifc_key = IfcStore.path + IfcStore.file.wrapped_data.header.file_name.time_stamp
ifc_hash = hashlib.md5(ifc_key.encode("utf-8")).hexdigest()
new_cache_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "cache", f"{ifc_hash}.h5")
new_cache_path = os.path.join(bpy.context.scene.BIMProperties.cache_dir, f"{ifc_hash}.h5")
IfcStore.cache = None
try:
shutil.move(IfcStore.cache_path, new_cache_path)
@@ -295,7 +301,28 @@ class IfcStore:
if "guid" in data:
IfcStore.guid_map[data["guid"]] = obj
tool.Ifc.setup_listeners(obj)
# TODO We're handling id_map and guid_map, but what about edited_objs? This might cause big problems.
@staticmethod
def history_edit_object(obj: bpy.types.Object, *, finish_editing: bool) -> None:
if not IfcStore.history:
return
commit, rollback = IfcStore.commit_edit_object, IfcStore.rollback_edit_object
if finish_editing:
commit, rollback = rollback, commit
data = EditObjectOperationData(obj=obj.name)
IfcStore.history[-1]["operations"].append(Operation(rollback=rollback, commit=commit, data=data))
@staticmethod
def commit_edit_object(data: EditObjectOperationData) -> None:
obj = bpy.data.objects[data["obj"]]
IfcStore.edited_objs.add(obj)
@staticmethod
def rollback_edit_object(data: EditObjectOperationData) -> None:
obj = bpy.data.objects[data["obj"]]
IfcStore.edited_objs.discard(obj)
@staticmethod
def rollback_unlink_element(data: OperationData) -> None:
@@ -378,9 +405,6 @@ class IfcStore:
obj.BIMStyleProperties.ifc_definition_id = 0
else: # bpy.types.Object
obj.BIMObjectProperties.ifc_definition_id = 0
# NOTE: in theory this will also remove listeners added by other addons
# though never had a report when this would be a problem.
bpy.msgbus.clear_by_owner(obj)
@staticmethod
def execute_ifc_operator(operator: tool.Ifc.Operator, context: bpy.types.Context, is_invoke=False) -> set[str]:
+70 -97
View File
@@ -21,6 +21,7 @@ import bpy
import time
import json
import logging
import traceback
import mathutils
import numpy as np
import multiprocessing
@@ -33,7 +34,6 @@ import ifcopenshell.util.placement
import ifcopenshell.util.representation
import ifcopenshell.util.shape
import bonsai.tool as tool
from itertools import chain, accumulate
from bonsai.bim.ifc import IfcStore, IFC_CONNECTED_TYPE
from bonsai.tool.loader import OBJECT_DATA_TYPE
from typing import Dict, Union, Optional, Any
@@ -70,8 +70,11 @@ class MaterialCreator:
self.mesh = mesh
self.obj = obj
if element.is_a("IfcTypeProduct"):
self.parse_element_type_material_styles(element)
self.parsed_meshes.add(self.mesh.name)
self.load_texture_maps(shape_has_openings)
if not self.ifc_import_settings.load_indexed_maps:
self.load_texture_maps(shape_has_openings)
self.assign_material_slots_to_faces()
tool.Geometry.record_object_materials(obj)
del self.mesh["ios_materials"]
@@ -81,6 +84,18 @@ class MaterialCreator:
if ifc_definition_id := material.BIMStyleProperties.ifc_definition_id:
self.styles[ifc_definition_id] = material
def parse_element_type_material_styles(self, element: ifcopenshell.entity_instance) -> None:
if self.mesh["ios_materials"]:
return # Already has materials assign to the representation itself
# Otherwise, we need to check for material styles on the element, since
# create_shape on types only works on representations.
context = tool.Ifc.get().by_id(self.mesh.BIMMeshProperties.ifc_definition_id).ContextOfItems
for material in ifcopenshell.util.element.get_materials(element):
if style := ifcopenshell.util.representation.get_material_style(material, context):
self.mesh["ios_materials"] = (style.id(),)
self.mesh["ios_material_ids"] = [0] * len(self.mesh.polygons)
break
def get_ifc_coordinate(self, material: bpy.types.Material) -> Union[ifcopenshell.entity_instance, None]:
"""Get IfcTextureCoordinate"""
texture_style = tool.Style.get_texture_style(material)
@@ -94,7 +109,7 @@ class MaterialCreator:
return coords
# TODO: support IfcTextureMap
if coords.is_a("IfcTextureMap"):
print(f"WARNING. IfcTextureMap texture coordinates is not supported.")
print("WARNING. IfcTextureMap texture coordinates is not supported.")
return
def load_texture_maps(self, shape_has_openings: bool) -> None:
@@ -194,14 +209,16 @@ class IfcImporter:
self.meshes: dict[str, OBJECT_DATA_TYPE] = {}
self.mesh_shapes = {}
self.time = 0
self.unit_scale = 1
self.unit_scale = 1.0
# ifc definition ids to blender elements mapping
self.added_data: dict[int, IFC_CONNECTED_TYPE] = {}
self.native_elements = set()
self.native_data = {}
self.native_elements: set[ifcopenshell.entity_instance] = set()
self.native_data: dict[str, Any] = {}
self.progress = 0
self.material_creator = MaterialCreator(ifc_import_settings, self)
classes_to_wireframe_str = bpy.context.scene.DocProperties.classes_to_wireframe
self.classes_to_wireframe_list = [word.strip() for word in classes_to_wireframe_str.split(",")]
def profile_code(self, message: str) -> None:
if not self.time:
@@ -254,6 +271,8 @@ class IfcImporter:
self.profile_code("Place objects in collections")
self.setup_arrays()
self.profile_code("Setup arrays")
tool.Project.load_linked_models_from_ifc()
self.profile_code("Load linked models")
self.add_project_to_scene()
self.profile_code("Add project to scene")
if self.ifc_import_settings.should_clean_mesh and len(self.file.by_type("IfcElement")) < 1000:
@@ -329,7 +348,7 @@ class IfcImporter:
if self.gross_elements:
print("Warning! Excessive voids were found and skipped for the following elements:")
for element in self.gross_elements:
print(element)
print(f"{element} - {len(getattr(element, 'HasOpenings', []))} openings")
def get_spatial_elements_filtered_by_elements(
self, elements: set[ifcopenshell.entity_instance]
@@ -402,7 +421,7 @@ class IfcImporter:
matrix[2][3] *= self.unit_scale
# Single swept disk solids (e.g. rebar) are better natively represented as beveled curves
if self.is_native_swept_disk_solid(element, resolved_representation):
if tool.Loader.is_native_swept_disk_solid(element, resolved_representation):
self.native_data[element.GlobalId] = {
"matrix": matrix,
"context": context,
@@ -411,23 +430,6 @@ class IfcImporter:
"type": "IfcSweptDiskSolid",
}
return True
def is_native_swept_disk_solid(
self, element: ifcopenshell.entity_instance, representation: ifcopenshell.entity_instance
) -> bool:
items = [i["item"] for i in ifcopenshell.util.representation.resolve_items(representation)]
if len(items) == 1 and items[0].is_a("IfcSweptDiskSolid"):
if tool.Blender.Modifier.is_railing(element):
return False
return True
elif len(items) and ( # See #2508 why we accommodate for invalid IFCs here
items[0].is_a("IfcSweptDiskSolid")
and len({i.is_a() for i in items}) == 1
and len({i.Radius for i in items}) == 1
):
if tool.Blender.Modifier.is_railing(element):
return False
return True
return False
def calculate_model_offset(self) -> None:
@@ -533,13 +535,17 @@ class IfcImporter:
native_data = self.native_data[element.GlobalId]
mesh_name = f"{native_data['context'].id()}/{native_data['geometry_id']}"
mesh = self.meshes.get(mesh_name)
curve_thickness = None
if mesh is None:
if native_data["type"] == "IfcSweptDiskSolid":
mesh = self.create_native_swept_disk_solid(element, mesh_name, native_data)
mesh, curve_thickness = tool.Loader.create_native_swept_disk_solid(element, mesh_name, native_data)
tool.Ifc.link(tool.Ifc.get().by_id(native_data["geometry_id"]), mesh)
mesh.name = mesh_name
self.meshes[mesh_name] = mesh
self.create_product(element, mesh=mesh)
obj = self.create_product(element, mesh=mesh)
tool.Loader.setup_native_swept_disk_solid_thickness(obj, curve_thickness)
print("Done creating geometry")
def create_spatial_elements(self) -> None:
@@ -698,24 +704,15 @@ class IfcImporter:
def create_structural_point_connections(self):
for product in self.file.by_type("IfcStructuralPointConnection"):
# TODO: make this based off ifcopenshell. See #1409
representation: ifcopenshell.entity_instance = next(
rep for rep in product.Representation.Representations if rep.RepresentationType == "Vertex"
)
mesh = tool.Loader.create_structural_point_connection_mesh(representation)
if mesh is None:
continue
tool.Ifc.link(representation, mesh)
placement_matrix = ifcopenshell.util.placement.get_local_placement(product.ObjectPlacement)
vertex = None
context = None
representation = None
for subelement in self.file.traverse(product.Representation):
if subelement.is_a("IfcVertex") and subelement.VertexGeometry.is_a("IfcCartesianPoint"):
vertex = list(subelement.VertexGeometry.Coordinates)
elif subelement.is_a("IfcGeometricRepresentationContext"):
context = subelement
elif subelement.is_a("IfcTopologyRepresentation"):
representation = subelement
if not vertex or not context or not representation:
continue # TODO implement non cartesian point vertexes
mesh_name = tool.Geometry.get_representation_name(representation)
mesh = bpy.data.meshes.new(mesh_name)
mesh.from_pydata([mathutils.Vector(vertex) * self.unit_scale], [], [])
obj = bpy.data.objects.new(tool.Loader.get_name(product), mesh)
self.set_matrix_world(obj, tool.Loader.apply_blender_offset_to_matrix_world(obj, placement_matrix))
self.link_element(product, obj)
@@ -811,8 +808,10 @@ class IfcImporter:
obj = bpy.data.objects.new(tool.Loader.get_name(element), mesh)
self.link_element(element, obj)
if getattr(element, "HasOpenings", None):
tool.Geometry.lock_scale(obj)
for ifcclass in self.classes_to_wireframe_list:
if element.is_a(ifcclass):
obj.display_type = "WIRE"
if shape:
# We use numpy here because Blender mathutils.Matrix is not accurate enough
@@ -836,43 +835,6 @@ class IfcImporter:
def load_existing_meshes(self) -> None:
self.meshes.update({m.name: m for m in bpy.data.meshes})
def create_native_swept_disk_solid(
self, element: ifcopenshell.entity_instance, mesh_name: str, native_data: dict[str, Any]
) -> bpy.types.Curve:
# TODO: georeferencing?
curve = bpy.data.curves.new(mesh_name, type="CURVE")
curve.dimensions = "3D"
curve.resolution_u = 2
polyline = curve.splines.new("POLY")
for item_data in ifcopenshell.util.representation.resolve_items(native_data["representation"]):
item = item_data["item"]
matrix = item_data["matrix"]
matrix[0][3] *= self.unit_scale
matrix[1][3] *= self.unit_scale
matrix[2][3] *= self.unit_scale
# TODO: support inner radius, start param, and end param
geometry = tool.Loader.create_generic_shape(item.Directrix)
if not geometry:
continue
e = geometry.edges
v = geometry.verts
vertices = [list(matrix @ [v[i], v[i + 1], v[i + 2], 1]) for i in range(0, len(v), 3)]
edges = [[e[i], e[i + 1]] for i in range(0, len(e), 2)]
v2 = None
for edge in edges:
v1 = vertices[edge[0]]
if v1 != v2:
polyline = curve.splines.new("POLY")
polyline.points[-1].co = native_data["matrix"] @ mathutils.Vector(v1)
v2 = vertices[edge[1]]
polyline.points.add(1)
polyline.points[-1].co = native_data["matrix"] @ mathutils.Vector(v2)
curve.bevel_depth = self.unit_scale * item.Radius
curve.use_fill_caps = True
return curve
def merge_materials_by_colour(self):
cleaned_materials = {}
for m in bpy.data.materials:
@@ -935,9 +897,9 @@ class IfcImporter:
tool.Loader.set_unit_scale(self.unit_scale)
def set_units(self):
if not (units := self.file.by_type("IfcUnitAssignment")):
if not (assignment := self.file.by_type("IfcProject")[0].UnitsInContext):
return # Geometry is optional in IFC
for unit in units[0].Units:
for unit in assignment.Units:
if unit.is_a("IfcNamedUnit") and unit.UnitType == "LENGTHUNIT":
if unit.is_a("IfcSIUnit"):
bpy.context.scene.unit_settings.system = "METRIC"
@@ -1060,11 +1022,7 @@ class IfcImporter:
v2 = vertices[edge[1]]
polyline.points.add(1)
polyline.points[-1].co = mathutils.Vector(v2)
# TODO: remove error handling after we update build in Bonsai.
try:
edges_item_ids = ifcopenshell.util.shape.get_edges_representation_item_ids(geometry).tolist()
except AttributeError:
edges_item_ids = []
edges_item_ids = ifcopenshell.util.shape.get_edges_representation_item_ids(geometry).tolist()
curve["ios_edges_item_ids"] = edges_item_ids
return curve
@@ -1116,7 +1074,12 @@ class IfcImporter:
verts = geometry.verts
mesh["has_cartesian_point_offset"] = False
return tool.Loader.convert_geometry_to_mesh(geometry, mesh, verts=verts)
return tool.Loader.convert_geometry_to_mesh(
geometry,
mesh,
verts=verts,
load_indexed_maps=self.ifc_import_settings.load_indexed_maps,
)
except:
self.ifc_import_settings.logger.error("Could not create mesh for %s", element)
import traceback
@@ -1184,15 +1147,16 @@ class IfcImportSettings:
self.has_filter = None
self.should_filter_spatial_elements = True
self.should_setup_viewport_camera = True
self.contexts = []
self.contexts: list[ifcopenshell.entity_instance] = []
self.context_settings: list[ifcopenshell.geom.main.settings] = []
self.gross_context_settings: list[ifcopenshell.geom.main.settings] = []
self.elements: set[ifcopenshell.entity_instance] = set()
self.load_indexed_maps = False
@staticmethod
def factory(context=None, input_file=None, logger=None):
scene_diff = bpy.context.scene.DiffProperties
props = bpy.context.scene.BIMProjectProperties
props = tool.Project.get_project_props()
settings = IfcImportSettings()
settings.input_file = input_file
if logger is None:
@@ -1212,13 +1176,22 @@ class IfcImportSettings:
settings.false_origin_mode = props.false_origin_mode
try:
settings.false_origin = [float(o) for o in props.false_origin.split(",")[:3]]
except:
settings.false_origin = [0, 0, 0]
except Exception as e:
print(traceback.format_exc())
raise Exception(
f"Failed to set false origin from string '{props.false_origin}'.\n"
f"Error: {str(e)}.\nSee above for the details."
)
try:
settings.project_north = float(props.project_north)
except:
settings.project_north = 0
except Exception as e:
print(traceback.format_exc())
raise Exception(
f"Failed to set project north from string '{props.project_north}'.\n"
f"Error: {str(e)}.\nSee above for the details."
)
settings.element_limit_mode = props.element_limit_mode
settings.element_offset = props.element_offset
settings.element_limit = props.element_limit
settings.load_indexed_maps = props.load_indexed_maps
return settings
@@ -30,7 +30,11 @@ classes = (
operator.BIM_OT_aggregate_unassign_object,
operator.BIM_OT_break_link_to_other_aggregates,
operator.BIM_OT_select_linked_aggregates,
operator.BIM_OT_disable_aggregate_mode,
operator.BIM_OT_toggle_aggregate_mode_local_view,
prop.BIMObjectAggregateProperties,
prop.Objects,
prop.BIMAggregateProperties,
ui.BIM_PT_aggregate,
ui.BIM_PT_linked_aggregate,
)
@@ -38,7 +42,9 @@ classes = (
def register():
bpy.types.Object.BIMObjectAggregateProperties = bpy.props.PointerProperty(type=prop.BIMObjectAggregateProperties)
bpy.types.Scene.BIMAggregateProperties = bpy.props.PointerProperty(type=prop.BIMAggregateProperties)
def unregister():
del bpy.types.Object.BIMObjectAggregateProperties
del bpy.types.Scene.BIMAggregateProperties
@@ -0,0 +1,332 @@
# Bonsai - OpenBIM Blender Add-on
# Copyright (C) 2024 Bruno Perdigão <contact@brunopo.com>
#
# This file is part of Bonsai.
#
# Bonsai is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Bonsai is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Bonsai. If not, see <http://www.gnu.org/licenses/>.
import blf
import bpy
import gpu
import ifcopenshell
import bonsai.tool as tool
from bpy.types import SpaceView3D
from bpy_extras import view3d_utils
from gpu_extras.batch import batch_for_shader
from mathutils import Vector
from bonsai.bim.module.geometry.decorator import ItemDecorator
def transparent_color(color, alpha=0.1):
color = [i for i in color]
color[3] = alpha
return color
def create_bounding_box(objs):
# Initialize the bounding box coordinates
min_x, min_y, min_z = float("inf"), float("inf"), float("inf")
max_x, max_y, max_z = float("-inf"), float("-inf"), float("-inf")
# Iterate over the selected objects
for obj in objs:
if not obj.data:
continue
# Get the object's bounding box coordinates
bbox_world = [obj.matrix_world @ Vector(b) for b in obj.bound_box]
obj_min = []
obj_min.append(min([b[0] for b in bbox_world]))
obj_min.append(min([b[1] for b in bbox_world]))
obj_min.append(min([b[2] for b in bbox_world]))
obj_max = []
obj_max.append(max([b[0] for b in bbox_world]))
obj_max.append(max([b[1] for b in bbox_world]))
obj_max.append(max([b[2] for b in bbox_world]))
# Update the overall bounding box coordinates
min_x = min(min_x, min(obj_min[0], obj_max[0]))
min_y = min(min_y, min(obj_min[1], obj_max[1]))
min_z = min(min_z, min(obj_min[2], obj_max[2]))
max_x = max(max_x, max(obj_min[0], obj_max[0]))
max_y = max(max_y, max(obj_min[1], obj_max[1]))
max_z = max(max_z, max(obj_min[2], obj_max[2]))
indices = [
(min_x, min_y, min_z),
(max_x, min_y, min_z),
(max_x, max_y, min_z),
(min_x, max_y, min_z),
(min_x, min_y, max_z),
(max_x, min_y, max_z),
(max_x, max_y, max_z),
(min_x, max_y, max_z),
]
edges = [(0, 1), (1, 2), (2, 3), (3, 0), (4, 5), (5, 6), (6, 7), (7, 4), (0, 4), (1, 5), (2, 6), (3, 7)]
return indices, edges
class AggregateDecorator:
is_installed = False
handlers = []
@classmethod
def install(cls, context):
if cls.is_installed:
cls.uninstall()
handler = cls()
cls.handlers.append(SpaceView3D.draw_handler_add(handler.draw_aggregate, (context,), "WINDOW", "POST_VIEW"))
cls.is_installed = True
@classmethod
def uninstall(cls):
for handler in cls.handlers:
try:
SpaceView3D.draw_handler_remove(handler, "WINDOW")
except ValueError:
pass
cls.is_installed = False
def dotted_line_shader(self):
vert_out = gpu.types.GPUStageInterfaceInfo("my_interface")
vert_out.smooth("FLOAT", "v_ArcLength")
shader_info = gpu.types.GPUShaderCreateInfo()
shader_info.push_constant("MAT4", "u_ViewProjectionMatrix")
shader_info.push_constant("FLOAT", "u_Scale")
shader_info.vertex_in(0, "VEC3", "position")
shader_info.vertex_in(1, "FLOAT", "arcLength")
shader_info.vertex_out(vert_out)
shader_info.fragment_out(0, "VEC4", "FragColor")
shader_info.push_constant("VEC4", "color")
shader_info.vertex_source(
"void main()"
"{"
" v_ArcLength = arcLength;"
" gl_Position = u_ViewProjectionMatrix * vec4(position, 1.0f);"
"}"
)
shader_info.fragment_source(
"void main()" "{" " if (step(sin(v_ArcLength * u_Scale), 0.4) == 1) discard;" " FragColor = color;" "}"
)
shader = gpu.shader.create_from_info(shader_info)
del vert_out
del shader_info
return shader
def draw_custom_batch(self, coords, color):
shader = self.dotted_line_shader()
arc_lengths = [0]
for a, b in zip(coords[:-1], coords[1:]):
arc_lengths.append(arc_lengths[-1] + (a - b).length)
batch = batch_for_shader(
shader,
"LINE_STRIP",
{"position": coords, "arcLength": arc_lengths},
)
matrix = bpy.context.region_data.perspective_matrix
shader.uniform_float("color", color)
shader.uniform_float("u_ViewProjectionMatrix", matrix)
shader.uniform_float("u_Scale", 25)
batch.draw(shader)
def draw_batch(self, shader_type, content_pos, color, indices=None):
shader = self.line_shader if shader_type == "LINES" else self.shader
batch = batch_for_shader(shader, shader_type, {"pos": content_pos}, indices=indices)
shader.uniform_float("color", color)
batch.draw(shader)
def draw_aggregate(self, context):
if context.scene.BIMAggregateProperties.in_aggregate_mode:
return
self.addon_prefs = tool.Blender.get_addon_preferences()
decorator_color_special = self.addon_prefs.decorator_color_special
decorator_color_selected = self.addon_prefs.decorator_color_selected
decorator_color_error = self.addon_prefs.decorator_color_error
decorator_color_unselected = self.addon_prefs.decorator_color_unselected
decorator_color_background = self.addon_prefs.decorator_color_background
theme = context.preferences.themes.items()[0][1]
selected_object_color = (*theme.view_3d.object_active, 1)
self.shader = gpu.shader.from_builtin("UNIFORM_COLOR")
self.shader.bind()
self.line_shader = gpu.shader.from_builtin("POLYLINE_UNIFORM_COLOR")
self.line_shader.bind()
# POLYLINE_UNIFORM_COLOR specific uniforms
self.line_shader.uniform_float("viewportSize", (context.region.width, context.region.height))
aggregates = []
if not (selected_objects := context.selected_objects):
return
for obj in selected_objects:
element = tool.Ifc.get_entity(obj)
if not element or not element.is_a("IfcElement"):
return
parts = ifcopenshell.util.element.get_parts(element)
if parts:
aggregates.append(obj)
continue
aggregate = ifcopenshell.util.element.get_aggregate(element)
if aggregate:
aggregates.append(tool.Ifc.get_object(aggregate))
aggregates = set(aggregates)
for aggregate in aggregates:
self.line_shader.uniform_float("lineWidth", 1.0)
color = decorator_color_unselected
if aggregate in selected_objects:
color = selected_object_color
size = aggregate.empty_display_size
location = aggregate.location
line_x = (location - Vector((size, 0.0, 0.0)), location + Vector((size, 0.0, 0.0)))
self.draw_batch("LINES", line_x, color, [(0, 1)])
line_y = (location - Vector((0.0, size, 0.0)), location + Vector((0.0, size, 0.0)))
self.draw_batch("LINES", line_y, color, [(0, 1)])
line_z = (location - Vector((0.0, 0.0, size)), location + Vector((0.0, 0.0, size)))
self.draw_batch("LINES", line_z, color, [(0, 1)])
if context.scene.BIMAggregateProperties.in_aggregate_mode:
return
parts = ifcopenshell.util.element.get_parts(tool.Ifc.get_entity(aggregate))
parts_objs = [tool.Ifc.get_object(p) for p in parts]
indices, edges = create_bounding_box(parts_objs)
self.line_shader.uniform_float("lineWidth", 0.5)
self.draw_batch("LINES", indices, color, edges)
line = (Vector(indices[0]), location)
self.draw_custom_batch(line, decorator_color_unselected)
class AggregateModeDecorator:
is_installed = False
handlers = []
@classmethod
def install(cls, context):
if cls.is_installed:
cls.uninstall()
handler = cls()
cls.handlers.append(
SpaceView3D.draw_handler_add(handler.draw_aggregate_name, (context,), "WINDOW", "POST_PIXEL")
)
cls.handlers.append(
SpaceView3D.draw_handler_add(handler.draw_aggregate_empty, (context,), "WINDOW", "POST_VIEW")
)
cls.is_installed = True
@classmethod
def uninstall(cls):
for handler in cls.handlers:
try:
SpaceView3D.draw_handler_remove(handler, "WINDOW")
except ValueError:
pass
cls.is_installed = False
def draw_batch(self, shader_type, content_pos, color, indices=None):
shader = self.line_shader if shader_type == "LINES" else self.shader
batch = batch_for_shader(shader, shader_type, {"pos": content_pos}, indices=indices)
shader.uniform_float("color", color)
batch.draw(shader)
def draw_aggregate_name(self, context):
if context.mode == "EDIT_MESH":
return
region = context.region
rv3d = region.data
props = context.scene.BIMAggregateProperties
aggregate_obj = props.editing_aggregate
if not aggregate_obj:
return
self.addon_prefs = tool.Blender.get_addon_preferences()
self.font_id = 0
font_size = tool.Blender.scale_font_size(12)
blf.size(self.font_id, font_size)
blf.enable(self.font_id, blf.SHADOW)
blf.shadow(self.font_id, 6, 0, 0, 0, 1)
color = self.addon_prefs.decorator_color_selected
if aggregate_obj in context.selected_objects:
color = self.addon_prefs.decorator_color_selected
blf.color(self.font_id, *color)
text = aggregate_obj.name
text_coords = view3d_utils.location_3d_to_region_2d(region, rv3d, aggregate_obj.location)
if not text_coords:
return
text_length = blf.dimensions(self.font_id, text)
text_coords[0] -= text_length[0] / 2
text_coords[1] -= 20
blf.position(self.font_id, text_coords[0], text_coords[1], 0)
self.shader = gpu.shader.from_builtin("UNIFORM_COLOR")
blf.draw(self.font_id, text)
def draw_aggregate_empty(self, context):
if context.mode == "EDIT_MESH":
return
props = context.scene.BIMAggregateProperties
aggregate_obj = props.editing_aggregate
if not aggregate_obj:
return
self.addon_prefs = tool.Blender.get_addon_preferences()
self.line_shader = gpu.shader.from_builtin("POLYLINE_UNIFORM_COLOR")
self.line_shader.bind()
self.line_shader.uniform_float("viewportSize", (context.region.width, context.region.height))
self.line_shader.uniform_float("lineWidth", 2.0)
theme = context.preferences.themes.items()[0][1]
selected_object_color = (*theme.view_3d.object_active, 1)
color = self.addon_prefs.decorator_color_selected
if aggregate_obj in context.selected_objects:
color = selected_object_color
size = aggregate_obj.empty_display_size
location = aggregate_obj.location
line_x = (location - Vector((size, 0.0, 0.0)), location + Vector((size, 0.0, 0.0)))
self.draw_batch("LINES", line_x, color, [(0, 1)])
line_y = (location - Vector((0.0, size, 0.0)), location + Vector((0.0, size, 0.0)))
self.draw_batch("LINES", line_y, color, [(0, 1)])
line_z = (location - Vector((0.0, 0.0, size)), location + Vector((0.0, 0.0, size)))
self.draw_batch("LINES", line_z, color, [(0, 1)])
parts = ifcopenshell.util.element.get_parts(tool.Ifc.get_entity(aggregate_obj))
if parts:
for part in parts:
part_obj = tool.Ifc.get_object(part)
if part.is_a("IfcElementAssembly"):
self.line_shader.uniform_float("lineWidth", 1.0)
size = part_obj.empty_display_size
location = part_obj.location
color = self.addon_prefs.decorator_color_unselected
if part_obj in context.selected_objects:
color = selected_object_color
line_x = (location - Vector((size, 0.0, 0.0)), location + Vector((size, 0.0, 0.0)))
self.draw_batch("LINES", line_x, color, [(0, 1)])
line_y = (location - Vector((0.0, size, 0.0)), location + Vector((0.0, size, 0.0)))
self.draw_batch("LINES", line_y, color, [(0, 1)])
line_z = (location - Vector((0.0, 0.0, size)), location + Vector((0.0, 0.0, size)))
self.draw_batch("LINES", line_z, color, [(0, 1)])
parts = ifcopenshell.util.element.get_parts(tool.Ifc.get_entity(aggregate_obj))
color = self.addon_prefs.decorator_color_selected
parts_objs = [tool.Ifc.get_object(p) for p in parts]
indices, edges = create_bounding_box(parts_objs)
self.line_shader.uniform_float("lineWidth", 0.5)
self.draw_batch("LINES", indices, color, edges)
@@ -23,6 +23,7 @@ import ifcopenshell.util.element
import bonsai.tool as tool
import bonsai.core.aggregate as core
import bonsai.core.spatial
from bonsai.bim.ifc import IfcStore
class BIM_OT_aggregate_assign_object(bpy.types.Operator, tool.Ifc.Operator):
@@ -66,6 +67,10 @@ class BIM_OT_aggregate_assign_object(bpy.types.Operator, tool.Ifc.Operator):
relating_obj=relating_obj,
related_obj=obj,
)
props = context.scene.BIMAggregateProperties
if relating_obj == props.editing_aggregate and props.in_aggregate_mode:
new_editing_obj = props.editing_objects.add()
new_editing_obj.obj = obj
except core.IncompatibleAggregateError:
self.report({"ERROR"}, f"Cannot aggregate {obj.name} to {relating_obj.name}")
except core.AggregateRepresentationError:
@@ -365,3 +370,33 @@ class BIM_OT_select_linked_aggregates(bpy.types.Operator):
obj.select_set(True)
return {"FINISHED"}
class BIM_OT_disable_aggregate_mode(bpy.types.Operator):
bl_idname = "bim.disable_aggregate_mode"
bl_label = "Disable Aggregate Mode"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
bpy.ops.object.select_all(action="DESELECT")
bonsai.core.aggregate.disable_aggregate_mode(tool.Aggregate)
return {"FINISHED"}
class BIM_OT_toggle_aggregate_mode_local_view(bpy.types.Operator):
bl_idname = "bim.toggle_aggregate_mode_local_view"
bl_label = "Toggle Aggregate Mode Local View"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
props = context.scene.BIMAggregateProperties
objs = [o.obj for o in props.editing_objects]
if props.in_aggregate_mode:
if context.space_data.local_view:
bpy.ops.view3d.localview()
else:
for obj in objs:
obj.select_set(True)
bpy.ops.view3d.localview()
return {"FINISHED"}
@@ -32,6 +32,7 @@ from bpy.props import (
FloatVectorProperty,
CollectionProperty,
)
from bonsai.bim.module.aggregate.decorator import AggregateDecorator, AggregateModeDecorator
def can_aggregate(relating_obj: bpy.types.Object, related_obj: bpy.types.Object) -> bool:
@@ -73,6 +74,20 @@ def poll_related_object(self: "BIMObjectAggregateProperties", related_obj: bpy.t
return True
def update_aggregate_decorator(self, context):
if self.aggregate_decorator:
AggregateDecorator.install(bpy.context)
else:
AggregateDecorator.uninstall()
def update_aggregate_mode_decorator(self, context):
if self.in_aggregate_mode:
AggregateModeDecorator.install(bpy.context)
else:
AggregateModeDecorator.uninstall()
class BIMObjectAggregateProperties(PropertyGroup):
is_editing: BoolProperty(name="Is Editing")
relating_object: PointerProperty(name="Relating Whole", type=bpy.types.Object, poll=poll_relating_object)
@@ -82,3 +97,20 @@ class BIMObjectAggregateProperties(PropertyGroup):
type=bpy.types.Object,
poll=poll_related_object,
)
class Objects(bpy.types.PropertyGroup):
obj: PointerProperty(type=bpy.types.Object)
previous_display_type: bpy.props.StringProperty(default="TEXTURED")
class BIMAggregateProperties(PropertyGroup):
in_aggregate_mode: BoolProperty(name="In Edit Mode", update=update_aggregate_mode_decorator)
editing_aggregate: PointerProperty(name="Editing Aggregate", type=bpy.types.Object)
editing_objects: CollectionProperty(type=Objects)
not_editing_objects: CollectionProperty(type=Objects)
aggregate_decorator: BoolProperty(
name="Display Aggregate",
default=False,
update=update_aggregate_decorator,
)
@@ -47,6 +47,9 @@ class BIM_PT_aggregate(Panel):
def draw(self, context):
layout = self.layout
row = layout.row()
row.label(text="Aggregate Decorator")
row.prop(context.scene.BIMAggregateProperties, "aggregate_decorator", icon="HIDE_OFF", text="")
if not AggregateData.is_loaded:
AggregateData.load()
@@ -38,13 +38,16 @@ class AttributesData:
def attributes(cls):
results = []
element = tool.Ifc.get_entity(bpy.context.active_object)
assert element
data = element.get_info()
if hasattr(element, "GlobalId"):
if "GlobalId" in data:
excluded_keys = ["id", "type"]
else:
excluded_keys = ["type"]
# Same types also filtered by `import_attribute`.
exclude_value_types = (tuple, ifcopenshell.entity_instance)
for key, value in data.items():
if value is None or isinstance(value, ifcopenshell.entity_instance) or key in excluded_keys:
if value is None or isinstance(value, exclude_value_types) or key in excluded_keys:
continue
if key == "id":
key = "STEP ID"
@@ -19,28 +19,43 @@
import bpy
import json
import ifcopenshell
import ifcopenshell.api
import ifcopenshell.api.attribute
import ifcopenshell.guid
import ifcopenshell.util.element
import bonsai.bim.helper
import bonsai.tool as tool
import bonsai.core.attribute as core
import bonsai.core.spatial
from bonsai.bim.ifc import IfcStore
def get_objs_for_operation(operator_properties, context):
if operator_properties.obj:
return [bpy.data.objects[operator_properties.obj]]
if operator_properties.mass_operation:
return context.selected_objects[:]
return [context.active_object]
class EnableEditingAttributes(bpy.types.Operator):
bl_idname = "bim.enable_editing_attributes"
bl_label = "Enable Editing Attributes"
bl_description = "ALT + Left Click to enable editing attributes on all selected objects"
bl_options = {"REGISTER", "UNDO"}
obj: bpy.props.StringProperty()
obj: bpy.props.StringProperty(options={"SKIP_SAVE"})
mass_operation: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
def execute(self, context):
self.file = IfcStore.get_file()
obj = bpy.data.objects[self.obj]
def invoke(self, context, event):
self.mass_operation = event.alt
return self.execute(context)
def enable_editing_attribute_on_obj(self, obj):
props = obj.BIMAttributeProperties
props.attributes.clear()
element = tool.Ifc.get_entity(obj)
if not element:
return
has_inherited_predefined_type = False
if not element.is_a("IfcTypeObject") and (element_type := ifcopenshell.util.element.get_type(element)):
# Allow for None due to https://github.com/buildingSMART/IFC4.3.x-development/issues/818
@@ -66,52 +81,65 @@ class EnableEditingAttributes(bpy.types.Operator):
bonsai.bim.helper.import_attributes2(element, props.attributes, callback=callback)
props.is_editing_attributes = True
def execute(self, context):
for obj in get_objs_for_operation(self, context):
self.enable_editing_attribute_on_obj(obj)
return {"FINISHED"}
class DisableEditingAttributes(bpy.types.Operator):
bl_idname = "bim.disable_editing_attributes"
bl_label = "Disable Editing Attributes"
bl_description = "ALT + Left Click to disable editing attributes on all selected objects"
bl_options = {"REGISTER", "UNDO"}
obj: bpy.props.StringProperty()
obj: bpy.props.StringProperty(options={"SKIP_SAVE"})
mass_operation: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
def execute(self, context):
obj = bpy.data.objects.get(self.obj)
def invoke(self, context, event):
self.mass_operation = event.alt
return self.execute(context)
def disable_editing_attributes_on_obj(self, obj):
props = obj.BIMAttributeProperties
props.is_editing_attributes = False
def execute(self, context):
for obj in get_objs_for_operation(self, context):
self.disable_editing_attributes_on_obj(obj)
return {"FINISHED"}
class EditAttributes(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.edit_attributes"
bl_label = "Edit Attributes"
bl_description = "Edit the attributes of the active object"
bl_options = {"REGISTER", "UNDO"}
obj: bpy.props.StringProperty()
def _execute(self, context):
self.file = IfcStore.get_file()
obj = bpy.data.objects.get(self.obj)
props = obj.BIMAttributeProperties
product = tool.Ifc.get_entity(obj)
obj = tool.Blender.get_active_object(is_selected=False)
if not (element := tool.Ifc.get_entity(obj)):
return
def callback(attributes, prop):
if prop.name in ("RefLatitude", "RefLongitude"):
if prop.is_null:
attributes[prop.name] = None
else:
if not prop.is_null:
try:
attributes[prop.name] = json.loads(prop.string_value)
except:
attributes[prop.name] = None
return True
return True
props = obj.BIMAttributeProperties
attributes = bonsai.bim.helper.export_attributes(props.attributes, callback=callback)
ifcopenshell.api.run("attribute.edit_attributes", self.file, product=product, attributes=attributes)
ifcopenshell.api.attribute.edit_attributes(self.file, product=element, attributes=attributes)
if (name := tool.Loader.get_name(product)) and obj.name != name:
obj.name = name
tool.Root.set_object_name(obj, element)
bpy.ops.bim.disable_editing_attributes(obj=obj.name)
return {"FINISHED"}
if tool.Root.is_spatial_element(element):
bonsai.core.spatial.import_spatial_decomposition(tool.Spatial)
class GenerateGlobalId(bpy.types.Operator, tool.Ifc.Operator):
@@ -160,9 +188,12 @@ class GenerateGlobalId(bpy.types.Operator, tool.Ifc.Operator):
class CopyAttributeToSelection(bpy.types.Operator, tool.Ifc.Operator):
bl_idname = "bim.copy_attribute_to_selection"
bl_label = "Copy Attribute To Selection"
bl_options = {"REGISTER", "UNDO"}
name: bpy.props.StringProperty()
def _execute(self, context):
value = context.active_object.BIMAttributeProperties.attributes.get(self.name).get_value()
for obj in tool.Blender.get_selected_objects():
core.copy_attribute_to_selection(tool.Ifc, name=self.name, value=value, obj=obj)
value = tool.Blender.get_active_object().BIMAttributeProperties.attributes.get(self.name).get_value()
total = core.copy_attribute_to_selection(
tool.Ifc, tool.Blender, tool.Root, tool.Spatial, name=self.name, value=value
)
self.report({"INFO"}, f"Attribute was successfully copied to {total} elements.")
+6 -13
View File
@@ -20,31 +20,28 @@ import bonsai.bim.helper
from bpy.types import Panel
from bonsai.bim.ifc import IfcStore
from bonsai.bim.module.attribute.data import AttributesData
import bonsai.tool as tool
def draw_ui(context, layout, attributes):
obj = context.active_object
oprops = obj.BIMObjectProperties
props = obj.BIMAttributeProperties
if props.is_editing_attributes:
row = layout.row(align=True)
op = row.operator("bim.edit_attributes", icon="CHECKMARK", text="Save Attributes")
op.obj = obj.name
op = row.operator("bim.disable_editing_attributes", icon="CANCEL", text="")
op.obj = obj.name
row.operator("bim.edit_attributes", icon="CHECKMARK", text="Save Attributes")
row.operator("bim.disable_editing_attributes", icon="CANCEL", text="")
bonsai.bim.helper.draw_attributes(props.attributes, layout, copy_operator="bim.copy_attribute_to_selection")
else:
row = layout.row()
op = row.operator("bim.enable_editing_attributes", icon="GREASEPENCIL", text="Edit")
op.obj = obj.name
for attribute in attributes:
row = layout.row(align=True)
row.label(text=attribute["name"])
# row.label(text=attribute["value"])
op = row.operator("bim.select_similar", text=attribute["value"], icon="NONE", emboss=False)
value = bonsai.bim.helper.get_display_value(attribute["value"])
op = row.operator("bim.select_similar", text=value, icon="NONE", emboss=False)
op.key = attribute["name"]
# TODO: reimplement, see #1222
@@ -62,11 +59,7 @@ class BIM_PT_object_attributes(Panel):
@classmethod
def poll(cls, context):
if not context.active_object:
return False
if not IfcStore.get_element(context.active_object.BIMObjectProperties.ifc_definition_id):
return False
return bool(context.active_object.BIMObjectProperties.ifc_definition_id)
return tool.Ifc.get_entity(context.active_object)
def draw(self, context):
if not AttributesData.is_loaded:
+6 -11
View File
@@ -616,7 +616,7 @@ class AddBcfViewpoint(bpy.types.Operator):
old_file_format = blender_render.image_settings.file_format
blender_render.image_settings.file_format = "PNG"
old_filepath = blender_render.filepath
blender_render.filepath = os.path.join(context.scene.BIMProperties.data_dir, "snapshot.png")
blender_render.filepath = tool.Blender.get_data_dir_path("snapshot.png").__str__()
bpy.ops.render.opengl(write_still=True)
with open(blender_render.filepath, "rb") as f:
snapshot = f.read()
@@ -1378,16 +1378,14 @@ class ActivateBcfViewpoint(bpy.types.Operator):
def set_view_setup_hints(
self, viewpoint: bcf.agnostic.visinfo.VisualizationInfoHandler, context: bpy.types.Context
) -> None:
if viewpoint.visualization_info.components.view_setup_hints:
if not viewpoint.visualization_info.components.view_setup_hints.spaces_visible:
# TODO: handle view_setup_hints.openings_visible
# should we reload elements with/without opening applied here or ...?
if view_setup_hints := tool.Bcf.get_viewpoint_view_setup_hints(viewpoint):
pass
if not view_setup_hints.spaces_visible:
self.hide_spaces(context)
if viewpoint.visualization_info.components.view_setup_hints.openings_visible is not None:
self.set_openings_visibility(
viewpoint.visualization_info.components.view_setup_hints.openings_visible, context
)
else:
self.hide_spaces(context)
self.set_openings_visibility(False, context)
def hide_spaces(self, context: bpy.types.Context) -> None:
old = context.area.type
@@ -1397,9 +1395,6 @@ class ActivateBcfViewpoint(bpy.types.Operator):
bpy.ops.object.hide_view_set()
context.area.type = old
def set_openings_visibility(self, is_visible, context):
pass # We no longer have an openings collection
def set_selection(self, viewpoint: bcf.agnostic.visinfo.VisualizationInfoHandler) -> None:
selected_global_ids = viewpoint.get_selected_guids()
if selected_global_ids is None:
+4 -4
View File
@@ -185,18 +185,18 @@ class BcfTopic(PropertyGroup):
def get_related_topics(self: "BCFProperties", context: bpy.types.Context) -> list[tuple[str, str, str]]:
global RELATED_TOPICS_ENUM_ITEMS
props = self
active_topic = props.active_topic
active_related_topics = active_topic.related_topics.keys()
enum_items = []
i = 0
RELATED_TOPICS_ENUM_ITEMS = []
for t in props.topics:
if t.name == active_topic.name:
continue
if t.name in active_related_topics:
continue
enum_items.append((t.name, t.title, t.description))
return enum_items
RELATED_TOPICS_ENUM_ITEMS.append((t.name, t.title, t.description))
return RELATED_TOPICS_ENUM_ITEMS
class BCFProperties(PropertyGroup):
@@ -49,9 +49,9 @@ classes = (
def register():
bpy.types.Scene.BIMBoundaryProperties = bpy.props.PointerProperty(type=prop.BIMBoundaryProperties)
bpy.types.Object.bim_boundary_properties = bpy.props.PointerProperty(type=prop.BIMObjectBoundaryProperties)
bpy.types.Object.BIMBoundaryProperties = bpy.props.PointerProperty(type=prop.BIMObjectBoundaryProperties)
def unregister():
del bpy.types.Scene.BIMBoundaryProperties
del bpy.types.Object.bim_boundary_properties
del bpy.types.Object.BIMBoundaryProperties
@@ -78,7 +78,8 @@ class BoundaryDecorator:
unselected_edges = []
unselected_tris = []
for boundary in context.scene.BIMBoundaryProperties.boundaries:
props = tool.Boundary.get_boundary_props()
for boundary in props.boundaries:
obj = boundary.obj
if not obj or not obj.data: # A boundary may not have data if it has no connection geometry
continue
@@ -42,16 +42,6 @@ import bonsai.core
import bonsai.core.geometry
def get_boundaries_collection(blender_space):
space_collection = blender_space.BIMObjectProperties.collection
collection_name = f"Boundaries/{blender_space.BIMObjectProperties.ifc_definition_id}"
boundaries_collection = space_collection.children.get(collection_name)
if not boundaries_collection:
boundaries_collection = bpy.data.collections.new(collection_name)
space_collection.children.link(boundaries_collection)
return boundaries_collection
def disable_editing_boundary_geometry(context):
ProfileDecorator.uninstall()
bpy.ops.object.mode_set(mode="OBJECT")
@@ -164,9 +154,8 @@ class Loader:
mesh = self.create_mesh(boundary)
obj = bpy.data.objects.new(f"{boundary.is_a()}/{boundary.Name}", mesh)
obj.matrix_world = blender_space.matrix_world
boundaries_collection = get_boundaries_collection(blender_space)
boundaries_collection.objects.link(obj)
tool.Ifc.link(boundary, obj)
tool.Collector.assign(obj)
return obj
@@ -365,7 +354,9 @@ class EnableEditingBoundary(bpy.types.Operator):
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
bprops = context.active_object.bim_boundary_properties
obj = context.active_object
assert obj
bprops = tool.Boundary.get_object_boundary_props(obj)
bprops.is_editing = True
boundary = tool.Ifc.get_entity(context.active_object)
for ifc_attribute, blender_property in EDITABLE_ATTRIBUTES.items():
@@ -384,7 +375,9 @@ class DisableEditingBoundary(bpy.types.Operator):
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
bprops = context.active_object.bim_boundary_properties
obj = context.active_object
assert obj
bprops = tool.Boundary.get_object_boundary_props(obj)
bprops.is_editing = False
for ifc_attribute, blender_property in EDITABLE_ATTRIBUTES.items():
setattr(bprops, blender_property, None)
@@ -397,8 +390,10 @@ class EditBoundaryAttributes(bpy.types.Operator, tool.Ifc.Operator):
bl_options = {"REGISTER", "UNDO"}
def _execute(self, context):
bprops = context.active_object.bim_boundary_properties
boundary = tool.Ifc.get_entity(context.active_object)
obj = context.active_object
assert obj
bprops = tool.Boundary.get_object_boundary_props(obj)
boundary = tool.Ifc.get_entity(obj)
attributes = dict()
for ifc_attribute, blender_property in EDITABLE_ATTRIBUTES.items():
obj = getattr(bprops, blender_property, None)
@@ -530,6 +525,7 @@ class HideBoundaries(bpy.types.Operator, tool.Ifc.Operator):
bl_options = {"REGISTER", "UNDO"}
def _execute(self, context):
props = tool.Boundary.get_boundary_props()
to_delete = set()
spaces = set()
for obj in context.selected_objects:
@@ -549,7 +545,7 @@ class HideBoundaries(bpy.types.Operator, tool.Ifc.Operator):
for boundary, boundary_obj in to_delete:
tool.Ifc.unlink(element=boundary)
bpy.data.objects.remove(boundary_obj)
context.scene.BIMBoundaryProperties.boundaries.clear()
props.boundaries.clear()
return {"FINISHED"}
@@ -560,7 +556,7 @@ class DecorateBoundaries(bpy.types.Operator, tool.Ifc.Operator):
bl_options = {"REGISTER", "UNDO"}
def _execute(self, context):
props = context.scene.BIMBoundaryProperties
props = tool.Boundary.get_boundary_props()
# filter not decorated boundaries and add decorations for them
decorated_boundaries = set([i.obj for i in props.boundaries])
active_boundaries = set()
@@ -821,7 +817,6 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
# Create shape of opening as a dissolved BMesh
settings = ifcopenshell.geom.settings()
shape = ifcopenshell.geom.create_shape(settings, opening)
m = shape.transformation.matrix
mat = Matrix(ifcopenshell.util.shape.get_shape_matrix(shape))
mat.translation = (0, 0, 0)
opening_bm = bmesh.new()
@@ -942,8 +937,6 @@ class AddBoundary(bpy.types.Operator, tool.Ifc.Operator):
# space.
exterior_boundary_polygon = shapely.Polygon(gross_boundary_polygon.exterior.coords)
inner_boundaries = []
for rel in getattr(related_building_element, "HasOpenings", []):
opening = rel.RelatedOpeningElement
if not opening.HasFillings:

Some files were not shown because too many files have changed in this diff Show More