web-ifc-viewer
web-ifc-viewer copied to clipboard
IFC from Civil3D distorted
Hi, I have been trying to load several IFC (2x3 and 4) models generated from Civil3D, all of then are far away from origin so I am using:
COORDINATE_TO_ORIGIN: true,
USE_FAST_BOOLS: false
but it doesn´t matter, geometry is shown distorted:
Civil3D always locate IFCSITE at 0,0,0 and uses the real world coordinates at every element:
#65= IFCSITE('004QbQN2jALQM8J4CaEdum',#49,$,$,$,#79,$,$,.ELEMENT.,(57,53,30,0),(-3,0,0,0),0.,$,$);
#77= IFCRELAGGREGATES('1hQUJU3Yj4lP681i$cMqDV',#49,$,$,#1,(#65));
#79= IFCLOCALPLACEMENT($,#86);
#82= IFCCARTESIANPOINT((0.,0.,0.));
#86= IFCAXIS2PLACEMENT3D(#82,$,$);
Elements geometry with very large coordinates:
#319= IFCCARTESIANPOINT((442441.147575846,4481087.55358068,723.842484175393));
#323= IFCCARTESIANPOINT((442437.500822167,4481088.7468948,723.842484175393));
#327= IFCCARTESIANPOINT((442437.407522377,4481088.46177175,723.842484175393));
#331= IFCCARTESIANPOINT((442441.054276056,4481087.26845764,723.842484175393));
Not sure if it is an issue or a bad practice from Autodesk... Does COORDINATE_TO_ORIGIN uses IFCSITE or IFCMAPCONVERSION to relocate the model? Please could you clarify what is the theory behind it? I have read this issue https://github.com/tomvandig/web-ifc/issues/84 but it is not clear for me what have been done at the end here it is one of the IFC files in a ZIP. T15C500060-202111111-VIA-MX-00006_Modelo_via_2x3_C3D_clean.zip Thank you very much and congratulations for your great work
Hi, we face the same issue. We are trying to fix it out by this: var ifcCamera= viewer.context.getIfcCamera(); //children[0] is mesh if one model is connected (we think) ifcCamera.cameraControls.fitToSphere(scene.children[0].geometry.boundingSphere); ifcCamera.cameraControls.maxDistance = 5000; ifcCamera.cameraControls.minDistance = -5000; ifcCamera.cameraControls.minZoom = 0.0002;
And it works on some CIVIL models, that are not too large (we have some, that are 30 square kilometres wide).
If model is too large we are dealing with occlusion culling - that means model is in scene, but too far to view it by camera.
https://stackoverflow.com/questions/59727192/threejs-disable-frustum-culling-for-some-objects
Even if I set all meshes to .frustumCulled = false (even scene).
function listChildren(children) { let child; for (let i = 0; i < children.length; i++) { child = children[i]; // console.log(child.frustumCulled); child.frustumCulled = false; // console.log(child); // Calls this function again if the child has children if (child.children && child.children.length > 0) { listChildren(child.children); } // Logs if this child last in recursion else { console.log('Reached bottom with: ', child); } } }
Hey, this is already solved. We'll publish a new version today!