Search in sources :

Example 1 with IfcCartesianPoint

use of org.bimserver.models.ifc2x3tc1.IfcCartesianPoint 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 2 with IfcCartesianPoint

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

the class IfcTools2D method curveToPath.

private static Path2D.Float curveToPath(double[] matrix, IfcCurve outerCurve, double multiplierMillimeters) {
    Path2D.Float path2d = new Path2D.Float();
    if (outerCurve instanceof IfcPolyline) {
        IfcPolyline ifcPolyline = (IfcPolyline) outerCurve;
        IfcCartesianPoint first = ifcPolyline.getPoints().get(0);
        double[] res = new double[4];
        Matrix.multiplyMV(res, 0, matrix, 0, new double[] { first.getCoordinates().get(0), first.getCoordinates().get(1), 0, 1 }, 0);
        path2d.moveTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
        for (IfcCartesianPoint cartesianPoint : ifcPolyline.getPoints()) {
            EList<Double> coords = cartesianPoint.getCoordinates();
            Matrix.multiplyMV(res, 0, matrix, 0, new double[] { coords.get(0), coords.get(1), 0, 1 }, 0);
            path2d.lineTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
        }
        path2d.closePath();
        return path2d;
    }
    return null;
}
Also used : Path2D(java.awt.geom.Path2D) IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint) IfcPolyline(org.bimserver.models.ifc2x3tc1.IfcPolyline)

Example 3 with IfcCartesianPoint

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

the class RichIfcModel method createIfcCartesianPoint.

public IfcCartesianPoint createIfcCartesianPoint(double i, double j, double k) throws IfcModelInterfaceException {
    IfcCartesianPoint ifcCartesianPoint = create(IfcCartesianPoint.class);
    EList<Double> coordinates = ifcCartesianPoint.getCoordinates();
    coordinates.add(i);
    coordinates.add(j);
    coordinates.add(k);
    return ifcCartesianPoint;
}
Also used : IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint)

Example 4 with IfcCartesianPoint

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

the class AddFurniture method main.

public static void main(String[] args) {
    try {
        PluginManager pluginManager = LocalDevPluginLoader.createPluginManager(Paths.get("home"));
        DeserializerPlugin deserializerPlugin = pluginManager.getFirstDeserializer("ifc", Schema.IFC2X3TC1, true);
        Deserializer deserializer = deserializerPlugin.createDeserializer(null);
        deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
        IfcModelInterface model = DeserializerUtils.readFromFile(deserializer, Paths.get("../TestData/data/AC9R1-Haus-G-H-Ver2-2x3.ifc"));
        deserializer = deserializerPlugin.createDeserializer(null);
        deserializer.init(pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1"));
        IfcModelInterface furnishingModel = DeserializerUtils.readFromFile(deserializer, Paths.get("test.ifc"));
        model.fixOids(new IncrementingOidProvider());
        long oid = model.getHighestOid();
        IncrementingOidProvider oidProvider = new IncrementingOidProvider(oid + 1);
        IfcFurnishingElement picknick = (IfcFurnishingElement) furnishingModel.getByName(Ifc2x3tc1Package.eINSTANCE.getIfcFurnishingElement(), "Picknik Bank");
        ModelHelper modelHelper = new ModelHelper(pluginManager.getMetaDataManager(), new HideAllInversesObjectIDM(CollectionUtils.singleSet(Ifc2x3tc1Package.eINSTANCE), pluginManager.getMetaDataManager().getPackageMetaData("ifc2x3tc1")), model);
        IfcProductDefinitionShape representation = (IfcProductDefinitionShape) picknick.getRepresentation();
        IfcRepresentation surfaceModel = null;
        IfcRepresentation boundingBox = null;
        for (IfcRepresentation ifcRepresentation : representation.getRepresentations()) {
            IfcShapeRepresentation ifcShapeRepresentation = (IfcShapeRepresentation) ifcRepresentation;
            if (ifcShapeRepresentation.getRepresentationType().equals("SurfaceModel")) {
                surfaceModel = (IfcRepresentation) modelHelper.copy(ifcShapeRepresentation, false);
            } else if (ifcShapeRepresentation.getRepresentationType().equals("BoundingBox")) {
                boundingBox = (IfcRepresentation) modelHelper.copy(ifcShapeRepresentation, false);
            }
        }
        IfcOwnerHistory ownerHistory = null;
        List<IfcOwnerHistory> all = model.getAll(IfcOwnerHistory.class);
        if (all.size() > 0) {
            ownerHistory = all.get(0);
        }
        for (IfcBuildingStorey ifcBuildingStorey : model.getAll(IfcBuildingStorey.class)) {
            for (IfcRelDecomposes ifcRelDecomposes : ifcBuildingStorey.getIsDecomposedBy()) {
                for (IfcObjectDefinition ifcObjectDefinition : ifcRelDecomposes.getRelatedObjects()) {
                    if (ifcObjectDefinition instanceof IfcSpace) {
                        IfcSpace ifcSpace = (IfcSpace) ifcObjectDefinition;
                        // IfcProductDefinitionShape slabRepr = (IfcProductDefinitionShape) ifcSpace.getRepresentation();
                        // IfcBoundingBox box = null;
                        // for (IfcRepresentation representation2 : slabRepr.getRepresentations()) {
                        // IfcShapeRepresentation shapeRepresentation = (IfcShapeRepresentation)representation2;
                        // if (shapeRepresentation.getRepresentationType().equals("BoundingBox")) {
                        // for (IfcRepresentationItem i2 : shapeRepresentation.getItems()) {
                        // box = (IfcBoundingBox)i2;
                        // }
                        // }
                        // }
                        IfcFurnishingElement newFurnishing = model.create(IfcFurnishingElement.class, oidProvider);
                        IfcRelContainedInSpatialStructure containedInSpatialStructure2 = model.create(IfcRelContainedInSpatialStructure.class, oidProvider);
                        containedInSpatialStructure2.setRelatingStructure(ifcBuildingStorey);
                        containedInSpatialStructure2.getRelatedElements().add(newFurnishing);
                        newFurnishing.setName("Generated");
                        newFurnishing.setGlobalId("TEST");
                        newFurnishing.setOwnerHistory(ownerHistory);
                        IfcProductDefinitionShape definitionShape = model.create(IfcProductDefinitionShape.class, oidProvider);
                        newFurnishing.setRepresentation(definitionShape);
                        definitionShape.getRepresentations().add(boundingBox);
                        definitionShape.getRepresentations().add(surfaceModel);
                        IfcLocalPlacement localPlacement = model.create(IfcLocalPlacement.class, oidProvider);
                        localPlacement.setPlacementRelTo(ifcSpace.getObjectPlacement());
                        IfcAxis2Placement3D axis2Placement3D = model.create(IfcAxis2Placement3D.class, oidProvider);
                        localPlacement.setRelativePlacement(axis2Placement3D);
                        IfcCartesianPoint pos = model.create(IfcCartesianPoint.class, oidProvider);
                        pos.getCoordinates().add(-3d);
                        pos.getCoordinates().add(+0.5d);
                        pos.getCoordinates().add(0d);
                        axis2Placement3D.setLocation(pos);
                        newFurnishing.setObjectPlacement(localPlacement);
                    }
                }
            }
        }
        model.resetExpressIds();
        SerializerPlugin serializerPlugin = pluginManager.getSerializerPlugin("org.bimserver.ifc.step.serializer.IfcStepSerializerPlugin", true);
        Serializer serializer = serializerPlugin.createSerializer(null);
        serializer.init(model, null, true);
        SerializerUtils.writeToFile(serializer, Paths.get("withfurn.ifc"));
    } catch (PluginException e) {
        e.printStackTrace();
    } catch (DeserializeException e) {
        e.printStackTrace();
    } catch (IfcModelInterfaceException e) {
        e.printStackTrace();
    } catch (SerializerException e) {
        e.printStackTrace();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : IfcModelInterface(org.bimserver.emf.IfcModelInterface) IfcObjectDefinition(org.bimserver.models.ifc2x3tc1.IfcObjectDefinition) IfcSpace(org.bimserver.models.ifc2x3tc1.IfcSpace) FileNotFoundException(java.io.FileNotFoundException) IfcOwnerHistory(org.bimserver.models.ifc2x3tc1.IfcOwnerHistory) PluginManager(org.bimserver.plugins.PluginManager) IfcModelInterfaceException(org.bimserver.emf.IfcModelInterfaceException) IfcProductDefinitionShape(org.bimserver.models.ifc2x3tc1.IfcProductDefinitionShape) IfcAxis2Placement3D(org.bimserver.models.ifc2x3tc1.IfcAxis2Placement3D) IfcLocalPlacement(org.bimserver.models.ifc2x3tc1.IfcLocalPlacement) IncrementingOidProvider(org.bimserver.shared.IncrementingOidProvider) IfcShapeRepresentation(org.bimserver.models.ifc2x3tc1.IfcShapeRepresentation) IfcRepresentation(org.bimserver.models.ifc2x3tc1.IfcRepresentation) IfcBuildingStorey(org.bimserver.models.ifc2x3tc1.IfcBuildingStorey) Serializer(org.bimserver.plugins.serializers.Serializer) ModelHelper(org.bimserver.plugins.ModelHelper) IfcFurnishingElement(org.bimserver.models.ifc2x3tc1.IfcFurnishingElement) PluginException(org.bimserver.shared.exceptions.PluginException) DeserializerPlugin(org.bimserver.plugins.deserializers.DeserializerPlugin) SerializerPlugin(org.bimserver.plugins.serializers.SerializerPlugin) DeserializeException(org.bimserver.plugins.deserializers.DeserializeException) IOException(java.io.IOException) SerializerException(org.bimserver.plugins.serializers.SerializerException) IfcRelDecomposes(org.bimserver.models.ifc2x3tc1.IfcRelDecomposes) Deserializer(org.bimserver.plugins.deserializers.Deserializer) HideAllInversesObjectIDM(org.bimserver.plugins.objectidms.HideAllInversesObjectIDM) IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint) IfcRelContainedInSpatialStructure(org.bimserver.models.ifc2x3tc1.IfcRelContainedInSpatialStructure)

Example 5 with IfcCartesianPoint

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

the class IfcTools2D method getArea.

private Area getArea(double multiplierMillimeters, double[] productMatrix, IfcRepresentationItem ifcRepresentationItem) {
    if (ifcRepresentationItem instanceof IfcExtrudedAreaSolid) {
        IfcExtrudedAreaSolid ifcExtrudedAreaSolid = (IfcExtrudedAreaSolid) ifcRepresentationItem;
        IfcAxis2Placement3D position = ifcExtrudedAreaSolid.getPosition();
        // 1 0 0 0 <- 3de argument
        // 0 1 0 0 <- cross product van 2 en 3 (levert ortogonale vector op)
        // 0 0 1 0 <- 2st argument
        // 5 0 0 1 <- 1st argument
        double[] matrix = placement3DToMatrix(position);
        if (productMatrix != null) {
            double[] rhs = matrix;
            matrix = Matrix.identity();
            Matrix.multiplyMM(matrix, 0, productMatrix, 0, rhs, 0);
        }
        IfcDirection extrudedDirection = ifcExtrudedAreaSolid.getExtrudedDirection();
        // TODO do something with this
        IfcProfileDef ifcProfileDef = ifcExtrudedAreaSolid.getSweptArea();
        if (ifcProfileDef instanceof IfcArbitraryProfileDefWithVoids) {
            IfcArbitraryProfileDefWithVoids ifcArbitraryProfileDefWithVoids = (IfcArbitraryProfileDefWithVoids) ifcProfileDef;
            IfcCurve outerCurve = ifcArbitraryProfileDefWithVoids.getOuterCurve();
            Path2D outerPath = null;
            if (outerCurve instanceof IfcPolyline) {
                outerPath = curveToPath(matrix, outerCurve, multiplierMillimeters);
            } else {
                storeUnimplemented(outerCurve);
            }
            if (outerPath != null) {
                Area area = new Area(outerPath);
                for (IfcCurve innerCurve : ifcArbitraryProfileDefWithVoids.getInnerCurves()) {
                    Path2D.Float innerPath = curveToPath(matrix, innerCurve, multiplierMillimeters);
                    if (innerPath != null) {
                        area.subtract(new Area(innerPath));
                    }
                }
                return area;
            }
        } else if (ifcProfileDef instanceof IfcArbitraryClosedProfileDef) {
            IfcArbitraryClosedProfileDef ifcArbitraryClosedProfileDef = (IfcArbitraryClosedProfileDef) ifcProfileDef;
            Path2D.Float path2d = new Path2D.Float();
            IfcCurve outerCurve = ifcArbitraryClosedProfileDef.getOuterCurve();
            boolean first = true;
            if (outerCurve instanceof IfcPolyline) {
                IfcPolyline ifcPolyline = (IfcPolyline) outerCurve;
                double[] res = new double[4];
                int i = 0;
                for (IfcCartesianPoint cartesianPoint : ifcPolyline.getPoints()) {
                    EList<Double> coords = cartesianPoint.getCoordinates();
                    Matrix.multiplyMV(res, 0, matrix, 0, new double[] { coords.get(0), coords.get(1), 0, 1 }, 0);
                    if (first) {
                        path2d.moveTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
                        first = false;
                    } else {
                        if (i > 1) {
                        }
                        path2d.lineTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
                    }
                    i++;
                }
                path2d.closePath();
                return new Area(path2d);
            } else if (outerCurve instanceof IfcCompositeCurve) {
                IfcCompositeCurve ifcCompositeCurve = (IfcCompositeCurve) outerCurve;
                for (IfcCompositeCurveSegment ifcCompositeCurveSegment : ifcCompositeCurve.getSegments()) {
                    IfcCurve curve = ifcCompositeCurveSegment.getParentCurve();
                    if (curve instanceof IfcPolyline) {
                        IfcPolyline ifcPolyline = (IfcPolyline) curve;
                        double[] res = new double[4];
                        for (IfcCartesianPoint cartesianPoint : ifcPolyline.getPoints()) {
                            EList<Double> coords = cartesianPoint.getCoordinates();
                            Matrix.multiplyMV(res, 0, matrix, 0, new double[] { coords.get(0), coords.get(1), 0, 1 }, 0);
                            if (first) {
                                path2d.moveTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
                                first = false;
                            } else {
                                path2d.lineTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
                            }
                        }
                    } else if (curve instanceof IfcTrimmedCurve) {
                        storeUnimplemented(curve);
                    } else {
                        storeUnimplemented(curve);
                    }
                }
                try {
                    path2d.closePath();
                    return new Area(path2d);
                } catch (Exception e) {
                // 
                }
            }
        } else if (ifcProfileDef instanceof IfcRectangleProfileDef) {
            IfcRectangleProfileDef ifcRectangleProfileDef = (IfcRectangleProfileDef) ifcProfileDef;
            double[] min = new double[] { ifcRectangleProfileDef.getPosition().getLocation().getCoordinates().get(0) - ifcRectangleProfileDef.getXDim() / 2, ifcRectangleProfileDef.getPosition().getLocation().getCoordinates().get(1) - ifcRectangleProfileDef.getYDim() / 2, 0, 1 };
            double[] max = new double[] { ifcRectangleProfileDef.getPosition().getLocation().getCoordinates().get(0) + ifcRectangleProfileDef.getXDim() / 2, ifcRectangleProfileDef.getPosition().getLocation().getCoordinates().get(1) + ifcRectangleProfileDef.getYDim() / 2, 0, 1 };
            Cube cube = new Cube(min, max);
            cube.transform(matrix);
            double[] transformedMin = cube.getMin();
            double[] transformedMax = cube.getMax();
            Path2D.Float path2d = new Path2D.Float();
            path2d.moveTo(transformedMin[0] * multiplierMillimeters, transformedMin[1] * multiplierMillimeters);
            path2d.lineTo(transformedMax[0] * multiplierMillimeters, transformedMin[1] * multiplierMillimeters);
            path2d.lineTo(transformedMax[0] * multiplierMillimeters, transformedMax[1] * multiplierMillimeters);
            path2d.lineTo(transformedMin[0] * multiplierMillimeters, transformedMax[1] * multiplierMillimeters);
            path2d.lineTo(transformedMin[0] * multiplierMillimeters, transformedMin[1] * multiplierMillimeters);
            path2d.closePath();
            return new Area(path2d);
        } else {
            storeUnimplemented(ifcProfileDef);
        }
    } else if (ifcRepresentationItem instanceof IfcPolyline) {
        IfcPolyline ifcPolyline = (IfcPolyline) ifcRepresentationItem;
        double[] res = new double[4];
        Path2D.Float path2d = new Path2D.Float();
        boolean first = true;
        for (IfcCartesianPoint cartesianPoint : ifcPolyline.getPoints()) {
            EList<Double> coords = cartesianPoint.getCoordinates();
            Matrix.multiplyMV(res, 0, productMatrix, 0, new double[] { coords.get(0), coords.get(1), 0, 1 }, 0);
            if (first) {
                path2d.moveTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
                first = false;
            } else {
                path2d.lineTo(res[0] * multiplierMillimeters, res[1] * multiplierMillimeters);
            }
        }
        path2d.closePath();
        return new Area(path2d);
    } else {
        storeUnimplemented(ifcRepresentationItem);
    }
    return null;
}
Also used : IfcCurve(org.bimserver.models.ifc2x3tc1.IfcCurve) IfcArbitraryClosedProfileDef(org.bimserver.models.ifc2x3tc1.IfcArbitraryClosedProfileDef) IfcRectangleProfileDef(org.bimserver.models.ifc2x3tc1.IfcRectangleProfileDef) IfcArbitraryProfileDefWithVoids(org.bimserver.models.ifc2x3tc1.IfcArbitraryProfileDefWithVoids) Path2D(java.awt.geom.Path2D) IfcTrimmedCurve(org.bimserver.models.ifc2x3tc1.IfcTrimmedCurve) IfcProfileDef(org.bimserver.models.ifc2x3tc1.IfcProfileDef) IfcPolyline(org.bimserver.models.ifc2x3tc1.IfcPolyline) Area(java.awt.geom.Area) EList(org.eclipse.emf.common.util.EList) IfcCompositeCurve(org.bimserver.models.ifc2x3tc1.IfcCompositeCurve) IfcAxis2Placement3D(org.bimserver.models.ifc2x3tc1.IfcAxis2Placement3D) IfcCompositeCurveSegment(org.bimserver.models.ifc2x3tc1.IfcCompositeCurveSegment) IfcCartesianPoint(org.bimserver.models.ifc2x3tc1.IfcCartesianPoint) IfcDirection(org.bimserver.models.ifc2x3tc1.IfcDirection) IfcExtrudedAreaSolid(org.bimserver.models.ifc2x3tc1.IfcExtrudedAreaSolid)

Aggregations

IfcCartesianPoint (org.bimserver.models.ifc2x3tc1.IfcCartesianPoint)9 IfcAxis2Placement3D (org.bimserver.models.ifc2x3tc1.IfcAxis2Placement3D)4 IfcExtrudedAreaSolid (org.bimserver.models.ifc2x3tc1.IfcExtrudedAreaSolid)3 IfcLocalPlacement (org.bimserver.models.ifc2x3tc1.IfcLocalPlacement)3 Path2D (java.awt.geom.Path2D)2 IfcModelInterface (org.bimserver.emf.IfcModelInterface)2 IfcArbitraryClosedProfileDef (org.bimserver.models.ifc2x3tc1.IfcArbitraryClosedProfileDef)2 IfcAxis2Placement (org.bimserver.models.ifc2x3tc1.IfcAxis2Placement)2 IfcBuildingStorey (org.bimserver.models.ifc2x3tc1.IfcBuildingStorey)2 IfcFurnishingElement (org.bimserver.models.ifc2x3tc1.IfcFurnishingElement)2 IfcObjectPlacement (org.bimserver.models.ifc2x3tc1.IfcObjectPlacement)2 IfcPolyline (org.bimserver.models.ifc2x3tc1.IfcPolyline)2 IfcSpace (org.bimserver.models.ifc2x3tc1.IfcSpace)2 Area (java.awt.geom.Area)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 URL (java.net.URL)1 IdEObject (org.bimserver.emf.IdEObject)1 IfcModelInterfaceException (org.bimserver.emf.IfcModelInterfaceException)1 SDeserializerPluginConfiguration (org.bimserver.interfaces.objects.SDeserializerPluginConfiguration)1