Fixing lint issues before merging to main

This commit is contained in:
Val Erastov 2022-11-05 20:39:59 -07:00
parent b97d4d9701
commit aa249f95d2
9 changed files with 45 additions and 58 deletions

2
externals.d.ts vendored
View file

@ -11,4 +11,4 @@ declare const verb: any;
declare const FS: any;
declare const __CAD_APP: any;
declare const __DEBUG__: any;
declare let out: any;

View file

@ -15,7 +15,7 @@ export const ExportBREP: any = {
icon: 'img/cad/extrude',
info: 'EXPORT BREP FILE CONTAINING SELECTED BODIES',
path:__dirname,
run: async (params: Params, ctx: ApplicationContext) => {
run: async (params: any, ctx: ApplicationContext) => {
console.log("this is it", this)
const occ = ctx.occService;
const oci = occ.commandInterface;
@ -43,7 +43,6 @@ export const ExportBREP: any = {
resultingMessage = "yay";
throw {userMessage: resultingMessage};
return;
},
@ -63,30 +62,24 @@ export const ExportBREP: any = {
],
}
var downloadBlob, downloadURL;
downloadBlob = function(data, fileName, mimeType) {
var blob, url;
blob = new Blob([data], {
function downloadBlob(data, fileName, mimeType) {
const blob = new Blob([data], {
type: mimeType
});
url = window.URL.createObjectURL(blob);
const url = window.URL.createObjectURL(blob);
downloadURL(url, fileName);
setTimeout(function() {
return window.URL.revokeObjectURL(url);
}, 1000);
};
}
downloadURL = function(data, fileName) {
var a;
a = document.createElement('a');
function downloadURL(data, fileName) {
const a = document.createElement('a');
a.href = data;
a.id = "MyDownload"
a.download = fileName;
document.body.appendChild(a);
a.style = 'display: none';
a.style.display = 'none';
a.click();
a.remove();
};
}

View file

@ -1,12 +1,13 @@
import {MShell} from "cad/model/mshell";
import {ApplicationContext} from "cad/context";
import {EntityKind} from "cad/model/entities";
import {ActionDefinition} from "cad/actions/actionSystemBundle";
import { MEdge } from "cad/model/medge";
import NurbsCurve from "geom/curves/nurbsCurve";
interface GetInfoParams {
targetBody: MShell | MEdge;
brepEdge: MEdge;
}
export const GetInfo: any = {
@ -25,12 +26,14 @@ export const GetInfo: any = {
let resultingMessage = "";
if (targetBody.TYPE === EntityKind.EDGE){
resultingMessage = "Edge Length = "+ targetBody.brepEdge.curve.impl.verb.length().toFixed(4);
if (targetBody instanceof MEdge){
resultingMessage = "Edge Length = "+ (targetBody.brepEdge.curve.impl as NurbsCurve).verb.length().toFixed(4);
}
if (targetBody.TYPE === EntityKind.SHELL){
let listOfOutputs = [];
const listOfOutputs = [];
const out_old = out;
try {
out = function(msg) {
listOfOutputs.push(msg);
//alert(JSON.stringify(msg));
@ -39,16 +42,14 @@ export const GetInfo: any = {
oci.vprops(params.targetBody);
} finally {
out = out_old;
}
const resultingVolumeArray = listOfOutputs.filter(function (str) { return str.includes("Mass") });
resultingMessage = "Volume = " + resultingVolumeArray[0].trim().replace(' ', '').replace("Mass:","").trim();
}
throw {userMessage: resultingMessage};
return;
},

View file

@ -5,13 +5,9 @@ import { MOpenFaceShell } from '../../../../../web/app/cad/model/mopenFace';
import {PlaneSurfacePrototype} from '../../../../../web/app/cad/model/surfacePrototype';
import CSys from "math/csys";
import {EntityKind} from "cad/model/entities";
import { TextureLoader, MeshBasicMaterial,MeshLambertMaterial, Mesh, DoubleSide, PlaneGeometry } from "three";
//import THREE from "three";
function paramsToPlane({ orientation, datum, depth }, cadRegistry) {
function paramsToPlane({ orientation, datum, depth }) {
const csys = datum ? datum.csys : CSys.ORIGIN;
let axis;
@ -29,8 +25,8 @@ function paramsToPlane({ orientation, datum, depth }, cadRegistry) {
}
function previewGeomProvider(params, {cadRegistry}) {
const plane = paramsToPlane(params, cadRegistry);
function previewGeomProvider(params) {
const plane = paramsToPlane(params);
const tr = plane.get3DTransformation();
const w = 375, h = 375;
const a = tr._apply(new Vector(-w, -h, 0));
@ -65,15 +61,15 @@ export default {
paramsInfo: ({ depth }) => `(${depth})`,
previewGeomProvider,
run: (params, { cadRegistry }) => {
return {
consumed: [],
created: [new MOpenFaceShell(new PlaneSurfacePrototype(paramsToPlane(params, cadRegistry)))]
created: [new MOpenFaceShell(new PlaneSurfacePrototype(paramsToPlane(params)))]
}
},
form: [
{
type: 'choice',
style: "dropdown",
label: 'orientation',
name: 'orientation',
style: 'radio',
@ -103,7 +99,6 @@ export default {
// name: 'image',
// optional: true,
// label: 'Optional Image',
// },
],
};

View file

@ -48,10 +48,6 @@ export function fillUpMissingFields(params: any, schema: OperationSchema, contex
for (const field of fields) {
const md = schema[field] as SchemaField;
if (md.optional) {
continue;
}
let val = params[field];
const isPrimitive =
@ -59,7 +55,7 @@ export function fillUpMissingFields(params: any, schema: OperationSchema, contex
&& md.type !== Types.object
&& md.type !== Types.entity;
if (isPrimitive && isValueNotProvided(val)) {
if (isPrimitive && isValueNotProvided(val) && !md.optional) {
params[field] = md.defaultValue;
} else if (md.type === Types.object) {
if (!val) {

View file

@ -6,7 +6,8 @@ import {SectionWidgetProps} from "cad/mdf/ui/SectionWidget";
export interface BooleanWidgetProps extends FieldBasicProps {
type: 'boolean';
simplify: boolean | true;
simplify?: boolean;
}
@ -42,8 +43,7 @@ export const BooleanWidgetDefinition = (props: BooleanWidgetProps) => ({
name: "simplify",
label: 'simplify',
type: "checkbox",
defaultValue: true,
optional: true,
defaultValue: true
},
{
name: "targets",

View file

@ -45,7 +45,7 @@ export function ChoiceWidget(props: ChoiceWidgetProps) {
val = value;
name = value;
}
return <RadioButton value={val} key={val}>{name}</RadioButton>
return <RadioButton value={val} label={name} key={val} />
})}
</RadioButtonsField>;
}

View file

@ -5,12 +5,15 @@ export class MOpenFaceShell extends MShell {
private surfacePrototype: any;
constructor(surfacePrototype, csys) {
constructor(surfacePrototype, csys?) {
super();
this.surfacePrototype = surfacePrototype;
this.csys = csys;
this.faces.push(new MFace(this.id + '/SURFACE', this,
surfacePrototype.boundTo([], 100, 100), csys));
if (!this.csys) {
this.csys = this.face.csys;
}
}
get face() {

View file

@ -45,7 +45,6 @@ export class MShell extends MObject {
export class MBrepShell extends MShell {
brepShell: Shell;
csys: CartesianCSys;
brepRegistry: Map<TopoObject, MObject>;
constructor(shell, csys?) {