Skip to content

Commit aa249f9

Browse files
committed
Fixing lint issues before merging to main
1 parent b97d4d9 commit aa249f9

File tree

9 files changed

+45
-58
lines changed

9 files changed

+45
-58
lines changed

externals.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ declare const verb: any;
1111
declare const FS: any;
1212
declare const __CAD_APP: any;
1313
declare const __DEBUG__: any;
14-
14+
declare let out: any;

modules/workbenches/modeler/actions/exportBREP/exportBREP.action.ts

+9-16
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const ExportBREP: any = {
1515
icon: 'img/cad/extrude',
1616
info: 'EXPORT BREP FILE CONTAINING SELECTED BODIES',
1717
path:__dirname,
18-
run: async (params: Params, ctx: ApplicationContext) => {
18+
run: async (params: any, ctx: ApplicationContext) => {
1919
console.log("this is it", this)
2020
const occ = ctx.occService;
2121
const oci = occ.commandInterface;
@@ -43,7 +43,6 @@ export const ExportBREP: any = {
4343
resultingMessage = "yay";
4444

4545
throw {userMessage: resultingMessage};
46-
return;
4746
},
4847

4948

@@ -63,30 +62,24 @@ export const ExportBREP: any = {
6362
],
6463
}
6564

66-
67-
68-
var downloadBlob, downloadURL;
69-
70-
downloadBlob = function(data, fileName, mimeType) {
71-
var blob, url;
72-
blob = new Blob([data], {
65+
function downloadBlob(data, fileName, mimeType) {
66+
const blob = new Blob([data], {
7367
type: mimeType
7468
});
75-
url = window.URL.createObjectURL(blob);
69+
const url = window.URL.createObjectURL(blob);
7670
downloadURL(url, fileName);
7771
setTimeout(function() {
7872
return window.URL.revokeObjectURL(url);
7973
}, 1000);
80-
};
74+
}
8175

82-
downloadURL = function(data, fileName) {
83-
var a;
84-
a = document.createElement('a');
76+
function downloadURL(data, fileName) {
77+
const a = document.createElement('a');
8578
a.href = data;
8679
a.id = "MyDownload"
8780
a.download = fileName;
8881
document.body.appendChild(a);
89-
a.style = 'display: none';
82+
a.style.display = 'none';
9083
a.click();
9184
a.remove();
92-
};
85+
}

modules/workbenches/modeler/actions/getInfo/getInfo.action.ts

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import {MShell} from "cad/model/mshell";
22
import {ApplicationContext} from "cad/context";
33
import {EntityKind} from "cad/model/entities";
4-
import {ActionDefinition} from "cad/actions/actionSystemBundle";
54
import { MEdge } from "cad/model/medge";
5+
import NurbsCurve from "geom/curves/nurbsCurve";
66

77

88
interface GetInfoParams {
99
targetBody: MShell | MEdge;
10+
brepEdge: MEdge;
1011
}
1112

1213
export const GetInfo: any = {
@@ -25,30 +26,30 @@ export const GetInfo: any = {
2526
let resultingMessage = "";
2627

2728

28-
if (targetBody.TYPE === EntityKind.EDGE){
29-
resultingMessage = "Edge Length = "+ targetBody.brepEdge.curve.impl.verb.length().toFixed(4);
29+
if (targetBody instanceof MEdge){
30+
resultingMessage = "Edge Length = "+ (targetBody.brepEdge.curve.impl as NurbsCurve).verb.length().toFixed(4);
3031
}
3132
if (targetBody.TYPE === EntityKind.SHELL){
32-
let listOfOutputs = [];
33+
const listOfOutputs = [];
34+
3335
const out_old = out;
34-
out = function(msg) {
35-
listOfOutputs.push(msg);
36+
try {
37+
out = function(msg) {
38+
listOfOutputs.push(msg);
3639
//alert(JSON.stringify(msg));
3740
out_old(msg);
41+
}
42+
43+
oci.vprops(params.targetBody);
44+
45+
} finally {
46+
out = out_old;
3847
}
39-
40-
oci.vprops(params.targetBody);
41-
42-
out = out_old;
43-
44-
48+
4549
const resultingVolumeArray = listOfOutputs.filter(function (str) { return str.includes("Mass") });
4650
resultingMessage = "Volume = " + resultingVolumeArray[0].trim().replace(' ', '').replace("Mass:","").trim();
4751
}
4852

49-
50-
51-
5253
throw {userMessage: resultingMessage};
5354
return;
5455
},

modules/workbenches/modeler/features/plane/simplePlaneOperation.ts

+10-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import { createMeshGeometry } from 'scene/geoms';
2-
import { Plane } from 'geom/impl/plane';
1+
import {createMeshGeometry} from 'scene/geoms';
2+
import {Plane} from 'geom/impl/plane';
33
import Vector from 'math/vector';
4-
import { MOpenFaceShell } from '../../../../../web/app/cad/model/mopenFace';
5-
import { PlaneSurfacePrototype } from '../../../../../web/app/cad/model/surfacePrototype';
4+
import {MOpenFaceShell} from '../../../../../web/app/cad/model/mopenFace';
5+
import {PlaneSurfacePrototype} from '../../../../../web/app/cad/model/surfacePrototype';
66
import CSys from "math/csys";
7-
import { EntityKind } from "cad/model/entities";
8-
import { TextureLoader, MeshBasicMaterial,MeshLambertMaterial, Mesh, DoubleSide, PlaneGeometry } from "three";
9-
//import THREE from "three";
7+
import {EntityKind} from "cad/model/entities";
108

119

12-
13-
14-
function paramsToPlane({ orientation, datum, depth }, cadRegistry) {
10+
function paramsToPlane({ orientation, datum, depth }) {
1511
const csys = datum ? datum.csys : CSys.ORIGIN;
1612

1713
let axis;
@@ -29,8 +25,8 @@ function paramsToPlane({ orientation, datum, depth }, cadRegistry) {
2925
}
3026

3127

32-
function previewGeomProvider(params, {cadRegistry}) {
33-
const plane = paramsToPlane(params, cadRegistry);
28+
function previewGeomProvider(params) {
29+
const plane = paramsToPlane(params);
3430
const tr = plane.get3DTransformation();
3531
const w = 375, h = 375;
3632
const a = tr._apply(new Vector(-w, -h, 0));
@@ -65,15 +61,15 @@ export default {
6561
paramsInfo: ({ depth }) => `(${depth})`,
6662
previewGeomProvider,
6763
run: (params, { cadRegistry }) => {
64+
6865
return {
6966
consumed: [],
70-
created: [new MOpenFaceShell(new PlaneSurfacePrototype(paramsToPlane(params, cadRegistry)))]
67+
created: [new MOpenFaceShell(new PlaneSurfacePrototype(paramsToPlane(params)))]
7168
}
7269
},
7370
form: [
7471
{
7572
type: 'choice',
76-
style: "dropdown",
7773
label: 'orientation',
7874
name: 'orientation',
7975
style: 'radio',
@@ -103,7 +99,6 @@ export default {
10399
// name: 'image',
104100
// optional: true,
105101
// label: 'Optional Image',
106-
107102
// },
108103
],
109104
};

web/app/cad/craft/schema/initializeBySchema.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,14 @@ export function fillUpMissingFields(params: any, schema: OperationSchema, contex
4848
for (const field of fields) {
4949
const md = schema[field] as SchemaField;
5050

51-
if (md.optional) {
52-
continue;
53-
}
54-
5551
let val = params[field];
5652

5753
const isPrimitive =
5854
md.type !== Types.array
5955
&& md.type !== Types.object
6056
&& md.type !== Types.entity;
6157

62-
if (isPrimitive && isValueNotProvided(val)) {
58+
if (isPrimitive && isValueNotProvided(val) && !md.optional) {
6359
params[field] = md.defaultValue;
6460
} else if (md.type === Types.object) {
6561
if (!val) {

web/app/cad/mdf/ui/BooleanWidget.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {SectionWidgetProps} from "cad/mdf/ui/SectionWidget";
66
export interface BooleanWidgetProps extends FieldBasicProps {
77

88
type: 'boolean';
9-
simplify: boolean | true;
9+
10+
simplify?: boolean;
1011

1112
}
1213

@@ -42,8 +43,7 @@ export const BooleanWidgetDefinition = (props: BooleanWidgetProps) => ({
4243
name: "simplify",
4344
label: 'simplify',
4445
type: "checkbox",
45-
defaultValue: true,
46-
optional: true,
46+
defaultValue: true
4747
},
4848
{
4949
name: "targets",

web/app/cad/mdf/ui/ChoiceWidget.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function ChoiceWidget(props: ChoiceWidgetProps) {
4545
val = value;
4646
name = value;
4747
}
48-
return <RadioButton value={val} key={val}>{name}</RadioButton>
48+
return <RadioButton value={val} label={name} key={val} />
4949
})}
5050
</RadioButtonsField>;
5151
}

web/app/cad/model/mopenFace.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ export class MOpenFaceShell extends MShell {
55

66
private surfacePrototype: any;
77

8-
constructor(surfacePrototype, csys) {
8+
constructor(surfacePrototype, csys?) {
99
super();
1010
this.surfacePrototype = surfacePrototype;
1111
this.csys = csys;
1212
this.faces.push(new MFace(this.id + '/SURFACE', this,
1313
surfacePrototype.boundTo([], 100, 100), csys));
14+
if (!this.csys) {
15+
this.csys = this.face.csys;
16+
}
1417
}
1518

1619
get face() {

web/app/cad/model/mshell.ts

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ export class MShell extends MObject {
4545
export class MBrepShell extends MShell {
4646

4747
brepShell: Shell;
48-
csys: CartesianCSys;
4948
brepRegistry: Map<TopoObject, MObject>;
5049

5150
constructor(shell, csys?) {

0 commit comments

Comments
 (0)