Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mods
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
mods
Commits
2cb2f497
Commit
2cb2f497
authored
3 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
mill xz yz, vectorization issues?
parent
9c4c1b2d
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
modules/processes/mill/raster/3D
+173
-79
173 additions, 79 deletions
modules/processes/mill/raster/3D
programs/machines/ShopBot/mill 3D stl
+1
-1
1 addition, 1 deletion
programs/machines/ShopBot/mill 3D stl
with
174 additions
and
80 deletions
modules/processes/mill/raster/3D
+
173
−
79
View file @
2cb2f497
...
...
@@ -127,14 +127,14 @@ var interface = function(div){
input.id = mod.div.id+'xz'
input.checked = true
div.appendChild(input)
mod.dirx = input
mod.dirx
z
= input
div.appendChild(document.createTextNode('xz'))
var input = document.createElement('input')
input.type = 'checkbox'
input.id = mod.div.id+'yz'
input.checked = true
div.appendChild(input)
mod.diry = input
mod.diry
z
= input
div.appendChild(document.createTextNode('yz'))
div.appendChild(document.createElement('br'))
//
...
...
@@ -283,6 +283,8 @@ function calculate_path() {
diameter:mod.dia_mm.value,
stepover:mod.stepover.value,
mmunits: mod.mmunits,
xz:mod.dirxz.checked,
yz:mod.diryz.checked,
map:mod.map})
}
//
...
...
@@ -303,7 +305,7 @@ function calculate_path_worker() {
var diameter = evt.data.diameter
var stepover = evt.data.stepover
var mmunits = evt.data.mmunits
var
y
step = Math.floor(stepover*diameter*w/(mmunits*(xmax-xmin)))
var step = Math.floor(stepover*diameter*w/(mmunits*(xmax-xmin)))
var path = [[]]
//
// construct tool offset
...
...
@@ -320,8 +322,9 @@ function calculate_path_worker() {
tooloffset[y*toolsize+x] = Number.MAX_VALUE
}
//
//
loop over lines
//
xz
//
if (evt.data.xz) {
var xstart = 0
var ystart = h-1
var zstart = Math.floor((map[ystart*w+xstart]-zmax)*w/(xmax-xmin))
...
...
@@ -385,7 +388,7 @@ function calculate_path_worker() {
if (xcur == (w-1)) {
if (dx == 1) {
dx = 0
dy = -
y
step
dy = -step
}
else {
dx = -1
...
...
@@ -395,7 +398,7 @@ function calculate_path_worker() {
else if (xcur == 0) {
if (dx == -1) {
dx = 0
dy = -
y
step
dy = -step
}
else {
dx = 1
...
...
@@ -407,6 +410,97 @@ function calculate_path_worker() {
//
self.postMessage({type:'progress',value:ycur})
}
}
//
// yz
//
if (evt.data.yz) {
var xstart = w-1
var ystart = 0
var zstart = Math.floor((map[ystart*w+xstart]-zmax)*w/(xmax-xmin))
path[0].push([xstart,h-1-ystart,zstart])
var xcur = w-1
var ycur = 1
var zcur = Math.floor((map[ycur*w+xcur]-zmax)*w/(xmax-xmin))
var dx = 0
var dy = 1
while (1) {
//
// move to next point
//
xnext = xcur+dx
ynext = ycur+dy
if (xnext <= 0)
//
// done
//
break;
//
// find offset at next point
//
var znext = -Number.MAX_VALUE
for (var xoffset = 0; xoffset < toolsize; ++xoffset)
for (var yoffset = 0; yoffset < toolsize; ++yoffset) {
var x = xnext+(xoffset-toolmiddle)
var y = ynext+(yoffset-toolmiddle)
var offset = tooloffset[yoffset*toolsize+xoffset]
var z = Math.floor((map[y*w+x]-zmax)*w/(xmax-xmin))-offset
if (z > znext)
znext = z
}
//
// vectorize
//
dxcur = xcur-xstart
dycur = ycur-ystart
dzcur = zcur-zstart
dcur = Math.sqrt(dxcur*dxcur+dycur*dycur+dzcur*dzcur)
nxcur = dxcur/dcur
nycur = dycur/dcur
nzcur = dzcur/dcur
dxnext = xnext-xcur
dynext = ynext-ycur
dznext = znext-zcur
dnext = Math.sqrt(dxnext*dxnext+dynext*dynext+dznext*dznext)
nxnext = dxnext/dnext
nynext = dynext/dnext
nznext = dznext/dnext
dot = nxcur*nxnext+nycur*nynext+nzcur*nznext
if (dot <= (1-error)) {
path[0].push([xcur,h-1-ycur,zcur])
xstart = xcur
ystart = ycur
zstart = zcur
}
xcur = xnext
ycur = ynext
zcur = znext
if (ycur == (w-1)) {
if (dy == 1) {
dy = 0
dx = -step
}
else {
dy = -1
dx = 0
}
}
else if (ycur == 0) {
if (dy == -1) {
dy = 0
dx = -step
}
else {
dy = 1
dx = 0
}
}
//
// update progress
//
self.postMessage({type:'progress',value:ycur})
}
}
//
// return
//
...
...
This diff is collapsed.
Click to expand it.
programs/machines/ShopBot/mill 3D stl
+
1
−
1
View file @
2cb2f497
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment