mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-15 21:05:22 +01:00
retrieving production info from raw data coming from the engine
This commit is contained in:
parent
6a6c8d96eb
commit
beecafa9c2
2 changed files with 32 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ import {MSketchObject} from './msketchObject';
|
|||
import {EMPTY_ARRAY} from 'gems/iterables';
|
||||
import CSys from '../../math/csys';
|
||||
import {MSketchLoop} from './mloop';
|
||||
import {sketchObjects} from '../../sketcher/fetchers';
|
||||
import {ProductionInfo} from './productionInfo';
|
||||
|
||||
export class MFace extends MObject {
|
||||
|
||||
|
|
@ -138,6 +138,14 @@ export class MFace extends MObject {
|
|||
}
|
||||
return this._worldToSketchTransformation;
|
||||
}
|
||||
|
||||
get productionInfo() {
|
||||
if (this._productionInfo === undefined) {
|
||||
this._productionInfo = !this.brepFace.data.productionInfo ? null :
|
||||
ProductionInfo.fromRawData(this.brepFace.data.productionInfo);
|
||||
}
|
||||
return this._productionInfo;
|
||||
}
|
||||
}
|
||||
|
||||
export class MBrepFace extends MFace {
|
||||
|
|
|
|||
23
web/app/cad/model/productionInfo.js
Normal file
23
web/app/cad/model/productionInfo.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
export class ProductionInfo {
|
||||
|
||||
role = undefined;
|
||||
originatedFromPrimitive = undefined;
|
||||
|
||||
static fromRawData(rawProductionInfo) {
|
||||
let info = new ProductionInfo();
|
||||
|
||||
function collectProductionInfo(rawInfo) {
|
||||
Object.keys(info).forEach(attr => {
|
||||
if (info[attr] === undefined && rawInfo[attr] !== undefined) {
|
||||
info[attr] = rawInfo[attr]
|
||||
}
|
||||
});
|
||||
if (rawInfo.derived) {
|
||||
rawInfo.derived.forEach(d => collectProductionInfo(d));
|
||||
}
|
||||
}
|
||||
collectProductionInfo(rawProductionInfo);
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue