How to open CAD Assistant on iOS programatically?

The company I work for have a mobile app on which our users can browse construction equipment documentation: PDF with operating manuals, technical specs PDF, word documents and so on. Among those, we also have “IFC” files – 3D models a user can download and view.

For the Android app, I just open the file with your application, OpenCascade CADAssistant by starting an Intent:

public void startBimIfcViewerActivity(Context context, String ifcFilePath)
{
    String bimViewerAppPackageName="org.opencascade.cadassistant";
    try
    {
        //check if bim viewer app is installed
        context.getPackageManager().getPackageInfo(bimViewerAppPackageName, 0);

        Intent i=new Intent(Intent.ACTION_VIEW);
        i.setPackage(bimViewerAppPackageName);
        i.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
        i.setDataAndType(AppFilesUtils.getContentUriFromFile(ifcFilePath), MimeTypes.APPLICATION_BIM_IFC);
        context.startActivity(i);
    }
    catch (Exception ex)
    {
        Toast.makeText(context, “Please install OpenCascade”, Toast.LENGTH_SHORT).show();
        if (DeviceUtils.isHuawei())
            startBrowserActivity(context, "https://www.opencascade.com/products/cad-assistant/");
        else startPlayStoreActivity(context, bimViewerAppPackageName);
    }
}

For our iOS application, I don't know how to open your app.

I can redirect the user to the AppStore in order to download it, but I don't know how to open it and pass the IFC file to it so that it could render the file.

One manual way to achieve this would be like this: download the file to "Files" app, in the "CAD Assistant" folder, then ask the user to open CAD Assistant app then select the file. But, it's not automatic / not user friendly. How can I open the app automatically?

Do you have a deeplinking mechanism in your iOS app?

I saw that you have support packets to buy, but they seem to be targeted towards developers that are integrating OpenCascade library into their own app. I don't want to do this, I only want to download and open the file with an external file viewer like would do with PDF documents. If you don't have a deeplinking mechanism, and our company buys support units, are those units applicable to the current request (add deeplinking URL scheme in order to be able to open IFC files, then to publish an update on AppStore)?

Thanks.

Kirill Gavrilov's picture

Why would you want opening files exactly in CAD Assistant?

iOS supports system-wide files associations, which CAD Assistant should implement in it's "Info.plist" bundle file. So that normal workflow would be implementing "Share File" functionality in your app. If well-defined, system itself will list applications accepting specific file type, including CAD Assistant, when it is already installed. Sharing file mechanisms are very different from system to system, so I don't know exactly the code for iOS platform - as iOS and Android platform define file access restrictions between apps, the file sharing code might be complicated.

I'm not sure, however, that CAD Assistant on iOS supports IFC files at all - it may open IGES, STEP, glTF, PLY, STL and JT files as far as I can see. Android version is more up-to-date and supports more formats.

Some users report issues when sharing files from iCloud with CAD Assistant, though. Don't know if this issue is specific to iCloud or has appeared with some iOS update and affects all applications (I'm no iOS user).

andob's picture

Why would you want opening files exactly in CAD Assistant?

Because I didn't find a better app to open IFC files.

CAD Assistant iOS can open IFC files, but you have to manually place them in Files app -> CAD Assistant folder, then open them from CAD assistant app. If you go to files app then click on IFC file, the share popup shows up, but there is no CAD Assistant option.

On the other hand, if you have, a STEP file in Files app and click it, the share dialog shows up with CAD Assistant option included. You can select it and the app would open and show the model correctly.

Probably STEP file association is defined in Info.plist, but IFC file association is not. Can you please check this?

Kirill Gavrilov's picture

If extension is missing in "Info.plist" then I don't think there is something that can be done at the level of another application (iOS isolates applications, so that normal application cannot directly launch another one like on macOS) or at system level (there is no system-wide file associations in iOS like in macOS that user may modify, as far as I know). CAD Assistant itself should be modified to extend the list of system-wide file associations.

You may try a dirty trick, though. While file association itself in iOS works through file extensions, CAD Assistant tries to detect file format from it's content - and STEP/IFC formats are distinguishable from FILE_SCHEMA property in file header (IFC2X3 or IFC4 for IFC files). So instead of sharing an .ifc file you may try renaming it and sharing an .stp file and see if file sharing suggests / opens CAD Assistant.

andob's picture

CAD Assistant itself should be modified to extend the list of system-wide file associations.

yes, exactly

You may try a dirty trick, though.

I tried, if I open an IFC file with STEP extension, I got an error. File ... cannot be read: No suitable reader found for the file format of file. But if I open an IFC file with IFC extension, it works fine.

andob's picture

hello,

Any update on this?

CAD Assistant on iOS needs to be updated, will you be able to do this for free or do you require extra budget from our side? If you do, you can discuss with my project manager.

Kirill Gavrilov's picture

As can be deduced from the last release date on AppStore, I wouldn't expect an update soon.
Therefore, if this is important to your project or to your users - it is better contacting Open Cascade via contact form (I suppose you have been already done this and probably are waiting for reply on email).

andob's picture

Yes, a sale agent told us we can buy Technology support packets, but for what I understand from the website, their main use case is support if we integrate Open Cascade into our own app. But this is not the case here, we don't want to integrate OpenCascade, but mearly interoperate with a separate application. Are support packets an option for our use case? So can we buy support packets then ask you to modify the iOS app?

Kirill Gavrilov's picture

This forum is for technical questions - please push harder the sales agent for commercial questions.

andob's picture

ok, will do. thank you!