简体   繁体   English

ifcManager.getAllItemsOfType() 遇到错误

[英]ifcManager.getAllItemsOfType() ran into error

I am using the ifcLoader.ifcManager.getAllItemsOfType() function from ifc.js I put the function inside the load method, so that after loading a ifc file, it should be print all the slab properties.我正在使用 ifc.js 中的ifcLoader.ifcManager.getAllItemsOfType() ifc.js我将 function 放在 load 方法中,以便在加载 ifc 文件后,它应该打印所有平板属性。

const modelID = 0;

  async function logAllSlabs(){
    const slabsID = await ifcLoader.ifcManager.getAllItemsOfType(modelID, IFCSLAB);

    for(let i = 0; i <= slabsID.length; i++) {
        const slabID = slabsID[i];
        const slabProperties = await ifcLoader.ifcManager.getItemProperties(0, slabID);
        console.log(slabProperties);
    }
  }
// IFC loading
  const ifcLoader = new IFCLoader();
  
  const input = document.getElementById('file-input')
  input.addEventListener('change', async () => {
    console.log('file selected')
    const file = input.files[0];
    const url = URL.createObjectURL(file);
    const model = await ifcLoader.loadAsync(url);
    scene.add(model);
    ifcModels.push(model);
    logAllSlabs()
  });

It seems work fine at the beginning, then there's this error.一开始似乎工作正常,然后出现此错误。 Cannot convert "undefined" to unsigned int无法将“未定义”转换为无符号整数

picture图片


Here is the code.这是代码。 https://github.com/ChenChihYuan/ifcjs_notes/blob/main/02_properties_WIT/app.js https://github.com/ChenChihYuan/ifcjs_notes/blob/main/02_properties_WIT/app.js

Any suggestions will be thankful.任何建议将不胜感激。

At a very quick glance, it looks like you're processing one too many items in your for statement:乍一看,您似乎在 for 语句中处理了太多项目:

You have:你有:
for(let i = 0; i <= slabsID.length; i++) { for(让 i = 0; i <=slabsID.length; i++) {

Since you're starting at zero, you should stop at length:由于您从零开始,因此您应该长时间停止:
for(let i = 0; i < slabsID.length; i++) { for(让 i = 0; i <slabsID.length; i++) {

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 jQuery ajax-即使成功运行也会运行错误 - jQuery ajax - error runs even though it ran successfully 我运行了react-native链接领域,但仍然出现错误 - I ran react-native link realm but still getting error 我在命令窗口中运行了npm start,它显示了此错误,如何解决? - I ran npm start in the command window and it displayed this error, What's the solution? 上载到S3-Chrome / Firefox中出现新的“不安全脚本” AKA“内容不安全”错误 - Uploading to S3 - new “unsafe script” AKA “ran insecure content” error in Chrome/Firefox 多次提取 API 调用返回错误 403(未运行第二个 API 调用) - Multiple Fetch API Call returns error 403 (the second API call is not ran) 从jquery函数而非@ Render.Action运行时,PartialViewResult操作会给出错误 - PartialViewResult action gives error when ran from jquery function but not from @Render.Action 构建失败 react-native 0.6.5 我们运行了“xcodebuild”命令,但它以错误代码 65 退出 - build failed react-native 0.6.5 We ran "xcodebuild" command but it exited with error code 65 我运行了我的代码并得到了这个错误:TypeError: eventType.toBuffer is not a function - I ran my code and got this error: TypeError: eventType.toBuffer is not a function Cypress Page Object Model 问题:运行链接到 PageObject 的测试时出现错误消息 - Cypress Page Object Model Issue:Got an error message when I ran a test linked to PageObject 我尝试使用 skulpt 制作 python 解释器,但遇到了意外错误。 我想在我的网站上使用它 - I tried to make a python interpreter using skulpt, but ran into an unexpected error. I want to use it on my website
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM