InvalidOperationException when creating a wall

InvalidOperationException when creating a wall

francois.lozes
Contributor Contributor
284 Views
2 Replies
Message 1 of 3

InvalidOperationException when creating a wall

francois.lozes
Contributor
Contributor

This question is related to a previous question of mine asked a year ago. Anyone knows what can throw an InvalidOperationException when creating a wall?

I get only as a message: "Failed to create the wall" when using:


Wall wall = Wall.Create(document, curve, wallType.Id, level.Id, structural: false);

 

Below are the coordinates of the 3D points defining the wall. You can see they have centimetric accuracy, besides Revit isn't complaning about points not belonging to the plane, so I'm not sure where to look!:

 

{(-223.91, -150.83, 50.42)}
{(-222.78, -150.23, 50.41)}
{(-220.18, -148.84, 50.39)}
{(-210.77, -143.81, 50.39)}
{(-205.70, -141.10, 50.39)}
{(-205.48, -140.98, 50.39)}
{(-204.02, -140.20, 50.36)}
{(-204.06, -140.23, 23.34)}
{(-204.08, -140.23, 16.81)}
{(-225.27, -151.56, 16.81)}
{(-225.26, -151.55, 50.37)}

{(-223.91, -150.83, 50.42)}
{(-222.78, -150.23, 50.41)}
{(-220.18, -148.84, 50.39)}
{(-210.77, -143.81, 50.39)}
{(-205.70, -141.10, 50.39)}
{(-205.48, -140.98, 50.39)}
{(-204.02, -140.20, 50.36)}
{(-204.06, -140.23, 23.34)}
{(-204.08, -140.23, 16.81)}
{(-225.27, -151.56, 16.81)}
{(-225.26, -151.55, 50.37)}
0 Likes
285 Views
2 Replies
Replies (2)
Message 2 of 3

moturi.magati.george
Autodesk
Autodesk

Hi @francois.lozes,

 

Based on the Method you are using, it seems to match with the method given in the documentation here:

 

https://www.revitapidocs.com/2015/8d651eae-ae63-bc50-5f43-383d71ec4301.htm

 

I think the error is coming from the curve list. Kindly share the snippet of your code

 

 

  Moturi George,     Developer Advocacy and Support,  ADN Open
0 Likes
Message 3 of 3

RPTHOMAS108
Mentor
Mentor

Well to start with I would be reducing the number of points in this set by half i.e.

 

221219.PNG

 

For the alternate overload noted you need to create one planar loop that doesn't intersect itself. When you get undocumented errors it points to a complete unexpected usage of the function. The documented exceptions are sometimes also more generic than the limited description of what they state is wrong. In the end it can only check so many possibly wrong forms of input and it can only check for those potential errors so many different ways. So yes your points are planar but you effectively have from the above two overlapping loops.

 

Secondly only when these points are plotted it forms a fairly basic rectangle. So you need to assess if a point between two points is actually adding anything useful or is just additional noise that should be eliminated elsewhere beforehand. Regardless of the exception you get here or not it will be vastly quicker to rationalise your input elsewhere.

 

Fairly simple to eliminate points that are:

A) within a certain distance of one another

B) are colinear with neighbouring points (one either side of the subject point).

 

The (B) aspect can be complicated by how you deal with the cumulative effect i.e. what two points set the baseline to measure out of tolerance from.

0 Likes