Converter options : SCS --> Anything ? Web Viewer Export options?

Hi, I’m trying to figure out if a particular workflow is possible. If I have a CAD file that i’ve converted to SCS, which is now viewable in the hoops web viewer, i’d like to be able to offer users the ability to export that SCS in a number of formats I select from the web viewer.

Is this possible and/or is any conversion out of SCS possible, or is it a “locked box” format… in as much as once you’re in it you can’t get out ?

I was exploring whether the converter.exe offered this possibility via backend conversion, but it seems that it does not recognize your own format for input… only for export ? It’s a bit strange that there’s only a 1-way conversion ?

converter.exe --license_file lic.txt --input .\test.scs
[08/29/2023 12-30-16-205 D:000000 PID:24532 M:16MB:]INFO: HOOPS Converter v23.2 - SC v74 Build 87e10c1
        [08/29/2023 12-30-16-207 D:000000 PID:24532 M:16MB:]INFO: Component initialization
                [08/29/2023 12-30-16-207 D:000000 PID:24532 M:16MB:]INFO: Initializing HPS::World
                [08/29/2023 12-30-16-531 D:000000 PID:24532 M:42MB:]INFO: Initializing Exchange
                [08/29/2023 12-30-17-614 D:000000 PID:24532 M:45MB:]INFO: Initializing HPS
        [08/29/2023 12-30-17-614 D:001000 PID:24532 M:46MB:]INFO: Component initialization done
        [08/29/2023 12-30-17-614 D:000000 PID:24532 M:46MB:]INFO: Loading test.scs

  ERROR 1:
  error: Invalid magic.

  ERROR 2:
  error: [json.exception.parse_error.101] parse error at line 1, column 1: syntax error while parsing value - invalid literal; last read: 'V'
[08/29/2023 12-30-19-997 D:000000 PID:24532 M:101MB]ERROR 0: Input file .\test.scs is not a supported format

If this tool doesn’t support it … i suspect the web viewer, in any particular customization I might be able to make , also doesn’t support it ?

Hi,

unfortunately it is curently not possible to read back an SCS file outside of the webviewer or to export it directly to another format. The recommended approach for your workflow would be to generate a PRC file alongside the scs when converting your CAD model and use that to export to different formats.

I hope this helps,
Guido

1 Like

I see , that’s unfortunate. I was hoping the format was open to some kind of transformation , but it seems it is closed , unlike the old openHSF stuff that seems to be defunct now ?

PRC is really the format to use here as it retains all the CAD data of the model (brep, etc).

Yea , I hear you , but sometimes I would prefer to be able to export from the viewer itself , but it seems the web viewer doesn’t have this function.

I know that the HOOPS Communicator team is working on better support for editing workflows, so some form of direct serialization from the viewer might come in the near future.

You can of course right now export from the viewer by simply iterating over all geometry/attributes but that is admittedly a bit cumbersome.

Can you expound on this ? Is that a built in function of the viewer UX… or something the containing page would do via JS? Sorry … I’m new to the documentation and if you could point me specifically at what you mean here regarding iteration, that would be helpful…

My point is that it would be straightforward to iterate over the content of the model and then simply export that data yourself.
Some pseudocode would look like this. This could be done either from the client or on the server via pupetter or a similar tech. Obviously you would have to implement the “saveAttributes” and saveMeshes" part but the viewer does contain various API’a that give you access to that data.

Again, I’m not recommending going down that path but it is possible to do that.

function saveNodeContent(node){
   saveAttributes()
   saveMeshes()
 }
    
function exportViewerContentRecursively(currentNode) {
        let children = viewer.model.getNodeChildren(currentNode);
        for (let i=0;i<children.length;i++) {
              saveNodeContent(children[i])
              exportViewerContentRecursively(children[i])
        }
}