Closed Garripe closed 1 year ago
This is odd - can you share the code? Or are you literally loading and saving again a model with no changes?
Hi @beachtom ,
I was testing with the version 0.0.35 and function ExportFilaAsIFC() and works well with any ifc file. I am using the code of the example https://ifcjs.github.io/info/docs/Guide/web-ifc/Tutorials/Editing%20Properties.
function handleChangeForIFCApi () {
const inputButton = fileInputRef.current
inputButton.addEventListener('change', (changed) => {
const reader = new FileReader()
reader.onload = () => encodeFile(reader.result)
reader.readAsText(changed.target.files[0])
})
}
async function encodeFile (ifcAsText) {
const uint8array = new TextEncoder().encode(ifcAsText)
await OpenIfcApi(uint8array)
// const line = ifcAPI.GetLine(0, 186)
// console.log(line)
// line.Name.value = 'test'
// ifcAPI.WriteLine(0, line)
createDownloadLink()
}
async function OpenIfcApi (ifcAsText) {
await ifcAPI.Init()
return ifcAPI.OpenModel(ifcAsText)
}
function createDownloadLink () {
try {
const data = ifcAPI.ExportFileAsIFC(0)
const blob = new Blob([data])
const file = new File([blob], 'modified.ifc')
const url = URL.createObjectURL(file)
const link = document.createElement('a')
link.innerText = 'Download'
link.download = 'modified.ifc'
link.setAttribute('href', url)
document.body.appendChild(link)
link.click()
} catch (error) {
console.error(error)
}
}
The only thing I change with version 0.0.39 is the function ExportFileAsIFC(0)
by SaveModel(0)
Hi @beachtom I have the same problem. I have updated to 0.0.42 because of deleting lines in API (I really need this feature). And it is in this version (thank you very much) but I am not able to save modified model. SaveModel and ExportFileAsIFC end with the same error that mentioned here. And for me if I am saving model that has 310 kilos error appears, if model has megabytes about tens everything works fine. So I am upvoting to repair it - thank you.
And no changes in model
This should be fixed now!
Thanks Tom! You mentioned in the past that it is possible to download a zip somewhere in the repository with the current build before you release it, with me replacing the specific files, where can I find it?
There is a link on the readme under current build.
But it takesa bout 15-20 min to build the entire set - so wait a bit or the changes may not be in
What happened?
Hi all, I am trying to save a model in a file. With small files it seems to work fine, specifically with the simple simple rebar.ifc file it does it correctly. I have not been able to do it with other files like TESTED_Simple_project_01.ifc. The function that is giving me an error is SaveModel(). This is the execution sequence:
As you can see in the images the dataBuffer is smaller than the src. Why is this happening? Am I doing something wrong? Thanks in advance
Version
0.0.39
What browsers are you seeing the problem on?
Chrome, Safari
Relevant log output
Anything else?
No response