ifc-commit/docs/commands.md
2026-03-24 16:11:15 +01:00

248 lines
No EOL
5 KiB
Markdown

# Commands
```bash
uv run ifccommit.py <command> [options]
```
## List
List all IFC types present in a file and their element counts.
```bash
uv run ifccommit.py list <input.ifc>
```
**Example:**
```bash
uv run ifccommit.py list model.ifc
```
---
## Info
Print attributes of each element matching a given IFC type.
```bash
uv run ifccommit.py info <input.ifc> <IfcType>
```
**Example:**
```bash
uv run ifccommit.py info model.ifc IfcWall
```
---
## Extract
Extract elements of given IFC types (or presets) into a new IFC file.
```bash
uv run ifccommit.py extract <input.ifc> <output.ifc> <IfcType|preset> [...]
```
**Presets:**
- `walls` — IfcWall, IfcWallStandardCase
- `storey` — IfcBuildingStorey
- `furnitures` — IfcFurnishingElement
**Examples:**
```bash
uv run ifccommit.py extract model.ifc walls.ifc walls
uv run ifccommit.py extract model.ifc slabs.ifc IfcSlab
```
---
## Insert
Insert (merge) a part IFC file into a base IFC file.
```bash
uv run ifccommit.py insert <base.ifc> <part.ifc> <output.ifc>
```
**Example:**
```bash
uv run ifccommit.py insert base.ifc part.ifc merged.ifc
```
---
## Replace
Remove a space and its contents from base, then merge the part file in its place.
```bash
uv run ifccommit.py replace <base.ifc> <space> <part.ifc> <output.ifc>
```
**Example:**
```bash
uv run ifccommit.py replace model.ifc A102 part.ifc result.ifc
```
---
## Split
Split an IFC file into one file per storey, optionally filtered by type.
```bash
uv run ifccommit.py split <input.ifc> <outdir> [IfcType|preset ...]
```
**Examples:**
```bash
uv run ifccommit.py split model.ifc output/
uv run ifccommit.py split model.ifc output/ walls
```
---
## Space
Extract an IfcSpace and all objects contained within it.
```bash
uv run ifccommit.py space <input.ifc> <output.ifc> <name> [--by name|longname]
```
**Options:**
- `--by name` — Match against Name (default)
- `--by longname` — Match against LongName
**Examples:**
```bash
uv run ifccommit.py space model.ifc output.ifc A102
uv run ifccommit.py space model.ifc output.ifc "Living Room" --by longname
```
---
## Move
Translate an element by (x, y, z) metres and write to a new file.
```bash
uv run ifccommit.py move <input.ifc> <output.ifc> [entity_id] [--name X] [--x N] [--y N] [--z N]
```
**Options:**
- `entity_id` — IFC entity id (e.g. 17902)
- `--name` — Find element by name substring
- `--x`, `--y`, `--z` — Offset in metres (default: 0.0)
**Examples:**
```bash
uv run ifccommit.py move model.ifc output.ifc 17902 --x 5.0 --z 1.5
uv run ifccommit.py move model.ifc output.ifc --name "Door" --x 2.0
```
---
## Copy
Copy elements by entity ids or tags and translate copies by (x, y, z) metres.
```bash
uv run ifccommit.py copy <input.ifc> <output.ifc> [--entity-ids N ...] [--tags X ...] [--x N] [--y N] [--z N]
```
**Options:**
- `--entity-ids` — IFC entity ids to copy
- `--tags` — IFC element tags to copy
- `--x`, `--y`, `--z` — Offset in metres (default: 0.0)
**Examples:**
```bash
uv run ifccommit.py copy model.ifc output.ifc --entity-ids 17902 17903 --x 5.0
uv run ifccommit.py copy model.ifc output.ifc --tags ABC123 --y 10.0
```
---
## Diff
Show differences between two IFC files.
```bash
uv run ifccommit.py diff <source.ifc> <target.ifc> [-v] [-o FILE]
```
**Options:**
- `-v`, `--verbose` — Show detailed changes (added, removed, modified elements)
- `-o`, `--output` — Write results to output file
**Examples:**
```bash
uv run ifccommit.py diff old.ifc new.ifc
uv run ifccommit.py diff old.ifc new.ifc -v -o diff.txt
```
---
## History
Write or read `Pset_GitCommit` properties on IFC elements.
**Write mode** — stamp `Pset_GitCommit` on all output elements using `HEAD`:
```bash
uv run ifccommit.py history --write-psets [--workdir DIR] [--yaml YAML]
```
**Read mode** — read `Pset_GitCommit` back and emit JSON:
```bash
uv run ifccommit.py history --input <file.ifc> [--output <out.json>]
```
**Options:**
- `--write-psets` — Enable write mode; stamp elements with current `HEAD`
- `--input` — IFC file to read `Pset_GitCommit` from (read mode)
- `--output` — Output JSON file (read mode)
- `--workdir` — Git repository root (default: cwd)
- `--yaml` — Repo-relative path to the pipeline yaml (default: `yaml/duplex.yaml`)
**Examples:**
```bash
uv run ifccommit.py history --write-psets --yaml yaml/my-pipeline.yaml
uv run ifccommit.py history --input result.ifc --output history.json
```
---
## Remove
Remove all elements contained within each instance of an IFC type.
```bash
uv run ifccommit.py remove <input.ifc> <IfcType> [--output FILE]
```
**Options:**
- `--output` — Output IFC file (default: `<input>_<IfcType>_removed.ifc`)
**Example:**
```bash
uv run ifccommit.py remove model.ifc IfcSpace --output cleaned.ifc
```
---
## Run
Browse and run a pipeline yaml from the demo repo.
```bash
uv run ifccommit.py run
```
This command fetches available pipeline YAML files from the demo repository, lets you select one, and executes it locally.
**Example:**
```bash
uv run ifccommit.py run
```