Compare commits

...

743 Commits

Author SHA1 Message Date
Dion Moult 8b8af680bc Merge branch 'v0.8.0' into webui_updates 2024-08-29 09:55:41 +10:00
Dion Moult 8a57a52949 Bump IOS 2024-08-29 09:20:32 +10:00
Jean-Marc Couffin 720eda51c3 Update README.md with new blenderBMI branding - BONSAI 2024-08-29 08:35:24 +10:00
Bruno Perdigão 01a701007e Fix b74811b3f 2024-08-28 19:02:06 -03:00
Bruno Perdigão ec5368224f Fix after fbcb19fdb 2024-08-28 18:58:11 -03:00
Bruno Perdigão 56e9488d3e A few updates on Snap and Raycast to improve the snap feel. 2024-08-28 16:52:35 -03:00
Bruno Perdigão 23ec2fc48e Adds intersect_edges_v2 to Cad tools.
This function uses another method to calculate the closest points in two edges that are not parallel.
The `intersect_line_line` from mathutils were not getting good results when using orthogonal view.
2024-08-28 16:52:35 -03:00
Bruno Perdigão fbcb19fdbb Improved snap "stickiness".
Added more control on how the snapping system selects the snapping point, and "M" key now updates the input panel.

Added `intersect_edge_2` to Cad tool

Revert "Improved snap "stickiness"."

This reverts commit 85e67d3996ab8002b4cef7c0b859e9da251d39bf.

A few snap and raycast changes to improve the snap feel
2024-08-28 16:52:35 -03:00
Andrej730 d9f3c9d012 bim.activate_model to hide all annotations #5232 2024-08-28 23:54:17 +05:00
Yassine Oualid 91e236c42c Display and Load Work Schedules from webUI 2024-08-28 18:57:40 +01:00
Yassine Oualid 03ab88b5bb First Draft Cost Schedule Web UI:
- display cost schedules
	- load cost items
	- Add cost items
	- Edit cost item names
2024-08-28 18:54:18 +01:00
Andrej730 42ef06aae1 typing 2024-08-28 18:47:23 +05:00
Andrej730 691dfb45f0 bim.activate_model to unhide all objects #5232
Restore old behaviour (new behaviour was introduced by accident in 786b796) where it would unhide all objects instead of keeping only objects in the current drawing.
2024-08-28 18:42:10 +05:00
Andrej730 760816b7f0 Show occurrences in spatial manager decomposed elements
Example - https://imgur.com/a/PNFUbv0
2024-08-28 17:57:19 +05:00
Andrej730 fc04c6e41e Remove unused property 2024-08-28 17:53:13 +05:00
Andrej730 99e67d528f Remove duplicated then decorator from b9855b2
'then the object name is selected' were already defined in then_the_object_name_is_selected
2024-08-28 16:42:55 +05:00
Andrej730 c113061742 Preserve visibility status for non-ifc objects when drawing is activated
Mentioned in #3402
2024-08-28 16:37:26 +05:00
Andrej730 174ff00a6d Fix errors trying to setup decorations running tests 2024-08-28 16:37:26 +05:00
Andrej730 84a2d4266d Autodocument hotkeys in the BIM tool hotkeys descriptions
Addition to #5223

Example - https://i.imgur.com/vGVHNPL.png
2024-08-28 15:41:50 +05:00
Andrej730 64cba98c3d Fix #5235 2024-08-28 14:37:58 +05:00
Andrej730 1aed2a6b3c Fix error not excluding annotations from other drawings after 3848a21
Mentioned in #5233

Also some refactor:
- checking IfcProduct instead of IfcProject. Not sure when this issue occur in general but if it occurs then it might fail for other non-IfcProducts too, not just IfcProject
- small performance optimization
2024-08-28 12:35:47 +05:00
Andrej730 4e1a956830 Fix #5233 2024-08-28 12:35:47 +05:00
Andrej730 747a39b440 48f0dc6a00 to pass on unix too 2024-08-28 11:29:39 +05:00
Andrej730 1b49515d9f Replace ordered_set with orderly_set
deepdiff deprecated use of ordered_set and switched to orderly_set (ordered_set fork), so we switch too
see https://github.com/seperman/deepdiff/releases/tag/8.0.0
2024-08-28 11:14:52 +05:00
Bruno Perdigão dabb85c466 Fix polytool input for distance zero 2024-08-27 19:59:55 -03:00
Bruno Perdigão b74811b3f4 Polytool, changed decorator order to show created polyline first. 2024-08-27 19:53:03 -03:00
Bruno Perdigão 79eaf895f7 Fix polyline to work only with walls.
This is temporary until we enable polyline to work with other tools.
2024-08-27 19:05:30 -03:00
Bruno Perdigão 994c85a05a black format 2024-08-27 18:22:43 -03:00
Bruno Perdigão 0faacccf6d Raycast now filters objects that are not in the active local view. 2024-08-27 18:20:06 -03:00
Bruno Perdigão 89d27bdf5f Fixed edge snap.
The `intersect_line_line` were returning points that were outside
the object edges, so it was added a function to check if the point
return is on the object edge.
2024-08-27 18:20:06 -03:00
Bruno Perdigão 76853db32c Fix mixed snap for Polytool 2024-08-27 18:20:06 -03:00
Andrej730 002c50e29d black format 2024-08-27 18:25:30 +05:00
Andrej730 d2efb2ab78 operator to toggle container elements
Example - https://imgur.com/a/Sy83Tnz
2024-08-27 18:25:30 +05:00
Andrej730 8bb78959ef h5 cache - improve logs
Now there are logs when cache was successfully loaded/created/failed to load.
2024-08-27 18:25:30 +05:00
Andrej730 48f0dc6a00 bim.purge_hdf5_cache to skip currently loaded cache
Previously it would fail with:
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'bonsai\\bim\\data\\cache\\988c190483ae6bab7cf6b00cee78694d.h5'
2024-08-27 18:25:30 +05:00
Andrej730 27aee31adf typing 2024-08-27 18:25:29 +05:00
Bruno Perdigão 24aaefb927 Polytool, fixed error with setting the plane method 2024-08-27 10:03:02 -03:00
Bruno Perdigão 7daec25454 Polytool, fixed decorator to show the mouse snapping point on top. 2024-08-27 10:03:02 -03:00
Andrej730 8309b13db0 reveal element filters and drawing underlay panels just if drawing is active
Those two panels were requiring drawing's camera to be active object which was a bit confusing since "Active Drawing" section above worked fine without selecting camera explicitly.

https://i.imgur.com/wcmA73Z.png
2024-08-27 17:55:44 +05:00
Andrej730 5e95985d19 Fix error setting integer properties in bim tests 2024-08-27 11:33:58 +05:00
Andrej730 fefe325ece Fix workflow for tests requiring Sun Position extension 2024-08-27 11:33:21 +05:00
Bruno Perdigão b717abf639 Polytool: small fix for Z axis line decorator 2024-08-26 17:11:20 -03:00
Bruno Perdigão 32ae12b45a Polytool: added on screen snap information. 2024-08-26 17:11:19 -03:00
Bruno Perdigão 48b74ebb76 Polytool: creates a decorator to show instructions on the screen. 2024-08-26 17:11:19 -03:00
Bruno Perdigão 197d0b3258 Fixed issue with X, Y and Z input for polytool.
This issue was caused by the change to X, Y, Z keys for lock axis.
2024-08-26 17:11:19 -03:00
Bruno Perdigão 2a1bc30f19 Polytool improved axis lock and mixed snapping
You can now lock into an axis while snapping to an object.
The result will be to closer point. In the future, there should
be a way for the user to select between different points.
2024-08-26 17:11:19 -03:00
Bruno Perdigão 6dcbd98769 Fixed error for measure tool when working with top or side view. 2024-08-26 17:11:19 -03:00
Bruno Perdigão 1be025ed86 Fixed typo 2024-08-26 17:11:19 -03:00
Bruno Perdigão 6fa87a16ab Polytool refactor for selecting plane and axis snap.
User can now select X, Y, Z to lock to an axis, and
S-X, S-Y and S-Z to lock to a plane.
2024-08-26 17:11:19 -03:00
Ziad-I 8c19b695ea fix drawings and sheets paths not being normalized
which lead to the paths sometimes having both / and \\
2024-08-26 20:07:50 +03:00
Ziad-I 5831c56380 remove left over print :) 2024-08-26 16:29:09 +03:00
Andrej730 3dde1b80b9 Fix errors initializing hdf5 cache #4832 2024-08-26 17:33:23 +05:00
Andrej730 08dd8f87ff Operator to select document related objects
https://i.imgur.com/4gXAram.png
2024-08-26 17:15:44 +05:00
Andrej730 1c3cf44122 get_referenced_elements to support IfcExternalInformation 2024-08-26 17:15:44 +05:00
Andrej730 868454c011 delete brick.ttl (added in d1d9db3) 2024-08-26 17:15:44 +05:00
Andrej730 edcfcd8850 Fix error if user hit shift-a in Annotation Tool without any drawing active 2024-08-26 15:47:00 +05:00
Andrej730 33bbf9fc53 remove debug print in collector.assign 2024-08-26 15:47:00 +05:00
Andrej730 286e90e299 Add annotation by default to the active drawing #5216
Approach in 358c834 didn't worked out because annotations are assigned to the drawing after assign_class and we can't check in assign_class whether it's going to be part of the drawing.
2024-08-26 15:46:59 +05:00
Bruno Perdigão 5aa7758795 Small fix in angle input for polytool 2024-08-25 21:36:11 -03:00
Bruno Perdigão 6c47baf0de Small fix in polytool with angle input when working with millimeters units 2024-08-25 19:13:27 -03:00
Bruno Perdigão 51018177cd Added option for wall_from_to_points not round the length and angle.
This function was hard coded to round length angle, now it has an option.
I assume it was originally built like this because it was supposed to
work only with Grease Pencil.
2024-08-25 19:07:50 -03:00
Bruno Perdigão be9719f5ca Fixed issue with creating duplicated points in polytool 2024-08-25 18:53:53 -03:00
Bruno Perdigão 9193ff7252 Fixed error with raycast in orthogonal view 2024-08-25 18:42:00 -03:00
Bruno Perdigão 53c3019b73 Small fix 2024-08-25 18:36:20 -03:00
Bruno Perdigão 6bbf3d3917 Refactor snapping functions and allow to choose snapping point.
By pressing "M", the user can now cycle through active snapping points when
there are many options close to each other. Still lacks a text to give
information about the active point.
2024-08-25 18:27:10 -03:00
Ziad-I 47a15011f6 add button to drawings panel to open documentation web ui page
might need a different icon since the URL icon is used by the open_drawing button
2024-08-25 21:38:15 +03:00
Ziad-I f26f6dfe5e fix broken display for multiple spreadsheets due to absolute position
removed absolute positioning as it made spreadsheets on top of each other
and made the spreadsheet's width and height as full screen as possible. also, add a separating margin between two spreadsheets.
2024-08-25 20:30:20 +03:00
Ziad-I 1745a4fd39 fix theme data not being sent when all Bonsai's are disconnected 2024-08-25 17:50:26 +03:00
Dion Moult fcaac3787b Continuing work to update docs 2024-08-25 22:15:12 +10:00
Thomas Krijnen 2d3adce59e Compatibility fix for v0.8 wrapper instances 2024-08-25 10:51:10 +02:00
Thomas Krijnen 7e6607adcf black 2024-08-25 10:39:57 +02:00
Thomas Krijnen 46c62d7cdb Add no-parallel-mapping setting to type literal 2024-08-25 10:33:54 +02:00
Thomas Krijnen c521892ca2 ::impl to make msvc17 a bit happier 2024-08-25 09:54:44 +02:00
Dion Moult d4a0dd1527 Split header and panel tool UI into two functions. Align related tool buttons together. 2024-08-25 15:43:55 +10:00
Dion Moult 527cdd3304 General interface docs 2024-08-25 14:55:21 +10:00
tim 31e836cfb4 png icons added 2024-08-25 14:54:30 +10:00
tim 86f123b6b0 Icons to header & sidebar 2024-08-25 14:54:30 +10:00
Thomas Krijnen fea8e3a5c9 Perform similar face bound lenciency in cgal kernel 2024-08-24 20:03:44 +02:00
Thomas Krijnen 3137904055 Perform mapping in parallel (or --no-parallel-mapping) 2024-08-24 20:03:44 +02:00
Bruno Perdigão f89dee7668 Fixed angle input for imperial units in polyline wall and measure tool. 2024-08-24 15:02:22 -03:00
Ziad-I c042d1afe5 make container padding/margin consistent over all pages 2024-08-24 18:48:58 +03:00
Ziad-I 42fc72bd4f add favicon to web UI 2024-08-24 18:12:13 +03:00
Bruno Perdigão f72c128ba6 Improved validation for inputs in polyline wall and measure tool. 2024-08-24 11:48:39 -03:00
Bruno Perdigão 3ceeaa739f Small fix on format_distance to show zero like 0'. 2024-08-24 11:48:39 -03:00
Thomas Krijnen 7a2e58944e clang (rightfully) complains about missing include 2024-08-24 15:00:49 +02:00
Dion Moult b9855b289f More qto and spatial tests. Tests can now select items in a UIList. 2024-08-24 22:48:37 +10:00
Dion Moult c7a8fd9309 More Qto tests and you can now spy on UILists and enum items 2024-08-24 21:39:46 +10:00
Thomas Krijnen daa6b31c5d msvc17 workaround 2024-08-24 13:24:23 +02:00
Dion Moult cd411e1f14 Add smoke tests for colour by property feature 2024-08-24 14:20:13 +10:00
Dion Moult 7a168069f7 Add solar analysis panel UI tests 2024-08-24 13:34:40 +10:00
Bruno Perdigão 97d2e08286 Initial implementation of unit handling for wall polyline tool.
The input panel now works with meters, millimeters and imperial units.
2024-08-23 17:33:34 -03:00
Thomas Krijnen f440a3ca17 Revert OCCT version to 7.5.3 due to HLR poly/edge behaviour 2024-08-23 20:54:06 +02:00
Thomas Krijnen 81bdb551ab SvgSerializer fix: Z == 2 2024-08-23 20:43:27 +02:00
Thomas Krijnen 5fdad744d3 Cgal kernel: Fail boolean op altogether when part conversion to Nef fails 2024-08-23 20:42:32 +02:00
Thomas Krijnen ab6f408db4 Unify edge orientation logic among kernels 2024-08-23 20:41:42 +02:00
Thomas Krijnen cdf8b9c038 Cgal kernel: taxonomy::line is intended to run along local Z 2024-08-23 20:41:17 +02:00
Thomas Krijnen 918fb41a7e Unify face bound counting logic among kernels 2024-08-23 20:39:20 +02:00
Thomas Krijnen 1d8e39e55f NB! For now let's use Epick for cgal-simple instead of actually Simple_cartesian 2024-08-23 20:38:38 +02:00
Thomas Krijnen b0b65e550c dispatch_curve_creation based on template magic instead of dynamic casting 2024-08-23 20:36:47 +02:00
Thomas Krijnen a1527a7e31 --use-material-names no longer in serializer_settings 2024-08-23 20:35:01 +02:00
Ziad-I 2ca3f86fc9 add RMB context menu to tables to set top calc type 2024-08-23 21:30:21 +03:00
Thomas Krijnen d80bcd1a94 Unify variant storage (#5118) 2024-08-23 20:29:07 +02:00
Ziad-I 60a06138d2 edit index.css for color consistency 2024-08-23 19:34:15 +03:00
Andrej730 e2001e82dd fix (hopefully) last failing test in github workflow 2024-08-23 17:25:10 +05:00
Andrej730 92f4cb0ffa fix error reloading camera representation
After 4b4ede7 it was leading to non-existing code
2024-08-23 17:25:10 +05:00
Andrej730 9f00e8aef0 Use Point RepresentationType for point clouds in ifc4x3
PointCloud representation type marked as deprecated in ifc4x3, see https://ifc43-docs.standards.buildingsmart.org/IFC/RELEASE/IFC4x3/HTML/lexical/IfcShapeRepresentation.htm
2024-08-23 17:25:10 +05:00
Andrej730 638d200a27 fix error switching to point cloud representation
Previously it wasn't handled and would always result in errors. It seems the only way to load point cloud representation to BBIM was by loading IFC file and only if this is the only representation of the element.
2024-08-23 17:25:10 +05:00
Andrej730 59717d6e92 fix tests after a4a2497f33 2024-08-23 17:25:10 +05:00
Andrej730 009795f7dc More reliable way to get bbim package name #5214
See #5214 for details, can't rely on 'bpy.context.preferences.addons' as it may contain a missing addons too (if addon was manually uninstalled and it won't be able to load but it will still appear in 'addons').
2024-08-23 17:25:10 +05:00
Andrej730 a0792a4b93 typing 2024-08-23 17:25:09 +05:00
Ziad-I 8534b6e154 fix first demo message not showing 2024-08-23 19:34:35 +10:00
Ziad-I 7910a68028 add more details in demo page 2024-08-23 19:34:35 +10:00
Ziad-I d44ee9874b Bonsai web ui templates 2024-08-23 19:34:35 +10:00
Ziad-I 8cd86581ff handle operators from demo page 2024-08-23 19:34:35 +10:00
Ziad-I 0a5b6a41b0 add demo html/css/js 2024-08-23 19:34:35 +10:00
Ziad-I 7bac468151 add demo endpoint and event listener 2024-08-23 19:34:35 +10:00
Ziad-I b375579dcd add new webui demo panel in demo module 2024-08-23 19:34:35 +10:00
Dion Moult d3d1ca0169 Fix bug where select similar property didn't work 2024-08-23 15:29:19 +10:00
Dion Moult 2b0572af10 New feature to filter pset / qto quickly in the panel
Ever work regularly with models that have 30 or more properties per element?
2024-08-23 15:20:47 +10:00
Dion Moult ed6365b292 You can now filter spatial containers by name, long name, or class 2024-08-23 14:27:22 +10:00
Dion Moult e3b1e0773f Show grouping panel by default 2024-08-23 14:20:37 +10:00
Dion Moult 3d38068b90 Unindent project in spatial tree to save space 2024-08-23 14:20:32 +10:00
Dion Moult a4a2497f33 You can now filter and search in the spatial decomposition panel 2024-08-23 13:49:45 +10:00
Dion Moult 1ef2fb89af Show annotations and hide openings in spatial decomposition element filter 2024-08-23 13:48:19 +10:00
Bruno Perdigão 902d777574 Fix removing the dimension decorator in measure tool. 2024-08-22 17:44:48 -03:00
Bruno Perdigão 3bd0caade1 Fixed Polyline Wall after changes in Measure tool input 2024-08-22 16:11:22 -03:00
Bruno Perdigão 301cb4bbdc Small fix in TAB behavior for measure and polyline tool 2024-08-22 15:55:05 -03:00
Bruno Perdigão f0338ffdda Measure tools now shows decorator for the dimension of every line and the angles between them. Area calculation was removed and will be introduced in another operator 2024-08-22 15:54:11 -03:00
Dion Moult 2100528cbe Rebrand to Bonsai in IOS-Python docs 2024-08-23 00:12:11 +10:00
Dion Moult ae4f681f73 Remove superseded test 2024-08-22 23:58:15 +10:00
Dion Moult 53d7624fc4 Work in progress starting to restructure docs in preparation for next release 2024-08-22 23:56:59 +10:00
Andrej730 951b2b76a6 small fix for 94f5137684 2024-08-22 18:34:13 +05:00
Andrej730 e9b4b6560e drawing.create_camera not to assign camera to the scene collection
Noticed that added drawing camera was linked to the scene collection and after collector.assign it was linked to the 2 collections instead of just 1 - it's own drawing collection and the scene collection.
2024-08-22 18:34:13 +05:00
Andrej730 cabffdc549 fix tests after 4e48c35425 2024-08-22 18:33:21 +05:00
Andrej730 7ea60742d6 fix typo 2024-08-22 18:28:50 +05:00
Andrej730 358c834427 fix bim tests after 143e094
drawings and annotations that are part of some drawing don't need to be added to the spatial hierarchy
2024-08-22 18:28:50 +05:00
Andrej730 5d6655cbc7 fix issue adding drawing representation after ef04402ed8 2024-08-22 18:28:50 +05:00
Andrej730 4d122d77dc load_from_memory prop - add description 2024-08-22 17:20:48 +05:00
Dion Moult d4e863ed3b Replace BlenderBIM branding with Bonsai in docs 2024-08-22 21:02:19 +10:00
Dion Moult b6ccf505e7 Fix #5177. Refresh georeferencing viz data after data purged. 2024-08-22 20:18:13 +10:00
Dion Moult ce9842983b Fix #5037. Remove deprecated pie menu. 2024-08-22 19:59:55 +10:00
Dion Moult eb19b26a6e Revert xlsx feature, just csv for now
Don't want another dep
2024-08-22 17:24:43 +10:00
Dion Moult 06602d0e39 Download CSV/XLSX from web 2024-08-22 17:22:38 +10:00
Dion Moult 00279b63de Show sum of columns on web spreadsheet, really useful for qto 2024-08-22 17:22:29 +10:00
Dion Moult 6418353119 You can now filter headers in web spreadsheets 2024-08-22 17:22:09 +10:00
Dion Moult 3afbbe51d2 Make spreadsheets fullscreen
Spreadsheets from multiple sessions need to be redesigned to perhaps use tabs or split windows or something else
2024-08-22 17:21:48 +10:00
Dion Moult ddb767674b Fix bug where there would be missing data in web spreadsheets
See https://github.com/olifolkerd/tabulator/issues/3135
2024-08-22 15:37:04 +10:00
Bruno Perdigão 5575ea8296 Polyline and Measure tool now use right-click to confirm input 2024-08-21 23:01:06 -03:00
Bruno Perdigão e8a7a032aa Changed the order of the input panel for Polyline and Measure tool. Distance and Angle now come first. 2024-08-21 22:56:12 -03:00
Bruno Perdigão f23e419685 Fixed bug in Polyline and Measure tool. The input calculation was wrong when you had only one point in the polyline 2024-08-21 22:56:12 -03:00
Bruno Perdigão b87e8136af Raycast and Snap refactor. Snap now works with objects with no faces 2024-08-21 22:56:12 -03:00
Bruno Postle 473d0ae888 Remove Association op cleans blenderbim & bonsai
The remove *.ifc Association removes any stale Linux BlenderBIM
associations as well as Bonsai associations, this should now give a
clean upgrade path. Closes #5212
2024-08-21 21:11:11 +01:00
Andrej730 94f5137684 fix poll error messages addressing empty enum 2024-08-21 18:36:12 +05:00
Andrej730 4e75945435 add surface styles preview (based on their blender materials)
Example - https://i.imgur.com/jH9q7iF.png
2024-08-21 18:36:11 +05:00
Andrej730 e31019eb67 fix issue adding bcf topic viewpoints
missed the set statement which is requirement to make it work for all cases
2024-08-21 18:36:11 +05:00
Andrej730 c505630a20 fix error removing bcf topic comment 2024-08-21 18:36:11 +05:00
Andrej730 860fa81f73 bonsai bcf - activate comment's viewpoint
Example - https://imgur.com/a/iUMgpVm
2024-08-21 18:36:11 +05:00
Andrej730 847b5d226e bim.add_bcf_comment - poll message 2024-08-21 18:36:11 +05:00
Andrej730 ad77d09916 fix bug in bonsai bcf v3 api
it wasn't setting reference links / document references / labels if Topic container for them wasn't created before
2024-08-21 18:36:11 +05:00
Andrej730 9b12cae8b4 bcf bonsai - create bcf v3 projects and display loaded bcf version
Example - https://imgur.com/a/3ZSGtw7
2024-08-21 18:36:11 +05:00
Andrej730 84a8c5dfeb bim.convert_to_blender to ignore linked files 2024-08-21 18:36:11 +05:00
Andrej730 12a7b8a79e bim.convert_to_blender to avoid types without mesh properties 2024-08-21 18:36:11 +05:00
Andrej730 ef04402ed8 Fix Image empty interpreted as Mesh #5194
Apparently we can't trust `obj.data == None` to identify empties since in Blender there are empties that can use `bpy.types.Image` as their `obj.data`.
2024-08-21 18:36:10 +05:00
Andrej730 45fed747c2 fix failing test in model module
it was failing because type object was hidden in viewport and was unselectable
2024-08-21 18:36:10 +05:00
Dion Moult 85229fc865 Fix #5204. Bug where you could attempt to add IFC objects in edit mode which isn't allowed. 2024-08-21 22:22:46 +10:00
tim 916f854905 Update ifccsv.rst
BlenderBIM to Bonsai changes
2024-08-21 22:06:08 +10:00
tim 1915541d20 Update ifcconvert.rst
Changed BlenderBIM Add-on to Bonsai
2024-08-21 22:05:48 +10:00
tim e37b84a95a Update introduction.rst
Replaced BlenderBIM with Bonsai
2024-08-21 22:05:34 +10:00
tim bcb2a37ce0 Removed Linux defaults to not confuse mac users 2024-08-21 22:05:14 +10:00
tim 018d6847a0 Update blenderbim.rst
replaced BlenderBim text with Bonsai
2024-08-21 22:04:44 +10:00
Dion Moult 35918265d0 Fix bug on Linux where INBETWEEN_MOUSEMOVE is fired for measure tool 2024-08-21 21:47:41 +10:00
Dion Moult 4e48c35425 Remove old dumb stair, superseded by new clever stair (now just called stair) 2024-08-21 21:19:27 +10:00
Dion Moult d985fe9240 Fix #5205. Regression in creating walls / slabs / profiles / products with potentially no default container. 2024-08-21 21:09:29 +10:00
Dion Moult 7c00021aaa You can now toggle flat shading when showing colourschemes 2024-08-21 20:55:35 +10:00
Andrej730 d2dc8b519f fix for ef835e43b8 2024-08-21 15:14:15 +05:00
Andrej730 25fe025354 bonsai file association files #5212 2024-08-21 15:13:59 +05:00
Andrej730 1aae710286 Restore file association files removed by accident #5212 2024-08-21 15:13:59 +05:00
Andrej730 38e8130793 stop ignoring src/bonsai/bonsai/libs
After #4373 with new folder structure 'libs' is no longer used to store dependencies and there is no need to ignore it.
2024-08-21 15:13:58 +05:00
Dion Moult 7e94388074 You can select a colourscheme key via search / dropdown now rather than typing a query 2024-08-21 18:50:55 +10:00
Andrej730 ef835e43b8 bim.save_uv_to_style - support saving uv to objects without a style
There was a problem with assigning uv workflow if object wasn't originally from IFC - saving uv requires object to have IfcSurfaceStyle but assigning IfcSurfaceStyle would reload representation discarding UV.

So, the current workflow for saving non-ifc objects uv to ifc:
1) Assign class to ifc object
2) Create IfcSurfaceStyle with a texture (currently also requires a rendering style)
3) Use "Save UV To Style"

Example - https://imgur.com/a/GZqo38M
2024-08-21 12:33:25 +05:00
Andrej730 e5d0eb13bf Show in UI if representation item has UV mapping / colour map
Example - https://i.imgur.com/bWV4dRj.png
2024-08-21 12:33:25 +05:00
Andrej730 4fcf23319f Show in UI an operator for saving UV
It was lost when we deprecated style UI in materials tab.
Button location - https://i.imgur.com/V57MKU2.png

Also added some minor tweaks.
2024-08-21 12:33:25 +05:00
Dion Moult 99154afdb1 You can now specify custom min/max for quantitative legends 2024-08-21 16:34:10 +10:00
Dion Moult e83eb68fe1 Add seaborn colour palletes for tab10, paired, rocket, mako, spectral, and coolwarm
This covers three usecases: qualitative, quantitative min->max, and quantitative middle with low/high
2024-08-21 15:27:21 +10:00
Dion Moult e4a4a33920 Add support for colouring by quantitative colour legend, not just qualitative categories 2024-08-21 14:02:41 +10:00
Dion Moult e8848c9701 Natsort is now a dependency. We'll be using it to do better sorting everywhere. 2024-08-21 14:01:32 +10:00
Bruno Perdigão cfd8044cb3 Fixed bug related to pressing shift for plane selection 2024-08-20 17:47:02 -03:00
Bruno Perdigão 2d7866570e Fixed bug for x, y, z calculation 2024-08-20 17:47:02 -03:00
Bruno Perdigão eb0ed7fe6b Fixed bugs related to shift and added Z as input option 2024-08-20 17:47:02 -03:00
Bruno Perdigão 67733c4449 Improved calculation for coordinates from distance and angle 2024-08-20 17:47:02 -03:00
Bruno Perdigão b3940cdc45 Minor refactor and clean up 2024-08-20 17:47:02 -03:00
Bruno Perdigão 94e75aebb0 Added area calculation to the input panel 2024-08-20 17:47:02 -03:00
Bruno Perdigão ff203b2a13 Changed decorator name to PolylineDecorator 2024-08-20 17:47:02 -03:00
Bruno Perdigão 10616df494 black format 2024-08-20 17:47:02 -03:00
Bruno Perdigão 1dc6d4935e Polyline tool: improved plane selection method and decorators 2024-08-20 17:47:02 -03:00
Bruno Perdigão 04088af2b6 small fix 2024-08-20 17:47:02 -03:00
Bruno Perdigão c477173096 Improved plane selection for Measure tool 2024-08-20 17:47:02 -03:00
Bruno Perdigão 2f4093f958 Fixed decorator for mixed snaping 2024-08-20 17:47:02 -03:00
Bruno Perdigão 95fc51da76 Created function to mix snap point with axis lock in polyline tool 2024-08-20 17:47:02 -03:00
Bruno Perdigão 50e629c02c Removed code after refactor 2024-08-20 17:47:02 -03:00
Bruno Perdigão 4a178fca58 Fixed error in polyline tool, when two points where add at the same location sequentially 2024-08-20 17:47:02 -03:00
Bruno Perdigão aff5b238d9 WIP: Added possibility to change plane intersection method 2024-08-20 17:47:02 -03:00
Bruno Perdigão 315b6060b0 WIP: Changed coordinates, distance and angles calculations to allow for 3d vectors 2024-08-20 17:47:02 -03:00
Bruno Perdigão b137197586 Changed input validantion to Snap tool 2024-08-20 17:47:02 -03:00
Bruno Perdigão d1d9db3ed8 WIP: started refactoring to develop the measure tool with most of the logic from polyline wall 2024-08-20 17:47:02 -03:00
Andrej730 736b50c6fa bonsai bcf - fix issue when viewpoints were not reloaded
when new bcf file was loaded
2024-08-20 18:39:09 +05:00
Andrej730 64b96633c2 bonsai bcf v3 - support working with viewpoints #2790
Also fixed a bug when removing viewpoint always removed the last viewpoint
2024-08-20 18:39:09 +05:00
Andrej730 8eae997053 bcf v3, bonsai bcf v3 - support extracting files #2790
extracting files in general is also improved - now it's possible to extract a file that was just added to bcf in memory and not yet saved to the disk.

Update model.py
2024-08-20 18:39:09 +05:00
Andrej730 fee56fc120 bonsai bcf - remove "bim.edit_bcf_author"
bcfxml doesn't actually have "author" field - this field is not stored in bcf, it's just needed as an UI for author for newly added comments and topics.
2024-08-20 18:39:09 +05:00
Andrej730 d1f87d5467 fix bug in 71ddc6384a 2024-08-20 18:39:09 +05:00
Andrej730 7539404c27 bcf v3 & bonsai bcf v3 - support adding/removing header files #2790
Also removed unnecessary read in AddBcfDocumentReference.
2024-08-20 18:39:08 +05:00
Andrej730 71ddc6384a bonsai bcf v3 - support adding/removing related topics #2790
Not entirely sure about TopicHandler.guid typing, just made it consistent with v2 for now.
2024-08-19 18:44:33 +05:00
Andrej730 4b402f8ea5 bonsai bcf - dropdown for related topics
Previously you had to type in exactly manually.
Besides the dropdown it should also show now a topic description in the dropdown items tooltips.
Removed "bim.add_bcf_related_topic" poll as it should be now covered by the enum.

Example - https://imgur.com/a/xhgcGWI
2024-08-19 18:44:33 +05:00
Andrej730 c39fa80e09 bonsai bcf v3 - support working with topics #2790 2024-08-19 18:44:33 +05:00
Andrej730 c89ad8c7da related topic - poll message set 2024-08-19 18:44:33 +05:00
Andrej730 6dfe46d9bd bonsai bcf - add default project for bcf v3, fix small possible issue with bcf v2
In theory in bcf v2 there could be a project with project info but without project.
2024-08-19 18:44:33 +05:00
Andrej730 1de51ecf77 bonsai bcf - fix bim snippet ui issue
schema is optional field in bcf v2 and it was unreliable to use it to detect whether bim snippet is present or not
2024-08-19 18:44:33 +05:00
Andrej730 8a55f18c95 bonsai bcf - poll message for adding bim snippet 2024-08-19 18:44:32 +05:00
Andrej730 7a1976cfc1 bonsai bcf - show info message when project is saved/loaded
to make ui more responsive
2024-08-19 18:44:32 +05:00
Andrej730 78c6401453 bonsai bcf v3 - support working with bim snippets 2024-08-19 18:44:32 +05:00
Andrej730 e12838d93e bonsai bcf v3 - support working with comments #2790 2024-08-19 18:44:32 +05:00
Andrej730 7aa5b71a6a bcf - comments setter api 2024-08-19 18:44:32 +05:00
Andrej730 2ef3af5e1b bonsai bcf - make document reference uneditable
as this data is not really editable and won't be saved
2024-08-19 18:44:32 +05:00
Andrej730 d399f7c6b7 bonsai bcf - add save current project button
Now there are two separate buttons - "save project" and "save project as".
Example - https://i.imgur.com/1vuVfgi.png
2024-08-19 18:44:32 +05:00
Andrej730 beb7f75368 bonsai - bcf v3 document references #2790 2024-08-19 18:44:32 +05:00
Andrej730 dc6fdc2a98 typing 2024-08-19 12:26:49 +05:00
Thomas Krijnen 45be17c25a Remove duplicate UseMaterialNames setting binding #5191 2024-08-19 09:15:49 +02:00
Dion Moult 4f11b19b3d Update install instructions for Bonsai 2024-08-18 22:22:21 +10:00
Ryan Schultz f646cf4372 Removes the style from all selected objects 2024-08-17 13:36:10 -05:00
Ziad-I 538859f60a make has_started check for both pid and port
this solves the issue when a user has not killed a previous server so the port of that server wasn't removed from the pid file, which would make has_started return true even if server hasn't started yet.
2024-08-16 20:52:39 +10:00
Ziad-I 75da994faf fix gantt display when there are no dependencies 2024-08-16 20:52:39 +10:00
Ziad-I 99827df89a fix setting color-scheme css property 2024-08-16 20:52:39 +10:00
Ziad-I 054a900779 edit names of pages and paths for them 2024-08-16 20:52:39 +10:00
Ziad-I e800f8b93d docstrings and formating 2024-08-16 20:52:39 +10:00
Ziad-I 7163697362 add open different web UI pages on starting it up 2024-08-16 20:52:39 +10:00
Ziad-I 29600711ae make webui default for work schedules and simplfy condition 2024-08-16 20:52:39 +10:00
Ziad-I 1d0ee61ba7 fix dependency display bug
dependency was not being displayed correctly due to calling draw on Gantt before appending it to the DOM, I think?
2024-08-16 20:52:39 +10:00
Ziad-I fb909ace1a edit condition if user tries to export to web with no server
previously it was just checking if there was a server running but not if blender was connected to a server, this was being handled in the operator itself which isn't the best.
2024-08-16 20:52:39 +10:00
Ziad-I 6ae5dbacf4 make web default format when exporting 2024-08-16 20:52:39 +10:00
Ziad-I 52bffa7f9c handle edge case not covered by last commit 2024-08-16 20:52:39 +10:00
Ziad-I e9a502ccec fix error when exporting an empty csv 2024-08-16 20:52:39 +10:00
Ziad-I f3d4eed19e split addGanttElement function into smaller functions
for code organization and readability
2024-08-16 20:52:39 +10:00
Ziad-I d260298ab2 fix printing when there is multiple gantt charts 2024-08-16 20:52:39 +10:00
Ziad-I c7d0cff300 edit or commented left over console.log 2024-08-16 20:52:39 +10:00
Ziad-I 631deeb094 fix connected list appearing in printing 2024-08-16 20:52:39 +10:00
Ziad-I 953a49f9ae add different bg color for work schedule table rows 2024-08-16 20:52:39 +10:00
Ziad-I 2e94a7c3f1 move outdated gantt warning into connected list 2024-08-16 20:52:39 +10:00
Ziad-I 68f10e1502 move outdated data warning into connected list for csv page 2024-08-16 20:52:39 +10:00
Ziad-I 625a57c6de change used text color for warnings 2024-08-16 20:52:39 +10:00
Andrej730 4348b9bff9 bonsai - bcf v3 referenced links support #2790 2024-08-15 18:18:11 +05:00
Andrej730 28ee1a7781 bonsai - dropdown for new bcf topic labels (same as f1db51df1a) 2024-08-15 18:18:11 +05:00
Andrej730 d40119d617 bonsai - more bcf v3 support and lots of todos #2790 2024-08-15 18:18:11 +05:00
Andrej730 774533911c bonsai - fix issues loading bcf v3 #2790 2024-08-15 18:18:10 +05:00
Andrej730 7597b1b29c bonsai, ifcopenshell - append IfcSurfaceStyles from other projects
And other IfcPresentationStyles, though they are not currently supported by bonsai.

Example - https://imgur.com/a/AHlvowp
2024-08-15 18:18:05 +05:00
Andrej730 bd8a2736d4 typing 2024-08-15 18:18:05 +05:00
Andrej730 aafb4b6147 fix missing import in 2066ebcc11 2024-08-14 19:54:45 +05:00
Andrej730 2066ebcc11 bbim, bcf - add simple operator to quickly load ifc file from bcf header
Example - https://imgur.com/a/rieFwNI
2024-08-14 18:44:53 +05:00
Andrej730 795ebc0ac1 remove uninstall/update instructions from preferences
Since 06c8a9e there's no longer issue with loaded binaries preventing to reload the addon on Windows, which works for 4.2.0 and in 4.2.1 we'll have https://projects.blender.org/blender/blender/issues/125049 which essentially does the same, moves the binaries out of the way.

Upgrade also works fine and we have a warning from 3d4c85c to indicate that user should restart Blender after upgrade.
2024-08-14 17:16:25 +05:00
Andrej730 7612cf92c0 remove donate button from bonsai preferences #4373
As per Blender request, see https://extensions.blender.org/approval-queue/bonsai/#activity-2480
2024-08-14 17:03:43 +05:00
Andrej730 db1f4d126a bonsai web module #5178
Ping @Ziad-I just in case
2024-08-14 16:49:34 +05:00
Andrej730 b15820dd10 bonsai libs/desktop #5178 2024-08-14 16:49:34 +05:00
Andrej730 f8f7884278 bonsai other scripts #5178 2024-08-14 16:49:34 +05:00
Andrej730 3318de7f6d bonsai main extension files #5178 2024-08-14 16:49:34 +05:00
Andrej730 726bf40d58 bonsai core module imports #5178 2024-08-14 16:49:34 +05:00
Andrej730 3860884db3 bonsai other ifcopenshell packages #5178 2024-08-14 16:49:34 +05:00
Andrej730 5784e3103d bonsai assets #5178 2024-08-14 16:49:34 +05:00
Andrej730 2a1d1d6e10 bonsaibim urls #5178 2024-08-14 16:49:34 +05:00
Andrej730 485643863f bonsai bim module imports #5178 2024-08-14 16:49:34 +05:00
Andrej730 c03777cfe6 bonsai tool module imports #5178 2024-08-14 16:49:34 +05:00
Andrej730 be442ff1be bonsai copyrights #5178 2024-08-14 16:49:34 +05:00
Andrej730 95e7910f69 bonsai .gitignore #5178 2024-08-14 16:49:34 +05:00
Andrej730 d5592ed2eb fix ifc4d copyright license 2024-08-14 16:49:34 +05:00
Andrej730 a29806ef9e bonsai dev_environment scripts #5178 2024-08-14 16:49:34 +05:00
Andrej730 3a9d79dcd3 bonsai makefile #5178 2024-08-14 16:49:34 +05:00
Andrej730 b9c2e312e3 black format 2024-08-14 16:49:34 +05:00
Andrej730 f1db51df1a blenderbim, bcf - add tooltips for topic attributes based on extensions
Example - https://imgur.com/a/mYiXqXn
2024-08-13 18:53:11 +05:00
Andrej730 312a58ddce bcf - readme note about code structure 2024-08-13 18:53:11 +05:00
Andrej730 1e71708aba bcf v2 - extensions support #3220
The api is the same as for bcf v3 though for bcf v2 they are currently available only in read-only mode.
2024-08-13 18:53:11 +05:00
Andrej730 ad6e00571e bcf v3 - add extensions tests 2024-08-13 18:53:11 +05:00
Dion Moult c8d05951b0 Rename choco dir 2024-08-13 23:47:26 +10:00
Dion Moult 0f8c3b3c83 Name change in workflows dir 2024-08-13 23:21:30 +10:00
Dion Moult 25071dfec6 Rename source dir 2024-08-13 23:09:50 +10:00
Dion Moult cc28f5a92b Search replace in test dir 2024-08-13 15:47:27 +10:00
Dion Moult a57a7041ac Search replace BlenderBIM with Bonsai 2024-08-13 15:45:33 +10:00
Dion Moult 17b90c3241 Search replace BlenderBIM Add-on with Bonsai 2024-08-13 15:40:54 +10:00
Dion Moult 90089f91c6 Minor fix 2024-08-13 15:28:03 +10:00
Dion Moult 37dd2a5607 G'day Bonsai! 2024-08-13 13:38:10 +10:00
Bruno Perdigão bc70130123 Polyline wall - you now can press 'C' to close the polyline 2024-08-12 16:01:25 -03:00
Bruno Perdigão 8d53141d5a Fix polyline wall generator for open polylines 2024-08-12 15:53:42 -03:00
Bruno Perdigão 0ffc62fbf3 lowered the threshold for the polyline snap to axis 2024-08-12 15:39:38 -03:00
Bruno Perdigão 4350e3df82 added shadow to polyline input panel text 2024-08-12 15:38:27 -03:00
Andrej730 2ad601ed34 bcf - fix make models after 237cd99 2024-08-12 18:04:45 +05:00
Andrej730 f9e8d6d478 bcf - fix issues with unexpected reloads from zip
It wasn't considering that self._topics could be an empty dict because there are no topics and it would also reload it. Now we have None value to distinguish when it actually wasn't loaded before.

Same for viewpoints, reference files and document references.

I've also imade mplementations identical/more similar between v2 and v3.
2024-08-12 17:31:52 +05:00
Andrej730 65cc5bf4c1 bbim bcf - fix issues setting visibility exceptions
1) bpy.ops.object.hide_view_set doesn't actually work with context provided selected objects - it's checking whether they're actually selected
2) bpy.ops.object.hide_view_clear wasn't using select=False, selecting revealed objects which might get in the way later.
3) used new api for getting visibility settings
2024-08-12 16:29:10 +05:00
Andrej730 73e5985777 bcf + bbim - set/get selected/visible elements #4857
1) added more high level api for getting/setting selected/visible elements in bcf
2) in bbim when you add a new viewpoint it will remember currently selected and visible objects:
https://imgur.com/a/2pZ79Z2
2024-08-12 16:29:10 +05:00
Andrej730 de14e92720 poll message 2024-08-12 16:29:10 +05:00
Andrej730 09ad47d11b remove debug prints 2024-08-12 16:29:10 +05:00
Andrej730 debe63c1af fix typo 2024-08-12 16:29:10 +05:00
Andrej730 6f2eb6c54a typing 2024-08-12 16:29:10 +05:00
Andrej730 56ca431965 bbim - load bcf files using drag'n'drop
Example - https://imgur.com/a/aK62slh
2024-08-12 16:29:10 +05:00
Andrej730 74e8b80fb4 bbim, bcf - expose topic attributes to edit from bbim #3026
Previously they weren't editable if they were not defined in .bcf already, so previously it was kind of requiring them to be defined by some other software, not BBIM.

Also changed couple prop names to make them more clear to users.
2024-08-12 16:25:41 +05:00
Andrej730 7ecfe372ad fix #5175 after 1626dd8 2024-08-12 15:19:02 +05:00
Andrej730 b017ab7596 black format after #5172 2024-08-12 15:19:01 +05:00
Junzhe Ren bd3905fe76 Update supported VS version installation.rst (#5174)
* Update installation.rst

2022 is now supported by dependency CMake

* Update installation.rst

Updates on Compiling on Windows (Visual Studio)
2024-08-12 15:17:08 +05:00
Bruno Perdigão 0c8048c14d Walls from polyline are now joined when generated 2024-08-11 21:57:16 -03:00
Bruno Perdigão 77f72ecdfa renamed the tools to Snap and Raycast 2024-08-11 21:57:16 -03:00
Bruno Perdigão 723701f1b8 Points are now added relative to default container Z value. 2024-08-11 21:57:16 -03:00
Bruno Perdigão bf96c63f7d moved raycasting functions to Raycasting module 2024-08-11 21:57:16 -03:00
Bruno Perdigão cef8251458 minor refactors 2024-08-11 21:57:16 -03:00
Bruno Perdigão 547981f32c Temporary solution for wall generation with polyline 2024-08-11 21:57:16 -03:00
Bruno Perdigão a3cc0245ca Started a system to lock on axis 2024-08-11 21:57:16 -03:00
Bruno Perdigão 5d934a2baa Improvements on how it handles the numbers input 2024-08-11 21:57:16 -03:00
Bruno Perdigão 4409a35441 small fix related to polyline decorator 2024-08-11 21:57:16 -03:00
Bruno Perdigão f637ef8016 black format 2024-08-11 21:57:16 -03:00
Bruno Perdigão 5e2cefee12 small change on input from keyboard 2024-08-11 21:57:16 -03:00
Bruno Perdigão 67b01dcd0f black format 2024-08-11 21:57:16 -03:00
Bruno Perdigão bc0efd7389 Added snaping to polyline points 2024-08-11 21:57:16 -03:00
Bruno Perdigão 4b4e6fa7e2 adds decorator to angle snap axis 2024-08-11 21:57:16 -03:00
Bruno Perdigão 17a0face6e Now the mouse snaps in angle axis in 30 degree intervals 2024-08-11 21:57:16 -03:00
Bruno Perdigão a3b2860789 added highlight color to the input panel 2024-08-11 21:57:16 -03:00
Bruno Perdigão f8f22257b4 fixed backspace for number input 2024-08-11 21:57:16 -03:00
Bruno Perdigão 8284ed0cdb Fix to allow calculations to work when no point was added yet 2024-08-11 21:57:16 -03:00
Bruno Perdigão d995e010cf WIP: calculates x and y based on distance and angle. Accepts negative input 2024-08-11 21:57:16 -03:00
Bruno Perdigão fcfc070825 WIP: Input panel receives x and y inputs from the keyboard 2024-08-11 21:57:16 -03:00
Bruno Perdigão 55552770a6 Input panel now shows coordinates, distance and angle 2024-08-11 21:57:16 -03:00
Bruno Perdigão 350df4eee5 WIP: Started the input system 2024-08-11 21:57:16 -03:00
Bruno Perdigão 04a273c720 Fixed problem with event type by using event value 2024-08-11 21:57:16 -03:00
Bruno Perdigão 61641acf56 Added 'Backspace' event to remove last polyline point 2024-08-11 21:57:16 -03:00
Bruno Perdigão 10035662dd Basic polyline implementation 2024-08-11 21:57:16 -03:00
Bruno Perdigão 056df7758b Improved performance. Objects are first select by their 2d bounding box related to the view. Then, just the objects close to the mouse use ray cast. 2024-08-11 21:57:16 -03:00
Bruno Perdigão 0522adac63 Added simple snap decorator 2024-08-11 21:57:16 -03:00
Bruno Perdigão 1f781e5cab added mouse offset for raycast 2024-08-11 21:57:16 -03:00
Bruno Perdigão a30fd7cab4 enabled snaping to ground plane 2024-08-11 21:57:16 -03:00
Bruno Perdigão 94ca2423e9 First implementation. Two types of raycast and basic snaping for faces,
edges and edge center.
2024-08-11 21:57:16 -03:00
Ryan Schultz 2938c1fd0b small tweak to the previous commits 2024-08-11 18:32:07 -05:00
Ryan Schultz ab8710bd1e schedule's background fill driven by .ods/xlsx, if it exists.
also added `.border` class to default schedule css.
2024-08-11 12:14:55 -05:00
Ryan Schultz a791abe23e fixes #4780: added preference for default location for schedule's css.
Also added a `border` class to style the schedule's border with css.  That is `fill`, `stroke-width`, and `stroke` are no longer hard-coded.
2024-08-11 11:53:58 -05:00
Chirag Singh e70122f354 Ran Black Formatting 2024-08-11 10:40:10 +10:00
Chirag Singh 96fdced471 1. Added a Json File having SpectralDB Materials. 2. Implemented UIList: Lists down the materials to be mapped with. 3. By default Not mapped material is white. 4. Added a Drop down for category and Subcategory from where the user can select the material from spectralDB 5. Corrected hardcoded render123.hdr as highlighted by Manu in #5033 2024-08-11 10:40:10 +10:00
Andrej730 1c95f6cc3f bcf - remove lru_cache in build_viewpoint #4857
disabling it as it currently won't allows users to create a different viewpoint for the same IFC element (in the same or other bcf file) and also entity position can change between `build_viewpoint` calls
2024-08-09 19:00:10 +05:00
Andrej730 0f03e412c3 bcf - port 3c17718 to v3
According to docs bcf is using meters as their length unit - https://github.com/BuildingSMART/BCF-XML/tree/release_3_0/Documentation

We should create some kind of common code folder to keep this sane...
2024-08-09 19:00:10 +05:00
Thomas Krijnen 6ca3e2a6db Attempt fix #5168 - Update release.yml 2024-08-09 15:54:41 +02:00
Thomas Krijnen 079446a4b6 Attempt fix #5168 - Update Dockerfile 2024-08-09 15:54:32 +02:00
Andrej730 e706e568bd bcf - option to provide snapshot filename + save warnings #4453
Example warning:
WARNING. Snapshot with viewpoint guid '6aff8c6e-216c-48c9-8120-3101816def3e' won't be saved to bcf. Only snapshot data (VisualizationInfoHandler.snapshot) is provided and snapshot filename (ViewPoint.snapshot) is missing.
2024-08-09 16:42:33 +05:00
Andrej730 526a2a6a80 bcf - return added viewpoint in add_visinfo_handler #4453 2024-08-09 16:42:33 +05:00
Andrej730 3e7a2c1b83 bcf - fix inconsistent return types in add_viewpoint #4887 2024-08-09 15:12:41 +05:00
Andrej730 9bb04d3ffc small fix for bcf docs
bcfxml.get_topic actually returns topichandler, not topic
2024-08-09 14:58:10 +05:00
Andrej730 7c4d45ab32 ci - fix ifcdiff dependencies 2024-08-09 14:29:38 +05:00
Andrej730 dafec70097 black format 2024-08-08 18:13:31 +05:00
Andrej730 eca1d47d06 typing 2024-08-08 18:12:45 +05:00
Andrej730 9671be1734 add a couple poll messages 2024-08-08 18:11:00 +05:00
Andrej730 644f32d11c Fix errors appending assets when projects are using georeferencing #5110 2024-08-08 18:11:00 +05:00
Andrej730 1626dd85f4 fix opening recent project showing file browser 2024-08-08 15:43:19 +05:00
Andrej730 3c0103b4da fix issues toggling EDIT mode
1) it was throwing errors if object was linked

2) bim.override_mode_set_edit wasn't considering that toggle_edit_mode might not work out and was changing BIMGeometryProperties.mode though it wasn't needed.
2024-08-08 15:12:57 +05:00
Dion Moult f9c4b6a98f Improve QTO of segment lengths
Previous method uses bounding box which could be wrong if the app (Revit) doesn't extrude in +Z and has a slope (e.g. most pipes). Also Revit tends to use rectangle profiles not for the cross section, but instead for the footprint which is crazy.
2024-08-08 15:13:34 +10:00
Dion Moult b01e93161e Use vertex buffer for more efficient centroids 2024-08-08 08:24:12 +10:00
Andrej730 ffbd3e50c5 typing 2024-08-07 20:27:21 +05:00
Andrej730 98c4a1d110 ifcdiff - add simple tests 2024-08-07 17:33:10 +05:00
Andrej730 e2c4bcb217 blenderbim - hide json output file and some operators if current ifc file is not used
It was misleading since those operators only worked with the current model and had no effect if it wasn't used in ifcdiff.
2024-08-07 17:33:10 +05:00
Andrej730 7e60b6888e ifcopenshell v0.8 fixes #5156 #4832 2024-08-07 17:33:10 +05:00
ArturTomczak bbf8ebcb52 add user-agent header to bSDD calls
As explained in: https://github.com/buildingSMART/bSDD/blob/master/Documentation/bSDD%20API.md#http-header-x-user-agent
2024-08-07 21:12:49 +10:00
Tim c1936b871e Renamed tools #3527 2024-08-07 21:12:29 +10:00
Ziad-I 31d67b5e62 fix bootstrap css conflict by adding dummy class in navbar a tags 2024-08-07 21:11:44 +10:00
Ziad-I 683e168ca1 add border radius to all pages 2024-08-07 21:11:44 +10:00
Ziad-I cbc0b4837f add icons to navbar and make it smaller 2024-08-07 21:11:44 +10:00
Ziad-I 02ff6c00ef add button colors 2024-08-07 21:11:44 +10:00
Ziad-I 78f664e892 fix CSS inconsistency and small errors 2024-08-07 21:11:44 +10:00
Ziad-I d745265048 fix footer for drawings page 2024-08-07 21:11:44 +10:00
Ziad-I 917991feab only ask for updates from specific blender using blender ID 2024-08-07 21:11:44 +10:00
Ziad-I 4877ab4426 add updating and removing of drawings/sheets 2024-08-07 21:11:44 +10:00
Ziad-I 48c5100d3b add blender generated theme for drawings page 2024-08-07 21:11:44 +10:00
Ziad-I 72caf7525e fix highlighting for better visibility 2024-08-07 21:11:44 +10:00
Ziad-I 242d91bc17 small css change 2024-08-07 21:11:44 +10:00
Ziad-I afb22ce7d5 add blender generated theme to gantt page
and some small edits in extracted colors and index page
2024-08-07 21:11:44 +10:00
Ziad-I e45a670ff5 add csv page uses blender theme css variables 2024-08-07 21:11:44 +10:00
Ziad-I 45042aa5e0 index.css uses blender css variables if they are defined 2024-08-07 21:11:44 +10:00
Ziad-I 07aec0730f update title in all pages 2024-08-07 21:11:44 +10:00
Ziad-I 7e6da3edb3 add mix colors function as blender mixes two colors...
blender mixes two colors to get the panel background final color :)
2024-08-07 21:11:44 +10:00
Ziad-I 4f0eafa92d fix blender css variables names 2024-08-07 21:11:44 +10:00
Ziad-I de75eded09 add theme_data listeners in web ui 2024-08-07 21:11:44 +10:00
Ziad-I f2b4bea4de add getting and sending theme data from blender 2024-08-07 21:11:44 +10:00
Ziad-I 4f28b2506d add theme data listeners in sioserver 2024-08-07 21:11:44 +10:00
Ziad-I 281da8ed77 add docstring to has_started and indentation edits 2024-08-07 21:11:44 +10:00
Ziad-I bdf4258895 add footer to drawings page 2024-08-07 21:11:44 +10:00
Ziad-I 385d9b9df7 connected clients list now works correctly with all pages 2024-08-07 21:11:44 +10:00
Ziad-I 0e40df4fa3 now correctly gets drawings and sheets data to send to web ui 2024-08-07 21:11:44 +10:00
Ziad-I b0c132f73a fix when sending csv or gantt data it is saved in the WebData
due to load not always being called as sometimes WebData is loaded before
2024-08-07 21:11:44 +10:00
Dion Moult 4fd802bf3d More efficient shape bbox and average vertex centroid function 2024-08-07 17:21:49 +10:00
Andrej730 e461040e17 bim.pip_install - fix for Blender 4.2 2024-08-06 18:22:35 +05:00
Andrej730 43b574011e fix choco releases 2024-08-06 17:14:43 +05:00
Andrej730 9bae914b51 ci-blenderbim-choco - rename for consistency, add workflow_dispatch
workflow_dispatch allows running workflow manually if needed
2024-08-06 16:52:30 +05:00
Andrej730 945070bdff blenderbim daily releases - add a note about autoupdates 2024-08-06 15:13:50 +05:00
Andrej730 d2b4afe1be blenderbim tests github action 2024-08-06 15:09:47 +05:00
Andrej730 3760f8fafe setup daily builds extensions repo 2024-08-06 15:09:47 +05:00
Andrej730 b9e5cefddf Another fix for #5134 2024-08-06 10:56:36 +05:00
Andrej730 9f5f757ccf Fix #5134 2024-08-05 18:33:03 +05:00
Andrej730 3a147d7f62 Remove Python 3.10 build from bbim builds
Reverts 8514a42, removes python 3.10 from bbim builds as it's not suppored by Blender 4.2+ (https://github.com/gentoo/gentoo/pull/37671)
2024-08-05 16:37:16 +05:00
Andrej730 9f1d14e5a7 black format 2024-08-05 13:59:33 +05:00
Dion Moult bce71f3797 See #5087. See #5114. Skip trying to test shapes that obviously don't have a representation to prevent false positives 2024-08-05 14:18:54 +10:00
Bruno Postle 253dca730d Fix misplaced section/elevation symbols
Looks like a simple typo, closes #5131
2024-08-04 17:30:30 +01:00
Ryan Schultz e0f33a56ec shift+click, to quickly switch the drawing view without turning anything on or off in the scene. as discussed: https://community.osarch.org/discussion/2196/quick-way-to-switch-between-drawing-views#latest
shift+click, to quickly switch the drawing view without turning anything on or off in the scene.
as discussed: https://community.osarch.org/discussion/2196/quick-way-to-switch-between-drawing-views#latest
2024-08-04 10:02:31 -05:00
Dion Moult 2287931e9c Rewrite georeference tests actually test UI effects 2024-08-04 21:23:02 +10:00
Dion Moult 1f7a498606 Fix #4958. Add UI spy class in feature tests to allow more natural BDD tests 2024-08-04 21:23:02 +10:00
Ryan Schultz a9e366b238 Assure text 'wraps' in CloseError 2024-08-03 14:30:06 -05:00
Ryan Schultz 1ca0dfb1e0 Make sure drawings are loaded when calling bim.activate_drawing from sheets UI.
related: c11ba23a3d
2024-08-03 14:09:15 -05:00
Ryan Schultz c11ba23a3d Fix #3728 - Be able to bim.activate_drawing a drawing listed in the sheets UI, as well. 2024-08-03 11:01:31 -05:00
Dion Moult 556c769b40 Sun position add-on is now detected in the current session instead of needing to restart Blender 2024-08-03 23:21:31 +10:00
Dion Moult 78173dd546 Add basic tests for new web module 2024-08-03 23:12:21 +10:00
Dion Moult 2196c16097 Fix failing georeference and spatial core/tool/bim tests and clean dead code 2024-08-03 23:08:35 +10:00
Dion Moult 7af5db7cd4 Collector now unassigns from old ifc collections 2024-08-03 22:04:38 +10:00
Dion Moult c58672cc25 Allow selecting a container object when changing spatial container 2024-08-03 19:29:06 +10:00
Dion Moult 85e022d76e IfcTester now groups results by types to make long failure lists more useful 2024-08-02 23:58:01 +10:00
Andrej730 872f40933f remove Python 3.9 from bbim makefile since a31051a93 2024-08-02 18:54:37 +05:00
Andrej730 4491018f5e fix tool surveyor test 2024-08-02 18:54:37 +05:00
Andrej730 a21c440b5b fix tool geometry tests 2024-08-02 18:54:37 +05:00
Andrej730 143e094db8 assign default container on assigning IfcAnnotation class
Currently if you create a IfcAnnotation it might just get lost as it's not assigned anywhere. Also noticed this since previously we allowed using bim.add_reference_image without any specific drawings.
2024-08-02 18:54:37 +05:00
Andrej730 94e9e945d7 fix system/qto tool tests after e6ac012 2024-08-02 18:54:36 +05:00
Andrej730 5e56115050 typing 2024-08-02 18:54:36 +05:00
Andrej730 1ad654aab3 Fix Ifc tool tests after #4843 and unlinking changes 2024-08-02 18:54:36 +05:00
Andrej730 596ffb093b dev environment script - keep it possible to run the script without any changes
by default it assumes it's executed from ifcopenshell repo directory
2024-08-02 18:54:36 +05:00
Andrej730 3576362fd8 blenderbim make test - run all tests but return error code at the end 2024-08-02 18:11:25 +05:00
Andrej730 2c949bb39a blenderbim "make test" - run tool and bim tests even if some core tests failed 2024-08-02 17:20:29 +05:00
Andrej730 34faa0617b fix running core tests on python 3.10 2024-08-02 17:05:28 +05:00
Dion Moult 15f6b3803f Fix #4986. IfcTester now determines whether a spec is relevant to the ifc version 2024-08-02 22:02:56 +10:00
Andrej730 8514a426bb fix potential blenderbim issues for python 3.10
tomllib was added to python 3.11, tomli can be used for the previous versions.

Though it is a bit questionable since internally Blender is using just tomllib and because of that I'm not sure anymore if Blender still supports Python 3.10.
2024-08-02 16:00:49 +05:00
Andrej730 2062324294 prevent issues importing blenderbim for core test
initialize_bbim_semver was possible breaking on running core tests if system python was missing tomllib
2024-08-02 16:00:49 +05:00
Dion Moult 90c6218210 Fix #5115. Members (e.g. stringers) can now have a stair modifier applied as they may be used to support stairs 2024-08-02 16:34:30 +10:00
Dion Moult 321bb7178d See #5110. Minor fix when appending linked elements. 2024-08-02 16:29:14 +10:00
Dion Moult 42dda0a07a Run black on light 2024-08-02 16:00:45 +10:00
Dion Moult adb17d91f9 Dedicated doc section for blend open/save issue 2024-08-02 15:57:17 +10:00
Dion Moult 646cc59687 Update live install script on linux/mac and merge system support docs into dev setup docs 2024-08-02 15:57:17 +10:00
Dion Moult 38759348cd Document new install location on 4.2 2024-08-02 15:57:17 +10:00
Dion Moult ff44f4f395 Show warning if a blend file is used alongside an ifc 2024-08-02 15:57:17 +10:00
Dion Moult a31051a937 Drop py39 from build matrix for BBIM as we now only support Blender >=4.2 2024-08-02 15:57:17 +10:00
Chirag Singh 5cfd69f337 Merge branch 'v0.8.0' of https://github.com/IfcOpenShell/IfcOpenShell into v0.8.0 2024-08-02 11:23:09 +05:30
Chirag Singh f4100f7951 Added HDR support 2024-08-02 11:22:40 +05:30
Thomas Krijnen 785d5118d0 installation.rst - minor enhancement 2024-08-02 05:02:20 +02:00
Thomas Krijnen fddd85817a installation.rst - minor doc enhancements 2024-08-02 04:59:09 +02:00
Thomas Krijnen a689fc6377 Consistency TopExp_Explorer::Current() 2024-08-02 04:50:06 +02:00
Augustin Trancart 8e5a7ed24e improve json lib discovery for cmake 2024-08-02 03:31:17 +02:00
Dion Moult 788217c73c Use loader to get name instead of hardcoding when loading IFCs. See #4517. 2024-08-02 09:31:15 +10:00
Blender Defender 1abc3a1422 feat: Update the patch UI of ResetAbsoluteCoordinates
Instead of specifying parameters `a`, `b`, `c` and `d`, more meaningful parameters have been introduced (`threshold`, `automatic_offset_point`, `x`, `y` and `z`), which allow to do the same operations in a more understandable way.
2024-08-02 08:26:14 +10:00
Richard Brice c31c34b7d2 reimplements piecewise_function using PIMPL idiom
PIMPL idiom allows implementaiton of piecewise_function to evolve without envoking systemwide recompile (unless the class definition changes)
2024-08-01 12:34:49 -07:00
Richard Brice b22ecba179 Implements mutually exclusive access to mapping cache with a mutex 2024-08-01 07:15:22 -07:00
Chirag Singh 22bc98b48b Merge branch 'v0.8.0' of https://github.com/IfcOpenShell/IfcOpenShell into v0.8.0 2024-08-01 19:29:48 +05:30
Chirag Singh cf70026570 Gensky corrected and output in .tiff format 2024-08-01 19:29:02 +05:30
Andrej730 3c4a865e0b ci.yml - also run tests for other ifcopenshell packages 2024-08-01 18:01:59 +05:00
Andrej730 8523bb317a bcf, bsdd - add "make test" 2024-08-01 18:01:59 +05:00
Andrej730 4b00b268c0 fix core geometry trests after c4ae957 and 698c648 2024-08-01 18:01:58 +05:00
Andrej730 f0ca34d107 fix core project tests after 0dc084d and e3cb811 2024-08-01 18:01:58 +05:00
Andrej730 3834ecb06a fix core root test after e3cb811 2024-08-01 18:01:58 +05:00
Andrej730 047c9e3ee9 fix core aggregate module test after 6eb3c48 2024-08-01 18:01:58 +05:00
Andrej730 786b796f37 fix breaking bim.activate_model for new collections structure 2024-08-01 18:01:58 +05:00
Andrej730 3fd8be72c2 refresh_ui_data note 2024-08-01 18:01:58 +05:00
Andrej730 cb80081473 fix covering test and fix bug adding coverings in non-meters projects
Noticed that adding a covering in millimeters project didn't worked - the reason was that shapely was using tolerance in ifc project units when get_obj_base_points was returning points in si (blender always operates in meters internally).
I've changed get_obj_base_points to return data in project units and get_bmesh_from_polygon to convert it back to meters for Blender.
It's probably would be better to always operate in si until we need to save data to ifc but I'm not that familiar with that module to just change it everywhere.

Ping @maxfb87 just in case.
2024-08-01 18:01:58 +05:00
Andrej730 5ac84e2be7 covering - more detailed poll messages 2024-08-01 18:01:58 +05:00
Andrej730 c8466e0606 typing 2024-08-01 18:01:58 +05:00
Thomas Krijnen db5167bbaf Prevent infinite recursion 2024-08-01 07:59:23 +02:00
Thomas Krijnen 7d6e26bfd5 Add revolve as top-level item in occt kernel 2024-08-01 07:48:42 +02:00
Thomas Krijnen 2fd339ac6b Hack/workaround for #5064 2024-08-01 07:48:28 +02:00
Dion Moult 6f6dc08696 Minor typo fixes 2024-08-01 14:58:23 +10:00
Andrej730 6cb063ebd2 fix bim drawing module test after 47704b1 2024-07-31 19:00:34 +05:00
Andrej730 fb95e3eb51 fix enabling sverchok as legacy addon on Blender 4.2
It was failing when BBIM is installed as an extension
2024-07-31 19:00:34 +05:00
Andrej730 17a061f917 fix bim test after e6ac012
when Types collection was renamed to IfcTypeProduct
2024-07-31 19:00:34 +05:00
Andrej730 51db65b868 fix resource bim tests after c399eb2
IfcLaborResource doesn't actually support IfcQuantityArea quantities
2024-07-31 19:00:34 +05:00
Andrej730 faab9e04a3 fix resource bim tests after 1a4e467
operator prop was deprecated a long time ago in e2d4a3a
2024-07-31 19:00:34 +05:00
Andrej730 bea92455dd clean up bim tests from trailing spaces 2024-07-31 19:00:34 +05:00
Andrej730 6be1b80a82 fix container operators after a9a4b0c + mention a limitation
If you would select container1 + obj1 with intention to copy obj1 to container1 - running bim.copy_to_container would also copy container1.
Similar issue for referencing/dereferncing structures in other structures in ifc4x3.
2024-07-31 19:00:34 +05:00
Andrej730 2927eadada Display referenced structured elements during container edit for more responsive ui
Before - https://imgur.com/a/m5qtDUn
After - https://imgur.com/a/TFlUNTa
2024-07-31 19:00:33 +05:00
Andrej730 4c5e90dc77 fix bim tests after collections no longer represent spatial hierarchy 2024-07-31 19:00:33 +05:00
Andrej730 f860973172 fix spatial module bim tests after a9a4b0c 2024-07-31 19:00:33 +05:00
Andrej730 94ed0cd59c fix bim.assign_container uses after a9a4b0c + add TODOs 2024-07-31 19:00:33 +05:00
Andrej730 93ea1f98ac fix qto tests after 8c3d10a 2024-07-31 19:00:33 +05:00
Andrej730 b68a92f251 remove bim.assign_objects_base_qto from tests (removed in 8c3d10a) 2024-07-31 19:00:33 +05:00
Andrej730 902da2e720 remove bim.pie_update_container
as we no longer rely on collections for container assignment
2024-07-31 19:00:33 +05:00
Andrej730 d384aaeb9c fix tests after a9a4b0c 2024-07-31 19:00:33 +05:00
Andrej730 133494af97 remove bimtester from bbim (related to 7157590) 2024-07-31 19:00:32 +05:00
Andrej730 64fc9462b6 fix bim attribute tests after 9122f00 2024-07-31 19:00:32 +05:00
Andrej730 3d86e5fff3 fix bim geometry tests after fccf56d 2024-07-31 19:00:32 +05:00
Andrej730 a24bb069aa fix bim tests after changes in quantities calculations 2024-07-31 19:00:32 +05:00
Andrej730 159355d63a typing 2024-07-31 19:00:32 +05:00
Andrej730 598cf4ba79 bim.perform_quantity_take_off description + info message 2024-07-31 19:00:32 +05:00
Andrej730 c86a4c88a9 fix broken search test after 410fff6 2024-07-31 19:00:32 +05:00
Jonathan Gan 6a9e76c2af Documentation: Added getting started documentation for ifcopenshell core (#4965)
* Added getting started documentation for ifcopenshell core

* Apply suggestions from code review

Co-authored-by: Thomas Krijnen <t.krijnen@gmail.com>

* Updated code snippet to use ->as instead of dynamic_cast based on feedback

* Missed out two dynamic casts

* Using preprocessor macros instead of chaining if-else

---------

Co-authored-by: Jonathan Gan <jonathan.gan@inspacion.com>
Co-authored-by: Thomas Krijnen <t.krijnen@gmail.com>
2024-07-31 07:28:25 +10:00
Andrej730 2070071c49 fix bbim builds... 2024-07-30 21:20:14 +05:00
Andrej730 9bbf3bcaba mention supported formats in export window
as currently there is no other ui to indicate that other formats besides .ifc are supported and I guess we just expect users to change extension in the saved filename

https://i.imgur.com/Qa6OlmR.png
2024-07-30 20:47:48 +05:00
Andrej730 0395c0c6c7 fix ifcjson export support #4832
Bumped the version, so Blender would recognize the updated wheel.

Related https://github.com/IFCJSON-Team/IFC2JSON_python/pull/3
2024-07-30 20:47:47 +05:00
Andrej730 a175ec4d28 fix bim tests after d4b055a 2024-07-30 20:46:16 +05:00
Andrej730 139627b6ec fix bim tests after b9f76042b 2024-07-30 20:46:16 +05:00
Andrej730 6f2eb0a116 fix bim tests after a156864 2024-07-30 20:46:16 +05:00
Andrej730 d26561acee fix for bim style module test 2024-07-30 20:46:16 +05:00
Andrej730 de0374bdbd fix error purging unused types in 75f8e75 2024-07-30 20:46:16 +05:00
Ziad-I 51463ab674 fix pid file not there on first run so exception was thrown and not caught
when the user ran the web ui for the first time. the running_pid file was not created yet by the server so it threw an exception due to with open not inside the try block
2024-07-30 18:18:35 +03:00
Dion Moult 6012695cfe Use a tolerance when detecting project norths heuristically 2024-07-30 23:57:54 +10:00
Dion Moult 081b3fcf33 Remove misleading load project button in new project wizard.
Previously there were subtle differences and two ways to load projects which is bad UX.
2024-07-30 23:57:54 +10:00
Dion Moult 27a2c94b4a Fix #5065. Restore "Import IFC" menu item for those wishing to purely work with IFC geometry instead of native ifc 2024-07-30 23:57:54 +10:00
Dion Moult b9f76042bb Remove deprecated export IFC operator ID 2024-07-30 23:57:54 +10:00
Andrej730 e7ef307984 remove redundant indent in bdc5a7a
Co-Authored-By: Adi Shavit <1814800+adishavit@users.noreply.github.com>
2024-07-30 18:56:02 +05:00
Andrej730 1f68e52ac2 black format - exclude 'mvd' and reformat pyproject.toml for readibility 2024-07-30 18:49:10 +05:00
Dion Moult 87dfb75c21 Merge pull request #5103 from IfcOpenShell/webui_drawings
Web UI drawings page
2024-07-30 23:12:04 +10:00
Blender Defender 8afb1b8b30 feat: Display float properties as string properties for more precision in the patch panel
This change affects the following recipes: `OffsetObjectPlacements`, `OffsetStoreyElevations`, `SetFalseOrigin`, `SetRefElevation` and `SetWorldCoordinateSystem`
2024-07-30 23:05:44 +10:00
Blender Defender 5572991a7c style: Run black on geom/occ_utils.py 2024-07-30 23:04:58 +10:00
Blender Defender 653b9288c0 feat: Allow merging multiple ifc projects at once with the MergeProject recipe 2024-07-30 23:04:58 +10:00
Chirag Singh 233b0856af Implemented gensky and fixed executable flag error as mentioned by Manu in #5033 2024-07-30 13:51:20 +05:30
Dion Moult ec29e3d60b Send sigkill not sigterm because aiohttp swallows sigterm and takes a long time
I'm not smart enough to know exactly why
2024-07-30 17:54:28 +10:00
Dion Moult 70bc32b3df Check for PID file prior to connecting to newly started web socket server 2024-07-30 17:28:35 +10:00
Ziad-I ca781655b0 add displaying of svgs in drawings page 2024-07-29 23:35:28 +03:00
Ziad-I 03e2cb70bb remove unnecessary padding 2024-07-29 22:45:35 +03:00
Chirag Singh c7c95e1f9d Implemented gensky (Values Hardcoded) 2024-07-29 23:15:31 +05:30
Chirag Singh b040c5e25b Pulled changes 2024-07-29 23:13:21 +05:30
Richard Brice 60b007d28a Fixes domain of vertical and cant pwf (Issue #5072) 2024-07-29 09:48:15 -07:00
Andrej730 52130a3eb6 fix materials / styles bim tests #4843 2024-07-29 18:53:12 +05:00
Andrej730 5e849d7b81 update core.tool.Material to fix tests 2024-07-29 18:53:12 +05:00
Andrej730 a7a28f613b Fix errors in tests and scripts removing styles
remove_style relies on style_type which is using StylesData to get the enum of it's values and StylesData will fail to load on `material = tool.Ifc.get_object(ifc_file.by_id(style.ifc_definition_id))` as ifc_definition_id was removed but not yet removed as an item from styles ui.

This issue doesn't occur when user is working from UI since StylesData precached when they load styles UI but if they run a script (as we do in bim tests) StylesData is not precached and will be loaded when get_active_style_type() is called leading to errors.
2024-07-29 18:53:12 +05:00
Andrej730 46b3bfecd1 fix issues assigning material sets and material lists 2024-07-29 18:53:12 +05:00
Andrej730 11b62a0fdc fix console errors adding new style and changing it's color
1) As adding new styles means it's not assigned anywhere, there is no need to keep graph up to date.
2) Removed Ifc Operator super class from couple operators that do not write ifc data
3) Moved common code to tool.Style
2024-07-29 18:53:11 +05:00
Andrej730 732bb93826 fix duplicated lines in 2575348 2024-07-29 18:53:11 +05:00
Andrej730 a0bda1afd3 typing 2024-07-29 18:53:11 +05:00
Dion Moult e0790601df Black 2024-07-29 22:38:55 +10:00
Dion Moult a9a4b0ccf0 Deprecate "duplicate" spatial tree browser in favour of regular object selection 2024-07-29 22:29:44 +10:00
Blender Defender f8848051ca style: Run black formatter on spatial/ui.py 2024-07-29 21:37:29 +10:00
Blender Defender b81031eecf fix: Remove the "animatable" option from the "engine" and "format" property in BIMFMProperties 2024-07-29 21:37:29 +10:00
Blender Defender 95a7ea8dce refactor: Create property group MultipleFileSelect
To easier create and display properties that allow one or more files as input, a `MultipleFileSelect` property group has been extracted, together with an operator for selecting the files and the code for displaying the property.
2024-07-29 21:37:29 +10:00
Dion Moult 98edb5a34c Display the default container in the UI when creating new types 2024-07-29 19:50:21 +10:00
Dion Moult 8ca2a55616 Implement filtered selection in new spatial decomposition panel 2024-07-29 18:09:08 +10:00
Dion Moult 74141bec73 Sort pset names and properties alphabetically
Can't believe it took this long to get around to doing this
2024-07-29 10:43:15 +10:00
Dion Moult f60c4fd3c5 Forgot to commit these files for the georeferencing updates 2024-07-29 10:42:37 +10:00
Ziad-I d9ee3522bc empty panels before adding names 2024-07-28 22:28:20 +03:00
Ziad-I 2538c47d01 fix display of list items 2024-07-28 22:01:13 +03:00
Ziad-I ec3dc71c0e add showing of drawings' and sheets' names 2024-07-28 21:04:16 +03:00
Ziad-I e5edd9a34d add retrieving drawings data from blender to web ui 2024-07-28 15:09:55 +03:00
Ziad-I f72359918d use blenderbim version instead of blender version 2024-07-27 22:12:14 +03:00
Kurt Battisti dfd505a794 Fix. Docs Georeferencing URL (#5096)
use users/advanced/georeferencing.html
2024-07-28 00:14:50 +10:00
Blender Defender 4a311fe4de fix: Remove the "ifc_patch_args" property (#5095)
* fix: Remove the "ifc_patch_args" property

This property has been removed, because patch recipes with arguments other than the boilerplate arguments automatically display these arguments as properties, and patch recipes that don't allow more arguments than the boilerplate arguments fail, if "ifc_patch_args" is not None or "[]". The test cases have been adjusted accordingly.

* style: run the black formatter to fix failing checks
2024-07-27 22:58:48 +10:00
Ziad-I 9d4493e1da add footer to index and gantt page 2024-07-27 15:52:49 +03:00
Andrej730 a1d8fbdbe9 Fix missing materials from sets #5093 #4832
Regression in ifcopenshell 0.8 - missing materials and styles from IfcMaterialProfileSets, IfcMaterialProfileSetUsages, IfcMaterialLayerSet.
2024-07-27 15:38:22 +05:00
Andrej730 952abde48e fix console errors related to material rename from ui
1) update_material_name was triggered for categories and failed since ifc id in that case = 0
2) update_material_name was triggered for materials when they were still incomplete and ifc id was still 0
3) moved setting material.name before settings ifc_id to avoid triggering unnecessary changes in ifc
2024-07-27 15:24:05 +05:00
Andrej730 168718063f fix regression #5092 after be7661a83 2024-07-27 15:24:01 +05:00
Dion Moult 4abcbbb4f9 Georeferencing calculator can now calculate blender offsets too 2024-07-27 19:54:12 +10:00
Dion Moult 1ac1b289c1 Map coords always visualise using map units, visualise IFC local origin, and don't show blender coords if no blender offset 2024-07-27 19:53:45 +10:00
Ziad-I c25173aa12 add event listeners and joining of room in drawings page 2024-07-26 22:43:10 +03:00
Andrej730 ea8d303883 fix some test-bim errors in Blender 4.2 2024-07-26 21:23:39 +05:00
Ziad-I 9d79337fa7 edit drawings html/css/js 2024-07-26 17:29:39 +03:00
Blender Defender 82a6ddb01c feat: Make sql_type an enum property in the Ifc2Sql recipe
Since there is a limited number of choices, a string property wouldn't be very helpful. Use a dynamic enum property (which is adjusted according to which types of SQL are available) instead.
2024-07-26 23:35:02 +10:00
Blender Defender a7152bdef0 feat: Convert argument names into prettier looking property names in the IFC Patch Panel
Inspired by #4721
2024-07-26 23:29:41 +10:00
Andrej730 6484a529b0 black format 2024-07-26 18:29:18 +05:00
Andrej730 6e1e653ceb fix tests to use release version of ifc4x3 (ci was failing) 2024-07-26 16:29:46 +05:00
Andrej730 0488e4cccb bcfp numpy 2.0+ support #5080
`np.float_` is deprecated, it was just an alias for `np.float64`
2024-07-26 16:29:26 +05:00
Andrej730 3cf92fd508 bsddclassification - remove description prop as unused 2024-07-26 16:29:26 +05:00
Andrej730 fb2bb7554e bsdd - add buttons to open URIs in browser
Examples:
- https://i.imgur.com/zSvU9vp.png
- https://imgur.com/a/WkbTiVa
2024-07-26 16:29:26 +05:00
Andrej730 be7661a83b remove duplicated operator bim.open_webbrowser
it did exactly the same as bim.open_uri
2024-07-26 16:29:25 +05:00
Andrej730 9684e21d93 bsdd - hide domain selection operator for the active domain
Example - https://imgur.com/a/SkpECro
2024-07-26 16:29:25 +05:00
Andrej730 ee5c401823 bsdd - expose bsdd props descriptions to ui
Example - https://imgur.com/a/xUUeuF5
2024-07-26 16:29:25 +05:00
Andrej730 4aa3ffb765 bsdd - check keyword length only in tool
just to make it more straightforward and remove unused output
2024-07-26 16:29:25 +05:00
Dion Moult c9affcc622 Update README.md 2024-07-26 20:09:26 +10:00
Dion Moult 153a71f91e Distribute IfcConvert on GH actions 2024-07-26 20:04:04 +10:00
Dion Moult ae7b1bb9b4 Bump IOS 2024-07-26 20:03:36 +10:00
Dion Moult 6f70196a6c Make IfcConvert downloads also come consistently from github releases 2024-07-26 20:03:24 +10:00
Blender Defender 228bbc30ad refactor: Update code comments and docstrings 2024-07-26 19:28:10 +10:00
Blender Defender f83a7ac730 feat: Sort the available length units numerically
Length units are now sorted ascending by the value the prefix represents, i.e. METER is listed before KILOMETER, ...
2024-07-26 19:28:10 +10:00
Blender Defender fad4ea82a7 refactor: Update the type annotation in Migrate.py to be a literal 2024-07-26 19:28:10 +10:00
Blender Defender a252b459a2 refactor: Update the type annotation in ConvertLengthUnit.py to be a literal 2024-07-26 19:28:10 +10:00
Blender Defender 9ac159e0af feat: Parse type "Literal" as enum property in the IFC Patch Panel 2024-07-26 19:28:10 +10:00
Dion Moult 74fbf29d5f Change name of ci-black-formatting.yml 2024-07-26 12:21:11 +10:00
Dion Moult 1fef4c5857 Run black on BBIM 2024-07-26 12:19:21 +10:00
Dion Moult e7b791f4a2 Run black on utils 2024-07-26 12:16:36 +10:00
Dion Moult a6286293d8 Run black on IOS-Python 2024-07-26 12:00:57 +10:00
Ziad-I bddb8d1e56 add initial page layout 2024-07-26 02:19:55 +03:00
Andrej730 d51fa2c5f7 bsdd - info messages with amount of found classes / class props 2024-07-25 18:36:18 +05:00
Andrej730 e4afcc96d1 dev_environment script - echo instead of rem so users could see the instructions 2024-07-25 18:36:18 +05:00
Andrej730 5f94a84616 dev environment script - move username to a separate variable, use current user as default
Want to keep the script working for some users (me 👉👈) just by running it from the repo without any changes.
2024-07-25 18:36:18 +05:00
Andrej730 a883e9f490 bsdd - fix bug adding wrong classification to the project + info messages
1) we were identifying active domain just by name, therefore it would always pick up the first dictionary that has matching name (typically it's the most recent version) even though user selected a different version

2) Previously it would fail if it couldn't find a domain, now it will show an info message.

3) Also added info message when user is trying to add the same classification again, so it will be less confusing.
2024-07-25 18:36:17 +05:00
Andrej730 74db3fcbbe bsdd - show more info about the selected domain
Exposed all stored information to the UI, now it's possible to distinguish between different versions of the same domain:
https://i.imgur.com/6wlSkCP.png
2024-07-25 18:36:17 +05:00
Andrej730 d7b85d1264 bsdd - fix bug when it was always loading preview and inactive domains 2024-07-25 18:36:17 +05:00
Andrej730 455fe740c7 support assigning bsdd classifications in ifc4x3 too 2024-07-25 18:36:17 +05:00
Andrej730 eac4e80ee9 typing 2024-07-25 18:36:17 +05:00
Dion Moult 33e188b321 Visualisation of WCS now takes into account blender session offsets 2024-07-25 23:34:29 +10:00
Blender Defender 59a3c019a4 ci: Move the black formatter workflow to a seperate file 2024-07-25 18:24:31 +05:00
Blender Defender 30ab2f1e48 ci: Add black formatter to ci.yml
Check, whether the files are formatted properly using the black formatter on push and pull requests.
2024-07-25 18:24:31 +05:00
Dion Moult aae160b568 Don't clone in windows dev setup, also don't use appdata since it will run as root 2024-07-25 22:51:05 +10:00
Ziad-I c4d3dad639 add page setup functions 2024-07-25 15:35:08 +03:00
Ziad-I adbf9093d3 add initial drawings page 2024-07-25 15:12:37 +03:00
Ziad-I c8defbb77f add connected list to gantt chart page 2024-07-25 14:59:56 +03:00
Ziad-I a14fc0a7f5 edit css rules 2024-07-25 14:25:44 +03:00
Thomas Krijnen 91f4427bb5 Start from project instead of unit assignment #5074 2024-07-25 10:23:12 +02:00
Ziad-I 8d2717d25b add connected blender list for index page 2024-07-24 23:26:43 +03:00
Andrej730 8b29e50f11 add_classification - remove dead and deprecated code 2024-07-24 18:24:22 +05:00
Andrej730 7edd1225c0 Fix issue assigning bsdd classification in ifc2x3 #5073 2024-07-24 18:24:22 +05:00
Andrej730 075a0c79e2 migrator - consider IfcClassification renamed property 2024-07-24 18:24:22 +05:00
Andrej730 a1c4221cd7 fix ui in 3d4c85c7d
previous change was committed by accident
2024-07-24 18:24:22 +05:00
Dion Moult dc197a2ae2 Add text shadows and clearly distinguish units, blender, local, and map coordinates in georef decorator 2024-07-24 23:21:32 +10:00
Andrej730 5fab630a8b Fix #5052 #4832 2024-07-24 17:30:23 +05:00
Andrej730 b021dbf55e fix issue in 93fe2e9
forgot that bim.assign_class is used without context arguments too, moved poll to pie menu operator
2024-07-24 17:21:42 +05:00
Andrej730 d3bcd2f73e Add more instruction for python version mismatch error handler
Example - https://i.imgur.com/l9KCHGc.png
2024-07-24 16:56:56 +05:00
Andrej730 3d4c85c7dc Indicate that Blender needs a restart if BBIM was reinstalled
Example - https://i.imgur.com/lbP4PqO.png
2024-07-24 15:54:26 +05:00
Dion Moult adde772014 Also consider non elements when guessing a false origin 2024-07-24 17:10:46 +10:00
Chirag Singh 59579fd4c4 Merge branch 'v0.8.0' of https://github.com/IfcOpenShell/IfcOpenShell into v0.8.0 2024-07-24 12:15:08 +05:30
Chirag Singh 0dde4102bc Added support for mapping material inside the UI. Output file name and file extension taken from input. Plus Fixed some bugs mentioned in #5033 2024-07-24 12:11:56 +05:30
Thomas Krijnen b988df9e1f Address old merge issue regarding style lookup #5069 2024-07-24 03:07:17 +02:00
tim 390b280442 Screed added to IfcCovering options
Screed added to IfcCovering-predefined_types FLOORING and TOPPING
2024-07-24 10:08:09 +10:00
Ziad-I 9776adee86 fix packages path for blender > 4.2 2024-07-23 22:16:24 +03:00
Andrej730 06c8a9ef14 Blender 4.2 - experimental support for reinstalling BBIM on Windows 2024-07-23 18:56:48 +05:00
Andrej730 9713cc0c2e operator to quickly restart blender 2024-07-23 17:24:14 +05:00
Thomas Krijnen dda010b130 Wire up ___localplacement settings #5031 2024-07-23 10:15:52 +02:00
Ziad-I 4122f22ee1 remove hardcoded values 2024-07-23 17:04:37 +10:00
Ziad-I e833b0aa81 edit docstrings 2024-07-23 17:04:37 +10:00
Ziad-I 975b215bd0 add type hints and docstrings 2024-07-23 17:04:37 +10:00
Ziad-I 276c4b871e add starting server if no server is running during export to web 2024-07-23 17:04:37 +10:00
Ziad-I 8e6d13242e add css variables and switching themes for gantt page 2024-07-23 17:04:37 +10:00
Ziad-I c852e624e9 add theme switching for tables page 2024-07-23 17:04:37 +10:00
Ziad-I ad17a610eb edit css for csv tables to have two themes 2024-07-23 17:04:37 +10:00
Ziad-I 6b4c695942 add writing/removing webserver pid to a json file
on starting and killing the webserver subprocess
2024-07-23 17:04:37 +10:00
Ziad-I 61dfb42cee edit warning text color 2024-07-23 17:04:37 +10:00
Ziad-I 386caab840 move intial opening of browser to server on startup event
as a band aid fix to handle race condition between starting server and opening of web browser
2024-07-23 17:04:37 +10:00
Ziad-I f50bbf9704 add warning to web ui on changes and is_dirty in web module data 2024-07-23 17:04:37 +10:00
Ziad-I 4912e86e6e fix using errno module instead of hardcoded
since error code numbers differ based on OS
2024-07-23 17:04:37 +10:00
Ziad-I b0fe30c597 add caching of blender messages 2024-07-23 17:04:37 +10:00
Ziad-I 84d4bf16c3 remoce unnecessary div element 2024-07-23 17:04:37 +10:00
Ziad-I 7851efd0c8 use ifc_file instead of IFC_File 2024-07-23 17:04:37 +10:00
Ziad-I 500587f267 make webdata ifc_file only show filename instead of full path 2024-07-23 17:04:37 +10:00
Ziad-I 6defdc63b5 add type hints and docstring to send_webui_data function 2024-07-23 17:04:37 +10:00
Ziad-I 216b3a4e37 rename variables to have more meaningful names 2024-07-23 17:04:37 +10:00
Ziad-I 4e79384c8e fix packages path when using dev setup with symlinks 2024-07-23 17:04:37 +10:00
Ziad-I f7a3b0706b fix: using blender python executable 2024-07-23 17:04:37 +10:00
Dion Moult 5d4a3d504c Support alpha versions for all wheels 2024-07-23 17:00:22 +10:00
Dion Moult 96b4ad8cd3 No longer ship bbim addon with bimtester 2024-07-23 11:41:46 +10:00
Richard Brice 54131b3fe5 IfcSectionedSolidHorizontal logs warning if Directrix is not a piecewise function, rather than silently failing. 2024-07-22 13:21:49 -07:00
Andrej730 93fe2e9b0f bim.assing_class - add description, add poll check for selected objs
also added description to pie menu entry
2024-07-22 17:26:59 +05:00
Andrej730 a7e856c311 Update ci-blenderbim.yml after all makefile changes 2024-07-22 16:46:47 +05:00
Andrej730 1fbdb4811d makefile - move ifcopenshell packages wheels instead of copy to keep it clean 2024-07-22 16:46:47 +05:00
Andrej730 797e3e8d8c bbim_translations - not to fail if user has fake-bpy-module 2024-07-22 16:46:47 +05:00
Andrej730 4c53881242 blenderbim makefile - safeguards for wheels used in the build 2024-07-22 16:46:47 +05:00
Andrej730 44fc5768af blender 4.2 - fix errors detecting last commit hash
1) __file__ / bim no longer exists as 'bim' is moved to the wheel
2) there also was an issue detecting hash after it was moved from bim to blenderbim package in c0635af
2024-07-22 16:43:50 +05:00
Andrej730 ffbade0f7a fix bcf paths after 237cd99 2024-07-22 16:43:50 +05:00
Andrej730 1ca6c489b1 dev installation - update windows script for Blender 4.2 2024-07-22 16:43:50 +05:00
Andrej730 845b3e0f6b dev installation - move dev environment scripts to separate files 2024-07-22 16:43:50 +05:00
Andrej730 51e9626809 installation.rst - update platform names 2024-07-22 16:43:50 +05:00
Andrej730 1d12f54c36 reuse tool.Blender.get_blenderbim_version 2024-07-22 16:43:50 +05:00
Andrej730 1281eb4aea fix download urls in startup error handler after d96f96031 2024-07-22 16:43:49 +05:00
Thomas Krijnen c0f2ac592e Consider edge orientation in faceset helper for advanced planar breps #4895 2024-07-22 13:07:40 +02:00
Thomas Krijnen 41f1d66fee Fix 2d transform op + fixed ref column order #5048 2024-07-22 04:33:35 +02:00
Dion Moult aa31436c67 Move git/other addons/troubleshooting to top level of docs 2024-07-22 12:13:46 +10:00
Thomas Krijnen e95e92356f Update src/ifcopenshell-python/ifcopenshell/util/shape.py
Co-authored-by: Vyacheslav Dobranov <112861900+VDobranov@users.noreply.github.com>
2024-07-22 03:51:12 +02:00
VDobranov e27980f746 Update shape.py
Following the discussion in Live Chat about length of all edges in a given geometry:
https://matrix.to/#/!ssOmSJysZpXBupsgjO:matrix.org/$0ZHjIFCtpwQl06xdGWlQ9ymsiKWpPuLMczVJnNYmN84?via=matrix.org&via=crossbach.de&via=infeeeee.duckdns.org
2024-07-22 03:51:12 +02:00
Ryan Schultz 3f3f3b6aff whoops
Revert "Update installation.rst"

This reverts commit a428ae5c86.
2024-07-21 12:50:49 -05:00
Thomas Krijnen 2b3035ec02 Lookup styles on (arbitrarily) more taxonomy kinds 2024-07-21 11:56:02 +02:00
Thomas Krijnen cc0760d505 profile_helper() returns loop, not face, take into account in hollow profile def 2024-07-21 11:55:18 +02:00
Thomas Krijnen f683fd220f Take into account tapered extrusion position 2024-07-21 11:54:48 +02:00
Thomas Krijnen 889d3c5451 Don't fail on tapered extrusion over non-derived profile def #5046 2024-07-21 11:53:42 +02:00
Thomas Krijnen c16cfc8afd Support extrusion over composite profile 2024-07-21 11:52:48 +02:00
Thomas Krijnen 4d698deb21 Various improvements to USD serializer related to object naming 2024-07-21 02:41:43 +02:00
Thomas Krijnen 3bbe598dff Minor formatting improvements 2024-07-21 02:40:56 +02:00
Thomas Krijnen e88bd3af80 Fix profile fillets #4993 2024-07-21 02:40:09 +02:00
Ryan Schultz a428ae5c86 Update installation.rst 2024-07-20 16:08:16 -05:00
Ryan Schultz 05e202059e fix #5047 - order IfcAnnotationTypes alphabetically.
and order types regardless of case.
2024-07-20 13:02:21 -05:00
Ryan Schultz ab97f23b47 Fix #5039 - Assure count is an integer 2024-07-20 10:36:26 -05:00
Kristoffer Andersen 4f0a65baea Update ci-ifcopenshell-conda-cleaner.yml
fix conda cleaner version ordering
2024-07-20 09:45:55 +02:00
Chirag Singh e88abd881d Fixed Issue #5033 2024-07-20 12:02:57 +05:30
Dion Moult d6d5dbfaa3 Fix semver syntax for BBIM GH daily builds 2024-07-20 15:51:26 +10:00
Dion Moult 3ea1f95fcf Bump version as we've already released 0.7.10
This makes the -alpha suffix actually work
2024-07-20 15:49:37 +10:00
Dion Moult 48026c7a50 Fix bug where adding a duct failed due to no container obj being calculated 2024-07-20 15:49:11 +10:00
Andrej730 8f2e8ec64d fix builds for macos 2024-07-19 22:22:22 +05:00
Andrej730 15945d854a fix bbim build missing very important aud wheel 2024-07-19 22:22:22 +05:00
Andrej730 f69c42aaae makefiles - windows support 2024-07-19 22:22:22 +05:00
Kristoffer Andersen b88e35e3e7 Update ci-ifcopenshell-conda-daily.yml
remove illegal conda version character -
2024-07-19 13:50:08 +02:00
Kristoffer Andersen 6befa2dc12 Update ci-ifcopenshell-conda-daily.yml
making legal semver by using -alpha
2024-07-19 13:45:12 +02:00
Andrej730 c25bb03a9c Blenderbim startup error handler - switch to scene properties
Noticed that by default Blender is using object properties (and users may have something else their startup file), so no we switch to the scene properties so they could see our error handler immediately.
2024-07-19 14:23:26 +05:00
Andrej730 4fdf8145f0 Fix incorrect python version detection for Blender 4.2
Basically this error message is back - https://i.imgur.com/ANQe0eg.png
2024-07-19 14:21:57 +05:00
Andrej730 bb910e42ab fix dependencies that should be downloaded for specific platform
Builds are finally working (atleast tested on windows) 🥳

Thanks to Blender now we'll always now if some dependency will become platform specific.

It shows errors like:
Skipping wheel for other system (manylinux_2_24_x86_64.manylinux_2_28_x86_64 != win_amd64): greenlet-3.0.3-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): yarl-1.9.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): aiohttp-3.9.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): fonttools-4.53.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): ezdxf-1.3.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): frozenlist-1.4.1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): SQLAlchemy-2.0.31-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Skipping wheel for other system (manylinux_2_17_x86_64.manylinux2014_x86_64 != win_amd64): multidict-6.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
2024-07-18 22:05:36 +05:00
Andrej730 13dce9d663 github action - fix finding zip files with new naming
encapsulated zip archive name generation in the makefile, so we wouldn't be recreating it multiple times
2024-07-18 21:30:09 +05:00
Andrej730 bda69555f6 blenderbim makefile - fix bbim translations build 2024-07-18 21:30:09 +05:00
Dion Moult e50f88a91c Whoops 2024-07-19 00:59:58 +10:00
Dion Moult fc7288b9e7 Fix missing bdist wheel during build 2024-07-19 00:56:16 +10:00
Andrej730 1355f3ab6b common.mk - windows support 2024-07-18 19:46:18 +05:00
Andrej730 d60c03b632 fix bbim daily github workflow not being triggered by changes in itself 2024-07-18 19:39:16 +05:00
Dion Moult b39020ce74 Fix yaml syntax 2024-07-19 00:26:56 +10:00
Dion Moult cb23b00913 Separate build/dist dir for bbim makefile 2024-07-19 00:26:07 +10:00
Dion Moult 268ab107e2 Forgot to update bimtester makefile 2024-07-18 23:57:44 +10:00
Dion Moult 734b4901fd Don't copy over the entire blenderbim dir when building 2024-07-18 23:52:24 +10:00
Dion Moult 0ecc3d3e2a Share common makefile instructions, use venv for running build, and separate dist/build dirs 2024-07-18 23:43:12 +10:00
Dion Moult 237cd99e3b Make bcf follow the same folder hierarchy as everybody else 2024-07-18 23:41:30 +10:00
Dion Moult 31acd0a39b Forgot PYTHON var 2024-07-18 22:44:25 +10:00
Dion Moult 7fb04c7d8f Wrap IOS make in venv 2024-07-18 22:40:43 +10:00
Dion Moult ad05434777 Add prerelease info, inline make dist-blenderbim 2024-07-18 22:29:08 +10:00
Dion Moult 99cb50d365 Forgot to commit IfcBIMTester pyproject 2024-07-18 22:24:25 +10:00
Andrej730 d29a201814 makefile - create wheels dir 2024-07-18 15:56:50 +05:00
Andrej730 fb702afee6 makefile - install build module globally
as we run make dist for ifcopenshell packages not inside venv
2024-07-18 15:48:18 +05:00
Andrej730 657906a2dd makefile - fix missing build module 2024-07-18 15:36:51 +05:00
Dion Moult 5b96b4a414 Bundle BBIM as a wheel
Yes we really did it
2024-07-18 20:24:17 +10:00
Dion Moult 30623ba333 Fix missing imports prior to deciding 4.2 import strategy 2024-07-18 20:24:17 +10:00
Andrej730 34652aa2b7 Create blenderbim_redirect.py 2024-07-18 20:24:17 +10:00
Dion Moult e7fd06a6d6 Fix non-valid Blender manifest (strings too long apparently) 2024-07-18 20:24:17 +10:00
Dion Moult f0077b9e22 Fix ifcopenshell-python wheel packaging missing util schema json files 2024-07-18 20:24:17 +10:00
Dion Moult 71aa30a25f Fix ifc5d packaging missing json mapping files 2024-07-18 20:24:17 +10:00
Dion Moult d96f960313 Add blender platform support 2024-07-18 20:24:17 +10:00
Dion Moult 5a2a809061 Bump permissions and tags in blender manifest 2024-07-18 20:24:17 +10:00
Andrej730 2710148276 fix bpypolyskel and ifcjson wheels 2024-07-18 20:24:17 +10:00
Andrej730 7ff1c535e5 build wheel for bpypolyskel 2024-07-18 20:24:17 +10:00
Dion Moult 71575905cb Remove behave and bimtester module - only used by advanced users and confuses users with ifctester 2024-07-18 20:24:17 +10:00
Andrej730 56573160d1 makefile - do not download pkg_resources as it's provided by blender
It seems Blender started providing pkg_resources by default at some point, see:
blender-4.2.0/4.2/python/lib/site-packages/pkg_resources
2024-07-18 20:24:17 +10:00
Andrej730 49555eb81e pack ifcjson to wheel 2024-07-18 20:24:17 +10:00
Dion Moult 9ed286660e WIP BlenderBIM makefile update 2024-07-18 20:24:17 +10:00
Dion Moult 3d2dfdf9cb Fix ifccityjson wheel 2024-07-18 20:24:17 +10:00
Dion Moult c3d4847b29 Minor fix to sun_position < Blender 4.2 2024-07-18 18:26:39 +10:00
Richard Brice 9bf68db080 Fixes mapping of cant segments without superelevations 2024-07-17 15:46:36 -07:00
Bruno Perdigão 798cc6069f Fix bug related to Linked Aggregates 2024-07-17 15:45:10 -03:00
Dion Moult 0efa36940c Package BIMTester as a wheel 2024-07-17 20:50:36 +10:00
Andrej730 6fbb1a286c support sun position addon on blender 4.2 2024-07-17 15:26:12 +05:00
Andrej730 7c606fea9b make sun_position an optional addon for bbim 2024-07-17 13:18:42 +05:00
Andrej730 ae97350e64 blender_manifest - fix version
Blender requires blender_manifest version to be semver compatible otherwise it fails with an error below if you try to install BBIM as an extension.

Error:
Error in manifest key "version" invalid: to be a semantic-version, found '0.7.10.240717'
2024-07-17 13:16:17 +05:00
Andrej730 3e7dbcaeb6 blender_manifest - bump min blender version
as manifest is used only for installing addon as blender extension in Blender 4.2+
2024-07-17 13:16:17 +05:00
Thomas Krijnen 4ad426a5c5 Update IfcParse.cpp #4998 2024-07-17 09:45:34 +02:00
Dion Moult eeb200a19d Minor UI polish to show structural panels by default 2024-07-17 17:37:20 +10:00
Dion Moult 766eb75e3a Deprecate old set viewport shadow from sun in favour of new solar analysis tools 2024-07-17 17:37:09 +10:00
Dion Moult 607f79f2f5 New feature to set view from sun for solar analysis 2024-07-17 17:36:50 +10:00
Dion Moult 70f252988a Purge deprecated "set north" operators from georeference superseded by new visualisation features 2024-07-17 17:36:03 +10:00
Dion Moult f956545743 Fix tzfpy packaging 2024-07-17 16:45:35 +10:00
Dion Moult 6f8aac96f0 Fix #5027. Forgot to commit some files for solar analysis. 2024-07-17 14:57:06 +10:00
Dion Moult a2018a22a6 Add sun path visualisation for solar analysis 2024-07-17 13:59:01 +10:00
Thomas Krijnen 7a10edbd73 Fix ambiguous overload after dedbf7014a 2024-07-17 03:43:55 +02:00
Thomas Krijnen 669b0b8c83 Fix triangulated face set #5020 2024-07-17 03:26:23 +02:00
Thomas Krijnen 70336f179d Keep identities on indexed face sets #5020 2024-07-17 03:12:35 +02:00
Dion Moult 7fc7a73db8 New panel to manage solar analysis setup (location, date, and time) 2024-07-16 23:13:02 +10:00
Andrej730 41065f77d1 BBIM startup error handler - fix error redownloading addon after 5e6fe5e 2024-07-16 18:02:26 +05:00
Andrej730 010f854a07 BBIM startup error handler - message on python version mismatch
Example - https://i.imgur.com/U5CBdqU.png
Logs (only startup error logs) now also have information about binary python version and binary filename.
2024-07-16 18:02:26 +05:00
Andrej730 c0635afb64 BBIM error handler - include commit hash
Include commit hash to the copied logs and add it to the startup error handler (https://imgur.com/9yVMBnR)
2024-07-16 18:02:26 +05:00
Andrej730 dedbf7014a fill context attribute of the shape elements (similar to v0.7.0) #4832 2024-07-16 18:02:26 +05:00
Dion Moult d8cf6ca4fc Bundle pytz and tzfpy for timezone calculations for solar analysis 2024-07-16 22:56:51 +10:00
Andrej730 f1ab63dda9 pyradiance macos support + linux fix
See:
https://github.com/LBNL-ETA/pyradiance/issues/35
https://github.com/LBNL-ETA/pyradiance/issues/34
2024-07-16 12:11:11 +05:00
Andrej730 3a5c3d856a quick fix for 54fe0f8ff 2024-07-16 11:17:36 +05:00
Andrej730 54fe0f8ff9 Remove blenderbim/occ_utils.py #812
Goodbye duplicated file 😁
2024-07-16 11:06:49 +05:00
Dion Moult 483516a902 Implement show / hide / isolate in spatial decomposition panel 2024-07-16 14:23:30 +10:00
Dion Moult 83085ba3c1 You can now toggle recursive children in the spatial tree 2024-07-15 23:56:35 +10:00
Dion Moult 215866cf30 You can now make a spatial element the active object from the spatial decomposition panel 2024-07-15 23:40:40 +10:00
Andrej730 09d5fafdf8 note on OCC imports 2024-07-15 18:34:39 +05:00
Andrej730 54cc4192bd typing for pythonocc types 2024-07-15 18:34:39 +05:00
Andrej730 eff778d5be support pythonocc >= 7.8.0 #4942
Related: https://github.com/tpaviot/pythonocc-core/issues/1350
Also added a print so this type of errors won't go silently.
2024-07-15 18:34:38 +05:00
Andrej730 66877c227b typing 2024-07-15 18:34:38 +05:00
Andrej730 7e117bca90 Move supported OCCT version in docs to general dependencies 2024-07-15 18:34:38 +05:00
Andrej730 9f084558f6 mathutils note 2024-07-15 18:34:38 +05:00
Dion Moult c715d9a81b A spatial tree's icon can now be hovered to show the class and clicked to select children 2024-07-15 23:29:53 +10:00
Dion Moult 8923d02f68 Update to latest Sphinx AutoAPI 2024-07-15 09:20:56 +10:00
Dion Moult 447a13b6e7 Forgot to do the same for PyPI 2024-07-14 23:31:34 +10:00
1496 changed files with 148882 additions and 160449 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ jobs:
run: |
pip install build
cd src/bcf &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+12
View File
@@ -0,0 +1,12 @@
name: ci-black-formatting
on:
push:
pull_request:
jobs:
lint-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
-81
View File
@@ -1,81 +0,0 @@
name: ci-blenderbim-daily
on:
push:
paths:
- '.github/workflows/ci-blenderbim-matrix.yml'
- 'src/blenderbim/**'
- 'src/ifcopenshell-python/ifcopenshell/**'
- 'src/bcf/src/bcf/**'
- 'src/ifcclash/ifcclash/**'
- 'src/ifccobie/**'
- 'src/ifcdiff/**'
- 'src/ifccsv/**'
- 'src/ifcpatch/ifcpatch/**'
- 'src/ifc4d/ifc4d/**'
- 'src/ifc5d/ifc5d/**'
- 'src/ifccityjson/**'
branches:
- v0.8.0
workflow_dispatch:
jobs:
activate:
runs-on: ubuntu-latest
if: |
github.repository == 'IfcOpenShell/IfcOpenShell'
steps:
- name: Set env
run: echo ok go
build:
needs: activate
name: ${{ matrix.config.name }}-${{ matrix.pyver }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pyver: [py39, py310, py311, py312]
config:
- {
name: "Windows Build",
short_name: win,
}
- {
name: "Linux Build",
short_name: linux
}
- {
name: "MacOS Build",
short_name: macos
}
- {
name: "MacOS ARM Build",
short_name: macosm1
}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2 # https://github.com/actions/setup-python
with:
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
python-version: '3.11'
- name: Get current version
id: version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Get current date
id: date
run: echo "date=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
- name: Compile
run: |
cp -r src/blenderbim src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
cd src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }}
- name: Upload zip file to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }}/dist/blenderbim-${{steps.version.outputs.version}}.${{steps.date.outputs.date}}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip
asset_name: blenderbim-${{steps.version.outputs.version}}.${{steps.date.outputs.date}}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip
release_name: "blenderbim-${{steps.version.outputs.version}}.${{steps.date.outputs.date}} (unstable)"
tag: "blenderbim-${{steps.version.outputs.version}}.${{steps.date.outputs.date}}"
overwrite: true
@@ -1,4 +1,4 @@
name: Publish-blenderbim-chocolatey package
name: ci-bonsai-choco
on:
schedule:
@@ -9,11 +9,12 @@ on:
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# * * * * *
- cron: "30 0 * * *" # 30min past utc midnight
workflow_dispatch:
env:
major: 0
minor: 0
name: blenderbim
name: bonsai
choco_version: 1.1.0
CHOCO_TOKEN: ${{ secrets.CHOCO_TOKEN }}
@@ -41,5 +42,6 @@ jobs:
- name: Check in release tags if we should do a choco release and perform the release if needed
id: do_choco_release
run: |
cd /home/runner/work/IfcOpenShell/IfcOpenShell/choco/blenderbim/ &&
pip install pygithub
cd /home/runner/work/IfcOpenShell/IfcOpenShell/choco/bonsai/ &&
python3 choco_release.py
+155
View File
@@ -0,0 +1,155 @@
name: ci-bonsai-daily
on:
push:
paths:
- '.github/workflows/ci-bonsai-daily.yml'
- 'src/bonsai/**'
- 'src/ifcopenshell-python/ifcopenshell/**'
- 'src/bcf/bcf/**'
- 'src/ifcclash/ifcclash/**'
- 'src/ifccobie/**'
- 'src/ifcdiff/**'
- 'src/ifccsv/**'
- 'src/ifcpatch/ifcpatch/**'
- 'src/ifc4d/ifc4d/**'
- 'src/ifc5d/ifc5d/**'
- 'src/ifccityjson/**'
branches:
- v0.8.0
workflow_dispatch:
jobs:
activate:
runs-on: ubuntu-latest
if: |
github.repository == 'IfcOpenShell/IfcOpenShell'
steps:
- name: Set env
run: echo ok go
build:
needs: activate
name: ${{ matrix.config.name }}-${{ matrix.pyver }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pyver: [py311, py312]
config:
- {
name: "Windows Build",
short_name: win,
}
- {
name: "Linux Build",
short_name: linux,
}
- {
name: "MacOS Build",
short_name: macos,
}
- {
name: "MacOS ARM Build",
short_name: macosm1,
}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2 # https://github.com/actions/setup-python
with:
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
python-version: '3.11'
- name: Get current version
id: version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Get current date
id: date
run: echo "date=$(date +'%y%m%d')" >> $GITHUB_OUTPUT
- name: Compile
run: |
cd src/bonsai && make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }}
- name: Find zip file name
id: find_zip
run: |
filepath=$(ls src/bonsai/dist/bonsai_*.zip)
echo "filepath=$filepath" >> $GITHUB_OUTPUT
echo "filename=$(basename $filepath)" >> $GITHUB_OUTPUT
- name: Upload zip file to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.find_zip.outputs.filepath }}
asset_name: ${{ steps.find_zip.outputs.filename }}
release_name: "bonsai-${{steps.version.outputs.version}}-alpha${{steps.date.outputs.date}} (unstable)"
tag: "bonsai-${{steps.version.outputs.version}}-alpha${{steps.date.outputs.date}}"
overwrite: true
body: "See README in https://github.com/IfcOpenShell/bonsai_unstable_repo/ on how to setup autoupdates for daily Bonsai builds."
update-extensions-repo-and-run-tests:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout bonsai_unstable_repo repository
uses: actions/checkout@v2
with:
repository: IfcOpenShell/bonsai_unstable_repo
token: ${{ secrets.IOS_TO_BLENDER_REPO }}
path: bonsai_unstable_repo
- name: Update index.json on extensions repo
run: |
set -x -e
# 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
tar -xf blender.tar.xz
# Setup Blender.
BLENDER_PATH=$(find blender-*/ -maxdepth 0 -exec readlink -f {} \;)
export PATH="$PATH:$BLENDER_PATH"
blender --version
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"
bonsai_zip="$(pwd)/$(ls bonsai_unstable_repo/bonsai_py311*-linux-x64.zip)"
blender --version
blender --command extension install-file -r user_default -e $bonsai_zip
blender --command extension list
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
mv sverchok-master sverchok
zip -q -r sverchok.zip sverchok
rm -r sverchok
blender --command extension install-file -r user_default sverchok.zip
git clone https://github.com/IfcOpenShell/IfcOpenShell.git IfcOpenShell
cd IfcOpenShell/src/ifcsverchok
make dist
sverchok_zip="$(pwd)/dist/$(ls dist)"
blender --command extension install-file -r user_default $sverchok_zip
# 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()"
cd ../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
make test
@@ -1,4 +1,9 @@
name: ci-blenderbim
name: ci-bonsai
# Differences from ci-bonsai-daily.yml:
# - make has IS_STABLE=TRUE
# - action is never triggered and executed only manually
# - doesn't add a current date to the release and tag
on:
workflow_dispatch:
@@ -19,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
pyver: [py39, py310, py311, py312]
pyver: [py310, py311, py312]
config:
- {
name: "Windows Build",
@@ -48,15 +53,20 @@ jobs:
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Compile
run: |
cp -r src/blenderbim src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
cd src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
cd src/bonsai &&
make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }} IS_STABLE=TRUE
- name: Find zip file name
id: find_zip
run: |
filepath=$(ls src/bonsai/dist/bonsai_*.zip)
echo "filepath=$filepath" >> $GITHUB_OUTPUT
echo "filename=$(basename $filepath)" >> $GITHUB_OUTPUT
- name: Upload zip file to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: src/blenderbim_${{ matrix.config.short_name }}_${{ matrix.pyver }}/dist/blenderbim-${{steps.version.outputs.version}}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip
asset_name: blenderbim-${{steps.version.outputs.version}}-${{ matrix.pyver }}-${{ matrix.config.short_name }}.zip
release_name: "blenderbim-${{steps.version.outputs.version}}"
tag: "blenderbim-${{steps.version.outputs.version}}"
file: ${{ steps.find_zip.outputs.filepath }}
asset_name: ${{ steps.find_zip.outputs.filename }}
release_name: "bonsai-${{steps.version.outputs.version}}"
tag: "bonsai-${{steps.version.outputs.version}}"
overwrite: true
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/bsdd &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifc4d &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifc5d &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifccityjson &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifcclash &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+65
View File
@@ -0,0 +1,65 @@
name: ci-ifcconvert
on:
workflow_dispatch:
jobs:
activate:
runs-on: ubuntu-latest
if: |
github.repository == 'IfcOpenShell/IfcOpenShell'
steps:
- name: Set env
run: echo ok go
build:
needs: activate
name: ${{ matrix.config.name }}-${{ matrix.pyver }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows 64bit",
short_name: win64,
}
- {
name: "Windows 32bit",
short_name: win32,
}
- {
name: "Linux 64bit",
short_name: linux64
}
- {
name: "MacOS Intel 64bit",
short_name: macos64
}
- {
name: "MacOS Silicon 64bit",
short_name: macosm164
}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2 # https://github.com/actions/setup-python
with:
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- run: echo ${{ env.DATE }}
- name: Get current version
id: version
run: echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
- name: Compile
run: |
cd src/ifcopenshell-python &&
make zip-ifcconvert PLATFORM=${{ matrix.config.short_name }}
- name: Upload zip file to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: src/ifcopenshell-python/dist/ifcconvert-${{ steps.version.outputs.version }}-${{ matrix.config.short_name }}.zip
asset_name: ifcconvert-${{ steps.version.outputs.version }}-${{ matrix.config.short_name }}.zip
release_name: "ifcconvert-${{steps.version.outputs.version}}"
tag: "ifcconvert-${{steps.version.outputs.version}}"
overwrite: true
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifccsv &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifcdiff &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifcfm &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
@@ -90,7 +90,10 @@ jobs:
return
# sort the versions in descending order
versions = sorted(versions, reverse=True)
print(f"Before reversal: {versions=}")
versions.reverse()
print(f"After reversal: {versions=}")
releases = versions[number_of_supported_versions:]
for release in releases:
@@ -35,7 +35,7 @@ jobs:
- name: Version + date str
id: verdate
run: echo "verdate='${{ steps.version.outputs.version }}.${{ steps.date.outputs.date }}'" >> $GITHUB_OUTPUT
run: echo "verdate='${{ steps.version.outputs.version }}alpha${{ steps.date.outputs.date }}'" >> $GITHUB_OUTPUT
test:
@@ -57,7 +57,7 @@ jobs:
pip install build
cp -r src/ifcopenshell-python src/ifcopenshell_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
cd src/ifcopenshell_${{ matrix.config.short_name }}_${{ matrix.pyver }} &&
make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }}
make dist PLATFORM=${{ matrix.config.short_name }} PYVERSION=${{ matrix.pyver }} IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifcpatch &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+1 -1
View File
@@ -26,7 +26,7 @@ jobs:
run: |
pip install build
cd src/ifctester &&
make dist
make dist IS_STABLE=TRUE
- name: Publish a Python distribution to PyPI
uses: ortega2247/pypi-upload-action@master
with:
+10 -2
View File
@@ -47,6 +47,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install xmlschema xsdata numpy lxml pytest isodate lark networkx tabulate python-dateutil shapely
pip install mathutils
pip install src/bcf --no-deps
pip install https://github.com/Andrej730/aud/archive/refs/heads/master-reduced-size.zip
@@ -106,7 +107,7 @@ jobs:
- name: Run IfcConvert on Sample files
run: |
(find test/input src/blenderbim/test/files -name '*.ifc' | while read i; do \
(find test/input src/bonsai/test/files -name '*.ifc' | while read i; do \
echo $i | tee -a log; \
timeout 1m "$(which IfcConvert)" -yv "$i" "$i.obj" --validate >> log 2>&1; \
echo $i $? >> statuses; \
@@ -125,4 +126,11 @@ jobs:
python tests.py
cd ../src/ifcopenshell-python
mv ifcopenshell ifcopenshell-local # Force testing on installed module
make test-safe
make test
cd ../bcf && make test
pip install requests
cd ../bsdd && make test
pip install deepdiff
cd ../ifcdiff && make test
cd ../ifcpatch && make test
cd ../ifctester && make test
+4 -4
View File
@@ -8,12 +8,12 @@ on:
jobs:
activate:
if: github.repository == 'IfcOpenShell/IfcOpenShell'
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- run: echo ok go
build:
needs: activate
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v2
@@ -52,8 +52,8 @@ jobs:
-DOCC_INCLUDE_DIR=/usr/include/opencascade \
-DOCC_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu \
-DPYTHON_EXECUTABLE:FILEPATH=/usr/bin/python3 \
-DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.8 \
-DPYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython3.8.so \
-DPYTHON_INCLUDE_DIR:PATH=/usr/include/python3.10 \
-DPYTHON_LIBRARY:FILEPATH=/usr/lib/x86_64-linux-gnu/libpython3.10.so \
-DLIBXML2_INCLUDE_DIR=/usr/include/libxml2 \
-DLIBXML2_LIBRARIES=/usr/lib/x86_64-linux-gnu/libxml2.so \
-DGLTF_SUPPORT=On \
+9 -12
View File
@@ -73,19 +73,16 @@ src/ifcopenshell-python/test/build
# mypy cache
.mypy_cache
# blenderbim libs
src/blenderbim/blenderbim/libs
# bonsai i18n
src/bonsai/bonsai/translations.py
# blenderbim i18n
src/blenderbim/blenderbim/translations.py
# bonsai test temp files
src/bonsai/test/files/temp
src/bonsai/test/files/basic.ifc.cache.blend
src/bonsai/test/files/basic.ifc.cache.sqlite
# blenderbim test temp files
src/blenderbim/test/files/temp
src/blenderbim/test/files/basic.ifc.cache.blend
src/blenderbim/test/files/basic.ifc.cache.sqlite
src/blenderbim/drawings
src/blenderbim/layouts
src/bonsai/drawings
src/bonsai/layouts
# ifcopenshell swig and compiled files
src/ifcopenshell-python/ifcopenshell/_ifcopenshell_wrapper.so
@@ -100,4 +97,4 @@ src/ifcopenshell-python/ifcopenshell/ifcopenshell_wrapper.py
.cache
# Brickschema
src/blenderbim/blenderbim/bim/schema/Brick.ttl
src/bonsai/bonsai/bim/schema/Brick.ttl
+2 -2
View File
@@ -1,6 +1,6 @@
# -*- mode: Dockerfile -*-
FROM ubuntu:focal
FROM ubuntu:22.04
ARG CHANNEL
ENV CHANNEL=${CHANNEL:-latest}
@@ -23,7 +23,7 @@ RUN echo "deb http://archive.ubuntu.com/ubuntu focal-proposed main restricted" |
echo "deb http://archive.ubuntu.com/ubuntu focal-proposed multiverse" | tee -a /etc/apt/sources.list; \
apt-get -qq update; \
apt-get -y install tzdata dos2unix rsync; \
apt-get -y install python3 libxml2 libpython3.8 \
apt-get -y install python3 libxml2 libpython3.10 \
libboost-all-dev \
libocct-foundation-dev libocct-modeling-algorithms-dev libocct-modeling-data-dev \
libocct-ocaf-dev libocct-visualization-dev libocct-data-exchange-dev \
+8 -8
View File
@@ -12,7 +12,7 @@ is implemented for the IFC releases [IFC2x3 TC1] and [IFC4 Add2 TC1]. Extending
is possible at compile-time when using C++ and at run-time when using Python.
In addition to a C++ and Python API, IfcOpenShell comes with an ecosystem of tools, notably including IfcConvert (an application
to convert IFC models to other formats), the BlenderBIM Add-on (an add-on to Blender providing a graphical IFC authoring platform),
to convert IFC models to other formats), the ~~BlenderBIM~~ Bonsai Add-on (an add-on to Blender providing a graphical IFC authoring platform),
and many other libraries, CLI apps, and more. Support is also provided for auxiliary standards such as BCF and IDS.
For more information, see:
@@ -22,10 +22,10 @@ For more information, see:
* [IfcOpenShell C++ Installation](https://docs.ifcopenshell.org/ifcopenshell/installation.html)
* [IfcOpenShell Python Installation](https://docs.ifcopenshell.org/ifcopenshell-python/installation.html)
* [IfcOpenShell Python Hello World Tutorial](https://docs.ifcopenshell.org/ifcopenshell-python/hello_world.html)
* [BlenderBIM Add-on Website](https://blenderbim.org)
* [BlenderBIM Add-on Documentation](https://docs.blenderbim.org/index.html)
* [Add-on Installation](https://docs.blenderbim.org/users/installation.html)
* [Exploring an IFC model](https://docs.blenderbim.org/users/exploring_an_ifc_model.html)
* [Bonsai Website](https://bonsaibim.org)
* [Bonsai Documentation](https://docs.bonsaibim.org/index.html)
* [Add-on Installation](https://docs.bonsaibim.org/users/installation.html)
* [Exploring an IFC model](https://docs.bonsaibim.org/users/exploring_an_ifc_model.html)
Development is sponsored through your generous donations!
@@ -37,7 +37,7 @@ Contents
| Name | Description | License | Service |
| ------------------------- | --------------------------------------------------------------------- | ------------------- | ------- |
| bcf | Library to read and write BCF-XML and query OpenCDE BCF-API modules | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/bcf-client?label=PyPI&color=006dad)](https://pypi.org/project/bcf-client/) |
| blenderbim | Add-on to Blender providing a graphical native IFC authoring platform | GPL-3.0-or-later | [![Official](https://img.shields.io/badge/BlenderBIM.org-Download-70ba35)](https://blenderbim.org/download.html) [![GitHub Unstable](https://img.shields.io/github/v/release/ifcopenshell/ifcopenshell?filter=blenderbim-*&label=GitHub-Unstable&color=f6f8fa)](https://github.com/IfcOpenShell/IfcOpenShell/releases?q=blenderbim&expanded=true) [![Chocolatey](https://img.shields.io/chocolatey/v/blenderbim-nightly?label=Chocolatey&color=5c9fd8)](https://community.chocolatey.org/packages/blenderbim-nightly/) |
| ~~blenderbim~~ Bonsai | Add-on to Blender providing a graphical native IFC authoring platform | GPL-3.0-or-later | [![Official](https://img.shields.io/badge/BonsaiBIM.org-Download-70ba35)](https://bonsaibim.org/download.html) [![GitHub Unstable](https://img.shields.io/github/v/release/ifcopenshell/ifcopenshell?filter=blenderbim-*&label=GitHub-Unstable&color=f6f8fa)](https://github.com/IfcOpenShell/IfcOpenShell/releases?q=blenderbim&expanded=true) [![Chocolatey](https://img.shields.io/chocolatey/v/blenderbim-nightly?label=Chocolatey&color=5c9fd8)](https://community.chocolatey.org/packages/blenderbim-nightly/) |
| bsdd | Library to query the bSDD API | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/bsdd?label=PyPI&color=006dad)](https://pypi.org/project/bsdd/) |
| ifc2ca | Utility to convert IFC structural analysis models to Code_Aster | LGPL-3.0-or-later |
| ifc4d | Convert to and from IFC and project management software | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifc4d?label=PyPI&color=006dad)](https://pypi.org/project/ifc4d/) |
@@ -46,12 +46,12 @@ Contents
| ifcblender | Historic Blender IFC import add-on | LGPL-3.0-or-later\* |
| ifccityjson | Convert CityJSON to IFC | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifccityjson?label=PyPI&color=006dad)](https://pypi.org/project/ifccityjson/) |
| ifcclash | Clash detection library and CLI app | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifcclash?label=PyPI&color=006dad)](https://pypi.org/project/ifcclash/) |
| ifcconvert | CLI app to convert IFC to many other formats | LGPL-3.0-or-later\* | [![Official](https://img.shields.io/badge/IfcOpenShell.org-Download-70ba35)](https://docs.ifcopenshell.org/ifcconvert/installation.html)
| ifcconvert | CLI app to convert IFC to many other formats | LGPL-3.0-or-later\* | [![Official](https://img.shields.io/badge/IfcOpenShell.org-Download-70ba35)](https://docs.ifcopenshell.org/ifcconvert/installation.html) [![GitHub](https://img.shields.io/github/v/release/ifcopenshell/ifcopenshell?filter=ifcconvert-*&label=GitHub&color=f6f8fa)](https://github.com/IfcOpenShell/IfcOpenShell/releases?q=ifcconvert&expanded=true)
| ifccsv | Library and CLI app to export and import schedules from IFC | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifccsv?label=PyPI&color=006dad)](https://pypi.org/project/ifccsv/) |
| ifcdiff | Compare changes between IFC models | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifcdiff?label=PyPI&color=006dad)](https://pypi.org/project/ifcdiff/) |
| ifcfm | Extract IFC data for FM handover requirements | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifcfm?label=PyPI&color=006dad)](https://pypi.org/project/ifcfm/) |
| ifcmax | Historic extension for IFC support in 3DS Max | LGPL-3.0-or-later\* | [![Official](https://img.shields.io/badge/IfcOpenShell.org-Download-70ba35)](https://docs.ifcopenshell.org/ifcmax.html)
| ifcopenshell-python | Python library for IFC manipulation | LGPL-3.0-or-later\* | [![GitHub](https://img.shields.io/github/v/release/ifcopenshell/ifcopenshell?filter=ifcopenshell-python-*&label=GitHub&color=f6f8fa)](https://github.com/IfcOpenShell/IfcOpenShell/releases?q=ifcopenshell-python&expanded=true) [![PyPI](https://img.shields.io/pypi/v/ifcopenshell?label=PyPI&color=006dad)](https://pypi.org/project/ifcopenshell/) [![Anaconda](https://img.shields.io/conda/vn/conda-forge/ifcopenshell?label=Anaconda&color=43b02a)](https://anaconda.org/conda-forge/ifcopenshell) [![Anaconda](https://img.shields.io/conda/vn/ifcopenshell/ifcopenshell?label=Anaconda-Unstable&color=43b02a)](https://anaconda.org/ifcopenshell/ifcopenshell) [![Docker](https://img.shields.io/docker/pulls/aecgeeks/ifcopenshell?label=Docker&color=1D63ED)](https://hub.docker.com/r/aecgeeks/ifcopenshell) [![AUR](https://img.shields.io/aur/version/ifcopenshell?label=AUR&color=1793d1)](https://aur.archlinux.org/packages/ifcopenshell) [![AUR Unstable](https://img.shields.io/aur/version/ifcopenshell-git?label=AUR-Unstable&color=1793d1)](https://aur.archlinux.org/packages/ifcopenshell-git) |
| ifcopenshell-python | Python library for IFC manipulation | LGPL-3.0-or-later\* | [![Official](https://img.shields.io/badge/IfcOpenShell.org-Download-70ba35)](https://docs.ifcopenshell.org/ifcopenshell-python/installation.html) [![GitHub](https://img.shields.io/github/v/release/ifcopenshell/ifcopenshell?filter=ifcopenshell-python-*&label=GitHub&color=f6f8fa)](https://github.com/IfcOpenShell/IfcOpenShell/releases?q=ifcopenshell-python&expanded=true) [![PyPI](https://img.shields.io/pypi/v/ifcopenshell?label=PyPI&color=006dad)](https://pypi.org/project/ifcopenshell/) [![Anaconda](https://img.shields.io/conda/vn/conda-forge/ifcopenshell?label=Anaconda&color=43b02a)](https://anaconda.org/conda-forge/ifcopenshell) [![Anaconda](https://img.shields.io/conda/vn/ifcopenshell/ifcopenshell?label=Anaconda-Unstable&color=43b02a)](https://anaconda.org/ifcopenshell/ifcopenshell) [![Docker](https://img.shields.io/docker/pulls/aecgeeks/ifcopenshell?label=Docker&color=1D63ED)](https://hub.docker.com/r/aecgeeks/ifcopenshell) [![AUR](https://img.shields.io/aur/version/ifcopenshell?label=AUR&color=1793d1)](https://aur.archlinux.org/packages/ifcopenshell) [![AUR Unstable](https://img.shields.io/aur/version/ifcopenshell-git?label=AUR-Unstable&color=1793d1)](https://aur.archlinux.org/packages/ifcopenshell-git) |
| ifcpatch | Utility to run pre-packaged scripts to manipulate IFCs | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifcpatch?label=PyPI&color=006dad)](https://pypi.org/project/ifcpatch/) |
| ifcsverchok | Blender Add-on for visual node programming with IFC | GPL-3.0-or-later | [![GitHub Unstable](https://img.shields.io/github/v/release/ifcopenshell/ifcopenshell?filter=ifcsverchok-*.*.*.*&label=GitHub-Unstable&color=f6f8fa)](https://github.com/IfcOpenShell/IfcOpenShell/releases?q=ifcsverchok&expanded=true)
| ifctester | Library, CLI and webapp for IDS model auditing | LGPL-3.0-or-later | [![PyPI](https://img.shields.io/pypi/v/ifctester?label=PyPI&color=006dad)](https://pypi.org/project/ifctester/) |
+1 -1
View File
@@ -1 +1 @@
0.7.10
0.7.11
@@ -15,7 +15,7 @@
<licenseUrl>https://github.com/IfcOpenShell/IfcOpenShell/blob/v0.8.0/COPYING</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/IfcOpenShell/IfcOpenShell</projectSourceUrl>
<docsUrl>https://docs.blenderbim.org/</docsUrl>
<docsUrl>https://docs.bonsaibim.org/</docsUrl>
<!--<mailingListUrl></mailingListUrl>-->
<bugTrackerUrl>https://github.com/IfcOpenShell/IfcOpenShell/issues</bugTrackerUrl>
<tags>blender bim blenderbim ifc python opensource foss</tags>

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

@@ -14,9 +14,11 @@ import os
import pathlib
import re
from urllib import request
from github import Github
from typing import NoReturn
def get_repo_tag_names():
def get_repo_tag_names() -> list[str]:
git_return = os.popen("git tag -l").read()
tag_names = [tag_name for tag_name in git_return.split("\n") if tag_name]
print(f"{len(tag_names)} tag_names found in repo")
@@ -43,7 +45,7 @@ def get_latest_choco_blender_version() -> list:
return re.findall(RE_BLENDER_VERSION_MIN_MAJ_PAT, html_txt)
def get_file_sha256_hash(file_path):
def get_file_sha256_hash(file_path: str) -> str:
BLOCKSIZE = 65536
hasher = hashlib.sha256()
@@ -56,16 +58,29 @@ def get_file_sha256_hash(file_path):
return hasher.hexdigest()
def quit_with_error_message(message: str):
def quit_with_error_message(message: str) -> NoReturn:
print(f"ERROR: {message}")
quit(0)
def get_release_zip(tag: str) -> tuple[str, str]:
g = Github()
repo = g.get_repo("IfcOpenShell/IfcOpenShell")
release = repo.get_release(tag)
for asset in release.get_assets():
asset_name = asset.name
if python_version not in asset_name:
continue
if TARGET_OS not in asset_name:
continue
return (asset_name, asset.browser_download_url)
raise Exception(f"Couldn't find the release matching '{python_version}' and '{TARGET_OS}' in tag '{tag}'.")
start = datetime.datetime.now()
URL_CHOCO_PACKAGE = "https://community.chocolatey.org/packages/blender"
URL_BLENDER_CMAKE = "https://raw.githubusercontent.com/blender/blender/{}/build_files/cmake/Modules/FindPythonLibsUnix.cmake"
URL_IFCOS_RELEASES = "https://github.com/IfcOpenShell/IfcOpenShell/releases/download/"
RE_BLENDER_VERSION_MIN_MAJ = r"Latest Version.+<span>Blender (\d+\.\d+)\..+</span>"
RE_BLENDER_VERSION_MIN_MAJ_PAT = r"Latest Version.+<span>Blender (\d+\.\d+\.\d+)</span>"
RE_BLENDER_PYTHON_VERSION_MAJ_MIN = r"\(_PYTHON_VERSION_SUPPORTED (\d+\.\d+)\)"
@@ -79,7 +94,7 @@ os.chdir(BLENDERBIM_DIR)
blenderbim_date_yesterday = (datetime.datetime.now() - datetime.timedelta(days=1)).strftime("%y%m%d")
should_release = False
target_release_tag = ""
target_os = "win"
TARGET_OS = "windows-x64"
git_status = os.popen("git status").read()
print(git_status)
@@ -130,10 +145,7 @@ print(f"{python_version=}")
blenderbim_build_version = target_release_tag.replace("blenderbim-", "")
# url_blenderbim_py3x_win_zip
release_zip_file_name = f"{target_release_tag}-{python_version}-{target_os}.zip"
# download release
url_blenderbim_py3x_win_zip = f"{URL_IFCOS_RELEASES}{target_release_tag}/{release_zip_file_name}"
release_zip_file_name, url_blenderbim_py3x_win_zip = get_release_zip(target_release_tag)
os.popen(f"wget {url_blenderbim_py3x_win_zip} --no-verbose").read()
# sha256sum_blenderbim_py310_win_zip
+4 -3
View File
@@ -221,10 +221,11 @@ endif()
if(GLTF_SUPPORT OR CITYJSON_SUPPORT)
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
find_file(json_hpp "json.hpp" ${JSON_INCLUDE_DIR}/nlohmann)
find_path(json_header_path "nlohmann/json.hpp" HINTS ${JSON_INCLUDE_DIR})
set(JSON_INCLUDE_DIR ${json_header_path})
if(json_hpp)
message(STATUS "JSON for Modern C++ header file found")
if(json_header_path)
message(STATUS "JSON for Modern C++ header file found in ${JSON_INCLUDE_DIR}")
else()
message(FATAL_ERROR "Unable to find JSON for Modern C++ header file, aborting")
endif()
+8 -8
View File
@@ -76,14 +76,14 @@ about:
For more information, see:
* [IfcOpenShell Website](http://ifcopenshell.org)
* [IfcOpenShell Documentation](http://blenderbim.org/docs-python)
* [IfcOpenShell C++ Installation](https://blenderbim.org/docs-python/ifcopenshell/installation.html)
* [IfcOpenShell Python Installation](https://blenderbim.org/docs-python/ifcopenshell-python/installation.html)
* [IfcOpenShell Python Hello World Tutorial](https://blenderbim.org/docs-python/ifcopenshell-python/hello_world.html)
* [BlenderBIM Add-on Website](https://blenderbim.org)
* [BlenderBIM Add-on Documentation](http://blenderbim.org/docs)
* [Add-on Installation](https://blenderbim.org/docs/users/installation.html)
* [Exploring an IFC model](https://blenderbim.org/docs/users/exploring_an_ifc_model.html)
* [IfcOpenShell Documentation](http://bonsaibim.org/docs-python)
* [IfcOpenShell C++ Installation](https://bonsaibim.org/docs-python/ifcopenshell/installation.html)
* [IfcOpenShell Python Installation](https://bonsaibim.org/docs-python/ifcopenshell-python/installation.html)
* [IfcOpenShell Python Hello World Tutorial](https://bonsaibim.org/docs-python/ifcopenshell-python/hello_world.html)
* [Bonsai Website](https://bonsaibim.org)
* [Bonsai Documentation](http://bonsaibim.org/docs)
* [Add-on Installation](https://bonsaibim.org/docs/users/installation.html)
* [Exploring an IFC model](https://bonsaibim.org/docs/users/exploring_an_ifc_model.html)
<table>
<thead>
+1 -1
View File
@@ -81,7 +81,7 @@ ADD_COMMIT_SHA = os.getenv("ADD_COMMIT_SHA")
PYTHON_VERSIONS = ["3.9.11", "3.10.3", "3.11.8", "3.12.1"]
JSON_VERSION = "v3.6.1"
OCE_VERSION = "0.18.3"
OCCT_VERSION = "7.7.1"
OCCT_VERSION = "7.5.3"
BOOST_VERSION = "1.80.0"
PCRE_VERSION = "8.41"
LIBXML2_VERSION = "2.9.11"
+29
View File
@@ -1,5 +1,34 @@
[tool.black]
line-length = 120
include = '''
src/(
bcf
|bcfserver
|blenderbim
|bsdd
|foundationserver
|ifc2ca
|ifc4d
|ifc5d
|ifcbimtester
|ifcblender
|ifccityjson
|ifcclash
|ifccsv
|ifcdiff
|ifcfm
|ifcpatch
|ifctester
|ifcopenshell-python
|ifcsverchok
|opencdeserver
)/.*.py$
'''
extend-exclude = '''
src/ifcopenshell-python/ifcopenshell/express/*
|src/ifcopenshell-python/ifcopenshell/mvd/*
|src/ifc2ca/templates/*
'''
[tool.pyright]
reportInvalidTypeForm = false
+7 -17
View File
@@ -16,11 +16,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with BCF. If not, see <http://www.gnu.org/licenses/>.
VERSION:=$(shell cat ../../VERSION)
SED:=sed -i
ifeq ($(UNAME_S),Darwin)
SED:=sed -i '' -e
endif
PACKAGE_NAME:=bcf
include ../common.mk
.PHONY: ci
ci:
@@ -33,19 +30,12 @@ license:
# TODO: make this based on xsd file presence
.PHONY: models
models:
cd src && xsdata generate -p bcf.v2.model --unnest-classes --kw-only --slots -ds Google bcf/v2/xsd
cd src && xsdata generate -p bcf.v3.model --unnest-classes --kw-only --slots -ds Google bcf/v3/xsd
xsdata generate -p bcf.v2.model --unnest-classes --kw-only --slots -ds Google bcf/v2/xsd
xsdata generate -p bcf.v3.model --unnest-classes --kw-only --slots -ds Google bcf/v3/xsd
.PHONY: dist
dist:
rm -rf dist
cp pyproject.toml pyproject.toml.bak
cp src/bcf/__init__.py __init__.py.bak
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' pyproject.toml
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' src/bcf/__init__.py
python -m build
mv pyproject.toml.bak pyproject.toml
mv __init__.py.bak src/bcf/__init__.py
.PHONY: test
test:
pytest -p no:pytest-blender tests
# .PHONY
# api:
+4
View File
@@ -3,3 +3,7 @@
A simple Python implementation of the BCF standard. Manipulation of BCF-XML is
available via `bcfxml.py` and manipulation of BCF-API is available via
`bcfapi.py`.
Python files in 'model' folder are automatically generated from .xsd files (located in 'xsd' folder).
To regenerate them you can use `make models`.
The only exception is 'v2/model/extensions.py', see it's note for the details.
+28
View File
@@ -0,0 +1,28 @@
import bcf.v2.model.extensions
import bcf.v3.model.extensions
from typing import NamedTuple, Union
from dataclasses import fields
class AttributeData(NamedTuple):
attr_type: type
subattr_name: str
subattr_xsd_name: str
Extensions = Union[bcf.v2.model.extensions.Extensions, bcf.v3.model.extensions.Extensions]
def get_extensions_attributes(extensions: Extensions) -> dict[str, AttributeData]:
"""Return mapping of xsd attribute name to a tuple that consists of:
- Extensions attribute name
- Extensions attribute type type
- subattribute name"""
possible_attributes = {}
for field in fields(type(extensions)):
field_type = field.type.__args__[0] # type: ignore [reportAttributeAccessIssue]
subfield = next(iter(fields(field_type)))
xsd_name = subfield.metadata["name"]
possible_attributes[field.name] = AttributeData(field_type, subfield.name, xsd_name)
return possible_attributes
+10
View File
@@ -0,0 +1,10 @@
import bcf.v2.model
import bcf.v3.model
from typing import Union
BimSnippet = Union[bcf.v2.model.BimSnippet, bcf.v3.model.BimSnippet]
BitMap = Union[bcf.v2.model.VisualizationInfoBitmap, bcf.v3.model.Bitmap]
DocumentReference = Union[bcf.v2.model.TopicDocumentReference, bcf.v3.model.DocumentReference]
HeaderFile = Union[bcf.v2.model.HeaderFile, bcf.v3.model.File]
Topic = Union[bcf.v2.model.Topic, bcf.v3.model.Topic]
ViewPoint = Union[bcf.v2.model.ViewPoint, bcf.v3.model.ViewPoint]
+101
View File
@@ -0,0 +1,101 @@
import tempfile
import bcf.v2.bcfxml
import bcf.v2.model
import bcf.v2.topic
import bcf.v3.bcfxml
import bcf.v3.model
import bcf.v3.topic
import bcf.agnostic.model as mdl
from pathlib import Path
from typing import Union, Optional
from typing_extensions import assert_never
TopicHandler = Union[bcf.v2.topic.TopicHandler, bcf.v3.topic.TopicHandler]
def extract_file(
topic: TopicHandler,
entity: Union[mdl.HeaderFile, mdl.BimSnippet, mdl.DocumentReference, mdl.BitMap],
bcfxml: Optional[Union[bcf.v2.bcfxml.BcfXml, bcf.v3.bcfxml.BcfXml]] = None,
outfile: Optional[Path] = None,
) -> Union[Path, str, None]:
"""Extracts an element with a file into a temporary directory
These include header files, bim snippets, document references, and
viewpoint bitmaps. External reference are not downloaded. Instead, the
URI reference is returned.
:param entity: The entity with a file reference to extract
:param outfile: If provided, save the header file to that location.
Otherwise, a temporary directory is created and the filename is
derived from the header's original filename.
:param bcfxml: The BCF XML file to use for resolving document references files.
Required only for BCF v3 document references (in BCF v3 internal documents
are stored at BCF root, not in the topic).
:return: The filepath of the extracted file. It may be a URL if the
header file is external.
"""
if isinstance(entity, mdl.DocumentReference):
if isinstance(entity, bcf.v2.model.TopicDocumentReference):
reference = entity.referenced_document
else:
reference = entity.document_guid
else:
reference = entity.reference
if not reference:
return None
# For v3 document references external documents are detected by empty document_guid.
# External bitmaps are not supported by bcf.
if not isinstance(entity, (bcf.v3.model.DocumentReference, mdl.BitMap)) and entity.is_external:
return reference
if isinstance(entity, bcf.v3.model.DocumentReference):
# Extract document reference filename and contents.
if not bcfxml:
raise TypeError("bcfxml is required for BCF v3 document references.")
assert isinstance(bcfxml, bcf.v3.bcfxml.BcfXml)
error_msg = f"BCF XML is missing document with guid '{reference}'."
if not bcfxml.documents:
raise Exception(error_msg)
definition_docs = bcfxml.documents.definition.documents
if not definition_docs:
raise Exception(error_msg)
docs = next((doc for doc in definition_docs.document if doc.guid == reference), None)
if not docs:
raise Exception(error_msg)
filename = docs.filename
bytes_data = bcfxml.documents.documents[filename]
else:
if isinstance(entity, mdl.BimSnippet):
bytes_data = topic.bim_snippet
assert isinstance(bytes_data, bytes)
elif isinstance(entity, mdl.HeaderFile):
bytes_data = topic.reference_files[reference]
elif isinstance(entity, mdl.BitMap):
bytes_data = next(
byte_data
for vp in topic.viewpoints.values()
for data_reference, byte_data in vp.bitmaps.items()
if data_reference == reference
)
elif isinstance(entity, bcf.v2.model.TopicDocumentReference):
assert isinstance(topic, bcf.v2.topic.TopicHandler)
bytes_data = topic.document_references[reference]
else:
assert_never(entity)
# We don't really need it if 'outfile' is None, just keeping type checker happy.
if isinstance(entity, mdl.HeaderFile) and entity.filename:
filename = entity.filename
else:
filename = Path(reference).name
if not outfile:
outfile = Path(tempfile.mkdtemp()) / filename
with open(outfile, "wb") as f:
f.write(bytes_data)
return outfile
+5
View File
@@ -0,0 +1,5 @@
import bcf.v2.visinfo
import bcf.v3.visinfo
from typing import Union
VisualizationInfoHandler = Union[bcf.v2.visinfo.VisualizationInfoHandler, bcf.v3.visinfo.VisualizationInfoHandler]
@@ -18,6 +18,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with BCF. If not, see <http://www.gnu.org/licenses/>.
"""
import zipfile
from pathlib import Path
from typing import Optional, Union
@@ -29,9 +30,10 @@ from bcf.v3.model import Version as Version3
from bcf.xml_parser import AbstractXmlParserSerializer, XmlParserSerializer
def load(
filepath: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None
) -> Optional[Union[BcfXml2, BcfXml3]]:
BcfXml = Union[BcfXml2, BcfXml3]
def load(filepath: Path, xml_handler: Optional[AbstractXmlParserSerializer] = None) -> Optional[BcfXml]:
"""
Load a BCF file.
@@ -5,8 +5,8 @@ from numpy.typing import NDArray
def camera_vectors_from_element_placement(
elem_placement: NDArray[np.float_],
) -> tuple[NDArray[np.float_], NDArray[np.float_], NDArray[np.float_]]:
elem_placement: NDArray[np.float64],
) -> tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]:
"""
Calculate the vectors of a camera pointing to an element.
@@ -21,8 +21,8 @@ def camera_vectors_from_element_placement(
def camera_vectors_from_target_position(
target_position: NDArray[np.float_], offset: Optional[NDArray[np.float_]] = None
) -> tuple[NDArray[np.float_], NDArray[np.float_], NDArray[np.float_]]:
target_position: NDArray[np.float64], offset: Optional[NDArray[np.float64]] = None
) -> tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.float64]]:
"""
Calculate the vectors of a camera pointing to a target point.
@@ -50,7 +50,7 @@ def camera_vectors_from_target_position(
# return camera_position, -mat[:3, 2], mat[:3, 1]
def unit_vector(v: NDArray[np.float_]) -> NDArray[np.float_]:
def unit_vector(v: NDArray[np.float64]) -> NDArray[np.float64]:
"""
Return the unit vector of a vector.
@@ -5,6 +5,7 @@ Copyright (c) 2017-2020 Anthon van der Neut, Ruamel bvba
original idea from https://stackoverflow.com/a/19722365/1307905
"""
import zipfile
from io import BytesIO
from os import PathLike
@@ -13,8 +14,7 @@ from typing import Any, Optional, Protocol
class ZipFileInterface(Protocol):
def writestr(self, filename_in_zip: str | zipfile.ZipInfo, file_contents: bytes | str) -> None:
...
def writestr(self, filename_in_zip: str | zipfile.ZipInfo, file_contents: bytes | str) -> None: ...
class InMemoryZipFile:
@@ -1,11 +1,14 @@
"""BCF XML V2 handler."""
import uuid
import warnings
import zipfile
from pathlib import Path
from typing import Any, NoReturn, Optional, TypeVar
import bcf.agnostic.extensions
import bcf.v2.model as mdl
import bcf.v2.model.extensions as mdl_extensions
from bcf.inmemory_zipfile import InMemoryZipFile, ZipFileInterface
from bcf.v2.topic import TopicHandler
from bcf.xml_parser import AbstractXmlParserSerializer, XmlParserSerializer
@@ -23,7 +26,8 @@ class BcfXml:
self._xml_handler = xml_handler or XmlParserSerializer()
self._version: Optional[mdl.Version] = None
self._project_info: Optional[mdl.ProjectExtension] = None
self._topics: dict[str, TopicHandler] = {}
self._extensions: Optional[mdl_extensions.Extensions] = None
self._topics: Optional[dict[str, TopicHandler]] = None
self._extension_schema: Optional[bytes] = None
self._zip_file = self._load_zip_file()
@@ -84,24 +88,63 @@ class BcfXml:
def extension_schema(self, value: bytes) -> None:
self._extension_schema = value
@property
def extensions(self) -> Optional[mdl_extensions.Extensions]:
"""BCF extensions."""
if not self._extensions and self.extension_schema:
import io
from xml.etree import ElementTree as etree
extensions = mdl_extensions.Extensions()
xs = "{http://www.w3.org/2001/XMLSchema}"
root = etree.parse(io.BytesIO((self.extension_schema)))
attrs = bcf.agnostic.extensions.get_extensions_attributes(extensions)
xsd_to_attrs = {v.subattr_xsd_name: k for k, v in attrs.items()}
for node in root.findall(f".//{xs}restriction"):
attr_type = node.attrib.get("base")
if not attr_type:
continue
attr_name = xsd_to_attrs.get(attr_type)
if attr_name is None:
continue
values = []
for enum in node.findall(f".//{xs}enumeration"):
values.append(enum.attrib["value"])
if not values:
continue
attr_data = attrs[attr_name]
attr = attr_data.attr_type()
setattr(attr, attr_data.subattr_name, values)
setattr(extensions, attr_name, attr)
self._extensions = extensions
return self._extensions
@extensions.setter
def extensions(self, value: Optional[mdl_extensions.Extensions]) -> None:
self._extensions = value
@property
def topics(self) -> dict[str, TopicHandler]:
"""BCF topics."""
if not self._topics and self._zip_file:
self._topics = self._load_topics(self._zip_file, self._xml_handler)
if self._topics is None:
self._topics = self._load_topics()
return self._topics
def _load_topics(
self, zip_file: zipfile.ZipFile, xml_handler: AbstractXmlParserSerializer
) -> dict[str, TopicHandler]:
def _load_topics(self) -> dict[str, TopicHandler]:
topics = {}
for topic_dir in zipfile.Path(zip_file).iterdir():
if self._zip_file is None:
return topics
for topic_dir in zipfile.Path(self._zip_file).iterdir():
if not topic_dir.is_dir():
continue
markup_path = topic_dir.joinpath("markup.bcf")
if not markup_path.exists():
continue
topics[topic_dir.name] = TopicHandler(topic_dir, xml_handler)
topics[topic_dir.name] = TopicHandler(topic_dir, self._xml_handler)
return topics
@classmethod
+197
View File
@@ -0,0 +1,197 @@
# NOTE: This file is not generated from
# https://github.com/buildingSMART/BCF-XML/blob/release_2_1/Extension%20Schemas/extensions.xsd
# because in bcf 2.1 there is no extensions.xml - I guess, the schema assumes that each .bcf
# will use their own schema patched by it's own extensions.xsd.
#
# To make things simpler we just mimic extensions structures from bcf 3, so they'll have common API,
# and parse extensions.xsd inside .bcf as .xml and fill our structures.
#
# Preferably if we could generate some kind of extensions.xml from extensions.xsd
# and leave all the handling to xsdata.
#
# We also don't add it to __init__.py not to mess with generator.
#
# Currently extensions support for v2 is only read-only.
from dataclasses import dataclass, field, fields
from typing import List, NamedTuple, Optional
@dataclass(slots=True, kw_only=True)
class ExtensionsPriorities:
class Meta:
global_type = False
priority: List[str] = field(
default_factory=list,
metadata={
"name": "Priority",
"type": "Element",
"namespace": "",
"min_length": 1,
"white_space": "collapse",
},
)
@dataclass(slots=True, kw_only=True)
class ExtensionsSnippetTypes:
class Meta:
global_type = False
snippet_type: List[str] = field(
default_factory=list,
metadata={
"name": "SnippetType",
"type": "Element",
"namespace": "",
"min_length": 1,
"white_space": "collapse",
},
)
@dataclass(slots=True, kw_only=True)
class ExtensionsStages:
class Meta:
global_type = False
stage: List[str] = field(
default_factory=list,
metadata={
"name": "Stage",
"type": "Element",
"namespace": "",
"min_length": 1,
"white_space": "collapse",
},
)
@dataclass(slots=True, kw_only=True)
class ExtensionsTopicLabels:
class Meta:
global_type = False
topic_label: List[str] = field(
default_factory=list,
metadata={
"name": "TopicLabel",
"type": "Element",
"namespace": "",
"min_length": 1,
"white_space": "collapse",
},
)
@dataclass(slots=True, kw_only=True)
class ExtensionsTopicStatuses:
class Meta:
global_type = False
topic_status: List[str] = field(
default_factory=list,
metadata={
"name": "TopicStatus",
"type": "Element",
"namespace": "",
"min_length": 1,
"white_space": "collapse",
},
)
@dataclass(slots=True, kw_only=True)
class ExtensionsTopicTypes:
class Meta:
global_type = False
topic_type: List[str] = field(
default_factory=list,
metadata={
"name": "TopicType",
"type": "Element",
"namespace": "",
"min_length": 1,
"white_space": "collapse",
},
)
@dataclass(slots=True, kw_only=True)
class ExtensionsUsers:
class Meta:
global_type = False
user: List[str] = field(
default_factory=list,
metadata={
"name": "UserIdType",
"type": "Element",
"namespace": "",
"min_length": 1,
"white_space": "collapse",
},
)
@dataclass(slots=True, kw_only=True)
class Extensions:
topic_types: Optional[ExtensionsTopicTypes] = field(
default=None,
metadata={
"name": "TopicTypes",
"type": "Element",
"namespace": "",
},
)
topic_statuses: Optional[ExtensionsTopicStatuses] = field(
default=None,
metadata={
"name": "TopicStatuses",
"type": "Element",
"namespace": "",
},
)
priorities: Optional[ExtensionsPriorities] = field(
default=None,
metadata={
"name": "Priorities",
"type": "Element",
"namespace": "",
},
)
topic_labels: Optional[ExtensionsTopicLabels] = field(
default=None,
metadata={
"name": "TopicLabels",
"type": "Element",
"namespace": "",
},
)
users: Optional[ExtensionsUsers] = field(
default=None,
metadata={
"name": "Users",
"type": "Element",
"namespace": "",
},
)
snippet_types: Optional[ExtensionsSnippetTypes] = field(
default=None,
metadata={
"name": "SnippetTypes",
"type": "Element",
"namespace": "",
},
)
stages: Optional[ExtensionsStages] = field(
default=None,
metadata={
"name": "Stages",
"type": "Element",
"namespace": "",
},
)
@@ -34,7 +34,7 @@ class BimSnippet:
metadata={
"name": "isExternal",
"type": "Attribute",
}
},
)
@@ -64,7 +64,7 @@ class HeaderFile:
"name": "Filename",
"type": "Element",
"namespace": "",
}
},
)
date: Optional[XmlDateTime] = field(
default=None,
@@ -72,7 +72,7 @@ class HeaderFile:
"name": "Date",
"type": "Element",
"namespace": "",
}
},
)
reference: Optional[str] = field(
default=None,
@@ -80,7 +80,7 @@ class HeaderFile:
"name": "Reference",
"type": "Element",
"namespace": "",
}
},
)
ifc_project: Optional[str] = field(
default=None,
@@ -89,7 +89,7 @@ class HeaderFile:
"type": "Attribute",
"length": 22,
"pattern": r"[0-9,A-Z,a-z,_$]*",
}
},
)
ifc_spatial_structure_element: Optional[str] = field(
default=None,
@@ -98,14 +98,14 @@ class HeaderFile:
"type": "Attribute",
"length": 22,
"pattern": r"[0-9,A-Z,a-z,_$]*",
}
},
)
is_external: bool = field(
default=True,
metadata={
"name": "isExternal",
"type": "Attribute",
}
},
)
@@ -120,7 +120,7 @@ class TopicDocumentReference:
"name": "ReferencedDocument",
"type": "Element",
"namespace": "",
}
},
)
description: Optional[str] = field(
default=None,
@@ -128,7 +128,7 @@ class TopicDocumentReference:
"name": "Description",
"type": "Element",
"namespace": "",
}
},
)
guid: Optional[str] = field(
default=None,
@@ -136,14 +136,14 @@ class TopicDocumentReference:
"name": "Guid",
"type": "Attribute",
"pattern": r"[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}",
}
},
)
is_external: bool = field(
default=False,
metadata={
"name": "isExternal",
"type": "Attribute",
}
},
)
@@ -170,7 +170,7 @@ class ViewPoint:
"name": "Viewpoint",
"type": "Element",
"namespace": "",
}
},
)
snapshot: Optional[str] = field(
default=None,
@@ -178,7 +178,7 @@ class ViewPoint:
"name": "Snapshot",
"type": "Element",
"namespace": "",
}
},
)
index: Optional[int] = field(
default=None,
@@ -186,7 +186,7 @@ class ViewPoint:
"name": "Index",
"type": "Element",
"namespace": "",
}
},
)
guid: str = field(
metadata={
@@ -230,7 +230,7 @@ class Comment:
"name": "Viewpoint",
"type": "Element",
"namespace": "",
}
},
)
modified_date: Optional[XmlDateTime] = field(
default=None,
@@ -238,7 +238,7 @@ class Comment:
"name": "ModifiedDate",
"type": "Element",
"namespace": "",
}
},
)
modified_author: Optional[str] = field(
default=None,
@@ -246,7 +246,7 @@ class Comment:
"name": "ModifiedAuthor",
"type": "Element",
"namespace": "",
}
},
)
guid: str = field(
metadata={
@@ -267,7 +267,7 @@ class Header:
"type": "Element",
"namespace": "",
"min_occurs": 1,
}
},
)
@@ -279,7 +279,7 @@ class Topic:
"name": "ReferenceLink",
"type": "Element",
"namespace": "",
}
},
)
title: str = field(
metadata={
@@ -295,7 +295,7 @@ class Topic:
"name": "Priority",
"type": "Element",
"namespace": "",
}
},
)
index: Optional[int] = field(
default=None,
@@ -303,7 +303,7 @@ class Topic:
"name": "Index",
"type": "Element",
"namespace": "",
}
},
)
labels: List[str] = field(
default_factory=list,
@@ -311,7 +311,7 @@ class Topic:
"name": "Labels",
"type": "Element",
"namespace": "",
}
},
)
creation_date: XmlDateTime = field(
metadata={
@@ -335,7 +335,7 @@ class Topic:
"name": "ModifiedDate",
"type": "Element",
"namespace": "",
}
},
)
modified_author: Optional[str] = field(
default=None,
@@ -343,7 +343,7 @@ class Topic:
"name": "ModifiedAuthor",
"type": "Element",
"namespace": "",
}
},
)
due_date: Optional[XmlDateTime] = field(
default=None,
@@ -351,7 +351,7 @@ class Topic:
"name": "DueDate",
"type": "Element",
"namespace": "",
}
},
)
assigned_to: Optional[str] = field(
default=None,
@@ -359,7 +359,7 @@ class Topic:
"name": "AssignedTo",
"type": "Element",
"namespace": "",
}
},
)
stage: Optional[str] = field(
default=None,
@@ -367,7 +367,7 @@ class Topic:
"name": "Stage",
"type": "Element",
"namespace": "",
}
},
)
description: Optional[str] = field(
default=None,
@@ -375,7 +375,7 @@ class Topic:
"name": "Description",
"type": "Element",
"namespace": "",
}
},
)
bim_snippet: Optional[BimSnippet] = field(
default=None,
@@ -383,7 +383,7 @@ class Topic:
"name": "BimSnippet",
"type": "Element",
"namespace": "",
}
},
)
document_reference: List[TopicDocumentReference] = field(
default_factory=list,
@@ -391,7 +391,7 @@ class Topic:
"name": "DocumentReference",
"type": "Element",
"namespace": "",
}
},
)
related_topic: List[TopicRelatedTopic] = field(
default_factory=list,
@@ -399,7 +399,7 @@ class Topic:
"name": "RelatedTopic",
"type": "Element",
"namespace": "",
}
},
)
guid: str = field(
metadata={
@@ -414,14 +414,14 @@ class Topic:
metadata={
"name": "TopicType",
"type": "Attribute",
}
},
)
topic_status: Optional[str] = field(
default=None,
metadata={
"name": "TopicStatus",
"type": "Attribute",
}
},
)
@@ -433,7 +433,7 @@ class Markup:
"name": "Header",
"type": "Element",
"namespace": "",
}
},
)
topic: Topic = field(
metadata={
@@ -449,7 +449,7 @@ class Markup:
"name": "Comment",
"type": "Element",
"namespace": "",
}
},
)
viewpoints: List[ViewPoint] = field(
default_factory=list,
@@ -457,5 +457,5 @@ class Markup:
"name": "Viewpoints",
"type": "Element",
"namespace": "",
}
},
)
@@ -10,7 +10,7 @@ class Project:
"name": "Name",
"type": "Element",
"namespace": "",
}
},
)
project_id: str = field(
metadata={
@@ -29,7 +29,7 @@ class ProjectExtension:
"name": "Project",
"type": "Element",
"namespace": "",
}
},
)
extension_schema: str = field(
metadata={
@@ -10,12 +10,12 @@ class Version:
"name": "DetailedVersion",
"type": "Element",
"namespace": "",
}
},
)
version_id: Optional[str] = field(
default=None,
metadata={
"name": "VersionId",
"type": "Attribute",
}
},
)
@@ -15,14 +15,14 @@ class Component:
metadata={
"name": "OriginatingSystem",
"type": "Element",
}
},
)
authoring_tool_id: Optional[str] = field(
default=None,
metadata={
"name": "AuthoringToolId",
"type": "Element",
}
},
)
ifc_guid: Optional[str] = field(
default=None,
@@ -31,7 +31,7 @@ class Component:
"type": "Attribute",
"length": 22,
"pattern": r"[0-9,A-Z,a-z,_$]*",
}
},
)
@@ -92,21 +92,21 @@ class ViewSetupHints:
metadata={
"name": "SpacesVisible",
"type": "Attribute",
}
},
)
space_boundaries_visible: Optional[bool] = field(
default=None,
metadata={
"name": "SpaceBoundariesVisible",
"type": "Attribute",
}
},
)
openings_visible: Optional[bool] = field(
default=None,
metadata={
"name": "OpeningsVisible",
"type": "Attribute",
}
},
)
@@ -139,7 +139,7 @@ class ComponentColoringColor:
"name": "Component",
"type": "Element",
"min_occurs": 1,
}
},
)
color: Optional[str] = field(
default=None,
@@ -147,7 +147,7 @@ class ComponentColoringColor:
"name": "Color",
"type": "Attribute",
"pattern": r"[0-9,a-f,A-F]{6}([0-9,a-f,A-F]{2})?",
}
},
)
@@ -159,7 +159,7 @@ class ComponentSelection:
"name": "Component",
"type": "Element",
"min_occurs": 1,
}
},
)
@@ -174,7 +174,7 @@ class ComponentVisibilityExceptions:
"name": "Component",
"type": "Element",
"min_occurs": 1,
}
},
)
@@ -205,6 +205,7 @@ class OrthogonalCamera:
camera_up_vector:
view_to_world_scale: view's visible size in meters
"""
camera_view_point: Point = field(
metadata={
"name": "CameraViewPoint",
@@ -247,6 +248,7 @@ class PerspectiveCamera:
release and viewers should be expect values outside this
range in current implementations.
"""
camera_view_point: Point = field(
metadata={
"name": "CameraViewPoint",
@@ -336,7 +338,7 @@ class ComponentColoring:
"name": "Color",
"type": "Element",
"min_occurs": 1,
}
},
)
@@ -347,14 +349,14 @@ class ComponentVisibility:
metadata={
"name": "Exceptions",
"type": "Element",
}
},
)
default_visibility: Optional[bool] = field(
default=None,
metadata={
"name": "DefaultVisibility",
"type": "Attribute",
}
},
)
@@ -368,7 +370,7 @@ class VisualizationInfoClippingPlanes:
metadata={
"name": "ClippingPlane",
"type": "Element",
}
},
)
@@ -383,7 +385,7 @@ class VisualizationInfoLines:
"name": "Line",
"type": "Element",
"min_occurs": 1,
}
},
)
@@ -394,14 +396,14 @@ class Components:
metadata={
"name": "ViewSetupHints",
"type": "Element",
}
},
)
selection: Optional[ComponentSelection] = field(
default=None,
metadata={
"name": "Selection",
"type": "Element",
}
},
)
visibility: ComponentVisibility = field(
metadata={
@@ -415,7 +417,7 @@ class Components:
metadata={
"name": "Coloring",
"type": "Element",
}
},
)
@@ -424,47 +426,48 @@ class VisualizationInfo:
"""
VisualizationInfo documentation.
"""
components: Optional[Components] = field(
default=None,
metadata={
"name": "Components",
"type": "Element",
}
},
)
orthogonal_camera: Optional[OrthogonalCamera] = field(
default=None,
metadata={
"name": "OrthogonalCamera",
"type": "Element",
}
},
)
perspective_camera: Optional[PerspectiveCamera] = field(
default=None,
metadata={
"name": "PerspectiveCamera",
"type": "Element",
}
},
)
lines: Optional[VisualizationInfoLines] = field(
default=None,
metadata={
"name": "Lines",
"type": "Element",
}
},
)
clipping_planes: Optional[VisualizationInfoClippingPlanes] = field(
default=None,
metadata={
"name": "ClippingPlanes",
"type": "Element",
}
},
)
bitmap: List[VisualizationInfoBitmap] = field(
default_factory=list,
metadata={
"name": "Bitmap",
"type": "Element",
}
},
)
guid: str = field(
metadata={
@@ -1,10 +1,11 @@
"""BCF XML V2 Topic handler."""
import datetime
import tempfile
import uuid
import zipfile
from pathlib import Path
from typing import Any, NoReturn, Optional
from typing import Any, NoReturn, Optional, Union
import numpy as np
from ifcopenshell import entity_instance
@@ -26,9 +27,9 @@ class TopicHandler:
xml_handler: Optional[AbstractXmlParserSerializer] = None,
) -> None:
self._markup: Optional[mdl.Markup] = None
self._viewpoints: dict[str, VisualizationInfoHandler] = {}
self._reference_files: dict[str, bytes] = {}
self._document_references: dict[str, bytes] = {}
self._viewpoints: Optional[dict[str, VisualizationInfoHandler]] = None
self._reference_files: Optional[dict[str, bytes]] = None
self._document_references: Optional[dict[str, bytes]] = None
self._bim_snippet: Optional[bytes] = None
self._xml_handler = xml_handler or XmlParserSerializer()
self._topic_dir = topic_dir
@@ -62,11 +63,21 @@ class TopicHandler:
"""Return the header of the topic."""
return self.markup.header if self.markup else None
@header.setter
def header(self, header: mdl.Header) -> None:
"""Set the header of the topic."""
self.markup.header = header
@property
def comments(self) -> list[mdl.Comment]:
"""Return the comments of the topic."""
return self.markup.comment if self.markup else []
@comments.setter
def comments(self, comments: list[mdl.Comment]) -> None:
assert self.markup
self.markup.comment = comments
@property
def bim_snippet(self) -> Optional[bytes]:
if not self._bim_snippet and self._topic_dir:
@@ -79,14 +90,24 @@ class TopicHandler:
@property
def viewpoints(self) -> dict[str, VisualizationInfoHandler]:
if not self._viewpoints and self._topic_dir:
if self._viewpoints is None:
self._viewpoints = self._load_viewpoints()
return self._viewpoints
def _load_viewpoints(self) -> dict[str, VisualizationInfoHandler]:
if self._topic_dir and self.markup and (viewpoints := self.markup.viewpoints):
return VisualizationInfoHandler.from_topic_viewpoints(self._topic_dir, viewpoints)
return {}
@property
def reference_files(self) -> dict[str, bytes]:
if self._reference_files or not self.header:
if self._reference_files is not None:
return self._reference_files
self._reference_files = {}
if not self.header:
return self._reference_files
for ref in self.header.file:
if ref.is_external:
continue
@@ -98,8 +119,13 @@ class TopicHandler:
@property
def document_references(self) -> dict[str, bytes]:
if self._document_references or not self.topic:
if self._document_references is not None:
return self._document_references
self._document_references = {}
if not self.topic:
return self._document_references
for doc in self.topic.document_reference:
if doc.is_external or not doc.referenced_document:
continue
@@ -117,11 +143,6 @@ class TopicHandler:
return bim_snippet_path.read_bytes()
return None
def _load_viewpoints(self) -> dict[str, VisualizationInfoHandler]:
if self.markup and (viewpoints := self.markup.viewpoints):
return VisualizationInfoHandler.from_topic_viewpoints(self._topic_dir, viewpoints)
return {}
@classmethod
def create_new(
cls,
@@ -219,55 +240,7 @@ class TopicHandler:
real_path = real_path.parent if path_part == ".." else real_path.joinpath(path_part)
destination_zip.writestr(real_path.at, self.document_references[doc.referenced_document])
def extract_file(self, entity, outfile: Optional[Path] = None) -> Path:
"""Extracts an element with a file into a temporary directory
These include header files, bim snippets, document references, and
viewpoint bitmaps. External reference are not downloaded. Instead, the
URI reference is returned.
:param entity: The entity with a file reference to extract
:type entity: bcf.v2.model.HeaderFile,bcf.v2.model.BimSnippet,bcf.v2.model.TopicDocumentReference
:param outfile: If provided, save the header file to that location.
Otherwise, a temporary directory is created and the filename is
derived from the header's original filename.
:type outfile: pathlib.Path,optional
:return: The filepath of the extracted file. It may be a URL if the
header file is external.
:rtype: Path
"""
if hasattr(entity, "reference"):
reference = entity.reference
else:
reference = entity.referenced_document
if not reference:
return
if getattr(entity, "is_external", False):
return entity.reference
resolved_reference = self._topic_dir
for part in Path(reference).parts:
if part == "..":
resolved_reference = resolved_reference.parent
else:
resolved_reference = resolved_reference.joinpath(part)
if not outfile:
if getattr(entity, "filename", None):
filename = entity.filename
else:
filename = resolved_reference.name
outfile = Path(tempfile.mkdtemp()) / filename
with open(outfile, "wb") as f:
f.write(resolved_reference.read_bytes())
return outfile
def add_viewpoint(self, element: entity_instance) -> None:
def add_viewpoint(self, element: entity_instance) -> VisualizationInfoHandler:
"""Add a viewpoint pointed at the placement of an IFC element to the topic.
Args:
@@ -277,7 +250,9 @@ class TopicHandler:
self.add_visinfo_handler(new_viewpoint)
return new_viewpoint
def add_viewpoint_from_point_and_guids(self, position: NDArray[np.float_], *guids: str) -> None:
def add_viewpoint_from_point_and_guids(
self, position: NDArray[np.float64], *guids: str
) -> VisualizationInfoHandler:
"""Add a viewpoint pointing at an XYZ point in space
Args:
@@ -290,9 +265,17 @@ class TopicHandler:
self.add_visinfo_handler(vi_handler)
return vi_handler
def add_visinfo_handler(self, new_viewpoint: VisualizationInfoHandler) -> None:
def add_visinfo_handler(
self, new_viewpoint: VisualizationInfoHandler, snapshot_filename: Optional[str] = None
) -> mdl.ViewPoint:
self.viewpoints[new_viewpoint.guid + ".bcfv"] = new_viewpoint
self.markup.viewpoints.append(mdl.ViewPoint(viewpoint=new_viewpoint.guid + ".bcfv", guid=new_viewpoint.guid))
viewpoint = mdl.ViewPoint(
viewpoint=new_viewpoint.guid + ".bcfv",
snapshot=snapshot_filename,
guid=new_viewpoint.guid,
)
self.markup.viewpoints.append(viewpoint)
return viewpoint
def __eq__(self, other: object) -> bool | NoReturn:
return (
@@ -1,7 +1,6 @@
import uuid
import zipfile
from functools import lru_cache
from typing import Any, Iterable, Optional
from typing import Any, Iterable, Optional, Literal, Union
import numpy as np
from ifcopenshell import entity_instance
@@ -134,6 +133,15 @@ class VisualizationInfoHandler:
self._save_bitmaps(bcf_zip, topic_dir)
def _save_snapshot(self, bcf_zip: ZipFileInterface, topic_dir: str, filename: Optional[str]) -> None:
if bool(self.snapshot) ^ bool(filename):
data = ["data (VisualizationInfoHandler.snapshot)", "filename (ViewPoint.snapshot)"]
provided_data, missing_data = data if self.snapshot else data[::-1]
print(
f"WARNING. Snapshot with viewpoint guid '{self.guid}' won't be saved to bcf. "
f"Only snapshot {provided_data} is provided but snapshot {missing_data} is missing."
)
return
if self.snapshot and filename:
bcf_zip.writestr(f"{topic_dir}/{filename}", self.snapshot)
@@ -176,7 +184,7 @@ class VisualizationInfoHandler:
@classmethod
def create_from_point_and_guids(
cls,
position: NDArray[np.float_],
position: NDArray[np.float64],
*guids: str,
xml_handler: Optional[AbstractXmlParserSerializer] = None,
) -> "VisualizationInfoHandler":
@@ -196,13 +204,110 @@ class VisualizationInfoHandler:
visualization_info=build_viewpoint_from_position_and_guids(position, *guids), xml_handler=xml_handler
)
def get_selected_guids(self) -> Union[list[str], None]:
"""
Return viewpoint selected elements IFC guids.
Returns:
If viewpoint has no selection settings, return `None`.
Otherwise return a list of selected elements IFC guids.
"""
visualization_info = self.visualization_info
components = visualization_info.components
if not components:
return None
selection = components.selection
if not selection:
return None
return [guid for c in selection.component if (guid := c.ifc_guid)]
def set_selected_elements(self, elements: list[ifcopenshell.entity_instance]) -> None:
visualization_info = self.visualization_info
guids = [e.GlobalId for e in elements]
components = visualization_info.components
if not components:
visibility = mdl.ComponentVisibility(default_visibility=True)
components = mdl.Components(visibility=visibility)
visualization_info.components = components
selection = components.selection
components_list = [mdl.Component(ifc_guid=guid) for guid in guids]
if not selection:
selection = mdl.ComponentSelection()
components.selection = selection
selection.component = components_list
def set_visible_elements(self, elements: list[ifcopenshell.entity_instance]) -> None:
self.set_visibility(elements, elements_visibility="VISIBLE")
def set_hidden_elements(self, elements: list[ifcopenshell.entity_instance]) -> None:
self.set_visibility(elements, elements_visibility="HIDDEN")
def set_visibility(
self, elements: list[ifcopenshell.entity_instance], elements_visibility: Literal["VISIBLE", "HIDDEN"]
) -> None:
visualization_info = self.visualization_info
default_visibility = elements_visibility == "HIDDEN"
guids = [e.GlobalId for e in elements]
components_list = [mdl.Component(ifc_guid=guid) for guid in guids]
components = visualization_info.components
if not components:
visibility = mdl.ComponentVisibility(default_visibility=default_visibility)
components = mdl.Components(visibility=visibility)
visualization_info.components = components
visibility = components.visibility
if not visibility:
visibility = mdl.ComponentVisibility(default_visibility=default_visibility)
components.visibility = visibility
elif visibility.default_visibility != default_visibility:
visibility.default_visibility = default_visibility
exceptions = visibility.exceptions
if not exceptions:
exceptions = mdl.ComponentVisibilityExceptions()
visibility.exceptions = exceptions
exceptions.component = components_list
def get_elements_visibility(self) -> Union[tuple[bool, list[str]], None]:
"""
Return viewpoint elements visibility settings.
Returns:
If viewpoint has no visibility settings, return `None`.
Otherwise return a tuple containing the default visibility
and a list of IFC element GUIDs listed as exceptions.
If default visibility is `True`, all elements are visible except the exceptions.
If default visibility is `False`, all elements are hidden except the exceptions.
"""
visualization_info = self.visualization_info
components = visualization_info.components
if not components:
return None
visibility = components.visibility
if not visibility:
return None
default_visibility = visibility.default_visibility or False
exceptions = visibility.exceptions
if not exceptions:
return default_visibility, []
guids = [guid for c in exceptions.component if (guid := c.ifc_guid)]
return default_visibility, guids
@lru_cache(maxsize=None)
def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo:
"""
Return a BCF viewpoint of an IFC element.
This function is cached to speedudp the creation of multiple BCF topics regarding the same element.
This function is cached to speed up the creation of multiple BCF topics regarding the same element.
Args:
element: The IFC element to point at.
@@ -224,11 +329,11 @@ def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo:
)
def build_viewpoint_from_position_and_guids(position: NDArray[np.float_], *guids: str) -> mdl.VisualizationInfo:
def build_viewpoint_from_position_and_guids(position: NDArray[np.float64], *guids: str) -> mdl.VisualizationInfo:
"""
Return a BCF viewpoint of an IFC element.
This function is cached to speedudp the creation of multiple BCF topics regarding the same element.
This function is cached to speed up the creation of multiple BCF topics regarding the same element.
Args:
position: target point coordinates.
@@ -249,7 +354,7 @@ def build_components(*guids: str) -> mdl.Components:
Return the BCF components from an IFC element GUID.
Args:
*guids: One or more IFC element GUID.
*guids: One or more selected IFC element GUID.
Returns:
The BCF components definition.
@@ -261,7 +366,7 @@ def build_components(*guids: str) -> mdl.Components:
)
def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
def build_camera(elem_placement: NDArray[np.float64]) -> mdl.PerspectiveCamera:
"""
Return a BCF camera for an IFC element placement matrix.
@@ -275,7 +380,7 @@ def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
def build_camera_from_vectors(
camera_position: NDArray[np.float_], camera_dir: NDArray[np.float_], camera_up: NDArray[np.float_]
camera_position: NDArray[np.float64], camera_dir: NDArray[np.float64], camera_up: NDArray[np.float64]
) -> mdl.PerspectiveCamera:
"""
Return a BCF camera for an IFC element placement matrix.
@@ -1,4 +1,5 @@
"""BCF XML V3 handlers."""
import uuid
import warnings
import zipfile
@@ -25,7 +26,7 @@ class BcfXml:
self._version: Optional[mdl.Version] = None
self._project_info: Optional[mdl.ProjectInfo] = None
self._extensions: Optional[mdl.Extensions] = None
self._topics: dict[str, TopicHandler] = {}
self._topics: Optional[dict[str, TopicHandler]] = None
self._documents: Optional[DocumentsHandler] = None
self._zip_file = self._load_zip_file()
@@ -90,18 +91,22 @@ class BcfXml:
@property
def topics(self) -> dict[str, TopicHandler]:
"""BCF topics."""
if not self._topics and self._zip_file:
self._load_topics()
if self._topics is None:
self._topics = self._load_topics()
return self._topics
def _load_topics(self) -> None:
def _load_topics(self) -> dict[str, TopicHandler]:
topics = {}
if self._zip_file is None:
return topics
for topic_dir in zipfile.Path(self._zip_file).iterdir():
if not topic_dir.is_dir():
continue
markup_path = topic_dir.joinpath("markup.bcf")
if not markup_path.exists():
continue
self._topics[topic_dir.name] = TopicHandler(topic_dir, self._xml_handler)
topics[topic_dir.name] = TopicHandler(topic_dir, self._xml_handler)
return topics
@property
def documents(self) -> Optional[DocumentsHandler]:
@@ -1,4 +1,5 @@
"""BCF XML V3 Documents handler."""
import zipfile
from typing import Any, Optional
@@ -22,7 +22,7 @@ class Document:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
guid: str = field(
metadata={
@@ -45,7 +45,7 @@ class DocumentInfoDocuments:
"name": "Document",
"type": "Element",
"namespace": "",
}
},
)
@@ -57,5 +57,5 @@ class DocumentInfo:
"name": "Documents",
"type": "Element",
"namespace": "",
}
},
)
@@ -15,7 +15,7 @@ class ExtensionsPriorities:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -32,7 +32,7 @@ class ExtensionsSnippetTypes:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -49,7 +49,7 @@ class ExtensionsStages:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -66,7 +66,7 @@ class ExtensionsTopicLabels:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -83,7 +83,7 @@ class ExtensionsTopicStatuses:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -100,7 +100,7 @@ class ExtensionsTopicTypes:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -117,7 +117,7 @@ class ExtensionsUsers:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -129,7 +129,7 @@ class Extensions:
"name": "TopicTypes",
"type": "Element",
"namespace": "",
}
},
)
topic_statuses: Optional[ExtensionsTopicStatuses] = field(
default=None,
@@ -137,7 +137,7 @@ class Extensions:
"name": "TopicStatuses",
"type": "Element",
"namespace": "",
}
},
)
priorities: Optional[ExtensionsPriorities] = field(
default=None,
@@ -145,7 +145,7 @@ class Extensions:
"name": "Priorities",
"type": "Element",
"namespace": "",
}
},
)
topic_labels: Optional[ExtensionsTopicLabels] = field(
default=None,
@@ -153,7 +153,7 @@ class Extensions:
"name": "TopicLabels",
"type": "Element",
"namespace": "",
}
},
)
users: Optional[ExtensionsUsers] = field(
default=None,
@@ -161,7 +161,7 @@ class Extensions:
"name": "Users",
"type": "Element",
"namespace": "",
}
},
)
snippet_types: Optional[ExtensionsSnippetTypes] = field(
default=None,
@@ -169,7 +169,7 @@ class Extensions:
"name": "SnippetTypes",
"type": "Element",
"namespace": "",
}
},
)
stages: Optional[ExtensionsStages] = field(
default=None,
@@ -177,5 +177,5 @@ class Extensions:
"name": "Stages",
"type": "Element",
"namespace": "",
}
},
)
@@ -40,7 +40,7 @@ class BimSnippet:
metadata={
"name": "IsExternal",
"type": "Attribute",
}
},
)
@@ -68,7 +68,7 @@ class DocumentReference:
"type": "Element",
"namespace": "",
"pattern": r"[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",
}
},
)
url: Optional[str] = field(
default=None,
@@ -78,7 +78,7 @@ class DocumentReference:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
description: Optional[str] = field(
default=None,
@@ -88,7 +88,7 @@ class DocumentReference:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
guid: str = field(
metadata={
@@ -110,7 +110,7 @@ class File:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
date: Optional[XmlDateTime] = field(
default=None,
@@ -118,7 +118,7 @@ class File:
"name": "Date",
"type": "Element",
"namespace": "",
}
},
)
reference: Optional[str] = field(
default=None,
@@ -128,7 +128,7 @@ class File:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
ifc_project: Optional[str] = field(
default=None,
@@ -137,7 +137,7 @@ class File:
"type": "Attribute",
"length": 22,
"pattern": r"[0-9A-Za-z_$]*",
}
},
)
ifc_spatial_structure_element: Optional[str] = field(
default=None,
@@ -146,14 +146,14 @@ class File:
"type": "Attribute",
"length": 22,
"pattern": r"[0-9A-Za-z_$]*",
}
},
)
is_external: bool = field(
default=True,
metadata={
"name": "IsExternal",
"type": "Attribute",
}
},
)
@@ -170,7 +170,7 @@ class TopicLabels:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -187,7 +187,7 @@ class TopicReferenceLinks:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
@@ -216,7 +216,7 @@ class ViewPoint:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
snapshot: Optional[str] = field(
default=None,
@@ -226,7 +226,7 @@ class ViewPoint:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
index: Optional[int] = field(
default=None,
@@ -234,7 +234,7 @@ class ViewPoint:
"name": "Index",
"type": "Element",
"namespace": "",
}
},
)
guid: str = field(
metadata={
@@ -274,7 +274,7 @@ class Comment:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
viewpoint: Optional[CommentViewpoint] = field(
default=None,
@@ -282,7 +282,7 @@ class Comment:
"name": "Viewpoint",
"type": "Element",
"namespace": "",
}
},
)
modified_date: Optional[XmlDateTime] = field(
default=None,
@@ -290,7 +290,7 @@ class Comment:
"name": "ModifiedDate",
"type": "Element",
"namespace": "",
}
},
)
modified_author: Optional[str] = field(
default=None,
@@ -300,7 +300,7 @@ class Comment:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
guid: str = field(
metadata={
@@ -323,7 +323,7 @@ class HeaderFiles:
"name": "File",
"type": "Element",
"namespace": "",
}
},
)
@@ -338,7 +338,7 @@ class TopicDocumentReferences:
"name": "DocumentReference",
"type": "Element",
"namespace": "",
}
},
)
@@ -353,7 +353,7 @@ class TopicRelatedTopics:
"name": "RelatedTopic",
"type": "Element",
"namespace": "",
}
},
)
@@ -368,7 +368,7 @@ class TopicViewpoints:
"name": "ViewPoint",
"type": "Element",
"namespace": "",
}
},
)
@@ -380,7 +380,7 @@ class Header:
"name": "Files",
"type": "Element",
"namespace": "",
}
},
)
@@ -395,7 +395,7 @@ class TopicComments:
"name": "Comment",
"type": "Element",
"namespace": "",
}
},
)
@@ -407,7 +407,7 @@ class Topic:
"name": "ReferenceLinks",
"type": "Element",
"namespace": "",
}
},
)
title: str = field(
metadata={
@@ -427,7 +427,7 @@ class Topic:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
index: Optional[int] = field(
default=None,
@@ -435,7 +435,7 @@ class Topic:
"name": "Index",
"type": "Element",
"namespace": "",
}
},
)
labels: Optional[TopicLabels] = field(
default=None,
@@ -443,7 +443,7 @@ class Topic:
"name": "Labels",
"type": "Element",
"namespace": "",
}
},
)
creation_date: XmlDateTime = field(
metadata={
@@ -469,7 +469,7 @@ class Topic:
"name": "ModifiedDate",
"type": "Element",
"namespace": "",
}
},
)
modified_author: Optional[str] = field(
default=None,
@@ -479,7 +479,7 @@ class Topic:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
due_date: Optional[XmlDateTime] = field(
default=None,
@@ -487,7 +487,7 @@ class Topic:
"name": "DueDate",
"type": "Element",
"namespace": "",
}
},
)
assigned_to: Optional[str] = field(
default=None,
@@ -497,7 +497,7 @@ class Topic:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
stage: Optional[str] = field(
default=None,
@@ -507,7 +507,7 @@ class Topic:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
description: Optional[str] = field(
default=None,
@@ -517,7 +517,7 @@ class Topic:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
bim_snippet: Optional[BimSnippet] = field(
default=None,
@@ -525,7 +525,7 @@ class Topic:
"name": "BimSnippet",
"type": "Element",
"namespace": "",
}
},
)
document_references: Optional[TopicDocumentReferences] = field(
default=None,
@@ -533,7 +533,7 @@ class Topic:
"name": "DocumentReferences",
"type": "Element",
"namespace": "",
}
},
)
related_topics: Optional[TopicRelatedTopics] = field(
default=None,
@@ -541,7 +541,7 @@ class Topic:
"name": "RelatedTopics",
"type": "Element",
"namespace": "",
}
},
)
comments: Optional[TopicComments] = field(
default=None,
@@ -549,7 +549,7 @@ class Topic:
"name": "Comments",
"type": "Element",
"namespace": "",
}
},
)
viewpoints: Optional[TopicViewpoints] = field(
default=None,
@@ -557,7 +557,7 @@ class Topic:
"name": "Viewpoints",
"type": "Element",
"namespace": "",
}
},
)
guid: str = field(
metadata={
@@ -574,7 +574,7 @@ class Topic:
"type": "Attribute",
"min_length": 1,
"white_space": "collapse",
}
},
)
topic_type: str = field(
metadata={
@@ -604,7 +604,7 @@ class Markup:
"name": "Header",
"type": "Element",
"namespace": "",
}
},
)
topic: Topic = field(
metadata={
@@ -12,7 +12,7 @@ class Project:
"namespace": "",
"min_length": 1,
"white_space": "collapse",
}
},
)
project_id: str = field(
metadata={
@@ -17,7 +17,7 @@ class Component:
"type": "Element",
"min_length": 1,
"white_space": "collapse",
}
},
)
authoring_tool_id: Optional[str] = field(
default=None,
@@ -26,7 +26,7 @@ class Component:
"type": "Element",
"min_length": 1,
"white_space": "collapse",
}
},
)
ifc_guid: Optional[str] = field(
default=None,
@@ -35,7 +35,7 @@ class Component:
"type": "Attribute",
"length": 22,
"pattern": r"[0-9A-Za-z_$]*",
}
},
)
@@ -96,21 +96,21 @@ class ViewSetupHints:
metadata={
"name": "SpacesVisible",
"type": "Attribute",
}
},
)
space_boundaries_visible: bool = field(
default=False,
metadata={
"name": "SpaceBoundariesVisible",
"type": "Attribute",
}
},
)
openings_visible: bool = field(
default=False,
metadata={
"name": "OpeningsVisible",
"type": "Attribute",
}
},
)
@@ -191,7 +191,7 @@ class ComponentColoringColorComponents:
"name": "Component",
"type": "Element",
"min_occurs": 1,
}
},
)
@@ -202,7 +202,7 @@ class ComponentSelection:
metadata={
"name": "Component",
"type": "Element",
}
},
)
@@ -216,7 +216,7 @@ class ComponentVisibilityExceptions:
metadata={
"name": "Component",
"type": "Element",
}
},
)
@@ -249,6 +249,7 @@ class OrthogonalCamera:
aspect_ratio: Proportional relationship between the width and
the height of the view (w/h).
"""
camera_view_point: Point = field(
metadata={
"name": "CameraViewPoint",
@@ -302,6 +303,7 @@ class PerspectiveCamera:
aspect_ratio: Proportional relationship between the width and
the height of the view (w/h).
"""
camera_view_point: Point = field(
metadata={
"name": "CameraViewPoint",
@@ -371,21 +373,21 @@ class ComponentVisibility:
metadata={
"name": "ViewSetupHints",
"type": "Element",
}
},
)
exceptions: Optional[ComponentVisibilityExceptions] = field(
default=None,
metadata={
"name": "Exceptions",
"type": "Element",
}
},
)
default_visibility: bool = field(
default=False,
metadata={
"name": "DefaultVisibility",
"type": "Attribute",
}
},
)
@@ -399,7 +401,7 @@ class VisualizationInfoBitmaps:
metadata={
"name": "Bitmap",
"type": "Element",
}
},
)
@@ -413,7 +415,7 @@ class VisualizationInfoClippingPlanes:
metadata={
"name": "ClippingPlane",
"type": "Element",
}
},
)
@@ -427,7 +429,7 @@ class VisualizationInfoLines:
metadata={
"name": "Line",
"type": "Element",
}
},
)
@@ -438,7 +440,7 @@ class ComponentColoring:
metadata={
"name": "Color",
"type": "Element",
}
},
)
@@ -449,21 +451,21 @@ class Components:
metadata={
"name": "Selection",
"type": "Element",
}
},
)
visibility: Optional[ComponentVisibility] = field(
default=None,
metadata={
"name": "Visibility",
"type": "Element",
}
},
)
coloring: Optional[ComponentColoring] = field(
default=None,
metadata={
"name": "Coloring",
"type": "Element",
}
},
)
@@ -472,47 +474,48 @@ class VisualizationInfo:
"""
VisualizationInfo documentation.
"""
components: Optional[Components] = field(
default=None,
metadata={
"name": "Components",
"type": "Element",
}
},
)
orthogonal_camera: Optional[OrthogonalCamera] = field(
default=None,
metadata={
"name": "OrthogonalCamera",
"type": "Element",
}
},
)
perspective_camera: Optional[PerspectiveCamera] = field(
default=None,
metadata={
"name": "PerspectiveCamera",
"type": "Element",
}
},
)
lines: Optional[VisualizationInfoLines] = field(
default=None,
metadata={
"name": "Lines",
"type": "Element",
}
},
)
clipping_planes: Optional[VisualizationInfoClippingPlanes] = field(
default=None,
metadata={
"name": "ClippingPlanes",
"type": "Element",
}
},
)
bitmaps: Optional[VisualizationInfoBitmaps] = field(
default=None,
metadata={
"name": "Bitmaps",
"type": "Element",
}
},
)
guid: str = field(
metadata={
@@ -1,4 +1,5 @@
"""BCF XML V3 Topic handler."""
import datetime
import uuid
import zipfile
@@ -25,7 +26,8 @@ class TopicHandler:
xml_handler: Optional[AbstractXmlParserSerializer] = None,
) -> None:
self._markup: Optional[mdl.Markup] = None
self._viewpoints: dict[str, VisualizationInfoHandler] = {}
self._viewpoints: Optional[dict[str, VisualizationInfoHandler]] = None
self._reference_files: Optional[dict[str, bytes]] = None
self._bim_snippet: Optional[bytes] = None
self._xml_handler = xml_handler or XmlParserSerializer()
self._topic_dir = topic_dir
@@ -48,22 +50,36 @@ class TopicHandler:
return self.markup.topic
@property
def guid(self) -> Optional[str]:
def guid(self) -> str:
"""Return the GUID of the topic."""
if self._markup:
return self.topic.guid
return self._topic_dir.name if self._topic_dir else None
return self._topic_dir.name if self._topic_dir else ""
@property
def header(self) -> Optional[mdl.Header]:
"""Return the header of the topic."""
return self.markup.header
@header.setter
def header(self, header: mdl.Header) -> None:
"""Set the header of the topic."""
self.markup.header = header
@property
def comments(self) -> list[mdl.Comment]:
"""Return the comments of the topic."""
return self.topic.comments.comment if self.topic.comments else []
@comments.setter
def comments(self, comments: list[mdl.Comment]) -> None:
topic_comments = self.topic.comments
if topic_comments is None:
if not comments:
return
self.topic.comments = (topic_comments := mdl.TopicComments())
topic_comments.comment = comments
@property
def bim_snippet(self) -> Optional[bytes]:
if not self._bim_snippet and self._topic_dir:
@@ -76,15 +92,15 @@ class TopicHandler:
@property
def viewpoints(self) -> dict[str, "VisualizationInfoHandler"]:
if (
not self._viewpoints
and self._topic_dir
and self.topic.viewpoints
and (viewpoints := self.topic.viewpoints.view_point)
):
self._viewpoints = VisualizationInfoHandler.from_topic_viewpoints(self._topic_dir, viewpoints)
if self._viewpoints is None:
self._viewpoints = self._load_viewpoints()
return self._viewpoints
def _load_viewpoints(self) -> dict[str, "VisualizationInfoHandler"]:
if self._topic_dir and self.topic.viewpoints and (viewpoints := self.topic.viewpoints.view_point):
return VisualizationInfoHandler.from_topic_viewpoints(self._topic_dir, viewpoints)
return {}
def _load_bim_snippet(self) -> Optional[bytes]:
bim_snippet_obj = self.topic.bim_snippet
if bim_snippet_obj and not bim_snippet_obj.is_external and self._topic_dir:
@@ -93,6 +109,27 @@ class TopicHandler:
return bim_snippet_path.read_bytes()
return None
@property
def reference_files(self) -> dict[str, bytes]:
if self._reference_files is not None:
return self._reference_files
self._reference_files = {}
if not self.header:
return self._reference_files
if not self.header.files:
return self._reference_files
for ref in self.header.files.file:
if ref.is_external:
continue
real_path = self._topic_dir
for path_part in ref.reference.split("/"):
real_path = real_path.parent if path_part == ".." else real_path.joinpath(path_part)
self._reference_files[ref.reference] = real_path.read_bytes()
return self._reference_files
@classmethod
def create_new(
cls,
@@ -144,6 +181,7 @@ class TopicHandler:
self._save_xml(destination_zip, self._markup, "markup.bcf")
self._save_viewpoints(destination_zip, topic_dir)
self._save_bim_snippet(destination_zip)
self._save_reference_files(destination_zip)
def _save_viewpoints(self, destination_zip: ZipFileInterface, topic_dir: str) -> None:
if not self.topic.viewpoints or not (viewpoints := self.topic.viewpoints.view_point):
@@ -164,7 +202,20 @@ class TopicHandler:
if self.bim_snippet:
destination_zip.writestr(f"{self.topic.guid}/{ref_filename}", self.bim_snippet)
def add_viewpoint(self, element: entity_instance) -> None:
def _save_reference_files(self, destination_zip: ZipFileInterface) -> None:
if not self.header:
return
if not self.header.files:
return
for ref in self.header.files.file:
if ref.is_external or not ref.reference:
continue
real_path = self._topic_dir
for path_part in ref.reference.split("/"):
real_path = real_path.parent if path_part == ".." else real_path.joinpath(path_part)
destination_zip.writestr(real_path.at, self.reference_files[ref.reference])
def add_viewpoint(self, element: entity_instance) -> VisualizationInfoHandler:
"""
Add a viewpoint tergeting an IFC element to the topic.
@@ -173,8 +224,11 @@ class TopicHandler:
"""
new_viewpoint = VisualizationInfoHandler.create_new(element, self._xml_handler)
self.add_visinfo_handler(new_viewpoint)
return new_viewpoint
def add_viewpoint_from_point_and_guids(self, position: NDArray[np.float_], *guids: str) -> None:
def add_viewpoint_from_point_and_guids(
self, position: NDArray[np.float64], *guids: str
) -> VisualizationInfoHandler:
"""
Add a viewpoint tergeting an IFC element to the topic.
@@ -185,14 +239,21 @@ class TopicHandler:
position, *guids, xml_handler=self._xml_handler
)
self.add_visinfo_handler(vi_handler)
return vi_handler
def add_visinfo_handler(self, new_viewpoint: VisualizationInfoHandler) -> None:
def add_visinfo_handler(
self, new_viewpoint: VisualizationInfoHandler, snapshot_filename: Optional[str] = None
) -> mdl.ViewPoint:
self.viewpoints[new_viewpoint.guid + ".bcfv"] = new_viewpoint
if self.topic.viewpoints is None:
self.topic.viewpoints = mdl.TopicViewpoints()
self.topic.viewpoints.view_point.append(
mdl.ViewPoint(viewpoint=new_viewpoint.guid + ".bcfv", guid=new_viewpoint.guid)
viewpoint = mdl.ViewPoint(
viewpoint=new_viewpoint.guid + ".bcfv",
snapshot=snapshot_filename,
guid=new_viewpoint.guid,
)
self.topic.viewpoints.view_point.append(viewpoint)
return viewpoint
def __eq__(self, other: object) -> bool | NoReturn:
return (
@@ -1,11 +1,11 @@
import uuid
import zipfile
from functools import lru_cache
from typing import Any, Iterable, Optional
from typing import Any, Iterable, Optional, Literal, Union
import numpy as np
from ifcopenshell import entity_instance
from ifcopenshell.util import placement
import ifcopenshell.util.unit
import ifcopenshell.util.placement
from numpy.typing import NDArray
import bcf.v3.model as mdl
@@ -133,6 +133,15 @@ class VisualizationInfoHandler:
self._save_bitmaps(bcf_zip, topic_dir)
def _save_snapshot(self, bcf_zip: ZipFileInterface, topic_dir: str, filename: Optional[str]) -> None:
if bool(self.snapshot) ^ bool(filename):
data = ["data (VisualizationInfoHandler.snapshot)", "filename (ViewPoint.snapshot)"]
provided_data, missing_data = data if self.snapshot else data[::-1]
print(
f"WARNING. Snapshot with viewpoint guid '{self.guid}' won't be saved to bcf. "
f"Only snapshot {provided_data} is provided but snapshot {missing_data} is missing."
)
return
if self.snapshot and filename:
bcf_zip.writestr(f"{topic_dir}/{filename}", self.snapshot)
@@ -175,7 +184,7 @@ class VisualizationInfoHandler:
@classmethod
def create_from_point_and_guids(
cls,
position: NDArray[np.float_],
position: NDArray[np.float64],
*guids: str,
xml_handler: Optional[AbstractXmlParserSerializer] = None,
) -> "VisualizationInfoHandler":
@@ -195,13 +204,110 @@ class VisualizationInfoHandler:
visualization_info=build_viewpoint_from_position_and_guids(position, *guids), xml_handler=xml_handler
)
def get_selected_guids(self) -> Union[list[str], None]:
"""
Return viewpoint selected elements IFC guids.
Returns:
If viewpoint has no selection settings, return `None`.
Otherwise return a list of selected elements IFC guids.
"""
visualization_info = self.visualization_info
components = visualization_info.components
if not components:
return None
selection = components.selection
if not selection:
return None
return [guid for c in selection.component if (guid := c.ifc_guid)]
def set_selected_elements(self, elements: list[ifcopenshell.entity_instance]) -> None:
visualization_info = self.visualization_info
guids = [e.GlobalId for e in elements]
components = visualization_info.components
if not components:
visibility = mdl.ComponentVisibility(default_visibility=True)
components = mdl.Components(visibility=visibility)
visualization_info.components = components
selection = components.selection
components_list = [mdl.Component(ifc_guid=guid) for guid in guids]
if not selection:
selection = mdl.ComponentSelection()
components.selection = selection
selection.component = components_list
def set_visible_elements(self, elements: list[ifcopenshell.entity_instance]) -> None:
self.set_visibility(elements, elements_visibility="VISIBLE")
def set_hidden_elements(self, elements: list[ifcopenshell.entity_instance]) -> None:
self.set_visibility(elements, elements_visibility="HIDDEN")
def set_visibility(
self, elements: list[ifcopenshell.entity_instance], elements_visibility: Literal["VISIBLE", "HIDDEN"]
) -> None:
visualization_info = self.visualization_info
default_visibility = elements_visibility == "HIDDEN"
guids = [e.GlobalId for e in elements]
components_list = [mdl.Component(ifc_guid=guid) for guid in guids]
components = visualization_info.components
if not components:
visibility = mdl.ComponentVisibility(default_visibility=default_visibility)
components = mdl.Components(visibility=visibility)
visualization_info.components = components
visibility = components.visibility
if not visibility:
visibility = mdl.ComponentVisibility(default_visibility=default_visibility)
components.visibility = visibility
elif visibility.default_visibility != default_visibility:
visibility.default_visibility = default_visibility
exceptions = visibility.exceptions
if not exceptions:
exceptions = mdl.ComponentVisibilityExceptions()
visibility.exceptions = exceptions
exceptions.component = components_list
def get_elements_visibility(self) -> Union[tuple[bool, list[str]], None]:
"""
Return viewpoint elements visibility settings.
Returns:
If viewpoint has no visibility settings, return `None`.
Otherwise return a tuple containing the default visibility
and a list of IFC element GUIDs listed as exceptions.
If default visibility is `True`, all elements are visible except the exceptions.
If default visibility is `False`, all elements are hidden except the exceptions.
"""
visualization_info = self.visualization_info
components = visualization_info.components
if not components:
return None
visibility = components.visibility
if not visibility:
return None
default_visibility = visibility.default_visibility or False
exceptions = visibility.exceptions
if not exceptions:
return default_visibility, []
guids = [guid for c in exceptions.component if (guid := c.ifc_guid)]
return default_visibility, guids
@lru_cache(maxsize=None)
def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo:
"""
Return a BCF viewpoint of an IFC element.
This function is cached to speedudp the creation of multiple BCF topics regarding the same element.
This function is cached to speed up the creation of multiple BCF topics regarding the same element.
Args:
element: The IFC element to point at.
@@ -209,7 +315,12 @@ def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo:
Returns:
The BCF viewpoint definition.
"""
elem_placement = placement.get_local_placement(element.ObjectPlacement)
ifc_file = element.wrapped_data.file
unit_scale = ifcopenshell.util.unit.calculate_unit_scale(ifc_file)
elem_placement = ifcopenshell.util.placement.get_local_placement(element.ObjectPlacement)
elem_placement[0][3] *= unit_scale
elem_placement[1][3] *= unit_scale
elem_placement[2][3] *= unit_scale
return mdl.VisualizationInfo(
guid=str(uuid.uuid4()),
@@ -218,11 +329,11 @@ def build_viewpoint(element: entity_instance) -> mdl.VisualizationInfo:
)
def build_viewpoint_from_position_and_guids(position: NDArray[np.float_], *guids: str) -> mdl.VisualizationInfo:
def build_viewpoint_from_position_and_guids(position: NDArray[np.float64], *guids: str) -> mdl.VisualizationInfo:
"""
Return a BCF viewpoint of an IFC element.
This function is cached to speedudp the creation of multiple BCF topics regarding the same element.
This function is cached to speed up the creation of multiple BCF topics regarding the same element.
Args:
position: target point coordinates.
@@ -243,7 +354,7 @@ def build_components(*guids: str) -> mdl.Components:
Return the BCF components from an IFC element GUID.
Args:
*guids: One or more IFC element GUID.
*guids: One or more selected IFC element GUID.
Returns:
The BCF components definition.
@@ -255,7 +366,7 @@ def build_components(*guids: str) -> mdl.Components:
)
def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
def build_camera(elem_placement: NDArray[np.float64]) -> mdl.PerspectiveCamera:
"""
Return a BCF camera for an IFC element placement matrix.
@@ -269,7 +380,7 @@ def build_camera(elem_placement: NDArray[np.float_]) -> mdl.PerspectiveCamera:
def build_camera_from_vectors(
camera_position: NDArray[np.float_], camera_dir: NDArray[np.float_], camera_up: NDArray[np.float_]
camera_position: NDArray[np.float64], camera_dir: NDArray[np.float64], camera_up: NDArray[np.float64]
) -> mdl.PerspectiveCamera:
"""
Return a BCF camera for an IFC element placement matrix.
@@ -1,4 +1,5 @@
"""XML Parser and Serializer factories."""
from typing import Optional, Protocol, Type, TypeVar
from xsdata.formats.dataclass.context import XmlContext
+1
View File
@@ -1,4 +1,5 @@
"""BCF XML tests."""
import uuid
from pathlib import Path
from tempfile import TemporaryDirectory
+23
View File
@@ -55,9 +55,32 @@ def test_save_maximum_information() -> None:
def assert_everything_in_place(bcf: BcfXml):
assert bcf.version.version_id == "2.1"
assert bcf.project
assert bcf.project.name == "BCF API Implementation"
assert bcf.project_info
assert bcf.project_info.extension_schema == "extensions.xsd"
assert bcf.extensions
assert bcf.extensions.topic_types
assert bcf.extensions.topic_types.topic_type == ["Architecture", "Hidden Type", "Structural"]
assert bcf.extensions.topic_statuses
assert bcf.extensions.topic_statuses.topic_status == ["Finished status", "Open", "Closed"]
assert bcf.extensions.priorities
assert bcf.extensions.priorities.priority == ["Low", "High", "Medium"]
assert bcf.extensions.topic_labels
assert bcf.extensions.topic_labels.topic_label == [
"Architecture",
"IT Development",
"Management",
"Mechanical",
"Structural",
]
assert bcf.extensions.users
assert bcf.extensions.users.user == ["dangl@iabi.eu", "linhard@iabi.eu"]
assert bcf.extensions.snippet_types
assert bcf.extensions.snippet_types.snippet_type == ["IFC2X3", "PDF", "XLSX"]
assert bcf.extensions.stages is None
assert len(bcf.topics) == 2
assert_first_topic_handler(bcf.topics["7ddc3ef0-0ab7-43f1-918a-45e38b42369c"])
second_th = bcf.topics["d1068c81-af04-4546-b63c-348810f6c716"]
+1
View File
@@ -1,4 +1,5 @@
"""BCF XML tests."""
import uuid
from pathlib import Path
from tempfile import TemporaryDirectory
+16
View File
@@ -39,6 +39,22 @@ def assert_everything_in_place(bcf: BcfXml):
assert bcf.project.name == "BCF 3.0 test cases"
assert bcf.project.project_id == "de894a86-3a08-4ea0-b2d1-6c222b5602d1"
assert bcf.extensions
assert bcf.extensions.topic_types
assert bcf.extensions.topic_types.topic_type == ["ERROR", "WARNING", "INFORMATION", "CLASH", "OTHER"]
assert bcf.extensions.topic_statuses
assert bcf.extensions.topic_statuses.topic_status == ["OPEN", "IN_PROGRESS", "SOLVED", "CLOSED"]
assert bcf.extensions.priorities
assert bcf.extensions.priorities.priority == ["LOW", "MEDIUM", "HIGH", "CRITICAL"]
assert bcf.extensions.topic_labels
assert bcf.extensions.topic_labels.topic_label == []
assert bcf.extensions.users
assert bcf.extensions.users.user == ["Architect@example.com", "Engineer@example.com", "MEPDesigner@example.com"]
assert bcf.extensions.snippet_types
assert bcf.extensions.snippet_types.snippet_type == []
assert bcf.extensions.stages
assert bcf.extensions.stages.stage == []
assert len(bcf.topics) == 1
topic_handler = bcf.topics["8ac9822a-761a-4deb-9f39-f61286acbf6a"]
-362
View File
@@ -1,362 +0,0 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020-2023 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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.
#
# BlenderBIM Add-on 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 BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
PYTHON:=python3.11
PIP:=pip3.11
PATCH:=patch
SED:=sed -i
ifeq ($(OS),Windows_NT)
HOSTOS:=win
else
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
HOSTOS:=linux
endif
ifeq ($(UNAME_S),Darwin)
HOSTOS:=macos
PYTHON:=python3
PATCH:=patch -d
SED:=sed -i '' -e
endif
endif
IS_STABLE:=FALSE
VERSION:=$(shell cat ../../VERSION)
VERSION_MAJOR:=$(shell cat '../../VERSION' | cut -d '.' -f 1)
VERSION_MINOR:=$(shell cat '../../VERSION' | cut -d '.' -f 2)
VERSION_PATCH:=$(shell cat '../../VERSION' | cut -d '.' -f 3)
VERSION_DATE:=$(shell date '+%y%m%d')
LAST_COMMIT_HASH:=$(shell git rev-parse HEAD)
PYVERSION:=py310
PYPI_IMP:=cp
ifeq ($(PYVERSION), py39)
PYLIBDIR:=python3.9
PYNUMBER:=39
PYPI_VERSION:=3.9
endif
ifeq ($(PYVERSION), py310)
PYLIBDIR:=python3.10
PYNUMBER:=310
PYPI_VERSION:=3.10
endif
ifeq ($(PYVERSION), py311)
PYLIBDIR:=python3.11
PYNUMBER:=311
PYPI_VERSION:=3.11
endif
ifeq ($(PYVERSION), py312)
PYLIBDIR:=python3.12
PYNUMBER:=312
PYPI_VERSION:=3.12
endif
ifeq ($(PLATFORM), linux)
PYPI_PLATFORM:=--platform manylinux_2_17_x86_64
endif
ifeq ($(PLATFORM), macos)
PYPI_PLATFORM:=--platform macosx_10_10_x86_64
endif
ifeq ($(PLATFORM), macosm1)
PYPI_PLATFORM:=--platform macosx_11_0_arm64
endif
ifeq ($(PLATFORM), win)
PYPI_PLATFORM:=--platform win_amd64
endif
# Current build commit hash.
OLD:=c18e4ea
.PHONY: bump
bump:
cd . && $(SED) -b "s/$(OLD)/$(NEW)/" Makefile
cd ../ifcopenshell-python/ && $(SED) -b "s/$(OLD)/$(NEW)/" Makefile
cd ../ifcopenshell-python/docs/ifcconvert/ && $(SED) -b "s/$(OLD)/$(NEW)/" installation.rst
.PHONY: dist
dist:
ifndef PLATFORM
$(error PLATFORM is not set)
endif
rm -rf dist
mkdir -p dist/working
mkdir -p dist/blenderbim
cp -r blenderbim/* dist/blenderbim/
# Provides IfcOpenShell Python functionality
cd dist/working && wget https://s3.amazonaws.com/ifcopenshell-builds/ifcopenshell-python-$(PYNUMBER)-v0.7.9-${OLD}-$(PLATFORM)64.zip
cd dist/working && unzip ifcopenshell-python*
cp -r dist/working/ifcopenshell dist/blenderbim/libs/site/packages/
# See bug #812
cd dist/working && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/src/blenderbim/occ_utils.py
cd dist/working && mv occ_utils.py ../blenderbim/libs/site/packages/ifcopenshell/geom/occ_utils.py
rm -rf dist/working
# Provides dependencies that are part of IfcOpenShell
mkdir dist/working
cd dist/working && wget https://github.com/IfcOpenShell/IfcOpenShell/archive/refs/heads/v0.8.0.zip
cd dist/working && unzip v0.8.0.zip
# IfcOpenBot sometimes lags behind, so we only use its binaries
mv dist/blenderbim/libs/site/packages/ifcopenshell/*ifcopenshell_wrapper* dist/working/
rm -rf dist/blenderbim/libs/site/packages/ifcopenshell
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcopenshell-python/ifcopenshell dist/blenderbim/libs/site/packages/
mv dist/working/*ifcopenshell_wrapper* dist/blenderbim/libs/site/packages/ifcopenshell/
# Provides bcf functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/bcf/src/bcf dist/blenderbim/libs/site/packages/
# Provides IFCClash functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcclash/ifcclash dist/blenderbim/libs/site/packages/
# Provides BIMTester functionality
cd dist/working && $(PYTHON) -m venv env
cd dist/working && . env/bin/activate && $(PIP) install pybabel
cd dist/working && . env/bin/activate && $(PIP) install babel
cd dist/working && . env/bin/activate && ./env/bin/pybabel compile -d ./IfcOpenShell-0.8.0/src/ifcbimtester/bimtester/locale/
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcbimtester/bimtester dist/blenderbim/libs/site/packages/
# Provides IFCTester functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifctester/ifctester dist/blenderbim/libs/site/packages/
# Provides IFCFM functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcfm/ifcfm dist/blenderbim/libs/site/packages/
# Provides bSDD functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/bsdd/* dist/blenderbim/libs/site/packages/
# Provides IFCDiff functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcdiff/* dist/blenderbim/libs/site/packages/
# Provides IFCCSV functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifccsv/* dist/blenderbim/libs/site/packages/
# Provides IFCPatch functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifcpatch/ifcpatch dist/blenderbim/libs/site/packages/
# Provides IFC4D functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifc4d/ifc4d dist/blenderbim/libs/site/packages/
# Provides IFC5D functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifc5d/ifc5d dist/blenderbim/libs/site/packages/
# Provides IFCCityJSON functionality
cp -r dist/working/IfcOpenShell-0.8.0/src/ifccityjson dist/blenderbim/libs/site/packages/
# Provides IfcGit functionality
cd dist/working && . env/bin/activate && $(PIP) install GitPython --target=./site-packages
cp -r dist/working/site-packages/smmap dist/blenderbim/libs/site/packages/
cp -r dist/working/site-packages/gitdb dist/blenderbim/libs/site/packages/
cp -r dist/working/site-packages/git dist/blenderbim/libs/site/packages/
rm -rf dist/working
# Provides audio playback for costing
mkdir -p dist/working
git clone https://github.com/Andrej730/aud.git --branch master-reduced-size --depth 1 dist/working/aud
cd dist/working/aud && git checkout 529af208fbcb707c387bfb681d2605c0b6112de7
cp -r dist/working/aud/aud dist/blenderbim/libs/site/packages/
rm -rf dist/working
# Provides jsgantt-improved supports for web-based construction sequencing gantt charts
mkdir dist/working
cd dist/working && wget https://raw.githubusercontent.com/jsGanttImproved/jsgantt-improved/master/dist/jsgantt.js
cd dist/working && wget https://raw.githubusercontent.com/jsGanttImproved/jsgantt-improved/master/dist/jsgantt.css
cp dist/working/jsgantt* dist/blenderbim/bim/data/gantt/
rm -rf dist/working
mkdir dist/working
cd dist/working && $(PYTHON) -m venv env
cd dist/working && mkdir site-packages
# IfcOpenShell dependency - support for new typing features
cd dist/working && . env/bin/activate && $(PIP) install typing_extensions --target=./site-packages
# Required by IfcCSV
cd dist/working && . env/bin/activate && $(PIP) install pandas $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Pandas ships with very heavy tests
cd dist/working/site-packages/pandas && rm -rf tests
cd dist/working && . env/bin/activate && $(PIP) install openpyxl --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install odfpy --target=./site-packages
# Required by IFCCityJSON
cd dist/working && . env/bin/activate && $(PIP) install cjio --target=./site-packages
# Provides express rule validation for ifcopenshell.validate
cd dist/working && . env/bin/activate && $(PIP) install pytest --target=./site-packages
# Provides Brickschema functionality
cd dist/working && . env/bin/activate && $(PIP) install "brickschema[persistence]==0.7.6a2" --target=./site-packages
# Required for SVG to DXF conversion
cd dist/working && . env/bin/activate && $(PIP) install ezdxf --target=./site-packages
# Required by bcf
cd dist/working && . env/bin/activate && $(PIP) install xsdata --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install xmlschema --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install elementpath --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install six --target=./site-packages
# Required by drawing module
cd dist/working && . env/bin/activate && $(PIP) install lxml $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Required by qto and drawing module
cd dist/working && . env/bin/activate && $(PIP) install shapely $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Required by the BIM type manager thumbnail generator
cd dist/working && . env/bin/activate && $(PIP) install pillow $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
# Provides mustache templating in construction docs and web UI data
cd dist/working && . env/bin/activate && $(PIP) install pystache --target=./site-packages
# Provides SVG export in construction documentation
cd dist/working && . env/bin/activate && $(PIP) install svgwrite --target=./site-packages
# Provides fuzzy date parsing for construction sequencing
cd dist/working && . env/bin/activate && $(PIP) install python-dateutil --target=./site-packages
# Provides duration parsing for construction sequencing
cd dist/working && . env/bin/activate && $(PIP) install isodate --target=./site-packages
# Provides networkx graph analysis for project dependency calculations
cd dist/working && . env/bin/activate && $(PIP) install networkx --target=./site-packages
# Required by IFCDiff
cd dist/working && . env/bin/activate && $(PIP) install deepdiff --target=./site-packages
# Required by IFCCSV and ifcopenshell.util.selector
cd dist/working && . env/bin/activate && $(PIP) install lark --target=./site-packages
# Required by IFC4D
cd dist/working && . env/bin/activate && $(PIP) install PyP6Xer --target=./site-packages
# Required by web module
cd dist/working && . env/bin/activate && $(PIP) install python-socketio[asyncio_client] --target=./site-packages
cd dist/working && . env/bin/activate && $(PIP) install aiohttp --target=./site-packages
# Required by light module
ifeq ($(PLATFORM), linux)
# See https://github.com/LBNL-ETA/pyradiance/issues/34
cd dist/working && . env/bin/activate && $(PIP) install pyradiance --platform manylinux1_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
else ifneq ($(PLATFORM), macos)
# No support for MacOS Intel from upstream. Too bad :(
cd dist/working && . env/bin/activate && $(PIP) install pyradiance $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --target=./site-packages
endif
cp -r dist/working/site-packages/* dist/blenderbim/libs/site/packages/
rm -rf dist/working
# Required by BIMTester
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/c8/4b/d0a8c23b6c8985e5544ea96d27105a273ea22051317f850c2cdbf2029fe4/behave-1.2.6.tar.gz
cd dist/working && tar -xzvf behave*
cd dist/working/behave-1.2.6/ && cp -r behave ../../blenderbim/libs/site/packages/
# See bug #1294
cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/src/ifcbimtester/patch/model_core.patch
cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/src/ifcbimtester/patch/runner_util.patch
cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/model_core.py < model_core.patch
cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/runner_util.py < runner_util.patch
# See bug #2159
cd dist/working/ && wget https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/src/ifcbimtester/patch/junit.patch
cd dist/working/ && $(PATCH) ../blenderbim/libs/site/packages/behave/reporter/junit.py < junit.patch
rm -rf dist/working
# Required by behave
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/f4/65/220bb4075fddb09d5b3ea2c1c1fa66c1c72be9361ec187aab50fa161e576/parse-1.15.0.tar.gz
cd dist/working && tar -xzvf parse*
cd dist/working/parse-1.15.0/ && cp parse.py ../../blenderbim/libs/site/packages/
rm -rf dist/working
# Required by behave
mkdir dist/working
cd dist/working && wget https://files.pythonhosted.org/packages/2e/79/81bebd1b0446d46733db99d74543b4bb80646ef4c988584bae0862e706bc/parse_type-0.5.2.tar.gz
cd dist/working && tar -xzvf parse_type*
cd dist/working/parse_type-0.5.2/ && cp -r parse_type ../../blenderbim/libs/site/packages/
rm -rf dist/working
# Provides IFCJSON functionality
mkdir dist/working
cd dist/working && wget https://github.com/IFCJSON-Team/IFC2JSON_python/archive/master.zip
cd dist/working && unzip master.zip
cp -r dist/working/IFC2JSON_python-master/file_converters/ifcjson dist/blenderbim/libs/site/packages/
rm -rf dist/working
# Provides Brickschema functionality
mkdir dist/working
# For now lets bundle the latest nightly schema
cd dist/working && wget https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
cd dist/working && cp Brick.ttl ../blenderbim/bim/schema/Brick.ttl
rm -rf dist/working
# Required by brickschema
# This is a bit of a dodgy one, it should be provided by setuptools which Blender doesn't ship.
mkdir dist/working
cd dist/working && wget https://github.com/IfcOpenShell/IfcOpenShell/raw/v0.8.0/src/blenderbim/scripts/pkg_resources.tar.gz
cd dist/working && tar -xzvf pkg_resources*
cd dist/working/ && cp -r pkg_resources ../blenderbim/libs/site/packages/
rm -rf dist/working
# Required for hipped roof generation
mkdir dist/working
cd dist/working && wget https://github.com/prochitecture/bpypolyskel/archive/refs/heads/master.zip
cd dist/working && unzip master.zip
cp -r dist/working/bpypolyskel-master/bpypolyskel dist/blenderbim/libs/site/packages/
rm -rf dist/working
# Required for Desktop icon and file association
cp -r blenderbim/libs/desktop dist/blenderbim/libs/
# Generate translations module for BBIM build
git clone https://github.com/IfcOpenShell/blenderbim-translations.git dist/working
$(PYTHON) scripts/bbim_translations.py -i "dist/working" -o "dist/blenderbim"
rm -rf dist/working
# Remove dependencies also bundled with Blender
rm -rf dist/blenderbim/libs/site/packages/numpy
rm -rf dist/blenderbim/libs/site/packages/numpy.libs
ifeq ($(IS_STABLE), TRUE)
cd dist/blenderbim && $(SED) "s/0, 0, 0/$(VERSION_MAJOR), $(VERSION_MINOR), $(VERSION_PATCH)/" __init__.py
cd dist/blenderbim && $(SED) "s/0.0.0/$(VERSION)/" blender_manifest.toml
cd dist && zip -r blenderbim-$(VERSION)-$(PYVERSION)-$(PLATFORM).zip ./*
else
cd dist/blenderbim && $(SED) "s/0, 0, 0/$(VERSION_MAJOR), $(VERSION_MINOR), $(VERSION_PATCH), $(VERSION_DATE)/" __init__.py
cd dist/blenderbim && $(SED) "s/0.0.0/$(VERSION).$(VERSION_DATE)/" blender_manifest.toml
cd dist/blenderbim/bim && $(SED) "s/8888888/$(LAST_COMMIT_HASH)/" __init__.py
cd dist && zip -r blenderbim-$(VERSION).$(VERSION_DATE)-$(PYVERSION)-$(PLATFORM).zip ./*
endif
rm -rf dist/blenderbim
.PHONY: test
test:
make test-core
make test-tool
make test-bim
.PHONY: test-core
test-core:
pytest -p no:pytest-blender test/core
.PHONY: test-bim
test-bim:
ifndef MODULE
pytest test/bim
else
pytest test/bim -m "$(MODULE)" ./ --maxfail=1
endif
.PHONY: test-tool
test-tool:
ifndef MODULE
pytest test/tool
else
pytest test/tool/test_$(MODULE).py
endif
.PHONY: qa
qa:
black .
pylint ./* --output-format=colorized --disable all --enable E --disable import-error
.PHONY: coverage
coverage:
coverage run --source blenderbim.core -m pytest -p no:pytest-blender test/core
coverage html
xdg-open htmlcov/index.html
.PHONY: license
license:
copyright-header --license GPL3 --copyright-holder "Dion Moult <dion@thinkmoult.com>" --copyright-year "2022" --copyright-software "BlenderBIM Add-on" --copyright-software-description "OpenBIM Blender Add-on" -a ./ -o ./
.PHONY: clean
clean:
rm -rf dist
rm -rf htmlcov
.PHONY: dev
dev:
blender -p setup_pytest.py
-5
View File
@@ -1,5 +0,0 @@
# BlenderBIM Add-on
An add-on to Blender to allow BIM functionality.
More information on the [BlenderBIM Add-on website](https://blenderbim.org).
-220
View File
@@ -1,220 +0,0 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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.
#
# BlenderBIM Add-on 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 BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
# Ensure we don't try to import bpy or blenderbim.bim
# to support running core tests.
# We assume if bpy was never loaded in current python session
# then we're not in Blender. It's still possible to use
# bpy in core and core tests for annotations using TYPE_CHECKING.
IN_BLENDER = sys.modules.get("bpy", None)
if IN_BLENDER:
import bpy
import addon_utils
import platform
import traceback
import webbrowser
from collections import deque
# NOTE: bl_info is superseded by blender_manifest.toml
# if addon is installed as an extension (Blender 4.2+)
bl_info = {
"name": "BlenderBIM",
"description": "Transforms Blender into a native Building Information Model authoring platform using IFC.",
"author": "IfcOpenShell Contributors",
"blender": (3, 1, 0),
"version": (0, 0, 0),
"location": "File Menu, Scene Properties Tab. See documentation for more.",
"doc_url": "https://docs.blenderbim.org/",
"tracker_url": "https://github.com/IfcOpenShell/IfcOpenShell/issues",
"category": "System",
}
last_error = None
last_actions: deque = deque(maxlen=10)
def get_debug_info():
version = ".".join(
[
str(x)
for x in [
addon.bl_info.get("version", (-1, -1, -1))
for addon in addon_utils.modules()
if addon.bl_info["name"] == "BlenderBIM"
][0]
]
)
return {
"os": platform.system(),
"os_version": platform.version(),
"python_version": platform.python_version(),
"architecture": platform.architecture(),
"machine": platform.machine(),
"processor": platform.processor(),
"blender_version": bpy.app.version_string,
"blenderbim_version": version,
"last_actions": last_actions,
"last_error": last_error,
}
def format_debug_info(info: dict):
last_actions = ""
for action in info["last_actions"]:
last_actions += f"\n# {action['type']}: {action['name']}"
if settings := action.get("settings"):
last_actions += f"\n>>> {settings}"
info["last_actions"] = last_actions
text = "\n".join(f"{k}: {v}" for k, v in info.items())
return text.strip()
if IN_BLENDER:
# Process *.pth in /libs/site/packages to setup globally importable modules
# This is 3 levels deep as required by the static RPATH of ../../ from dependencies taken from Anaconda
# site.addsitedir(os.path.join(os.path.dirname(os.path.realpath(__file__)), "libs", "site", "packages"))
sys.path.insert(0, os.path.join(os.path.dirname(os.path.realpath(__file__)), "libs", "site", "packages"))
try:
import ifcopenshell.api
def log_api(usecase_path, ifc_file, settings):
last_actions.append(
{
"type": "ifcopenshell.api",
"name": usecase_path,
"settings": ifcopenshell.api.serialise_settings(settings),
}
)
ifcopenshell.api.add_pre_listener("*", "action_logger", log_api)
def register():
global BLENDER_PACKAGE_NAME, __name__, __package__
BLENDER_PACKAGE_NAME = __name__
if bpy.app.version >= (4, 2, 0):
sys.modules["blenderbim"] = sys.modules[__name__]
__name__ = "blenderbim"
# Only renaming __name__ is actually required to make imports work.
# We renaming __package__ just for consistency.
__package__ = "blenderbim"
import blenderbim.bim
blenderbim.bim.register()
def unregister():
import blenderbim.bim
blenderbim.bim.unregister()
except:
last_error = traceback.format_exc()
print(last_error)
print(format_debug_info(get_debug_info()))
print("\nFATAL ERROR: Unable to load the BlenderBIM Add-on")
class BIM_PT_fatal_error(bpy.types.Panel):
bl_label = "BlenderBIM Fatal Error"
bl_idname = "SCENE_PT_error_message"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
def draw(self, context):
info = get_debug_info()
layout = self.layout
layout.alert = True
layout.label(text="BlenderBIM could not load.", icon="ERROR")
if info["os"] == "Windows":
layout.operator("wm.console_toggle", text="View the console for full logs.", icon="CONSOLE")
else:
layout.label(text="View the console for full logs.", icon="CONSOLE")
box = layout.box()
py = ".".join(info["python_version"].split(".")[0:2])
b3d = ".".join(info["blender_version"].split(".")[0:2])
box.label(text=f"Blender {b3d} {info['os']} {info['machine']}", icon="BLENDER")
box.label(text=f"Python {py} BBIM {info['blenderbim_version']}", icon="SCRIPTPLUGINS")
layout.operator("bim.copy_debug_information", text="Copy Error Message To Clipboard")
op = layout.operator("bim.open_uri", text="How Can I Fix This?")
op.uri = "https://docs.blenderbim.org/users/troubleshooting.html#installation-issues"
layout.label(text="Try Reinstalling:", icon="IMPORT")
op = layout.operator("bim.open_uri", text="Re-download Add-on")
bbim_date = info["blenderbim_version"].split(".")[-1]
py_tag = py.replace(".", "")
if "Linux" in info["os"]:
os = "linux"
elif "Darwin" in info["os"]:
if "arm64" in info["machine"]:
os = "macosm1"
else:
os = "macos"
else:
os = "win"
op.uri = f"https://github.com/IfcOpenShell/IfcOpenShell/releases/download/blenderbim-{bbim_date}/blenderbim-{bbim_date}-py{py_tag}-{os}.zip"
class OpenUri(bpy.types.Operator):
bl_idname = "bim.open_uri"
bl_label = "Open URI"
uri: bpy.props.StringProperty()
def execute(self, context):
webbrowser.open(self.uri)
return {"FINISHED"}
class CopyDebugInformation(bpy.types.Operator):
bl_idname = "bim.copy_debug_information"
bl_label = "Copy Debug Information"
bl_description = "Copies debugging information to your clipboard for use in bugreports"
def execute(self, context):
info = format_debug_info(get_debug_info())
context.window_manager.clipboard = info
return {"FINISHED"}
class HiddenPanel:
@classmethod
def false_poll(cls, context):
return False
def register():
# Only show our error panel and nothing else in the scene tab
for item_name in dir(bpy.types):
item = getattr(bpy.types, item_name)
if not hasattr(item, "bl_rna") or not isinstance(item.bl_rna, bpy.types.Panel):
continue
if getattr(item, "bl_context", None) != "scene":
continue
# Reregister scene panel with a new poll to hide it
item.poll = HiddenPanel.false_poll
bpy.utils.unregister_class(item)
bpy.utils.register_class(item)
bpy.utils.register_class(BIM_PT_fatal_error)
bpy.utils.register_class(CopyDebugInformation)
bpy.utils.register_class(OpenUri)
def unregister():
bpy.utils.unregister_class(OpenUri)
bpy.utils.unregister_class(CopyDebugInformation)
bpy.utils.unregister_class(BIM_PT_fatal_error)
@@ -1,122 +0,0 @@
import argparse
from aiohttp import web
import socketio
import pystache
import json
sio_port = 8080 # default port
sio = socketio.AsyncServer(
cors_allowed_origins="*",
async_mode="aiohttp",
)
# sio.instrument(
# auth={
# "username": "admin",
# "password": "admin",
# }
# )
app = web.Application()
sio.attach(app)
blender_messages = {}
# Web namespace
class WebNamespace(socketio.AsyncNamespace):
def __init__(self, namespace):
super().__init__(namespace)
async def on_connect(self, sid, environ):
print(f"Web client connected: {sid}")
async def on_disconnect(self, sid):
print(f"Web client disconnected: {sid}")
async def on_web_operator(self, sid, data):
await sio.emit(
"web_operator",
data,
namespace="/blender",
room=data["blenderId"],
)
# Blender namespace
class BlenderNamespace(socketio.AsyncNamespace):
def __init__(self, namespace):
super().__init__(namespace)
async def on_connect(self, sid, environ):
print(f"Blender client connected: {sid}")
# Notify web client about new connection
blender_messages[sid] = {}
await sio.emit("blender_connect", sid, namespace="/web")
async def on_disconnect(self, sid):
print(f"Blender client disconnected: {sid}")
# Remove client message and notify web client about disconnection
if sid in blender_messages:
del blender_messages[sid]
await sio.emit("blender_disconnect", sid, namespace="/web")
async def on_data(self, sid, data):
print(f"Data from Blender client {sid}")
# blender_messages[sid]["default_data"] = data
# await sio.emit("default_data", {"blenderId": sid, "data": data}, namespace="/web")
async def on_csv_data(self, sid, data):
print(f"CSV data from Blender client {sid}")
# Store the message and forward it to the web client
blender_messages[sid]["csv_data"] = data
await sio.emit("csv_data", {"blenderId": sid, "data": data}, namespace="/web")
async def on_gantt_data(self, sid, data):
print(f"Gant Chart data from Blender client {sid}")
blender_messages[sid]["gantt_data"] = data
await sio.emit("gantt_data", {"blenderId": sid, "data": data}, namespace="/web")
# Attach namespaces
sio.register_namespace(WebNamespace("/web"))
sio.register_namespace(BlenderNamespace("/blender"))
# Define a route to render the index.html template
async def index(request):
with open("templates/index.html", "r") as f:
template = f.read()
html_content = pystache.render(template, {"port": sio_port})
return web.Response(text=html_content, content_type="text/html")
async def gantt(request):
with open("templates/gantt.html", "r") as f:
template = f.read()
html_content = pystache.render(template, {"port": sio_port})
return web.Response(text=html_content, content_type="text/html")
app.router.add_get("/", index)
app.router.add_get("/gantt", gantt)
app.router.add_static("/jsgantt/", path="../gantt", name="jsgantt")
app.router.add_static("/static/", path="./static", name="static")
def main():
global sio_port
parser = argparse.ArgumentParser(description="SocketIO server")
parser.add_argument("--host", type=str, default="127.0.0.1", help="Host to run the server on")
parser.add_argument("--port", type=int, default=8080, help="Port to run the server on")
args = parser.parse_args()
sio_port = args.port
web.run_app(app, host=args.host, port=sio_port)
if __name__ == "__main__":
main()
# web.run_app(app, host="127.0.0.1", port=sio_port)
@@ -1,280 +0,0 @@
:root {
color-scheme: dark;
}
body {
background-color: #252525;
color: #e0e0e0;
margin: 0;
font-family: Arial, sans-serif;
}
#container {
margin-top: 20px;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 20px;
}
h3 {
margin-top: 0;
}
nav {
background-color: #121212;
padding: 1em 0;
display: flex;
align-items: center;
position: relative;
}
nav .logo {
margin-left: 40px;
height: 40px;
/* Adjust height as needed */
}
nav ul {
list-style-type: none;
margin: 0;
margin-left: 1px;
display: flex;
flex-grow: 1;
justify-content: center;
}
nav ul li {
margin-right: 50px;
}
nav ul li a {
text-decoration: none;
color: #fff;
font-size: 1.2em;
}
nav ul li a:hover,
nav ul li a.active {
color: #3fb449;
}
nav .bottom-bar {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
background-color: #25682a;
}
.table-description {
margin-bottom: 1rem;
width: 50%;
background-color: transparent;
border-collapse: collapse;
border-spacing: 0;
border-color: #464444;
border: 1px solid #464444;
border-radius: 0.25rem;
box-shadow: 0 0 0.7rem rgba(95, 95, 95, 0.4);
text-align: center;
}
.table-description tr {
display: table-row;
border-bottom: 1px solid #464444;
}
.gantt-info {
margin: 0.5rem;
font-size: 1rem;
font-weight: bold;
}
.btn {
margin: 0.5rem;
font-size: 1rem;
cursor: pointer;
}
@media print {
.no-print {
display: none;
}
}
/* ------------ Overwriting JSGantt CSS rules ------------ */
div.gantt {
background-color: #252525;
color: #c7c7c7;
}
.gantt table {
border-color: #464444;
;
}
.gantt td {
border-color: #464444;
;
}
/* Headings and cell defaults */
.gmajorheading,
.gminorheading,
.gminorheadingwkend,
.gtaskcell,
.gtaskcellcurrent,
.gtaskcellwkend,
.gname,
.ggroupitem,
.gtaskheading {
background-color: #252525;
border-color: #464444;
;
}
.gtaskheading,
.gname,
.gtaskname,
.gres,
.gdur,
.gcomp,
.gstartdate,
.gplanstartdate,
.gplanenddate,
.gcost,
.gchartlbl,
.gcontainercol,
.genddate {
color: #c7c7c7;
border-color: #464444;
;
}
.gtaskname>div {
color: #c7c7c7;
}
.gtaskbarcontainer.gplan,
.gchartlbl.gcontainercol {
background: #252525;
border-color: #464444;
}
.gtaskname div,
.gtaskheading div,
.gtaskname span {
color: #c7c7c7;
}
.gtasklist,
.gadditional {
border: #464444 1px solid
}
.gchartgrid {
background-color: #252525;
}
.glistgrid,
.glistlbl {
background-color: #252525;
border-color: #464444;
;
}
/* .gTaskInfo {
background-color: #2e2e2e;
color: #c7c7c7;
border-color: #c7c7c7;;
} */
/* Dark mode scrollbar */
.frame::-webkit-scrollbar-thumb {
background-color: #252525;
}
.frame::-webkit-scrollbar-track {
background-color: #252525;
}
/* Highlight row */
.gitemhighlight td {
background-color: #009136;
color: #ffffff;
}
/* Differentiate Group, Milestone and Ordinary task items (applied to row) */
.ggroupitem {
background-color: #252525;
font-weight: bold;
border-color: #464444;
}
.gmileitem,
.glineitem {
background-color: #252525;
}
/* Task bar caption text styles */
.gmilecaption,
.ggroupcaption,
.gcaption {
color: #ffffff;
}
/* Task complete %age bar */
.gtaskcomplete {
background-color: #777777;
}
/* Milestones */
.gmdtop {
border-bottom: 5px solid #ffffff;
}
.gmdbottom {
border-top: 5px solid #ffffff;
}
.gfoldercollapse {
color: #c7c7c7;
cursor: pointer;
font-weight: bold;
font-size: 12px;
font-family: Courier, "Courier New", monospace;
}
/* Highlight for collapsible row */
.gname.ggroupitem {
background-color: rgb(75, 75, 75);
}
/* Form label and selected highlighting */
.gformlabel {
background-color: #2e2e2e;
color: #c7c7c7;
border: #4a4a4a 1px solid;
}
span.gformlabel:hover {
background-color: #3a3a3a;
border-color: #565656;
}
span.gselected {
background-color: #565656;
border-color: #777777;
color: #ffffff;
}
.gantt-inputtable {
background-color: #3b3b3b;
box-sizing: border-box;
border: 1px solid #000;
color: #c7c7c7;
}
@@ -1,76 +0,0 @@
:root {
color-scheme: dark;
}
body {
background-color: #252525;
color: #e0e0e0;
margin: 0;
font-family: Arial, sans-serif;
}
#container {
margin-top: 20px;
margin-left: 10px;
margin-right: 10px;
margin-bottom: 20px
}
.table-container {
margin-bottom: 40px;
}
.csv-table {
margin-top: 10px;
}
h3 {
margin-top: 0;
}
nav {
background-color: #121212;
padding: 1em 0;
display: flex;
align-items: center;
position: relative;
}
nav .logo {
margin-left: 40px;
height: 40px;
/* Adjust height as needed */
}
nav ul {
list-style-type: none;
margin: 0;
margin-left: 1px;
display: flex;
flex-grow: 1;
justify-content: center;
}
nav ul li {
margin-right: 50px;
}
nav ul li a {
text-decoration: none;
color: #fff;
font-size: 1.2em;
}
nav ul li a:hover,
nav ul li a.active {
color: #3fb449;
}
nav .bottom-bar {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 2px;
background-color: #25682a;
}
@@ -1,339 +0,0 @@
// keeps track of blenders connected in form of
// shown:bool, workSchedule: {}, ganttTasks: {},
const connectedClients = {};
let socket;
// print options
const pageSizes = [
{ value: "210,297", text: "A4 Portrait" },
{ value: "297,210", text: "A4 Landscape" },
{ value: "297,420", text: "A3 Portrait" },
{ value: "420,297", text: "A3 Landscape" },
{ value: "420,594", text: "A2 Portrait" },
{ value: "594,420", text: "A2 Landscape" },
{ value: "594,841", text: "A1 Portrait" },
{ value: "841,594", text: "A1 Landscape" },
{ value: "841,1189", text: "A0 Portrait" },
{ value: "1189,841", text: "A0 Landscape" },
];
// Document ready function
$(document).ready(function () {
connectSocket();
});
// Function to connect to Socket.IO server
function connectSocket() {
const url = "ws://localhost:" + SOCKET_PORT + "/web";
socket = io(url);
console.log("socket: ", socket);
// Register socket event handlers
socket.on("blender_connect", handleBlenderConnect);
socket.on("blender_disconnect", handleBlenderDisconnect);
socket.on("gantt_data", handleGanttData);
}
// Function to handle 'blender_connect' event
function handleBlenderConnect(blenderId) {
console.log("blender_connect: ", blenderId);
if (!connectedClients.hasOwnProperty(blenderId)) {
connectedClients[blenderId] = {
shown: false,
workSchedule: {},
ganttTasks: {},
};
}
}
// Function to handle 'blender_disconnect' event
function handleBlenderDisconnect(blenderId) {
console.log("blender_disconnect: ", blenderId);
if (connectedClients.hasOwnProperty(blenderId)) {
delete connectedClients[blenderId];
removeGanttElement(blenderId);
}
}
// Function to handle 'gantt_data' event
function handleGanttData(data) {
const blenderId = data["blenderId"];
console.log(data);
const filename = data["data"]["IFC_File"];
const ganttTasks = data["data"]["gantt_data"]["tasks"];
const ganttWorkSched = data["data"]["gantt_data"]["work_schedule"];
// const ganttWorkSched = {};
if (connectedClients.hasOwnProperty(blenderId)) {
if (!connectedClients[blenderId].shown) {
connectedClients[blenderId] = {
shown: true,
ganttTasks: ganttTasks,
workSchedule: ganttWorkSched,
};
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
} else {
updateGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
connectedClients[blenderId].workSchedule = ganttWorkSched;
connectedClients[blenderId].ganttTasks = ganttTasks;
}
} else {
connectedClients[blenderId] = {
shown: true,
ganttTasks: ganttTasks,
workSchedule: ganttWorkSched,
};
addGanttElement(blenderId, ganttTasks, ganttWorkSched, filename);
}
}
// Function to add a new gantt with data and filename
function addGanttElement(blenderId, tasks, workSched, filename) {
const ganttContainer = $("<div></div>")
.addClass("gantt-container")
.attr("id", "container-" + blenderId);
const ganttTitle = $("<h3></h3>")
.attr("id", "title-" + blenderId)
.text(filename)
.addClass("no-print")
.css("margin-bottom", "10px");
const workSchedDiv = $("<div></div>").attr("id", "workSched" + blenderId);
const scheduleTable = $("<table></table>")
.addClass("no-print table-description")
.attr("id", "workSchedTable-" + blenderId)
.hide();
$.each(workSched, (key, value) => {
value = value ? value : "null";
$("<tr></tr>")
.append($("<td></td>").text(key))
.append($("<td></td>").text(value))
.appendTo(scheduleTable);
});
const toggleButton = $("<button></button>")
.text("Show Schedule Info")
.addClass("btn no-print")
.on("click", function () {
scheduleTable.toggle();
const buttonText = scheduleTable.is(":visible")
? "Hide Schedule Info"
: "Show Schedule Info";
toggleButton.text(buttonText);
});
var ganttInfoDiv = $("<div></div>")
.addClass("gantt-info")
.attr("id", "gantt-info-" + blenderId);
const scheduleName = $("<span></span>").text("Schedule: " + workSched.Name);
const createdOn = $("<span></span>")
.text("Created: " + new Date(workSched.CreationDate).toLocaleDateString())
.css("float", "right");
const ganttDiv = $("<div></div>")
.addClass("gantt-chart")
.attr("id", "gantt-" + blenderId);
ganttInfoDiv.append(scheduleName);
ganttInfoDiv.append(createdOn);
workSchedDiv.append(toggleButton);
workSchedDiv.append(scheduleTable);
ganttContainer.append(ganttTitle);
ganttContainer.append(workSchedDiv);
ganttContainer.append(ganttInfoDiv);
ganttContainer.append(ganttDiv);
$("#container").append(ganttContainer);
let g = new JSGantt.GanttChart($("#gantt-" + blenderId)[0], "week");
g.setOptions({
vCaptionType: "Caption", // Set to Show Caption : None,Caption,Resource,Duration,Complete,
vQuarterColWidth: 36,
vDateTaskDisplayFormat: "day dd month yyyy", // Shown in tool tip box
vDayMajorDateDisplayFormat: "mon yyyy - Week ww", // Set format to dates in the "Major" header of the "Day" view
vWeekMinorDateDisplayFormat: "dd mon", // Set format to display dates in the "Minor" header of the "Week" view
vLang: "en",
vShowTaskInfoLink: 1, // Show link in tool tip (0/1)
vShowEndWeekDate: 0, // Show/Hide the date for the last day of the week in header for daily
vUseSingleCell: 10000, // Set the threshold cell per table row (Helps performance for large data.
vFormatArr: ["Day", "Week", "Month", "Quarter"], // Even with setUseSingleCell using Hour format on such a large chart can cause issues in some browsers,
vShowRes: true, // Disable the resource column.
vShowComp: false, // Disable the completion column.
vShowDur: false, // Disable the duration column, because jsgantt doesn't calculate durations the way we want.
vAdditionalHeaders: {
ifcduration: { title: "Duration" },
resourceUsage: { title: "Resource Usage" },
},
vUseToolTip: true, // Disable tooltips.
vTooltipTemplate: generateTooltip,
vTotalHeight: 900,
vEventsChange: {
taskname: editValue, // if you need to use the this scope, do: editValue.bind(this)
res: editValue,
dur: editValue,
comp: editValue,
start: editValue,
end: editValue,
planstart: editValue,
planend: editValue,
cost: editValue,
additional_category: editValue,
},
});
JSGantt.addJSONTask(g, tasks);
g.setEditable(true);
g.Draw();
connectedClients[blenderId]["gantt"] = g;
let printButton = $("<button>", {
id: "print-btn-" + blenderId,
html: "Print",
class: "btn no-print",
});
let printOptions = $("<select>", {
id: "print-options-" + blenderId,
class: "no-print",
});
$.each(pageSizes, function (index, size) {
printOptions.append(
$("<option>", {
value: size.value,
text: size.text,
})
);
});
printButton.on("click", function () {
// make it only the corresponding gantt chart is printed
$(".gantt-chart").removeClass("no-print");
$(".gantt-chart")
.not("#gantt-" + blenderId)
.addClass("your-css-class");
var values = $("#print-options-" + blenderId)
.val()
.split(",");
g.setEditable(false);
g.setTotalHeight("");
g.Draw();
addEventListener("afterprint", (event) => {
g.setEditable(true);
},);
let css =
"@media print {\n" +
" @page {\n" +
" size: " +
values[0] +
"mm " +
values[1] +
"mm;\n" +
" }\n" +
" /* Make all text black */\n" +
" body, p, span, h1, h2, h3, h4, h5, h6, div, a, li, td, th, * {\n" +
" color: black !important;\n" +
" }\n" +
"}";
g.printChart(values[0], values[1], css);
g.setTotalHeight(900);
g.Draw();
});
ganttContainer.append(printOptions);
ganttContainer.append(printButton);
}
// Function to update gantt and filename
function updateGanttElement(blenderId, tasks, workSched, filename) {
// update work schedule table
const table = $("#workSchedTable-" + blenderId);
table.empty();
$.each(workSched, (key, value) => {
value = value ? value : "null";
$("<tr></tr>")
.append($("<td></td>").text(key))
.append($("<td></td>").text(value))
.appendTo(table);
});
// update gantt chart with new data
let g = connectedClients[blenderId]["gantt"];
g.ClearTasks();
g.Draw();
JSGantt.addJSONTask(g, tasks);
g.Draw();
$("#title-" + blenderId).text(filename);
}
// Function to remove gantt element
function removeGanttElement(blenderId) {
$("#container-" + blenderId).remove();
}
// Utility function to create a tooltip for the gantt chars
function generateTooltip(task) {
var dataObject = task.getDataObject();
var numberResources = dataObject.resourceUsage
? dataObject.resourceUsage
: "NULL";
return `
<dl>
<dt>Name:</dt><dd>{{pName}}</dd>
<dt>Start:</dt><dd>{{pStart}}</dd>
<dt>End:</dt><dd>{{pEnd}}</dd>
<dt>Duration:</dt><dd>${dataObject.ifcduration}</dd>
<dt>Number of Resources:</dt><dd>${numberResources}</dd>
<dt>Resources:</dt><dd>{{pRes}}</dd>
</dl>
`;
}
// Event handlers for editing gantt table data
function editValue(list, task, event, cell, column) {
console.log("editValue function called with the following parameters:");
console.log("list:", list);
console.log("task:", task);
console.log("event:", event);
console.log("cell:", cell);
console.log("column:", column);
const ganttId = task.getGantt()["vDiv"].id;
const index = ganttId.indexOf("-") + 1;
const blenderId = ganttId.substring(index);
const workSchedId = connectedClients[blenderId].workSchedule.id;
// update data object reprsenting the task
const dataObj = task.getDataObject();
dataObj[column] = event.target.value;
task.setDataObject(dataObj);
const msg = {
sourcePage: "gantt",
blenderId: blenderId,
operator: {
type: "editTask",
workScheduleId: workSchedId,
taskId: task.getOriginalID(),
column: column,
value: event.target.value,
},
};
socket.emit("web_operator", msg);
}
@@ -1,221 +0,0 @@
// keeps track of blenders connected in form of
// {shown:bool, filename:string, headers:array}
const connectedClients = {};
let socket;
// Document ready function
$(document).ready(function () {
connectSocket();
});
// Function to connect to Socket.IO server
function connectSocket() {
const url = "ws://localhost:" + SOCKET_PORT + "/web";
socket = io(url);
console.log("socket: ", socket);
// Register socket event handlers
socket.on("blender_connect", handleBlenderConnect);
socket.on("blender_disconnect", handleBlenderDisconnect);
socket.on("csv_data", handleCsvData);
}
// Function to handle 'blender_connect' event
function handleBlenderConnect(blenderId) {
console.log("blender_connect: ", blenderId);
if (!connectedClients.hasOwnProperty(blenderId)) {
connectedClients[blenderId] = { shown: false, ifc_file: "" };
}
}
// Function to handle 'blender_disconnect' event
function handleBlenderDisconnect(blenderId) {
console.log("blender_disconnect: ", blenderId);
if (connectedClients.hasOwnProperty(blenderId)) {
delete connectedClients[blenderId];
removeTableElement(blenderId);
}
}
// Function to handle 'csv_data' event
function handleCsvData(data) {
const blenderId = data["blenderId"];
const csvData = data["data"]["csv_data"];
const filename = data["data"]["IFC_File"];
console.log(data);
if (connectedClients.hasOwnProperty(blenderId)) {
if (!connectedClients[blenderId].shown) {
connectedClients[blenderId] = {
shown: true,
ifc_file: filename,
headers: [],
};
addTableElement(blenderId, csvData, filename);
} else {
updateTableElement(blenderId, csvData, filename);
}
} else {
connectedClients[blenderId] = {
shown: true,
ifc_file: filename,
headers: [],
};
addTableElement(blenderId, csvData, filename);
}
}
// Function to add a new table with data and filename
function addTableElement(blenderId, csvData, filename) {
// store headers of the csv data
const firstLine = csvData.indexOf("\n");
const csvHeaders = csvData.substring(0, firstLine).split(",");
connectedClients[blenderId].headers = csvHeaders;
console.log(connectedClients[blenderId]);
const tableContainer = $("<div></div>")
.addClass("table-container")
.attr("id", "container-" + blenderId);
const tableTitle = $("<h3></h3>")
.attr("id", "title-" + blenderId)
.text(filename)
.css("margin-bottom", "10px");
const tableDiv = $("<div></div>")
.addClass("csv-table")
.attr("id", "table-" + blenderId);
tableContainer.append(tableTitle);
tableContainer.append(tableDiv);
$("#container").append(tableContainer);
function createHeaderMenu(definitions) {
var menu = [];
for (let column of definitions) {
// Create text element for checkbox
if (!column.hasOwnProperty("key")) {
column.visible = true;
}
let checkbox = document.createElement("span");
checkbox.textContent = column.visible ? "\u2611" : "\u2610"; // ☑ or ☐
// Build label
let label = document.createElement("span");
let title = document.createElement("span");
title.textContent = " " + column.title;
label.appendChild(checkbox);
label.appendChild(title);
// Create menu item
menu.push({
label: label,
action: function (e) {
// Prevent menu closing
e.stopPropagation();
// Toggle current column visibility
column.visible = !column.visible;
console.log(column.title, column.visible);
// Change menu item checkbox
if (column.visible) {
table.showColumn(column.title);
checkbox.textContent = "\u2611"; // ☑
} else {
table.hideColumn(column.title);
checkbox.textContent = "\u2610"; // ☐
}
},
});
}
return menu;
}
var table = new Tabulator("#table-" + blenderId, {
height: "400px",
resizableColumnGuide: true,
index: "GlobalId",
data: csvData,
importFormat: "csv",
autoColumns: true,
selectableRows: 1,
layout: "fitColumns",
autoColumnsDefinitions: function (definitions) {
menu = createHeaderMenu(definitions, table);
definitions.forEach((column) => {
column.visible = true;
column.headerMenu = menu;
});
return definitions;
},
});
table.on("rowSelected", function (row) {
var index = row.getIndex(); // the guid of the object
if (!index) {
console.log("No Global ID found");
return;
}
// table id is usually "table-BlenderId" so blender id is always
// after the first 6 characters
var tableId = row.getTable().element.id.substr(6);
const msg = {
sourcePage: "csv",
blenderId: tableId,
operator: {
type: "selection",
globalId: index,
},
};
socket.emit("web_operator", msg);
});
}
// Function to update table and filename
function updateTableElement(blenderId, csvData, filename) {
// check if the headers are the same
// if yes, just replace the data
// else, replace the whole data and column definations
const firstLine = csvData.indexOf("\n");
const newHeaders = csvData.substring(0, firstLine).split(",");
const sameHeaders = compareHeaders(
connectedClients[blenderId].headers,
newHeaders
);
const table = Tabulator.findTable("#table-" + blenderId)[0];
if (table) {
if (sameHeaders) {
table.replaceData(csvData, { importFormat: "csv" });
} else {
table.setData(csvData);
connectedClients[blenderId].headers = newHeaders;
}
$("#title-" + blenderId).text(filename);
}
}
// Function to remove table element
function removeTableElement(blenderId) {
$("#container-" + blenderId).remove();
}
// Utility function to compare two csv header
function compareHeaders(headers1, headers2) {
if (headers1.length !== headers2.length) {
return false;
}
for (let i = 0; i < headers1.length; i++) {
if (headers1[i] !== headers2[i]) {
return false;
}
}
return true;
}
@@ -1,34 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Web Client</title>
<link rel="stylesheet" type="text/css" href="/jsgantt/jsgantt.css" />
<link rel="stylesheet" href="/static/css/gantt.css" />
<script
type="text/javascript"
src="https://code.jquery.com/jquery-3.6.0.min.js"
></script>
<script
type="text/javascript"
src="https://cdn.socket.io/4.0.0/socket.io.min.js"
></script>
<script type="text/javascript" src="./jsgantt/jsgantt.js"></script>
<script>
var SOCKET_PORT = {{port}};
</script>
<script defer src="./static/js/gantt.js"></script>
</head>
<body>
<nav class="no-print">
<img src="https://blenderbim.org/assets/images/blender/blender-logo.png" alt="Logo" class="logo" />
<ul>
<li><a href="/">IFC Data</a></li>
<li><a href="/gantt" class="active">Gantt Chart</a></li>
</ul>
<div class="bottom-bar"></div>
</nav>
<div id="container"></div>
</body>
</html>
@@ -1,40 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Web Client</title>
<link rel="stylesheet" href="/static/css/index.css" />
<link
rel="stylesheet"
href="https://unpkg.com/tabulator-tables/dist/css/tabulator_site_dark.min.css"
/>
<script
type="text/javascript"
src="https://code.jquery.com/jquery-3.6.0.min.js"
></script>
<script
type="text/javascript"
src="https://unpkg.com/tabulator-tables/dist/js/tabulator.min.js"
></script>
<script
type="text/javascript"
src="https://cdn.socket.io/4.0.0/socket.io.min.js"
></script>
<script>
var SOCKET_PORT = {{port}};
</script>
<script defer src="./static/js/index.js"></script>
</head>
<body>
<nav>
<img src="https://blenderbim.org/assets/images/blender/blender-logo.png" alt="Logo" class="logo" />
<ul>
<li><a href="/" class="active">IFC Data</a></li>
<li><a href="/gantt">Gantt Chart</a></li>
</ul>
<div class="bottom-bar"></div>
</nav>
<div id="container"></div>
</body>
</html>
@@ -1,42 +0,0 @@
# BlenderBIM Add-on - OpenBIM Blender Add-on
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on 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.
#
# BlenderBIM Add-on 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 BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import bpy
from . import ui, prop, operator
classes = (
operator.ExecuteBIMTester,
operator.BIMTesterPurge,
operator.SelectFeature,
operator.SelectSteps,
operator.SelectBIMTesterIfcFile,
operator.RejectElement,
operator.ApproveClass,
operator.RejectClass,
operator.SelectAudited,
prop.BimTesterProperties,
ui.BIM_PT_qa,
)
def register():
bpy.types.Scene.BimTesterProperties = bpy.props.PointerProperty(type=prop.BimTesterProperties)
def unregister():
del bpy.types.Scene.BimTesterProperties

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