Commit Graph

31 Commits

Author SHA1 Message Date
Petru Conduraru 3d15f581d1 util.doc: fix the same truncation in pset and property descriptions
The property-set and property extraction sites had the identical
first-paragraph truncation: descriptions ending at a colon lost their
bulleted lists and follow-up paragraphs. Route all four sites (IFC2X3 +
IFC4, pset-level and property-level including recursive children) through
extract_full_description, and make the existing HISTORY: changelog split
case-insensitive, since 21 pset docs use "History:" which only becomes
reachable once the walk passes the first paragraph.

Data refreshed from the same local buildingSMART doc sources with the
merge-only-description discipline: IFC4 376 descriptions completed
(34 pset + 342 property/child), IFC2X3 147 (20 + 127), zero artifact
regressions, all other fields byte-identical.

Example: Pset_DamperOccurrence.SizingMethod previously ended at
"...nominally or with exact measurements:" and now includes
"NOMINAL: Nominal sizing method. EXACT: Exact sizing method."

Generated with the assistance of an AI coding tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 15:17:55 +03:00
Petru Conduraru 6490e3ffa9 Cut lazy HISTORY remark leaks from extracted descriptions
Three IFC2X3 type descriptions leaked HISTORY remark text that is not
wrapped in a blockquote in the source markdown: a literal "> HISTORY ..."
tail inside the definition paragraph (IfcEnergyMeasure,
IfcHeatFluxDensityMeasure) and an inline "HISTORY: ..." sentence
(IfcMetricValueSelect). Teach extract_full_description to skip leading
HISTORY paragraphs and cut at inline/lazy remark markers, and clean the
three affected data entries (all other descriptions unchanged).

Generated with the assistance of an AI coding tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 15:13:18 +03:00
Petru Conduraru 5a7ab0ca68 util.doc: stop truncating entity descriptions at the first paragraph (#4624)
get_entity_doc returned incomplete descriptions for many entities and
types, e.g. IFC4 IfcAlarmType ended mid-sentence at "The set of shared
information may include:". The DocExtractor took only the FIRST <p> of the
markdown-derived HTML (BeautifulSoup .find("p").text), silently dropping
any bulleted list embedded in the definition and every paragraph after it.

Add DocExtractor.extract_full_description, which walks all top-level
<p>/<ul>/<ol> elements in document order (list items rendered as "- item"),
stops before any <blockquote> (HISTORY/NOTE remarks), and strips inline
kramdown attribute markers. The four entity/type extraction sites now use
it; the property-set extraction sites are left untouched to keep this
change scoped.

The shipped schema JSON data is refreshed from the buildingSMART IFC doc
sources (IFC4.0.2.1 and Ifc2.3.0.1): 1491 entity/type descriptions are
completed. Only top-level description fields change; attribute
descriptions and all other fields are byte-identical to the previous data,
and 11 regenerated descriptions containing extraction artifacts were kept
at their previous text.

Verified: IfcAlarmType now includes the full "may include" list and the
closing paragraph; IfcBeamType, IfcWindow and IFC2X3 IfcWallStandardCase
spot-checked complete with no HISTORY leakage.

Generated with the assistance of an AI coding tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 14:32:40 +03:00
Andrej730 dfc91e6639 ifcopenshell-python - clean up unused imports 2026-01-16 17:16:24 +05:00
Andrej730 13be6ccd45 Sort imports 2025-12-19 18:53:14 +05:00
Thomas Krijnen 322fbe27d6 Python 3.10 compatibility 2025-08-28 11:13:42 +02:00
Andrej730 16f9f91561 util.doc - statically type json structures 2025-05-14 19:40:45 +05:00
Andrej730 2f87029434 Use schema_identifier to get IFC4X3 schema more precisely 2025-03-14 18:19:07 +05:00
Andrej730 3c333c6b59 typing 2024-09-02 17:24:58 +05:00
Andrej730 9b9301cbb0 ifc4x3 docs parser - use release ifc4x3 version 2024-06-24 15:22:02 +05:00
Andrej730 aeb64acc07 util.doc - use release schema version for IFC4X3
As it will be more like to be available in the ifcopenshell package. Related to #4565
2024-04-22 17:31:49 +05:00
Dion Moult 52be9684fc Minor fix in doc utility for entities which have no predefined types 2024-04-18 10:48:23 +02:00
Andrej730 ecc8832c46 typing and small refactor 2024-04-17 14:54:42 +02:00
Andrej730 e2ef636209 add fallback to the previous schema versions for docs and mappings
before it was breaking part of BlenderBIM UI if we would open IFC4X1 file
2024-04-16 11:35:31 +02:00
Gorgious56 274f42993c #3478 : Ifc class name suggestions can now autofill predefined type
If they are correctly filled in the json file :)
2024-04-16 10:05:50 +02:00
Andrej730 5b5dd73684 get_inverse_attributes - added more correct recursive unpacking for aggregates and selections
Not affected the result schemas though
2023-02-23 18:56:24 +05:00
Andrej730 708dc6aca2 IFC4X3/IFC2X3 pset templates library
Generated from xmls from the ISO release of IFC4X3.
Based on https://standards.buildingsmart.org/IFC/RELEASE/IFC4/ADD2_TC1/HTML/annex/annex-a/general-usage/IFC4_ADD2.ifc

Also generated pset templates library for IFC2X3 (also based on similar xmls) but IFC2X3 ifc pset library is using... IFC4X3 schema because IfcPropertySetTemplate and IfcRelDeclares are not available in IFC2X3. Which is okay for our purposes for now.

Will need to update IFC4X3 library if one of the issues will be resolved:
https://github.com/buildingSMART/IFC4.3.x-development/issues/587
https://github.com/buildingSMART/IFC4.3.x-development/issues/586
2023-02-23 18:17:14 +05:00
Andrej730 476ab506d0 Added ifc4x3 json schema and it's parser
API for docs works the same way as it worked for ifc2x3 and ifc4.

Besides changing `doc.py` and adding `.json` schemas added `ifc4x3dev_scrape_data_for_docs.py` (it's kind of hacky now and relies on `server.py` code from the further mentioned repo) that's used to parse some entities descriptions from https://github.com/buildingSMART/IFC4.3.x-development for later use in `doc.py`.
2023-02-15 18:38:04 +05:00
Dion Moult adc59de2bf Minor fix to accommodate null descriptions and parents with no attributes
# Conflicts:
#	src/ifcopenshell-python/ifcopenshell/util/doc.py
2022-11-03 17:13:56 +11:00
Andrej730 c0909dace0 black.py formatting 2022-11-02 17:35:51 +06:00
Andrej730 d9f8aa4e7b Added ifc types schema for Ifc2x3 and Ifc4
Types schema located in separate json file, it's structure:
{ ifc_type_name: {"description": type_description, "spec_url": type_spec_url} }

I've also added new API function to get type data - `get_type_doc(version, ifc_type)`
2022-10-30 11:33:20 +06:00
Andrej730 9a25db6584 get_attribute_doc get_entity_doc now use recursive method by default 2022-10-29 18:31:40 +06:00
Andrej730 17ccd0adf7 Simplified getting entity parent information for schema api
Removed unnecssary parent information from json schema - now API is getting it from ifcopenshell schema.
2022-10-29 18:27:51 +06:00
Andrej730 937f39c898 Added information about parent entity to schema
Added information about parent entity to schema (it's located in "parent_entity" entity parameter inside schema), both for Ifc2x3 and Ifc4.

Modified get_entity_doc and get_attribute_doc - now you can use additional optional parameter `recursive=True` with those functions - then parent entities attributes will be included to the list of entity's attributes. For example IfcWindow will also have attributes from IfcBuildingElement, IfcElement, IfcProduct etc...
2022-10-29 17:35:43 +06:00
Andrej730 0b5ccd88a5 Added descriptions for psets and qsets to ifc2x3, ifc4 schema
Example of getting pset description: `get_property_set_doc("IFC4", "Pset_ZoneCommon")['description']`
2022-10-29 16:31:54 +06:00
Andrej730 f2c2fa8dce Added entities predefined types to schema
Both for ifc2x3 and ifc4 but there is still a problem with ifc2x3 predefined types description - it's empty since constants have no description in ifc2x3. For temporary solution I've used description available on ifc4 for ifc2x3 too.

I've also added API function to get entity's predefined type description: `get_predefined_type_doc(version, entity, predefined_type)`

Example for the same constant that has no description in ifc2x3 and has one in ifc4:
https://github.com/buildingSMART/IFC/blob/Ifc2.3.0.1/Constants/s/STEAMINJECTION_1b6zZZM99EevT2LVdQ7B%24V.xml
https://github.com/buildingSMART/IFC/blob/Ifc4.0.2.1/Constants/s/STEAMINJECTION_1b6zZZM99EevT2LVdQ7B$V.xml
2022-10-27 16:23:46 +06:00
Dion Moult 9a0f29170a Fix #2518. Don't fail on non-existent schemas to allow for custom schemas 2022-10-20 15:03:33 +11:00
Dion Moult 159e2ca779 Run black and minor fix. See #1990. 2022-10-19 09:17:37 +11:00
Andrej730 81d80ee415 Doc API is now accessible without setting up DocAPI class
Now you can access Doc API functions directly (like `ifcopenshell.util.doc.get_entity_doc(...)`) without setting up DocAPI class.
To make it work I've set up singleton DocDatabase class and made all paths relative to module location.
2022-10-16 16:54:05 +06:00
Andrej730 4dc860c019 Added IFC v4.0 json schema and added docs API for working with schemas
The schema for IFC4 the same as it was for IFC2x3.
Properties schema for IFC4 includes both quantity and propety sets.

Also cleaned up entities description for IFC2x3 from HTML code and IFC tags.
2022-10-16 13:32:22 +06:00
Andrej730 28aab490df IFC v2.3 json schema and parsing tool to regenerate it (#2501)
* IFC v2.3 json schema and parsing tool to regenerate it

Added entities and propeties schema in json format.

ifc2x3_entities.json format:
entity_name -> description, url, attributes;
attributes format: attribute_name -> attribute_descrption

ifc2x3_properties.json format:
property_set_name -> property_name -> description, children
children format: child_property_name -> child_property_description.

Also added doc.py script that can generate the same json schema files but requires docs IFC 2.3 docs in the same folder (https://github.com/buildingSMART/IFC/tree/Ifc2.3.0.1)

* Moved all json schema files to /util/schema

* Moved json files back to /util/, changed doc.py export location

* Added specification urls for entities and properties

Added specification urls for entities and properties.
Also added a function to parse actual property sets domain from the website to generate specification urls (domain on website and on github do not match).

Schema structure was changed:

ifc2x3_entities.json format:
entity_name -> description, spec_url, attributes;
attributes format: attribute_name -> attribute_descrption

ifc2x3_properties.json format:
property_set_name -> properties, spec_url
properties format: property_name -> description, children_properties
children_properties format: child_property_name -> child_property_description.

ifc2x3_property_sets_domains.json format:
property_set_name -> ifc_domain
2022-10-15 07:14:34 +11:00