# scripting Collision meshes on imported Revit model

**URL:** <https://forums.unrealengine.com/t/scripting-collision-meshes-on-imported-revit-model/677234>\
**Category:** Architectural and Design Visualization\
**Tags:** collision-meshes, unreal-engine\
**Created:** [October 26, 2022, 6:28am UTC](https://forums.unrealengine.com/t/scripting-collision-meshes-on-imported-revit-model/677234 "2022-10-26T06:28:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Unreality](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/unreality/32/585644_2.png) [@Unreality](https://forums.unrealengine.com/u/Unreality)\
**Post date:** [October 26, 2022, 6:28am UTC](https://forums.unrealengine.com/t/scripting-collision-meshes-on-imported-revit-model/677234/1 "2022-10-26T06:28:12Z")

</div>

Hi, I have imported a large model from Revit, and I then wrote a python script that successfully applied DOP simplified collisions to all the thousands of actors. Here is part of one of the walls.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/e/5/fe53d33eba952c5b317fd214637562f451a039fe.jpeg)  
How can i stop the routine from creating mesh across the doorways, so that we can ‘walk around’ it in 3rd person?  
Here’s the code i used, it does a basic job ok.

import unreal  
asset\_path =‘/game/…’  
def add\_box\_collision (static\_mesh):

```
# You could instead use .SPHERE, .CAPSULE, .NDOP10_X, .NDOP10_Y, .NDOP10_Z, .NDOP18, .NDOP26
shape_type = unreal.ScriptingCollisionShapeType.NDOP10_X
unreal.EditorStaticMeshLibrary.add_simple_collisions(static_mesh, shape_type)
unreal.EditorAssetLibrary.save_loaded_asset(static_mesh)

```

# get a list of all Assets in the path.

all\_assets = unreal.EditorAssetLibrary.list\_assets(asset\_path)  
unreal.EditorFilterLibrary.by\_class(all\_assets,“Doors”,not,“”,“true”)

# load them all into memory.

all\_assets\_loaded = [unreal.EditorAssetLibrary.load\_asset(a) for a in all\_assets]

# filter the list to include

# only Static Meshes.

static\_mesh\_assets = unreal.EditorFilterLibrary.by\_class(all\_assets\_loaded, unreal.StaticMesh)

# run the function above on each Static Mesh in the list.

list(map(add\_box\_collision, static\_mesh\_assets))

---

<div class="post-metadata">

**Author:** ![S-Dot](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/s-dot/32/1194599_2.png) [@S-Dot](https://forums.unrealengine.com/u/S-Dot)\
**Post date:** [October 29, 2022, 4:38am UTC](https://forums.unrealengine.com/t/scripting-collision-meshes-on-imported-revit-model/677234/2 "2022-10-29T04:38:23Z")

</div>

On a mesh like that it is often easier to set the collision to “use complex collision as simple” in the mesh properties. I don’t know how to do that in your script.

Simple collision is called simple for a reason. If the simple collision would be very complex then you can use the model itself as the collision model. That is what “use complex collision as simple” does.
