更新版本
This commit is contained in:
97
api.cjs.js
97
api.cjs.js
@@ -6,6 +6,7 @@ var measurements = require('@jscad/modeling/src/measurements');
|
||||
var three = require('three');
|
||||
var Line2 = require('three/examples/jsm/lines/Line2');
|
||||
var LineGeometry = require('three/examples/jsm/lines/LineGeometry');
|
||||
var LineSegments2 = require('three/examples/jsm/lines/LineSegments2');
|
||||
var LineSegmentsGeometry = require('three/examples/jsm/lines/LineSegmentsGeometry');
|
||||
var geom3 = require('@jscad/modeling/src/geometries/geom3');
|
||||
var mat4 = require('@jscad/modeling/src/maths/mat4');
|
||||
@@ -5214,10 +5215,8 @@ exports.Curve = Curve_1 = class Curve extends exports.Entity {
|
||||
for (let p of pts)
|
||||
array.push(p.x, p.y, 0);
|
||||
let geometry = new LineGeometry.LineGeometry().setPositions(array);
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
// 引线的颜色
|
||||
if (HostApplicationServices.printIsColor)
|
||||
material.color = ColorMaterial.GetColor(this.PrintColorIndex);
|
||||
// 用 PrintColorIndex 便于 白->黑
|
||||
const material = ColorMaterial.GetPrintLineMaterial(this.PrintColorIndex);
|
||||
return new Line2.Line2(geometry, material);
|
||||
}
|
||||
let geo = new three.BufferGeometry().setFromPoints(pts);
|
||||
@@ -5402,13 +5401,9 @@ exports.Line = Line_1 = class Line extends exports.Curve {
|
||||
for (let p of pts)
|
||||
array.push(p.x, p.y, p.z);
|
||||
let geometry = new LineGeometry.LineGeometry().setPositions(array);
|
||||
// 线段的颜色
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
const printLineMatrial = ColorMaterial.PrintLineMatrial.clone();
|
||||
printLineMatrial.color = ColorMaterial.GetColor(this.PrintColorIndex);
|
||||
return new Line2.Line2(geometry, printLineMatrial);
|
||||
}
|
||||
return new Line2.Line2(geometry, ColorMaterial.PrintLineMatrial);
|
||||
// 用 PrintColorIndex 便于 白->黑
|
||||
const printLineMatrial = ColorMaterial.GetPrintLineMaterial(this.PrintColorIndex);
|
||||
return new Line2.Line2(geometry, printLineMatrial);
|
||||
}
|
||||
let geo = new three.BufferGeometry().setFromPoints(pts);
|
||||
let line = new three.Line(geo, ColorMaterial.GetLineMaterial(this.DrawColorIndex, this._Freeze, this._LineType));
|
||||
@@ -5439,10 +5434,8 @@ exports.Line = Line_1 = class Line extends exports.Curve {
|
||||
UpdateDrawObjectMaterial(type, obj, material) {
|
||||
if (type === exports.RenderType.WireframePrint) {
|
||||
let m = obj;
|
||||
const mtl = ColorMaterial.PrintLineMatrial.clone();
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
mtl.color = ColorMaterial.GetColor(this.PrintColorIndex);
|
||||
}
|
||||
// 用 PrintColorIndex 便于 白->黑
|
||||
const mtl = ColorMaterial.GetPrintLineMaterial(this.PrintColorIndex);
|
||||
m.material = mtl;
|
||||
}
|
||||
else {
|
||||
@@ -7042,14 +7035,9 @@ exports.Circle = Circle_1 = class Circle extends exports.Curve {
|
||||
if (renderType === RenderType.WireframePrint)
|
||||
{
|
||||
let geometry = new LineGeometry().setPositions(cirGeo.attributes.position.array as number[]);
|
||||
// 线段的颜色
|
||||
if (HostApplicationServices.printIsColor)
|
||||
{
|
||||
const printLineMatrial = ColorMaterial.PrintLineMatrial.clone();
|
||||
printLineMatrial.color = ColorMaterial.GetColor(this.ColorIndex);
|
||||
return new Line2(geometry, printLineMatrial);
|
||||
}
|
||||
obj.add(new Line2(geometry, ColorMaterial.PrintLineMatrial));
|
||||
// 用 PrintColorIndex 便于 白->黑
|
||||
const printLineMatrial = ColorMaterial.GetPrintLineMaterial(this.PrintColorIndex);
|
||||
obj.add(new Line2(geometry, printLineMatrial));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -9866,10 +9854,8 @@ exports.Polyline = Polyline_1 = class Polyline extends exports.Curve {
|
||||
// 多段线也支持彩印
|
||||
if (type === exports.RenderType.WireframePrint) {
|
||||
let m = obj;
|
||||
const mtl = ColorMaterial.PrintLineMatrial.clone();
|
||||
if (HostApplicationServices.printIsColor) {
|
||||
mtl.color = ColorMaterial.GetColor(this.PrintColorIndex);
|
||||
}
|
||||
// 用 PrintColorIndex 便于 白->黑
|
||||
const mtl = ColorMaterial.GetPrintLineMaterial(this.PrintColorIndex);
|
||||
m.material = mtl;
|
||||
}
|
||||
else {
|
||||
@@ -15286,6 +15272,7 @@ var ViewType;
|
||||
/** 映射: 视图->矩阵 */
|
||||
new Map([
|
||||
[ViewType.Front, new three.Matrix4().fromArray([1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1])],
|
||||
[ViewType.Back, new three.Matrix4().fromArray([-1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1])],
|
||||
[ViewType.Left, new three.Matrix4().fromArray([0, -1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, 0, 0, 0, 1])],
|
||||
[ViewType.Down, new three.Matrix4().fromArray([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])],
|
||||
[ViewType.Right, new three.Matrix4().fromArray([0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1])],
|
||||
@@ -17424,6 +17411,7 @@ const DefaultPartsAnalysisOption = {
|
||||
};
|
||||
Object.freeze(DefaultPartsAnalysisOption);
|
||||
const DefaultFastDimOption = {
|
||||
version: 1,
|
||||
filterSmallSize: false,
|
||||
filterSmallSizeValue: 0,
|
||||
filterAppointSize: false,
|
||||
@@ -17431,6 +17419,8 @@ const DefaultFastDimOption = {
|
||||
filterAppointForBoardName: false,
|
||||
filterAppointForBoardNameValues: "",
|
||||
conditionType: ForBoardNameType.Same,
|
||||
filterBoardDist: false,
|
||||
filterBoardDistValue: 100
|
||||
};
|
||||
Object.freeze(DefaultFastDimOption);
|
||||
const DefaultOneClickInspectionOption = {
|
||||
@@ -17547,6 +17537,16 @@ const DefaultExtrudePl2Board = {
|
||||
isDrawBottom: true,
|
||||
};
|
||||
Object.freeze(DefaultExtrudePl2Board);
|
||||
const DefaultExportSTEPOption = {
|
||||
version: 1,
|
||||
drillHole: true, // 排钻孔
|
||||
drilling: true, // 排钻
|
||||
topLine: true, // 顶线
|
||||
handle: true, // 拉手
|
||||
hinge: true, // 铰链
|
||||
compositeEntity: true, // 复合实体
|
||||
};
|
||||
Object.freeze(DefaultExportSTEPOption);
|
||||
|
||||
/**
|
||||
* 使用轮廓和扫描路径构建扫描几何体,实现衣柜中的顶线或者地脚线之类的实体.
|
||||
@@ -25245,6 +25245,13 @@ exports.CompositeEntity = CompositeEntity_1 = class CompositeEntity extends expo
|
||||
callback(en);
|
||||
}
|
||||
}
|
||||
ClearDraw() {
|
||||
this.Traverse(ent => {
|
||||
if (ent !== this)
|
||||
ent.ClearDraw();
|
||||
});
|
||||
return super.ClearDraw();
|
||||
}
|
||||
//实体在被内嵌时,它绘制对象的世界矩阵会被影响,所以这里我们不直接计算它的盒子,而是用绘制对象的盒子来计算包围盒,避免错误
|
||||
//例如 复合扫略实体 的ZoomObject在这个实现下是错误的(因为扫略实体也是直接取绘制对象的包围盒)
|
||||
// get BoundingBox()
|
||||
@@ -29483,6 +29490,7 @@ function Creat2DModelGeom(board, modelings, _2DPathCsgs, faceMtx) {
|
||||
knifeGeomPts = shapePts.map(p => [p.x, p.y]);
|
||||
if (sweepContour.IsClockWise)
|
||||
knifeGeomPts.reverse();
|
||||
modelKnifePtsCache.set(item.knife.id, knifeGeomPts);
|
||||
}
|
||||
//刀截面geom
|
||||
let knifeGeom = geom2__default["default"].fromPoints(knifeGeomPts);
|
||||
@@ -32291,7 +32299,7 @@ exports.Board = Board_1 = class Board extends exports.ExtrudeSolid {
|
||||
l = new three.Line(BufferGeometryUtils.CreateFromPts(PointShapeUtils.LinesOpenDirPts(this.height, this.width, openDir)), ColorMaterial.GetWallLineMtl(color));
|
||||
}
|
||||
else {
|
||||
// 虚线 todo线宽>3时,可能要对geom做二次填充
|
||||
// 虚线
|
||||
if (HostApplicationServices.openDirIsDash) {
|
||||
const geometry = new LineSegmentsGeometry.LineSegmentsGeometry();
|
||||
const nums = [];
|
||||
@@ -32299,10 +32307,11 @@ exports.Board = Board_1 = class Board extends exports.ExtrudeSolid {
|
||||
for (let p of pts)
|
||||
nums.push(p.x, p.y, p.z);
|
||||
geometry.setPositions(nums);
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
material.linewidth = lineWidth;
|
||||
// 用 PrintColorIndex 便于 白->黑
|
||||
const material = ColorMaterial.GetPrintLineMaterial(this.PrintColorIndex);
|
||||
material.linewidth = lineWidth + 1; // 加1好看点
|
||||
material.color = ColorMaterial.GetColor(color);
|
||||
l = new three.LineSegments(geometry, material);
|
||||
l = new LineSegments2.LineSegments2(geometry, material);
|
||||
}
|
||||
// 实线
|
||||
else {
|
||||
@@ -32312,7 +32321,8 @@ exports.Board = Board_1 = class Board extends exports.ExtrudeSolid {
|
||||
for (let p of pts)
|
||||
nums.push(p.x, p.y, p.z);
|
||||
geometry.setPositions(nums);
|
||||
const material = ColorMaterial.PrintLineMatrial.clone();
|
||||
// 用 PrintColorIndex 便于 白->黑
|
||||
const material = ColorMaterial.GetPrintLineMaterial(this.PrintColorIndex);
|
||||
material.linewidth = lineWidth;
|
||||
material.color = ColorMaterial.GetColor(color);
|
||||
l = new Line2.Line2(geometry, material);
|
||||
@@ -38791,8 +38801,9 @@ exports.RoomHolePolyline = class RoomHolePolyline extends exports.RoomHoleBase {
|
||||
}
|
||||
this._MeshGeometry = new three.BufferGeometry().fromGeometry(geo);
|
||||
for (const group of this._MeshGeometry.groups) {
|
||||
if (this._OverWriteMaterial.has(group.materialIndex)) {
|
||||
let mtl = (this._OverWriteMaterial.get(group.materialIndex).Object);
|
||||
let id = this._OverWriteMaterial.get(group.materialIndex);
|
||||
if (id) {
|
||||
let mtl = id.Object;
|
||||
this.GenWorldUV(this._MeshGeometry, mtl, group.start, group.count);
|
||||
}
|
||||
}
|
||||
@@ -38816,9 +38827,10 @@ exports.RoomHolePolyline = class RoomHolePolyline extends exports.RoomHoleBase {
|
||||
}
|
||||
for (const group of this.MeshGeometry.groups) {
|
||||
if (this._OverWriteMaterial.size > 0) {
|
||||
if (this._OverWriteMaterial.has(group.materialIndex)) {
|
||||
let mtl = (this._OverWriteMaterial.get(group.materialIndex).Object);
|
||||
this.GenWorldUV(this.MeshGeometry, mtl, group.start, group.count);
|
||||
let id = this._OverWriteMaterial.get(group.materialIndex);
|
||||
if (id) {
|
||||
let mtl = id.Object;
|
||||
this.GenWorldUV(this._MeshGeometry, mtl, group.start, group.count);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -42868,6 +42880,10 @@ exports.Dimension = class Dimension extends exports.Entity {
|
||||
this.WriteAllObjectRecord();
|
||||
this._CabinetName = value;
|
||||
}
|
||||
ClearDraw() {
|
||||
this._Text.ClearDraw();
|
||||
return super.ClearDraw();
|
||||
}
|
||||
ReadDimStyle(file) {
|
||||
this._DimStyleOverride.clear();
|
||||
let size = file.Read();
|
||||
@@ -51530,10 +51546,13 @@ exports.RadiusDimension = class RadiusDimension extends exports.Dimension {
|
||||
let [line, arrow, textObj] = obj.children;
|
||||
// 修改箭头类型
|
||||
{
|
||||
obj.remove(arrow, textObj);
|
||||
obj.remove(arrow);
|
||||
// textObj 可能为undefined
|
||||
textObj && obj.remove(textObj);
|
||||
const [newArrow1, newArrow2] = this.GetArrowObject(renderType);
|
||||
arrow = newArrow1;
|
||||
obj.add(arrow, textObj);
|
||||
obj.add(arrow);
|
||||
textObj && obj.add(textObj);
|
||||
}
|
||||
let arrowSize = this.GetDimStyleValue(DimStyleKeyCode.DIMASZ) ?? 10;
|
||||
if (renderType === exports.RenderType.WireframePrint) {
|
||||
|
Reference in New Issue
Block a user