Create Wall using Curves

Create Wall using Curves

NonicaTeam
Enthusiast Enthusiast
610 Views
7 Replies
Message 1 of 8

Create Wall using Curves

NonicaTeam
Enthusiast
Enthusiast

Hi,

I am trying to create a wall with a list of curves using the overload in IronPython:

public static Wall Create(
	Document document,
	IList<Curve> profile,
	ElementId wallTypeId,
	ElementId levelId,
	bool structural
)

 

What I do is I get the lines, ordered them sequentially and create the wall. With a rectangular wall, it does work well. The issue is when adding a hole in the profile curves. I cannot stop getting Failed to create wall error. I tried all sorts (reordering the other way around) of workarounds but nothing seems to work. 

This is the method I use to order the lines before calling the wall creation (all lines are cloned before trying to create the new wall and comes from the edges of an actual wall):

def foundFollowingCurve(self, sel_crv, outer_crvs, array_curves, skip_ind):
		try:
			st_po  = sel_crv.GetEndPoint(0)
			end_po = sel_crv.GetEndPoint(1)
			for ind, out_crv in enumerate(outer_crvs):
				if not ind in skip_ind:
					at_st_po  = out_crv.GetEndPoint(0)
					at_end_po = out_crv.GetEndPoint(1)
					if (end_po.IsAlmostEqualTo(at_st_po) or st_po.IsAlmostEqualTo(at_st_po)):
						skip_ind.Add(ind)
						array_curves.Add(out_crv)
						return self.foundFollowingCurve(out_crv, outer_crvs, array_curves, skip_ind)
					elif (end_po.IsAlmostEqualTo(at_end_po) or st_po.IsAlmostEqualTo(at_end_po)):
						skip_ind.Add(ind)
						array_curves.Add(out_crv.CreateReversed())
						return self.foundFollowingCurve(out_crv, outer_crvs, array_curves, skip_ind)	
			return array_curves, skip_ind
		except Exception as e:
			Autodesk.Revit.UI.TaskDialog.Show("Exception", str(e) + " - " + str(sys.exc_info()[-1].tb_lineno))

 

Anyone had experience this issue before?

 

Thanks

0 Likes
Accepted solutions (1)
611 Views
7 Replies
Replies (7)
Message 2 of 8

scgq425
Advocate
Advocate

Hi @NonicaTeam :

this api paramter : IList Curves is the vertical profile not the wall location path , if you want  to create a rectangular boundary wall , you can use this

`Create Method (Document, Curve, ElementId, Boolean)` or `Create Method (Document, Curve, ElementId, ElementId, Double, Double, Boolean, Boolean)` and loop you path list.

LanHui Xu 徐兰辉
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog
LinkedIn
Revit/CAD Development | Steel Product Manager

EESignature

0 Likes
Message 3 of 8

NonicaTeam
Enthusiast
Enthusiast

I appreciate the comment.

I am feeding in the profile curves.

0 Likes
Message 4 of 8

scgq425
Advocate
Advocate

Hi @NonicaTeam :
im sry to post a wrong answer .

if you want to add a hole use api , the wall profile direction and the hole path direction list need all clockwise or reclockwise , like the list :

```

public List<Curve> CreateWallBoundaryList()
{

XYZ p1 = new XYZ(0, 0, 0);
XYZ p2 = new XYZ(5, 0, 0);
XYZ p3 = new XYZ(5, 0, 10);
XYZ p4 = new XYZ(0, 0, 10);
XYZ p5 = new XYZ(1, 0, 2);
XYZ p6 = new XYZ(3, 0, 2);
XYZ p7 = new XYZ(3, 0, 5);
XYZ p8 = new XYZ(1, 0, 5);

Line l1 = Line.CreateBound(p1, p2);
Line l2 = Line.CreateBound(p2, p3);
Line l3 = Line.CreateBound(p3, p4);
Line l4 = Line.CreateBound(p4, p1);
Line l5 = Line.CreateBound(p5, p6);
Line l6 = Line.CreateBound(p6, p7);
Line l7 = Line.CreateBound(p7, p8);
Line l8 = Line.CreateBound(p8, p5);
List<Curve> curves = new List<Curve>()
{
l1,
l2,
l3,
l4,
l5,
l6,
l7,
l8
};

return curves;
}

```

scgq425_0-1733214047577.png

 

 

LanHui Xu 徐兰辉
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog
LinkedIn
Revit/CAD Development | Steel Product Manager

EESignature

Message 5 of 8

NonicaTeam
Enthusiast
Enthusiast

Thanks for your message and the details.

 

I made sure the edges and the hole lines were anticlockwise, however, I keep getting Failed to create wall.

 

Attached the coordinate list and wall picture.

 

Thanks

0 Likes
Message 6 of 8

scgq425
Advocate
Advocate
Accepted solution

Hi @NonicaTeam :

you coordinate is right , but in this api has a bug is : the boundary profile 's first line cant vertical to the inner profile 's first line , is a hidden bug .

so i change you inner list locate like this code , if you code auto sort list , you can add a funciton to make this start coordinate to next : (

 

 

 

public List<Curve> CreateWallBoundaryList()
{

XYZ p1 = new XYZ(49, -60, 30);
XYZ p2 = new XYZ(36, -60, 30);
XYZ p3 = new XYZ(36, -60, 0);
XYZ p4 = new XYZ(49, -60, 0);

XYZ p5 = new XYZ(44, -60, 15.4);
XYZ p6 = new XYZ(40, -60, 15.4);
XYZ p7 = new XYZ(40, -60, 10.2);
XYZ p8 = new XYZ(44, -60, 9.2);
// old locate
//XYZ p5 = new XYZ(44, -60, 9.2);
//XYZ p6 = new XYZ(44, -60, 15.4);
//XYZ p7 = new XYZ(40, -60, 15.4);
//XYZ p8 = new XYZ(40, -60, 10.2);

Line l1 = Line.CreateBound(p1, p2);
Line l2 = Line.CreateBound(p2, p3);
Line l3 = Line.CreateBound(p3, p4);
Line l4 = Line.CreateBound(p4, p1);
Line l5 = Line.CreateBound(p5, p6);
Line l6 = Line.CreateBound(p6, p7);
Line l7 = Line.CreateBound(p7, p8);
Line l8 = Line.CreateBound(p8, p5);
List<Curve> curves = new List<Curve>()
{
l1,
l2,
l3,
l4,
l5,
l6,
l7,
l8
};

return curves;
}

 

 

scgq425_0-1733233105036.png

 

LanHui Xu 徐兰辉
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog
LinkedIn
Revit/CAD Development | Steel Product Manager

EESignature

0 Likes
Message 7 of 8

NonicaTeam
Enthusiast
Enthusiast

Thanks. I appreciate your help. 
I wish this was more documented. This can get complex when you have arcs instead of lines and so on.

😞

0 Likes
Message 8 of 8

scgq425
Advocate
Advocate

Hi @NonicaTeam :

this error likely the revit to calcute two face normal-direction and get difference this  . but no public solution to solve this : (

LanHui Xu 徐兰辉
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

Blog
LinkedIn
Revit/CAD Development | Steel Product Manager

EESignature