/* $RCSfile: PrintSpatial.java,v $ * $Revision: 1.4 $ $Date: 2012/02/23 19:36:17 $ * Auth: Jochen Fritz (jfritz@steptools.com) * * Copyright (c) 1991-2012 by STEP Tools Inc. * All Rights Reserved. * * Permission to use, copy, modify, and distribute this software and * its documentation is hereby granted, provided that this copyright * notice and license appear on all copies of the software. * * STEP TOOLS MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE * SUITABILITY OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING * BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. STEP TOOLS * SHALL NOT BE LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A * RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS * DERIVATIVES. */ import java.io.IOException; import java.util.Iterator; import com.steptools.stdev.*; import com.steptools.stdev.p21.*; import com.steptools.schemas.ifc2x3.*; public class PrintSpatial { // PRINT SPATIAL STRUCTURE - This IFC program recursively prints the // spatial structure defined in a file, beginning with the IfcProject // root. Use this as the starting point for a more sophisticated // program. public static void main(String[] argv) throws STDevException, IOException { // read file, change to args[0] or other as needed String fname = "geometry_out.ifc"; System.out.println ("Loading file: "+ fname); Part21Parser parser = new Part21LoggingParser(); Model mod = parser.parse(fname); EntityIDTable eids = EntityIDTable.forModel(mod); Population pop = (Population) mod.getPopulation(); // Find the project and print all children EntityExtent projs = pop.getExtent(IfcProject.DOMAIN); Iterator itor = projs.iterator(); while (itor.hasNext()) { IfcProject p = (IfcProject) itor.next(); printStruct (pop, eids, p, 0); } } static void printStruct ( Population pop, EntityIDTable eids, IfcObjectDefinition elem, int indent ) { // Print info about the current object for (int i=0; i