mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
Don't cut rooms in documentation, fix non single material bug, and add view present for construction style documentation
This commit is contained in:
@@ -98,6 +98,7 @@ if bpy is not None:
|
||||
operator.ExecuteIfcDiff,
|
||||
operator.AssignContext,
|
||||
operator.SetViewPreset1,
|
||||
operator.SetViewPreset2,
|
||||
operator.OpenUpstream,
|
||||
operator.BIM_OT_CopyAttributesToSelection,
|
||||
operator.BIM_OT_ChangeClassificationLevel,
|
||||
|
||||
@@ -152,8 +152,6 @@ class IfcCutter:
|
||||
self.load_ifc_files()
|
||||
print('# Timer logged at {:.2f} seconds'.format(time.time() - start_time))
|
||||
start_time = time.time()
|
||||
print('# Timer logged at {:.2f} seconds'.format(time.time() - start_time))
|
||||
start_time = time.time()
|
||||
print('# Get product shapes')
|
||||
self.get_product_shapes()
|
||||
print('# Timer logged at {:.2f} seconds'.format(time.time() - start_time))
|
||||
@@ -208,7 +206,8 @@ class IfcCutter:
|
||||
settings.set(settings.USE_PYTHON_OPENCASCADE, True)
|
||||
products = []
|
||||
for ifc_file in self.ifc_files:
|
||||
products.extend(ifc_file.by_type('IfcProduct'))
|
||||
# TODO: This should perhaps be configurable, e.g. spaces cut to show zones in the drawing
|
||||
products.extend(ifc_file.by_type('IfcElement'))
|
||||
total_products = len(products)
|
||||
for i, product in enumerate(products):
|
||||
print('{}/{} geometry processed ...'.format(i, total_products), end='\r', flush=True)
|
||||
@@ -571,7 +570,6 @@ class IfcCutter:
|
||||
pickle.dump(self.cut_polygons, pickle_file, protocol=pickle.HIGHEST_PROTOCOL)
|
||||
|
||||
def get_fresh_cut_polygons(self):
|
||||
total_product_shapes = len(self.product_shapes)
|
||||
process_data = [(p.GlobalId, s, self.section_box['face'], self.transformation_data) for p, s in self.product_shapes]
|
||||
|
||||
import multiprocessing
|
||||
@@ -1009,6 +1007,11 @@ class SvgWriter():
|
||||
classes = [position, element.is_a()]
|
||||
for association in element.HasAssociations:
|
||||
if association.is_a('IfcRelAssociatesMaterial'):
|
||||
classes.append('material-{}'.format(association.RelatingMaterial.Name))
|
||||
classes.append('material-{}'.format(self.get_material_name(association.RelatingMaterial)))
|
||||
classes.append('globalid-{}'.format(element.GlobalId))
|
||||
return classes
|
||||
|
||||
def get_material_name(self, element):
|
||||
if hasattr(element, 'Name') and element.Name:
|
||||
return element.Name
|
||||
return element.id()
|
||||
|
||||
@@ -1769,6 +1769,37 @@ class SetViewPreset1(bpy.types.Operator):
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class SetViewPreset2(bpy.types.Operator):
|
||||
bl_idname = 'bim.set_view_preset_2'
|
||||
bl_label = 'Set View Preset 2'
|
||||
|
||||
def execute(self, context):
|
||||
bpy.data.worlds[0].color = (1, 1, 1)
|
||||
bpy.context.scene.render.engine = 'BLENDER_WORKBENCH'
|
||||
bpy.context.scene.display.shading.show_object_outline = True
|
||||
bpy.context.scene.display.shading.show_cavity = True
|
||||
bpy.context.scene.display.shading.cavity_type = 'BOTH'
|
||||
bpy.context.scene.display.shading.curvature_ridge_factor = 1
|
||||
bpy.context.scene.display.shading.curvature_valley_factor = 1
|
||||
bpy.context.scene.view_settings.view_transform = 'Standard'
|
||||
|
||||
bpy.context.scene.display.shading.light = 'FLAT'
|
||||
bpy.context.scene.display.shading.color_type = 'SINGLE'
|
||||
bpy.context.scene.display.shading.single_color = (1, 1, 1)
|
||||
bpy.context.scene.use_nodes = True
|
||||
rgb_curves = bpy.context.scene.node_tree.nodes.new(type='CompositorNodeCurveRGB')
|
||||
rgb_curves.mapping.curves[3].points.new(.4, 0) # Increase black contrast
|
||||
rgb_curves.mapping.update()
|
||||
for node in bpy.context.scene.node_tree.nodes:
|
||||
if node.type == 'R_LAYERS':
|
||||
render_layers = node
|
||||
elif node.type == 'COMPOSITE':
|
||||
composite = node
|
||||
bpy.context.scene.node_tree.links.new(render_layers.outputs[0], rgb_curves.inputs[1])
|
||||
bpy.context.scene.node_tree.links.new(rgb_curves.outputs[0], composite.inputs[0])
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
class OpenUpstream(bpy.types.Operator):
|
||||
bl_idname = 'bim.open_upstream'
|
||||
bl_label = 'Open Upstream Reference'
|
||||
|
||||
@@ -512,8 +512,9 @@ class BIM_PT_documentation(Panel):
|
||||
layout.use_property_split = True
|
||||
props = bpy.context.scene.DocProperties
|
||||
|
||||
row = layout.row()
|
||||
row = layout.row(align=True)
|
||||
row.operator('bim.set_view_preset_1')
|
||||
row.operator('bim.set_view_preset_2')
|
||||
|
||||
row = layout.row()
|
||||
row.prop(props, 'view_name')
|
||||
|
||||
Reference in New Issue
Block a user