ifc2x3 pset library name fix + copyrights

This commit is contained in:
Andrej730
2023-02-24 10:57:52 +05:00
parent f2c03a508f
commit aa8da74ed8
2 changed files with 23 additions and 5 deletions
@@ -1,3 +1,21 @@
# IfcOpenShell - IFC toolkit and geometry engine
# Copyright (C) 2023 @Andrej730
#
# This file is part of IfcOpenShell.
#
# IfcOpenShell is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IfcOpenShell is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with IfcOpenShell. If not, see <http://www.gnu.org/licenses/>.
import ifcopenshell.api
import ifcopenshell.util.attribute
from pathlib import Path
@@ -44,7 +62,7 @@ class PsetTemplatesGenerator:
fi_zip.extractall(pset_data_location)
pset_data_glob = f"{pset_data_location}/*.xml"
self.parse_psets_data("IFC4X3", pset_data_glob, str(IFC4x3_OUTPUT_PATH))
self.parse_psets_data("IFC4X3", pset_data_glob, "IFC4X3 Property Set Templates", str(IFC4x3_OUTPUT_PATH))
shutil.rmtree(pset_data_location)
def parse_ifc2x3_data(self):
@@ -66,14 +84,14 @@ class PsetTemplatesGenerator:
pset_data_glob = f"{pset_data_location}/**/pset*.xml"
# we're using IFC4X3 since IfcPropertySetTemplate and IfcRelDeclares
# are not available in IFC2X3
self.parse_psets_data("IFC4X3", pset_data_glob, str(IFC2x3_OUTPUT_PATH))
self.parse_psets_data("IFC4X3", pset_data_glob, "IFC2X3 Property Set Templates", str(IFC2x3_OUTPUT_PATH))
shutil.rmtree(pset_data_location)
def ifc_entity(self, entity_name, **kwargs):
entity = self.ifc_file.create_entity(entity_name, **kwargs)
return entity
def parse_psets_data(self, schema_name, pset_data_glob, ifc_output_path):
def parse_psets_data(self, schema_name, pset_data_glob, project_name, ifc_output_path):
schema_name = schema_name.upper()
self.ifc_file = ifcopenshell.api.run("project.create_file", version=schema_name)
schema = ifcopenshell.ifcopenshell_wrapper.schema_by_name(schema_name)
@@ -83,7 +101,7 @@ class PsetTemplatesGenerator:
)
self.ifc_unit_enum = schema.declaration_by_name("IfcUnitEnum").as_enumeration_type().enumeration_items()
self.ifc_entity("IfcProject", Name=f"{schema_name} Property Set Templates")
self.ifc_entity("IfcProject", Name=project_name)
psets_list = []
rel = self.ifc_entity("IfcRelDeclares", RelatedDefinitions=psets_list) if schema_name != "IFC2X3" else None
@@ -5,7 +5,7 @@ FILE_NAME('/dev/null','2023-02-22T17:34:59+05:00',(),(),'IfcOpenShell v0.7.0-1d6
FILE_SCHEMA(('IFC4X3'));
ENDSEC;
DATA;
#1=IFCPROJECT($,$,'IFC4X3 Property Set Templates',$,$,$,$,$,$);
#1=IFCPROJECT($,$,'IFC2X3 Property Set Templates',$,$,$,$,$,$);
#2=IFCRELDECLARES($,$,$,$,$,(#3,#13,#17,#22,#27,#32,#37,#42,#55,#68,#81,#92,#98,#105,#109,#114,#119,#127,#135,#143,#150,#157,#168,#174,#183,#188,#198,#207,#216,#227,#235,#243,#251,#261,#276,#290,#297,#316,#323,#328,#331,#334,#337,#349,#364,#375,#386,#392,#394,#397,#410,#415,#418,#421,#424,#427,#432,#435,#438,#441,#447,#456,#477,#486,#492,#501,#506,#532,#545,#584,#587,#590,#597,#600,#612,#625,#635,#659,#662,#672,#685,#690,#701,#725,#740,#757,#769,#785,#799,#803,#812,#853,#859,#890,#897,#943,#948,#956,#958,#960,#962,#983,#987,#1003,#1008,#1031,#1034,#1050,#1057,#1061,#1066,#1075,#1087,#1099,#1119,#1131,#1154,#1161,#1165,#1184,#1208,#1213,#1216,#1225,#1230,#1241,#1243,#1246,#1251,#1254,#1258,#1260,#1265,#1278,#1280,#1295,#1298,#1314,#1317,#1331,#1336,#1339,#1346,#1362,#1380,#1393,#1398,#1405,#1425,#1432,#1441,#1448,#1455,#1483,#1499,#1516,#1522,#1526,#1528,#1547,#1549,#1558,#1563,#1565,#1569,#1574,#1579,#1582,#1592,#1596,#1607,#1612,#1614,#1617,#1622,#1625,#1628,#1639,#1655,#1670,#1695,#1711,#1726,#1739,#1754,#1771,#1786,#1803,#1816,#1831,#1837,#1862,#1877,#1899,#1922,#1946,#1963,#1982,#1997,#2004,#2011,#2024,#2026,#2035,#2050,#2055,#2066,#2073,#2085,#2088,#2094,#2109,#2115,#2121,#2128,#2143,#2153,#2157,#2168,#2172,#2174,#2196,#2199,#2206,#2215,#2224,#2231,#2240,#2255,#2277,#2281,#2290,#2298,#2305,#2316,#2322,#2330,#2343,#2358,#2378,#2390,#2402,#2432,#2446,#2468,#2475,#2495,#2507,#2514,#2521,#2533,#2535,#2539,#2543,#2545,#2548,#2551,#2555,#2558,#2561,#2566,#2570,#2573,#2587,#2594,#2601,#2610,#2619,#2624,#2629,#2648,#2672,#2682,#2692,#2698,#2707,#2720,#2729,#2742,#2751,#2759,#2772,#2779,#2792,#2799,#2806,#2816,#2819,#2821,#2825,#2830,#2836,#2851,#2854,#2871,#2879,#2885,#2894,#2904,#2908,#2923,#2926,#2929,#2936,#2950,#2971,#2983,#3012,#3019,#3026,#3039,#3046,#3073,#3084,#3126,#3140,#3154));
#3=IFCPROPERTYSETTEMPLATE('2UcDHEdQf10ev$eurUJH1a',$,'Pset_SpaceProgramCommon','Definition from IAI: Properties common to the definition of all instances of IfcSpaceProgram',$,'IfcSpaceProgram',(#4,#5,#6,#7,#8,#9,#10,#11,#12));
#4=IFCSIMPLEPROPERTYTEMPLATE('0ZkG0A_jX04uBqZFUkX$1r',$,'Location','General description of the required location for the space (e.g. "third floor south") ',.P_SINGLEVALUE.,'IfcLabel',$,$,$,$,$,.READWRITE.);