Fix editor interaction, loading, and IFC cleanup (#385)
* fix: update site labels after camera swaps * fix: gate scene display until viewer is ready * fix: render scene loader on first paint * fix: keep loader during pending scene graph * feat: add wasd camera panning * feat: add x delete mode shortcut * feat: add floorplan north compass * fix: move floorplan compass to lower corner * fix: progressively rebuild heavy scene geometry * fix: simplify noisy ifc wall output
This commit is contained in:
@@ -16,6 +16,12 @@ import {
|
||||
} from '@pascal-app/core'
|
||||
import { customAlphabet } from 'nanoid'
|
||||
import * as WebIFC from 'web-ifc'
|
||||
import { type IfcConversionSimplificationOptions, simplifyConvertedSceneGraph } from './cleanup'
|
||||
|
||||
export type {
|
||||
IfcConversionSimplificationOptions,
|
||||
IfcConversionSimplificationStats,
|
||||
} from './cleanup'
|
||||
|
||||
export type PascalNode = AnyNode
|
||||
|
||||
@@ -636,6 +642,7 @@ export interface ConversionOptions {
|
||||
swapYZ?: boolean
|
||||
extrusionDepthIsHeight?: boolean
|
||||
swapProfileDimensions?: boolean
|
||||
simplify?: boolean | IfcConversionSimplificationOptions
|
||||
label?: string
|
||||
}
|
||||
|
||||
@@ -664,6 +671,12 @@ export async function convertIfcToPascal(
|
||||
extrusionDepthIsHeight: options?.extrusionDepthIsHeight ?? true,
|
||||
swapProfileDimensions: options?.swapProfileDimensions ?? false,
|
||||
}
|
||||
const simplificationOptions =
|
||||
options?.simplify === false
|
||||
? { enabled: false }
|
||||
: typeof options?.simplify === 'object'
|
||||
? options.simplify
|
||||
: undefined
|
||||
|
||||
const progress = (msg: string, pct: number) => {
|
||||
console.log(`[IFC→Pascal] ${msg} (${pct}%)`)
|
||||
@@ -2049,6 +2062,16 @@ export async function convertIfcToPascal(
|
||||
/* no type rels */
|
||||
}
|
||||
|
||||
progress('Simplifying converted scene...', 94)
|
||||
const simplificationStats = simplifyConvertedSceneGraph(nodes, simplificationOptions)
|
||||
if (
|
||||
simplificationStats.removedTinyWalls > 0 ||
|
||||
simplificationStats.removedMergedWalls > 0 ||
|
||||
simplificationStats.removedDuplicateOpenings > 0
|
||||
) {
|
||||
console.log('[IFC→Pascal] Simplification:', simplificationStats)
|
||||
}
|
||||
|
||||
ifcApi.CloseModel(modelID)
|
||||
|
||||
progress('Building scene graph...', 95)
|
||||
|
||||
Reference in New Issue
Block a user