无法运行BimServerClient的java CheckinIfcFile示例

时间:2018-06-06 08:07:24

标签: java bim

我对BIM服务器很新,目前我正在尝试创建项目并将IFC文件上传到BIM服务器。 现在我能够

1.登陆 2.创建项目 通过java代码,但我无法上传IFC文件

我尝试了以下代码,但无法上传

public class CheckinIfcFile extends GenericDemoClient {



    public static void main(String[] args) {

        new CheckinIfcFile().start();

    }

    @Override

    public void doSomethingWithClient(BimServerClient client) {

        try {

            String randomName = "Random " + new Random().nextLong();



            // Create a new project with a random name

            SProject project = client.getServiceInterface().addProject(randomName, "ifc2x3tc1");



            long poid = project.getOid();

            String comment = "This is a comment";



            // This method is an easy way to find a compatible deserializer for the combination of the "ifc" file extension and this project. You can also get a specific deserializer if you want to.

            SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", poid);



            // Make sure you change this to a path to a local IFC file

            Path demoIfcFile = Paths.get("C:\\Git\\TestFiles\\TestData\\data\\AC11-Institute-Var-2-IFC.ifc");



            // Here we actually checkin the IFC file. Flow.SYNC indicates that we only want to continue the code-flow after the checkin has been completed

            client.checkin(poid, comment, deserializer.getOid(), false, Flow.SYNC, demoIfcFile);

        } catch (ServerException e) {

            e.printStackTrace();

        } catch (UserException e) {

            e.printStackTrace();

        } catch (IOException e) {

            e.printStackTrace();

        }

    }

}

我添加了所有依赖

<dependency>
    <groupId>org.opensourcebim</groupId>
    <artifactId>bimserverclientlib</artifactId>
    <version>1.5.51</version>
</dependency>

任何指导都非常明确

0 个答案:

没有答案
相关问题