Skip to content

Commit

Permalink
Merge pull request #213 from SpectralVectors/use_experimental_fix
Browse files Browse the repository at this point in the history
Use experimental fix
  • Loading branch information
pppalain authored Nov 14, 2024
2 parents 2192474 + 26a8949 commit 35d065d
Show file tree
Hide file tree
Showing 12 changed files with 2 additions and 272 deletions.
Binary file added scripts/addons/cam.zip
Binary file not shown.
10 changes: 0 additions & 10 deletions scripts/addons/cam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@
PathsChain,
PathExport,
PathExportChain,
# .pack
# PackObjectsSettings,
# .preferences
CamAddonPreferences,
# .preset_managers
Expand All @@ -183,8 +181,6 @@
AddPresetCamCutter,
AddPresetCamOperation,
AddPresetCamMachine,
# .slice
# SliceObjectsSettings,
]


Expand Down Expand Up @@ -225,12 +221,6 @@ def register() -> None:
scene.cam_operations = CollectionProperty(
type=camOperation,
)
# scene.cam_pack = PointerProperty(
# type=PackObjectsSettings,
# )
# scene.cam_slice = PointerProperty(
# type=SliceObjectsSettings,
# )
scene.cam_text = StringProperty()
scene.interface = PointerProperty(
type=CAM_INTERFACE_Properties,
Expand Down
20 changes: 0 additions & 20 deletions scripts/addons/cam/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
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.machine import CAM_MACHINE_Panel
from .ui.panels.material import CAM_MATERIAL_Panel
from .ui.panels.movement import CAM_MOVEMENT_Panel
Expand All @@ -35,20 +31,6 @@ class FABEX_ENGINE(RenderEngine):
bl_label = "Fabex CNC/CAM"
bl_use_eevee_viewport = True

# view3d = [a.spaces[0] for a in context.screen.areas if a.type == "VIEW_3D"][0]

# shading = view3d.shading
# shading.color_type = "OBJECT"
# shading.show_shadows = True
# shading.show_cavity = True
# shading.cavity_type = "BOTH"
# shading.cavity_ridge_factor = 2.5
# shading.cavity_valley_factor = 2.5
# shading.curvature_ridge_factor = 2
# shading.curvature_valley_factor = 2
# shading.use_dof = True
# shading.show_object_outline = True


def get_panels():
"""Retrieve a list of panels for the Blender UI.
Expand Down Expand Up @@ -83,10 +65,8 @@ def get_panels():
EEVEE_MATERIAL_PT_context_material,
EEVEE_MATERIAL_PT_surface,
EEVEE_MATERIAL_PT_settings,
# CAM_INTERFACE_Panel,
CAM_CHAINS_Panel,
CAM_OPERATIONS_Panel,
# CAM_INFO_Panel,
CAM_MATERIAL_Panel,
CAM_OPERATION_PROPERTIES_Panel,
CAM_OPTIMISATION_Panel,
Expand Down
6 changes: 2 additions & 4 deletions scripts/addons/cam/gcodepath.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,6 @@ def exportGcodePath(filename, vertslist, operations):
unitcorr = 1
rotcorr = 180.0 / pi

use_experimental = bpy.context.preferences.addons[__package__].preferences.experimental

def startNewFile():
"""Start a new file for G-code generation.
Expand All @@ -208,7 +206,7 @@ def startNewFile():

# process user overrides for post processor settings

if use_experimental and isinstance(c, iso.Creator):
if isinstance(c, iso.Creator):
c.output_block_numbers = m.output_block_numbers
c.start_block_number = m.start_block_number
c.block_number_increment = m.block_number_increment
Expand Down Expand Up @@ -248,7 +246,7 @@ def startNewFile():
cut_distance = 0
for i, o in enumerate(operations):

if use_experimental and o.output_header:
if o.output_header:
lines = o.gcode_header.split(";")
for aline in lines:
c.write(aline + "\n")
Expand Down
65 changes: 0 additions & 65 deletions scripts/addons/cam/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,68 +227,3 @@ def packCurves():

polygon_utils_cam.shapelyToCurve("test", sgeometry.MultiPolygon(placedpolys), 0)
print(t)


# class PackObjectsSettings(PropertyGroup):
# """stores all data for machines"""

# sheet_fill_direction: EnumProperty(
# name="Fill Direction",
# items=(
# ("X", "X", "Fills sheet in X axis direction"),
# ("Y", "Y", "Fills sheet in Y axis direction"),
# ),
# description="Fill direction of the packer algorithm",
# default="Y",
# )
# sheet_x: FloatProperty(
# name="X Size",
# description="Sheet size",
# min=0.001,
# max=10,
# default=0.5,
# precision=constants.PRECISION,
# unit="LENGTH",
# )
# sheet_y: FloatProperty(
# name="Y Size",
# description="Sheet size",
# min=0.001,
# max=10,
# default=0.5,
# precision=constants.PRECISION,
# unit="LENGTH",
# )
# distance: FloatProperty(
# name="Minimum Distance",
# description="Minimum distance between objects(should be " "at least cutter diameter!)",
# min=0.001,
# max=10,
# default=0.01,
# precision=constants.PRECISION,
# unit="LENGTH",
# )
# tolerance: FloatProperty(
# name="Placement Tolerance",
# description="Tolerance for placement: smaller value slower placemant",
# min=0.001,
# max=0.02,
# default=0.005,
# precision=constants.PRECISION,
# unit="LENGTH",
# )
# rotate: BoolProperty(
# name="Enable Rotation",
# description="Enable rotation of elements",
# default=True,
# )
# rotate_angle: FloatProperty(
# name="Placement Angle Rotation Step",
# description="Bigger rotation angle, faster placemant",
# default=0.19635 * 4,
# min=pi / 180,
# max=pi,
# precision=5,
# subtype="ANGLE",
# unit="ROTATION",
# )
11 changes: 0 additions & 11 deletions scripts/addons/cam/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ class CamAddonPreferences(AddonPreferences):
default=False,
)

experimental: BoolProperty(
name="Show Experimental Features",
description="Use these features when you want to help development of Fabex",
default=False,
)

default_interface_level: EnumProperty(
name="Interface Level in New File",
description="Choose visible options",
Expand Down Expand Up @@ -271,8 +265,3 @@ def draw(self, context):
col.label(text="Shapely is not Installed")
else:
col.label(text=f"Shapely v{shape_version}")

box = layout.box()
col = box.column(align=True)
col.label(text="Experimental", icon="EXPERIMENTAL")
col.prop(self, "experimental")
105 changes: 0 additions & 105 deletions scripts/addons/cam/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,108 +110,3 @@ def slicing3d(ob, start, end):

bpy.ops.object.select_all(action="DESELECT") # deselect everything
return True


# def sliceObject(ob):
# """Slice a 3D object into layers based on a specified thickness.

# This function takes a 3D object and slices it into multiple layers
# according to the specified thickness. It creates a new collection for
# the slices and optionally creates text labels for each slice if the
# indexes parameter is set. The slicing can be done in either 2D or 3D
# based on the user's selection. The function also handles the positioning
# of the slices based on the object's bounding box.

# Args:
# ob (bpy.types.Object): The 3D object to be sliced.
# """
# # April 2020 Alain Pelletier
# # get variables from menu
# thickness = bpy.context.scene.cam_slice.slice_distance
# slice3d = bpy.context.scene.cam_slice.slice_3d
# indexes = bpy.context.scene.cam_slice.indexes
# above0 = bpy.context.scene.cam_slice.slice_above0
# # setup the collections
# scollection = bpy.data.collections.new("Slices")
# bpy.context.scene.collection.children.link(scollection)
# if indexes:
# tcollection = bpy.data.collections.new("Text")
# bpy.context.scene.collection.children.link(tcollection)

# bpy.ops.object.mode_set(mode="OBJECT") # force object mode
# minx, miny, minz, maxx, maxy, maxz = utils.getBoundsWorldspace([ob])

# start_height = minz
# if above0 and minz < 0:
# start_height = 0

# # calculate amount of layers needed
# layeramt = 1 + int((maxz - start_height) // thickness)

# for layer in range(layeramt):
# height = round(layer * thickness, 6) # height of current layer
# t = str(layer) + "-" + str(height * 1000)
# slicename = "slice_" + t # name for the current slice
# tslicename = "t_" + t # name for the current slice text
# height += start_height
# print(slicename)

# ob.select_set(True) # select object to be sliced
# bpy.context.view_layer.objects.active = ob # make object to be sliced active
# bpy.ops.object.duplicate() # make a copy of object to be sliced
# bpy.context.view_layer.objects.active.name = slicename # change the name of object

# # attribute active object to obslice
# obslice = bpy.context.view_layer.objects.active
# scollection.objects.link(obslice) # link obslice to scollecton
# if slice3d:
# # slice 3d at desired height and stop at desired height
# slicesuccess = slicing3d(obslice, height, height + thickness)
# else:
# # slice object at desired height
# slicesuccess = slicing2d(obslice, height)

# if indexes and slicesuccess:
# # text objects
# bpy.ops.object.text_add() # new text object
# textob = bpy.context.active_object
# textob.data.size = 0.006 # change size of object
# textob.data.body = t # text content
# textob.location = (0, 0, 0) # text location
# textob.name = tslicename # change the name of object
# bpy.ops.object.select_all(action="DESELECT") # deselect everything
# tcollection.objects.link(textob) # add to text collection
# textob.parent = obslice # make textob child of obslice

# # select all slices
# for obj in bpy.data.collections["Slices"].all_objects:
# obj.select_set(True)


# class SliceObjectsSettings(PropertyGroup):
# """Stores All Data for Machines"""

# slice_distance: FloatProperty(
# name="Slicing Distance",
# description="Slices distance in z, should be most often " "thickness of plywood sheet.",
# min=0.001,
# max=10,
# default=0.005,
# precision=constants.PRECISION,
# unit="LENGTH",
# )
# slice_above0: BoolProperty(
# name="Slice Above 0",
# description="only slice model above 0",
# default=False,
# )
# slice_3d: BoolProperty(
# name="3D Slice",
# description="For 3D carving",
# default=False,
# )
# indexes: BoolProperty(
# name="Add Indexes",
# description="Adds index text of layer + index",
# default=True,
# )
Empty file.
3 changes: 0 additions & 3 deletions scripts/addons/cam/ui/panels/buttons_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ def __init__(self):
self.level = int(context.scene.interface.level)
self.machine = context.scene.cam_machine

addon_prefs = context.preferences.addons["bl_ext.user_default.fabex"].preferences
self.use_experimental = addon_prefs.experimental

operations = context.scene.cam_operations
operations_count = len(operations)
operation_index = context.scene.cam_active_operation
Expand Down
9 changes: 0 additions & 9 deletions scripts/addons/cam/ui/panels/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ def update_layout(self, context):
bpy.types.WORLD_PT_CAM_OPERATION,
bpy.types.WORLD_PT_CAM_OPERATIONS,
bpy.types.WORLD_PT_CAM_OPTIMISATION,
# bpy.types.WORLD_PT_CAM_PACK,
# bpy.types.WORLD_PT_CAM_SLICE,
# bpy.types.WORLD_PT_BASRELIEF,
bpy.types.VIEW3D_PT_tools_curvetools,
bpy.types.VIEW3D_PT_tools_create,
]
Expand All @@ -149,9 +146,6 @@ def update_layout(self, context):
CAM_OPERATIONS_Panel,
CAM_MATERIAL_Panel,
CAM_MACHINE_Panel,
# CAM_PACK_Panel,
# CAM_SLICE_Panel,
# BASRELIEF_Panel,
]
operation_classes = [
CAM_OPERATION_PROPERTIES_Panel,
Expand Down Expand Up @@ -279,9 +273,6 @@ def update_user_layout(self, context):
bpy.ops.wm.save_userpref()


# update_layout(self, context)


class CAM_INTERFACE_Properties(PropertyGroup):
level: EnumProperty(
name="Interface",
Expand Down
Loading

0 comments on commit 35d065d

Please sign in to comment.