mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-03 13:28:19 +00:00
Fix bug where you could add psets of the same name multiple times
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import bpy
|
import bpy
|
||||||
from blenderbim.bim.prop import Attribute
|
from blenderbim.bim.prop import Attribute
|
||||||
|
from blenderbim.bim.module.pset.data import Data
|
||||||
import blenderbim.bim.schema
|
import blenderbim.bim.schema
|
||||||
from bpy.types import PropertyGroup
|
from bpy.types import PropertyGroup
|
||||||
from bpy.props import (
|
from bpy.props import (
|
||||||
@@ -20,12 +21,16 @@ qtonames = {}
|
|||||||
|
|
||||||
def getPsetNames(self, context):
|
def getPsetNames(self, context):
|
||||||
global psetnames
|
global psetnames
|
||||||
if "/" in context.active_object.name:
|
obj = context.active_object
|
||||||
ifc_class = context.active_object.name.split("/")[0]
|
if "/" in obj.name:
|
||||||
|
ifc_class = obj.name.split("/")[0]
|
||||||
if ifc_class not in psetnames:
|
if ifc_class not in psetnames:
|
||||||
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
|
psets = blenderbim.bim.schema.ifc.psetqto.get_applicable(ifc_class, pset_only=True)
|
||||||
psetnames[ifc_class] = [(p.Name, p.Name, "") for p in psets]
|
psetnames[ifc_class] = [(p.Name, p.Name, "") for p in psets]
|
||||||
return psetnames[ifc_class]
|
assigned_names = [
|
||||||
|
Data.psets[p]["Name"] for p in Data.products[obj.BIMObjectProperties.ifc_definition_id]["psets"]
|
||||||
|
]
|
||||||
|
return [p for p in psetnames[ifc_class] if p[0] not in assigned_names]
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user