Metadata-Version: 2.4
Name: uffutils
Version: 0.4.0
Summary: A set of commandline tools for manipulating UFF files.
Author-email: Jan Hein de Jong <janhein.dejong@gmail.com>
Requires-Python: >=3.13
Requires-Dist: click<9.0.0,>=8.1.8
Requires-Dist: pyuff<3.0.0,>=2.4.6
Description-Content-Type: text/markdown

# UFF Utils 

UFF Utils is a command-line tool for inspecting and manipulating UFF files (e.g., take subsets, move, rotate, scale). For example, if you want to take a subset of every 1000th node, scale from m to mm, and inspect the resulting file, you can do: 

```powershell 
uffutils subset in.uff subset.uff --step 1000
uffutils scale subset.uff scaled.uff --length 1000
uffutils inspect scaled.uff
```

For more functionality, see the description of each command below. 

## Installing

A good way to run UFF utils is through [`uv`](https://docs.astral.sh/uv/getting-started/installation/). Once you have installed `uv`, you can run `uffutils` like so: 

```powershell 
uvx uffutils --help
```

## The `inspect` command 

The `inspect` command allows you to view the contents of a UFF file. Example usage: 

```sh 
uffutils inspect my_file.uff  # Print nice overview 
uffutils inspect my_file.uff --nodes # Print full list of nodes
```

## The `subset` command

Allows you to create file with a subset of nodes, which is particularly useful if you want to downsize a UFF file. Usage: 


```sh
uffutils subset in.uff out.uff --ids "1,2,3"  # Only takes nodes 1, 2 and 3
uffutils subset in.uff out.uff --step 1000  # Takes every 1000th node, starting at 1 
uffutils subset in.uff out.uff --max 100 # Takes the first 100 nodes 
```

Operations can be combined. The following operation yields a file with nodes 10 and 30. 

```sh
uffutils subset in.uff out.uff `
    --selection "10,20,30,40,50"
    --step 2
    --max 2
```

## The `scale` command  

You can scale length: 

```sh
uffutils scale in.uff out.uff --length 1000 
```

## The `move` command 

You can translate the data: 

```sh 
uffutils move in.uff out.uff --xyz 10.0 20.0 30.0 
```

## The `rotate` command

You can rotate the data: 

```sh 
uffutils rotate in.uff out.uff --xyz 90 90 90 --origin 0 0 0
```

## Combining operations in a single command 

You can combine commands through piping, like so: 

```sh
uffutils subset in.uff --step 100 | `
    uffutils scale --length 1000 | `
    uffutils move --xyz 10 20 30 | `
    uffutils rotate - out.uff --xyz 90 0 0 
```
