I managed to create a json file from all the Properties in my PropertyGroup class.
{
"my_selectionload": "C:\\Algemeen\\07_ifcopenshell\\00_ifc\\02_ifc_library\\IFC4 demo_selectionset.json",
"my_ifcproduct": false,
"my_ifcproductname": false,
"my_ifcproducttypename": false,
"my_ifcbuildingstorey": false,
"my_ifcclassification": false,
"my_ifcmaterial": false,
"my_ifcpsetcommon": true,
"my_isexternal": true,
"my_loadbearing": true,
"my_firerating": false,
"my_acousticrating": false,
"my_length": false,
"my_width": true,
"my_height": true,
"my_area": false,
"my_netarea": false,
"my_netsidearea": false,
"my_grossarea": false,
"my_grosssidearea": false,
"my_volume": true,
"my_netvolume": true,
"my_grossvolume": true,
"my_spreadsheetfile": "C:\\Algemeen\\07_ifcopenshell\\00_ifc\\02_ifc_library\\IFC Schependomlaan_blenderbim.xlsx",
"ods_or_xlsx": "ODS",
"key1": "1",
"key2": "2"
}
How would I set all the properties accordingly to this json file in the Blender UI? I am struggling with the logic.
So far I came up with this:
ifc_properties = context.scene.ifc_properties
selection_file = open(ifc_properties.my_selectionload)
selection_configuration = json.load(selection_file)
for my_ifcproperty in ifc_properties.__annotations__.keys():
my_ifcpropertyvalue = getattr(ifc_properties, my_ifcproperty)
for property_name_from_json, property_value_from_json in selection_configuration.items():
if my_ifcproperty==property_name_from_json:
if property_value_from_json == True:
ifc_properties.my_ifcproductname = True
if property_value_from_json == False:
ifc_properties.my_ifcproductname = False
But sometimes it seems to work and other times not, I am getting a bit confused.