Files
NODEDC_TASKMANAGER/plane-src/apps/web/helpers/beam-viewer-config.ts

36 lines
1.0 KiB
TypeScript

export const DEFAULT_BEAM_VIEWER_BASE_URL = "https://bim.nodedc.tech";
const BEAM_DIRECT_MODEL_TYPE_BY_EXTENSION: Record<string, string> = {
bim: "bim",
glb: "gltf",
gltf: "gltf",
las: "las",
laz: "las",
obj: "obj",
stl: "stl",
xkt: "xkt",
};
const BEAM_CONVERTIBLE_MODEL_TYPE_BY_EXTENSION: Record<string, string> = {
iges: "iges",
igs: "iges",
step: "step",
stp: "step",
};
export const getBeamFileExtension = (name: string): string => {
const parts = name.split(".");
return parts.length > 1 ? parts[parts.length - 1].toLowerCase() : "";
};
export const getBeamModelTypeFromFileName = (name: string | undefined): string | null => {
if (!name) return null;
const extension = getBeamFileExtension(name);
return BEAM_DIRECT_MODEL_TYPE_BY_EXTENSION[extension] ?? BEAM_CONVERTIBLE_MODEL_TYPE_BY_EXTENSION[extension] ?? null;
};
export const getBeamDirectModelTypeFromFileName = (name: string | undefined): string | null => {
if (!name) return null;
return BEAM_DIRECT_MODEL_TYPE_BY_EXTENSION[getBeamFileExtension(name)] ?? null;
};