/* $RCSfile: PrintWallProps.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.schemas.ifc2x3.*; import com.steptools.stdev.*; import com.steptools.stdev.p21.*; public class PrintWallProps { // PRINT WALL PROPERTIES - This IFC program finds all of the IfcWall // instances in a file, then searches for all related property set // definitions and prints the property sets for each. The program // takes the filename from the command line so you can use it with // test files such as those on buildingSMART site or Univ Karlsruhe. // public static void main(String[] argv) throws STDevException, IOException { String fname = argv[0]; Part21Parser parser = new Part21LoggingParser(); Model mod = parser.parse(fname); Population pop = (Population) mod.getPopulation(); EntityIDTable eids = EntityIDTable.forModel(mod); EntityExtent walls = pop.getExtent(IfcWall.DOMAIN); Iterator itor = walls.iterator(); while (itor.hasNext()) { IfcWall wall = (IfcWall)itor.next(); printWallProps(pop, eids, wall); } } static void printWallProps ( Population pop, EntityIDTable eids, IfcWall wall ) { System.out.println ( "Wall: " + wall.domain().getName() + "#"+ eids.getId(wall) + ", " + wall.getName() ); // Iterate over all objects that point to this wall and select the // defines by properties. EntityInstanceSet refs = wall.usedin( pop, IfcRelDefinesByProperties.DOMAIN, IfcRelDefines.relatedobjects_ATT ); Iterator itor = refs.iterator(); while(itor.hasNext()) { IfcRelDefinesByProperties rel = (IfcRelDefinesByProperties) itor.next(); IfcPropertySetDefinition psetd = rel.getRelatingPropertyDefinition(); if (! (psetd instanceof IfcPropertySet)) continue; IfcPropertySet pset = (IfcPropertySet) psetd; System.out.println (" rel: #" + eids.getId(rel)); System.out.println (" pset #" + eids.getId(pset) + " " + pset.getName()); SetIfcProperty props = pset.getHasProperties(); for (int i=0; i"); return; } // The select can have contain many different types, but they // are almost all doubles, so we just print that. If you need // to know the exact type, you can call the test functions for // the types below. if (val.isIfcDescriptiveMeasure()) System.out.printf ("%s (desc measure)", val.getIfcDescriptiveMeasure()); else if (val.isIfcInteger()) System.out.printf ("%d (simple int)", val.getIfcInteger()); else if (val.isIfcReal()) System.out.printf ("%g (simple real)", val.getIfcReal()); else if (val.isIfcBoolean()) System.out.printf ("%s (simple bool)", val.getIfcBoolean().toString()); else if (val.isIfcIdentifier()) System.out.printf ("%s (simple ID)", val.getIfcIdentifier()); else if (val.isIfcText()) System.out.printf ("%s (simple int)", val.getIfcText()); else if (val.isIfcLabel()) System.out.printf ("%s (simple int)", val.getIfcLabel()); else if (val.isIfcLogical()) System.out.printf ("%s (simple log)", val.getIfcLogical().toString()); else { // Some numeric type // IfcVolumeMeasure // IfcTimeMeasure // IfcThermodynamicTemperatureMeasure // IfcSolidAngleMeasure // IfcPositiveRatioMeasure // IfcRatioMeasure // IfcPositivePlaneAngleMeasure // IfcPlaneAngleMeasure // IfcParameterValue // IfcNumericMeasure // IfcMassMeasure // IfcPositiveLengthMeasure // IfcLengthMeasure // IfcElectricCurrentMeasure // IfcCountMeasure // IfcContextDependentMeasure // IfcAreaMeasure // IfcAmountOfSubstanceMeasure // IfcLuminousIntensityMeasure // IfcNormalisedRatioMeasure // IfcComplexNumber // IfcVolumetricFlowRateMeasure // IfcTimeStamp // IfcThermalTransmittanceMeasure // IfcThermalResistanceMeasure // IfcThermalAdmittanceMeasure // IfcPressureMeasure // IfcPowerMeasure // IfcMassFlowRateMeasure // IfcMassDensityMeasure // IfcLinearVelocityMeasure // IfcKinematicViscosityMeasure // IfcIntegerCountRateMeasure // IfcHeatFluxDensityMeasure // IfcFrequencyMeasure // IfcEnergyMeasure // IfcElectricVoltageMeasure // IfcDynamicViscosityMeasure // IfcCompoundPlaneAngleMeasure // IfcAngularVelocityMeasure // IfcThermalConductivityMeasure // IfcMolecularWeightMeasure // IfcVaporPermeabilityMeasure // IfcMoistureDiffusivityMeasure // IfcIsothermalMoistureCapacityMeasure // IfcSpecificHeatCapacityMeasure // IfcMonetaryMeasure // IfcMagneticFluxDensityMeasure // IfcMagneticFluxMeasure // IfcLuminousFluxMeasure // IfcForceMeasure // IfcInductanceMeasure // IfcIlluminanceMeasure // IfcElectricResistanceMeasure // IfcElectricConductanceMeasure // IfcElectricChargeMeasure // IfcDoseEquivalentMeasure // IfcElectricCapacitanceMeasure // IfcAbsorbedDoseMeasure // IfcRadioActivityMeasure // IfcRotationalFrequencyMeasure // IfcTorqueMeasure // IfcAccelerationMeasure // IfcLinearForceMeasure // IfcLinearStiffnessMeasure // IfcModulusOfSubgradeReactionMeasure // IfcModulusOfElasticityMeasure // IfcMomentOfInertiaMeasure // IfcPlanarForceMeasure // IfcRotationalStiffnessMeasure // IfcShearModulusMeasure // IfcLinearMomentMeasure // IfcLuminousIntensityDistributionMeasure // IfcCurvatureMeasure // IfcMassPerLengthMeasure // IfcModulusOfLinearSubgradeReactionMeasure // IfcModulusOfRotationalSubgradeReactionMeasure // IfcRotationalMassMeasure // IfcSectionalAreaIntegralMeasure // IfcSectionModulusMeasure // IfcTemperatureGradientMeasure // IfcThermalExpansionCoefficientMeasure // IfcWarpingConstantMeasure // IfcWarpingMomentMeasure // IfcSoundPowerMeasure // IfcSoundPressureMeasure // IfcHeatingValueMeasure // IfcPHMeasure // IfcIonConcentrationMeasure SelectionBase sel = val.selection(); System.out.printf ("%s (measure)", sel.getValue(val).toString(), sel.toString()); } } }