-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create b3dm, attribute lost #164
Comments
test2.zip |
It is not clear what the actual goal is. When you have attribute information in IFC, and you export this data with But the functionality of Cesium ion has recently been extended to improve the handling of IFC data and the attributes/metadata that it contains. You could try uploading your model to Cesium ion, as described in https://cesium.com/learn/3d-tiling/tiler-data-formats/ . This way, the attribute information should be preserved in the resulting tileset data. (This data will be GLB and not B3DM, but the GLB will contain the necessary attribute information) |
Hello developer, thank you for your reply. |
When you convert the data from IFC to GLB with However, from inspecting the GLB file, it looks like they are preserving this ID as part of the 'name' of the nodes in the glTF file. And in theory, it is possible to access this information in CesiumJS. I do not recommend this! It relies on an aspect of But you can access the ID, like Again: This is not something that you should "rely" on for production use. But here is the sandcastle that shows how this data can be accessed: const viewer = new Cesium.Viewer("cesiumContainer");
const url = "http://localhost:8003/test2.glb";
const position = Cesium.Cartesian3.fromDegrees(
-75.152325, 39.94704, 10
);
const entity = viewer.entities.add({
name: url,
position: position,
model: {
uri: url,
},
});
viewer.trackedEntity = entity;
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function (movement) {
const pick = viewer.scene.pick(movement.endPosition);
const name = pick?.detail?.node?._name;
console.log("Name: "+name);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
It seems like this is possible, but you don't recommend doing it this way. |
When uploading the IFC model to Cesium ion, it will be converted into 3D Tiles. In this 3D Tiles tileset, there are GLB/glTF files that contain only some identifiers. There is no direct way to access the data from the original IFC file based on that. Similarly, when converting the IFC file to GLB with (Unless there are other tools that convert IFC to GLB - but given the complexity of IFC, this is unlikely...) |
Hello developer, I'm glad to receive your reply. |
I'm not entirely sure if this is what you referred to. But the following sandcastle shows how you can obtain the // Grant CesiumJS access to your ion assets
Cesium.Ion.defaultAccessToken = /*========= !!! INSERT YOUR TOKEN HERE !!! */
const viewer = new Cesium.Viewer("cesiumContainer");
const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(2918934, {
//This tileset doesn't have a location, so we're using a modelMatrix to place it at 0, 0 instead of drawing at the center of the earth
modelMatrix: Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(0, 0),
),
});
viewer.scene.primitives.add(tileset);
await viewer.zoomTo(tileset);
// Create an HTML element that will serve as the
// tooltip that displays the feature information
function createTooltip() {
const tooltip = document.createElement("div");
viewer.container.appendChild(tooltip);
tooltip.style.backgroundColor = "black";
tooltip.style.position = "absolute";
tooltip.style.left = "0";
tooltip.style.top = "0";
tooltip.style.padding = "14px";
tooltip.style["pointer-events"] = "none";
tooltip.style["block-size"] = "fit-content";
return tooltip;
}
const tooltip = createTooltip();
// Show the given HTML content in the tooltip
// at the given screen position
function showTooltip(screenX, screenY, htmlContent) {
tooltip.style.display = "block";
tooltip.style.left = `${screenX}px`;
tooltip.style.top = `${screenY}px`;
tooltip.innerHTML = htmlContent;
}
// Create an HTML string that contains information
// about the given feature, under the given title
function createFeatureHtml(title, feature) {
if (!Cesium.defined(feature)) {
return `(No ${title})<br>`;
}
const propertyKeys = feature.getPropertyIds();
if (!Cesium.defined(propertyKeys)) {
return `(No properties for ${title})<br>`;
}
let html = `<b>${title}:</b><br>`;
for (let i = 0; i < propertyKeys.length; i++) {
const propertyKey = propertyKeys[i];
const propertyValue = feature.getProperty(propertyKey);
html += ` ${propertyKey} : ${propertyValue}<br>`;
}
return html;
}
// Given an object that was obtained via Scene#pick: If it is
// a Cesium3DTileFeature, then it is returned.
// Otherwise, 'undefined' is returned.
function obtainFeature(picked) {
if (!Cesium.defined(picked)) {
return undefined;
}
const isFeature = picked instanceof Cesium.Cesium3DTileFeature;
if (!isFeature) {
return undefined;
}
return picked;
}
// Install the handler that will perform picking when the
// mouse is moved, and update the label entity when the
// mouse is over a Cesium3DTileFeature
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function (movement) {
let tooltipText = "";
const picked = viewer.scene.pick(movement.endPosition);
const feature = obtainFeature(picked);
tooltipText += createFeatureHtml("Feature", feature);
const screenX = movement.endPosition.x;
const screenY = movement.endPosition.y;
showTooltip(screenX, screenY, tooltipText);
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE); |
Hello, I have reviewed the demo case you provided me with. |
@javagl |
The GUID is no longer contained in the data when it is converted with ion. After it is converted with ion, the data only contains the When you export the data with |
Okay, thank you very much for your help. |
The support for AECO data, including IFC, is constantly improved within ion. You can expect that there will be broader support for different forms of metadata in the future. I cannot give details an exact timeline about that. But users will be informed about new features and improved support, via the community forum, or via blog posts like the one that you already linked to. |
Hello developer, my English is not particularly good and I am using a translation tool to communicate with you.
I use the command: npx 3d-tiles-tools glbToB3dm -i ./test2.glb -o ./out/test2.b3dm
After converting my GLB to B3DM, I used Cesium for rendering. Lost these attributes and custom data information
The text was updated successfully, but these errors were encountered: