# Functions to create archive-style USD

**URL:** <https://forum.aousd.org/t/functions-to-create-archive-style-usd/1630>\
**Category:** USD\
**Tags:** beginner\
**Created:** [June 25, 2024, 2:05am UTC](https://forum.aousd.org/t/functions-to-create-archive-style-usd/1630 "2024-06-25T02:05:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![parker](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@parker](https://forum.aousd.org/u/parker)\
**Post date:** [June 25, 2024, 2:05am UTC](https://forum.aousd.org/t/functions-to-create-archive-style-usd/1630/1 "2024-06-25T02:05:05Z")

</div>

This seems like a beginner question since I always forget where things live in the API…

I’d like to flatten an USD stage and make all paths absolute, in order to transfer the file to a location to be rendered from on our farm. We don’t use custom asset resolvers so this is the easiest way to make a render un-breakable due to potential dependency changes in the layer structure.

What are the easiest functions in the API to let me do this? It will be with Python but pointers to the C++ equivalents are fine, thanks!

---

<div class="post-metadata">

**Author:** ![BigRoyNL](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.aousd.org/bigroynl/32/413_2.png) [@BigRoyNL](https://forum.aousd.org/u/BigRoyNL)\
**Post date:** [June 25, 2024, 10:33pm UTC](https://forum.aousd.org/t/functions-to-create-archive-style-usd/1630/2 "2024-06-25T22:33:12Z")

</div>

### Stage Export or Flatten

Would just [`stage.Export()`](https://openusd.org/dev/api/class_usd_stage.html#a3f3fa959eb4a0a6ac2ec5ca8f248cb95) suffice? It basically writes out a [flattened](https://openusd.org/dev/api/class_usd_stage.html#ae3271778fa2ceeb82fbd51296610820a) copy of your USD stage.

#### UsdUtils.FlattenLayerStack

Other options may be [`UsdUtils.FlattenLayerStack`](https://openusd.org/release/api/flatten_layer_stack_8h.html#a82cccc4bb061ba2244168e4a2515a6c6). Some other topics here cover that:

- [Python flattening stage while preserving relative paths - #2 by spiff](https://forum.aousd.org/t/python-flattening-stage-while-preserving-relative-paths/1476/2) (this topic asks for the opposite of what you want though)

#### Usdz?

Another approach _could be_ to make a `usdz` Zipped USD as is briefly described [here](https://forum.aousd.org/t/flatten-but-keep-variant-sets/276/2) - however it may contain more than you like in particular?

> The `usdzip —asset` utility will create a package for you that contains all needed (localized) referenced usd layers, plus any images/textures the scene requires, and all composition will be retained.

---

<div class="post-metadata">

**Author:** ![parker](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@parker](https://forum.aousd.org/u/parker)\
**Post date:** [August 22, 2024, 8:01pm UTC](https://forum.aousd.org/t/functions-to-create-archive-style-usd/1630/3 "2024-08-22T20:01:38Z")

</div>

Hi Roy, thanks for the reply! Sorry I haven’t had a chance to look at it sooner.

Other things popped up on my todo list so I haven’t done any more work on this, but those functions sounds like good places to start!

Thanks.
