mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
WIP you can now start a fresh project with partial editing support. See #1222.
This commit is contained in:
@@ -18,8 +18,17 @@ class Usecase:
|
||||
if not parent:
|
||||
self.create_origin()
|
||||
if self.settings["context"] == "Plan":
|
||||
return self.file.createIfcGeometricRepresentationContext(None, "Plan", 2, 1.0e-05, self.origin)
|
||||
return self.file.createIfcGeometricRepresentationContext(None, "Model", 3, 1.0e-05, self.origin)
|
||||
context = self.file.createIfcGeometricRepresentationContext(None, "Plan", 2, 1.0e-05, self.origin)
|
||||
else:
|
||||
context = self.file.createIfcGeometricRepresentationContext(None, "Model", 3, 1.0e-05, self.origin)
|
||||
project = self.file.by_type("IfcProject")[0]
|
||||
if project.RepresentationContexts:
|
||||
contexts = list(project.RepresentationContexts)
|
||||
else:
|
||||
contexts = []
|
||||
contexts.append(context)
|
||||
project.RepresentationContexts = contexts
|
||||
return context
|
||||
parent = parent[0]
|
||||
return self.file.create_entity("IfcGeometricRepresentationSubContext", **{
|
||||
"ContextIdentifier": self.settings["subcontext"],
|
||||
|
||||
@@ -8,18 +8,20 @@ from blenderbim.bim.module.context.data import Data
|
||||
class AddSubcontext(bpy.types.Operator):
|
||||
bl_idname = "bim.add_subcontext"
|
||||
bl_label = "Add Subcontext"
|
||||
context: bpy.props.StringProperty()
|
||||
subcontext: bpy.props.StringProperty()
|
||||
target_view: bpy.props.StringProperty()
|
||||
|
||||
def execute(self, context):
|
||||
self.file = IfcStore.get_file()
|
||||
usecase = add_context.Usecase(
|
||||
add_context.Usecase(
|
||||
self.file,
|
||||
{
|
||||
"context": bpy.context.scene.BIMProperties.available_contexts,
|
||||
"subcontext": bpy.context.scene.BIMProperties.available_subcontexts,
|
||||
"target_view": bpy.context.scene.BIMProperties.available_target_views,
|
||||
"context": self.context or bpy.context.scene.BIMProperties.available_contexts,
|
||||
"subcontext": self.subcontext or bpy.context.scene.BIMProperties.available_subcontexts,
|
||||
"target_view": self.target_view or bpy.context.scene.BIMProperties.available_target_views,
|
||||
},
|
||||
)
|
||||
result = usecase.execute()
|
||||
).execute()
|
||||
Data.load()
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user