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

Manufacturing typescripting, z & substrate offsets #427

Merged
merged 28 commits into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
e4ce3db
Added toroidal mixer
Oct 8, 2021
996f399
Added toroidal mixer support
Oct 8, 2021
3ca49af
Fixed port locations
Oct 8, 2021
c54e284
Second port placement case
Oct 8, 2021
1dfe0fd
Added hideChosenFeatures function
Oct 14, 2021
56ca62d
Merge pull request #6 from MurrayLF/webpack-build-ds
MurrayLF Oct 15, 2021
f2a84a8
Hopefully toroid milling fix
Oct 17, 2021
82525b1
Fixed paper connection updating issue
Oct 19, 2021
b62ff7e
Substrate offset functionality, typescripting
Oct 19, 2021
0da3f6c
Port updating fix
Oct 21, 2021
2aace54
Manufacturing typescripting, fixes
Oct 26, 2021
ef2462e
Quick connection with valve fix
Nov 1, 2021
9dd657a
Modified toroidalMixer uniting
Nov 2, 2021
aba0402
Quick valve fix
Nov 4, 2021
eefb5c8
Modified manufacturingInfo
Nov 6, 2021
54b0698
Updated cnc manufacturing functionality
Nov 6, 2021
fec8853
Removed substrateFeatureMap
Nov 6, 2021
9bd73ea
Converted toroidalMixer to typescript
Nov 6, 2021
05604f6
paperObject rename, typescript refactoring
Nov 8, 2021
ddd4858
Typescripting merger
Nov 8, 2021
7134ecc
Merge branch 'CIDARLAB-webpack-build' into webpack-build
Nov 8, 2021
a34bfaa
Fixed module imports
Nov 8, 2021
3d41e96
Removed console.log statements
Nov 8, 2021
d1d5a4f
Removed typescripting error
Nov 8, 2021
30c593d
Rename ManufacturingInfo.ts to manufacturingInfo.ts
MurrayLF Nov 9, 2021
430a0e5
Removed old code, updated imports
Nov 9, 2021
a755084
Merge branch 'webpack-build' of https://github.com/MurrayLF/3DuF into…
Nov 9, 2021
b2b6346
laserCuttingGenerator typescripting
Nov 9, 2021
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
7 changes: 2 additions & 5 deletions src/app/core/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export default class Component {

// Create and set the ports here itself

const cleanparamdata = this._params.parameters;
const cleanparamdata = this._params.toMap();
MurrayLF marked this conversation as resolved.
Show resolved Hide resolved
if ((mint !== "" && mint !== "TEXT") || mint === null) {
const ports = ComponentAPI.getComponentPorts(MapUtils.toMap(cleanparamdata), mint);
const ports = ComponentAPI.getComponentPorts(cleanparamdata, mint);
if (ports != undefined && ports.length >= 0 && ports !== null) {
for (const i in ports) {
this.setPort(ports[i].label, ports[i]);
Expand Down Expand Up @@ -560,11 +560,8 @@ export default class Component {
*/
updateComponentPorts(): void {
// updating the Component Ports

const params = this.params.toMap();

const cleanparamdata = params;

const ports = ComponentAPI.getComponentPorts(cleanparamdata, this._entity);

for (const i in ports) {
Expand Down
11 changes: 5 additions & 6 deletions src/app/core/componentPort.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import uuid from "node-uuid";
import paper from "paper";
import Layer from "./layer";
import Component from "./component";
import { ComponentPortInterchangeV1, Point } from "./init";

Expand All @@ -9,16 +8,16 @@ export default class ComponentPort {
protected _x: number;
protected _y: number;
protected _label: string;
protected _layer: Layer;
protected _layer: string;

/**
* Default constructor for ComponentPorts
* @param {Number} x X coordinate
* @param {Number} y Y coordinate
* @param {String} label Name of the component
* @param {Layer} layer
* @param {string} layer
*/
constructor(x: number, y: number, label: string, layer: Layer) {
constructor(x: number, y: number, label: string, layer: string) {
this._id = uuid.v1();
this._x = x;
this._y = y;
Expand All @@ -28,7 +27,7 @@ export default class ComponentPort {

/**
* Gets the layer of the component port
* @returns {layer} Returns layer
* @returns {string} Returns layer
* @memberof ComponentPort
*/
get layer() {
Expand All @@ -37,7 +36,7 @@ export default class ComponentPort {

/**
* Sets the layer
* @param {} value Value of the layer
* @param {string} value Value of the layer
* @memberof ComponentPort
* @returns {void}
*/
Expand Down
13 changes: 13 additions & 0 deletions src/app/core/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,19 @@ export default class Connection {
*/
updateParameter(key: string, value: any): void {
this._params.updateParameter(key, value);

console.log("Key: ", key, " Val: ", value);

if (key != "segments") {
for (const i in this._featureIDs) {
const featureidtochange = this._featureIDs[i];

// Get the feature id and modify it
const feature = ConnectionUtils.getFeatureFromID(featureidtochange);
feature.updateParameter(key, value);
}
}

MurrayLF marked this conversation as resolved.
Show resolved Hide resolved
// this._params[key] = value;
// this.updateView();
}
Expand Down
30 changes: 23 additions & 7 deletions src/app/core/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import Layer from "./layer";
import DXFObject from "./dxfObject";
import { ComponentAPI } from "@/componentAPI";
import MapUtils from "../utils/mapUtils";
import { FeatureInterchangeV0 } from "./init";
import { FeatureInterchangeV0, LogicalLayerType } from "./init";
import Parameter from "./parameter";
import EventBus from "@/events/events";
import RenderLayer from "../view/renderLayer";
import { DFMType, ManufacturingInfo } from "@/app/manufacturing/manufacturingInfo";
import { DFMType, ManufacturingInfo } from "../manufacturing/manufacturingInfo";
import FeatureUtils from "@/app/utils/featureUtils";

/**
* Feature class
Expand Down Expand Up @@ -45,12 +46,18 @@ export default class Feature {
this._referenceID = null;
this.layer = null;
const tempRenderName: string = this.deriveRenderName();
let modifierName: string;
if (this.type == "Port") modifierName = "PORT";
else modifierName = "COMPONENT";
this._manufacturingInfo = {
fabtype: fabtype,
layertype: null,
rendername: tempRenderName,
"z-offset-key": ComponentAPI.library[this.type].object.zOffsetKey(tempRenderName),
"substrate-offset": ComponentAPI.library[this.type].object.substrateOffset(tempRenderName)
depth: this.getValue(ComponentAPI.library[this.type].object.zOffsetKey(tempRenderName)),
"substrate-offset": ComponentAPI.library[this.type].object.substrateOffset(tempRenderName),
substrate: null,
modifier: modifierName
};
}

Expand Down Expand Up @@ -107,10 +114,18 @@ export default class Feature {
return this._manufacturingInfo;
}

// Ensures that all values in manufacturingInfo have been set
setManufacturingInfoLayer() {
/**
* Ensures that layer and substrate values in manufacturingInfo have been set
* @return {void}
* @memberof Feature
*/
setManufacturingInfoLayer(): void {
this._manufacturingInfo.depth = this.getValue(ComponentAPI.library[this.type].object.zOffsetKey(this.deriveRenderName()));
if (this.layer != null) {
this._manufacturingInfo.layertype = this.layer.type;
this._manufacturingInfo.substrate = FeatureUtils.setSubstrate(this, this._manufacturingInfo["substrate-offset"]);
} else {
throw new Error("Layer not set in feature " + this.ID + " so manufacturingInfo cannot be set");
}
}

Expand Down Expand Up @@ -339,10 +354,11 @@ export default class Feature {
*/

deriveRenderName(): string {
console.log(this._type);
if (this._type.includes("_integration")) {
return "INTEGRATION";
console.log("INTEGRATION");
} else if (this._type.includes("_control")) {
return "INTEGRATION";
} else if (this._type.includes("_control") || this._type == "Valve") {
console.log("CONTROL");
return "CONTROL";
} else if (this._type.includes("_cell")) {
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export type Point = [number, number];

export type Segment = [Point, Point];

export type paperObject = paper.CompoundPath | paper.Path | paper.PointText;
export type ToolPaperObject = paper.CompoundPath | paper.Path | paper.PointText;

export type ScratchInterchangeV1 = {
name: string;
Expand Down
27 changes: 27 additions & 0 deletions src/app/featureSets/basic/render2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,33 @@ export const render2D = {
targetPrimitiveType: "MixerTarget",
targetPrimitiveSet: "Basic2D"
},
ToroidalMixer: {
featureParams: {
componentSpacing: "componentSpacing",
position: "position",
channelWidth: "channelWidth",
neckAngle: "neckAngle",
neckLength: "neckLength",
neckWidth: "neckWidth",
numberOfMixers: "numberOfMixers",
rotation: "rotation",
innerDiameter: "innerDiameter"
MurrayLF marked this conversation as resolved.
Show resolved Hide resolved
},
targetParams: {
componentSpacing: "componentSpacing",
channelWidth: "channelWidth",
neckAngle: "neckAngle",
neckLength: "neckLength",
neckWidth: "neckWidth",
numberOfMixers: "numberOfMixers",
rotation: "rotation",
innerDiameter: "innerDiameter"
},
featurePrimitiveType: "ToroidalMixer",
featurePrimitiveSet: "Basic2D",
targetPrimitiveType: "MixerTarget",
targetPrimitiveSet: "Basic2D"
},
GradientGenerator: {
featureParams: {
position: "position",
Expand Down
2 changes: 2 additions & 0 deletions src/app/featureSets/featureSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import Node from "../library/node";
import DropletGeneratorT from "../library/dropletGeneratorT";
import DropletGeneratorFlowFocus from "../library/dropletGeneratorFlowFocus";
import LogicArray from "../library/logicArray";
import ToroidalMixer from "../library/toroidalMixer";

export default class FeatureSet {
constructor(definitions, tools, render2D, render3D, setString) {
Expand Down Expand Up @@ -90,6 +91,7 @@ export default class FeatureSet {
Pump3D_control: { object: new Pump3D(), key: "CONTROL" },
RoundedChannel: { object: new RoundedChannel(), key: null },
thermoCycler: { object: new thermoCycler(), key: "FLOW" },
ToroidalMixer: { object: new ToroidalMixer(), key: "FLOW" },
MurrayLF marked this conversation as resolved.
Show resolved Hide resolved
Transition: { object: new Transition(), key: null },
Transposer: { object: new Transposer(), key: "FLOW" },
Transposer_control: { object: new Transposer(), key: "CONTROL" },
Expand Down
6 changes: 3 additions & 3 deletions src/app/library/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class Template {
} else if (this.__zOffsetKeys.hasOwnProperty(key)) {
return this.__zOffsetKeys[key];
} else {
throw new Error("zOffsetKey does not contain given key");
throw new Error("zOffsetKey does not contain key " + key);
}
}

Expand All @@ -71,11 +71,11 @@ export default class Template {
*/
substrateOffset(key: string): string {
if (this.__substrateOffset === null) {
throw new Error("zOffsetKey cannot be null instantiate in the __setupDefinitions");
throw new Error("substrateOffset cannot be null instantiate in the __setupDefinitions");
} else if (this.__substrateOffset.hasOwnProperty(key)) {
return this.__substrateOffset[key];
} else {
throw new Error("substrateOffset does not contain given key");
throw new Error("substrateOffset does not contain key " + key);
}
}

Expand Down
Loading