thatopen / web-ifc-three Goto Github PK
View Code? Open in Web Editor NEWThe official IFC Loader for Three.js.
Home Page: https://ifcjs.github.io/info/
License: MIT License
The official IFC Loader for Three.js.
Home Page: https://ifcjs.github.io/info/
License: MIT License
I'm aware that in the future almost everyone will either use web-ifc-viewer or Three.js directly, but right now having it in npm would be convenient to test the last changes in web-ifc-viewer directly
Hi !
Can you highlight IfcSpace? If yes, is there any way?
I got all the expressIDs of IfcSpace in the working model.
Hello! When loading a model (http://openifcmodel.cs.auckland.ac.nz/_models/23111022_IFCR2_Buildings_1.ifc), I received an error in developer's console window:
.
The current implementation of getSpatialStructure
is very generic: it gets the children of the project, then the children of the site, etc. Instead of doing that, it would be better to get all the IfcRelAggregates
and all the IfcRelContainedInSpatialStructure
and create the spatial tree in one single iteration.
getSpatialStructure(modelID: number, includeProperties?: boolean) {
return this.properties.getSpatialStructure(modelID, includeProperties);
}
now each object has a 'type' property that is an ID and not an IFCTYPE string. (like in the previous versions).
so after getting the spatial structure I still have to iterate through all elements setting the IFCTYPE using the dictionary IfcElementsMap or the function getIfcType.
Maybe when passing true on includeProperties param we could already include the translated IFCTYPE.
What do you think?
In order to use web-ifc when graphical interfase is not requerid it would be useful to implement the same interface that web-ifc-three has.
Of course just an interfase subset, all fumcrions related to graphical interfase has no meaning.
Hi !
I'd like to select some ifcOpening elements in a 3D model.
At the moment, I can access these elements' properties thanks to the getItemProperties
method.
However, I can't access there geometries, for example using the subsets related methods.
Managing openings elements is a tricky part in a construction project. That would be great if the ifc.js library could be used to manage this use case !!
Note
Hello
After testing with some models, I've notest some of them load very far away from 0,0.
I wonder if there is a way to change the coordinate system to make them centralized?
For now, I will try to get world position of every object and bring all of them closer to 0
Thank you,
Antonio
After implementing @agviegas sugestion -" If you want to allow the user to select objects and edit them, you can create the subsets of the objects the user want to modify lazily. This means that when the user clicks on a wall, you hide the wall using the visibility functions of the API, and create a subset of only that wall. From the user's perspective, he's able to click and modify any element in the model.", I encountered some problems, 1º- I can't click in the new created subsets and 2º- I cannot have the original material.
Some methods are too big and unmaintainable. Extract them in smaller methods. Also, merge modelID
, mapFaceindexID
and mapIDFaceIndex
into a single state
object that represents the data of a single model.
Hello there! This library is opensource. Ok. Even if a well-written code does not need comments, it would be very useful for me to find comments. On the contrary, these comments seem to be very few. I would like to understand and also learn, through an example like this, the best js programming techniques. For this I ask you if it is possible to add other comments to the code in the open source spirit, aimed at everyone. Thanks for your time.
Make three a peer dependency to avoid "multiple instances of three being imported" warnings.
docs state that ifc should be used as:
import { IfcLoader } from 'web-ifc-three';
but that won't work, see https://unpkg.com/browse/[email protected]/ package.json says "main": "index.js",
but there is none in the package.
Setting element visibility could be improved by not requiring to pass geometry as an argument. Instead only passing expressId & modelId. This makes it easier to use when with UI integrations.
I need to export generated Mesh from threejs to IFC file format. How i can do that?
Hello as mention in the title with the file in
Duplex Apartment.zip causes a memory out of bounds exception.
Uncaught RuntimeError: memory access out of bounds at http://localhost:5000/web-ifc.wasm:wasm-function[930]:0x4f3a4 at http://localhost:5000/web-ifc.wasm:wasm-function[931]:0x4ff87 at Object.GetLine (eval at new_ (http://localhost:5000/bundle.js:1:1), <anonymous>:9:10) at IfcAPI.GetRawLineData (http://localhost:5000/bundle.js:36157:28) at IfcAPI.GetLine (http://localhost:5000/bundle.js:36109:28) at IfcLoader.getItemProperties (http://localhost:5000/bundle.js:70365:29) at HTMLCanvasElement.selectObject (http://localhost:5000/bundle.js:72048:29) (anonymous) @ web-ifc.wasm:0x4f3a4 (anonymous) @ web-ifc.wasm:0x4ff87 GetLine @ VM354:9 GetRawLineData @ web-ifc-api.js:45366 GetLine @ web-ifc-api.js:45318 getItemProperties @ IfcLoader.js:128 selectObject @ web-ifc-scene.js:114
I am not really sure if its a problem with the usage of the web-ifc api or the api itself.
Edit.: it only happens when you try to select specific parts of the model (e.g. parts of the roof)
I downloaded to test the ifc Sam Romeo file . I tried to upload it locally. If I load it from the js folder it works. If I load it from the jsm folder, nothing is seen. What should I do to see the js console from Chrome? .... I always right click on browser page and then inspect ... but in this case the right click doesn't work
In "IFC.js" discord channel we discussed using "jest" as a testing framework.
Hi! I have a geometrical problems on rendering an IFC file.
The geometry in my model are rendered differently in Revit.
All window geometries are malformed:
IMG:
IFC:
R8_F1_MAB_AR_M3_XX_XXX_MO_7000.zip
ERROR Failed to compile with 1 error 9:01:25 AM
error in ./src/views/3Dengine/web-ifc-api.js
Module parse failed: Unexpected token (660:23)
File was processed with these loaders:
var path = import.meta.url.substring(0, import.meta.url.lastIndexOf("/") + 1);
| var wasmBinaryFile = path + "web-ifc.wasm";
|
@ ./src/views/3Dengine/IFCLoader.js 8:0-42 12:17-23
@ ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_babel-loader@8.2.2@babel-loade
r/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.6@vue-loader
/lib??vue-loader-options!./src/views/3Dengine/IFCmodel.vue?vue&type=script&lang=js&
@ ./src/views/3Dengine/IFCmodel.vue?vue&type=script&lang=js&
@ ./src/views/3Dengine/IFCmodel.vue
@ ./src/router.js
@ ./src/main.js
@ multi ./node_modules/_webpack-dev-server@3.11.2@webpack-dev-server/client?http://192.168.0.101:1337/sockjs-node (webp
ack)/hot/dev-server.js ./src/main.js
Getting geometry properties is a heavy process, and something that users will rarely want. Separating native properties and psets will allow users to get the only the psets recursively, thus improving the performance of getting properties.
Hi there,
I saw you made the viewer more optimized by merging the model into a single geometry. really nice!
I have a problem now, I wonder how to enable/disable single parts of the model with this approach.
I saw its possible if the buffer geometry is indexed and then you can pass a drawRange to the it, so it draws only what you want.
Do any of you maybe have a direction I could pursue, or maybe its not possible? I should go back to working with simple geometries if I want to manipulate the model?
Thank you,
Antonio
The IfcLoader file is getting too big. Extracting it into smaller, more maintainable files is necessary. This also requires configuring rollup to bundle the final file.
Link.
Hi, I have characters with accents in the IFC file, and when I read the value in the IFC it appears encoded as UTF-16 I think and I can't decode it.
Sorry for the wording of the question, I had to use automatic translator.
Thanks!
Missing esformatter as devDependency in package.json in order to be able to build dist folder.
I tried to get the info of model item using getSpacialStructure. But it returns following error.
IFCModel.ts:54 Uncaught TypeError: Cannot read property 'toString' of undefined
at PropertyManager.newNode (IFCModel.ts:54)
at IFCModel.ts:35
at Array.map ()
at PropertyManager.getChildren (IFCModel.ts:17)
at PropertyManager.getSpatialNode (TypeManager.ts:31)
at IFCModel.ts:36
at Array.map ()
at PropertyManager.getChildren (IFCModel.ts:17)
at PropertyManager.getSpatialNode (TypeManager.ts:31)
at IFCModel.ts:36
at Array.map ()
at PropertyManager.getChildren (IFCModel.ts:17)
at PropertyManager.getSpatialNode (TypeManager.ts:31)
at IFCModel.ts:36
at Array.map ()
at PropertyManager.getChildren (IFCModel.ts:17)
at PropertyManager.getSpatialNode (TypeManager.ts:31)
at PropertyManager.getSpatialStructure (PropertyManager.ts:123)
at IFCManager.getSpatialStructure (IFCManager.ts:107)
at IfcManager.getSpatialStructure (ifc-manager.ts:84)
It is because of missing IfcGrid. IfcGrid is related element to IfcRelContainedInSpatialStructure.
But it is not in IfcElements.
I suggest, IFCGRID will be added into IfcElements like following image.
Hi,
Great project!
I am looking for guidance about the change in the library of the functions setModelDisplay() which was deleted.
I was using setModelDisplay to configure transparency of the whole model and setItemsDisplay to color some elements to highlight.
Its seems the function createSubset() substitutes setItemsDisplay(), is there a way to setModelDisplay() or is it planned to implement similar function?
Thanks in advance
I've noticed that when using methods such as IfcManager.getPropertySets(modelID, expressID, true)
, the returned value is serialized and thus the instances of IfcPropertySet
, IfcPropertySingleValue
and so on ... are lost.
It would be a game changer to keep the data correctly instantiated (when using web workers) and to keep the typing intact. Currently the return type of IfcManager.getPropertySets()
is Promise<any[]>
but it could maybe then be Promise<IfcPropertySet[]>
.
No representation in the model of the U beam of this IFC file.
C200.zip
I recently upgraded the lib to the new versions :
"web-ifc":"^0.0.24"=> "^0.0.28",
"web-ifc-three": "^0.0.68" => "^0.0.80",
Now, I have some models that are not loaded, (but they did load before), like this one station_0.ifc.zip
Any idea ?
Thanks !
Adding this code to https://github.com/IFCjs/examples/blob/main/simple-react/src/App.js#L43
this.viewer.ifcManager.loader.getSpatialStructure()
(here for ref: pablo-mayrgundter/examples@da6eff8)
Causes this error and no useable IFC elements.
TypeError: Cannot convert "undefined" to unsigned int
at Object.toWireType (web-ifc-api.js:3985)
at Object.GetLineIDsWithType (eval at new_ (web-ifc-api.js:3734), <anonymous>:7:26)
at IfcAPI.GetLineIDsWithType (web-ifc-api.js:45377)
at PropertyManager.getChunks (TypeManager.ts:19)
at PropertyManager.getSpatialTreeChunks (TypeManager.ts:13)
at PropertyManager.getSpatialStructure (PropertyManager.ts:117)
at IFCManager.getSpatialStructure (IFCLoader.ts:206)
at IFCLoader.getSpatialStructure (IFCLoader.ts:61)
at App.onDrop (App.js:45)
Also tried with web-ifc-viewer 1.0.20, same result.
hello everyone, I am starting contributing to the library
I just got lot of TS issues when compiling it and errors with rollup imports.
this after running npm install
on both dirs and npm run build
on the root.
Do we have a stable branch to start with?
Can I contribute fixing the TS errors ?
Info:
Node.js v15.12.0
MacOS
I have been trying to run IFC.js in a Java WebEngine browser. I have compressed the IFC.js demo folder into a WAR file and successfully started up a Jetty local sever and IFC.js runs happily on localhost:8080 in a regular browser. In the Java browser the index page displays and I can select a model but no model or 3D space appears. Do any of you have any ideas on what additional HTML or browser settings are used in a regular browser to make this work, that may not be set in my Java WebEngine browser?
I have run out of things to try. The Java WebEngine is clearly not running the JavaScript in the referenced bundle.js, even though WebEngine should happily run JavaScript in the HTML page.
My username on Discord is SilentBob.
Hello!
As I asked before in the discord, I hope you can update the documentation with tutorials on how to extract geometric information (e.g. position, width, length and height) and semantic information (e.g. material and storey).
I would be very grateful for this!
To implement a Vue.js component that loads IFC files the path to web-ifc.wasm has to be specified with setWasmPath(./foo/bar/)
.
The problem is that this method prefixes the specified path and doesn't accept an absolute path or a URL.
Would it be possible to provide more functions to set the wasm path?
In my case, if I set the path to the web-ifc.wasm file with ifcLoader.ifcManager.setWasmPath("./")
my web app will perform a GET request to https://localhost:9200/home/vasco/Desktop/cernbox/web/node_modules/web-ifc/web-ifc.wasm, which results in a 404.
Since I have the web-ifc.wasm in the root of my build directory, I have to set the path to the web-ifc.wasm with ifcLoader.ifcManager.setWasmPath("../../../../../../../")
. This way the web app performs a GET request to https://localhost:9200/web-ifc.wasm and everything works fine.
The problem here is that for different deployment environments the relative path will be different.
A method to set the wasm path with a URL or an absolute path would solve this problem.
Initially ThatOpen/engine_web-ifc#69
In this construction project, one company (company A) is managing all the openings changes from one Revit digital mockup. Every time a change occurs, the company A shares one IFC files with all the up-to-date openings. Consulting companies, like structural engineering consultants, need to update the execution blueprints from this IFC.
When using the web-ifc-three lib to render the openings in 3D, the opening shapes do not appear to be regular rectangles. However, this is the case with the BIMcollab software.
The openings are mainly extruded shapes.
Using the orthographic camera in the Y and X direction, it appears that the "weird" shapes pb is limited to the view from above. It is like the extrusion did not work correctly.
The model is globally translated far away from the origin... To be sure to view it with Three.js, the camera should target the center of its bounding box.
Hi!
And thank you for this awesome library.
I just have an issue when loading a model. When I traverse the children Meshes, the position and the quaternion are always all zeros, even though the position and the rotation of the object is not zero in the Matrix of the Mesh. Is it intended ? If yes, can you explain me why ? If not, I guess a fix is just doing the following before returning the loaded model in load
:
loadedModel.traverse((child) => {
child.matrix.decompose(child.position, child.quaternion, child.scale);
});
I cannot upload the model I tested with (the .ifc file format is not supported), but you can download it here.
Also, it looks like the world transform of the children Meshes is already baked in the geometry of the corresponding child Mesh, right ? Actually I was wrong, it doesn't. Apparently the issue was coming from three.js not perfect support of the interleaved buffer attribute you use for your geometries.
Describe the bug
Does not load IFC models while using OCULUS QUEST 2 (I could try only with this device)
To Reproduce
Run the threejs example of ifc loader from OCULUS QUEST 2.
S
Screenshots
If applicable, add screenshots to help explain your problem (drag and drop the image).
Platform:
three-mesh-bvh sometimes throws error 'TypeError: Cannot read properties of undefined (reading 'count')' when using geometry subsets. This is reproducible by passing an empty selection array to SubsetManager.createSubset. I believe this also occurs when the selection contains an item that doesn't have a geometric representation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.