26 lines
891 B
TypeScript
26 lines
891 B
TypeScript
/**
|
|
* 2D file-format detection for the 2D+3D merge dispatch.
|
|
*
|
|
* 2D = CAD drawings (dwg/dxf) → rendered by Viewer2D via the WASM parser.
|
|
* Everything else (glb/gltf/obj/fbx/dae/ifc/ply/3ds/3dm) is 3D → ThreeDViewer.
|
|
* Kept dependency-free so both the dropzone and the controller can import it
|
|
* without pulling in either viewer.
|
|
*/
|
|
export const DWG_EXT = /\.dwg$/i;
|
|
export const DXF_EXT = /\.dxf$/i;
|
|
|
|
/** True if the name is a binary DWG (parsed by the WASM parser). */
|
|
export function isDwg(name: string): boolean {
|
|
return DWG_EXT.test(name);
|
|
}
|
|
|
|
/** True if the name is a text DXF (parsed by the dxf-parser JS lib). */
|
|
export function isDxf(name: string): boolean {
|
|
return DXF_EXT.test(name);
|
|
}
|
|
|
|
/** True if the file/URL name is a 2D CAD drawing (dwg or dxf) → Viewer2D. */
|
|
export function is2D(name: string): boolean {
|
|
return DWG_EXT.test(name) || DXF_EXT.test(name);
|
|
}
|