Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Magnetophoresis Part Request #248

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,12 @@
<button id="logicarray_params_button" class="params-button mdl-button mdl-js-button mdl-button--icon">
<i class="material-icons">settings</i>
</button>
</div>
<div class="button_row">
<a id="magnetophoresis_button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--raised feature-button">Magnetophoresis</a>
<button id="magnetophoresis_params_button" class="params-button mdl-button mdl-js-button mdl-button--icon">
<i class="material-icons">settings</i>
</button>
</div>
</nav>
<span class="mdl-layout-title">Distribute</span>
Expand Down
78 changes: 78 additions & 0 deletions npm errors.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
AD+bmahabir@DESKTOP-SB69448 MINGW64 ~/Desktop/3DuF (master)
$ npm install

> [email protected] install C:\Users\bmahabir\Desktop\3DuF\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/win32-x64-83_binding.node
Download complete
Binary saved to C:\Users\bmahabir\Desktop\3DuF\node_modules\node-sass\vendor\win32-x64-83\binding.node
Caching binary to C:\Users\bmahabir\AppData\Roaming\npm-cache\node-sass\4.14.1\win32-x64-83_binding.node

> [email protected] postinstall C:\Users\bmahabir\Desktop\3DuF\node_modules\node-sass
> node scripts/build.js

Binary found at C:\Users\bmahabir\Desktop\3DuF\node_modules\node-sass\vendor\win32-x64-83\binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\watchify\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

added 1232 packages from 1249 contributors and audited 1372 packages in 25.916s

11 packages are looking for funding
run `npm fund` for details

found 183 vulnerabilities (99 low, 55 moderate, 29 high)
run `npm audit fix` to fix them, or `npm audit` for details

AD+bmahabir@DESKTOP-SB69448 MINGW64 ~/Desktop/3DuF (master)
$ npm run compile

> [email protected] compile C:\Users\bmahabir\Desktop\3DuF
> browserify ./src/app/appSetup.js -t babelify --outfile ./3DuFapp.js -d -t [ babelify ]

Browserslist: caniuse-lite is outdated. Please run next command `npm update caniuse-lite browserslist`
SyntaxError: C:\Users\bmahabir\Desktop\3DuF\src\app\view\ui\componentToolBar.js: Unexpected token, expected "," (170:3)

168 | DropletGenFlow: this.__dropletgenFlowButton,
169 | LogicArray: this.__logicarrayButton
> 170 | magnetophoresis: this.__magnetophoresisButton,
| ^
171 | };
172 |
173 | while parsing file: C:\Users\bmahabir\Desktop\3DuF\src\app\view\ui\componentToolBar.js
at Parser.raise (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:3939:15)
at Parser.unexpected (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:5248:16)
at Parser.expect (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:5236:28)
at Parser.parseObj (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:6636:14)
at Parser.parseExprAtom (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:6294:21)
at Parser.parseExprSubscripts (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:5924:21)
at Parser.parseMaybeUnary (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:5903:21)
at Parser.parseExprOps (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:5812:21)
at Parser.parseMaybeConditional (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:5784:21)
at Parser.parseMaybeAssign (C:\Users\bmahabir\Desktop\3DuF\node_modules\@babel\parser\lib\index.js:5731:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] compile: `browserify ./src/app/appSetup.js -t babelify --outfile ./3DuFapp.js -d -t [ babelify ]`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] compile script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\bmahabir\AppData\Roaming\npm-cache\_logs\2021-04-23T20_15_42_893Z-debug.log

AD+bmahabir@DESKTOP-SB69448 MINGW64 ~/Desktop/3DuF (master)
$ npm test

> [email protected] test C:\Users\bmahabir\Desktop\3DuF
> mocha --recursive --compilers js:babel/register -R spec ./src/test/

'mocha' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Test failed. See above for more details.
279 changes: 279 additions & 0 deletions src/app/library/magnetophoresis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
// based off of curved mixer code
import Template from "./template";
import paper from "paper";
import ComponentPort from "../core/componentPort";

export default class RotaryMixer extends Template {
constructor() {
super();
}

__setupDefinitions() {
this.__unique = {
position: "Point"
};

this.__heritable = {
componentSpacing: "Float",
rotation: "Float",
radius: "Float",
flowChannelWidth: "Float",
controlChannelWidth: "Float",
valveWidth: "Float",
valveLength: "Float",
valveSpacing: "Float",
height: "Float"
};

this.__defaults = {
componentSpacing: 1000,
rotation: 0,
radius: 2000,
flowChannelWidth: 1000,
controlChannelWidth: 500,
valveWidth: 2.4 * 1000,
valveLength: 1 * 1000,
valveSpacing: 300,
valveRadius: 1.2 * 1000,
height: 250
};

this.__units = {
componentSpacing: "&mu;m",
rotation: "&deg;",
radius: "&mu;m",
flowChannelWidth: "&mu;m",
controlChannelWidth: "&mu;m",
valveWidth: "&mu;m",
valveLength: "&mu;m",
valveSpacing: "&mu;m",
height: "&mu;m"
};

this.__minimum = {
componentSpacing: 0,
radius: 0.1 * 5000,
flowChannelWidth: 0.1 * 1000,
controlChannelWidth: 0.1 * 1000,
valveWidth: 0.1 * 2.4 * 1000,
valveLength: 0.1 * 2.4 * 1000,
valveSpacing: 0.1 * 300,
valveRadius: 0.1 * 1.2 * 1000,
height: 0.1 * 200,
rotation: 0
};

this.__maximum = {
componentSpacing: 10000,
radius: 10 * 5000,
flowChannelWidth: 10 * 1000,
controlChannelWidth: 10 * 1000,
valveWidth: 10 * 2.4 * 1000,
valveLength: 10 * 2.4 * 1000,
valveSpacing: 10 * 300,
valveRadius: 10 * 1.2 * 1000,
height: 10 * 200,
rotation: 360
};

this.__placementTool = "MultilayerPositionTool";

this.__toolParams = {
position: "position"
};

this.__featureParams = {
componentSpacing: "componentSpacing",
position: "position",
rotation: "rotation",
flowChannelWidth: "flowChannelWidth",
controlChannelWidth: "controlChannelWidth",
radius: "radius",
valveWidth: "valveWidth",
valveLength: "valveLength",
valveSpacing: "valveSpacing",
height: "height"
};

this.__targetParams = {
componentSpacing: "componentSpacing",
position: "position",
rotation: "rotation",
flowChannelWidth: "flowChannelWidth",
controlChannelWidth: "controlChannelWidth",
radius: "radius",
valveWidth: "valveWidth",
valveLength: "valveLength",
valveSpacing: "valveSpacing",
height: "height"
};

this.__renderKeys = ["FLOW", "CONTROL"];

this.__mint = "ROTARY MIXER";
}

getPorts(params) {
let radius = params["radius"];
let valvespacing = params["valveSpacing"];
let valvelength = params["valveLength"];
let valvewidth = params["valveWidth"];
let flowChannelWidth = params["flowChannelWidth"]; //params["flowChannelWidth"];
let channellength = radius + valvelength + 2 * valvespacing + flowChannelWidth; //This needs to be a real expression

let ports = [];

ports.push(new ComponentPort(channellength, -radius - flowChannelWidth / 2, "1", "FLOW"));
ports.push(new ComponentPort(-channellength, radius + flowChannelWidth / 2, "2", "FLOW"));

//top right
ports.push(new ComponentPort(radius + flowChannelWidth + valvespacing + valvelength / 2, -radius - flowChannelWidth / 2 - valvewidth, "3", "CONTROL"));
//top bottom
ports.push(new ComponentPort(0, -radius - flowChannelWidth / 2 - valvewidth, "4", "CONTROL"));
//middle right
ports.push(new ComponentPort(flowChannelWidth / 2 + radius + valvewidth, 0, "5", "CONTROL"));
//bottom middle
ports.push(new ComponentPort(0, radius + flowChannelWidth / 2 + valvewidth, "6", "CONTROL"));
//bottom left
ports.push(new ComponentPort(-radius - valvespacing - valvelength - flowChannelWidth / 2, radius + flowChannelWidth / 2 + valvewidth, "7", "CONTROL"));

return ports;
}

render2D(params, key = null) {
if (key == "FLOW") {
return this.__renderFlow(params);
} else if (key == "CONTROL") {
return this.__renderControl(params);
} else {
throw new Error("No valid key found");
}
}

render2DTarget(key, params) {
let rotarymixer = this.__renderFlow(params);
rotarymixer.addChild(this.__renderControl(params));
rotarymixer.fillColor.alpha = 0.5;

return rotarymixer;
}

__renderFlow(params) {
let position = params["position"];
let radius = params["radius"];
let color = params["color"];
let rotation = params["rotation"];
let valvespacing = params["valveSpacing"];
let valvelength = params["valveLength"];
let valvewidth = params["valveWidth"];
let flowChannelWidth = params["flowChannelWidth"]; //params["flowChannelWidth"];
let px = position[0];
let py = position[1];
let center = new paper.Point(px, py);
let channellength = radius + valvelength + 2 * valvespacing + flowChannelWidth; //This needs to be a real expression

let rotarymixer = new paper.CompoundPath();

let innercirc = new paper.Path.Circle(center, radius);
let outercirc = new paper.Path.Circle(center, radius + flowChannelWidth);

let rotary = outercirc.subtract(innercirc);

let topleft = new paper.Point(px - valvelength / 2, py - radius - flowChannelWidth / 2 - valvewidth / 2);
let topmiddlerectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvelength, valvewidth));
rotary = rotary.subtract(topmiddlerectangle);

topleft = new paper.Point(px + radius + flowChannelWidth / 2 - valvewidth / 2, py - valvelength / 2);
let middlerightrectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvewidth, valvelength));
rotary = rotary.subtract(middlerightrectangle);

topleft = new paper.Point(px - valvelength / 2, py + radius + flowChannelWidth / 2 - valvewidth / 2);
let bottommiddlerectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvelength, valvewidth));
rotary = rotary.subtract(bottommiddlerectangle);

rotarymixer.addChild(rotary);

let point1 = new paper.Point(px, py - radius - flowChannelWidth);
let point2 = new paper.Point(px + channellength, py - radius);
let rectangle = new paper.Path.Rectangle(point1, point2);

topleft = new paper.Point(px + radius + flowChannelWidth + valvespacing, py - radius - flowChannelWidth / 2 - valvewidth / 2);
let topleftrectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvelength, valvewidth));
rectangle = rectangle.subtract(topleftrectangle);

rectangle = rectangle.subtract(topmiddlerectangle);

rotarymixer.addChild(rectangle);

let point3 = new paper.Point(px - channellength, py + radius);
let point4 = new paper.Point(px, py + radius + flowChannelWidth);
let rectangle2 = new paper.Path.Rectangle(point3, point4);

topleft = new paper.Point(px - radius - valvespacing - valvelength - flowChannelWidth, py + radius + flowChannelWidth / 2 - valvewidth / 2);
let bottomleftrectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvelength, valvewidth));
rectangle2 = rectangle2.subtract(bottomleftrectangle);

rectangle2 = rectangle2.subtract(bottommiddlerectangle);

rotarymixer.addChild(rectangle2);

rotarymixer.fillColor = color;

return rotarymixer.rotate(rotation, px, py);
}

__renderControl(params) {
let position = params["position"];
let radius = params["radius"];
let color = params["color"];
let rotation = params["rotation"];
let valvespacing = params["valveSpacing"];
let valvelength = params["valveLength"];
let valvewidth = params["valveWidth"];
let flowChannelWidth = params["flowChannelWidth"];
let controlChannelWidth = params["controlChannelWidth"]; //params["flowChannelWidth"];
let px = position[0];
let py = position[1];

let rotarymixer = new paper.CompoundPath();
let topleft = null;
let bottomright = null;

//Removed 2 valves
//could not test what my part looked like due to errors so I just went with removing 2 valves to have the # of valves match the magnetophoresis part

rotarymixer.addChild(new paper.Path.Rectangle(topLeft, bottomRight));

//Draw top middle valve
topleft = new paper.Point(px - valvelength / 2, py - radius - flowChannelWidth / 2 - valvewidth / 2);
let topmiddlerectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvelength, valvewidth));
rotarymixer.addChild(topmiddlerectangle);

topLeft = new paper.Point(px - controlChannelWidth / 2, py - radius - flowChannelWidth / 2 - valvewidth);
bottomRight = new paper.Point(px + controlChannelWidth / 2, py - radius);
rotarymixer.addChild(new paper.Path.Rectangle(topLeft, bottomRight));

//Draw middle right valve
topleft = new paper.Point(px + radius + flowChannelWidth / 2 - valvewidth / 2, py - valvelength / 2);
let middlerightrectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvewidth, valvelength));
rotarymixer.addChild(middlerightrectangle);

topLeft = new paper.Point(px + flowChannelWidth / 2 + radius, py - controlChannelWidth / 2);
bottomRight = new paper.Point(px + flowChannelWidth / 2 + radius + valvewidth, py + controlChannelWidth / 2);
rotarymixer.addChild(new paper.Path.Rectangle(topLeft, bottomRight));

//Draw Bottom middle valve
topleft = new paper.Point(px - valvelength / 2, py + radius + flowChannelWidth / 2 - valvewidth / 2);
let bottommiddlerectangle = new paper.Path.Rectangle(topleft, new paper.Size(valvelength, valvewidth));
rotarymixer.addChild(bottommiddlerectangle);

topLeft = new paper.Point(px - controlChannelWidth / 2, py + radius + flowChannelWidth / 2);
bottomRight = new paper.Point(px + controlChannelWidth / 2, py + radius + flowChannelWidth / 2 + valvewidth);
rotarymixer.addChild(new paper.Path.Rectangle(topLeft, bottomRight));



rotarymixer.fillColor = color;
return rotarymixer.rotate(rotation, px, py);
}
}
Loading