Title: BlenderBim : IFC Style Attribute is None, causing error on validation · Issue #1672 · IfcOpenShell/IfcOpenShell · GitHub
Open Graph Title: BlenderBim : IFC Style Attribute is None, causing error on validation · Issue #1672 · IfcOpenShell/IfcOpenShell
X Title: BlenderBim : IFC Style Attribute is None, causing error on validation · Issue #1672 · IfcOpenShell/IfcOpenShell
Description: When editing a material's style attributes, the attribute styles is initialized as None. Which causes an error when validating the style. Error: Python: Traceback (most recent call last): File "C:\Users\NH\AppData\Roaming\Blender Foundat...
Open Graph Description: When editing a material's style attributes, the attribute styles is initialized as None. Which causes an error when validating the style. Error: Python: Traceback (most recent call last): File "C:\...
X Description: When editing a material's style attributes, the attribute styles is initialized as None. Which causes an error when validating the style. Error: Python: Traceback (most recent call last): File ...
Opengraph URL: https://github.com/IfcOpenShell/IfcOpenShell/issues/1672
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"BlenderBim : IFC Style Attribute is None, causing error on validation","articleBody":"\r\n\r\nWhen editing a material's style attributes, the attribute `styles` is initialized as `None`. Which causes an error when validating the style.\r\n\r\n\r\n```\r\n\r\nError: Python: Traceback (most recent call last):\r\n File \"C:\\Users\\NH\\AppData\\Roaming\\Blender Foundation\\Blender\\2.93\\scripts\\addons\\blenderbim\\bim\\module\\style\\operator.py\", line 159, in execute\r\n return IfcStore.execute_ifc_operator(self, context)\r\n File \"C:\\Users\\NH\\AppData\\Roaming\\Blender Foundation\\Blender\\2.93\\scripts\\addons\\blenderbim\\bim\\ifc.py\", line 217, in execute_ifc_operator\r\n result = getattr(operator, \"_execute\")(context)\r\n File \"C:\\Users\\NH\\AppData\\Roaming\\Blender Foundation\\Blender\\2.93\\scripts\\addons\\blenderbim\\bim\\module\\style\\operator.py\", line 173, in _execute\r\n ifcopenshell.api.run(\"style.edit_style\", self.file, **{\"style\": style, \"attributes\": attributes})\r\n File \"c:\\Program Files (x86)\\Steam\\steamapps\\common\\Blender\\2.93\\scripts\\modules\\ifcopenshell\\api\\__init__.py\", line 46, in run \r\n result = usecase_class(ifc_file, **settings).execute()\r\n File \"c:\\Program Files (x86)\\Steam\\steamapps\\common\\Blender\\2.93\\scripts\\modules\\ifcopenshell\\api\\style\\edit_style.py\", line 10, in execute\r\n setattr(self.settings[\"style\"], name, value)\r\n File \"c:\\Program Files (x86)\\Steam\\steamapps\\common\\Blender\\2.93\\scripts\\modules\\ifcopenshell\\entity_instance.py\", line 121, in __setattr__\r\n self[index] = value\r\n File \"c:\\Program Files (x86)\\Steam\\steamapps\\common\\Blender\\2.93\\scripts\\modules\\ifcopenshell\\entity_instance.py\", line 139, in __setitem__\r\n self.wrapped_data.setArgumentAsNull(idx)\r\n File \"c:\\Program Files (x86)\\Steam\\steamapps\\common\\Blender\\2.93\\scripts\\modules\\ifcopenshell\\ifcopenshell_wrapper.py\", line 1774, in setArgumentAsNull\r\n return _ifcopenshell_wrapper.entity_instance_setArgumentAsNull(self, i)\r\nRuntimeError: Attribute not set\r\n\r\nlocation: \u003cunknown location>:-1\r\n```\r\n\r\nI've found a temporary workaround to set the attribute to an empty string before calling the api operator : \r\n\r\n def _execute(self, context):\r\n material = context.active_object.active_material\r\n props = material.BIMStyleProperties\r\n attributes = blenderbim.bim.helper.export_attributes(props.attributes)\r\n \"\"\"\r\n for key, value in attributes.items():\r\n # The \"styles\" attribute is None which it shouldn't be. Defaulting to empty string to prevent error\r\n if value is None:\r\n attributes[key] = \"\"\r\n \"\"\"\r\n self.file = IfcStore.get_file()\r\n style = self.file.by_id(material.BIMMaterialProperties.ifc_style_id)\r\n ifcopenshell.api.run(\"style.edit_style\", self.file, **{\"style\": style, \"attributes\": attributes})\r\n Data.load(IfcStore.get_file(), material.BIMMaterialProperties.ifc_style_id)\r\n bpy.ops.bim.disable_editing_style()\r\n return {\"FINISHED\"}\r\n\r\nI'm wondering if the error can be fixed higher up in the chain of events. Just wanted to point that out in case there is an obvious fix. :)","author":{"url":"https://github.com/Gorgious56","@type":"Person","name":"Gorgious56"},"datePublished":"2021-08-19T20:55:02Z","url":"https://github.com/IfcOpenShell/IfcOpenShell/issues/1672"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:78e24a53-bd1b-25e7-b759-ece7e6b1cc0a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 974C:29B90A:607A4:83C8D:6B04AEB3 |
| html-safe-nonce | c52f5a03b41b535af976c11f97addf8613e824ac60b9aa8e181e2789dacc871d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NzRDOjI5QjkwQTo2MDdBNDo4M0M4RDo2QjA0QUVCMyIsInZpc2l0b3JfaWQiOiI4MDU5NTcwNzg0ODgyMTc1NjY3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a64ff967ff0da9c9d7a7384925559c8a1bc3a93a248bbbb287978a13dcd63222 |
| hovercard-subject-tag | issue:975040867 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/IfcOpenShell/IfcOpenShell/1672/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a138be1c83a385e81c4c0021db0bc7796e9de8596ad5a1a341b9b395e0070a6c/IfcOpenShell/IfcOpenShell/issues/1672 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a138be1c83a385e81c4c0021db0bc7796e9de8596ad5a1a341b9b395e0070a6c/IfcOpenShell/IfcOpenShell/issues/1672 |
| og:image:alt | When editing a material's style attributes, the attribute styles is initialized as None. Which causes an error when validating the style. Error: Python: Traceback (most recent call last): File "C:\... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Gorgious56 |
| hostname | github.com |
| expected-hostname | github.com |
| None | f1d110ea058a0915c1d8aa3fc2069fa15801e128f591e5762525abe77490ecb1 |
| turbo-cache-control | no-preview |
| go-import | github.com/IfcOpenShell/IfcOpenShell git https://github.com/IfcOpenShell/IfcOpenShell.git |
| octolytics-dimension-user_id | 13692563 |
| octolytics-dimension-user_login | IfcOpenShell |
| octolytics-dimension-repository_id | 40473201 |
| octolytics-dimension-repository_nwo | IfcOpenShell/IfcOpenShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 40473201 |
| octolytics-dimension-repository_network_root_nwo | IfcOpenShell/IfcOpenShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ffa22a65e4c46d376940fe34b05e6a7e9c7fdb9b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width