Issue in executing the api methods in Solibri w.r.t openModel and saveModel not working in the same file

Viewed 6

The code below is written to a public class that is intended to be executed in another class that implements the Views interface in Solibri, but while executing the code, it does not execute the last two methods that have been created. If somebody knows what the problem is can they please mention how to resolve it ? The api methods are all w.r.t to Solibri and I have not been able to debug the error myself

public static void openInSolibri() throws IOException {
        String name = "Solibri Building.smc";
        FileInputStream fis = new FileInputStream(
                "C:\\Users\\Public\\Solibri\\SOLIBRI\\Samples\\models\\Solibri Building.smc");
        BufferedInputStream bis = new BufferedInputStream(fis);
        
        SMC.openModel(name, bis);
        
    }

    // method to update IFC models
    public static void updateModels() throws FileNotFoundException, IOException {

        String filename = "C:\\Users\\Public\\Solibri\\SOLIBRI\\Samples\\models\\Solibri Building.smc";
        try (InputStream inputStream = new FileInputStream(filename);) {
            UUID uuid = SMC.getModel().getUUID();
            SMC.getModels().updateIFCModel(uuid, inputStream);

        }
    }

    // method to run checks
    public static void runChecks() {
        SMC.getChecking().runChecking(false);
    }

    
    //method to export bcfxml content
    public static void exportBcf() throws FileNotFoundException {
        FileOutputStream fos = new FileOutputStream(new File("C:\\Solibri Model\\myFile.bcf"));
        SMC.getBcfXml().exportBcfXml(BcfVersion.V2_1, BcfScope.ALL, fos);

    }
    
    //method to save the model
    public static void saveSMC() {
        Path path = Paths.get("C:\\Solibri Model\\Solibri Building.smc");
        SMC.saveModel(path);
    }
0 Answers
Related