3434#include " ../ifcparse/IfcHierarchyHelper.h"
3535#include " ../ifcgeom/IfcGeom.h"
3636
37- // Some convinience typedefs and definitions.
37+ // Some convenience typedefs and definitions.
3838typedef std::string S;
3939typedef IfcWrite::IfcGuidHelper guid;
4040typedef std::pair<double , double > XY;
@@ -45,8 +45,8 @@ void createGroundShape(TopoDS_Shape& shape);
4545
4646int main (int argc, char ** argv) {
4747
48- // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several convience
49- // functions for working with geometry in IFC files.
48+ // The IfcHierarchyHelper is a subclass of the regular IfcFile that provides several
49+ // convenience functions for working with geometry in IFC files.
5050 IfcHierarchyHelper file;
5151
5252 // Start by adding a wall to the file, initially leaving most attributes blank.
@@ -66,7 +66,7 @@ int main(int argc, char** argv) {
6666 // structure: IfcProject > IfcSite > IfcBuilding > IfcBuildingStorey > IfcWall
6767
6868 // Lateron changing the name of the IfcProject can be done by obtaining a reference to the
69- // project, which was automatically created. since we know it exists .
69+ // project, which has been created automatically .
7070 file.getSingle <Ifc2x3::IfcProject>()->setName (" IfcOpenHouse" );
7171
7272 // An IfcOwnerHistory has been initialized as well, which should be assigned to the wall.
@@ -234,7 +234,7 @@ int main(int argc, char** argv) {
234234 // can be a composition of multiple solids. The following door will be composed of four boxes
235235 // which constitute the door and its frame.
236236 Ifc2x3::IfcDoor* door = new Ifc2x3::IfcDoor (guid (), file.getSingle <Ifc2x3::IfcOwnerHistory>(), null, null, null,
237- file.addLocalPlacement (4800 , 1600 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ), 0 , null, 2120 , 1000 );
237+ file.addLocalPlacement (4800 , 1600 , 0 , 0 , 0 , 1 , 0 , 1 , 0 ), 0 , null, 2200 , 1000 );
238238 door->setRepresentation (file.addBox (80 , 80 , 2120 , 0 , file.addPlacement3d (460 , 0 , 0 )));
239239 Ifc2x3::IfcRepresentation::list door_representations = door->Representation ()->Representations ();
240240 Ifc2x3::IfcShapeRepresentation* door_body = 0 ;
@@ -258,6 +258,10 @@ int main(int argc, char** argv) {
258258 // only the plate will have a transparent material assigned.
259259
260260 // The window frame will consists of four seperate beams.
261+ // AutoCAD Architecture will create an internal window type for the IfcWindow created.
262+ // Therefore the OverallWidth and OverallHeight of the window attributes will need to
263+ // match the bounding box of the representation. Furthermore, the window placement needs
264+ // to align with the lowerleft corner of the constituent parts.
261265 Ifc2x3::IfcProductDefinitionShape::list frame_representations (new IfcTemplatedEntityList<Ifc2x3::IfcProductDefinitionShape>());
262266 frame_representations->push (file.addBox (1860 , 90 , 90 ));
263267 frame_representations->push (*frame_representations->begin ()); // Add a reference to the shape created above
@@ -277,18 +281,18 @@ int main(int argc, char** argv) {
277281 // This window will be placed at five locations within the building. A list of placements is
278282 // created and is iterated over to create all window instances.
279283 Ifc2x3::IfcLocalPlacement::list window_placements (new IfcTemplatedEntityList<Ifc2x3::IfcLocalPlacement>());
280- window_placements->push (file.addLocalPlacement (2 *-1770 -430 , 0 , 400 ));
281- window_placements->push (file.addLocalPlacement ( -1770 -430 , 0 , 400 ));
282- window_placements->push (file.addLocalPlacement ( -430 , 0 , 400 ));
283- window_placements->push (file.addLocalPlacement ( 3000 , 0 , 400 ));
284- window_placements->push (file.addLocalPlacement ( -4855 , 885 , 400 , 0 , 0 , 1 , 0 , 1 , 0 ));
284+ window_placements->push (file.addLocalPlacement (2 *-1770 -430 - 930 , - 45 , 400 ));
285+ window_placements->push (file.addLocalPlacement ( -1770 -430 - 930 , - 45 , 400 ));
286+ window_placements->push (file.addLocalPlacement ( -430 - 930 , - 45 , 400 ));
287+ window_placements->push (file.addLocalPlacement ( 3000 - 930 , - 45 , 400 ));
288+ window_placements->push (file.addLocalPlacement ( -4855 + 45 , 885 - 930 , 400 , 0 , 0 , 1 , 0 , 1 , 0 ));
285289
286290 for (Ifc2x3::IfcLocalPlacement::it it = window_placements->begin (); it != window_placements->end (); ++it) {
287291
288292 // Create the window at the current location
289293 Ifc2x3::IfcLocalPlacement* place = *it;
290294 Ifc2x3::IfcWindow* window = new Ifc2x3::IfcWindow (guid (), file.getSingle <Ifc2x3::IfcOwnerHistory>(),
291- null, null, null, place, 0 , null, 2000 , 1600 );
295+ null, null, null, place, 0 , null, 1600 , 1860 );
292296 file.addBuildingProduct (window);
293297
294298 // Initalize a list of parts for the window to be composed of
@@ -297,10 +301,10 @@ int main(int argc, char** argv) {
297301 // The placements for the beams are not shared accross the different windows because every
298302 // beam is placed relative to its parent window entity.
299303 Ifc2x3::IfcLocalPlacement::list frame_placements (new IfcTemplatedEntityList<Ifc2x3::IfcLocalPlacement>());
300- frame_placements->push (file.addLocalPlacement ());
301- frame_placements->push (file.addLocalPlacement ( 0 , 0 , 1510 ));
302- frame_placements->push (file.addLocalPlacement (-885 , 0 , 90 ));
303- frame_placements->push (file.addLocalPlacement ( 885 , 0 , 90 ));
304+ frame_placements->push (file.addLocalPlacement ( 930 , 45 ));
305+ frame_placements->push (file.addLocalPlacement ( 930 , 45 , 1510 ));
306+ frame_placements->push (file.addLocalPlacement (-885 + 930 , 45 , 90 ));
307+ frame_placements->push (file.addLocalPlacement ( 885 + 930 , 45 , 90 ));
304308
305309 // Now iterate over the placements and representations of the beam and add them to list of parts
306310 Ifc2x3::IfcLocalPlacement::it frame_placement;
@@ -318,7 +322,7 @@ int main(int argc, char** argv) {
318322
319323 // Add the glass plate to the list of parts
320324 Ifc2x3::IfcPlate* glass_part = new Ifc2x3::IfcPlate (guid (), file.getSingle <Ifc2x3::IfcOwnerHistory>(), null,
321- null, null, file.addLocalPlacement (0 , 0 , 90 ), file.addBox (1680 , 10 , 1420 ), null);
325+ null, null, file.addLocalPlacement (930 , 45 , 90 ), file.addBox (1680 , 10 , 1420 ), null);
322326 file.AddEntity (glass_part);
323327 window_parts->push (glass_part);
324328 file.relatePlacements (window, glass_part);
0 commit comments