# Create wall by profile Python

**URL:** <https://forum.dynamobim.com/t/create-wall-by-profile-python/91617>\
**Category:** Revit\
**Tags:** python\
**Created:** [July 10, 2023, 6:25am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617 "2023-07-10T06:25:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![arantza](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@arantza](https://forum.dynamobim.com/u/arantza)\
**Post date:** [July 10, 2023, 6:25am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/1 "2023-07-10T06:25:02Z")

</div>

Hi,

I’m trying to create a wall by a list of lines. I’ve used a code from another Topic of 2019 but it is not working. I get an error saying that I have a string. Could anyone help me? Thanks in advance.

You can see below the code, inputs and error

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/6/76f8dd9853b5c9ba969105ab0b336f00ad733434.png)

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [July 10, 2023, 7:23am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/2 "2023-07-10T07:23:57Z")

</div>

Hi,

- check your input curves, it is possible that your curves are not correctly aligned on the same plane

- the curves are far from the internal origin? It creates accuracy issues

---

<div class="post-metadata">

**Author:** ![arantza](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@arantza](https://forum.dynamobim.com/u/arantza)\
**Post date:** [July 10, 2023, 7:53am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/3 "2023-07-10T07:53:35Z")

</div>

Hi,

Thanks for your comment, but the lines are aligned on the same plane. I have corrected the code and now I have a new error… I attach the images

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/c/2c4eddfc3b6167a98763fef1e50a1671fbd11e7e.png)

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/9/6964e1a95429e2e5486217110abe76b1a9cceb76.png)

---

<div class="post-metadata">

**Author:** ![c.poupin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/c.poupin/32/89152_2.png) [@c.poupin](https://forum.dynamobim.com/u/c.poupin)\
**Post date:** [July 10, 2023, 7:58am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/4 "2023-07-10T07:58:10Z")

</div>

Remove these nodes

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/d/5defe2cd14bc682c5d874023ea729259733f1ba1.png)

What is the unit of your project ?meter, millimeter ?

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 10, 2023, 9:42am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/5 "2023-07-10T09:42:36Z")

</div>

Hello,  
if it can help  
assuming it’s mm

 ![10 juillet wallbyprofile_2023-07-10_11-34-28](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/6/c/6c9e0f352c9cd427ec0d8c5dbdae70437c73ae35.png)

I left only the creation of the wall in the transaction  
python script:

```auto
import clr
import System

from System.Collections.Generic import *
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager 
from RevitServices.Transactions import TransactionManager 

clr.AddReference("RevitAPI")
clr.AddReference("RevitAPIUI")

import Autodesk 
from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication 
app = uiapp.Application 
uidoc = uiapp.ActiveUIDocument

curves=IN[0]
level=UnwrapElement(IN[1])
type=UnwrapElement(IN[2])

typeid=type.Id
levelid=level.Id
profile=List[Curve]()

for curve in curves:
    profile.Add(curve.ToRevitType())

TransactionManager.Instance.EnsureInTransaction(doc)

wall=Wall.Create(doc,profile,typeid,levelid,False)

TransactionManager.Instance.TransactionTaskDone()

OUT = wall

```

edit: you have forgotten `import System`  
cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![arantza](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@arantza](https://forum.dynamobim.com/u/arantza)\
**Post date:** [July 14, 2023, 4:03pm UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/6 "2023-07-14T16:03:32Z")

</div>

Hi Christian, thanks for your help, but I still have warnings. I have copied your code and I get this

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.  
Traceback (most recent call last):  
File “”, line 42, in   
Exception: Failed to create the wall.

Line 42 is were the wall is created:  
wall=Wall.Create(doc,profile,typeid,levelid,False)

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 14, 2023, 5:47pm UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/7 "2023-07-14T17:47:07Z")

</div>

Hello, I tried by changing the engine like you, I don’t have your message, sorry for not being able to do better, I’m attaching the script just in case

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/0/e066599abad8041358ff9bcbb9b1beb455996b0f.png)  
[10 juillet wallbyprofile.dyn](https://forum.dynamobim.com/uploads/short-url/ivmowoo5gMDBsUnehNohsv8w04b.dyn) (15.4 KB)

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![arantza](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@arantza](https://forum.dynamobim.com/u/arantza)\
**Post date:** [July 15, 2023, 7:48am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/8 "2023-07-15T07:48:34Z")

</div>

Hi Christian,

Many thanks! With your script I don’t have the warning. I’ll review mine, I have something wrong for sure.

The problem now is that it doesn’t model the geometry of the points correctly. It seems that is attached to the levels. I don’t know why Revit modify the geometry.

Have you modified your levels’ values to create correcly the geometry?

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/9/49e7dd5ffdd957066b298987842861cece418f44.png)

Thanks again

Arantza

---

<div class="post-metadata">

**Author:** ![christian.stan](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/christian.stan/32/166296_2.png) [@christian.stan](https://forum.dynamobim.com/u/christian.stan)\
**Post date:** [July 15, 2023, 8:26am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/9 "2023-07-15T08:26:54Z")

</div>

Hello, no special handling in addition, I started from a standard architectural template.

Cordially  
christian.stan

---

<div class="post-metadata">

**Author:** ![arantza](https://avatars.discourse-cdn.com/v4/letter/a/8491ac/32.png) [@arantza](https://forum.dynamobim.com/u/arantza)\
**Post date:** [July 17, 2023, 6:22am UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/10 "2023-07-17T06:22:23Z")

</div>

Ok, thanks for your help. This might be happening because I’m using Revit 2021. I’ll keep trying

Arantza

---

<div class="post-metadata">

**Author:** ![Stewan.BotesFCDBK](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@Stewan.BotesFCDBK](https://forum.dynamobim.com/u/Stewan.BotesFCDBK)\
**Post date:** [February 26, 2024, 2:54pm UTC](https://forum.dynamobim.com/t/create-wall-by-profile-python/91617/11 "2024-02-26T14:54:47Z")

</div>

Hi, did you get the script to run? I get the same error.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/f/0/f0810d571c6b9c504ef0b3907c8f45e7973ff6a4.png)
