Search in sources :

Example 66 with BimServerClientInterface

use of org.bimserver.plugins.services.BimServerClientInterface in project BIMserver by opensourceBIM.

the class Tmp method main.

public static void main(String[] args) {
    BimServerClientInterface bimServerClient = LocalDevSetup.setupJson("http://localhost:8080");
    // Create a project
    try {
        SProject project = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc2x3tc1");
        // Look for a deserializer
        SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
        // Checkin file
        bimServerClient.checkin(project.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, Paths.get("../TestData/data/AC11-Institute-Var-2-IFC.ifc"));
        // Refresh project
        project = bimServerClient.getServiceInterface().getProjectByPoid(project.getOid());
        // Load model without lazy loading (complete model at once)
        IfcModelInterface model = bimServerClient.getModel(project, project.getLastRevisionId(), false, false);
        System.out.println(model.getAllWithSubTypes(IfcWall.class).size());
    } catch (ServerException | UserException | PublicInterfaceNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (BimServerClientException e) {
        e.printStackTrace();
    }
}
Also used : SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) ServerException(org.bimserver.shared.exceptions.ServerException) IfcModelInterface(org.bimserver.emf.IfcModelInterface) PublicInterfaceNotFoundException(org.bimserver.shared.exceptions.PublicInterfaceNotFoundException) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) UserException(org.bimserver.shared.exceptions.UserException) IOException(java.io.IOException) SProject(org.bimserver.interfaces.objects.SProject) BimServerClientException(org.bimserver.shared.exceptions.BimServerClientException)

Aggregations

BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)66 SProject (org.bimserver.interfaces.objects.SProject)57 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)46 Test (org.junit.Test)40 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)31 SSerializerPluginConfiguration (org.bimserver.interfaces.objects.SSerializerPluginConfiguration)23 IfcModelInterface (org.bimserver.emf.IfcModelInterface)20 PublicInterfaceNotFoundException (org.bimserver.shared.exceptions.PublicInterfaceNotFoundException)20 URL (java.net.URL)19 LowLevelInterface (org.bimserver.shared.interfaces.LowLevelInterface)19 IOException (java.io.IOException)16 ServiceException (org.bimserver.shared.exceptions.ServiceException)15 UserException (org.bimserver.shared.exceptions.UserException)13 ServerException (org.bimserver.shared.exceptions.ServerException)11 BimServerClientException (org.bimserver.shared.exceptions.BimServerClientException)10 Path (java.nio.file.Path)8 JsonBimServerClientFactory (org.bimserver.client.json.JsonBimServerClientFactory)7 BimServerClientFactory (org.bimserver.shared.BimServerClientFactory)7 IfcPropertySingleValue (org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue)6 File (java.io.File)4