Minor fix

This commit is contained in:
Dion Moult
2021-08-20 08:01:37 +10:00
parent 511e1c8a95
commit 11e36bf744
@@ -31,6 +31,7 @@ import ifcopenshell
import ifcopenshell.geom import ifcopenshell.geom
import ifcopenshell.util.selector import ifcopenshell.util.selector
import ifcopenshell.util.representation import ifcopenshell.util.representation
import blenderbim.bim.schema
import blenderbim.bim.module.drawing.svgwriter as svgwriter import blenderbim.bim.module.drawing.svgwriter as svgwriter
import blenderbim.bim.module.drawing.annotation as annotation import blenderbim.bim.module.drawing.annotation as annotation
import blenderbim.bim.module.drawing.sheeter as sheeter import blenderbim.bim.module.drawing.sheeter as sheeter
@@ -92,14 +93,24 @@ class AddDrawing(bpy.types.Operator):
group = self.file.by_id(sorted(GroupData.groups.keys())[-1]) group = self.file.by_id(sorted(GroupData.groups.keys())[-1])
ifcopenshell.api.run("group.edit_group", self.file, **{"group": group, "attributes": {"Name": new.name}}) ifcopenshell.api.run("group.edit_group", self.file, **{"group": group, "attributes": {"Name": new.name}})
bpy.ops.bim.assign_group(product=camera.name, group=group.id()) bpy.ops.bim.assign_group(product=camera.name, group=group.id())
bpy.ops.bim.add_pset(obj=camera.name, obj_type="Object", pset_name="EPset_Drawing") pset = ifcopenshell.api.run(
pset_id = sorted(PsetData.products[camera.BIMObjectProperties.ifc_definition_id]["psets"])[-1] "pset.add_pset",
bpy.ops.bim.edit_pset( self.file,
obj=camera.name, **{
obj_type="Object", "product": self.file.by_id(camera.BIMObjectProperties.ifc_definition_id),
pset_id=pset_id, "name": "EPset_Drawing",
properties=json.dumps({"TargetView": "PLAN_VIEW", "Scale": "1/100"}), },
) )
ifcopenshell.api.run(
"pset.edit_pset",
self.file,
**{
"pset": pset,
"properties": {"TargetView": "PLAN_VIEW", "Scale": "1/100"},
"pset_template": blenderbim.bim.schema.ifc.psetqto.get_by_name("EPset_Drawing"),
},
)
PsetData.load(IfcStore.get_file(), camera.BIMObjectProperties.ifc_definition_id)
return {"FINISHED"} return {"FINISHED"}
@@ -1106,7 +1117,7 @@ class RefreshDrawingList(bpy.types.Operator):
bl_label = "Refresh Drawing List" bl_label = "Refresh Drawing List"
def execute(self, context): def execute(self, context):
doc_props = context.scene.DocProperties.drawings doc_props = context.scene.DocProperties
doc_props.drawings.clear() doc_props.drawings.clear()
for obj in context.scene.objects: for obj in context.scene.objects:
if not isinstance(obj.data, bpy.types.Camera): if not isinstance(obj.data, bpy.types.Camera):