Search in sources :

Example 1 with IfcBSplineSurfaceWithKnots

use of org.bimserver.models.ifc4.IfcBSplineSurfaceWithKnots in project BIMserver by opensourceBIM.

the class TestIfc4TwoDimensional2 method test.

@Test
public void test() throws Exception {
    try (JsonBimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8080")) {
        try (BimServerClient client = factory.create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"))) {
            SProject project = client.getServiceInterface().addProject(RandomStringUtils.randomAlphanumeric(10), "ifc4");
            SDeserializerPluginConfiguration deserializer = client.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
            Path path = Paths.get("../../TestFiles/TestData/data/ifc4add2tc1/basin-advanced-brep.ifc");
            SLongCheckinActionState actionState = client.checkinSync(project.getOid(), "test", deserializer.getOid(), path, (title, progress) -> System.out.println(title + ": " + progress));
            ClientIfcModel model = client.getModel(project, actionState.getRoid(), true, false);
            List<IfcBSplineCurveWithKnots> bSplineCurves = model.getAll(IfcBSplineCurveWithKnots.class);
            Assert.assertEquals(4, bSplineCurves.size());
            for (IfcBSplineCurveWithKnots bSplineCurve : bSplineCurves) {
                Assert.assertEquals(7, bSplineCurve.getControlPointsList().size());
                for (org.bimserver.models.ifc4.IfcCartesianPoint point : bSplineCurve.getControlPointsList()) {
                    Assert.assertNotNull(point);
                    Assert.assertTrue(point.getCoordinates().size() == 2 || point.getCoordinates().size() == 3);
                }
            }
            List<IfcBSplineSurfaceWithKnots> bSplineSurfaces = model.getAll(IfcBSplineSurfaceWithKnots.class);
            Assert.assertEquals(2, bSplineSurfaces.size());
            for (IfcBSplineSurfaceWithKnots bSplineSurface : bSplineSurfaces) {
                Assert.assertEquals(4, bSplineSurface.getControlPointsList().size());
                for (ListOfIfcCartesianPoint pointList : bSplineSurface.getControlPointsList()) {
                    // This assertion fails, error seems to be in client.
                    // 1st pointlist is of size 1, 2nd of size 2 and so on
                    // with duplication of the first point's coordinates
                    Assert.assertEquals(7, pointList.getList().size());
                    for (IfcCartesianPoint point : pointList.getList()) {
                        Assert.assertNotNull(point);
                        Assert.assertEquals(3, point.getCoordinates().size());
                    }
                }
            }
        }
        Thread.sleep(500);
    }
}
Also used : Path(java.nio.file.Path) ClientIfcModel(org.bimserver.client.ClientIfcModel) SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) IfcBSplineSurfaceWithKnots(org.bimserver.models.ifc4.IfcBSplineSurfaceWithKnots) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) JsonBimServerClientFactory(org.bimserver.client.json.JsonBimServerClientFactory) SLongCheckinActionState(org.bimserver.interfaces.objects.SLongCheckinActionState) IfcCartesianPoint(org.bimserver.models.ifc4.IfcCartesianPoint) SProject(org.bimserver.interfaces.objects.SProject) BimServerClient(org.bimserver.client.BimServerClient) ListOfIfcCartesianPoint(org.bimserver.models.ifc4.ListOfIfcCartesianPoint) IfcCartesianPoint(org.bimserver.models.ifc4.IfcCartesianPoint) ListOfIfcCartesianPoint(org.bimserver.models.ifc4.ListOfIfcCartesianPoint) IfcBSplineCurveWithKnots(org.bimserver.models.ifc4.IfcBSplineCurveWithKnots) Test(org.junit.Test)

Aggregations

Path (java.nio.file.Path)1 BimServerClient (org.bimserver.client.BimServerClient)1 ClientIfcModel (org.bimserver.client.ClientIfcModel)1 JsonBimServerClientFactory (org.bimserver.client.json.JsonBimServerClientFactory)1 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)1 SLongCheckinActionState (org.bimserver.interfaces.objects.SLongCheckinActionState)1 SProject (org.bimserver.interfaces.objects.SProject)1 IfcBSplineCurveWithKnots (org.bimserver.models.ifc4.IfcBSplineCurveWithKnots)1 IfcBSplineSurfaceWithKnots (org.bimserver.models.ifc4.IfcBSplineSurfaceWithKnots)1 IfcCartesianPoint (org.bimserver.models.ifc4.IfcCartesianPoint)1 ListOfIfcCartesianPoint (org.bimserver.models.ifc4.ListOfIfcCartesianPoint)1 UsernamePasswordAuthenticationInfo (org.bimserver.shared.UsernamePasswordAuthenticationInfo)1 Test (org.junit.Test)1