Create wall by profile Python

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

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

1 Like

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

Remove these nodes

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

1 Like

Hello,
if it can help
assuming it’s mm

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

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

3 Likes

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)

1 Like

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


10 juillet wallbyprofile.dyn (15.4 KB)

Cordially
christian.stan

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?

Thanks again

Arantza

1 Like

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

Cordially
christian.stan

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

Arantza

1 Like

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