You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using RichIfcModel class in order to generate some objects (IfcBuilding, IfcSpace, ..) like you did in the org.bimserver.tests.emf.TestBigModelEmf class.
Ifc objects are created as expected but when I look on my new project from the bimviewer webpage, it seems that all my objects are duplicated.
Here is the code I'm using:
public Test() {
try (BimServerClientFactory factory = new JsonBimServerClientFactory("http://localhost:8082")) {
// create a client
BimServerClientInterface bimServerClient = factory
.create(new UsernamePasswordAuthenticationInfo("email", "mail"));
// create a new project
SProject newProject = bimServerClient.getServiceInterface().addProject("test" + Math.random(), "ifc2x3tc1");
// create a model
IfcModelInterface model = bimServerClient.newModel(newProject, true);
// from Model object, create a Rich client
RichIfcModel richIfcModel = new RichIfcModel(model);
IfcBuilding ifcBuilding = richIfcModel.createDefaultProjectStructure();
// Create IfcBuildingStorey & Ifcspace
IfcRelAggregates buildingAggregation = richIfcModel.create(IfcRelAggregates.class);
buildingAggregation.setRelatingObject(ifcBuilding);
for (int i = 1; i <= 10; i++) {
IfcBuildingStorey ifcBuildingStorey = richIfcModel.create(IfcBuildingStorey.class);
ifcBuildingStorey.setName("Storey " + i);
ifcBuildingStorey.setCompositionType(IfcElementCompositionEnum.ELEMENT);
ifcBuildingStorey.setElevation(3000 * i);
IfcLocalPlacement storeyPlacement = richIfcModel.create(IfcLocalPlacement.class);
storeyPlacement.setRelativePlacement(richIfcModel.createBasicPosition(0, 0, i * 3000));
ifcBuildingStorey.setObjectPlacement(storeyPlacement);
buildingAggregation.getRelatedObjects().add(ifcBuildingStorey);
IfcRelAggregates storeyAggregation = richIfcModel.create(IfcRelAggregates.class);
storeyAggregation.setRelatingObject(ifcBuildingStorey);
for (int x = 1; x <= 1; x++) {
for (int y = 1; y <= 1; y++) {
createSpace(richIfcModel, richIfcModel.getDefaultRepresentationContext(), storeyPlacement,
storeyAggregation, x, y, true);
}
}
}
// commit
long roid = model.commit("Initial model");
} catch (Throwable e) {
e.printStackTrace();
if (e instanceof AssertionError) {
throw (AssertionError) e;
}
fail(e.getMessage());
}
}
private void createSpace(RichIfcModel richIfcModel, IfcRepresentationContext representationContext,
IfcLocalPlacement storeyPlacement, IfcRelAggregates storeyAggregation, int x, int y, boolean doreuse)
throws IfcModelInterfaceException {
IfcSpace ifcSpace = richIfcModel.create(IfcSpace.class);
ifcSpace.setName("Space " + ((y * 10) + x));
ifcSpace.setCompositionType(IfcElementCompositionEnum.ELEMENT);
ifcSpace.setInteriorOrExteriorSpace(IfcInternalOrExternalEnum.INTERNAL);
IfcLocalPlacement spacePlacement = richIfcModel.create(IfcLocalPlacement.class);
spacePlacement.setPlacementRelTo(storeyPlacement);
spacePlacement.setRelativePlacement(richIfcModel.createBasicPosition(x * 6000, y * 6000, 0));
ifcSpace.setObjectPlacement(spacePlacement);
storeyAggregation.getRelatedObjects().add(ifcSpace);
IfcProductRepresentation rep = null;
rep = richIfcModel.createRectangularExtrusionProductRepresentation(5000, 5000, 2000);
ifcSpace.setRepresentation(rep);
createFurnishing(richIfcModel, representationContext, y, ifcSpace, spacePlacement, doreuse);
}
private void createFurnishing(RichIfcModel richIfcModel, IfcRepresentationContext representationContext, int number,
IfcSpace ifcSpace, IfcLocalPlacement spacePlacement, boolean doreuse) throws IfcModelInterfaceException {
IfcFurnishingElement furnishing = richIfcModel.create(IfcFurnishingElement.class);
furnishing.setName("Furnishing " + number);
IfcLocalPlacement furnishingPlacement = richIfcModel.create(IfcLocalPlacement.class);
furnishingPlacement.setPlacementRelTo(spacePlacement);
IfcAxis2Placement3D furnitureAxisPlacement = richIfcModel.create(IfcAxis2Placement3D.class);
furnitureAxisPlacement.setLocation(richIfcModel.createIfcCartesianPoint(500, 500, 2));
furnishingPlacement.setRelativePlacement(furnitureAxisPlacement);
furnishing.setObjectPlacement(furnishingPlacement);
IfcProductRepresentation rep = null;
rep = richIfcModel.createRectangularExtrusionProductRepresentation(4000, 4000, 1200);
furnishing.setRepresentation(rep);
richIfcModel.addContains(ifcSpace, furnishing);
}
public static void main(String[] args) {
new Test();
}
}
I'm not totally sure but this issue might be related with issue #688.
Do you have any idea how I could avoid this duplicate ?
Thank you
Gregory
The text was updated successfully, but these errors were encountered:
Hi,
I'm using RichIfcModel class in order to generate some objects (IfcBuilding, IfcSpace, ..) like you did in the org.bimserver.tests.emf.TestBigModelEmf class.
Ifc objects are created as expected but when I look on my new project from the bimviewer webpage, it seems that all my objects are duplicated.

Here is the code I'm using:
}
I'm not totally sure but this issue might be related with issue #688.
Do you have any idea how I could avoid this duplicate ?
Thank you
Gregory
The text was updated successfully, but these errors were encountered: