mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 02:47:48 +00:00
Implement ability to edit individual BCF reference links
This commit is contained in:
@@ -40,6 +40,7 @@ if bpy is not None:
|
||||
operator.ViewBcfTopic,
|
||||
operator.RemoveBcfComment,
|
||||
operator.RemoveBcfReferenceLink,
|
||||
operator.EditBcfReferenceLinks,
|
||||
operator.EditBcfComment,
|
||||
operator.AddBcfComment,
|
||||
operator.ActivateBcfViewpoint,
|
||||
@@ -251,6 +252,7 @@ if bpy is not None:
|
||||
operator.SnapSpacesTogether,
|
||||
operator.CopyGrid,
|
||||
prop.StrProperty,
|
||||
prop.BcfReferenceLink,
|
||||
prop.Attribute,
|
||||
prop.MaterialLayer,
|
||||
prop.MaterialConstituent,
|
||||
|
||||
@@ -860,6 +860,23 @@ class AddBcfReferenceLink(bpy.types.Operator):
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class EditBcfReferenceLinks(bpy.types.Operator):
|
||||
bl_idname = "bim.edit_bcf_reference_links"
|
||||
bl_label = "Edit BCF Reference Link"
|
||||
|
||||
def execute(self, context):
|
||||
bcfxml = bcfstore.BcfStore.get_bcfxml()
|
||||
props = bpy.context.scene.BCFProperties
|
||||
blender_topic = props.topics[props.active_topic_index]
|
||||
topic = bcfxml.topics[blender_topic.name]
|
||||
for index, reference_link in enumerate(topic.reference_links):
|
||||
if reference_link == blender_topic.reference_links[index].name:
|
||||
continue
|
||||
topic.reference_links[index] = blender_topic.reference_links[index].name
|
||||
bcfxml.edit_topic(topic)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class RemoveBcfReferenceLink(bpy.types.Operator):
|
||||
bl_idname = "bim.remove_bcf_reference_link"
|
||||
bl_label = "Remove BCF Reference Link"
|
||||
|
||||
@@ -167,6 +167,10 @@ def refreshPredefinedTypes(self, context):
|
||||
context.scene.BIMProperties.ifc_predefined_type = enum[0][0]
|
||||
|
||||
|
||||
def updateBcfReferenceLink(self, context):
|
||||
bpy.ops.bim.edit_bcf_reference_links()
|
||||
|
||||
|
||||
def getDiagramScales(self, context):
|
||||
global diagram_scales_enum
|
||||
if (
|
||||
@@ -587,6 +591,10 @@ def refreshBcfTopic(self, context):
|
||||
getBcfViewpoints(self, context)
|
||||
|
||||
|
||||
class BcfReferenceLink(PropertyGroup):
|
||||
name: StringProperty(name="Name", update=updateBcfReferenceLink)
|
||||
|
||||
|
||||
class StrProperty(PropertyGroup):
|
||||
pass
|
||||
|
||||
@@ -1016,7 +1024,7 @@ class BcfTopic(PropertyGroup):
|
||||
file_reference: StringProperty(default="", name="Reference")
|
||||
file_ifc_project: StringProperty(default="", name="IFC Project")
|
||||
file_ifc_spatial_structure_element: StringProperty(default="", name="IFC Spatial Structure Element")
|
||||
reference_links: CollectionProperty(name="Reference Links", type=StrProperty)
|
||||
reference_links: CollectionProperty(name="Reference Links", type=BcfReferenceLink)
|
||||
reference_link: StringProperty(default="", name="Reference Link")
|
||||
labels: CollectionProperty(name="Labels", type=StrProperty)
|
||||
bim_snippet: PointerProperty(type=BcfBimSnippet)
|
||||
|
||||
Reference in New Issue
Block a user