private static void PutSeatList(Document doc, List <SeatInfo> seatInfos) { Doc.AutoTransaction(() => { foreach (var seatInfo in seatInfos) { var offset = seatInfo.Location - (RefSeat.Location as LocationPoint)?.Point; var cloneSeatIds = ElementTransformUtils.CopyElement(Doc, RefSeat.Id, offset).ToList(); if (cloneSeatIds.Count == 0) { MessageBox.Show("Copys the seat, but gets not a seat."); return; } var seat = Doc.GetElement(cloneSeatIds[0]); // Sets the seat some parameters. seat.SetSeatParameters(FillPattern, doc, seatInfo); // Sets the seat fill color. seat.SetColorFill(FillPattern, doc, seatInfo.FillColor); if (!seatInfo.IsRotation) { continue; } var location = seatInfo.Location; var startPt = new XYZ(location.X, location.Y + seatInfo.Length / 2, 0); var endPt = new XYZ(location.X, location.Y + seatInfo.Length / 2, 1); var line = Line.CreateBound(startPt, endPt); // No use mirror, mirror element is very slow. ElementTransformUtils.RotateElement(Doc, seat.Id, line, Math.PI); } }); }