增加模块临时定位

pull/457/MERGE
ChenX 5 years ago
parent 96950c42d9
commit b57047fbff

@ -54,8 +54,6 @@ export class DrawLeftRight implements Command
app.Database.ModelSpace.Append(leftBoard); app.Database.ModelSpace.Append(leftBoard);
app.Database.ModelSpace.Append(rightBoard); app.Database.ModelSpace.Append(rightBoard);
} }
JigUtils.End();
} }
} }
} }

@ -1,9 +1,9 @@
import { Matrix4, Vector3 } from "three";
import { Factory } from "../../CADFactory"; import { Factory } from "../../CADFactory";
import { ISerialize } from "../../ISerialize";
import { CADFiler } from "../../CADFiler"; import { CADFiler } from "../../CADFiler";
import { TemplateRecord } from "../TemplateRecord"; import { ISerialize } from "../../ISerialize";
import { Matrix4, Box3, Vector3 } from "three";
import { ObjectId } from "../../ObjectId"; import { ObjectId } from "../../ObjectId";
import { TemplateRecord } from "../TemplateRecord";
export interface PositioningParam export interface PositioningParam
{ {
@ -17,7 +17,7 @@ export interface PositioningParam
* () * ()
*/ */
@Factory @Factory
export class Positioning implements ISerialize export abstract class Positioning implements ISerialize
{ {
SpaceCS: Matrix4;//空间坐标系 SpaceCS: Matrix4;//空间坐标系
SpaceSize: Vector3;//有可能不存在 SpaceSize: Vector3;//有可能不存在

@ -0,0 +1,12 @@
import { Positioning } from "./Positioning";
import { Factory } from "../../CADFactory";
/**
*
* 使23使,使,使.
*/
@Factory
export class PositioningTemporary extends Positioning
{
}

@ -1,4 +1,4 @@
import { Matrix4, Vector3, Math, Box3 } from "three"; import { Box3, Math, Matrix4, Vector3 } from "three";
import { AutoRecord, ISPROXYKEY } from "../AutoRecord"; import { AutoRecord, ISPROXYKEY } from "../AutoRecord";
import { Factory } from "../CADFactory"; import { Factory } from "../CADFactory";
import { CADFiler } from "../CADFiler"; import { CADFiler } from "../CADFiler";
@ -9,6 +9,7 @@ import { SymbolTableRecord } from "../SymbolTableRecord";
import { TemplateParam } from "./Param/TemplateParam"; import { TemplateParam } from "./Param/TemplateParam";
import { TemplateParamType } from "./Param/TemplateParamType"; import { TemplateParamType } from "./Param/TemplateParamType";
import { Positioning } from "./Positioning/Positioning"; import { Positioning } from "./Positioning/Positioning";
import { PositioningTemporary } from "./Positioning/PositioningTemporary";
import { TemplateSplitType, TemplateType } from "./TemplateType"; import { TemplateSplitType, TemplateType } from "./TemplateType";
/** /**
@ -227,7 +228,7 @@ export class TemplateRecord extends SymbolTableRecord
*/ */
protected async Update() protected async Update()
{ {
let vardefines = this.GetParameterDefinition(false); let varDefines = this.GetParameterDefinition(false);
let brs = this.Objects.filter(id => !id.IsErase).map(id => id.Object as Board); let brs = this.Objects.filter(id => !id.IsErase).map(id => id.Object as Board);
let evaled = new Set<TemplateParam>(); let evaled = new Set<TemplateParam>();
@ -251,7 +252,7 @@ export class TemplateRecord extends SymbolTableRecord
spaceCS = this.positioning.SpaceCS; spaceCS = this.positioning.SpaceCS;
spaceSize = this.positioning.SpaceSize; spaceSize = this.positioning.SpaceSize;
spaceCS = this.RotateSpaceCS(vardefines, paramMap, evaled, spaceCS, spaceSize); spaceCS = this.RotateSpaceCS(varDefines, paramMap, evaled, spaceCS, spaceSize);
//更新LWH(通过定位空间) //更新LWH(通过定位空间)
this.LParam.UpdateParam(spaceSize.x); this.LParam.UpdateParam(spaceSize.x);
this.LParam.expr = ""; this.LParam.expr = "";
@ -259,17 +260,20 @@ export class TemplateRecord extends SymbolTableRecord
this.WParam.expr = ""; this.WParam.expr = "";
this.HParam.UpdateParam(spaceSize.z); this.HParam.UpdateParam(spaceSize.z);
this.HParam.expr = ""; this.HParam.expr = "";
if (this.positioning instanceof PositioningTemporary)
this.positioning = undefined;
} }
else else
{ {
this.LParam.EvalUpdate(vardefines, paramMap, evaled); this.LParam.EvalUpdate(varDefines, paramMap, evaled);
this.WParam.EvalUpdate(vardefines, paramMap, evaled); this.WParam.EvalUpdate(varDefines, paramMap, evaled);
this.HParam.EvalUpdate(vardefines, paramMap, evaled); this.HParam.EvalUpdate(varDefines, paramMap, evaled);
this.PXParam.EvalUpdate(vardefines, paramMap, evaled); this.PXParam.EvalUpdate(varDefines, paramMap, evaled);
this.PYParam.EvalUpdate(vardefines, paramMap, evaled); this.PYParam.EvalUpdate(varDefines, paramMap, evaled);
this.PZParam.EvalUpdate(vardefines, paramMap, evaled); this.PZParam.EvalUpdate(varDefines, paramMap, evaled);
let l = this.LParam.value as number; let l = this.LParam.value as number;
let w = this.WParam.value as number; let w = this.WParam.value as number;
@ -280,7 +284,7 @@ export class TemplateRecord extends SymbolTableRecord
let baseP = new Vector3(this.PXParam.value as number, this.PYParam.value as number, this.PZParam.value as number); let baseP = new Vector3(this.PXParam.value as number, this.PYParam.value as number, this.PZParam.value as number);
baseP.applyMatrix4(spaceCS); baseP.applyMatrix4(spaceCS);
spaceCS.setPosition(baseP); spaceCS.setPosition(baseP);
spaceCS = this.RotateSpaceCS(vardefines, paramMap, evaled, spaceCS, spaceSize); spaceCS = this.RotateSpaceCS(varDefines, paramMap, evaled, spaceCS, spaceSize);
if (!this.Parent) if (!this.Parent)
{ {
@ -307,9 +311,9 @@ export class TemplateRecord extends SymbolTableRecord
this.HParam.UpdateParam(spaceSize.z); this.HParam.UpdateParam(spaceSize.z);
} }
vardefines["L"] = spaceSize.x; varDefines["L"] = spaceSize.x;
vardefines["W"] = spaceSize.y; varDefines["W"] = spaceSize.y;
vardefines["H"] = spaceSize.z; varDefines["H"] = spaceSize.z;
//#endregion //#endregion
@ -325,7 +329,7 @@ export class TemplateRecord extends SymbolTableRecord
//更新其他参数变量 Eval local params //更新其他参数变量 Eval local params
for (const param of this.Params) for (const param of this.Params)
{ {
param.EvalUpdate(vardefines, paramMap, evaled); param.EvalUpdate(varDefines, paramMap, evaled);
} }
//保持SpaceCS //保持SpaceCS
@ -335,7 +339,7 @@ export class TemplateRecord extends SymbolTableRecord
} }
//Cache //Cache
this._CacheParamVars = vardefines; this._CacheParamVars = varDefines;
this._CacheSpaceCS = spaceCS; this._CacheSpaceCS = spaceCS;
this._CacheSpaceSize = spaceSize; this._CacheSpaceSize = spaceSize;
} }

Loading…
Cancel
Save