diff --git a/web/app/cad/model/mface.js b/web/app/cad/model/mface.js index 52078f84..68114237 100644 --- a/web/app/cad/model/mface.js +++ b/web/app/cad/model/mface.js @@ -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 { diff --git a/web/app/cad/model/productionInfo.js b/web/app/cad/model/productionInfo.js new file mode 100644 index 00000000..372296ce --- /dev/null +++ b/web/app/cad/model/productionInfo.js @@ -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; + } + +} \ No newline at end of file