Users can now specify what objects to cut for documentation with presets

This commit is contained in:
Dion Moult
2020-08-11 13:52:16 +10:00
parent 114e835d4a
commit ef41daedb9
4 changed files with 21 additions and 2 deletions
@@ -71,6 +71,7 @@ except ImportError:
import ifcopenshell
import ifcopenshell.geom
import ifcopenshell.util.selector
cwd = os.path.dirname(os.path.realpath(__file__))
this_file = os.path.join(cwd, 'cut_ifc.py')
@@ -164,6 +165,7 @@ class IfcCutter:
self.cut_pickle_file = 'cut.pickle'
self.should_recut = True
self.should_recut_selected = True
self.cut_objects = ''
self.selected_global_ids = []
self.should_extract = True
self.diagram_name = None
@@ -291,8 +293,8 @@ class IfcCutter:
with open(shape_pickle, 'rb') as shape_file:
shape_map = pickle.load(shape_file)
# TODO: This should perhaps be configurable, e.g. spaces cut to show zones in the drawing
products.extend(ifc_file.by_type('IfcElement'))
selector = ifcopenshell.util.selector.Selector()
products.extend(selector.parse(ifc_file, self.cut_objects))
include_elements = []
for i, product in enumerate(products):
@@ -2080,6 +2080,10 @@ class CutSection(bpy.types.Operator):
ifc_cutter.data_dir = bpy.context.scene.BIMProperties.data_dir
ifc_cutter.diagram_name = self.diagram_name
ifc_cutter.background_image = bpy.context.scene.render.filepath
if camera.data.BIMCameraProperties.cut_objects == 'CUSTOM':
ifc_cutter.cut_objects = camera.data.BIMCameraProperties.cut_objects_custom
else:
ifc_cutter.cut_objects = camera.data.BIMCameraProperties.cut_objects
ifc_cutter.leader_obj = None
ifc_cutter.stair_obj = None
ifc_cutter.dimension_obj = None
@@ -416,6 +416,13 @@ class BIMCameraProperties(PropertyGroup):
view_name: StringProperty(name="View Name")
diagram_scale: EnumProperty(items=getDiagramScales, name='Diagram Scale')
is_nts: BoolProperty(name='Is NTS')
cut_objects: EnumProperty(items=[
('.IfcWall|.IfcSlab|.IfcCurtainWall|.IfcStair|.IfcStairFlight|.IfcColumn|.IfcBeam|.IfcMember|.IfcCovering',
'Overall Plan / Section', ''),
('.IfcElement', 'Detail Drawing', ''),
('CUSTOM', 'Custom', '')
], name='Cut Objects')
cut_objects_custom: StringProperty(name='Custom Cut')
class BIMTextProperties(PropertyGroup):
@@ -855,6 +855,12 @@ class BIM_PT_camera(Panel):
row = layout.row()
row.operator('bim.resize_text')
row = layout.row()
row.prop(props, 'cut_objects')
if props.cut_objects == 'CUSTOM':
row = layout.row()
row.prop(props, 'cut_objects_custom')
row = layout.row(align=True)
row.prop(props, 'diagram_scale', text='')
row.operator('bim.cut_section')