mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 23:36:20 +00:00
Update README files
Generated with the assistance of an AI coding tool.
This commit is contained in:
+41
-2
@@ -181,6 +181,45 @@ ifcedit run model.ifc pset.edit_pset --pset 15 \
|
|||||||
--properties '{"IsExternal": true, "FireRating": "2HR"}'
|
--properties '{"IsExternal": true, "FireRating": "2HR"}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### quantify
|
||||||
|
|
||||||
|
Run quantity take-off (QTO) on an IFC file, computing physical measurements
|
||||||
|
(volume, area, length, count, weight) and writing them back as
|
||||||
|
`IfcElementQuantity` property sets. Uses `ifc5d` rules.
|
||||||
|
|
||||||
|
**List available rules:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ifcedit quantify list
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{"name": "IFC4QtoBaseQuantities"},
|
||||||
|
{"name": "IFC4X3QtoBaseQuantities"}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Run QTO on a file:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ifcedit quantify run model.ifc IFC4QtoBaseQuantities
|
||||||
|
ifcedit quantify run model.ifc IFC4QtoBaseQuantities --selector IfcWall
|
||||||
|
ifcedit quantify run model.ifc IFC4QtoBaseQuantities -o model_qto.ifc
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"ok": true, "rule": "IFC4QtoBaseQuantities", "elements_quantified": 42}
|
||||||
|
```
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- `--selector <query>` -- ifcopenshell selector to restrict elements (default: all `IfcElement`)
|
||||||
|
- `-o, --output <path>` -- write to a different file instead of overwriting the input
|
||||||
|
|
||||||
|
Note: `quantify run` writes geometry-based measurements and requires the
|
||||||
|
IfcOpenShell C++ geometry bindings for elements with computed quantities.
|
||||||
|
|
||||||
## Error handling
|
## Error handling
|
||||||
|
|
||||||
Errors are reported in the JSON response:
|
Errors are reported in the JSON response:
|
||||||
@@ -198,8 +237,8 @@ Exit code is 0 on success, 1 on error.
|
|||||||
|
|
||||||
`ifcedit` and `ifcquery` are complementary tools:
|
`ifcedit` and `ifcquery` are complementary tools:
|
||||||
|
|
||||||
- **ifcquery** reads and inspects IFC models (summary, tree, info, select, relations, clash)
|
- **ifcquery** reads and inspects IFC models (summary, tree, info, select, relations, clash, validate, schedule, cost, schema)
|
||||||
- **ifcedit** modifies IFC models by wrapping `ifcopenshell.api` functions
|
- **ifcedit** modifies IFC models by wrapping `ifcopenshell.api` functions, and runs QTO via `quantify`
|
||||||
|
|
||||||
A typical workflow: inspect with `ifcquery`, look up the right API function
|
A typical workflow: inspect with `ifcquery`, look up the right API function
|
||||||
with `ifcedit docs`, then apply changes with `ifcedit run`.
|
with `ifcedit docs`, then apply changes with `ifcedit run`.
|
||||||
|
|||||||
+76
-4
@@ -157,6 +157,74 @@ Parameters:
|
|||||||
- `tolerance` -- intersection tolerance in meters (default: 0.002)
|
- `tolerance` -- intersection tolerance in meters (default: 0.002)
|
||||||
- `scope` -- `"storey"` or `"all"` (default: `"storey"`)
|
- `scope` -- `"storey"` or `"all"` (default: `"storey"`)
|
||||||
|
|
||||||
|
#### ifc_validate
|
||||||
|
|
||||||
|
Check the model for schema and constraint violations.
|
||||||
|
|
||||||
|
```
|
||||||
|
ifc_validate()
|
||||||
|
ifc_validate(express_rules=True)
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns `{"valid": true, "issues": []}` or `{"valid": false, "issues": [{"level": "ERROR", "message": "..."}]}`.
|
||||||
|
|
||||||
|
#### ifc_schedule
|
||||||
|
|
||||||
|
List all work schedules and their nested task trees.
|
||||||
|
|
||||||
|
```
|
||||||
|
ifc_schedule()
|
||||||
|
ifc_schedule(max_depth=1) # top-level phases only
|
||||||
|
```
|
||||||
|
|
||||||
|
`max_depth` limits subtask expansion. At the cutoff, `subtasks` is replaced
|
||||||
|
with `{"truncated": true, "count": N}` so you know children exist without
|
||||||
|
fetching them all. Omit for unlimited depth.
|
||||||
|
|
||||||
|
#### ifc_cost
|
||||||
|
|
||||||
|
List all cost schedules and their nested cost item trees.
|
||||||
|
|
||||||
|
```
|
||||||
|
ifc_cost()
|
||||||
|
ifc_cost(max_depth=2) # top two levels of the BoQ
|
||||||
|
```
|
||||||
|
|
||||||
|
`max_depth` limits cost item expansion, same truncation convention as
|
||||||
|
`ifc_schedule`.
|
||||||
|
|
||||||
|
#### ifc_schema
|
||||||
|
|
||||||
|
Return IFC class documentation for any entity type, using the loaded model's
|
||||||
|
schema version.
|
||||||
|
|
||||||
|
```
|
||||||
|
ifc_schema(entity_type="IfcWall")
|
||||||
|
ifc_schema(entity_type="IfcBuildingStorey")
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns description, predefined types, spec URL, and attribute descriptions.
|
||||||
|
Returns `{"error": "Unknown entity: Foo"}` for unrecognised types.
|
||||||
|
|
||||||
|
#### ifc_quantify
|
||||||
|
|
||||||
|
Run quantity take-off (QTO) on the loaded model using an `ifc5d` rule.
|
||||||
|
Computes physical measurements (volume, area, length, count, weight) and
|
||||||
|
writes them back as `IfcElementQuantity` property sets. Modifies the model
|
||||||
|
in-place -- call `ifc_save()` when done.
|
||||||
|
|
||||||
|
```
|
||||||
|
ifc_quantify(rule="IFC4QtoBaseQuantities")
|
||||||
|
ifc_quantify(rule="IFC4QtoBaseQuantities", selector="IfcWall")
|
||||||
|
```
|
||||||
|
|
||||||
|
Available rules: `IFC4QtoBaseQuantities`, `IFC4X3QtoBaseQuantities`.
|
||||||
|
|
||||||
|
`selector` is an optional ifcopenshell selector to restrict which elements
|
||||||
|
are quantified (default: all `IfcElement`).
|
||||||
|
|
||||||
|
Returns `{"ok": true, "rule": "...", "elements_quantified": 42}`.
|
||||||
|
|
||||||
### Edit discovery tools
|
### Edit discovery tools
|
||||||
|
|
||||||
#### ifc_list
|
#### ifc_list
|
||||||
@@ -209,10 +277,14 @@ Does NOT auto-save -- call `ifc_save()` when ready to write changes to disk.
|
|||||||
|
|
||||||
1. **Load** a model: `ifc_load`
|
1. **Load** a model: `ifc_load`
|
||||||
2. **Inspect** with query tools: `ifc_summary`, `ifc_tree`, `ifc_select`, `ifc_info`, `ifc_relations`
|
2. **Inspect** with query tools: `ifc_summary`, `ifc_tree`, `ifc_select`, `ifc_info`, `ifc_relations`
|
||||||
3. **Find** the right API function: `ifc_list`, `ifc_docs`
|
3. **Validate** if needed: `ifc_validate`
|
||||||
4. **Edit** the model: `ifc_edit`
|
4. **Browse schedules / costs**: `ifc_schedule`, `ifc_cost` (use `max_depth=1` first on large projects)
|
||||||
5. **Verify** changes with query tools
|
5. **Look up IFC classes**: `ifc_schema`
|
||||||
6. **Save** when satisfied: `ifc_save`
|
6. **Find** the right API function: `ifc_list`, `ifc_docs`
|
||||||
|
7. **Edit** the model: `ifc_edit`
|
||||||
|
8. **Quantify** elements: `ifc_quantify` (writes QTO psets in-place)
|
||||||
|
9. **Verify** changes with query tools
|
||||||
|
10. **Save** when satisfied: `ifc_save`
|
||||||
|
|
||||||
The model stays in memory across all calls, so multi-step editing sessions
|
The model stays in memory across all calls, so multi-step editing sessions
|
||||||
are fast -- no file I/O between operations.
|
are fast -- no file I/O between operations.
|
||||||
|
|||||||
@@ -197,6 +197,133 @@ ifcquery model.ifc relations 10 --traverse up
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### validate
|
||||||
|
|
||||||
|
Check the model for schema and constraint violations.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ifcquery model.ifc validate
|
||||||
|
ifcquery model.ifc validate --rules
|
||||||
|
```
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- `--rules` -- also run the slower EXPRESS rules check (default: off)
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"valid": true,
|
||||||
|
"issues": []
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
On an invalid model:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"valid": false,
|
||||||
|
"issues": [
|
||||||
|
{"level": "ERROR", "message": "Entity #42 IfcWall.GlobalId is not a valid IfcGloballyUniqueId"}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### schedule
|
||||||
|
|
||||||
|
List all work schedules and their task trees from the model.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ifcquery model.ifc schedule
|
||||||
|
ifcquery model.ifc schedule --depth 1
|
||||||
|
```
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- `--depth N` -- expand at most N levels of subtasks (default: unlimited). At the
|
||||||
|
cutoff, `subtasks` is replaced with `{"truncated": true, "count": N}`.
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 42,
|
||||||
|
"name": "Construction Schedule",
|
||||||
|
"predefined_type": "BASELINE",
|
||||||
|
"tasks": [
|
||||||
|
{
|
||||||
|
"id": 55,
|
||||||
|
"name": "Phase 1",
|
||||||
|
"start": "2024-01-01T09:00:00",
|
||||||
|
"finish": "2024-06-30T17:00:00",
|
||||||
|
"is_milestone": false,
|
||||||
|
"outputs": [{"id": 10, "type": "IfcWall", "name": "Wall A"}],
|
||||||
|
"subtasks": [
|
||||||
|
{"id": 56, "name": "Foundations", "start": null, "finish": null,
|
||||||
|
"is_milestone": false, "outputs": [], "subtasks": []}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### cost
|
||||||
|
|
||||||
|
List all cost schedules and their cost item trees from the model.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ifcquery model.ifc cost
|
||||||
|
ifcquery model.ifc cost --depth 2
|
||||||
|
```
|
||||||
|
|
||||||
|
Options:
|
||||||
|
|
||||||
|
- `--depth N` -- expand at most N levels of subitems (default: unlimited). At the
|
||||||
|
cutoff, `subitems` is replaced with `{"truncated": true, "count": N}`.
|
||||||
|
|
||||||
|
```json
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 100,
|
||||||
|
"name": "Bill of Quantities",
|
||||||
|
"predefined_type": "COSTPLAN",
|
||||||
|
"items": [
|
||||||
|
{
|
||||||
|
"id": 110,
|
||||||
|
"name": "Concrete Works",
|
||||||
|
"values": [{"formula": "1200.00 = material(1200.0)", "category": "material"}],
|
||||||
|
"subitems": [
|
||||||
|
{"id": 111, "name": "Formwork", "values": [], "subitems": []}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
|
### schema
|
||||||
|
|
||||||
|
Show IFC class documentation for any entity type, using the schema version of
|
||||||
|
the loaded model.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ifcquery model.ifc schema IfcWall
|
||||||
|
ifcquery model.ifc schema IfcBuildingStorey
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"description": "The wall represents a vertical construction ...",
|
||||||
|
"predefined_types": {"STANDARD": "A standard wall, extruded vertically ..."},
|
||||||
|
"spec_url": "https://standards.buildingsmart.org/...",
|
||||||
|
"attributes": {
|
||||||
|
"Name": "Optional name for use by the participating software systems",
|
||||||
|
"ObjectPlacement": "Placement of the product in space ..."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns `{"error": "Unknown entity: Foo"}` for unrecognised types.
|
||||||
|
|
||||||
### clash
|
### clash
|
||||||
|
|
||||||
Check a single element for geometric intersections and clearance violations
|
Check a single element for geometric intersections and clearance violations
|
||||||
|
|||||||
Reference in New Issue
Block a user