@maqiuyao/dxf-viewer 0.2.29 → 0.2.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dxf-viewer.cjs +47 -47
- package/dist/dxf-viewer.js +2484 -2113
- package/dist/src/dxfViewer/core/dxf/DxfLoader.d.ts +7 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/acadproxy.d.ts +67 -0
- package/dist/src/dxfViewer/core/dxf-parser/entities/geomtry.d.ts +1 -1
- package/package.json +2 -2
|
@@ -492,6 +492,13 @@ export declare class DxfLoader extends THREE.Loader {
|
|
|
492
492
|
private getTextMesh;
|
|
493
493
|
private createTextMeshByText;
|
|
494
494
|
private transformTextMesh;
|
|
495
|
+
/**
|
|
496
|
+
* %%U 下划线支持:parseDxfTextContent 已把文本切成 {text, u?} 分段,
|
|
497
|
+
* 此处按下划线分段在文字 mesh 局部空间补细矩形(与文字同材质引用,
|
|
498
|
+
* 继承整体平移/旋转/合并路径)。字符宽度按「总宽 / 总字符数」均分近似,
|
|
499
|
+
* 空格按占位计——对里程标记等 ASCII 文本误差可忽略。
|
|
500
|
+
*/
|
|
501
|
+
private addTextUnderscores;
|
|
495
502
|
private loadText;
|
|
496
503
|
private loadAttDef;
|
|
497
504
|
private loadAttrib;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { DxfBaseReader, IGroup } from '../DxfBaseReader';
|
|
2
|
+
import { default as IGeometry, EntityName, IEntity, IPoint } from './geomtry';
|
|
3
|
+
/**
|
|
4
|
+
* ACAD_PROXY_ENTITY 内嵌代理图形(AcGiWorldDraw 命令流)最小解码器。
|
|
5
|
+
*
|
|
6
|
+
* 二进制格式来自 Autodesk 官方博客
|
|
7
|
+
* "Proxy graphic in DXF binary chunk interpretation"(blog.autodesk.io, 2013):
|
|
8
|
+
* {Header}: {int32 graphicsLen} {int32 commandCount}
|
|
9
|
+
* {Command}: {int32 packetLen} {int32 opcode} {args...} // packetLen 含自身 8 字节
|
|
10
|
+
* graphicsLen 自 blob 起始计(含头 8 字节);其后剩余字节为原应用对象的 DWG 序列化
|
|
11
|
+
* 数据(DXF 组码 160/161 尺寸所指),与本解码器无关。
|
|
12
|
+
* 所有多字节量小端;AcGePoint3d/AcGeVector3d = 3×double(24B);无对齐要求。
|
|
13
|
+
*
|
|
14
|
+
* 最小版消费绘图基元(多段线/圆/弧/位压缩 LWPOLYLINE/壳面)与颜色命令,
|
|
15
|
+
* 其余命令按 packetLen 跳过:文本类(10/11/36/38)暂不展开;文字轮廓通常已由
|
|
16
|
+
* 字体描边多段线(op 6/7)承载,仍可显示。
|
|
17
|
+
*
|
|
18
|
+
* op33(位压缩 LWPOLYLINE,ODA 位流格式)与 op9(Shell)的布局参照
|
|
19
|
+
* LibreCAD/libdxfrw proxygraphicdecoder.cpp / dwgbuffer.cpp 逆向定案:
|
|
20
|
+
* op33 payload = {int32 num_data_bytes}{位流...};位流 MSB-first 逐位、
|
|
21
|
+
* 多字节原始值小端;BS/BL/BD 为 2 位码压缩,DD 为「相对默认值」压缩
|
|
22
|
+
* (00=同默认 / 01=替换低 4 字节 / 10=替换中间 4 字节 / 11=完整 64 位)。
|
|
23
|
+
*/
|
|
24
|
+
/** 代理图形解出的绘图基元 */
|
|
25
|
+
export type ProxyPrim = {
|
|
26
|
+
kind: 'polyline';
|
|
27
|
+
points: IPoint[];
|
|
28
|
+
closed: boolean;
|
|
29
|
+
colorIndex: number;
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'circle';
|
|
32
|
+
center: IPoint;
|
|
33
|
+
radius: number;
|
|
34
|
+
colorIndex: number;
|
|
35
|
+
} | {
|
|
36
|
+
kind: 'arc';
|
|
37
|
+
center: IPoint;
|
|
38
|
+
radius: number;
|
|
39
|
+
startAngle: number;
|
|
40
|
+
endAngle: number;
|
|
41
|
+
colorIndex: number;
|
|
42
|
+
} | {
|
|
43
|
+
kind: 'text';
|
|
44
|
+
startPoint: IPoint;
|
|
45
|
+
height: number;
|
|
46
|
+
rotation: number;
|
|
47
|
+
xScale: number;
|
|
48
|
+
text: string;
|
|
49
|
+
mirrored: number;
|
|
50
|
+
colorIndex: number;
|
|
51
|
+
};
|
|
52
|
+
export interface ProxyDecodeResult {
|
|
53
|
+
prims: ProxyPrim[];
|
|
54
|
+
/** 命令码直方图(含已处理与跳过),用于诊断 */
|
|
55
|
+
ops: Record<number, number>;
|
|
56
|
+
}
|
|
57
|
+
export declare function decodeProxyGraphics(data: Uint8Array): ProxyDecodeResult;
|
|
58
|
+
/** 把解码基元合成为标准 DXF 实体(图层/颜色继承代理实体,句柄加后缀防重) */
|
|
59
|
+
export declare function proxyPrimsToEntities(prims: ProxyPrim[], parent: IEntity): IEntity[];
|
|
60
|
+
/**
|
|
61
|
+
* ACAD_PROXY_ENTITY 实体处理器:收集 310 图形块解码后,
|
|
62
|
+
* 以 decodedEntities 附加字段带回展开结果(由 DxfParser.parseEntities 拆入实体表)。
|
|
63
|
+
*/
|
|
64
|
+
export default class AcadProxy implements IGeometry {
|
|
65
|
+
ForEntityName: EntityName;
|
|
66
|
+
parseEntity(scanner: DxfBaseReader, curr: IGroup): IEntity;
|
|
67
|
+
}
|
|
@@ -33,7 +33,7 @@ export interface IEntity {
|
|
|
33
33
|
blockPosition?: IPoint;
|
|
34
34
|
attributesFollow?: boolean;
|
|
35
35
|
}
|
|
36
|
-
export type EntityName = "POINT" | "3DFACE" | "ARC" | "ATTDEF" | "ATTRIB" | "CIRCLE" | "DIMENSION" | "MULTILEADER" | "ELLIPSE" | "HATCH" | "IMAGE" | "INSERT" | "LEADER" | "LINE" | "LWPOLYLINE" | "MTEXT" | "OLE2FRAME" | "POLYLINE" | "REGION" | "RAY" | "SEQEND" | "SOLID" | "SPLINE" | "ACAD_TABLE" | "TEXT" | "VERTEX" | "VIEWPORT" | "XLINE";
|
|
36
|
+
export type EntityName = "POINT" | "3DFACE" | "ARC" | "ATTDEF" | "ATTRIB" | "CIRCLE" | "DIMENSION" | "MULTILEADER" | "ELLIPSE" | "HATCH" | "IMAGE" | "INSERT" | "LEADER" | "LINE" | "LWPOLYLINE" | "MTEXT" | "OLE2FRAME" | "POINT" | "POLYLINE" | "REGION" | "RAY" | "SEQEND" | "SOLID" | "SPLINE" | "ACAD_TABLE" | "ACAD_PROXY_ENTITY" | "TEXT" | "VERTEX" | "VIEWPORT" | "XLINE";
|
|
37
37
|
export default interface IGeometry {
|
|
38
38
|
ForEntityName: EntityName;
|
|
39
39
|
parseEntity(scanner: DxfBaseReader, curr: IGroup): IEntity;
|
package/package.json
CHANGED