开发:类型定义

pull/2915/MERGE
ChenX 2 months ago
parent 07e22083e0
commit 1022eeb23d

@ -4,7 +4,7 @@ import { Mat4 } from "@jscad/modeling/src/maths/mat4";
import { measureAggregateVolume } from "@jscad/modeling/src/measurements"; import { measureAggregateVolume } from "@jscad/modeling/src/measurements";
import { intersect, scission } from "@jscad/modeling/src/operations/booleans"; import { intersect, scission } from "@jscad/modeling/src/operations/booleans";
import { Vector2, Vector3 } from "three"; import { Vector2, Vector3 } from "three";
import { CSGIntersect, Geom3Res } from "../../Common/CSGIntersect"; import { CSGIntersect } from "../../Common/CSGIntersect";
import { Board } from "../../DatabaseServices/Entity/Board"; import { Board } from "../../DatabaseServices/Entity/Board";
import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude"; import { ExtrudeSolid } from "../../DatabaseServices/Entity/Extrude";
import { Line } from "../../DatabaseServices/Entity/Line"; import { Line } from "../../DatabaseServices/Entity/Line";
@ -197,14 +197,14 @@ export class BoardCuttingForSweep
const interCSG = intersect(csg1Clone, csg2Clone); const interCSG = intersect(csg1Clone, csg2Clone);
interCSG.transforms = meat.OCSInv.elements as Mat4; interCSG.transforms = meat.OCSInv.elements as Mat4;
intersect(interCSG, interCSG); intersect(interCSG, interCSG);
const interCSGs = scission(interCSG as unknown as Geom3) as unknown as Geom3[]; const interCSGs = scission(interCSG);
for (const interCSG of interCSGs) for (const interCSG of interCSGs)
{ {
// 过滤掉小于肉的100体积的凹槽(这里甩固定值) // 过滤掉小于肉的100体积的凹槽(这里甩固定值)
const interVolume = measureAggregateVolume(interCSG); const interVolume = measureAggregateVolume(interCSG);
if (interVolume < 100) if (interVolume < 100)
continue; continue;
const topology = new BSPGroupParse(interCSG as unknown as Geom3Res); const topology = new BSPGroupParse(interCSG);
/** 交集部分的包围盒 */ /** 交集部分的包围盒 */
const box = new Box3Ext(new Vector3(Infinity, Infinity, Infinity), new Vector3(-Infinity, -Infinity, -Infinity)); const box = new Box3Ext(new Vector3(Infinity, Infinity, Infinity), new Vector3(-Infinity, -Infinity, -Infinity));
const ptsList = topology.Parse(); const ptsList = topology.Parse();
@ -360,7 +360,7 @@ export class BoardCuttingForSweep
private ProjectCSGToPts(CSG: Geom3, dir: "X" | "Y" | "Z" = "Z") private ProjectCSGToPts(CSG: Geom3, dir: "X" | "Y" | "Z" = "Z")
{ {
// 转为点集 // 转为点集
const topology = new BSPGroupParse(CSG as unknown as Geom3Res); const topology = new BSPGroupParse(CSG);
const ps: Vector3[] = []; const ps: Vector3[] = [];
for (let pts of topology.Parse()) for (let pts of topology.Parse())
{ {

@ -38,6 +38,7 @@ import { CuttingBoardByBoard } from "../../BoardCutting/CuttingUtils2";
import { BoardMaterialLoader, MaterialInfo } from "../../CF/Import/BoardMaterialLoader"; import { BoardMaterialLoader, MaterialInfo } from "../../CF/Import/BoardMaterialLoader";
import { FaceDirection } from "../../DrawDrilling/DrillType"; import { FaceDirection } from "../../DrawDrilling/DrillType";
import { IBoardRectHoleType, SetBrHighHoleTypeFromRectHoleType } from "../../DrawDrilling/HoleUtils"; import { IBoardRectHoleType, SetBrHighHoleTypeFromRectHoleType } from "../../DrawDrilling/HoleUtils";
import { JiaJu } from "./JiaJuInterface";
let _xmlParse: DOMParser; let _xmlParse: DOMParser;

@ -1,5 +1,5 @@
//ref: https://quicktype.io/typescript //ref: https://quicktype.io/typescript
namespace JiaJu export namespace JiaJu
{ {
export interface Bom export interface Bom
{ {

@ -10,7 +10,7 @@ import { IParseBoardNameOption } from "./R2bInterface";
export class ParseBoardNameStore extends BoardStore<IParseBoardNameOption> export class ParseBoardNameStore extends BoardStore<IParseBoardNameOption>
{ {
@observable m_Option: IParseBoardNameOption = { ...DefaultParseBoardNameOPtion }; @observable m_Option: IParseBoardNameOption = { ...DefaultParseBoardNameOPtion };
@observable m_UiOption: IUiOption<IParseBoardNameOption>; @observable declare m_UiOption: IUiOption<IParseBoardNameOption>;
InitOption() InitOption()
{ {
Object.assign(this.m_Option, DefaultParseBoardNameOPtion); Object.assign(this.m_Option, DefaultParseBoardNameOPtion);

@ -19,11 +19,11 @@ export interface Geom3Res
}>; }>;
} }
export function CSGIntersect(csg1: Geom3, csg2: Geom3, csg2tranfrom: Matrix4): Geom3Res export function CSGIntersect(csg1: Geom3, csg2: Geom3, csg2tranfrom: Matrix4): Geom3
{ {
//因为内部使用geom3进行box cache 所以我们新建了一个geom3 避免被cache导致错误 //因为内部使用geom3进行box cache 所以我们新建了一个geom3 避免被cache导致错误
let csg1Clone = geom3.create(csg1.polygons.concat()); let csg1Clone = geom3.create(csg1.polygons.concat());
let csg2Clone = geom3.create(csg2.polygons.concat()); let csg2Clone = geom3.create(csg2.polygons.concat());
csg2Clone.transforms = csg2tranfrom.elements as Mat4; csg2Clone.transforms = csg2tranfrom.elements as Mat4;
return intersect(csg1Clone, csg2Clone) as unknown as Geom3Res; return intersect(csg1Clone, csg2Clone);
} }

@ -35,7 +35,7 @@ export class TranslateGizmo extends CoorAxes implements IGizmo
opacity: 0.5 opacity: 0.5
}); });
Picks: Group; declare Picks: Group;
constructor() constructor()
{ {

@ -1,7 +1,6 @@
import { Poly3 } from "@jscad/modeling/src/geometries/types"; import { Geom3, Poly3 } from "@jscad/modeling/src/geometries/types";
import { Vec3 } from "@jscad/modeling/src/maths/vec3"; import { Vec3 } from "@jscad/modeling/src/maths/vec3";
import { Vector3 } from "three"; import { Vector3 } from "three";
import { Geom3Res } from "../Common/CSGIntersect";
import { ToFixed } from "../Common/Utils"; import { ToFixed } from "../Common/Utils";
/** /**
@ -15,7 +14,7 @@ import { ToFixed } from "../Common/Utils";
*/ */
export class BSPGroupParse export class BSPGroupParse
{ {
constructor(bsp?: Geom3Res, public fractionDigits = 1) constructor(bsp?: Geom3, public fractionDigits = 1)
{ {
if (bsp) if (bsp)
for (let poly of bsp.polygons) for (let poly of bsp.polygons)

@ -58,7 +58,7 @@ declare const version: string;
export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}> export class TopPanel extends React.Component<{ store?: TopPanelStore; }, {}>
{ {
private topStore = DownPanelStore.GetInstance(); private topStore = DownPanelStore.GetInstance();
state: TopPanelState; declare state: TopPanelState;
constructor(props) constructor(props)
{ {
super(props); super(props);

@ -46,7 +46,7 @@ interface InputHitState
@observer @observer
export class InputHint extends React.Component<InputHintProps, InputHitState> export class InputHint extends React.Component<InputHintProps, InputHitState>
{ {
public state: InputHitState; public declare state: InputHitState;
private inputEl: HTMLInputElement; private inputEl: HTMLInputElement;
private selectIndex: number = 0; //选择历史命令索引 private selectIndex: number = 0; //选择历史命令索引
private isCNInput: boolean = false; private isCNInput: boolean = false;

@ -18,8 +18,8 @@ type IDoorDrawer = IDoorInfo | IDrawerInfo;
export class DoorDrawerStore extends BoardStore<IDoorAndDrawerConfigOption> export class DoorDrawerStore extends BoardStore<IDoorAndDrawerConfigOption>
{ {
m_Option: IDoorAndDrawerConfigOption; declare m_Option: IDoorAndDrawerConfigOption;
protected m_UiOption: IUiOption<IDoorAndDrawerConfigOption>; protected declare m_UiOption: IUiOption<IDoorAndDrawerConfigOption>;
totalHeight = 0; totalHeight = 0;
totalWidth = 0; totalWidth = 0;
totalDepth = 0; totalDepth = 0;

@ -38,7 +38,7 @@ export class DrillStore extends BoardStore
@observable rules: DrillingOption[] = []; @observable rules: DrillingOption[] = [];
@observable drillConfigSortType: DrillConfigSortType;//排钻类型排序方式 @observable drillConfigSortType: DrillConfigSortType;//排钻类型排序方式
@observable customConfigSort: string[] = []; //自定义的排序[...Keys] @observable customConfigSort: string[] = []; //自定义的排序[...Keys]
@observable m_Option: DrillingOption; @observable declare m_Option: DrillingOption;
@observable drillConfig: Map<string, DrillingOption[]> = new Map(); //类似UI_option @observable drillConfig: Map<string, DrillingOption[]> = new Map(); //类似UI_option
defaultfDrillConfig: Map<string, DrillingOption[]> = new Map(); //排钻类型初始排序 defaultfDrillConfig: Map<string, DrillingOption[]> = new Map(); //排钻类型初始排序
deleteHoleTemps = new Set(); deleteHoleTemps = new Set();

@ -9,7 +9,7 @@ import { EWineRackStyle, IWineRackOption } from "./WineRackInterface";
export class WineRackStore extends BoardStore<IWineRackOption> export class WineRackStore extends BoardStore<IWineRackOption>
{ {
EditorTemplate: TemplateWineRackRecord; declare EditorTemplate: TemplateWineRackRecord;
@observable m_Option: IWineRackOption = Object.assign({}, DefaultWineRackConfig); @observable m_Option: IWineRackOption = Object.assign({}, DefaultWineRackConfig);
HasInvailValue() HasInvailValue()
{ {

Loading…
Cancel
Save