I have an IFC file with some IFC data. The PSet is called PP_Description. Is it possible to iterate through the IFC elements and when they have PP_Description present, create a Blender Custom Parameter with the same name (PP_Description) and the same value? 
Comments
No reason why not. Ironically I created a PR that did the opposite of what you are asking for; Blender Custom Properties to Pset values. Maybe that will give you some clues...
Thanks for the link.
I'm not a coder and I can't seem to get the correct imports for working with the IFC data....I'm trying to get an AI to help but it seems stuck on which imports to use too....
`import bpy
import ifcopenshell
import ifcopenshell.api
from ifcopenshell.util.pset import PsetQto
Define the target PSet names
TARGET_PSETS = {"PP_Description", "PP_Description_Model", "PP_Description_Size"}
def add_custom_properties_from_psets():
ifc_file = ifcopenshell.api.run("context.get_file", None)
if not ifc_file:
print("No IFC file found.")
return
add_custom_properties_from_psets()`
When I run a simplified script to just report the value of one named PSet on one selected object, nothing is found depsite that Object having it's PSet name and value shown in Bonsai. Does Bonsai use different PSet Names under the hood (perhaps a prefix or suffix)?
import bpy
import bonsai.tool as tool
import ifcopenshell.util.element
class ReportPsetValue(bpy.types.Operator):
"""Report the value of PSet PP_Description for the selected object in the console"""
bl_idname = "object.report_pset_value"
bl_label = "Report PSet Value"
bl_options = {"REGISTER", "UNDO"}
Register the operator
bpy.utils.register_class(ReportPsetValue)
To use: Select an object, then run bpy.ops.object.report_pset_value() or search via F3
I've worked it out - the PSet is a collection. The Collection is like a dictionary of the Parameter Names and Values (Revit Project Parameters with their Values). All working now.