Search in sources :

Example 1 with IfcParameterValue

use of org.bimserver.models.ifc2x3tc1.IfcParameterValue in project BIMserver by opensourceBIM.

the class TestReadTrim method test.

@Test
public void test() {
    try {
        // Create a new BimServerClient with authentication
        BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
        // Create a new project
        SProject newProject = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc2x3tc1");
        // Get the appropriate deserializer
        SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", newProject.getOid());
        // Checkin the file
        bimServerClient.checkin(newProject.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/TestData/data/TST.ifc"));
        // Refresh project info
        newProject = bimServerClient.getServiceInterface().getProjectByPoid(newProject.getOid());
        IfcModelInterface model = bimServerClient.getModel(newProject, newProject.getLastRevisionId(), true, false);
        for (IfcTrimmedCurve ifcTrimmedCurve : model.getAllWithSubTypes(IfcTrimmedCurve.class)) {
            for (IfcTrimmingSelect ifcTrimmingSelect : ifcTrimmedCurve.getTrim1()) {
                if (ifcTrimmingSelect instanceof IfcParameterValue) {
                    IfcParameterValue ifcParameterValue = (IfcParameterValue) ifcTrimmingSelect;
                    System.out.println("Trim1: " + ifcParameterValue.getWrappedValue());
                }
            }
            for (IfcTrimmingSelect ifcTrimmingSelect : ifcTrimmedCurve.getTrim2()) {
                if (ifcTrimmingSelect instanceof IfcParameterValue) {
                    IfcParameterValue ifcParameterValue = (IfcParameterValue) ifcTrimmingSelect;
                    System.out.println("Trim2: " + ifcParameterValue.getWrappedValue());
                }
            }
        }
    } catch (Throwable e) {
        e.printStackTrace();
        if (e instanceof AssertionError) {
            throw (AssertionError) e;
        }
        fail(e.getMessage());
    }
}
Also used : SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) IfcModelInterface(org.bimserver.emf.IfcModelInterface) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) IfcTrimmedCurve(org.bimserver.models.ifc2x3tc1.IfcTrimmedCurve) IfcTrimmingSelect(org.bimserver.models.ifc2x3tc1.IfcTrimmingSelect) IfcParameterValue(org.bimserver.models.ifc2x3tc1.IfcParameterValue) SProject(org.bimserver.interfaces.objects.SProject) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)1 IfcModelInterface (org.bimserver.emf.IfcModelInterface)1 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)1 SProject (org.bimserver.interfaces.objects.SProject)1 IfcParameterValue (org.bimserver.models.ifc2x3tc1.IfcParameterValue)1 IfcTrimmedCurve (org.bimserver.models.ifc2x3tc1.IfcTrimmedCurve)1 IfcTrimmingSelect (org.bimserver.models.ifc2x3tc1.IfcTrimmingSelect)1 BimServerClientInterface (org.bimserver.plugins.services.BimServerClientInterface)1 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)1 Test (org.junit.Test)1