55import java .util .ArrayList ;
66import java .util .List ;
77
8- import org .bimserver .emf .IdEObject ;
98import org .bimserver .emf .IfcModelInterface ;
10- import org .bimserver .models .ifc2x3tc1 .IfcColumn ;
11- import org .bimserver .models .ifc2x3tc1 .IfcDoor ;
12- import org .bimserver .models .ifc2x3tc1 .IfcRoot ;
13- import org .bimserver .models .ifc2x3tc1 .IfcSlab ;
14- import org .bimserver .models .ifc2x3tc1 .IfcWall ;
15- import org .bimserver .models .ifc2x3tc1 .IfcWallStandardCase ;
16- import org .bimserver .models .ifc2x3tc1 .IfcWindow ;
9+ import org .bimserver .models .ifc2x3tc1 .*;
1710import org .bimserver .plugins .PluginManager ;
1811import org .bimserver .plugins .ifcengine .*;
1912import org .bimserver .plugins .serializers .EmfSerializer ;
@@ -35,8 +28,9 @@ public void init(IfcModelInterface model, ProjectInfo projectInfo, PluginManager
3528 super .init (model , projectInfo , pluginManager , ifcEnginPlugin , false );
3629 try {
3730 IfcEngine ifcEngine = ifcEnginPlugin .createIfcEngine ();
31+ ifcEngine .init ();
3832 Serializer serializer = getPluginManager ().requireIfcStepSerializer ();
39- serializer .init (model , getProjectInfo (), getPluginManager (), ifcEnginPlugin , false );
33+ serializer .init (model , getProjectInfo (), getPluginManager (), ifcEnginPlugin , true );
4034 ifcEngineModel = ifcEngine .openModel (serializer .getBytes ());
4135 ifcEngineModel .setPostProcessing (true );
4236 geometry = ifcEngineModel .finalizeModelling (ifcEngineModel .initializeModelling ());
@@ -129,7 +123,7 @@ private void writeGeometries() {
129123 boolean first = true ;
130124 for (Class <? extends EObject > eClass : eClasses ) {
131125 for (Object object : model .getAll (eClass )) {
132- IfcRoot ifcRoot = (IfcRoot ) object ;
126+ IfcProduct ifcRoot = (IfcProduct ) object ;
133127 SetGeometryResult geometry = getGeometry (ifcRoot );
134128 if (geometry != null ) {
135129 out .println (first ? " {" : " ,{" );
@@ -146,11 +140,11 @@ private void writeGeometries() {
146140 }
147141 }
148142
149- private SetGeometryResult getGeometry (IdEObject ifcRootObject ) throws SerializerException , IfcEngineException {
143+ private SetGeometryResult getGeometry (IfcProduct ifcRootObject ) throws SerializerException , IfcEngineException {
150144 BinaryIndexBuffer binaryIndexBuffer = new BinaryIndexBuffer ();
151145 BinaryVertexBuffer binaryVertexBuffer = new BinaryVertexBuffer ();
152146 int nrIndices = 0 ;
153- IfcEngineInstance instance = ifcEngineModel .getInstanceFromExpressId (( int ) ifcRootObject .getOid ());
147+ IfcEngineInstance instance = ifcEngineModel .getInstanceFromExpressId (ifcRootObject .getExpressId ());
154148 IfcEngineInstanceVisualisationProperties visualisationProperties = instance .getVisualisationProperties ();
155149 for (int i = visualisationProperties .getStartIndex (); i < visualisationProperties .getPrimitiveCount () * 3 + visualisationProperties .getStartIndex (); i += 3 ) {
156150 binaryIndexBuffer .addIndex (geometry .getIndex (i ));
0 commit comments