glTF export - OCCT7.5 require RapidJSON

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
gvb
Posts: 11
Joined: Tue Mar 09, 2021 11:51 am

glTF export - OCCT7.5 require RapidJSON

Post by gvb »

Hello

I am succeeded to export glTF files from FreeCAD using OCC 7.5 features. Current FreeCAD code is ready for glTF export, but OCC7.5 has to be compiled with RapidJSON library and packed into Libpack. Is there the description of build process of Libpack? I am not able to find the rigth repo where I should direct my PR. Or may be Libpack builded manualy?

Also I am not sure that Linux OCCT has compiled with RapidJSON. It is header-only library, so it is not obviouse from package dependancy.
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: glTF export - OCCT7.5 require RapidJSON

Post by apeltauer »

Building from OCC from scratch:
1. get the source code from (https://gitlab.com/blobfish/occt ) --> fillet fix included
2. setup your machine with cmake
3. get freetype2 and tcl/tk
4. setup cmake
5. build occ
gvb
Posts: 11
Joined: Tue Mar 09, 2021 11:51 am

Re: glTF export - OCCT7.5 require RapidJSON

Post by gvb »

Thanks for reply, I have already done that on my local machine. So my question is about what is a best way to share that with community?

Probably glTF is not popular enough for now, but it is strange for me to have option in FreecadCAD GUI "Export as glTF" witch is not working due to incomplete OCCT build options.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: glTF export - OCCT7.5 require RapidJSON

Post by Kunda1 »

gvb wrote: Thu Mar 11, 2021 7:49 am Thanks for reply, I have already done that on my local machine. So my question is about what is a best way to share that with community?

Probably glTF is not popular enough for now, but it is strange for me to have option in FreecadCAD GUI "Export as glTF" witch is not working due to incomplete OCCT build options.
If this is true, it is awkward.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
wmayer
Founder
Posts: 20244
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: glTF export - OCCT7.5 require RapidJSON

Post by wmayer »

Probably glTF is not popular enough for now, but it is strange for me to have option in FreecadCAD GUI "Export as glTF" witch is not working due to incomplete OCCT build options.
You have to blame OCCT. It provides the class RWGltf_CafWriter to create glTF files but no way to determine if it was built with RapidJSON, i.e. whether it's working or not.
So, when trying to export to that format you always get an error but when you enable log messages you at least get some information about the missing RapidJSON support.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: glTF export - OCCT7.5 require RapidJSON

Post by Kunda1 »

wmayer wrote: Thu Mar 11, 2021 8:44 pm
Probably glTF is not popular enough for now, but it is strange for me to have option in FreecadCAD GUI "Export as glTF" witch is not working due to incomplete OCCT build options.
You have to blame OCCT. It provides the class RWGltf_CafWriter to create glTF files but no way to determine if it was built with RapidJSON, i.e. whether it's working or not.
So, when trying to export to that format you always get an error but when you enable log messages you at least get some information about the missing RapidJSON support.
What would be an ideal way occt would behave here?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
gvb
Posts: 11
Joined: Tue Mar 09, 2021 11:51 am

Re: glTF export - OCCT7.5 require RapidJSON

Post by gvb »

My point is the same - we need rebild LibPack with HAVE_RAPIDJSON defined for OCCT code (see [1][2]). With out it the OCCT test case [3] is failed with that error [1]

$ FreeCADLibs/bin/DRAWEXE.exe
Draw[1]> pload ALL
1
Draw[2]> restore C:/occt/install/data/occ/Ball.brep b
b
Draw[3]> incmesh b 0.1
Incremental Mesh, multi-threading OFF
Meshing statuses: NoError
Draw[4]> set aTmpGltf "C:/occt/install/data/occ/Ball_tmp.glb"
C:/occt/install/data/occ/Ball_tmp.glb
Draw[5]> writegltf b "$aTmpGltf"
Error: glTF writer is unavailable - OCCT has been built without RapidJSON support [HAVE_RAPIDJSON undefined]
Draw[6]>



[1] https://gitlab.com/blobfish/occt/-/blob ... r.cxx#L721
[2] https://gitlab.com/blobfish/occt/-/blob ... r.cxx#L556
[3] https://gitlab.com/blobfish/occt/-/blob ... write/ball
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: glTF export - OCCT7.5 require RapidJSON

Post by Kunda1 »

gvb wrote: Fri Mar 12, 2021 7:43 am My point is the same - we need rebild LibPack with HAVE_RAPIDJSON defined for OCCT code (see [1][2]). With out it the OCCT test case [3] is failed with that error [1]
Pinging package volunteers. What say you?
sgrogan wrote: pinged by pinger macro
apeltauer wrote: pinged by pinger macro
vejmarie wrote: pinged by pinger macro
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
wmayer
Founder
Posts: 20244
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: glTF export - OCCT7.5 require RapidJSON

Post by wmayer »

Kunda1 wrote: Thu Mar 11, 2021 8:45 pm What would be an ideal way occt would behave here?
That the class RWGltf_CafWriter is not declared.
User avatar
vejmarie
Posts: 713
Joined: Mon Jan 04, 2016 4:52 pm
Location: Somewhere between France, USA and Taiwan
Contact:

Re: glTF export - OCCT7.5 require RapidJSON

Post by vejmarie »

Kunda1 wrote: Fri Mar 12, 2021 12:40 pm
gvb wrote: Fri Mar 12, 2021 7:43 am My point is the same - we need rebild LibPack with HAVE_RAPIDJSON defined for OCCT code (see [1][2]). With out it the OCCT test case [3] is failed with that error [1]
Pinging package volunteers. What say you?
sgrogan wrote: pinged by pinger macro
apeltauer wrote: pinged by pinger macro
vejmarie wrote: pinged by pinger macro
Will take care of that for Homebrew and the snap
Post Reply