How to render the autodesk model in offline mode in iOS?

380 views Asked by At

I'm making an ios app and have used the forge api to render the model in the webview. I'm using React Native but i'm open to suggestions for objective-c too.

The problem i'm having is to render the model in offline mode. The app could download svf file and save on the phone's disk, but how can i load the file and render that in the webview? I find the A360 app can render the model in offline mode but not sure if it's rendered in webview. I also find the Autodesk.Viewing.FileLoader api, but couldn't figure out with it and i don't find an example. This is what I have tried:

var viewer = new Autodesk.Viewing.Private.GuiViewer3D(document.getElementById('MyViewerDiv'));

var filepath = '/Users/zheminzhang/Library/Developer/CoreSimulator/Devices/901B40DC-1DB6-4596-A24A-6D3FAA1EA5C5/data/Containers/Data/Application/925466F3-A623-416B-81A4-1EB62123AA66/Documents/RNFetchBlob_tmp/RNFetchBlobTmp_d0411119-5006-4529-8734-7e70764a309b.svf';

var options = {
    doc: filepath,
    env: 'Local'
};

Autodesk.Viewing.Initializer (options, function () {
    viewer.start(options.doc, options);
    // viewer.initialize();
    // var fileloader = new Autodesk.Viewing.FileLoader(viewer);
    // fileloader.loadFile(filepath);
});

Can anyone help please?

1

There are 1 answers

1
Xiaodong Liang On

I happened to notice this post. I am not sure how useful it would be, just sharing what I have practiced with iOS + Forge Viewer. https://forge.autodesk.com/blog/standalone-app-of-forge-viewer-on-ios-by-cordova