Skip to content

Commit

Permalink
Merge pull request #258 from pppalain/master
Browse files Browse the repository at this point in the history
Mid March update
  • Loading branch information
pppalain committed Mar 19, 2024
2 parents a174dd7 + d0e75bf commit 372d822
Show file tree
Hide file tree
Showing 52 changed files with 168,561 additions and 2,598 deletions.
17 changes: 3 additions & 14 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Cache blender
id: cache-blender
if: runner.os != 'macOS'
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: blender
key: ${{ matrix.os }}-${{ matrix.blender_version}}-blender
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
shutil.unpack_archive("${{ steps.download.outputs.BLENDER_ARCHIVE }}","blender")
shell: python
- name: Save blender
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: steps.cache-blender.outputs.cache-hit != 'true' && runner.os != 'macOS'
with:
path: blender
Expand All @@ -79,21 +79,10 @@ jobs:
export ADDON_PATH=${PWD}/scripts/addons/blendercam.zip
cd scripts/addons/cam/tests
python install_addon.py ${ADDON_PATH}
python test_suite.py
python test_suite.py -vvv
- uses: actions/upload-artifact@v4
if: always()
with:
name: blendercam-${{matrix.os}}-${{matrix.blender_version}}
path: ./scripts/addons/cam
rerun-failed-jobs:
runs-on: ubuntu-latest
needs: [ build_and_test ]
if: failure()
steps:
- name: Checkout repository
uses: actions/[email protected]
- name: Rerun failed jobs in the current workflow (because mac blender is unstable)
env:
GH_TOKEN: ${{ github.token }}
run: gh run rerun ${{ github.run_id }} --failed

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ forceSyncWithUpstream
.project

.pydevproject
__pycache__/
temp_cam/
# profiler output files
*.prof
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Blendercam works on Windows or Linux. Probably on MacOS also.

## 👌 Features

| | Blender from 2.80 to 3.5.1
| | Blender from 2.80 to 4.0.0
| -------------------------- | :----------------: |
| Several milling strategies for 2D and 3D | ✔️ |
| Cutter types: ball, ballcone, endmill flat, v-carve with various angles, user definable | ✔️ |
Expand Down
10 changes: 6 additions & 4 deletions scripts/addons/cam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ***** END GPL LICENCE BLOCK *****

import bgl
# ***** END GPL LICENCE BLOCK ****
import bl_operators
import blf
import bpy
Expand All @@ -36,13 +34,17 @@

from pathlib import Path

USE_PROFILER = False

try:
import shapely
except ImportError:
# pip install required python stuff
subprocess.check_call([sys.executable, "-m", "ensurepip"])
subprocess.check_call([sys.executable, "-m", "pip", "install", "--upgrade", " pip"])
subprocess.check_call([sys.executable, "-m", "pip", "install", "shapely","Equation","opencamlib"])
# install numba if available for this platform, ignore failure
subprocess.run([sys.executable, "-m", "pip", "install", "numba"])


from bpy.app.handlers import persistent
Expand All @@ -60,7 +62,7 @@
bl_info = {
"name": "CAM - gcode generation tools",
"author": "Vilem Novak",
"version":(0,9,10),
"version":(1,0,3),
"blender": (3, 6, 0),
"location": "Properties > render",
"description": "Generate machining paths for CNC",
Expand Down
5 changes: 5 additions & 0 deletions scripts/addons/cam/async_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ def __init__(self):
self._is_cancelled=False

def modal(self,context,event):
if bpy.app.background:
return {'PASS_THROUGH'}

if event.type == 'TIMER':
try:
if self.tick(context):
Expand Down Expand Up @@ -70,6 +73,8 @@ def tick(self,context):
return True
except StopIteration:
return False
except Exception as e:
print("Exception thrown in tick:",e)

def execute(self, context):
if bpy.app.background:
Expand Down
2 changes: 2 additions & 0 deletions scripts/addons/cam/autoupdate.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class UpdateChecker(bpy.types.Operator):
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
if bpy.app.background:
return {"FINISHED"}
last_update_check = bpy.context.preferences.addons['cam'].preferences.last_update_check
today=date.today().toordinal()
update_source = bpy.context.preferences.addons['cam'].preferences.update_source
Expand Down
15 changes: 8 additions & 7 deletions scripts/addons/cam/bridges.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,21 @@ def useBridges(ch, o):

vi = 0
newpoints = []
p1 = sgeometry.Point(ch.points[0])
ch_points=ch.get_points_np()
p1 = sgeometry.Point(ch_points[0])
startinside = o.bridgespoly.contains(p1)
interrupted = False
verts = []
edges = []
faces = []
while vi < len(ch.points):
while vi < len(ch_points):
i1 = vi
i2 = vi
chp1 = ch.points[i1]
chp2 = ch.points[i1] # Vector(v1)#this is for case of last point and not closed chunk..
if vi + 1 < len(ch.points):
chp1 = ch_points[i1]
chp2 = ch_points[i1] # Vector(v1)#this is for case of last point and not closed chunk..
if vi + 1 < len(ch_points):
i2 = vi + 1
chp2 = ch.points[vi + 1] # Vector(ch.points[vi+1])
chp2 = ch_points[vi + 1] # Vector(ch_points[vi+1])
v1 = mathutils.Vector(chp1)
v2 = mathutils.Vector(chp2)
if v1.z < bridgeheight or v2.z < bridgeheight:
Expand Down Expand Up @@ -230,7 +231,7 @@ def useBridges(ch, o):
newpoints.append(chp1)
vi += 1
interrupted = True
ch.points = newpoints
ch.set_points(newpoints)

# create bridge cut curve here
count = 0
Expand Down
Loading

0 comments on commit 372d822

Please sign in to comment.