Write Pset and Qset via python code

edited February 19 in General

Hi everyone,
I'm trying to write custom pset and qto set via python code. For now I've tried to follow this instruction https://wiki.osarch.org/index.php?title=BlenderBIM_Add-on/BlenderBIM_Add-on_code_examples but it doesn't work and I don't know why. Would someone be able to help me with this issue? I really appreciate any help you can provide.
Below there is the code I texted:

====================================================

import bpy
import numpy as np
import os
import ifcopenshell
from ifcopenshell.api import run
import ifcopenshell.api.owner.settings

=====================================================

Create BIM project

createProject = True
if createProject:
bpy.ops.bim.create_project()
bpy.context.scene.BIMProjectProperties.author_name = "Valerio Gianforte"
bpy.context.scene.BIMProjectProperties.organisation_name = "LIam"

Create Object

addCube = True
if addCube:
cube = bpy.ops.mesh.primitive_cube_add()
bpy.context.scene.BIMProjectProperties.ifc_product = "IfcElement"
bpy.context.scene.BIMProjectProperties.ifc_class = "IfcCivilElement"
bpy.ops.bim.assign_class(ifc_class = "IfcCivilElement",
predefined_type = "IfcCivilElementType",
userdefined_type = "")
bpy.data.objects["IfcCivilElement/Cube"].BIMTypeProperties.relating_type_class = "IfcCivilElementType"
pset = bpy.context.active_object.BIMObjectProperties.psets.add()
pset.name = "Pset_PackingInstruction"
prop = pset.properties.add()
prop.name = "AC_Pset_RenovationAndPhasing"
prop.string_value = "Costo della struttura"

I'd like to obtain a situation like the following image:

Comments

Sign In or Register to comment.