同步源码
This commit is contained in:
669
api.esm.js
669
api.esm.js
@@ -1,4 +1,4 @@
|
||||
import { Vector3, Matrix4, Box3, Color, FrontSide, MeshPhysicalMaterial, Object3D, Vector2 as Vector2$1, Quaternion, MathUtils, Shape as Shape$1, EllipseCurve, LineDashedMaterial, DoubleSide, MeshBasicMaterial, LineBasicMaterial, ShaderMaterial, BufferGeometry, ShapeGeometry, BufferAttribute, Line as Line$1, Plane, Line3, CatmullRomCurve3, Box2 as Box2$1, Path as Path$1, LineSegments, Mesh, CylinderBufferGeometry, Float32BufferAttribute, Geometry, ShapeUtils, Face3, BoxBufferGeometry, InstancedInterleavedBuffer, InterleavedBufferAttribute, ExtrudeGeometry, BoxGeometry, Euler, OrthographicCamera, PerspectiveCamera, AmbientLight as AmbientLight$1, DirectionalLightHelper, SphereBufferGeometry, Matrix3, Group, DirectionalLight as DirectionalLight$1, HemisphereLight as HemisphereLight$1, MirroredRepeatWrapping, Texture, Scene, WebGLRenderTarget, Frustum, MeshNormalMaterial, PointLight as PointLight$1, SphereGeometry, BackSide, RectAreaLight as RectAreaLight$1, SpotLight as SpotLight$1, ConeGeometry, PointsMaterial, Points, Raycaster } from 'three';
|
||||
import { Vector3, Matrix4, Box3, Color, FrontSide, MeshPhysicalMaterial, Object3D, Vector2 as Vector2$1, Quaternion, MathUtils, LineDashedMaterial, DoubleSide, MeshBasicMaterial, LineBasicMaterial, ShaderMaterial, BufferGeometry, Shape as Shape$1, ShapeGeometry, BufferAttribute, Line as Line$1, Plane, Line3, EllipseCurve, CatmullRomCurve3, Box2 as Box2$1, Path as Path$1, LineSegments, Mesh, CylinderBufferGeometry, Float32BufferAttribute, Geometry, ShapeUtils, Face3, BoxBufferGeometry, InstancedInterleavedBuffer, InterleavedBufferAttribute, ExtrudeGeometry, BoxGeometry, Euler, OrthographicCamera, PerspectiveCamera, AmbientLight as AmbientLight$1, DirectionalLightHelper, SphereBufferGeometry, Matrix3, Group, DirectionalLight as DirectionalLight$1, HemisphereLight as HemisphereLight$1, MirroredRepeatWrapping, Texture, Scene, WebGLRenderTarget, Frustum, MeshNormalMaterial, PointLight as PointLight$1, SphereGeometry, BackSide, RectAreaLight as RectAreaLight$1, SpotLight as SpotLight$1, ConeGeometry, PointsMaterial, Points, Raycaster } from 'three';
|
||||
import { iaop, end } from 'xaop';
|
||||
import { Line2 } from 'three/examples/jsm/lines/Line2';
|
||||
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry';
|
||||
@@ -2146,6 +2146,10 @@ var StoreageKeys;
|
||||
StoreageKeys["UserName"] = "userName";
|
||||
StoreageKeys["UserPhone"] = "userPhone";
|
||||
StoreageKeys["ShopName"] = "shopName";
|
||||
StoreageKeys["AgentShopName"] = "AgentShopName";
|
||||
StoreageKeys["AgentPhone"] = "AgentPhone";
|
||||
StoreageKeys["VersionName"] = "VersionName";
|
||||
StoreageKeys["RegisterTime"] = "RegisterTime";
|
||||
StoreageKeys["RenderType"] = "renderType";
|
||||
StoreageKeys["ExactDrill"] = "openExactDrill";
|
||||
StoreageKeys["ConfigName"] = "configName_";
|
||||
@@ -2765,118 +2769,6 @@ function arraySum(arr) {
|
||||
return sum;
|
||||
}
|
||||
|
||||
let tempArc;
|
||||
class Shape2 extends Shape$1 {
|
||||
getPoints(divisions = 12, optimizeArc = true) {
|
||||
let points = [], last;
|
||||
for (let i = 0, curves = this.curves; i < curves.length; i++) {
|
||||
let curve = curves[i];
|
||||
let resolution = divisions;
|
||||
//@ts-ignore
|
||||
if (curve && curve.isEllipseCurve) {
|
||||
if (optimizeArc) {
|
||||
if (!tempArc)
|
||||
tempArc = new Arc;
|
||||
else
|
||||
tempArc.ClearDraw();
|
||||
tempArc.IsClockWise = curve.aClockwise;
|
||||
tempArc.StartAngle = curve.aStartAngle;
|
||||
tempArc.EndAngle = curve.aEndAngle;
|
||||
tempArc.Radius = Math.abs(curve.xRadius);
|
||||
//根据圆弧的角度,来确定绘制个数
|
||||
let count = Math.max(2, Math.abs(Math.ceil((tempArc.AllAngle) / Math.PI)) * divisions);
|
||||
resolution = clamp(Math.ceil(tempArc.Length / 20), count, 60);
|
||||
}
|
||||
else
|
||||
resolution = divisions * 2;
|
||||
}
|
||||
else {
|
||||
//@ts-ignore
|
||||
resolution = (curve && (curve.isLineCurve || curve.isLineCurve3)) ? 1
|
||||
//@ts-ignore
|
||||
: (curve && curve.isSplineCurve) ? divisions * curve.points.length
|
||||
: divisions;
|
||||
}
|
||||
let pts = curve.getPoints(resolution);
|
||||
for (let j = 0; j < pts.length; j++) {
|
||||
let point = pts[j];
|
||||
if (last && equalv2(last, point, 1e-4))
|
||||
continue; // ensures no consecutive points are duplicates
|
||||
points.push(point);
|
||||
last = point;
|
||||
if (j === pts.length - 1)
|
||||
point["_mask_"] = true;
|
||||
}
|
||||
}
|
||||
if (this.autoClose
|
||||
&& points.length > 1
|
||||
&& !points[points.length - 1].equals(points[0])) {
|
||||
points.push(points[0]);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {
|
||||
let curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);
|
||||
/*
|
||||
if (this.curves.length > 0)
|
||||
{
|
||||
// if a previous curve is present, attempt to join
|
||||
let firstPoint = curve.getPoint(0);
|
||||
if (!equalv2(firstPoint, this.currentPoint))
|
||||
{
|
||||
this.lineTo(firstPoint.x, firstPoint.y);
|
||||
}
|
||||
}
|
||||
*/
|
||||
this.curves.push(curve);
|
||||
let lastPoint = curve.getPoint(1);
|
||||
this.currentPoint.copy(lastPoint);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
//解析二维圆弧
|
||||
class Arc2d {
|
||||
constructor(p1, p2, bul) {
|
||||
p1 = p1.clone();
|
||||
p2 = p2.clone();
|
||||
//a (* 2 (atan b))
|
||||
let a = Math.atan(bul) * 2;
|
||||
//r (/ (distance p1 p2) 2 (sin a))
|
||||
let r = p1.distanceTo(p2) / 2 / Math.sin(a);
|
||||
//c (polar p1 (+ (- (/ pi 2) a) (angle p1 p2)) r)
|
||||
let c = polar(p1.clone(), Math.PI / 2 - a + angle(p2.clone().sub(p1)), r);
|
||||
this._Radius = Math.abs(r);
|
||||
this._StartAn = angle(p1.sub(c));
|
||||
this._EndAn = angle(p2.sub(c));
|
||||
this._Center = c;
|
||||
}
|
||||
}
|
||||
//创建轮廓 通过点表和凸度
|
||||
function CreatePolylinePath(pts, buls) {
|
||||
let shape = new Shape2();
|
||||
if (pts.length === 0)
|
||||
return shape;
|
||||
let firstPt = pts[0];
|
||||
shape.moveTo(firstPt.x, firstPt.y);
|
||||
for (let i = 0; i < pts.length - 1; i++) {
|
||||
let prePt = pts[i];
|
||||
let nextPt = pts[i + 1];
|
||||
if (equaln$1(buls[i], 0, 1e-8) || equalv2(prePt, nextPt, 1e-2)) {
|
||||
shape.lineTo(nextPt.x, nextPt.y);
|
||||
}
|
||||
else {
|
||||
//参考
|
||||
//http://www.dorodnic.com/blog/tag/three-js/ 绘制一个齿轮
|
||||
//https://www.kirupa.com/html5/drawing_circles_canvas.htm //html5
|
||||
let arc2 = new Arc2d(prePt, nextPt, buls[i]);
|
||||
let cen = arc2._Center;
|
||||
shape.absarc(cen.x, cen.y, arc2._Radius, arc2._StartAn, arc2._EndAn, buls[i] < 0);
|
||||
}
|
||||
}
|
||||
return shape;
|
||||
}
|
||||
|
||||
function GetGoodShaderSimple(color = new Vector3, side = FrontSide, logBuf = false, opacity = 1) {
|
||||
return {
|
||||
uniforms: {
|
||||
@@ -4859,6 +4751,212 @@ Circle = Circle_1 = __decorate([
|
||||
Factory
|
||||
], Circle);
|
||||
|
||||
const ARC_SplitLength = 4; //圆的分段长度
|
||||
const Arc_MinSplitCount = 8; //圆的最小分段个数
|
||||
const ARC_MaxSplitCount = 90; //圆的最大分段个数
|
||||
/**
|
||||
*
|
||||
* @param cu
|
||||
*/
|
||||
function SplitCurveParams(cu) {
|
||||
let xparams = [];
|
||||
if (cu instanceof Circle) {
|
||||
let splitCount = cu.Radius / ARC_SplitLength;
|
||||
//保证是偶数(避免奇数和Shape2计算方式一致导致的干涉)
|
||||
splitCount = clamp(Math.floor(splitCount * 0.5) * 2, Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
for (let i = 0; i < splitCount; i++)
|
||||
xparams.push(i / splitCount);
|
||||
}
|
||||
else
|
||||
//分段1
|
||||
for (let i = 0; i < cu.EndParam; i++) {
|
||||
xparams.push(i);
|
||||
if (!equaln$1(cu.GetBulgeAt(i), 0, BUL_IS_LINE_FUZZ)) // is arc
|
||||
{
|
||||
let arc = cu.GetCurveAtIndex(i);
|
||||
let splitCount = arc.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
if (splitCount === 0)
|
||||
continue;
|
||||
let a = Math.PI * 2 / splitCount;
|
||||
let params = [];
|
||||
for (let j = 0; j < splitCount; j++) {
|
||||
let param = arc.GetParamAtAngle(a * j);
|
||||
if (arc.ParamOnCurve(param))
|
||||
params.push(param);
|
||||
}
|
||||
arraySortByNumber(params);
|
||||
if (params.length === 0)
|
||||
continue;
|
||||
for (let p of params) {
|
||||
if (p > 1e-5 && p < 0.99999)
|
||||
xparams.push(p + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
xparams.push(cu.EndParam);
|
||||
return xparams;
|
||||
}
|
||||
function SplitCurvePoints(cu) {
|
||||
let pts = [];
|
||||
if (cu instanceof Circle) {
|
||||
let splitCount = cu.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
for (let i = 0; i < splitCount; i++)
|
||||
pts.push(cu.GetPointAtParam(i / splitCount));
|
||||
}
|
||||
else
|
||||
//分段1
|
||||
for (let i = 0; i < cu.EndParam; i++) {
|
||||
pts.push(AsVector3(cu.GetPoint2dAt(i)).applyMatrix4(cu.OCSNoClone));
|
||||
if (!equaln$1(cu.GetBulgeAt(i), 0, BUL_IS_LINE_FUZZ)) // is arc
|
||||
{
|
||||
let arc = cu.GetCurveAtIndex(i);
|
||||
let splitCount = arc.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
if (splitCount === 0)
|
||||
continue;
|
||||
let divParam = 1 / splitCount;
|
||||
for (let j = 1; j < splitCount - 1; j++) {
|
||||
let p = arc.GetPointAtParam(divParam * j);
|
||||
pts.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
pts.push(cu.EndPoint);
|
||||
return pts;
|
||||
}
|
||||
function SplitArcParams(arc) {
|
||||
let splitCount = arc.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
if (splitCount === 0)
|
||||
return [];
|
||||
let a = Math.PI * 2 / splitCount;
|
||||
let params = [];
|
||||
for (let j = 0; j < splitCount; j++) {
|
||||
let param = arc.GetParamAtAngle(a * j);
|
||||
if (arc.ParamOnCurve(param))
|
||||
params.push(param);
|
||||
}
|
||||
arraySortByNumber(params);
|
||||
if (params.length === 0)
|
||||
return [];
|
||||
return params.filter(p => p > 1e-5 && p < 9.99999);
|
||||
}
|
||||
|
||||
let tempArc;
|
||||
class Shape2 extends Shape$1 {
|
||||
getPoints(divisions = 12, optimizeArc = true) {
|
||||
let points = [], last;
|
||||
for (let i = 0, curves = this.curves; i < curves.length; i++) {
|
||||
let curve = curves[i];
|
||||
let resolution = divisions;
|
||||
//@ts-ignore
|
||||
if (curve && curve.isEllipseCurve) {
|
||||
if (optimizeArc) {
|
||||
if (!tempArc)
|
||||
tempArc = new Arc;
|
||||
else
|
||||
tempArc.ClearDraw();
|
||||
tempArc.IsClockWise = curve.aClockwise;
|
||||
tempArc.StartAngle = curve.aStartAngle;
|
||||
tempArc.EndAngle = curve.aEndAngle;
|
||||
tempArc.Radius = Math.abs(curve.xRadius);
|
||||
//根据圆的半径来确定绘制个数(与SplitCurveParams一致)
|
||||
let splitCount = tempArc.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount * 0.5) * 2, Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
resolution = Math.max(1, Math.ceil(Math.abs((tempArc.AllAngle * 0.5) / Math.PI) * splitCount * 0.5)) * 2;
|
||||
}
|
||||
else
|
||||
resolution = divisions * 2;
|
||||
}
|
||||
else {
|
||||
//@ts-ignore
|
||||
resolution = (curve && (curve.isLineCurve || curve.isLineCurve3)) ? 1
|
||||
//@ts-ignore
|
||||
: (curve && curve.isSplineCurve) ? divisions * curve.points.length
|
||||
: divisions;
|
||||
}
|
||||
let pts = curve.getPoints(resolution);
|
||||
for (let j = 0; j < pts.length; j++) {
|
||||
let point = pts[j];
|
||||
if (last && equalv2(last, point, 1e-4))
|
||||
continue; // ensures no consecutive points are duplicates
|
||||
points.push(point);
|
||||
last = point;
|
||||
if (j === pts.length - 1)
|
||||
point["_mask_"] = true;
|
||||
}
|
||||
}
|
||||
if (this.autoClose
|
||||
&& points.length > 1
|
||||
&& !points[points.length - 1].equals(points[0])) {
|
||||
points.push(points[0]);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
absellipse(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation) {
|
||||
let curve = new EllipseCurve(aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation);
|
||||
/*
|
||||
if (this.curves.length > 0)
|
||||
{
|
||||
// if a previous curve is present, attempt to join
|
||||
let firstPoint = curve.getPoint(0);
|
||||
if (!equalv2(firstPoint, this.currentPoint))
|
||||
{
|
||||
this.lineTo(firstPoint.x, firstPoint.y);
|
||||
}
|
||||
}
|
||||
*/
|
||||
this.curves.push(curve);
|
||||
let lastPoint = curve.getPoint(1);
|
||||
this.currentPoint.copy(lastPoint);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
//解析二维圆弧
|
||||
class Arc2d {
|
||||
constructor(p1, p2, bul) {
|
||||
p1 = p1.clone();
|
||||
p2 = p2.clone();
|
||||
//a (* 2 (atan b))
|
||||
let a = Math.atan(bul) * 2;
|
||||
//r (/ (distance p1 p2) 2 (sin a))
|
||||
let r = p1.distanceTo(p2) / 2 / Math.sin(a);
|
||||
//c (polar p1 (+ (- (/ pi 2) a) (angle p1 p2)) r)
|
||||
let c = polar(p1.clone(), Math.PI / 2 - a + angle(p2.clone().sub(p1)), r);
|
||||
this._Radius = Math.abs(r);
|
||||
this._StartAn = angle(p1.sub(c));
|
||||
this._EndAn = angle(p2.sub(c));
|
||||
this._Center = c;
|
||||
}
|
||||
}
|
||||
//创建轮廓 通过点表和凸度
|
||||
function CreatePolylinePath(pts, buls) {
|
||||
let shape = new Shape2();
|
||||
if (pts.length === 0)
|
||||
return shape;
|
||||
let firstPt = pts[0];
|
||||
shape.moveTo(firstPt.x, firstPt.y);
|
||||
for (let i = 0; i < pts.length - 1; i++) {
|
||||
let prePt = pts[i];
|
||||
let nextPt = pts[i + 1];
|
||||
if (equaln$1(buls[i], 0, 1e-8) || equalv2(prePt, nextPt, 1e-2)) {
|
||||
shape.lineTo(nextPt.x, nextPt.y);
|
||||
}
|
||||
else {
|
||||
//参考
|
||||
//http://www.dorodnic.com/blog/tag/three-js/ 绘制一个齿轮
|
||||
//https://www.kirupa.com/html5/drawing_circles_canvas.htm //html5
|
||||
let arc2 = new Arc2d(prePt, nextPt, buls[i]);
|
||||
let cen = arc2._Center;
|
||||
shape.absarc(cen.x, cen.y, arc2._Radius, arc2._StartAn, arc2._EndAn, buls[i] < 0);
|
||||
}
|
||||
}
|
||||
return shape;
|
||||
}
|
||||
|
||||
function SplineConver2Polyline(spl, tolerance = 0.1) {
|
||||
let cu = spl.Shape;
|
||||
let cacheParam = new Map();
|
||||
@@ -11870,6 +11968,12 @@ var EWineRackType;
|
||||
EWineRackType[EWineRackType["Oblique"] = 0] = "Oblique";
|
||||
EWineRackType[EWineRackType["Upright"] = 1] = "Upright";
|
||||
})(EWineRackType || (EWineRackType = {}));
|
||||
/**酒格样式 */
|
||||
var EWineRackStyle;
|
||||
(function (EWineRackStyle) {
|
||||
EWineRackStyle[EWineRackStyle["WholeLattice"] = 0] = "WholeLattice";
|
||||
EWineRackStyle[EWineRackStyle["Semilattice"] = 1] = "Semilattice";
|
||||
})(EWineRackStyle || (EWineRackStyle = {}));
|
||||
var EWRackArrayType;
|
||||
(function (EWRackArrayType) {
|
||||
EWRackArrayType[EWRackArrayType["ByWidth"] = 0] = "ByWidth";
|
||||
@@ -11959,8 +12063,9 @@ const DefaultBehindBoardConfig = {
|
||||
};
|
||||
Object.freeze(DefaultBehindBoardConfig);
|
||||
const DefaultWineRackConfig = {
|
||||
version: 3,
|
||||
version: 4,
|
||||
type: EWineRackType.Oblique,
|
||||
wineRackStyle: EWineRackStyle.WholeLattice,
|
||||
arrayType: EWRackArrayType.ByWidth,
|
||||
fullType: EFullType.ByWidth,
|
||||
isFull: false,
|
||||
@@ -12683,6 +12788,39 @@ const DefaultR2b2Option = {
|
||||
vertialShrink: 0,
|
||||
};
|
||||
Object.freeze(DefaultR2b2Option);
|
||||
({
|
||||
version: 3,
|
||||
isAll: true,
|
||||
isHide: true,
|
||||
isDelete: false,
|
||||
behind: false,
|
||||
layer: false,
|
||||
vertial: false,
|
||||
footer: false,
|
||||
tbBoard: false,
|
||||
specialShape: false,
|
||||
hole: false,
|
||||
door: false,
|
||||
drawer: false,
|
||||
closingStrip: false,
|
||||
winerack: false,
|
||||
wood: false,
|
||||
nails: false,
|
||||
topline: false,
|
||||
handle: false,
|
||||
hinge: false,
|
||||
hwComposity: false,
|
||||
lattice: false,
|
||||
dim: false,
|
||||
curve: false,
|
||||
line: false,
|
||||
polyline: false,
|
||||
circle: false,
|
||||
arc: false,
|
||||
custom: false,
|
||||
customBoardName: "",
|
||||
matchType: ECompareType.Equal
|
||||
});
|
||||
const DefaultCommonPanelOption = {
|
||||
orderType: EOrderType.ByUpdate,
|
||||
};
|
||||
@@ -12732,6 +12870,13 @@ const DefaultDimStyleOption = {
|
||||
dimADEC: 2,
|
||||
};
|
||||
Object.freeze(DefaultDimStyleOption);
|
||||
const DefaultChangeColorByBoardMaterialOption = {
|
||||
accordThickness: false,
|
||||
accordMaterialColor: true,
|
||||
accordMaterial: true,
|
||||
accordMaterialName: true
|
||||
};
|
||||
Object.freeze(DefaultChangeColorByBoardMaterialOption);
|
||||
|
||||
function equaln(v1, v2, fuzz = 1e-5) {
|
||||
return Math.abs(v1 - v2) <= fuzz;
|
||||
@@ -13661,6 +13806,7 @@ let HardwareTopline = class HardwareTopline extends SweepSolid {
|
||||
set ContourRotation(ro) {
|
||||
if (ro === this._contourRotation)
|
||||
return;
|
||||
this.WriteAllObjectRecord();
|
||||
let diffRo = ro - this._contourRotation;
|
||||
this._contourRotation = ro;
|
||||
let mat = new Matrix4().makeRotationZ(diffRo);
|
||||
@@ -13792,10 +13938,11 @@ class LookOverBoardInfosTool {
|
||||
for (let b of brsProps) {
|
||||
let dlist = b.DrillList;
|
||||
if (equaln$1(b.ContourCurve.Area, 0)) {
|
||||
Toaster({
|
||||
message: `${b.BoardProcessOption.roomName} ${b.BoardProcessOption.cabinetName} ${b.Name}轮廓有有问题,请检查`,
|
||||
timeout: 3000,
|
||||
ToasterShowEntityMsg({
|
||||
msg: `${b.BoardProcessOption.roomName} ${b.BoardProcessOption.cabinetName} ${b.Name}轮廓有有问题,请检查`,
|
||||
timeout: 5000,
|
||||
intent: Intent.DANGER,
|
||||
ent: b
|
||||
});
|
||||
continue;
|
||||
}
|
||||
@@ -14334,98 +14481,6 @@ function getBevelVec(inPt, inPrev, inNext, ignoreSpike = true) {
|
||||
return new Vector2$1(v_trans_x / shrink_by, v_trans_y / shrink_by);
|
||||
}
|
||||
|
||||
const ARC_SplitLength = 4; //圆的分段长度
|
||||
const Arc_MinSplitCount = 12; //圆的最小分段个数
|
||||
const ARC_MaxSplitCount = 360; //圆的最大分段个数
|
||||
/**
|
||||
*
|
||||
* @param cu
|
||||
*/
|
||||
function SplitCurveParams(cu) {
|
||||
let xparams = [];
|
||||
if (cu instanceof Circle) {
|
||||
let splitCount = cu.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
for (let i = 0; i < splitCount; i++)
|
||||
xparams.push(i / splitCount);
|
||||
}
|
||||
else
|
||||
//分段1
|
||||
for (let i = 0; i < cu.EndParam; i++) {
|
||||
xparams.push(i);
|
||||
if (!equaln$1(cu.GetBulgeAt(i), 0, BUL_IS_LINE_FUZZ)) // is arc
|
||||
{
|
||||
let arc = cu.GetCurveAtIndex(i);
|
||||
let splitCount = arc.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
if (splitCount === 0)
|
||||
continue;
|
||||
let a = Math.PI * 2 / splitCount;
|
||||
let params = [];
|
||||
for (let j = 0; j < splitCount; j++) {
|
||||
let param = arc.GetParamAtAngle(a * j);
|
||||
if (arc.ParamOnCurve(param))
|
||||
params.push(param);
|
||||
}
|
||||
arraySortByNumber(params);
|
||||
if (params.length === 0)
|
||||
continue;
|
||||
for (let p of params) {
|
||||
if (p > 1e-5 && p < 0.99999)
|
||||
xparams.push(p + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
xparams.push(cu.EndParam);
|
||||
return xparams;
|
||||
}
|
||||
function SplitCurvePoints(cu) {
|
||||
let pts = [];
|
||||
if (cu instanceof Circle) {
|
||||
let splitCount = cu.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
for (let i = 0; i < splitCount; i++)
|
||||
pts.push(cu.GetPointAtParam(i / splitCount));
|
||||
}
|
||||
else
|
||||
//分段1
|
||||
for (let i = 0; i < cu.EndParam; i++) {
|
||||
pts.push(AsVector3(cu.GetPoint2dAt(i)).applyMatrix4(cu.OCSNoClone));
|
||||
if (!equaln$1(cu.GetBulgeAt(i), 0, BUL_IS_LINE_FUZZ)) // is arc
|
||||
{
|
||||
let arc = cu.GetCurveAtIndex(i);
|
||||
let splitCount = arc.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
if (splitCount === 0)
|
||||
continue;
|
||||
let divParam = 1 / splitCount;
|
||||
for (let j = 1; j < splitCount - 1; j++) {
|
||||
let p = arc.GetPointAtParam(divParam * j);
|
||||
pts.push(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
pts.push(cu.EndPoint);
|
||||
return pts;
|
||||
}
|
||||
function SplitArcParams(arc) {
|
||||
let splitCount = arc.Radius / ARC_SplitLength;
|
||||
splitCount = clamp(Math.floor(splitCount), Arc_MinSplitCount, ARC_MaxSplitCount);
|
||||
if (splitCount === 0)
|
||||
return [];
|
||||
let a = Math.PI * 2 / splitCount;
|
||||
let params = [];
|
||||
for (let j = 0; j < splitCount; j++) {
|
||||
let param = arc.GetParamAtAngle(a * j);
|
||||
if (arc.ParamOnCurve(param))
|
||||
params.push(param);
|
||||
}
|
||||
arraySortByNumber(params);
|
||||
if (params.length === 0)
|
||||
return [];
|
||||
return params.filter(p => p > 1e-5 && p < 9.99999);
|
||||
}
|
||||
|
||||
var DepthType;
|
||||
(function (DepthType) {
|
||||
DepthType[DepthType["Front"] = 1] = "Front";
|
||||
@@ -18811,14 +18866,12 @@ function GetModelingFromCustomDrill(br) {
|
||||
continue;
|
||||
//在板件的世界,0.01的误差应该不能被看出来,所以我们允许0.01的容差(这样应该是没问题的)
|
||||
//也避免了一些二维转三维出现的缝隙排钻不能被拆解的问题
|
||||
if (max.z >= br.Thickness - 1e-2) //较大的容差(0.01)
|
||||
{
|
||||
if (max.z >= br.Thickness - CanDrawHoleFuzz) {
|
||||
dir = FaceDirection.Front;
|
||||
shape.Position = shape.Position.setZ(min.z);
|
||||
thickness = br.Thickness - min.z;
|
||||
}
|
||||
else if (min.z < 1e-2) //较大的容差
|
||||
{
|
||||
else if (min.z < CanDrawHoleFuzz) {
|
||||
dir = FaceDirection.Back;
|
||||
thickness = max.z;
|
||||
}
|
||||
@@ -19859,7 +19912,10 @@ function GetBoardHighSeal(br, sealcus) {
|
||||
{ size: parseFloat(br.BoardProcessOption.sealedLeft) },
|
||||
];
|
||||
}
|
||||
let highSeals = br.BoardProcessOption.highSealed.filter(d => d.size !== null && d.size !== undefined);
|
||||
let highSeals = [];
|
||||
for (let d of br.BoardProcessOption.highSealed)
|
||||
if (d.size != null)
|
||||
highSeals.push({ ...d });
|
||||
//若未设置高级封边,把上下左右封边存入高级封边
|
||||
if (sealcus.length !== highSeals.length || !br.IsSpecialShape) {
|
||||
let sealDown = parseFloat(br.BoardProcessOption[EBoardKeyList.DownSealed]);
|
||||
@@ -21393,7 +21449,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
|
||||
UpdateDrawObject(renderType, obj) {
|
||||
let o = super.UpdateDrawObject(renderType, obj);
|
||||
if (renderType === RenderType.Edge) {
|
||||
obj.add(new Mesh(this.MeshGeometry, ColorMaterial.GrayTransparentMeshMaterial));
|
||||
obj.add(new LineSegments(this.EdgeGeometry, ColorMaterial.GetLineMaterial(8)));
|
||||
this.CheckSealing(obj);
|
||||
}
|
||||
else if (renderType === RenderType.PlaceFace) {
|
||||
@@ -27764,9 +27820,16 @@ let HistoricManage = HistoricManage_1 = class HistoricManage extends CADObject {
|
||||
this.doing = false; //正在执行工作 例如: 文件读取中 撤销中 重做中
|
||||
this.Enable = true;
|
||||
}
|
||||
Clear() {
|
||||
this.historyRecord.length = 0;
|
||||
this.curIndex = -1;
|
||||
/**
|
||||
* 清理历史记录
|
||||
* @param [remCount=0] 剩余的记录记录个数
|
||||
*/
|
||||
Clear(remCount = 0) {
|
||||
let delCount = (this.curIndex + 1) - remCount;
|
||||
if (delCount <= 0)
|
||||
return;
|
||||
this.historyRecord.splice(0, delCount);
|
||||
this.curIndex -= delCount;
|
||||
}
|
||||
//对象从文件中读取数据,初始化自身
|
||||
ReadFile(file) {
|
||||
@@ -29538,8 +29601,7 @@ class ISpaceParse {
|
||||
this.SpaceOCSInv = new Matrix4().getInverse(this.SpaceOCS);
|
||||
this.GeneralBoardMap();
|
||||
}
|
||||
async Parse() {
|
||||
}
|
||||
async Parse() { }
|
||||
get Size() {
|
||||
if (this.SpaceBox)
|
||||
return this.SpaceBox.getSize(new Vector3());
|
||||
@@ -32517,15 +32579,16 @@ class DrawObliqueWineRackTool extends DrawWineRackTool {
|
||||
let lWRData = [];
|
||||
let rWRData = [];
|
||||
let res;
|
||||
let wineRackStyle = config.wineRackStyle;
|
||||
switch (config.arrayType) {
|
||||
case EWRackArrayType.ByWidth:
|
||||
res = this.CalcWineRackDataByWidth(lWRData, rWRData);
|
||||
res = this.CalcWineRackDataByWidth(lWRData, rWRData, wineRackStyle);
|
||||
break;
|
||||
case EWRackArrayType.ByCount:
|
||||
res = this.CalcWineRackDataByCount(lWRData, rWRData);
|
||||
res = this.CalcWineRackDataByCount(lWRData, rWRData, wineRackStyle);
|
||||
break;
|
||||
case EWRackArrayType.Fixed:
|
||||
res = this.CalcWineRackDataByFixed(lWRData, rWRData);
|
||||
res = this.CalcWineRackDataByFixed(lWRData, rWRData, wineRackStyle);
|
||||
}
|
||||
let pls = [];
|
||||
for (let data of lWRData) {
|
||||
@@ -32574,7 +32637,7 @@ class DrawObliqueWineRackTool extends DrawWineRackTool {
|
||||
return false;
|
||||
}
|
||||
/**按格子宽获取酒格数据 */
|
||||
CalcWineRackDataByWidth(lWRDataList, rWRDataList) {
|
||||
CalcWineRackDataByWidth(lWRDataList, rWRDataList, wineRackStyle) {
|
||||
let size = this.space.Size;
|
||||
let Config = this.Config;
|
||||
let widthCount = 0, heightCount = 0, gripWidth = 0;
|
||||
@@ -32606,12 +32669,12 @@ class DrawObliqueWineRackTool extends DrawWineRackTool {
|
||||
width = widthCount * gripWidth + 2 * Config.boardThick * SIN45;
|
||||
height = size.z;
|
||||
}
|
||||
this.GetWineRackData(width, height, gripWidth, Config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList);
|
||||
this.GetWineRackData({ width, height, gripWidth, brThick: Config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList }, wineRackStyle);
|
||||
return {
|
||||
width: width, height: height
|
||||
};
|
||||
}
|
||||
CalcWineRackDataByCount(lWRDataList, rWRDataList) {
|
||||
CalcWineRackDataByCount(lWRDataList, rWRDataList, wineRackStyle) {
|
||||
const config = this.Config;
|
||||
const size = this.space.Size;
|
||||
let widthCount = Math.floor(config.widthCount * 2);
|
||||
@@ -32637,19 +32700,19 @@ class DrawObliqueWineRackTool extends DrawWineRackTool {
|
||||
width = widthCount * gripWidth + 2 * config.boardThick * SIN45;
|
||||
height = size.z;
|
||||
}
|
||||
this.GetWineRackData(width, height, gripWidth, config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList);
|
||||
this.GetWineRackData({ width, height, gripWidth, brThick: config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList }, wineRackStyle);
|
||||
return {
|
||||
width: width, height: height
|
||||
};
|
||||
}
|
||||
CalcWineRackDataByFixed(lWRDataList, rWRDataList) {
|
||||
CalcWineRackDataByFixed(lWRDataList, rWRDataList, wineRackStyle) {
|
||||
const config = this.Config;
|
||||
let widthCount = Math.floor(config.widthCount * 2);
|
||||
let heightCount = Math.floor(config.heightCount * 2);
|
||||
let gripWidth = config.gripWidth * SIN45;
|
||||
let width = widthCount * gripWidth + 2 * config.boardThick * SIN45;
|
||||
let height = heightCount * gripWidth + 2 * config.boardThick * SIN45;
|
||||
this.GetWineRackData(width, height, gripWidth, config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList);
|
||||
this.GetWineRackData({ width, height, gripWidth, brThick: config.boardThick, widthCount, heightCount, lWRDataList, rWRDataList }, wineRackStyle);
|
||||
return {
|
||||
width: width, height: height
|
||||
};
|
||||
@@ -32705,8 +32768,147 @@ class DrawObliqueWineRackTool extends DrawWineRackTool {
|
||||
pl.CloseMark = true;
|
||||
return pl;
|
||||
}
|
||||
//获取酒格数据
|
||||
GetWineRackData(width, height, gripWidth, brThick, widthCount, heightCount, lWRDataList, rWRDataList) {
|
||||
GetWineRackData(option, wineRackStyle) {
|
||||
switch (wineRackStyle) {
|
||||
case EWineRackStyle.Semilattice:
|
||||
this.GetWineRackDataPreferentialSemilattice(option);
|
||||
break;
|
||||
case EWineRackStyle.WholeLattice:
|
||||
this.GetWineRackDataPreferentialWholeLattice(option);
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取酒格数据半格优先
|
||||
* @param {{width: number 总宽
|
||||
* height: number 总高
|
||||
* gripWidth: number 半格宽
|
||||
* brThick: number 板厚
|
||||
* widthCount: number 半格宽数量
|
||||
* heightCount: number 半格高数量
|
||||
* lWRDataList: IWineRackData[], 往左倒
|
||||
* rWRDataList: IWineRackData[], 往右倒
|
||||
* }} option
|
||||
* @memberof DrawObliqueWineRackTool
|
||||
*/
|
||||
GetWineRackDataPreferentialSemilattice(option) {
|
||||
const { width, height, gripWidth, brThick, widthCount, heightCount, lWRDataList, rWRDataList } = option;
|
||||
/** 板厚对角的一半 */
|
||||
const brThickDiagonal = brThick * SIN45;
|
||||
for (let i = 0, Lenght = Math.floor((widthCount + 1) / 2); i < Lenght; i++) {
|
||||
let p1 = brThickDiagonal + gripWidth * i * 2;
|
||||
let data = {
|
||||
basePt: new Vector3(p1, 0, 0),
|
||||
brLength: 0
|
||||
};
|
||||
if (width - p1 >= height - brThickDiagonal) {
|
||||
data.brLength = (height - brThickDiagonal) / SIN45;
|
||||
}
|
||||
else {
|
||||
data.brLength = (width - p1) / SIN45;
|
||||
}
|
||||
rWRDataList.push(data);
|
||||
}
|
||||
for (let i = 0, Lenght = Math.floor((heightCount - 1) / 2); i < Lenght; i++) {
|
||||
let p1 = (i + 1) * gripWidth * 2;
|
||||
let data = {
|
||||
basePt: new Vector3(brThickDiagonal, p1, 0),
|
||||
brLength: 0
|
||||
};
|
||||
if (height - p1 > width - brThickDiagonal) {
|
||||
data.brLength = (width - brThickDiagonal) / SIN45;
|
||||
}
|
||||
else {
|
||||
data.brLength = (height - p1 - brThickDiagonal) / SIN45;
|
||||
}
|
||||
rWRDataList.push(data);
|
||||
}
|
||||
for (let i = 0, flag = true, Lenght = Math.floor((widthCount - 1) / 2); i < Lenght; i++) {
|
||||
let p1 = brThickDiagonal + gripWidth * (i + 1) * 2;
|
||||
let data = {
|
||||
basePt: new Vector3(p1, brThickDiagonal * 2, 0),
|
||||
brLength: 0
|
||||
};
|
||||
if (p1 >= height - brThickDiagonal) {
|
||||
if (flag && heightCount % 2 === 0)
|
||||
data.brLength = (height - brThickDiagonal * 2) / SIN45;
|
||||
else
|
||||
data.brLength = (height - brThickDiagonal * 3) / SIN45;
|
||||
flag = false;
|
||||
}
|
||||
else {
|
||||
data.brLength = (p1 - brThickDiagonal * 2) / SIN45;
|
||||
}
|
||||
lWRDataList.push(data);
|
||||
}
|
||||
if (widthCount % 2 === 0) {
|
||||
for (let i = 0, flag = true, Lenght = Math.ceil(heightCount / 2); i < Lenght; i++) {
|
||||
let p1 = height - gripWidth * 2 * (i - 1) - gripWidth * (heightCount % 2 === 0 ? 2 : 1);
|
||||
let data = {
|
||||
basePt: new Vector3(width - brThickDiagonal, p1, 0),
|
||||
brLength: 0
|
||||
};
|
||||
if (i === 0) {
|
||||
data.basePt = new Vector3(width, brThickDiagonal, 0);
|
||||
if (height === width) {
|
||||
data.brLength = (width - brThickDiagonal) / SIN45;
|
||||
flag = false;
|
||||
}
|
||||
else {
|
||||
data.brLength = (Math.min(width, height) - brThickDiagonal * 2) / SIN45;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (height - p1 + brThickDiagonal * 2 >= width) {
|
||||
if (flag)
|
||||
data.brLength = (width - brThickDiagonal * 2) / SIN45;
|
||||
else
|
||||
data.brLength = (width - brThickDiagonal * 3) / SIN45;
|
||||
flag = false;
|
||||
}
|
||||
else {
|
||||
data.brLength = (height - p1 - brThickDiagonal) / SIN45;
|
||||
}
|
||||
}
|
||||
lWRDataList.push(data);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (let i = 0, flag = true, Lenght = Math.floor(heightCount / 2); i < Lenght; i++) {
|
||||
let p1 = height - gripWidth * 2 * i - gripWidth * (heightCount % 2 === 0 ? 1 : 2);
|
||||
let data = {
|
||||
basePt: new Vector3(width - brThickDiagonal, p1, 0),
|
||||
brLength: 0
|
||||
};
|
||||
if (height - p1 + brThickDiagonal * 2 >= width) {
|
||||
if (flag)
|
||||
data.brLength = (width - brThickDiagonal * 2) / SIN45;
|
||||
else
|
||||
data.brLength = (width - brThickDiagonal * 3) / SIN45;
|
||||
flag = false;
|
||||
}
|
||||
else {
|
||||
data.brLength = (height - p1 - brThickDiagonal) / SIN45;
|
||||
}
|
||||
lWRDataList.push(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取酒格数据整格优先
|
||||
* @param {{width: number 总宽
|
||||
* height: number 总高
|
||||
* gripWidth: number 半格宽
|
||||
* brThick: number 板厚
|
||||
* widthCount: number 半格宽数量
|
||||
* heightCount: number 半格高数量
|
||||
* lWRDataList: IWineRackData[], //往左倒
|
||||
* rWRDataList: IWineRackData[], //往右倒
|
||||
* }} option
|
||||
* @memberof DrawObliqueWineRackTool
|
||||
*/
|
||||
GetWineRackDataPreferentialWholeLattice(option) {
|
||||
const { width, height, gripWidth, brThick, widthCount, heightCount, lWRDataList, rWRDataList } = option;
|
||||
let data;
|
||||
for (let i = 0; i < Math.floor(widthCount / 2); i++) {
|
||||
let p1 = gripWidth + brThick * SIN45 + gripWidth * i * 2;
|
||||
@@ -33307,10 +33509,12 @@ let TemplateWineRackRecord = class TemplateWineRackRecord extends TemplateRecord
|
||||
this.option.brThick2 = file.Read();
|
||||
if (ver > 1)
|
||||
this.option.followNarrow = file.Read();
|
||||
if (ver > 2)
|
||||
this.option.wineRackStyle = file.Read();
|
||||
}
|
||||
//对象将自身数据写入到文件.
|
||||
WriteFile(file) {
|
||||
file.Write(2);
|
||||
file.Write(3);
|
||||
super.WriteFile(file);
|
||||
file.Write(this.option.type);
|
||||
file.Write(this.option.arrayType);
|
||||
@@ -33339,6 +33543,7 @@ let TemplateWineRackRecord = class TemplateWineRackRecord extends TemplateRecord
|
||||
file.Write(this.option.isDrawVer);
|
||||
file.Write(this.option.brThick2);
|
||||
file.Write(this.option.followNarrow);
|
||||
file.Write(this.option.wineRackStyle);
|
||||
}
|
||||
};
|
||||
TemplateWineRackRecord = __decorate([
|
||||
|
Reference in New Issue
Block a user