mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-10-02 13:04:49 +00:00
Allow view scales to be set per camera instead of global
This commit is contained in:
@@ -80,6 +80,7 @@ if bpy is not None:
|
|||||||
operator.CutSection,
|
operator.CutSection,
|
||||||
operator.CreateSheets,
|
operator.CreateSheets,
|
||||||
operator.GenerateDigitalTwin,
|
operator.GenerateDigitalTwin,
|
||||||
|
operator.CreateView,
|
||||||
prop.Subcontext,
|
prop.Subcontext,
|
||||||
prop.BIMProperties,
|
prop.BIMProperties,
|
||||||
prop.DocProperties,
|
prop.DocProperties,
|
||||||
@@ -95,6 +96,7 @@ if bpy is not None:
|
|||||||
prop.BIMMaterialProperties,
|
prop.BIMMaterialProperties,
|
||||||
prop.SweptSolid,
|
prop.SweptSolid,
|
||||||
prop.BIMMeshProperties,
|
prop.BIMMeshProperties,
|
||||||
|
prop.BIMCameraProperties,
|
||||||
ui.BIM_PT_documentation,
|
ui.BIM_PT_documentation,
|
||||||
ui.BIM_PT_bim,
|
ui.BIM_PT_bim,
|
||||||
ui.BIM_PT_owner,
|
ui.BIM_PT_owner,
|
||||||
@@ -107,6 +109,7 @@ if bpy is not None:
|
|||||||
ui.BIM_PT_material,
|
ui.BIM_PT_material,
|
||||||
ui.BIM_PT_mesh,
|
ui.BIM_PT_mesh,
|
||||||
ui.BIM_PT_object,
|
ui.BIM_PT_object,
|
||||||
|
ui.BIM_PT_camera,
|
||||||
)
|
)
|
||||||
|
|
||||||
def menu_func_export(self, context):
|
def menu_func_export(self, context):
|
||||||
@@ -137,6 +140,7 @@ if bpy is not None:
|
|||||||
bpy.types.Collection.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
|
bpy.types.Collection.BIMObjectProperties = bpy.props.PointerProperty(type=prop.BIMObjectProperties)
|
||||||
bpy.types.Material.BIMMaterialProperties = bpy.props.PointerProperty(type=prop.BIMMaterialProperties)
|
bpy.types.Material.BIMMaterialProperties = bpy.props.PointerProperty(type=prop.BIMMaterialProperties)
|
||||||
bpy.types.Mesh.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
|
bpy.types.Mesh.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
|
||||||
|
bpy.types.Camera.BIMCameraProperties = bpy.props.PointerProperty(type=prop.BIMCameraProperties)
|
||||||
|
|
||||||
def unregister():
|
def unregister():
|
||||||
for cls in reversed(classes):
|
for cls in reversed(classes):
|
||||||
@@ -152,6 +156,7 @@ if bpy is not None:
|
|||||||
del(bpy.types.Collection.BIMObjectProperties)
|
del(bpy.types.Collection.BIMObjectProperties)
|
||||||
del(bpy.types.Material.BIMMaterialProperties)
|
del(bpy.types.Material.BIMMaterialProperties)
|
||||||
del(bpy.types.Mesh.BIMMeshProperties)
|
del(bpy.types.Mesh.BIMMeshProperties)
|
||||||
|
del(bpy.types.Mesh.BIMCameraProperties)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
register()
|
register()
|
||||||
|
|||||||
@@ -855,7 +855,7 @@ class CutSection(bpy.types.Operator):
|
|||||||
ifc_cutter.cut_pickle_file = os.path.join(ifc_cutter.data_dir, '{}-cut.pickle'.format(self.diagram_name))
|
ifc_cutter.cut_pickle_file = os.path.join(ifc_cutter.data_dir, '{}-cut.pickle'.format(self.diagram_name))
|
||||||
ifc_cutter.should_recut = bpy.context.scene.DocProperties.should_recut
|
ifc_cutter.should_recut = bpy.context.scene.DocProperties.should_recut
|
||||||
svg_writer = cut_ifc.SvgWriter(ifc_cutter)
|
svg_writer = cut_ifc.SvgWriter(ifc_cutter)
|
||||||
numerator, denominator = bpy.context.scene.DocProperties.diagram_scale.split(':')
|
numerator, denominator = camera.data.BIMCameraProperties.diagram_scale.split(':')
|
||||||
svg_writer.scale = float(numerator) / float(denominator)
|
svg_writer.scale = float(numerator) / float(denominator)
|
||||||
ifc_cutter.cut()
|
ifc_cutter.cut()
|
||||||
svg_writer.write()
|
svg_writer.write()
|
||||||
|
|||||||
@@ -215,11 +215,15 @@ class Subcontext(PropertyGroup):
|
|||||||
|
|
||||||
|
|
||||||
class DocProperties(PropertyGroup):
|
class DocProperties(PropertyGroup):
|
||||||
diagram_scale: EnumProperty(items=getDiagramScales, name='Diagram Scale')
|
|
||||||
should_recut: BoolProperty(name="Should Recut", default=True)
|
should_recut: BoolProperty(name="Should Recut", default=True)
|
||||||
view_name: StringProperty(name="View Name")
|
view_name: StringProperty(name="View Name")
|
||||||
|
|
||||||
|
|
||||||
|
class BIMCameraProperties(PropertyGroup):
|
||||||
|
view_name: StringProperty(name="View Name")
|
||||||
|
diagram_scale: EnumProperty(items=getDiagramScales, name='Diagram Scale')
|
||||||
|
|
||||||
|
|
||||||
class BIMProperties(PropertyGroup):
|
class BIMProperties(PropertyGroup):
|
||||||
schema_dir: StringProperty(default=os.path.join(cwd ,'schema') + os.path.sep, name="Schema Directory")
|
schema_dir: StringProperty(default=os.path.join(cwd ,'schema') + os.path.sep, name="Schema Directory")
|
||||||
data_dir: StringProperty(default=os.path.join(cwd, 'data') + os.path.sep, name="Data Directory")
|
data_dir: StringProperty(default=os.path.join(cwd, 'data') + os.path.sep, name="Data Directory")
|
||||||
|
|||||||
@@ -198,13 +198,6 @@ class BIM_PT_documentation(Panel):
|
|||||||
row.prop(props, 'view_name')
|
row.prop(props, 'view_name')
|
||||||
row.operator('bim.create_view', icon='ADD', text='')
|
row.operator('bim.create_view', icon='ADD', text='')
|
||||||
|
|
||||||
row = layout.row()
|
|
||||||
row.prop(props, 'should_recut')
|
|
||||||
|
|
||||||
row = layout.row(align=True)
|
|
||||||
row.prop(props, 'diagram_scale', text='')
|
|
||||||
row.operator('bim.cut_section')
|
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.operator('bim.create_sheets')
|
row.operator('bim.create_sheets')
|
||||||
|
|
||||||
@@ -212,6 +205,33 @@ class BIM_PT_documentation(Panel):
|
|||||||
row.operator('bim.generate_digital_twin')
|
row.operator('bim.generate_digital_twin')
|
||||||
|
|
||||||
|
|
||||||
|
class BIM_PT_camera(Panel):
|
||||||
|
bl_label = "Diagrams and Documentation"
|
||||||
|
bl_idname = "BIM_PT_camera"
|
||||||
|
bl_space_type = 'PROPERTIES'
|
||||||
|
bl_region_type = 'WINDOW'
|
||||||
|
bl_context = 'data'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def poll(cls, context):
|
||||||
|
engine = context.engine
|
||||||
|
return context.camera and (engine in cls.COMPAT_ENGINES) and \
|
||||||
|
hasattr(context.active_object.data, "BIMCameraProperties")
|
||||||
|
|
||||||
|
def draw(self, context):
|
||||||
|
layout = self.layout
|
||||||
|
layout.use_property_split = True
|
||||||
|
dprops = bpy.context.scene.DocProperties
|
||||||
|
props = context.active_object.data.BIMCameraProperties
|
||||||
|
|
||||||
|
row = layout.row()
|
||||||
|
row.prop(dprops, 'should_recut')
|
||||||
|
|
||||||
|
row = layout.row(align=True)
|
||||||
|
row.prop(props, 'diagram_scale', text='')
|
||||||
|
row.operator('bim.cut_section')
|
||||||
|
|
||||||
|
|
||||||
class BIM_PT_owner(Panel):
|
class BIM_PT_owner(Panel):
|
||||||
bl_label = "Owner History"
|
bl_label = "Owner History"
|
||||||
bl_idname = "BIM_PT_owner"
|
bl_idname = "BIM_PT_owner"
|
||||||
|
|||||||
Reference in New Issue
Block a user