Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit 17a8b33

Browse files
committed
You can new create new BCF projects from scratch
1 parent 4f2bf3a commit 17a8b33

4 files changed

Lines changed: 28 additions & 6 deletions

File tree

src/ifcblenderexport/blenderbim/bim/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
operator.UnassignClass,
2626
operator.SelectClass,
2727
operator.SelectType,
28+
operator.NewBcfProject,
2829
operator.LoadBcfProject,
2930
operator.SaveBcfProject,
3031
operator.AddBcfTopic,

src/ifcblenderexport/blenderbim/bim/operator.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,24 @@ def execute(self, context):
507507
return {"FINISHED"}
508508

509509

510+
class NewBcfProject(bpy.types.Operator):
511+
bl_idname = "bim.new_bcf_project"
512+
bl_label = "New BCF Project"
513+
514+
def execute(self, context):
515+
import bcfplugin
516+
bcfplugin.newProject("New BCF Project")
517+
bcf.BcfStore.topics = bcfplugin.getTopics()
518+
bpy.context.scene.BCFProperties.is_editable = False
519+
bpy.context.scene.BCFProperties.name = bcfplugin.getProjectName()
520+
while len(bpy.context.scene.BCFProperties.topics) > 0:
521+
bpy.context.scene.BCFProperties.topics.remove(0)
522+
bpy.context.scene.BCFProperties.is_editable = True
523+
bpy.context.scene.BCFProperties.directory = bcfplugin.util.getBcfDir()
524+
bpy.context.scene.BCFProperties.is_loaded = True
525+
return {"FINISHED"}
526+
527+
510528
class LoadBcfProject(bpy.types.Operator):
511529
bl_idname = "bim.load_bcf_project"
512530
bl_label = "Load BCF Project"
@@ -525,6 +543,7 @@ def execute(self, context):
525543
new = bpy.context.scene.BCFProperties.topics.add()
526544
new.name = topic[0]
527545
bpy.context.scene.BCFProperties.is_editable = True
546+
bpy.context.scene.BCFProperties.is_loaded = True
528547
return {"FINISHED"}
529548

530549
def invoke(self, context, event):

src/ifcblenderexport/blenderbim/bim/prop.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,7 @@ class BIMProperties(PropertyGroup):
16401640

16411641
class BCFProperties(PropertyGroup):
16421642
is_editable: BoolProperty(name="Is Editable", default=False)
1643+
is_loaded: BoolProperty(name="Is Loaded", default=False)
16431644
name: StringProperty(default="", name="Project Name", update=updateBcfProjectName)
16441645
author: StringProperty(default="john@doe.com", name="Author Email")
16451646
topics: CollectionProperty(name="BCF Topics", type=BcfTopic)

src/ifcblenderexport/blenderbim/bim/ui.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,28 +1661,29 @@ def draw(self, context):
16611661
props = bpy.context.scene.BCFProperties
16621662

16631663
row = layout.row(align=True)
1664-
row.operator("bim.load_bcf_project")
1664+
row.operator("bim.new_bcf_project", text="New Project")
1665+
row.operator("bim.load_bcf_project", text="Load Project")
16651666

1666-
if not props.topics:
1667+
if not props.is_loaded:
16671668
return
16681669

1669-
row.operator("bim.save_bcf_project")
1670+
row.operator("bim.save_bcf_project", text="Save Project")
16701671

16711672
row = layout.row()
16721673
row.prop(props, "name")
16731674

16741675
row = layout.row()
16751676
row.prop(props, "author")
16761677

1677-
if not props.topics:
1678-
return
1679-
16801678
props = bpy.context.scene.BCFProperties
16811679
row = layout.row()
16821680
row.template_list("BIM_UL_topics", "", props, "topics", props, "active_topic_index")
16831681
col = row.column(align=True)
16841682
col.operator("bim.add_bcf_topic", icon="ADD", text="")
16851683

1684+
if not props.topics:
1685+
return
1686+
16861687
row = layout.row()
16871688
row.prop(props, "topic_description", text="")
16881689

0 commit comments

Comments
 (0)