From 78a70baf7c69041ab3f379c57e1454e7a5ae64a9 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Mon, 3 Sep 2018 22:28:54 +0200 Subject: [PATCH] Step-Importer: introduce data generation based on config. --- scripts/StepImporter/CppGenerator.py | 29 +++-- .../{entitylist.txt => ifc_entitylist.txt} | 0 scripts/StepImporter/step_entitylist.txt | 111 ++++++++++++++++++ 3 files changed, 129 insertions(+), 11 deletions(-) rename scripts/StepImporter/{entitylist.txt => ifc_entitylist.txt} (100%) create mode 100644 scripts/StepImporter/step_entitylist.txt diff --git a/scripts/StepImporter/CppGenerator.py b/scripts/StepImporter/CppGenerator.py index a05716619..4f67a3aea 100644 --- a/scripts/StepImporter/CppGenerator.py +++ b/scripts/StepImporter/CppGenerator.py @@ -5,7 +5,7 @@ # Open Asset Import Library (ASSIMP) # --------------------------------------------------------------------------- # -# Copyright (c) 2006-2010, ASSIMP Development Team +# Copyright (c) 2006-2018, ASSIMP Development Team # # All rights reserved. # @@ -48,11 +48,21 @@ if sys.version_info < (3, 0): print("must use python 3.0 or greater") sys.exit(-2) -input_template_h = 'IFCReaderGen.h.template' -input_template_cpp = 'IFCReaderGen.cpp.template' +use_ifc_template = False + +input_step_template_h = 'StepReaderGen.h.template' +input_step_template_cpp = 'StepReaderGen.cpp.template' +input_template_h = 'IFCReaderGen.h.template' +input_template_cpp = 'IFCReaderGen.cpp.template' -output_file_h = os.path.join('..','..','code','IFCReaderGen.h') -output_file_cpp = os.path.join('..','..','code','IFCReaderGen.cpp') +output_file_h = "" +output_file_cpp = "" +if (use_ifc_template ): + output_file_h = os.path.join('..','..','code','IFCReaderGen.h') + output_file_cpp = os.path.join('..','..','code','IFCReaderGen.cpp') +else: + output_file_h = os.path.join('..','..','code','StepReaderGen.h') + output_file_cpp = os.path.join('..','..','code','StepReaderGen.cpp') template_entity_predef = '\tstruct {entity};\n' template_entity_predef_ni = '\ttypedef NotImplemented {entity}; // (not currently used by Assimp)\n' @@ -221,7 +231,9 @@ def work(filename): schema = ExpressReader.read(filename,silent=True) entities, stub_decls, schema_table, converters, typedefs, predefs = '','',[],'','','' - + entitylist = 'ifc_entitylist.txt' + if not use_ifc_template: + entitylist = 'step_entitylist.txt' whitelist = [] with open('entitylist.txt', 'rt') as inp: whitelist = [n.strip() for n in inp.read().split('\n') if n[:1]!='#' and n.strip()] @@ -280,8 +292,3 @@ def work(filename): if __name__ == "__main__": sys.exit(work(sys.argv[1] if len(sys.argv)>1 else 'schema.exp')) - - - - - diff --git a/scripts/StepImporter/entitylist.txt b/scripts/StepImporter/ifc_entitylist.txt similarity index 100% rename from scripts/StepImporter/entitylist.txt rename to scripts/StepImporter/ifc_entitylist.txt diff --git a/scripts/StepImporter/step_entitylist.txt b/scripts/StepImporter/step_entitylist.txt new file mode 100644 index 000000000..14b05ca3e --- /dev/null +++ b/scripts/StepImporter/step_entitylist.txt @@ -0,0 +1,111 @@ +# ============================================================================== +# List of IFC structures needed by Assimp +# ============================================================================== +# use genentitylist.sh to update this list + +# This machine-generated list is not complete, it lacks many intermediate +# classes in the inheritance hierarchy. Those are magically augmented by the +# code generator. Also, the names of all used entities need to be present +# in the source code for this to work. + +IfcAnnotation +IfcArbitraryClosedProfileDef +IfcArbitraryOpenProfileDef +IfcArbitraryProfileDefWithVoids +IfcAxis1Placement +IfcAxis2Placement +IfcAxis2Placement2D +IfcAxis2Placement3D +IfcBooleanClippingResult +IfcBooleanResult +IfcBoundedCurve +IfcBoundingBox +IfcBSplineCurve +IfcBuilding +IfcCartesianPoint +IfcCartesianTransformationOperator +IfcCartesianTransformationOperator3D +IfcCartesianTransformationOperator3DnonUniform +IfcCircle +IfcCircleHollowProfileDef +IfcCircleProfileDef +IfcClosedShell +IfcColourOrFactor +IfcColourRgb +IfcCompositeCurve +IfcCompositeCurveSegment +IfcConic +IfcConnectedFaceSet +IfcConversionBasedUnit +IfcCurve +IfcDirection +IfcDoor +IfcEllipse +IfcExtrudedAreaSolid +IfcFace +IfcFaceBasedSurfaceModel +IfcFaceBound +IfcFaceOuterBound +IfcFeatureElementSubtraction +IfcGeometricRepresentationContext +IfcGeometricRepresentationItem +IfcHalfSpaceSolid +IfcLine +IfcLocalPlacement +IfcManifoldSolidBrep +IfcMappedItem +IfcMeasureWithUnit +IfcNamedUnit +IfcObjectDefinition +IfcObjectPlacement +IfcOpeningElement +IfcParameterizedProfileDef +IfcPlane +IfcPolygonalBoundedHalfSpace +IfcPolyline +IfcPolyLoop +IfcPresentationStyleAssignment +IfcPresentationStyleSelect +IfcProduct +IfcProductRepresentation +IfcProfileDef +IfcProject +IfcRectangleProfileDef +IfcRelAggregates +IfcRelContainedInSpatialStructure +IfcRelFillsElement +IfcRelVoidsElement +IfcRepresentation +IfcRepresentationContext +IfcRepresentationItem +IfcRepresentationMap +IfcRevolvedAreaSolid +IfcShell +IfcShellBasedSurfaceModel +IfcSite +IfcSIUnit +IfcSomething +IfcSpace +IfcSpatialStructureElement +IfcSpatialStructureElements +IfcStyledItem +IfcSurfaceStyle +IfcSurfaceStyleElementSelect +IfcSurfaceStyleRendering +IfcSurfaceStyleShading +IfcSurfaceStyleWithTextures +IfcSweptAreaSolid +IfcSweptDiskSolid +IfcTopologicalRepresentationItem +IfcTrimmedCurve +IfcUnit +IfcUnitAssignment +IfcVector +IfcIShapeProfileDef +IfcPropertyListValue +IfcRelDefinesByProperties +IfcPropertySet +IfcPropertySingleValue +IfcProperty +IfcComplexProperty +IfcElementQuantity