private static bool ExtrachtHeightForStation(ref XYZ PointToFill, double StationToStudy, XYZ HeightPoint, XYZ PointBeforeIt = null) { if (HeightPoint.X == StationToStudy) { PointToFill = new XYZ(PointToFill.X, PointToFill.Y, HeightPoint.Z); return(true); } else { if (HeightPoint.X > StationToStudy) { if (PointBeforeIt != null) { LineX LL = LineX.CreateBound(PointBeforeIt, HeightPoint); XYZ Vector = HeightPoint - PointBeforeIt; var Angle = XYZ.BasisX.AngleTo(Vector) * 180 / Math.PI; var XPoint = (StationToStudy - PointBeforeIt.X); var point = LL.Evaluate((XPoint / (HeightPoint.X - PointBeforeIt.X)), true); PointToFill = new XYZ(PointToFill.X, PointToFill.Y, point.Z); } return(true); } } return(false); }
/// <summary> /// Tessellate the curve: /// 1). If there are more than 2 points, create a polyline out of the points; /// 2). If there are exactly 2 points, create a line; /// 3). If there's exception thrown during the tessellation process, attempt to create /// a line from start and end points. If that fails, a point will be created instead. /// </summary> /// <param name="curve"></param> /// <returns></returns> private IEnumerable <GeometryObject> Tessellate(Curve curve) { var result = new List <GeometryObject>(); try { // we scale the tesselation rather than the curve var conv = UnitConverter.DynamoToHostFactor(UnitType.UT_Length); // use the ASM tesselation of the curve var pkg = renderPackageFactory.CreateRenderPackage(); curve.Tessellate(pkg, renderPackageFactory.TessellationParameters); // get necessary info to enumerate and convert the lines //var lineCount = pkg.LineVertexCount * 3 - 3; var verts = pkg.LineStripVertices.ToList(); if (verts.Count > 2) { var scaledXYZs = new List <XYZ>(); for (var i = 0; i < verts.Count; i += 3) { scaledXYZs.Add(new XYZ(verts[i] * conv, verts[i + 1] * conv, verts[i + 2] * conv)); } result.Add(PolyLine.Create(scaledXYZs)); } else if (verts.Count == 2) { result.Add(Line.CreateBound(curve.StartPoint.ToXyz(), curve.EndPoint.ToXyz())); } } catch (Exception) { // Add a red bounding box geometry to identify that some errors occur var bbox = curve.BoundingBox; result.AddRange(ProtoToRevitMesh.CreateBoundingBoxMeshForErrors(bbox.MinPoint, bbox.MaxPoint)); try { result.Add(Line.CreateBound(curve.StartPoint.ToXyz(), curve.EndPoint.ToXyz())); } catch (Exception) { try { result.Add(DocumentManager.Instance.CurrentUIApplication.Application.Create.NewPoint(curve.StartPoint.ToXyz())); } catch (ArgumentException) { //if either the X, Y or Z of the point is infinite, no need to add it for preview } } } return(result); }
public XYZ FindIntersectwoline(Line line1, Line line2) { IntersectionResultArray resultArray; if (Line.CreateBound(line2.Origin + 10000.0 * line2.Direction, line2.Origin - 10000.0 * line2.Direction).Intersect((Curve)Line.CreateBound(line1.Origin + 10000.0 * line1.Direction, line1.Origin - 10000.0 * line1.Direction), out resultArray) != SetComparisonResult.Overlap) { throw new InvalidOperationException("Input lines did not intersect."); } if (resultArray == null || resultArray.Size != 1) { throw new InvalidOperationException("Could not extract line intersection point."); } return(resultArray.get_Item(0).XYZPoint); }
private static XYZ ReviseYValue(XYZ nextPt, SeatBatch batch, bool alignBottom) { var line = Line.CreateBound(new XYZ(nextPt.X, -10000000, nextPt.Z), new XYZ(nextPt.X, 10000000, nextPt.Z)); var roomInsPts = line.GetPlaneInsPointList(RoomEdges); var boxInsPts = line.GetPlaneInsPointList(PickEdges); var roomInsMinY = roomInsPts.Min(m => m.Y); var boxInsMinY = boxInsPts.Min(m => m.Y); var roomInsMaxY = roomInsPts.Max(m => m.Y); var boxInsMaxY = boxInsPts.Max(m => m.Y); // Revises the next point y min value. var pt1 = new XYZ(nextPt.X, Math.Max(roomInsMinY, boxInsMinY) + 0.05, nextPt.Z); var pt2 = new XYZ(nextPt.X, Math.Min(roomInsMaxY, boxInsMaxY) - batch.Length - 0.05, nextPt.Z); return(alignBottom ? pt1 : pt2); }
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); } }); }
public void SetValue(Document doc, Autodesk.Revit.DB.Line targetx, FamilyInstance familyInstance, string space) { PLane3D pLane3D = new PLane3D(doc.ActiveView.Origin, doc.ActiveView.ViewDirection); string val1 = string.Empty; double kspace = UnitConvert.StringToFeetAndInches(space, out val1); Transform transform = familyInstance.GetTransform(); Line target = Line.CreateBound(pLane3D.ProjectPointOnPlane(targetx.GetStartPoint()), pLane3D.ProjectPointOnPlane(targetx.GetLastPoint())); var list = familyInstance.LinesGeometry(doc); Line maxp = list.Linemax(); Line max = Line.CreateBound(transform.OfPoint(maxp.GetStartPoint()), transform.OfPoint(maxp.GetLastPoint())); Line lineonplane = Line.CreateBound(pLane3D.ProjectPointOnPlane(max.GetStartPoint()), pLane3D.ProjectPointOnPlane(max.GetLastPoint())); XYZ pointintersect = FindIntersectwoline(target, lineonplane); Parameter dim_length = familyInstance.LookupParameter("DIM_LENGTH"); double value = dim_length.AsDouble(); //XYZ start = pLane3D.ProjectPointOnPlane(max.GetStartPoint()); //XYZ end = pLane3D.ProjectPointOnPlane(max.GetLastPoint()); XYZ start = lineonplane.GetStartPoint(); XYZ end = lineonplane.GetLastPoint(); double kc1 = target.Distance(pLane3D.ProjectPointOnPlane(start)); double kc2 = target.Distance(pLane3D.ProjectPointOnPlane(end)); //Line hg = Line.CreateBound(pointintersect, end); //SketchPlane skt = SketchPlane.Create(doc, pLane3D.GetPlane); //var ty = doc.Create.NewModelCurve(lineonplane, skt); //doc.Create.NewModelCurve(target, skt); //doc.Create.NewModelCurve(hg, skt); //doc.ActiveView.SketchPlane = skt; Line targetXX = Line.CreateBound(target.Origin + 10000.0 * target.Direction, target.Origin - 10000.0 * target.Direction); if (kc1 > kc2) { double length1 = (pointintersect - start).GetLength(); if (value / 2 < length1) { if (length1 < value) { double kc = targetXX.Distance(end); //dim_length.Set(value - kc - kspace); double setk = (value - kc - kspace); string sou1 = setk.DoubleRoundFraction(8); string k; double h = UnitConvert.StringToFeetAndInches(sou1, out k); dim_length.Set(h); XYZ direction = (end - start).Normalize() * (kc + kspace); ElementTransformUtils.MoveElement(doc, familyInstance.Id, -direction); } else { double kc = targetXX.Distance(end); //dim_length.Set(value + kc - kspace); double setk = (value + kc - kspace); string sou1 = setk.DoubleRoundFraction(8); string k; double h = UnitConvert.StringToFeetAndInches(sou1, out k); dim_length.Set(h); XYZ direction = (end - start).Normalize() * (kc - kspace); ElementTransformUtils.MoveElement(doc, familyInstance.Id, direction); } } else { if (length1 < value) { double kc = targetXX.Distance(end); //dim_length.Set(value - (kspace - kc)); double setk = (value - (kspace - kc)); string sou1 = setk.DoubleRoundFraction(8); string k; double h = UnitConvert.StringToFeetAndInches(sou1, out k); dim_length.Set(h); XYZ direction = (end - start).Normalize() * (kc - kspace); ElementTransformUtils.MoveElement(doc, familyInstance.Id, direction); } else { double kc = targetXX.Distance(end); dim_length.Set(value - (kspace - kc)); XYZ direction = (end - start).Normalize() * (kc + kspace); ElementTransformUtils.MoveElement(doc, familyInstance.Id, -direction); } } } else { double lengthk = (pointintersect - end).GetLength(); if (lengthk < value) { double kc = targetXX.Distance(pLane3D.ProjectPointOnPlane(start)); //dim_length.Set(value - kc - kspace); double setk = (value - kc - kspace); string sou1 = setk.DoubleRoundFraction(8); string k; double h = UnitConvert.StringToFeetAndInches(sou1, out k); dim_length.Set(h); } else { //double kc = targetXX.Distance(pLane3D.ProjectPointOnPlane(start)); //dim_length.Set(value + kc - kspace); double kc = targetXX.Distance(pLane3D.ProjectPointOnPlane(start)); var setk = (value + kc - kspace); string sou1 = setk.DoubleRoundFraction(8); string k; double h = UnitConvert.StringToFeetAndInches(sou1, out k); dim_length.Set(h); } } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:\WerkStudent\Updated\General_WithOpening2"); Microsoft.Office.Interop.Excel.Worksheet xlWorksheet = xlWorkbook.Sheets[1]; Microsoft.Office.Interop.Excel.Range xlRange = xlWorksheet.UsedRange; int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; double cF = 1 / 0.3048; //Get UI document UIDocument uidoc = commandData.Application.ActiveUIDocument; //Get document Document doc = uidoc.Document; string level = (String)xlRange.Cells[4, "A"].Value2; //Create levels Level levels = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels) .WhereElementIsNotElementType().Cast <Level>().First(x => x.Name == level); string ty1 = (String)xlRange.Cells[3, "A"].Value2; var FloorType = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Floors) .WhereElementIsElementType().Cast <FloorType>().First(x => x.Name == ty1); int points = Convert.ToInt32(xlRange.Cells[2, "B"].value2); List <XYZ> pointlist1 = new List <XYZ>(); for (int i = 5; i <= points + 4; i = i + 2) { XYZ pisb = new XYZ(xlRange.Cells[i, "B"].value2 * cF, xlRange.Cells[i, "C"].value2 * cF, xlRange.Cells[i, "D"].value2 * cF); pointlist1.Add(pisb); } List <XYZ> pointlist2 = new List <XYZ>(); for (int i = 6; i <= points + 4; i = i + 2) { XYZ pisf = new XYZ(xlRange.Cells[i, "B"].value2 * cF, xlRange.Cells[i, "C"].value2 * cF, xlRange.Cells[i, "D"].value2 * cF); pointlist2.Add(pisf); } List <Line> concurves = new List <Line>(); for (int i = 0; i <= (points - 2) / 2; i++) { XYZ pisb = pointlist1.ElementAt(i); XYZ pisf = pointlist2.ElementAt(i); Line Alllines = Line.CreateBound(pisb, pisf); concurves.Add(Alllines); } //Line close = Line.CreateBound(pointlist2.ElementAt(points -6), pointlist1.ElementAt(0)); // concurves.Add(close); List <Curve> licurve = new List <Curve>(); for (int i = 0; i < concurves.Count; i++) { licurve.Add(concurves.ElementAt(i)); } // Making a curve in a loop CurveLoop crvloop = CurveLoop.Create(licurve); CurveArray curArr = new CurveArray(); foreach (Curve c in crvloop) { //Put the curves to curve array curArr.Append(c); } try { using (Transaction trans = new Transaction(doc, "Bungalow Floors")) { trans.Start(); doc.Create.NewFloor(curArr, FloorType, levels, false); trans.Commit(); } return(Result.Succeeded); } catch (Exception e) { message = e.Message; return(Result.Failed); } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { // get uI document UIDocument uidoc = commandData.Application.ActiveUIDocument; //Get dokument Document doc = uidoc.Document; // Create levels Level level = new FilteredElementCollector(doc) .OfCategory(BuiltInCategory.OST_Levels) .WhereElementIsNotElementType() .Cast <Level>() .First(x => x.Name == "Level 1"); double cF = 1 / 0.3028; XYZ p1 = new XYZ(0 * cF, 0 * cF, 0 * cF); XYZ p2 = new XYZ(13.135 * cF, 0 * cF, 0 * cF); XYZ p3 = new XYZ(13.135 * cF, 9.135 * cF, 0 * cF); XYZ p4 = new XYZ(0 * cF, 9.135 * cF, 0 * cF); Line l1 = Line.CreateBound(p1, p2); Line l2 = Line.CreateBound(p2, p3); Line l3 = Line.CreateBound(p3, p4); Line l4 = Line.CreateBound(p4, p1); List <Curve> curves = new List <Curve>(); curves.Add(l1); curves.Add(l2); curves.Add(l3); curves.Add(l4); // // making a curve in a loop CurveLoop crvloop = CurveLoop.Create(curves); ////double off = UnitUtils.ConvertFromInternalUnits(120, DisplayUnitType.DUT_MILLIMETERS); // // giving the offset CurveLoop offcr = CurveLoop.CreateViaOffset(crvloop, 0.1 * cF, new XYZ(0, 0, 1)); //// creating a curve array object required for method CurveArray curArr = new CurveArray(); foreach (Curve c in offcr) { //// To put the curves to Currve array // //Append adds data to a StringBuilder curArr.Append(c); } try { using (Transaction trans = new Transaction(doc, "Bungalow")) { trans.Start(); // for foundation doc.Create.NewFloor(curArr, false); trans.Commit(); } return(Result.Succeeded); } catch (Exception e) { message = e.Message; return(Result.Failed); } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { // get uI document UIDocument uidoc = commandData.Application.ActiveUIDocument; //Get dokument Document doc = uidoc.Document; // Create levels Level level = new FilteredElementCollector(doc) .OfCategory(BuiltInCategory.OST_Levels) .WhereElementIsNotElementType() .Cast <Level>() .First(x => x.Name == "Level 1"); var wallExterior = new FilteredElementCollector(doc) .OfCategory(BuiltInCategory.OST_Walls) .WhereElementIsElementType() .Cast <WallType>() .First(x => x.Name == "AW 01 a & b(24cm)"); FilteredElementCollector collector = new FilteredElementCollector(doc) .OfClass(typeof(FamilySymbol)) .OfCategory(BuiltInCategory.OST_Windows); FamilySymbol symbol = collector.First(x => x.Name == "TC Haus zwei Flügel(1-50)") as FamilySymbol; Application xlApp = new Microsoft.Office.Interop.Excel.Application(); Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:\WerkStudent\Mail\Gen_Open_Fin_keller"); Worksheet xlWorksheet = xlWorkbook.Sheets[1]; Range xlRange = xlWorksheet.UsedRange; int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; // Input for client double cF = 1 / 0.3048; double height = 2.755; double z = 0.0; //Exterior Walls XYZ p1 = new XYZ(xlRange.Cells[5, "B"].value2 * cF, xlRange.Cells[5, "C"].value2 * cF, z); XYZ p2 = new XYZ(xlRange.Cells[6, "B"].value2 * cF, xlRange.Cells[6, "C"].value2 * cF, z); XYZ p3 = new XYZ(xlRange.Cells[7, "B"].value2 * cF, xlRange.Cells[7, "C"].value2 * cF, z); XYZ p4 = new XYZ(xlRange.Cells[8, "B"].value2 * cF, xlRange.Cells[8, "C"].value2 * cF, z); XYZ pd = new XYZ(xlRange.Cells[9, "H"].value2 * cF, xlRange.Cells[9, "I"].value2 * cF, z); //Exterior curves Line l1 = Line.CreateBound(p1, p2); Line l2 = Line.CreateBound(p2, p3); Line l3 = Line.CreateBound(p3, p4); Line l4 = Line.CreateBound(p4, p1); List <Curve> curExterior = new List <Curve>(); curExterior.Add(l1); curExterior.Add(l2); curExterior.Add(l3); curExterior.Add(l4); Wall wb; try { using (Transaction trans = new Transaction(doc, "Bungalow")) { trans.Start(); List <Wall> wl = new List <Wall>(); foreach (Curve cExt in curExterior) { wb = Wall.Create(doc, cExt, wallExterior.Id, level.Id, height * cF, 0, false, false); wl.Add(wb); } int i = Convert.ToInt32(xlRange.Cells[8, "G"].value2); doc.Create.NewFamilyInstance(pd, symbol, wl.ElementAt(i - 1), level, StructuralType.NonStructural); trans.Commit(); } return(Result.Succeeded); } catch (Exception e) { message = e.Message; return(Result.Failed); } }
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements) { Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"D:\WerkStudent\Updated\General_WithOpening"); Microsoft.Office.Interop.Excel.Worksheet xlWorksheet = xlWorkbook.Sheets[3]; Microsoft.Office.Interop.Excel.Range xlRange = xlWorksheet.UsedRange; int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; //Get UI document UIDocument uidoc = commandData.Application.ActiveUIDocument; //Get document Document doc = uidoc.Document; string level = (String)xlRange.Cells[3, "A"].Value2; //Create levels Level levels = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Levels) .WhereElementIsNotElementType().Cast <Level>().First(x => x.Name == level); string ty1 = (String)xlRange.Cells[2, "A"].Value2; var FloorType = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Floors) .WhereElementIsElementType().Cast <FloorType>().First(x => x.Name == ty1); //string ty2 = (String)xlRange.Cells[2, "B"].Value2; ////var opening =sourceFloor.Document.Create.NewOpening(destFloor,openingCurveArray,true); //var Opening = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_FloorOpening) // .WhereElementIsElementType().Cast<Opening>(); double p01x = xlRange.Cells[4, "B"].value2; double p01y = xlRange.Cells[4, "C"].value2; double p01z = xlRange.Cells[4, "D"].value2; double p02x = xlRange.Cells[5, "B"].value2; double p02y = xlRange.Cells[5, "C"].value2; double p02z = xlRange.Cells[5, "D"].value2; double p03x = xlRange.Cells[6, "B"].value2; double p03y = xlRange.Cells[6, "C"].value2; double p03z = xlRange.Cells[6, "D"].value2; double p04x = xlRange.Cells[7, "B"].value2; double p04y = xlRange.Cells[7, "C"].value2; double p04z = xlRange.Cells[7, "D"].value2; double cF = 1 / 0.3048; XYZ p01 = new XYZ(p01x * cF, p01y * cF, p01z * cF); XYZ p02 = new XYZ(p02x * cF, p02y * cF, p02z * cF); XYZ p03 = new XYZ(p03x * cF, p03y * cF, p03z * cF); XYZ p04 = new XYZ(p04x * cF, p04y * cF, p04z * cF); double p11x = xlRange.Cells[9, "B"].value2; double p11y = xlRange.Cells[9, "C"].value2; double p11z = xlRange.Cells[9, "D"].value2; double p12x = xlRange.Cells[10, "B"].value2; double p12y = xlRange.Cells[10, "C"].value2; double p12z = xlRange.Cells[10, "D"].value2; double p13x = xlRange.Cells[11, "B"].value2; double p13y = xlRange.Cells[11, "C"].value2; double p13z = xlRange.Cells[11, "D"].value2; double p14x = xlRange.Cells[12, "B"].value2; double p14y = xlRange.Cells[12, "C"].value2; double p14z = xlRange.Cells[12, "D"].value2; XYZ p11 = new XYZ(p11x * cF, p11y * cF, p11z * cF); XYZ p12 = new XYZ(p12x * cF, p12y * cF, p12z * cF); XYZ p13 = new XYZ(p13x * cF, p13y * cF, p13z * cF); XYZ p14 = new XYZ(p14x * cF, p14y * cF, p14z * cF); double pf1x = xlRange.Cells[14, "B"].value2; double pf1y = xlRange.Cells[14, "C"].value2; double pf1z = xlRange.Cells[14, "D"].value2; double pf2x = xlRange.Cells[15, "B"].value2; double pf2y = xlRange.Cells[15, "C"].value2; double pf2z = xlRange.Cells[15, "D"].value2; double pf3x = xlRange.Cells[16, "B"].value2; double pf3y = xlRange.Cells[16, "C"].value2; double pf3z = xlRange.Cells[16, "D"].value2; double pf4x = xlRange.Cells[17, "B"].value2; double pf4y = xlRange.Cells[17, "C"].value2; double pf4z = xlRange.Cells[17, "D"].value2; XYZ pf1 = new XYZ(pf1x * cF, pf1y * cF, pf1z * cF); XYZ pf2 = new XYZ(pf2x * cF, pf2y * cF, pf2z * cF); XYZ pf3 = new XYZ(pf3x * cF, pf3y * cF, pf3z * cF); XYZ pf4 = new XYZ(pf4x * cF, pf4y * cF, pf4z * cF); Line l01 = Line.CreateBound(p01, p02); Line l02 = Line.CreateBound(p02, p03); Line l03 = Line.CreateBound(p03, p04); Line l04 = Line.CreateBound(p04, p01); Line l11 = Line.CreateBound(p11, p12); Line l12 = Line.CreateBound(p12, p13); Line l13 = Line.CreateBound(p13, p14); Line l14 = Line.CreateBound(p14, p11); Line lf1 = Line.CreateBound(pf1, pf2); Line lf2 = Line.CreateBound(pf2, pf3); Line lf3 = Line.CreateBound(pf3, pf4); Line lf4 = Line.CreateBound(pf4, pf1); List <Curve> curves = new List <Curve>(); curves.Add(l01); curves.Add(l02); curves.Add(l03); curves.Add(l04); List <Curve> curves1 = new List <Curve>(); curves1.Add(l11); curves1.Add(l12); curves1.Add(l13); curves1.Add(l14); List <Curve> curvesf = new List <Curve>(); curvesf.Add(lf1); curvesf.Add(lf2); curvesf.Add(lf3); curvesf.Add(lf4); // Making a curve in a loop CurveLoop crvloop = CurveLoop.Create(curves); CurveLoop crvloop1 = CurveLoop.Create(curves1); CurveLoop crvloopf = CurveLoop.Create(curvesf); CurveLoop offcr = CurveLoop.CreateViaOffset(crvloop, 0.1 * cF, new XYZ(0, 0, 1)); CurveLoop offcr1 = CurveLoop.CreateViaOffset(crvloop1, 0.1 * cF, new XYZ(0, 0, 1)); CurveLoop offcrf = CurveLoop.CreateViaOffset(crvloopf, 0.1 * cF, new XYZ(0, 0, 1)); // Creating a curve array object required for method CurveArray curArr = new CurveArray(); CurveArray curArr1 = new CurveArray(); CurveArray openingCurveArray = new CurveArray(); foreach (Curve c in offcr) { //Put the curves to curve array curArr.Append(c); } foreach (Curve c in offcr1) { //Put the curves to curve array curArr1.Append(c); } foreach (Curve c in offcrf) { //Put the curves to curve array openingCurveArray.Append(c); } try { using (Transaction trans = new Transaction(doc, "Bungalow/Flair110/Flair152RE")) { trans.Start(); doc.Create.NewFloor(curArr, FloorType, levels, false); // doc.Create.NewFloor(curArr1, FloorType, levels, false); //////Floor flaw = doc.Create.NewFloor(curArr,false); //Floor fl = doc.Create.NewFloor(curArr1, FloorType, levels, false); //doc.Create.NewOpening(fl, curArr1, false); //XYZ openingEdges1 = pf1; //XYZ openingEdges2 = pf2; //XYZ openingEdges3 = pf3; //XYZ openingEdges4 = pf4; //var openingEdges = {openingEdges1, openingEdges2, openingEdges3, openingEdges4}; //var openingCurveArray = openingEdges; var opening = doc.Create.NewFloor(curArr, FloorType, levels, false); doc.Create.NewOpening(opening, openingCurveArray, true); trans.Commit(); } return(Result.Succeeded); } catch (Exception e) { message = e.Message; return(Result.Failed); } }