xeokit-sdk icon indicating copy to clipboard operation
xeokit-sdk copied to clipboard

Wrong MetaObjects name after minification

Open KiraL91 opened this issue 2 years ago • 2 comments

Description Once the project is built for production, the metaObjects names are minified.

To Reproduce In a new Angular project

  1. Create Viewer and load the Duplex.ifc model
  2. Build project for production ng build
  3. In the browser the Tree Viewer shows the minified name of the different entities.

Screenshots image

Additional context

The Duplex.ifc is not modified after building the project.

The angular.json config file

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "myProjectName": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:application": {
          "strict": true
        }
      },
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.app.json",
            "assets": [
              "src/favicon.png",
              "src/assets"
            ],
            "styles": [
              "node_modules/bootstrap/dist/css/bootstrap.min.css",
              "src/styles.css"
            ],
            "scripts": [
              "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
            ]
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "5mb",
                  "maximumError": "8mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "2kb",
                  "maximumError": "4kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "browserTarget": "nameOfMyProject:build:production"
            },
            "development": {
              "browserTarget": "nameOfMyProject:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n",
          "options": {
            "browserTarget": "nameOfMyProject:build"
          }
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "codeCoverage": true,
            "main": "src/test.ts",
            "polyfills": "src/polyfills.ts",
            "tsConfig": "tsconfig.spec.json",
            "karmaConfig": "karma.conf.js",
            "assets": [
              "src/favicon.ico",
              "src/assets"
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": []
          }
        }
      }
    }
  },
  "defaultProject": "nameOfMyProject"
}

Example of MetaObject

NL {metaModel: kL, id: '1xS3BCk291UvhgP2a6eflL', originalSystemId: '1xS3BCk291UvhgP2a6eflL', name: 'oy', type: '0001', …}
children: [NL]
id: "1xS3BCk291UvhgP2a6eflL"
metaModel: kL
author: ""
createdAt: ""
creatingApplication: ""
id: "Duplex"
metaScene: Bj
metaModels:
Duplex: kL {id: 'Duplex', projectId: '100', revisionId: 'none', author: '', createdAt: '', …}
[[Prototype]]: Object
metaObjects:
0BTBFw6f90Nfh9rP1dlXr2: NL {metaModel: kL, id: '0BTBFw6f90Nfh9rP1dlXr2', originalSystemId: '0BTBFw6f90Nfh9rP1dlXr2', name: 'vF', type: 'A102', …}
0wkEuT1wr1kOyafLY4vy4m: NL {metaModel: kL, id: '0wkEuT1wr1kOyafLY4vy4m', originalSystemId: '0wkEuT1wr1kOyafLY4vy4m', name: 'ac', type: 'M_Tall Cabinet-Single Door(2):800 mm:157983', …}
0wkEuT1wr1kOyafLY4vy6k: NL {metaModel: kL, id: '0wkEuT1wr1kOyafLY4vy6k', originalSystemId: '0wkEuT1wr1kOyafLY4vy6k', name: 'ac', type: 'M_Tall Cabinet-Single Door(2):800 mm:158081', …}
0wkEuT1wr1kOyafLY4vy6l: NL {metaModel: kL, id: '0wkEuT1wr1kOyafLY4vy6l', originalSystemId: '0wkEuT1wr1kOyafLY4vy6l', name: 'ac', type: 'M_Tall Cabinet-Single Door(2):800 mm:158080', …}
1hOSvn6df7F8_7GcBWlRqU: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlRqU', originalSystemId: '1hOSvn6df7F8_7GcBWlRqU', name: 'fF', type: 'Sol:Residential - Wood Joist with Subflooring:144800', …}
1hOSvn6df7F8_7GcBWlRrM: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlRrM', originalSystemId: '1hOSvn6df7F8_7GcBWlRrM', name: 'fF', type: 'Sol:Residential - Wood Joist with Subflooring:144872', …}
1hOSvn6df7F8_7GcBWlS1M: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlS1M', originalSystemId: '1hOSvn6df7F8_7GcBWlS1M', name: 'mL', type: 'M_Casement:819mm x 759mm:149736', …}
1hOSvn6df7F8_7GcBWlS8Z: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlS8Z', originalSystemId: '1hOSvn6df7F8_7GcBWlS8Z', name: 'n2', type: 'M_Single-Flush:0762 x 2032mm:150173', …}
1hOSvn6df7F8_7GcBWlS9F: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlS9F', originalSystemId: '1hOSvn6df7F8_7GcBWlS9F', name: 'n2', type: 'M_Single-Flush:0762 x 2032mm:150257', …}
1hOSvn6df7F8_7GcBWlSDm: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlSDm', originalSystemId: '1hOSvn6df7F8_7GcBWlSDm', name: 'n2', type: 'M_Single-Flush:0864 x 2032mm:150478', …}
1hOSvn6df7F8_7GcBWlSFK: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlSFK', originalSystemId: '1hOSvn6df7F8_7GcBWlSFK', name: 'n2', type: 'M_Single-Flush:0864 x 2032mm:150378', …}
1hOSvn6df7F8_7GcBWlSXO: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlSXO', originalSystemId: '1hOSvn6df7F8_7GcBWlSXO', name: 'mL', type: 'M_Fixed:2800mm x 2410mm:147686', …}
1hOSvn6df7F8_7GcBWlS_W: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlS_W', originalSystemId: '1hOSvn6df7F8_7GcBWlS_W', name: 'mL', type: 'M_Fixed:2800mm x 2410mm:149278', …}
1hOSvn6df7F8_7GcBWlSp1: NL {metaModel: kL, id: '1hOSvn6df7F8_7GcBWlSp1', originalSystemId: '1hOSvn6df7F8_7GcBWlSp1', name: 'mL', type: 'M_Casement:819mm x 759mm:148607', …}
1kHrnJ8X9C0A30wVBdNGCJ: NL {metaModel: kL, id: '1kHrnJ8X9C0A30wVBdNGCJ', originalSystemId: '1kHrnJ8X9C0A30wVBdNGCJ', name: 'E0', type: 'Escalier:Residential - 200mm Max Riser 250mm Tread:151086:1', …}
1l0GAJtRTFv8$zmKJOH4ZZ: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4ZZ', originalSystemId: '1l0GAJtRTFv8$zmKJOH4ZZ', name: 'mL', type: 'M_Fixed:750mm x 2200mm:182101', …}
1l0GAJtRTFv8$zmKJOH4aS: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4aS', originalSystemId: '1l0GAJtRTFv8$zmKJOH4aS', name: 'mL', type: 'M_Fixed:750mm x 2200mm:181930', …}
1l0GAJtRTFv8$zmKJOH4gQ: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4gQ', originalSystemId: '1l0GAJtRTFv8$zmKJOH4gQ', name: 'mL', type: 'M_Casement:819mm x 759mm:181548', …}
1l0GAJtRTFv8$zmKJOH4hv: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4hv', originalSystemId: '1l0GAJtRTFv8$zmKJOH4hv', name: 'mL', type: 'M_Fixed:819mm x 759mm:181583', …}
1l0GAJtRTFv8$zmKJOH4kJ: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4kJ', originalSystemId: '1l0GAJtRTFv8$zmKJOH4kJ', name: 'mL', type: 'M_Fixed:819mm x 759mm:181285', …}
1l0GAJtRTFv8$zmKJOH4oq: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4oq', originalSystemId: '1l0GAJtRTFv8$zmKJOH4oq', name: 'mL', type: 'M_Casement:819mm x 759mm:180994', …}
1l0GAJtRTFv8$zmKJOH4qs: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4qs', originalSystemId: '1l0GAJtRTFv8$zmKJOH4qs', name: 'mL', type: 'M_Fixed:819mm x 759mm:180864', …}
1l0GAJtRTFv8$zmKJOH4u1: NL {metaModel: kL, id: '1l0GAJtRTFv8$zmKJOH4u1', originalSystemId: '1l0GAJtRTFv8$zmKJOH4u1', name: 'mL', type: 'M_Fixed:819mm x 759mm:180663', …}
1s1jVhK8z0pgKYcr9jt7AB: NL {metaModel: kL, id: '1s1jVhK8z0pgKYcr9jt7AB', originalSystemId: '1s1jVhK8z0pgKYcr9jt7AB', name: 'n2', type: 'M_Single-Glass 1:0813 x 2420mm:171975', …}
1s1jVhK8z0pgKYcr9jt781: NL {metaModel: kL, id: '1s1jVhK8z0pgKYcr9jt781', originalSystemId: '1s1jVhK8z0pgKYcr9jt781', name: 'n2', type: 'M_Single-Glass 1:0813 x 2420mm:171853', …}
1xS3BCk291UvhgP2a6eflK: NL {metaModel: kL, id: '1xS3BCk291UvhgP2a6eflK', originalSystemId: '1xS3BCk291UvhgP2a6eflK', name: 'm9', type: 'm9', …}
1xS3BCk291UvhgP2a6eflL: NL {metaModel: kL, id: '1xS3BCk291UvhgP2a6eflL', originalSystemId: '1xS3BCk291UvhgP2a6eflL', name: 'oy', type: '0001', …}
1xS3BCk291UvhgP2a6eflN: NL {metaModel: kL, id: '1xS3BCk291UvhgP2a6eflN', originalSystemId: '1xS3BCk291UvhgP2a6eflN', name: 'I_', type: 'Default', …}
1xS3BCk291UvhgP2dvNMKI: NL {metaModel: kL, id: '1xS3BCk291UvhgP2dvNMKI', originalSystemId: '1xS3BCk291UvhgP2dvNMKI', name: 'rO', type: 'Level 1', …}
1xS3BCk291UvhgP2dvNMQJ: NL {metaModel: kL, id: '1xS3BCk291UvhgP2dvNMQJ', originalSystemId: '1xS3BCk291UvhgP2dvNMQJ', name: 'rO', type: 'Level 2', …}
1xS3BCk291UvhgP2dvNsgp: NL {metaModel: kL, id: '1xS3BCk291UvhgP2dvNsgp', originalSystemId: '1xS3BCk291UvhgP2dvNsgp', name: 'rO', type: 'T/FDN', …}
1xS3BCk291UvhgP2dvNtSE: NL {metaModel: kL, id: '1xS3BCk291UvhgP2dvNtSE', originalSystemId: '1xS3BCk291UvhgP2dvNtSE', name: 'rO', type: 'Roof', …}
2GHk5kQe1879p_6HT5nAdl: NL {metaModel: kL, id: '2GHk5kQe1879p_6HT5nAdl', originalSystemId: '2GHk5kQe1879p_6HT5nAdl', name: 'mL', type: 'M_Fixed:2800mm x 2410mm:180318', …}
2O2Fr$t4X7Zf8NOew3FK1b: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FK1b', originalSystemId: '2O2Fr$t4X7Zf8NOew3FK1b', name: 'pL', type: 'Mur de base:Foundation - Concrete (435mm):141018', …}
2O2Fr$t4X7Zf8NOew3FK3E: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FK3E', originalSystemId: '2O2Fr$t4X7Zf8NOew3FK3E', name: 'pL', type: 'Mur de base:Foundation - Concrete (435mm):140913', …}
2O2Fr$t4X7Zf8NOew3FK04: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FK04', originalSystemId: '2O2Fr$t4X7Zf8NOew3FK04', name: 'pL', type: 'Mur de base:Foundation - Concrete (435mm):140987', …}
2O2Fr$t4X7Zf8NOew3FK4F: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FK4F', originalSystemId: '2O2Fr$t4X7Zf8NOew3FK4F', name: 'fF', type: 'Sol:127mm Slab on Grade:141232', …}
2O2Fr$t4X7Zf8NOew3FK9N: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FK9N', originalSystemId: '2O2Fr$t4X7Zf8NOew3FK9N', name: 'pL', type: 'Mur de base:Foundation - Concrete (417mm):140520', …}
2O2Fr$t4X7Zf8NOew3FK80: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FK80', originalSystemId: '2O2Fr$t4X7Zf8NOew3FK80', name: 'pL', type: 'Mur de base:Foundation - Concrete (417mm):140479', …}
2O2Fr$t4X7Zf8NOew3FKE5: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKE5', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKE5', name: 'pL', type: 'Mur de base:Foundation - Concrete (417mm):140602', …}
2O2Fr$t4X7Zf8NOew3FKEr: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKEr', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKEr', name: 'pL', type: 'Mur de base:Foundation - Concrete (417mm):140554', …}
2O2Fr$t4X7Zf8NOew3FKGS: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKGS', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKGS', name: 'pL', type: 'Mur de base:Interior - Partition (92mm Stud):139939', …}
2O2Fr$t4X7Zf8NOew3FKIu: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKIu', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKIu', name: 'pL', type: 'Mur de base:Interior - Partition (92mm Stud):139783', …}
2O2Fr$t4X7Zf8NOew3FKRH: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKRH', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKRH', name: 'pL', type: 'Mur de base:Party Wall - CMU Residential Unit Dimising Wall:139374', …}
2O2Fr$t4X7Zf8NOew3FKRi: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKRi', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKRi', name: 'pL', type: 'Mur de base:Party Wall - CMU Residential Unit Dimising Wall:139347', …}
2O2Fr$t4X7Zf8NOew3FKST: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKST', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKST', name: 'pL', type: 'Mur de base:Interior - Partition (92mm Stud):139682', …}
2O2Fr$t4X7Zf8NOew3FKau: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKau', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKau', name: 'uL', type: 'Mur de base:Party Wall - CMU Residential Unit Dimising Wall:143239', …}
2O2Fr$t4X7Zf8NOew3FKcz: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FKcz', originalSystemId: '2O2Fr$t4X7Zf8NOew3FKcz', name: 'fF', type: 'Sol:127mm Slab on Grade:143106', …}
2O2Fr$t4X7Zf8NOew3FL8v: NL {metaModel: kL, id: '2O2Fr$t4X7Zf8NOew3FL8v', originalSystemId: '2O2Fr$t4X7Zf8NOew3FL8v', ...
(...)
metaObjectsByType: {0001: {…}, Default: {…}, m9: {…}, Level 2: {…}, A203: {…}, …}
propertySets: {1BDblwKXj61ewiXWMt7dX3: Nj, 22lKVFjNv0pAfmNgLKUfZO: Nj, 1c2nlxkET2OAt8MJJMZspg: Nj, 1ESP1BScbEjPxgDktpZVV9: Nj, 13mcYkzq1039hxjYBibOXS: Nj, …}
scene: $c {scene: $c, viewer: zj, _dontClear: false, _renderer: Ys, meta: {…}, …}
viewer: zj {language: 'en', localeService: Pj, scene: $c, metaScene: Bj, id: 1, …}
_eventSubs: {}
_typeCounts: {0001: 1, Default: 1, m9: 1, Level 2: 1, A203: 1, …}
[[Prototype]]: Object
projectId: "100"
propertySets: [1BDblwKXj61ewiXWMt7dX3: Nj, 22lKVFjNv0pAfmNgLKUfZO: Nj, 1c2nlxkET2OAt8MJJMZspg: Nj, 1ESP1BScbEjPxgDktpZVV9: Nj, 13mcYkzq1039hxjYBibOXS: Nj, …]
revisionId: "none"
rootMetaObject: NL {metaModel: kL, id: '1xS3BCk291UvhgP2a6eflL', originalSystemId: '1xS3BCk291UvhgP2a6eflL', name: 'oy', type: '0001', …}
schema: ""
[[Prototype]]: Object
name: "oy"
originalSystemId: "1xS3BCk291UvhgP2a6eflL"
propertySets: []
type: "0001"
_countEntities: 224

KiraL91 avatar Apr 06 '22 08:04 KiraL91

Almost looks like the ifc is included using an import/require and thus part of the minification.

mlankamp avatar Apr 06 '22 20:04 mlankamp

Hi, The ifc is loaded with the WebIFCLoaderPlugin as suggested in the examples (so, there is no import involved):

const model = new WebIFCLoaderPlugin(viewer, {
    wasmPath: path
});
.load({
    id: filename,
    src: `${path_to_ifc}/${filename}.${format}`,
});
model.on('loaded', () => {
    ...
}

The imports that I use in the component

import { Component, AfterViewInit, ElementRef, ViewChild } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Viewer, ViewerConfiguration, WebIFCLoaderPlugin, NavCubePlugin, TreeViewPlugin, DistanceMeasurementsPlugin, MetaObject, AnnotationsPlugin, math } from '@xeokit/xeokit-sdk';
import { environment as env } from 'src/environments/environment';
import axios from 'axios';

The ifc file is just copied to the assets folder of the final bundle. I made a quick test and copied the file manually to be sure that the minification does not modify the ifc file.

KiraL91 avatar Apr 07 '22 06:04 KiraL91

Unfortunately we're limited in how much support we can provide for integrating xeokit with the various application frameworks out there (like React, Vue etc).

Instead, the best we can do is simply ensure that xeokit follows JavaScript best-practices, so that if these frameworks follow them too, there should be a way to ingrate them OK.

From the info given in this issue, if the static file is not minified by the build process, then perhaps there some sort of data service obfuscating those names, as it serves the file?

Other than that, I can't imagine how xeokit's causing those names to get garbled, since it's just loading and parsing them from input data.

I'll close foe now, unless more insights arise.

xeolabs avatar Aug 23 '22 13:08 xeolabs