BIMserver
BIMserver copied to clipboard
How to generate the geometry of a single object?
Hello,
I did not found a forum so i post my question here, it's not a bug sorry. I want to generate the geometry of a single object without having to comit the entire model before call the IfcOpenShellPlugin. The purpose is to be able to move or create an object in the client side, load it in the 3D view and when the edition is finished apply the commit. My questions are the following:
- The IfcOpenShellPlugin input is an IFC file, so i wanted to isolate the branch of the moved/created object and serialize it in an ifc file using the ifc serializer. Do you it's the good way and is there a simple way to retrieve it (the "branch" of the object) in the model? -I tried the following code from your test but after several minutes, the program reaches an exception:
final IfcModelInterface ifcModel = client.getModel(project, project.getLastRevisionId(), false, false, true);
final IfcSpaceImpl ifcSpace = (IfcSpaceImpl) ifcModel.getFirst(IfcSpace.class);
final IfcObjectPlacement objectPlacement = ifcSpace.getObjectPlacement();
if (objectPlacement != null && objectPlacement instanceof IfcLocalPlacement)
{
final IfcLocalPlacement localPlacement = (IfcLocalPlacement) objectPlacement;
final IfcAxis2Placement relativePlacement =localPlacement.getRelativePlacement();
if (relativePlacement != null) {
if (relativePlacement instanceof IfcAxis2Placement3D) {
final IfcAxis2Placement3D axis2Placement3D = (IfcAxis2Placement3D) relativePlacement;
final IfcCartesianPoint location = axis2Placement3D.getLocation();
final double newValue = location.getCoordinates().get(2) + 50;
LOGGER.debug("Changing z value of " + ifcSpace.getName() + " from " + location.getCoordinates().get(2) + " to " + newValue);
location.getCoordinates().set(2, newValue);
}
}
}
final SerializerPlugin serializerPlugin = bimServer.getPluginManager().getSerializerPlugin("org.bimserver.ifc.step.serializer.Ifc2x3tc1StepSerializerPlugin", false);
final Serializer serializer = serializerPlugin.createSerializer(new PluginConfiguration());
serializer.init(ifcSpace.getModel(), null, false);
SerializerUtils.writeToFile(serializer, Paths.get("c:\\Temp\\FirstSpaceMoved.ifc"));
- Do you know a simple way to generate the geometry of a single object after modifying it in the model?
Thankls for your great job.
Currently BIMserver does not provide a way to do this, I don't think it will be easy to determine which geometry needs to be regenerated, but if you already know which object you want to regenerate, than it should be easier. We could at least add a call that allows you to regenerate the geometry for a specific object I guess, so we don't have to solve the hard problem yet, I'll leave this issue open for that but don't have time for this myself in the coming months.