diff --git a/examples/AngleMeasurement/index.html b/examples/AngleMeasurement/index.html index cbf24e4d..a14cbd5a 100644 --- a/examples/AngleMeasurement/index.html +++ b/examples/AngleMeasurement/index.html @@ -58,9 +58,9 @@ - - - + + + diff --git a/examples/AreaMeasurement/index.html b/examples/AreaMeasurement/index.html index 55396db4..12e96ca1 100644 --- a/examples/AreaMeasurement/index.html +++ b/examples/AreaMeasurement/index.html @@ -58,10 +58,10 @@ - + - - + +
diff --git a/examples/BoundingBoxer/index.html b/examples/BoundingBoxer/index.html index 32261485..d73deed8 100644 --- a/examples/BoundingBoxer/index.html +++ b/examples/BoundingBoxer/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/Civil3DNavigator/index.html b/examples/Civil3DNavigator/index.html index 6934663b..fb07c586 100644 --- a/examples/Civil3DNavigator/index.html +++ b/examples/Civil3DNavigator/index.html @@ -58,10 +58,10 @@ - - + + - + diff --git a/examples/CivilCrossSectionNavigator/index.html b/examples/CivilCrossSectionNavigator/index.html index 91eb6f43..1f1fc69b 100644 --- a/examples/CivilCrossSectionNavigator/index.html +++ b/examples/CivilCrossSectionNavigator/index.html @@ -76,11 +76,11 @@ - - + + - - + + diff --git a/examples/CivilElevationNavigator/index.html b/examples/CivilElevationNavigator/index.html index bdc397c5..d5933d20 100644 --- a/examples/CivilElevationNavigator/index.html +++ b/examples/CivilElevationNavigator/index.html @@ -77,11 +77,11 @@ - - - + + + - + diff --git a/examples/CivilPlanNavigator/index.html b/examples/CivilPlanNavigator/index.html index 6ffccf6b..0965b2ba 100644 --- a/examples/CivilPlanNavigator/index.html +++ b/examples/CivilPlanNavigator/index.html @@ -66,11 +66,11 @@ - - - + + + - + diff --git a/examples/Classifier/index.html b/examples/Classifier/index.html index 85b6ee54..b7ea37d1 100644 --- a/examples/Classifier/index.html +++ b/examples/Classifier/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/ClipEdges/index.html b/examples/ClipEdges/index.html index e51d91ab..9e812b30 100644 --- a/examples/ClipEdges/index.html +++ b/examples/ClipEdges/index.html @@ -58,11 +58,11 @@ - + - - + + diff --git a/examples/Clipper/index.html b/examples/Clipper/index.html index 5f8905a9..290dc532 100644 --- a/examples/Clipper/index.html +++ b/examples/Clipper/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/Cullers/index.html b/examples/Cullers/index.html index 140ac012..803373b4 100644 --- a/examples/Cullers/index.html +++ b/examples/Cullers/index.html @@ -58,9 +58,9 @@ - + - + diff --git a/examples/EdgeMeasurement/index.html b/examples/EdgeMeasurement/index.html index e928e67a..5e0cb5dd 100644 --- a/examples/EdgeMeasurement/index.html +++ b/examples/EdgeMeasurement/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/Exploder/index.html b/examples/Exploder/index.html index 731bb637..b12a1fb5 100644 --- a/examples/Exploder/index.html +++ b/examples/Exploder/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/FaceMeasurement/index.html b/examples/FaceMeasurement/index.html index c4f74f22..b81843df 100644 --- a/examples/FaceMeasurement/index.html +++ b/examples/FaceMeasurement/index.html @@ -58,10 +58,10 @@ - + - - + + diff --git a/examples/FragmentsManager/index.html b/examples/FragmentsManager/index.html index 0fcdcd03..2a66b11d 100644 --- a/examples/FragmentsManager/index.html +++ b/examples/FragmentsManager/index.html @@ -58,9 +58,9 @@ - + - + diff --git a/examples/Grids/index.html b/examples/Grids/index.html index 3686153f..a2296f0e 100644 --- a/examples/Grids/index.html +++ b/examples/Grids/index.html @@ -64,8 +64,8 @@ - - + + diff --git a/examples/Hider/index.html b/examples/Hider/index.html index 01b8be58..f71d83bb 100644 --- a/examples/Hider/index.html +++ b/examples/Hider/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/Highlighter/index.html b/examples/Highlighter/index.html index 543abb57..c9e5a9ee 100644 --- a/examples/Highlighter/index.html +++ b/examples/Highlighter/index.html @@ -58,9 +58,9 @@ - - - + + + diff --git a/examples/IfcGeometryTiler/index.html b/examples/IfcGeometryTiler/index.html index 6372afd3..160ea066 100644 --- a/examples/IfcGeometryTiler/index.html +++ b/examples/IfcGeometryTiler/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/IfcJsonExporter/index.html b/examples/IfcJsonExporter/index.html index 9efb6476..dc447043 100644 --- a/examples/IfcJsonExporter/index.html +++ b/examples/IfcJsonExporter/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/IfcLoader/index.html b/examples/IfcLoader/index.html index 44218fc9..c8cc7af4 100644 --- a/examples/IfcLoader/index.html +++ b/examples/IfcLoader/index.html @@ -58,10 +58,10 @@ - + - + diff --git a/examples/IfcPropertiesManager/index.html b/examples/IfcPropertiesManager/index.html index 376ff3db..171757b6 100644 --- a/examples/IfcPropertiesManager/index.html +++ b/examples/IfcPropertiesManager/index.html @@ -6,7 +6,7 @@Jt.intersectsBox(e),intersectsTriangle:e=>Jt.intersectsTriangle(e)})}intersectsSphere(n){return this.shapecast({intersectsBounds:t=>n.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(n)})}closestPointToGeometry(n,t,e={},s={},E=0,i=1/0){return(this.indirect?ri:Qn)(this,n,t,e,s,E,i)}closestPointToPoint(n,t={},e=0,s=1/0){return wn(this,n,t,e,s)}getBoundingBox(n){return n.makeEmpty(),this._roots.forEach(e=>{Y(0,new Float32Array(e),os),n.union(os)}),n}}function rs(r,n,t){return r===null||(r.point.applyMatrix4(n.matrixWorld),r.distance=r.point.distanceTo(t.ray.origin),r.object=n,r.distance Jt.intersectsBox(e),intersectsTriangle:e=>Jt.intersectsTriangle(e)})}intersectsSphere(n){return this.shapecast({intersectsBounds:t=>n.intersectsBox(t),intersectsTriangle:t=>t.intersectsSphere(n)})}closestPointToGeometry(n,t,e={},s={},E=0,i=1/0){return(this.indirect?ri:Qn)(this,n,t,e,s,E,i)}closestPointToPoint(n,t={},e=0,s=1/0){return wn(this,n,t,e,s)}getBoundingBox(n){return n.makeEmpty(),this._roots.forEach(e=>{Y(0,new Float32Array(e),os),n.union(os)}),n}}function rs(r,n,t){return r===null||(r.point.applyMatrix4(n.matrixWorld),r.distance=r.point.distanceTo(t.ray.origin),r.object=n,r.distance _&&(_=D)}return a[l+0]!==R||a[l+1]!==F||a[l+2]!==p||a[l+3]!==g||a[l+4]!==A||a[l+5]!==_?(a[l+0]=R,a[l+1]=F,a[l+2]=p,a[l+3]=g,a[l+4]=A,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+I,F=f+I;let p=C,g=!1,A=!1;t?p||(g=t.has(R),A=t.has(F),p=!g&&!A):(g=!0,A=!0);const _=p||g,S=p||A;let N=!1;_&&(N=E(m,I,p));let y=!1;S&&(y=E(f,I,p));const L=N||y;if(L)for(let P=0;P<3;P++){const D=m+P,x=f+P,Y=a[D],z=a[D+3],tt=a[x],W=a[x+3];a[l+P]=YW?z:W}return L}}}const qi=new st;function zt(c,t,e,s){return j(c,t,qi),e.intersectBox(qi,s)}function Qr(c,t,e,s,i,n){const{geometry:o,_indirectBuffer:r}=c;for(let a=s,h=s+i;a _&&(_=Y)}}return a[l+0]!==R||a[l+1]!==F||a[l+2]!==p||a[l+3]!==g||a[l+4]!==A||a[l+5]!==_?(a[l+0]=R,a[l+1]=F,a[l+2]=p,a[l+3]=g,a[l+4]=A,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+I,F=f+I;let p=C,g=!1,A=!1;t?p||(g=t.has(R),A=t.has(F),p=!g&&!A):(g=!0,A=!0);const _=p||g,S=p||A;let N=!1;_&&(N=E(m,I,p));let y=!1;S&&(y=E(f,I,p));const L=N||y;if(L)for(let P=0;P<3;P++){const D=m+P,x=f+P,Y=a[D],z=a[D+3],tt=a[x],W=a[x+3];a[l+P]=YW?z:W}return L}}}const tn=new O;function aa(c,t,e,s,i){Z.setBuffer(c._roots[t]),hi(0,c,e,s,i),Z.clearBuffer()}function hi(c,t,e,s,i){const{float32Array:n,uint16Array:o,uint32Array:r}=Z,a=c*2;if(ct(a,o)){const h=lt(c,r),d=It(a,o);Qr(t,e,s,h,d,i)}else{const h=pt(c);zt(h,n,s,tn)&&hi(h,t,e,s,i);const d=Ct(c,r);zt(d,n,s,tn)&&hi(d,t,e,s,i)}}const en=new O,ha=["x","y","z"];function ca(c,t,e,s){Z.setBuffer(c._roots[t]);const i=ci(0,c,e,s);return Z.clearBuffer(),i}function ci(c,t,e,s){const{float32Array:i,uint16Array:n,uint32Array:o}=Z;let r=c*2;if(ct(r,n)){const a=lt(c,o),h=It(r,n);return jr(t,e,s,a,h)}else{const a=qn(c,o),h=ha[a],d=s.direction[h]>=0;let E,l;d?(E=pt(c),l=Ct(c,o)):(E=Ct(c,o),l=pt(c));const I=zt(E,i,s,en)?ci(E,t,e,s):null;if(I){const T=I.point[h];if(d?T<=i[l+a]:T>=i[l+a+3])return I}const C=zt(l,i,s,en)?ci(l,t,e,s):null;return I&&C?I.distance<=C.distance?I:C:I||C||null}}const as=new st,oe=new At,re=new At,ye=new H,sn=new at,hs=new at;function la(c,t,e,s){Z.setBuffer(c._roots[t]);const i=li(0,c,e,s);return Z.clearBuffer(),i}function li(c,t,e,s,i=null){const{float32Array:n,uint16Array:o,uint32Array:r}=Z;let a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),sn.set(e.boundingBox.min,e.boundingBox.max,s),i=sn),ct(a,o)){const h=t.geometry,d=h.index,E=h.attributes.position,l=e.index,I=e.attributes.position,C=lt(c,r),T=It(a,o);if(ye.copy(s).invert(),e.boundsTree)return j(c,n,hs),hs.matrix.copy(ye),hs.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:m=>hs.intersectsBox(m),intersectsTriangle:m=>{m.a.applyMatrix4(s),m.b.applyMatrix4(s),m.c.applyMatrix4(s),m.needsUpdate=!0;for(let f=C,R=T+C;f _&&(_=U)}return a[l+0]!==R||a[l+1]!==F||a[l+2]!==p||a[l+3]!==g||a[l+4]!==A||a[l+5]!==_?(a[l+0]=R,a[l+1]=F,a[l+2]=p,a[l+3]=g,a[l+4]=A,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+I,F=f+I;let p=C,g=!1,A=!1;t?p||(g=t.has(R),A=t.has(F),p=!g&&!A):(g=!0,A=!0);const _=p||g,S=p||A;let N=!1;_&&(N=E(m,I,p));let y=!1;S&&(y=E(f,I,p));const L=N||y;if(L)for(let P=0;P<3;P++){const U=m+P,x=f+P,Y=a[U],z=a[U+3],tt=a[x],W=a[x+3];a[l+P]=YW?z:W}return L}}}const qi=new st;function zt(c,t,e,s){return j(c,t,qi),e.intersectBox(qi,s)}function Qr(c,t,e,s,i,n){const{geometry:o,_indirectBuffer:r}=c;for(let a=s,h=s+i;a _&&(_=Y)}}return a[l+0]!==R||a[l+1]!==F||a[l+2]!==p||a[l+3]!==g||a[l+4]!==A||a[l+5]!==_?(a[l+0]=R,a[l+1]=F,a[l+2]=p,a[l+3]=g,a[l+4]=A,a[l+5]=_,!0):!1}else{const m=l+8,f=o[l+6],R=m+I,F=f+I;let p=C,g=!1,A=!1;t?p||(g=t.has(R),A=t.has(F),p=!g&&!A):(g=!0,A=!0);const _=p||g,S=p||A;let N=!1;_&&(N=E(m,I,p));let y=!1;S&&(y=E(f,I,p));const L=N||y;if(L)for(let P=0;P<3;P++){const U=m+P,x=f+P,Y=a[U],z=a[U+3],tt=a[x],W=a[x+3];a[l+P]=YW?z:W}return L}}}const tn=new O;function aa(c,t,e,s,i){Z.setBuffer(c._roots[t]),hi(0,c,e,s,i),Z.clearBuffer()}function hi(c,t,e,s,i){const{float32Array:n,uint16Array:o,uint32Array:r}=Z,a=c*2;if(ct(a,o)){const h=lt(c,r),d=It(a,o);Qr(t,e,s,h,d,i)}else{const h=pt(c);zt(h,n,s,tn)&&hi(h,t,e,s,i);const d=Ct(c,r);zt(d,n,s,tn)&&hi(d,t,e,s,i)}}const en=new O,ha=["x","y","z"];function ca(c,t,e,s){Z.setBuffer(c._roots[t]);const i=ci(0,c,e,s);return Z.clearBuffer(),i}function ci(c,t,e,s){const{float32Array:i,uint16Array:n,uint32Array:o}=Z;let r=c*2;if(ct(r,n)){const a=lt(c,o),h=It(r,n);return jr(t,e,s,a,h)}else{const a=qn(c,o),h=ha[a],d=s.direction[h]>=0;let E,l;d?(E=pt(c),l=Ct(c,o)):(E=Ct(c,o),l=pt(c));const I=zt(E,i,s,en)?ci(E,t,e,s):null;if(I){const T=I.point[h];if(d?T<=i[l+a]:T>=i[l+a+3])return I}const C=zt(l,i,s,en)?ci(l,t,e,s):null;return I&&C?I.distance<=C.distance?I:C:I||C||null}}const as=new st,oe=new At,re=new At,ye=new H,sn=new at,hs=new at;function la(c,t,e,s){Z.setBuffer(c._roots[t]);const i=li(0,c,e,s);return Z.clearBuffer(),i}function li(c,t,e,s,i=null){const{float32Array:n,uint16Array:o,uint32Array:r}=Z;let a=c*2;if(i===null&&(e.boundingBox||e.computeBoundingBox(),sn.set(e.boundingBox.min,e.boundingBox.max,s),i=sn),ct(a,o)){const h=t.geometry,d=h.index,E=h.attributes.position,l=e.index,I=e.attributes.position,C=lt(c,r),T=It(a,o);if(ye.copy(s).invert(),e.boundsTree)return j(c,n,hs),hs.matrix.copy(ye),hs.needsUpdate=!0,e.boundsTree.shapecast({intersectsBounds:m=>hs.intersectsBox(m),intersectsTriangle:m=>{m.a.applyMatrix4(s),m.b.applyMatrix4(s),m.c.applyMatrix4(s),m.needsUpdate=!0;for(let f=C,R=T+C;fs?e:s}}function Vt(r,n,t){for(let e=0;e<3;e++){const s=n[r+2*e],E=n[r+2*e+1],i=s-E,o=s+E;iL&&(L=O),A>L&&(L=A);const P=(L-f)/2,p=F*2;E[R+p+0]=f+P,E[R+p+1]=P+(Math.abs(f)+P)*cn,fo.value!==s),await t.setProperties(s,null),this.registerChange(t,e,s))}async addElementToPset(t,e,...s){const E=await Ee.getPsetRel(t,e);if(!E)return;const i=await t.getProperties(E);if(!i)return;for(const I of s){const c=new bt(I);i.RelatedObjects.push(c),this.onElementToPset.trigger({model:t,psetID:e,elementID:I})}this.registerChange(t,e);const o=this.components.get(ie);for(const I of s)o.addEntityRelations(t,I,"IsDefinedBy",e)}async addPropToPset(t,e,...s){const E=await t.getProperties(e);if(E){for(const i of s){if(E.HasProperties.includes(i))continue;const o=new bt(i);E.HasProperties.push(o),this.onPropToPset.trigger({model:t,psetID:e,propID:i})}this.registerChange(t,e)}}async saveToIfc(t,e){const s=this.components.get(oe),E=s.webIfc,i=await s.readIfcFile(e),o=this.changeMap[t.uuid]??[];for(const c of o){const C=await t.getProperties(c);if(C)try{E.WriteLine(i,C)}catch{}else try{E.DeleteLine(i,c)}catch{}}const I=E.SaveModel(i);return s.webIfc.CloseModel(i),s.cleanUp(),I}async setAttributeListener(t,e,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const E=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][s]:null;if(E)return E;const i=await t.getProperties(e);if(!i)throw new Error(`Entity with expressID ${e} doesn't exists.`);const o=i[s];if(Array.isArray(o)||!o)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const I=o.value;if(I===void 0||I==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const c=new x;return Object.defineProperty(i[s],"value",{get(){return this._value},async set(C){this._value=C,c.trigger(C)}}),i[s].value=I,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][s]=c,c}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const e=nt.getIFCSchema(t);return new Q[e].IfcGloballyUniqueId(se.create())}async getOwnerHistory(t){const e=await t.getAllPropertiesOfType(In);if(!e)throw new Error("No OwnerHistory was found.");const s=Object.keys(e).map(o=>parseInt(o,10)),E=e[s[0]],i=new bt(E.expressID);return{ownerHistory:E,ownerHistoryHandle:i}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const s of e)this.changeMap[t.uuid].add(s),this.onDataChanged.trigger({model:t,expressID:s})}async newSingleProperty(t,e,s,E){const i=nt.getIFCSchema(t),o=new Q[i].IfcIdentifier(s),I=new Q[i][e](E),c=new Q[i].IfcPropertySingleValue(o,null,I,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}};M(nt,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Be=nt;const gs=new ne,ms=gs.get(oe);await ms.setup();const pi=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),ws=await pi.arrayBuffer(),ot=await ms.load(new Uint8Array(ws)),Ot=gs.get(Be),{pset:Bs}=await Ot.newPset(ot,"CalculatedQuantities"),di=await Ot.newSingleNumericProperty(ot,"IfcReal","Volume",12.25);await Ot.addPropToPset(ot,Bs.expressID,di.expressID);await Ot.addElementToPset(ot,Bs.expressID,186);const Pe=await ot.getProperties(186);Pe&&(Pe.Name.value="New Wall Name",await Ot.setData(ot,Pe));const Mi=await Ot.saveToIfc(ot,new Uint8Array(ws)),Ys=new File([Mi],"small-modified.ifc"),ve=document.createElement("a");ve.href=URL.createObjectURL(Ys);ve.download=Ys.name;URL.revokeObjectURL(ve.href);
+- If you're using a platform tool, verify the uuid isn't misspelled or contact the tool creator.`)}};M(b,"_pattern",/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/),M(b,"_lut",["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"]);let se=b;const re=class re{constructor(){M(this,"onDisposed",new x);M(this,"list",new Map);M(this,"enabled",!1);M(this,"_clock");M(this,"update",()=>{if(!this.enabled)return;const n=this._clock.getDelta();for(const[t,e]of this.list)e.enabled&&e.isUpdateable()&&e.update(n);requestAnimationFrame(this.update)});this._clock=new _s,re.setupBVH()}add(n,t){if(this.list.has(n))throw new Error("You're trying to add a component that already exists in the components instance. Use Components.get() instead.");se.validate(n),this.list.set(n,t)}get(n){const t=n.uuid;if(!this.list.has(t)){const e=new n(this);return this.list.has(t)||this.add(t,e),e}return this.list.get(t)}init(){this.enabled=!0,this._clock.start(),this.update()}dispose(){this.enabled=!1;for(const[n,t]of this.list)t.enabled=!1,t.isDisposeable()&&t.dispose();this._clock.stop(),this.onDisposed.trigger(),this.onDisposed.reset()}static setupBVH(){pe.prototype.computeBoundsTree=Ti,pe.prototype.disposeBoundsTree=Ri,cs.prototype.raycast=ci}};M(re,"release","2.1.26");let ne=re;const Fi=new Map([[Ye,{forRelated:"Decomposes",forRelating:"IsDecomposedBy"}],[Ts,{forRelated:"HasAssociations",forRelating:"AssociatedTo"}],[Rs,{forRelated:"HasAssociations",forRelating:"ClassificationForObjects"}],[ls,{forRelated:"HasAssignments",forRelating:"IsGroupedBy"}],[xe,{forRelated:"IsDefinedBy",forRelating:"DefinesOcurrence"}],[Fs,{forRelated:"IsTypedBy",forRelating:"Types"}],[As,{forRelated:"IsDefinedBy",forRelating:"Defines"}],[Ge,{forRelated:"ContainedInStructure",forRelating:"ContainsElements"}],[us,{forRelated:"AssignedToFlowElement",forRelating:"HasControlElements"}],[fs,{forRelated:"ConnectedFrom",forRelating:"ConnectedTo"}],[Ns,{forRelated:"HasAssignments",forRelating:"ReferencedBy"}],[Os,{forRelated:"HasContext",forRelating:"Declares"}],[Ss,{forRelated:"HasAssignments",forRelating:"Controls"}],[Ls,{forRelated:"Nests",forRelating:"IsNestedBy"}]]),mt=class mt extends Gt{constructor(t){super(t);M(this,"onDisposed",new x);M(this,"onRelationsIndexed",new x);M(this,"relationMaps",{});M(this,"enabled",!0);M(this,"_relToAttributesMap",Fi);M(this,"_inverseAttributes",["IsDecomposedBy","Decomposes","AssociatedTo","HasAssociations","ClassificationForObjects","IsGroupedBy","HasAssignments","IsDefinedBy","DefinesOcurrence","IsTypedBy","Types","Defines","ContainedInStructure","ContainsElements","HasControlElements","AssignedToFlowElement","ConnectedTo","ConnectedFrom","ReferencedBy","Declares","HasContext","Controls","IsNestedBy","Nests"]);M(this,"_ifcRels",[Ye,Ts,Rs,ls,xe,Fs,As,Ge,us,fs,Ns,Os,Ss,Ls]);M(this,"onFragmentsDisposed",t=>{delete this.relationMaps[t.groupID]});this.components.add(mt.uuid,this),t.get(Yt).onFragmentsDisposed.add(this.onFragmentsDisposed)}indexRelations(t,e,s,E){const i=Object.keys(e).find(a=>a.startsWith("Relating")),o=Object.keys(e).find(a=>a.startsWith("Related"));if(!(i&&o))return;const I=e[i].value,c=e[o].map(a=>a.value),C=t.get(I)??new Map,T=this.getAttributeIndex(E);T!==null&&(C.set(T,c),t.set(I,C));for(const a of c){const R=t.get(a)??new Map,l=this.getAttributeIndex(s);if(!l)continue;const S=R.get(l)??[];S.push(I),R.set(l,S),t.set(a,R)}}getAttributeIndex(t){const e=this._inverseAttributes.indexOf(t);return e===-1?null:e}setRelationMap(t,e){this.relationMaps[t.uuid]=e,this.onRelationsIndexed.trigger({modelID:t.uuid,relationsMap:e})}async process(t){if(!t.hasProperties)throw new Error("FragmentsGroup properties not found");let e=this.relationMaps[t.uuid];if(e)return e;e=new Map;for(const s of this._ifcRels){const E=await t.getAllPropertiesOfType(s);if(!E)continue;const i=this._relToAttributesMap.get(s);if(!i)continue;const{forRelated:o,forRelating:I}=i;for(const c in E){const C=E[c];this.indexRelations(e,C,o,I)}}return this.setRelationMap(t,e),e}async processFromWebIfc(t,e){const s=new Map;for(const E of this._ifcRels){const i=this._relToAttributesMap.get(E);if(!i)continue;const{forRelated:o,forRelating:I}=i,c=t.GetLineIDsWithType(e,E);for(let C=0;Co.value!==s),await t.setProperties(s,null),this.registerChange(t,e,s))}async addElementToPset(t,e,...s){const E=await Ee.getPsetRel(t,e);if(!E)return;const i=await t.getProperties(E);if(!i)return;for(const I of s){const c=new bt(I);i.RelatedObjects.push(c),this.onElementToPset.trigger({model:t,psetID:e,elementID:I})}this.registerChange(t,e);const o=this.components.get(ie);for(const I of s)o.addEntityRelations(t,I,"IsDefinedBy",e)}async addPropToPset(t,e,...s){const E=await t.getProperties(e);if(E){for(const i of s){if(E.HasProperties.includes(i))continue;const o=new bt(i);E.HasProperties.push(o),this.onPropToPset.trigger({model:t,psetID:e,propID:i})}this.registerChange(t,e)}}async saveToIfc(t,e){const s=this.components.get(oe),E=s.webIfc,i=await s.readIfcFile(e),o=this.changeMap[t.uuid]??[];for(const c of o){const C=await t.getProperties(c);if(C)try{E.WriteLine(i,C)}catch{}else try{E.DeleteLine(i,c)}catch{}}const I=E.SaveModel(i);return s.webIfc.CloseModel(i),s.cleanUp(),I}async setAttributeListener(t,e,s){this.attributeListeners[t.uuid]||(this.attributeListeners[t.uuid]={});const E=this.attributeListeners[t.uuid][e]?this.attributeListeners[t.uuid][e][s]:null;if(E)return E;const i=await t.getProperties(e);if(!i)throw new Error(`Entity with expressID ${e} doesn't exists.`);const o=i[s];if(Array.isArray(o)||!o)throw new Error(`Attribute ${s} is array or null, and it can't have a listener.`);const I=o.value;if(I===void 0||I==null)throw new Error(`Attribute ${s} has a badly defined handle.`);const c=new x;return Object.defineProperty(i[s],"value",{get(){return this._value},async set(C){this._value=C,c.trigger(C)}}),i[s].value=I,this.attributeListeners[t.uuid][e]||(this.attributeListeners[t.uuid][e]={}),this.attributeListeners[t.uuid][e][s]=c,c}increaseMaxID(t){return t.ifcMetadata.maxExpressID++,t.ifcMetadata.maxExpressID}newGUID(t){const e=nt.getIFCSchema(t);return new Q[e].IfcGloballyUniqueId(se.create())}async getOwnerHistory(t){const e=await t.getAllPropertiesOfType(In);if(!e)throw new Error("No OwnerHistory was found.");const s=Object.keys(e).map(o=>parseInt(o,10)),E=e[s[0]],i=new bt(E.expressID);return{ownerHistory:E,ownerHistoryHandle:i}}registerChange(t,...e){this.changeMap[t.uuid]||(this.changeMap[t.uuid]=new Set);for(const s of e)this.changeMap[t.uuid].add(s),this.onDataChanged.trigger({model:t,expressID:s})}async newSingleProperty(t,e,s,E){const i=nt.getIFCSchema(t),o=new Q[i].IfcIdentifier(s),I=new Q[i][e](E),c=new Q[i].IfcPropertySingleValue(o,null,I,null);return c.expressID=this.increaseMaxID(t),await this.setData(t,c),c}};M(nt,"uuid","58c2d9f0-183c-48d6-a402-dfcf5b9a34df");let Be=nt;const gs=new ne,ms=gs.get(oe);await ms.setup();const pi=await fetch("https://thatopen.github.io/engine_components/resources/small.ifc"),ws=await pi.arrayBuffer(),ot=await ms.load(new Uint8Array(ws)),Ot=gs.get(Be),{pset:Bs}=await Ot.newPset(ot,"CalculatedQuantities"),di=await Ot.newSingleNumericProperty(ot,"IfcReal","Volume",12.25);await Ot.addPropToPset(ot,Bs.expressID,di.expressID);await Ot.addElementToPset(ot,Bs.expressID,186);const Pe=await ot.getProperties(186);Pe&&(Pe.Name.value="New Wall Name",await Ot.setData(ot,Pe));const Mi=await Ot.saveToIfc(ot,new Uint8Array(ws)),Ys=new File([Mi],"small-modified.ifc"),ve=document.createElement("a");ve.href=URL.createObjectURL(Ys);ve.download=Ys.name;URL.revokeObjectURL(ve.href);
diff --git a/examples/assets/ifcPropertiesTiler.js b/examples/assets/ifcPropertiesTiler.js
index 1b3029b8..0559d95a 100644
--- a/examples/assets/ifcPropertiesTiler.js
+++ b/examples/assets/ifcPropertiesTiler.js
@@ -1,4 +1,4 @@
-import"./web-ifc-api-cV7FPlIA.js";import{S as b}from"./stats.min-BpIepu9J.js";import{m as w,t as f,a as u}from"./index-TmOv0r_5.js";import{p as y,C as g,O as h,a as B,H as F,u as L,h as S,e as U,c as k}from"./index-BkOJFY0w.js";const v=document.getElementById("container"),n=new y,x=n.get(g),s=x.create();s.scene=new h(n);s.renderer=new B(n,v);s.camera=new F(n);n.init();s.camera.controls.setLookAt(12,6,8,0,0,-10);s.scene.setup();const I=n.get(L);I.create(s);s.scene.three.background=null;const O=new S(n),R=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),A=await R.arrayBuffer(),P=new Uint8Array(A),j=O.load(P);s.scene.three.add(j);function C(e,o){const t=new File([o],e),a=document.createElement("a"),p=URL.createObjectURL(t);a.href=p,a.download=t.name,a.click(),URL.revokeObjectURL(p)}async function z(e){for(const{name:o,bits:t}of e)C(o,t),await new Promise(a=>{setTimeout(a,100)})}const r=n.get(U);r.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.56/",absolute:!0};const c={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let l=0;const d=[];r.onPropertiesStreamed.add(async e=>{c.types[e.type]||(c.types[e.type]=[]),c.types[e.type].push(l);for(const a in e.data)c.ids[a]=l;const o=`small.ifc-processed-properties-${l}`,t=new Blob([JSON.stringify(e.data)]);d.push({bits:t,name:o}),l++});r.onProgress.add(async e=>{console.log(e)});r.onIndicesStreamed.add(async e=>{d.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(c)])});const t=n.get(k).serializeRelations(e);d.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([t])}),await z(d)});async function T(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),t=new Uint8Array(o);await r.streamFromBuffer(t)}const i=new b;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";s.renderer.onBeforeUpdate.add(()=>i.begin());s.renderer.onAfterUpdate.add(()=>i.end());w.init();const m=f.create(()=>u`
+import"./web-ifc-api-CBCWqdvz.js";import{S as b}from"./stats.min-BpIepu9J.js";import{m as w,t as f,a as u}from"./index-TmOv0r_5.js";import{p as y,C as g,O as h,a as B,H as F,u as L,h as S,e as U,c as k}from"./index-B7_GRGdn.js";const v=document.getElementById("container"),n=new y,x=n.get(g),s=x.create();s.scene=new h(n);s.renderer=new B(n,v);s.camera=new F(n);n.init();s.camera.controls.setLookAt(12,6,8,0,0,-10);s.scene.setup();const I=n.get(L);I.create(s);s.scene.three.background=null;const O=new S(n),R=await fetch("https://thatopen.github.io/engine_components/resources/small.frag"),A=await R.arrayBuffer(),P=new Uint8Array(A),j=O.load(P);s.scene.three.add(j);function C(e,o){const t=new File([o],e),a=document.createElement("a"),p=URL.createObjectURL(t);a.href=p,a.download=t.name,a.click(),URL.revokeObjectURL(p)}async function z(e){for(const{name:o,bits:t}of e)C(o,t),await new Promise(a=>{setTimeout(a,100)})}const r=n.get(U);r.settings.wasm={path:"https://unpkg.com/web-ifc@0.0.56/",absolute:!0};const c={types:{},ids:{},indexesFile:"small.ifc-processed-properties-indexes"};let l=0;const d=[];r.onPropertiesStreamed.add(async e=>{c.types[e.type]||(c.types[e.type]=[]),c.types[e.type].push(l);for(const a in e.data)c.ids[a]=l;const o=`small.ifc-processed-properties-${l}`,t=new Blob([JSON.stringify(e.data)]);d.push({bits:t,name:o}),l++});r.onProgress.add(async e=>{console.log(e)});r.onIndicesStreamed.add(async e=>{d.push({name:"small.ifc-processed-properties.json",bits:new Blob([JSON.stringify(c)])});const t=n.get(k).serializeRelations(e);d.push({name:"small.ifc-processed-properties-indexes",bits:new Blob([t])}),await z(d)});async function T(){const o=await(await fetch("https://thatopen.github.io/engine_components/resources/small.ifc")).arrayBuffer(),t=new Uint8Array(o);await r.streamFromBuffer(t)}const i=new b;i.showPanel(2);document.body.append(i.dom);i.dom.style.left="0px";i.dom.style.zIndex="unset";s.renderer.onBeforeUpdate.add(()=>i.begin());s.renderer.onAfterUpdate.add(()=>i.end());w.init();const m=f.create(()=>u`
0?m.start.copy(E.start):m.start.copy(l.start),h.subVectors(E.end,l.end),h.dot(r)<0?m.end.copy(E.end):m.end.copy(l.end)),!0)}}}();At.prototype.distanceToPoint=function(){const c=new O;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();At.prototype.distanceToTriangle=function(){const c=new O,t=new O,e=["a","b","c"],s=new gt,i=new gt;return function(n,o=null,r=null){const a=o||r?s:null;if(this.intersectsTriangle(n,a))return(o||r)&&(o&&a.getCenter(o),r&&a.getCenter(r)),0;let h=1/0;for(let d=0;d<3;d++){let E;const l=e[d],I=n[l];this.closestPointToPoint(I,c),E=I.distanceToSquared(c),Els.intersectsBox(s),intersectsTriangle:s=>ls.intersectsTriangle(s)})}intersectsSphere(t){return this.shapecast({intersectsBounds:e=>t.intersectsBox(e),intersectsTriangle:e=>e.intersectsSphere(t)})}closestPointToGeometry(t,e,s={},i={},n=0,o=1/0){return(this.indirect?pa:oa)(this,t,e,s,i,n,o)}closestPointToPoint(t,e={},s=0,i=1/0){return Gr(this,t,e,s,i)}getBoundingBox(t){return t.makeEmpty(),this._roots.forEach(e=>{j(0,new Float32Array(e),nn),t.union(nn)}),t}}function on(c,t,e){return c===null||(c.point.applyMatrix4(t.matrixWorld),c.distance=c.point.distanceTo(e.ray.origin),c.object=t,c.distancethis.tolerance)return!1;return!0}intersectRay(t,e){const s=this.faces;let i=-1/0,n=1/0;for(let o=0,r=s.length;o0?m.start.copy(E.start):m.start.copy(l.start),h.subVectors(E.end,l.end),h.dot(r)<0?m.end.copy(E.end):m.end.copy(l.end)),!0)}}}();At.prototype.distanceToPoint=function(){const c=new O;return function(t){return this.closestPointToPoint(t,c),t.distanceTo(c)}}();At.prototype.distanceToTriangle=function(){const c=new O,t=new O,e=["a","b","c"],s=new gt,i=new gt;return function(n,o=null,r=null){const a=o||r?s:null;if(this.intersectsTriangle(n,a))return(o||r)&&(o&&a.getCenter(o),r&&a.getCenter(r)),0;let h=1/0;for(let d=0;d<3;d++){let E;const l=e[d],I=n[l];this.closestPointToPoint(I,c),E=I.distanceToSquared(c),E