iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
616 stars 210 forks source link

exporting imodel to obj #58

Closed andgonro closed 4 years ago

andgonro commented 4 years ago

I am trying to use the test app export-obj but the imodel keeps failing to be loaded due to a profile issue I have tried to open directly a local .imodel file published from OpenPlant or a .idgndb created by Navigator getting a different error on each case

using .imodel PS D:_Siemens\DevProjects\imodeljs\test-apps> node export-obj/lib/ExportObj.js --input "m3321a010.imodel" --output "OPM_Example.obj" Error |DgnCore| Error BE_SQLITE_ERROR_InvalidProfileVersion opening [m3321a010.imodel] Error |imodeljs-backend.IModelDb| Invalid Profile Version: Could not open standalone iModel {"pathname":"m3321a010.imodel","ExceptionType":"IModelError","ActivityId":"86d1117a-2ef0-46f3-9e09-99be22d1b286","SessionId":"43592aa1-8462-455e-b82c-fc87142a72e6","ApplicationId":"","ApplicationVersion":""} Could not open standalone iModel Invalid Profile Version: Could not open standalone iModel at Function.openStandalone (D:_Siemens\DevProjects\imodeljs\core\backend\lib\BriefcaseManager.js:792:19) at Function.openStandalone (D:_Siemens\DevProjects\imodeljs\core\backend\lib\IModelDb.js:221:68) at Function.openSnapshot (D:_Siemens\DevProjects\imodeljs\core\backend\lib\IModelDb.js:231:31) at doExport (D:_Siemens\DevProjects\imodeljs\test-apps\export-obj\lib\ExportObj.js:18:48) at Object. (D:_Siemens\DevProjects\imodeljs\test-apps\export-obj\lib\ExportObj.js:101:5) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3)

using idgndb PS D:_Siemens\DevProjects\imodeljs\test-apps> node export-obj/lib/ExportObj.js --input "m3321a010.idgndb" --output "OPM_Example.obj" Error |BeSQLite| Cannot open file: The file's ECDb profile (3.7.3.3) is too old. Expected version: 4.0.0.2. Error |DgnCore| Error BE_SQLITE_ERROR_ProfileTooOld opening [m3321a010.idgndb] Error |imodeljs-backend.IModelDb| Profile Too Old: Could not open standalone iModel {"pathname":"m3321a010.idgndb","ExceptionType":"IModelError","ActivityId":"e5ce12bc-b324-4d65-919b-1bda223b2f1b","SessionId":"cc789673-5b75-4ce6-9ec3-224e696b21a1","ApplicationId":"","ApplicationVersion":""} Could not open standalone iModel Profile Too Old: Could not open standalone iModel at Function.openStandalone (D:_Siemens\DevProjects\imodeljs\core\backend\lib\BriefcaseManager.js:792:19) at Function.openStandalone (D:_Siemens\DevProjects\imodeljs\core\backend\lib\IModelDb.js:221:68) at Function.openSnapshot (D:_Siemens\DevProjects\imodeljs\core\backend\lib\IModelDb.js:231:31) at doExport (D:_Siemens\DevProjects\imodeljs\test-apps\export-obj\lib\ExportObj.js:18:48) at Object. (D:_Siemens\DevProjects\imodeljs\test-apps\export-obj\lib\ExportObj.js:101:5) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3)

I am not sure if I am missing anything.

ColinKerr commented 4 years ago

The second error is happening because you are trying to open a 1.6 iModel which is not compatible with iModel.js (iModel.js only supports 2.0 iModels, ECDb profile 4 and greater). The latest versions of Navigator CONNECT Edition (10.x) support 2.0 iModels. This newer version of Navigator converts the older iModels in place so it can view them but does not support saving the exported file. The suggested workflow is to publish directly to the 2.0 format from the original source.

The first error is less clear, some more information would help. Can you provide the versions of OpenPlant and iModel.js you are using.

pmconne commented 4 years ago

A .imodel file is basically a zip archive containing a .bim or .ibim file. export-obj wants the uncompressed file - it won't decompress it for you.

Josh-Schifter commented 4 years ago

If you have a recent .imodel package file, you can extract the .bim/.ibim using these two steps:

  1. Upload it to the hub from the developer registration dashboard
  2. Run the snapshot utility to pull out the contents:

If that doesn't work, perhaps you are using an old version of OpenPlant. Either get a newer version, or you can use a recent BentleyView which is a free download.

andgonro commented 4 years ago

A .imodel file is basically a zip archive containing a .bim or .ibim file. export-obj wants the uncompressed file - it won't decompress it for you.

A .imodel file is basically a zip archive containing a .bim or .ibim file. export-obj wants the uncompressed file - it won't decompress it for you.

Thanks, it worked when I used i.bim file