Skip to content

Commit

Permalink
Merge pull request #209 from SpectralVectors/fabex-ui-update
Browse files Browse the repository at this point in the history
Fabex UI update
  • Loading branch information
pppalain authored Oct 30, 2024
2 parents 03e08ea + e608caa commit 8dda1ed
Show file tree
Hide file tree
Showing 53 changed files with 1,123 additions and 1,969 deletions.
8 changes: 4 additions & 4 deletions scripts/addons/cam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@
)
from .slice import SliceObjectsSettings
from .ui import register as ui_register, unregister as ui_unregister
from .ui.legacy_ui import import_settings
from .ui.panels.interface import CAM_INTERFACE_Properties
from .utils import (
check_operations_on_load,
Expand Down Expand Up @@ -211,8 +210,9 @@ def register() -> None:
scene.cam_chains = CollectionProperty(
type=camChain,
)
scene.cam_import_gcode = PointerProperty(
type=import_settings,
scene.gcode_output_type = StringProperty(
name="Gcode Output Type",
default="",
)
scene.cam_machine = PointerProperty(
type=machineSettings,
Expand Down Expand Up @@ -264,7 +264,7 @@ def unregister() -> None:
del scene.cam_operations
del scene.cam_active_operation
del scene.cam_machine
del scene.cam_import_gcode
del scene.gcode_output_type
del scene.cam_text
del scene.cam_pack
del scene.cam_slice
Expand Down
3 changes: 3 additions & 0 deletions scripts/addons/cam/async_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def modal(self, context, event):
else:
context.window_manager.event_timer_remove(self.timer)
bpy.context.workspace.status_text_set(None)
context.window_manager.progress = 0
return {"FINISHED"}
except Exception as e:
context.window_manager.event_timer_remove(self.timer)
Expand Down Expand Up @@ -110,6 +111,8 @@ def show_progress(self, context, text, n, value_type):

if n is not None:
progress_text = f"{text}: {n:.2f}{value_type}"
context.window_manager.progress = n * 0.01
[a.tag_redraw() for a in context.screen.areas if a.type == "VIEW_3D"]
else:
progress_text = f"{text}"
bpy.context.workspace.status_text_set(progress_text + " (Press ESC to cancel)")
Expand Down
80 changes: 50 additions & 30 deletions scripts/addons/cam/basrelief.py
Original file line number Diff line number Diff line change
Expand Up @@ -1607,9 +1607,9 @@ class BasReliefsettings(bpy.types.PropertyGroup):
class BASRELIEF_Panel(bpy.types.Panel):
"""Bas Relief Panel"""

bl_label = "Bas Relief"
bl_label = "[ Bas Relief ]"
bl_idname = "WORLD_PT_BASRELIEF"

bl_options = {"DEFAULT_CLOSED"}
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "render"
Expand Down Expand Up @@ -1665,42 +1665,58 @@ def draw(self, context):

# if br:
# cutter preset
layout.operator("scene.calculate_bas_relief", text="Calculate Relief")
layout.prop(br, "advanced")
layout.prop(br, "use_image_source")

box = layout.box()
col = box.column(align=True)
col.label(text="Source")
if br.use_image_source:
layout.prop_search(br, "source_image_name", bpy.data, "images")
col.prop_search(br, "source_image_name", bpy.data, "images")
else:
layout.prop_search(br, "view_layer_name", bpy.context.scene, "view_layers")
layout.prop(br, "depth_exponent")
layout.label(text="Project Parameters")
layout.prop(br, "bit_diameter")
layout.prop(br, "pass_per_radius")
layout.prop(br, "widthmm")
layout.prop(br, "heightmm")
layout.prop(br, "thicknessmm")

layout.label(text="Justification")
layout.prop(br, "justifyx")
layout.prop(br, "justifyy")
layout.prop(br, "justifyz")

layout.label(text="Silhouette")
layout.prop(br, "silhouette_threshold")
layout.prop(br, "recover_silhouettes")
col.prop_search(br, "view_layer_name", bpy.context.scene, "view_layers")
col.prop(br, "use_image_source")
col.prop(br, "depth_exponent")
col.prop(br, "advanced")

box = layout.box()
col = box.column(align=True)
col.label(text="Parameters")
col.prop(br, "bit_diameter", text="Ball End Diameter (mm)")
col.prop(br, "pass_per_radius")
col.prop(br, "widthmm", text="Desired Width (mm)")
col.prop(br, "heightmm", text="Desired Height (mm)")
col.prop(br, "thicknessmm", text="Thickness (mm)")

box = layout.box()
col = box.column(align=True)
col.label(text="Justification")
col.prop(br, "justifyx")
col.prop(br, "justifyy")
col.prop(br, "justifyz")

box = layout.box()
col = box.column(align=True)
col.label(text="Silhouette")
col.prop(br, "silhouette_threshold", text="Threshold")
col.prop(br, "recover_silhouettes")
if br.recover_silhouettes:
layout.prop(br, "silhouette_scale")
col.prop(br, "silhouette_scale", text="Scale")
if br.advanced:
layout.prop(br, "silhouette_exponent")
col.prop(br, "silhouette_exponent", text="Square Exponent")
# layout.template_curve_mapping(br,'curva')
# layout.prop(br,'attenuation')

box = layout.box()
col = box.column(align=True)
col.label(text="Iterations")
if br.advanced:
col.prop(br, "smooth_iterations", text="Smooth")
col.prop(br, "vcycle_iterations", text="V-Cycle")
col.prop(br, "linbcg_iterations", text="LINBCG")

if br.advanced:
# layout.prop(br,'attenuation')
layout.prop(br, "min_gridsize")
layout.prop(br, "smooth_iterations")
layout.prop(br, "vcycle_iterations")
layout.prop(br, "linbcg_iterations")
layout.prop(br, "use_planar")
layout.prop(br, "decimate_ratio")
layout.prop(br, "use_planar")

layout.prop(br, "gradient_scaling_mask_use")
if br.advanced:
Expand All @@ -1720,6 +1736,10 @@ def draw(self, context):
# layout.prop(br,'scale_down_before_use')
# if br.scale_down_before_use:
# layout.prop(br,'scale_down_before')
box = layout.box()
col = box.column()
col.scale_y = 1.2
col.operator("scene.calculate_bas_relief", text="Calculate Relief", icon="RNDCURVE")


class ReliefError(Exception):
Expand Down
6 changes: 3 additions & 3 deletions scripts/addons/cam/cam_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ class camOperation(PropertyGroup):
machine_axes: EnumProperty(
name="Number of Axes",
items=(
("3", "3 axis", "a"),
("4", "#4 axis - EXPERIMENTAL", "a"),
("5", "#5 axis - EXPERIMENTAL", "a"),
("3", "3 axis", "a", "EMPTY_DATA", 0),
("4", "4 axis - EXPERIMENTAL", "a", "EXPERIMENTAL", 1),
("5", "5 axis - EXPERIMENTAL", "a", "EXPERIMENTAL", 2),
),
description="How many axes will be used for the operation",
default="3",
Expand Down
10 changes: 6 additions & 4 deletions scripts/addons/cam/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
from .ui.panels.cutter import CAM_CUTTER_Panel
from .ui.panels.feedrate import CAM_FEEDRATE_Panel
from .ui.panels.gcode import CAM_GCODE_Panel
from .ui.panels.info import CAM_INFO_Panel
from .ui.panels.interface import CAM_INTERFACE_Panel

# from .ui.panels.info import CAM_INFO_Panel

# from .ui.panels.interface import CAM_INTERFACE_Panel
from .ui.panels.machine import CAM_MACHINE_Panel
from .ui.panels.material import CAM_MATERIAL_Panel
from .ui.panels.movement import CAM_MOVEMENT_Panel
Expand Down Expand Up @@ -67,10 +69,10 @@ def get_panels():
EEVEE_MATERIAL_PT_context_material,
EEVEE_MATERIAL_PT_surface,
EEVEE_MATERIAL_PT_settings,
CAM_INTERFACE_Panel,
# CAM_INTERFACE_Panel,
CAM_CHAINS_Panel,
CAM_OPERATIONS_Panel,
CAM_INFO_Panel,
# CAM_INFO_Panel,
CAM_MATERIAL_Panel,
CAM_OPERATION_PROPERTIES_Panel,
CAM_OPTIMISATION_Panel,
Expand Down
6 changes: 3 additions & 3 deletions scripts/addons/cam/gcodeimportparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
np.set_printoptions(suppress=True) # suppress scientific notation in subdivide functions linspace


def import_gcode(context, filepath):
def import_gcode(self, context, filepath):
"""Import G-code data into the scene.
This function reads G-code from a specified file and processes it
Expand All @@ -35,7 +35,7 @@ def import_gcode(context, filepath):
print("Running read_some_data...")

scene = context.scene
mytool = scene.cam_import_gcode
mytool = self
import time

then = time.time()
Expand Down Expand Up @@ -167,7 +167,7 @@ def obj_from_pydata(name, verts, edges=None, close=True, collection_name=None):
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
if bpy.context.scene.cam_import_gcode.output == "curve":
if bpy.context.scene.gcode_output_type == "curve":
bpy.ops.object.convert(target="CURVE")


Expand Down
Loading

0 comments on commit 8dda1ed

Please sign in to comment.