Skip to content
Draft
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
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@
"cSpell.words": ["registryref"],
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
},
"editor.formatOnSave": true,
"typescript.format.insertSpaceAfterTypeAssertion": true
}
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"dependencies": {
"@dagrejs/graphlib": "^2.1.4",
"@mdi/font": "^5.9.55",
"@types/file-saver": "^2.0.3",
"@types/node-uuid": "0.0.28",
"acorn": "^8.4.1",
"axios": "^0.21.1",
Expand Down Expand Up @@ -71,6 +72,7 @@
"@babel/preset-env": "^7.15.0",
"@mdi/js": "^5.9.55",
"@types/chai": "^4.2.21",
"@types/md5": "^2.3.1",
"@types/mocha": "^5.2.4",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
Expand All @@ -94,6 +96,8 @@
"eslint-plugin-prettier-vue": "^2.1.1",
"eslint-plugin-vue": "^6.2.2",
"glob-parent": "^5.1.2",
"mem": "^4.0.0",
"minimist": "^1.2.3",
"npm-merge-driver": "^2.3.6",
"prettier": "^1.19.1",
"prettier-eslint": "^9.0.2",
Expand All @@ -110,9 +114,7 @@
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.2",
"y18n": "^4.0.1",
"yeoman-generator": "^5.4.2",
"mem": "^4.0.0",
"minimist": "^1.2.3"
"yeoman-generator": "^5.4.2"
},
"bugs": {
"url": "https://github.com/CIDARLAB/3DuF/issues"
Expand Down
15 changes: 12 additions & 3 deletions src/app/core/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import MapUtils from "../utils/mapUtils";
* The Device stores information about a design.
*/
export default class Device {
toJSON(): any {
throw new Error("Method not implemented.");
}
private __layers: Array<Layer>;
private __textLayers: Array<Layer>;
private __params: Params;
Expand Down Expand Up @@ -891,13 +894,16 @@ export default class Device {
* @return {Array<values>}
* @memberof Device
*/
getValvesForConnection(connection: Connection): Array<Component | null> {
getValvesForConnection(connection: Connection): Array<Component> {
let connectionid: string = connection.id;
let ret: Array<Component | null> = [];
let ret: Array<Component> = [];
for (let [key, value] of this.__valveMap) {
// let = pair;
if (connectionid === value) {
ret.push(this.getComponentByID(key));
let valve = this.getComponentByID(key);
if (valve != null) {
ret.push(valve);
}
}
}

Expand All @@ -912,6 +918,9 @@ export default class Device {
*/
getIsValve3D(valve: Component): boolean | undefined {
let valveid = valve.id;
if (!this.__valveIs3DMap.has(valveid)){
throw new Error(`Doesn't contain the 3d valve: ${valveid}`);
}
return this.__valveIs3DMap.get(valveid);
}

Expand Down
7 changes: 5 additions & 2 deletions src/app/core/edgeFeature.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentAPI } from "@/componentAPI";
import { DFMType } from "../manufacturing/ManufacturingInfo";
import { DFMType } from "../manufacturing/manufacturingInfo";
import DXFObject from "./dxfObject";

import Feature from "./feature";
Expand All @@ -17,7 +17,10 @@ export default class EdgeFeature extends Feature {
* @param {Params} params
* @param {String} id
*/
constructor(edgeObjects: any, params: Params, id = ComponentAPI.generateID()) {
constructor(edgeObjects: any, params: Params | null, id = ComponentAPI.generateID()) {
if (params === null) {
params = new Params({}, new Map(), new Map());
}
super("EDGE", params, id, id, DFMType.EDGE);
if (edgeObjects) {
this._edgeObjects = edgeObjects;
Expand Down
2 changes: 1 addition & 1 deletion src/app/core/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FeatureInterchangeV0 } from "./init";
import Parameter from "./parameter";
import EventBus from "@/events/events";
import RenderLayer from "../view/renderLayer";
import { DFMType, ManufacturingInfo } from "../manufacturing/ManufacturingInfo";
import { DFMType, ManufacturingInfo } from "../manufacturing/manufacturingInfo";

/**
* Feature class
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 PaperObject = paper.CompoundPath | paper.Path | paper.PointText;

export type ScratchInterchangeV1 = {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion src/app/library/merger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Template from "./template";
import paper from "paper";
import ComponentPort from "../core/componentPort";
import { LogicalLayerType } from "../core/init";
import { DFMType } from "../manufacturing/ManufacturingInfo";
import { DFMType } from "../manufacturing/manufacturingInfo";

export default class Merger extends Template {
constructor() {
Expand Down
19 changes: 19 additions & 0 deletions src/app/library/template.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import ComponentPort from "../core/componentPort";
import { DFMType } from "../manufacturing/manufacturingInfo";
//import { ManufacturingInfo } from "../manufacturing/manufacturingInfo";

export enum PositionToolType {
Expand All @@ -24,6 +25,7 @@ export default class Template {
protected _previewImage: string = "";
protected __zOffsetKeys: { [key: string]: string } | null = null;
protected __substrateOffset: { [key: string]: string } | null = null;
protected fabtype: { [key: string]: DFMType } | null = {"FLOW": DFMType.XY, "CONTROL": DFMType.XY};

/**
*Creates an instance of Template.
Expand Down Expand Up @@ -312,4 +314,21 @@ export default class Template {
const y_new = position[1] - positionUnitedBounds.topLeft.y;
return [x_new, y_new];
}

/**
* Returns the fab type of the component
*
* @param {string} key
* @returns {string}
* @memberof Template
*/
getFabType(key: string): DFMType {
if (this.fabtype === null) {
throw new Error("fabType cannot be null instantiate in the __setupDefinitions");
} else if(this.fabtype.hasOwnProperty(key)) {
return this.fabtype[key];
} else {
throw new Error("fabType does not have key: " + key);
}
}
}
Loading