Search in sources :

Example 1 with IfcWindow

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

the class CommandLine method run.

@Override
public void run() {
    reader = new BufferedReader(new InputStreamReader(System.in));
    running = true;
    try {
        while (running) {
            try {
                String line = reader.readLine();
                if (line == null) {
                    Thread.sleep(50);
                    continue;
                }
                if (line.equalsIgnoreCase("exit")) {
                    bimServer.stop();
                    return;
                } else if (line.startsWith("dumpmodel")) {
                    try {
                        long roid = Long.parseLong(line.substring(9).trim());
                        DatabaseSession databaseSession = bimServer.getDatabase().createSession();
                        try {
                            DownloadDatabaseAction downloadDatabaseAction = new DownloadDatabaseAction(bimServer, databaseSession, AccessMethod.INTERNAL, roid, -1, -1, new SystemAuthorization(1, TimeUnit.HOURS), null);
                            IfcModelInterface model = downloadDatabaseAction.execute();
                            LOGGER.info("Model size: " + model.size());
                            List<IfcWall> walls = model.getAll(IfcWall.class);
                            List<IfcProject> projects = model.getAll(IfcProject.class);
                            List<IfcSlab> slabs = model.getAll(IfcSlab.class);
                            List<IfcWindow> windows = model.getAll(IfcWindow.class);
                            LOGGER.info("Walls: " + walls.size());
                            LOGGER.info("Windows: " + windows.size());
                            LOGGER.info("Projects: " + projects.size());
                            LOGGER.info("Slabs: " + slabs.size());
                        } catch (UserException e) {
                            LOGGER.error("", e);
                        } catch (BimserverLockConflictException e) {
                            LOGGER.error("", e);
                        } catch (BimserverDatabaseException e) {
                            LOGGER.error("", e);
                        } finally {
                            databaseSession.close();
                        }
                    } catch (Exception e) {
                        LOGGER.error("", e);
                    }
                } else if (line.equalsIgnoreCase("dump")) {
                    LOGGER.info("Dumping all thread's track traces...");
                    LOGGER.info("");
                    Map<Thread, StackTraceElement[]> allStackTraces = Thread.getAllStackTraces();
                    for (Thread t : allStackTraces.keySet()) {
                        LOGGER.info(t.getName());
                        StackTraceElement[] stackTraceElements = allStackTraces.get(t);
                        for (StackTraceElement stackTraceElement : stackTraceElements) {
                            LOGGER.info("\t" + stackTraceElement.getClassName() + ":" + stackTraceElement.getLineNumber() + "." + stackTraceElement.getMethodName());
                        }
                        LOGGER.info("");
                    }
                    LOGGER.info("Done printing stack traces");
                    LOGGER.info("");
                    Thread.sleep(10000);
                } else if (line.equals("migrate")) {
                    try {
                        bimServer.getDatabase().getMigrator().migrate();
                        bimServer.getServerInfoManager().update();
                    } catch (MigrationException e) {
                        LOGGER.error("", e);
                    } catch (InconsistentModelsException e) {
                        LOGGER.error("", e);
                    }
                } else if (line.equals("clearendpoints")) {
                    bimServer.getEndPointManager().clear();
                } else if (line.startsWith("showall")) {
                    KeyValueStore keyValueStore = ((Database) bimServer.getDatabase()).getKeyValueStore();
                    Set<String> allTableNames = keyValueStore.getAllTableNames();
                    long total = 0;
                    for (String tableName : allTableNames) {
                        long size = keyValueStore.count(tableName);
                        total += size;
                        if (size != 0) {
                            LOGGER.info(tableName + " " + size);
                        }
                    }
                    LOGGER.info("total: " + total);
                } else {
                    LOGGER.info("Unknown command");
                }
            } catch (IOException e) {
                LOGGER.error("", e);
            }
        }
    } catch (InterruptedException e) {
    }
}
Also used : InconsistentModelsException(org.bimserver.database.migrations.InconsistentModelsException) Set(java.util.Set) DatabaseSession(org.bimserver.database.DatabaseSession) IfcModelInterface(org.bimserver.emf.IfcModelInterface) KeyValueStore(org.bimserver.database.KeyValueStore) SystemAuthorization(org.bimserver.webservices.authorization.SystemAuthorization) List(java.util.List) UserException(org.bimserver.shared.exceptions.UserException) DownloadDatabaseAction(org.bimserver.database.actions.DownloadDatabaseAction) IfcWall(org.bimserver.models.ifc2x3tc1.IfcWall) IfcProject(org.bimserver.models.ifc2x3tc1.IfcProject) IfcWindow(org.bimserver.models.ifc2x3tc1.IfcWindow) InputStreamReader(java.io.InputStreamReader) IOException(java.io.IOException) IOException(java.io.IOException) BimserverLockConflictException(org.bimserver.database.BimserverLockConflictException) MigrationException(org.bimserver.database.migrations.MigrationException) UserException(org.bimserver.shared.exceptions.UserException) InconsistentModelsException(org.bimserver.database.migrations.InconsistentModelsException) IfcSlab(org.bimserver.models.ifc2x3tc1.IfcSlab) MigrationException(org.bimserver.database.migrations.MigrationException) BufferedReader(java.io.BufferedReader) BimserverLockConflictException(org.bimserver.database.BimserverLockConflictException)

Example 2 with IfcWindow

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

the class Scaler method scale.

public void scale(float scale) {
    if (scale != 1.0f) {
        for (long key : ifcModel.keySet()) {
            IdEObject idEObject = (IdEObject) ifcModel.get(key);
            if (idEObject instanceof IfcAsymmetricIShapeProfileDef) {
                setIfcAsymmetricIShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcBlock) {
                setIfcBlock(idEObject, scale);
            } else if (idEObject instanceof IfcBoundingBox) {
                setIfcBoundingBox(idEObject, scale);
            } else if (idEObject instanceof IfcBuilding) {
                setIfcBuilding(idEObject, scale);
            } else if (idEObject instanceof IfcBuildingStorey) {
                setIfcBuildingStorey(idEObject, scale);
            } else if (idEObject instanceof IfcCartesianPoint) {
                setIfcCartesianPoint(idEObject, scale);
            } else if (idEObject instanceof IfcCenterLineProfileDef) {
                setIfcCenterLineProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcChamferEdgeFeature) {
                setIfcChamferEdgeFeature(idEObject, scale);
            } else if (idEObject instanceof IfcCircle) {
                setIfcCircle(idEObject, scale);
            } else if (idEObject instanceof IfcCircleHollowProfileDef) {
                setIfcCircleHollowProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcCircleProfileDef) {
                setIfcCircleProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcCraneRailAShapeProfileDef) {
                setIfcCraneRailAShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcCraneRailFShapeProfileDef) {
                setIfcCraneRailFShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcConnectionPointEccentricity) {
                setIfcConnectionPointEccentricity(idEObject, scale);
            } else if (idEObject instanceof IfcCShapeProfileDef) {
                setIfcCShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcCurveStyleFontPattern) {
                setIfcCurveStyleFontPattern(idEObject, scale);
            } else if (idEObject instanceof IfcDoor) {
                setIfcDoor(idEObject, scale);
            } else if (idEObject instanceof IfcDoorLiningProperties) {
                setIfcDoorLiningProperties(idEObject, scale);
            } else if (idEObject instanceof IfcDoorPanelProperties) {
                setIfcDoorPanelProperties(idEObject, scale);
            } else if (idEObject instanceof IfcEdgeFeature) {
                setIfcEdgeFeature(idEObject, scale);
            } else if (idEObject instanceof IfcEllipse) {
                setIfcEllipse(idEObject, scale);
            } else if (idEObject instanceof IfcEllipseProfileDef) {
                setIfcEllipseProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcExtrudedAreaSolid) {
                setIfcExtrudedAreaSolid(idEObject, scale);
            } else if (idEObject instanceof IfcGeneralProfileProperties) {
                setIfcGeneralProfileProperties(idEObject, scale);
            } else if (idEObject instanceof IfcIShapeProfileDef) {
                setIfcIShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcLightSourcePositional) {
                setIfcLightSourcePositional(idEObject, scale);
            } else if (idEObject instanceof IfcLShapeProfileDef) {
                setIfcLShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcMaterialLayer) {
                setIfcMaterialLayer(idEObject, scale);
            } else if (idEObject instanceof IfcMaterialLayerSetUsage) {
                setIfcMaterialLayerSetUsage(idEObject, scale);
            } else if (idEObject instanceof IfcMechanicalConcreteMaterialProperties) {
                setIfcMechanicalConcreteMaterialProperties(idEObject, scale);
            } else if (idEObject instanceof IfcMechanicalFastener) {
                setIfcMechanicalFastener(idEObject, scale);
            } else if (idEObject instanceof IfcOffsetCurve2D) {
                setIfcOffsetCurve2D(idEObject, scale);
            } else if (idEObject instanceof IfcOffsetCurve3D) {
                setIfcOffsetCurve3D(idEObject, scale);
            } else if (idEObject instanceof IfcPermeableCoveringProperties) {
                setIfcPermeableCoveringProperties(idEObject, scale);
            } else if (idEObject instanceof IfcPlanarExtent) {
                setIfcPlanarExtent(idEObject, scale);
            } else if (idEObject instanceof IfcQuantityLength) {
                setIfcQuantityLength(idEObject, scale);
            } else if (idEObject instanceof IfcRectangleHollowProfileDef) {
                setIfcRectangleHollowProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcRectangleProfileDef) {
                setIfcRectangleProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcRectangularPyramid) {
                setIfcRectangularPyramid(idEObject, scale);
            } else if (idEObject instanceof IfcReinforcementBarProperties) {
                setIfcReinforcementBarProperties(idEObject, scale);
            } else if (idEObject instanceof IfcReinforcingBar) {
                setIfcReinforcingBar(idEObject, scale);
            } else if (idEObject instanceof IfcReinforcingMesh) {
                setIfcReinforcingMesh(idEObject, scale);
            } else if (idEObject instanceof IfcRelConnectsStructuralMember) {
                setIfcRelConnectsStructuralMember(idEObject, scale);
            } else if (idEObject instanceof IfcRibPlateProfileProperties) {
                setIfcRibPlateProfileProperties(idEObject, scale);
            } else if (idEObject instanceof IfcRightCircularCone) {
                setIfcRightCircularCone(idEObject, scale);
            } else if (idEObject instanceof IfcRightCircularCylinder) {
                setIfcRightCircularCylinder(idEObject, scale);
            } else if (idEObject instanceof IfcRoundedEdgeFeature) {
                setIfcRoundedEdgeFeature(idEObject, scale);
            } else if (idEObject instanceof IfcRoundedRectangleProfileDef) {
                setIfcRoundedRectangleProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcSectionReinforcementProperties) {
                setIfcSectionReinforcementProperties(idEObject, scale);
            } else if (idEObject instanceof IfcSite) {
                setIfcSite(idEObject, scale);
            } else if (idEObject instanceof IfcSlippageConnectionCondition) {
                setIfcSlippageConnectionCondition(idEObject, scale);
            } else if (idEObject instanceof IfcSpace) {
                setIfcSpace(idEObject, scale);
            } else if (idEObject instanceof IfcSphere) {
                setIfcSphere(idEObject, scale);
            } else if (idEObject instanceof IfcStairFlight) {
                setIfcStairFlight(idEObject, scale);
            } else if (idEObject instanceof IfcStructuralLoadSingleDisplacement) {
                setIfcStructuralLoadSingleDisplacement(idEObject, scale);
            } else if (idEObject instanceof IfcStructuralProfileProperties) {
                setIfcStructuralProfileProperties(idEObject, scale);
            } else if (idEObject instanceof IfcStructuralSurfaceMember) {
                setIfcStructuralSurfaceMember(idEObject, scale);
            } else if (idEObject instanceof IfcStructuralSurfaceMemberVarying) {
                setIfcStructuralSurfaceMemberVarying(idEObject, scale);
            } else if (idEObject instanceof IfcSurfaceOfLinearExtrusion) {
                setIfcSurfaceOfLinearExtrusion(idEObject, scale);
            } else if (idEObject instanceof IfcSweptDiskSolid) {
                setIfcSweptDiskSolid(idEObject, scale);
            } else if (idEObject instanceof IfcTendon) {
                setIfcTendon(idEObject, scale);
            } else if (idEObject instanceof IfcTextStyleWithBoxCharacteristics) {
                setIfcTextStyleWithBoxCharacteristics(idEObject, scale);
            } else if (idEObject instanceof IfcTrapeziumProfileDef) {
                setIfcTrapeziumProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcTShapeProfileDef) {
                setIfcTShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcUShapeProfileDef) {
                setIfcUShapeProfileDef(idEObject, scale);
            } else if (idEObject instanceof IfcVector) {
                setIfcVector(idEObject, scale);
            } else if (idEObject instanceof IfcVirtualGridIntersection) {
                setIfcVirtualGridIntersection(idEObject, scale);
            } else if (idEObject instanceof IfcWindow) {
                setIfcWindow(idEObject, scale);
            } else if (idEObject instanceof IfcWindowLiningProperties) {
                setIfcWindowLiningProperties(idEObject, scale);
            } else if (idEObject instanceof IfcWindowPanelProperties) {
                setIfcWindowPanelProperties(idEObject, scale);
            } else if (idEObject instanceof IfcZShapeProfileDef) {
                setIfcZShapeProfileDef(idEObject, scale);
            }
            setDoubleAsStringValues(idEObject);
        }
    }
}
Also used : IfcCenterLineProfileDef(org.bimserver.models.ifc2x3tc1.IfcCenterLineProfileDef) IfcCircleHollowProfileDef(org.bimserver.models.ifc2x3tc1.IfcCircleHollowProfileDef) IfcQuantityLength(org.bimserver.models.ifc2x3tc1.IfcQuantityLength) IfcStructuralSurfaceMember(org.bimserver.models.ifc2x3tc1.IfcStructuralSurfaceMember) IfcReinforcementBarProperties(org.bimserver.models.ifc2x3tc1.IfcReinforcementBarProperties) IfcStairFlight(org.bimserver.models.ifc2x3tc1.IfcStairFlight) IfcRibPlateProfileProperties(org.bimserver.models.ifc2x3tc1.IfcRibPlateProfileProperties) IfcUShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcUShapeProfileDef) IfcCraneRailAShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcCraneRailAShapeProfileDef) IfcRectangleHollowProfileDef(org.bimserver.models.ifc2x3tc1.IfcRectangleHollowProfileDef) IfcStructuralSurfaceMemberVarying(org.bimserver.models.ifc2x3tc1.IfcStructuralSurfaceMemberVarying) IfcMaterialLayer(org.bimserver.models.ifc2x3tc1.IfcMaterialLayer) IfcCraneRailFShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcCraneRailFShapeProfileDef) IfcRightCircularCylinder(org.bimserver.models.ifc2x3tc1.IfcRightCircularCylinder) IfcExtrudedAreaSolid(org.bimserver.models.ifc2x3tc1.IfcExtrudedAreaSolid) IfcBuilding(org.bimserver.models.ifc2x3tc1.IfcBuilding) IfcCircle(org.bimserver.models.ifc2x3tc1.IfcCircle) IfcSurfaceOfLinearExtrusion(org.bimserver.models.ifc2x3tc1.IfcSurfaceOfLinearExtrusion) IfcCShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcCShapeProfileDef) IfcTextStyleWithBoxCharacteristics(org.bimserver.models.ifc2x3tc1.IfcTextStyleWithBoxCharacteristics) IdEObject(org.bimserver.emf.IdEObject) IfcRightCircularCone(org.bimserver.models.ifc2x3tc1.IfcRightCircularCone) IfcWindowPanelProperties(org.bimserver.models.ifc2x3tc1.IfcWindowPanelProperties) IfcLightSourcePositional(org.bimserver.models.ifc2x3tc1.IfcLightSourcePositional) IfcConnectionPointEccentricity(org.bimserver.models.ifc2x3tc1.IfcConnectionPointEccentricity) IfcRectangularPyramid(org.bimserver.models.ifc2x3tc1.IfcRectangularPyramid) IfcTendon(org.bimserver.models.ifc2x3tc1.IfcTendon) IfcReinforcingMesh(org.bimserver.models.ifc2x3tc1.IfcReinforcingMesh) IfcCircleProfileDef(org.bimserver.models.ifc2x3tc1.IfcCircleProfileDef) IfcZShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcZShapeProfileDef) IfcEllipseProfileDef(org.bimserver.models.ifc2x3tc1.IfcEllipseProfileDef) IfcBoundingBox(org.bimserver.models.ifc2x3tc1.IfcBoundingBox) IfcIShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcIShapeProfileDef) IfcVirtualGridIntersection(org.bimserver.models.ifc2x3tc1.IfcVirtualGridIntersection) IfcAsymmetricIShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcAsymmetricIShapeProfileDef) IfcRelConnectsStructuralMember(org.bimserver.models.ifc2x3tc1.IfcRelConnectsStructuralMember) IfcDoorPanelProperties(org.bimserver.models.ifc2x3tc1.IfcDoorPanelProperties) IfcOffsetCurve2D(org.bimserver.models.ifc2x3tc1.IfcOffsetCurve2D) IfcChamferEdgeFeature(org.bimserver.models.ifc2x3tc1.IfcChamferEdgeFeature) IfcMechanicalFastener(org.bimserver.models.ifc2x3tc1.IfcMechanicalFastener) IfcRectangleProfileDef(org.bimserver.models.ifc2x3tc1.IfcRectangleProfileDef) IfcRoundedRectangleProfileDef(org.bimserver.models.ifc2x3tc1.IfcRoundedRectangleProfileDef) IfcSpace(org.bimserver.models.ifc2x3tc1.IfcSpace) IfcBlock(org.bimserver.models.ifc2x3tc1.IfcBlock) IfcLShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcLShapeProfileDef) IfcTrapeziumProfileDef(org.bimserver.models.ifc2x3tc1.IfcTrapeziumProfileDef) IfcSweptDiskSolid(org.bimserver.models.ifc2x3tc1.IfcSweptDiskSolid) IfcWindowLiningProperties(org.bimserver.models.ifc2x3tc1.IfcWindowLiningProperties) IfcBuildingStorey(org.bimserver.models.ifc2x3tc1.IfcBuildingStorey) IfcDoor(org.bimserver.models.ifc2x3tc1.IfcDoor) IfcDoorLiningProperties(org.bimserver.models.ifc2x3tc1.IfcDoorLiningProperties) IfcMaterialLayerSetUsage(org.bimserver.models.ifc2x3tc1.IfcMaterialLayerSetUsage) IfcTShapeProfileDef(org.bimserver.models.ifc2x3tc1.IfcTShapeProfileDef) IfcCurveStyleFontPattern(org.bimserver.models.ifc2x3tc1.IfcCurveStyleFontPattern) IfcSlippageConnectionCondition(org.bimserver.models.ifc2x3tc1.IfcSlippageConnectionCondition) IfcSite(org.bimserver.models.ifc2x3tc1.IfcSite) IfcWindow(org.bimserver.models.ifc2x3tc1.IfcWindow) IfcReinforcingBar(org.bimserver.models.ifc2x3tc1.IfcReinforcingBar) IfcEdgeFeature(org.bimserver.models.ifc2x3tc1.IfcEdgeFeature) IfcGeneralProfileProperties(org.bimserver.models.ifc2x3tc1.IfcGeneralProfileProperties) IfcPermeableCoveringProperties(org.bimserver.models.ifc2x3tc1.IfcPermeableCoveringProperties) IfcRoundedEdgeFeature(org.bimserver.models.ifc2x3tc1.IfcRoundedEdgeFeature) IfcVector(org.bimserver.models.ifc2x3tc1.IfcVector) IfcStructuralProfileProperties(org.bimserver.models.ifc2x3tc1.IfcStructuralProfileProperties) IfcOffsetCurve3D(org.bimserver.models.ifc2x3tc1.IfcOffsetCurve3D) IfcStructuralLoadSingleDisplacement(org.bimserver.models.ifc2x3tc1.IfcStructuralLoadSingleDisplacement) IfcSphere(org.bimserver.models.ifc2x3tc1.IfcSphere) IfcPlanarExtent(org.bimserver.models.ifc2x3tc1.IfcPlanarExtent) IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint) IfcMechanicalConcreteMaterialProperties(org.bimserver.models.ifc2x3tc1.IfcMechanicalConcreteMaterialProperties) IfcEllipse(org.bimserver.models.ifc2x3tc1.IfcEllipse) IfcSectionReinforcementProperties(org.bimserver.models.ifc2x3tc1.IfcSectionReinforcementProperties)

Example 3 with IfcWindow

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

the class TestCreateProperties method test.

@Test
public void test() {
    try {
        // New client
        BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
        // Create a project
        SProject project = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc2x3tc1");
        // Look for a deserializer
        SDeserializerPluginConfiguration deserializer = bimServerClient.getServiceInterface().getSuggestedDeserializerForExtension("ifc", project.getOid());
        bimServerClient.checkin(project.getOid(), "test", deserializer.getOid(), false, Flow.SYNC, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/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(), true, true);
        String propertyName = "BooleanProperty";
        int nrWindowsFirst = 0;
        // Iterate over all projects, there should be 1
        for (IfcWindow window : model.getAllWithSubTypes(IfcWindow.class)) {
            nrWindowsFirst++;
            createProperty(window, model, propertyName, "Description of property", true);
        }
        long newRoid = model.commit("Added boolean properties to " + nrWindowsFirst + " windows");
        model = bimServerClient.getModel(project, newRoid, true, false);
        int foundOke = 0;
        int nrWindowsSecond = 0;
        Set<Long> counted = new HashSet<Long>();
        for (IfcWindow window : model.getAllWithSubTypes(IfcWindow.class)) {
            nrWindowsSecond++;
            for (IfcRelDefines ifcRelDefines : window.getIsDefinedBy()) {
                if (ifcRelDefines instanceof IfcRelDefinesByProperties) {
                    IfcRelDefinesByProperties ifcRelDefinesByProperties = (IfcRelDefinesByProperties) ifcRelDefines;
                    IfcPropertySetDefinition relatingPropertyDefinition = ifcRelDefinesByProperties.getRelatingPropertyDefinition();
                    if (relatingPropertyDefinition instanceof IfcPropertySet) {
                        IfcPropertySet ifcPropertySet = (IfcPropertySet) relatingPropertyDefinition;
                        for (IfcProperty ifcProperty : ifcPropertySet.getHasProperties()) {
                            if (ifcProperty instanceof IfcPropertySingleValue) {
                                IfcPropertySingleValue ifcPropertySingleValue = (IfcPropertySingleValue) ifcProperty;
                                if (ifcPropertySingleValue.getName().equals(propertyName)) {
                                    IfcValue nominalValue = ifcPropertySingleValue.getNominalValue();
                                    if (nominalValue instanceof IfcBoolean) {
                                        if (((IfcBoolean) nominalValue).getWrappedValue() == Tristate.TRUE) {
                                            if (!counted.contains(ifcPropertySingleValue.getOid())) {
                                                foundOke++;
                                                counted.add(ifcPropertySingleValue.getOid());
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        LOGGER.info("Windows first: " + nrWindowsFirst);
        LOGGER.info("Windows second: " + nrWindowsSecond);
        LOGGER.info("Found Oke: " + foundOke);
        if (foundOke != nrWindowsFirst) {
            fail(foundOke + " / " + nrWindowsFirst);
        }
    } catch (Throwable e) {
        e.printStackTrace();
        fail(e.getMessage());
    }
}
Also used : IfcValue(org.bimserver.models.ifc2x3tc1.IfcValue) IfcProperty(org.bimserver.models.ifc2x3tc1.IfcProperty) IfcPropertySingleValue(org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue) SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) IfcWindow(org.bimserver.models.ifc2x3tc1.IfcWindow) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) IfcModelInterface(org.bimserver.emf.IfcModelInterface) SProject(org.bimserver.interfaces.objects.SProject) IfcRelDefinesByProperties(org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties) URL(java.net.URL) IfcRelDefines(org.bimserver.models.ifc2x3tc1.IfcRelDefines) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) IfcPropertySet(org.bimserver.models.ifc2x3tc1.IfcPropertySet) IfcPropertySetDefinition(org.bimserver.models.ifc2x3tc1.IfcPropertySetDefinition) HashSet(java.util.HashSet) IfcBoolean(org.bimserver.models.ifc2x3tc1.IfcBoolean) Test(org.junit.Test)

Example 4 with IfcWindow

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

the class TestCreateProperties method createProperty.

private void createProperty(IfcWindow window, IfcModelInterface model, String name, String description, Object value) throws IfcModelInterfaceException {
    IfcRelDefinesByProperties ifcRelDefinesByProperties = model.create(IfcRelDefinesByProperties.class);
    window.getIsDefinedBy().add(ifcRelDefinesByProperties);
    IfcPropertySet propertySet = model.create(IfcPropertySet.class);
    ifcRelDefinesByProperties.setRelatingPropertyDefinition(propertySet);
    IfcPropertySingleValue property = model.create(IfcPropertySingleValue.class);
    propertySet.getHasProperties().add(property);
    property.setName(name);
    property.setDescription(description);
    if (value instanceof Boolean) {
        IfcBoolean ifcValue = model.create(IfcBoolean.class);
        ifcValue.setWrappedValue(((Boolean) value) ? Tristate.TRUE : Tristate.FALSE);
        property.setNominalValue(ifcValue);
    } else {
    // Unimplemented
    }
}
Also used : IfcPropertySingleValue(org.bimserver.models.ifc2x3tc1.IfcPropertySingleValue) IfcRelDefinesByProperties(org.bimserver.models.ifc2x3tc1.IfcRelDefinesByProperties) IfcBoolean(org.bimserver.models.ifc2x3tc1.IfcBoolean) IfcPropertySet(org.bimserver.models.ifc2x3tc1.IfcPropertySet) IfcBoolean(org.bimserver.models.ifc2x3tc1.IfcBoolean)

Example 5 with IfcWindow

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

the class TestLoadCompleteModel method start.

@Test
public void start() {
    try {
        // New client
        BimServerClientInterface bimServerClient = getFactory().create(new UsernamePasswordAuthenticationInfo("admin@bimserver.org", "admin"));
        // Create a project
        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, new URL("https://github.com/opensourceBIM/TestFiles/raw/master/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, true);
        // Change the window names
        for (IfcWindow window : model.getAllWithSubTypes(IfcWindow.class)) {
            window.setName(window.getName() + " Changed");
        }
        long newRoid = model.commit("Changed window names");
        IfcModelInterface newModel = bimServerClient.getModel(project, newRoid, true, false);
        List<IfcWindow> windows = newModel.getAllWithSubTypes(Ifc2x3tc1Package.eINSTANCE.getIfcWindow());
        for (IfcWindow window : windows) {
            assertTrue(window.getName().endsWith(" Changed"));
        }
    } catch (Exception e) {
        fail(e.getMessage());
    }
}
Also used : SDeserializerPluginConfiguration(org.bimserver.interfaces.objects.SDeserializerPluginConfiguration) IfcWindow(org.bimserver.models.ifc2x3tc1.IfcWindow) UsernamePasswordAuthenticationInfo(org.bimserver.shared.UsernamePasswordAuthenticationInfo) IfcModelInterface(org.bimserver.emf.IfcModelInterface) BimServerClientInterface(org.bimserver.plugins.services.BimServerClientInterface) SProject(org.bimserver.interfaces.objects.SProject) URL(java.net.URL) Test(org.junit.Test)

Aggregations

IfcWindow (org.bimserver.models.ifc2x3tc1.IfcWindow)4 IfcModelInterface (org.bimserver.emf.IfcModelInterface)3 URL (java.net.URL)2 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)2 SProject (org.bimserver.interfaces.objects.SProject)2 IfcBoolean (org.bimserver.models.ifc2x3tc1.IfcBoolean)2 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 BimserverLockConflictException (org.bimserver.database.BimserverLockConflictException)1 DatabaseSession (org.bimserver.database.DatabaseSession)1 KeyValueStore (org.bimserver.database.KeyValueStore)1 DownloadDatabaseAction (org.bimserver.database.actions.DownloadDatabaseAction)1 InconsistentModelsException (org.bimserver.database.migrations.InconsistentModelsException)1 MigrationException (org.bimserver.database.migrations.MigrationException)1 IdEObject (org.bimserver.emf.IdEObject)1 IfcAsymmetricIShapeProfileDef (org.bimserver.models.ifc2x3tc1.IfcAsymmetricIShapeProfileDef)1