Wall.ByCurveAndHeight function wrong level and data

Hi,

By making a script for placing walls I ran into a strange problem. When a Wall.ByCurveAndHeight function is called and a vector is applied the wall will generate on a different level and the data in the properties of the wall don’t match.

The problem doesn’t appear when the same code is made in Python. :thinking:

Does anyone have an explanation for this?

Code Block:

vectorx = Vector.ByCoordinates(vectorxin,0,0);


x1 = 0;
y1 = 0;
z1 = 0;
x2 = 2000;
y2 = 0;
z2 = 0;
wallheigth;
level;
walltypes;
vectorxin;

StartPunt = Point.ByCoordinates(x1,y1,z1);
EindPunt = Point.ByCoordinates(x2,y2,z2);

EindPuntVec = EindPunt.Add(vectorx);

lijn = Line.ByStartPointEndPoint(StartPunt,EindPuntVec);

Wall.ByCurveAndHeight(lijn,wallheigth,level,walltypes);

Python Code:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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

#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

# Place your code below this line

x1 = IN[0]
y1 = IN[1]
z1 = IN[2]
x2 = IN[3]
y2 = IN[4]
z2 = IN[5]
hoogte = IN[6]
level = IN[7]
walltype = IN[8]
vector = IN[9]

metersToFeet1 = 0.3048
feetToMeters = 1 / metersToFeet1
mmToFeet = feetToMeters/1000

LeveId = UnwrapElement(level).Id
WallTypesId = UnwrapElement(walltype).Id
hoogte = hoogte*mmToFeet

XYZstart = XYZ(x1*mmToFeet,y1*mmToFeet,z1*mmToFeet)
XYZeind = XYZ(x2*mmToFeet,y2*mmToFeet,z2*mmToFeet).Add(XYZ(vector*mmToFeet,0,0))
Curve = Line.CreateBound(XYZstart,XYZeind)

TransactionManager.Instance.EnsureInTransaction(doc)
Wall = Wall.Create(doc,Curve,WallTypesId,LeveId,hoogte,0,False,False)
TransactionManager.Instance.TransactionTaskDone()

# Assign your output to the OUT variable.
OUT = Wall

wall

Wall test.dyn (24.0 KB)