diff --git a/RookieStation/Drawing/ExecuteCmds/CmdCreateLightLegend.cs b/RookieStation/Drawing/ExecuteCmds/CmdCreateLightLegend.cs index 233128b..23d1404 100644 --- a/RookieStation/Drawing/ExecuteCmds/CmdCreateLightLegend.cs +++ b/RookieStation/Drawing/ExecuteCmds/CmdCreateLightLegend.cs @@ -25,7 +25,8 @@ namespace RookieStation.Drawing.ExecuteCmds if (doc.ActiveView.ViewType == ViewType.DrawingSheet) { - var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter(), "请选择参考的视口"); + var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter(), "请选择参考的视口确定比例"); + var location = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选择左下角点放置图例"); var viewport = doc.GetElement(portRefer) as Viewport; var viewPlan = doc.GetElement(viewport.ViewId); if (!(viewPlan is ViewPlan)) @@ -50,7 +51,7 @@ namespace RookieStation.Drawing.ExecuteCmds }); doc.Invoke(ts => { - RsRevitUtils.SetLegendLocation(doc, legend); + RsRevitUtils.SetLegendLocation(doc, legend, location); }); }, "创建灯具图例"); } diff --git a/RookieStation/Drawing/ExecuteCmds/CmdCreateMainMaterialsTable.cs b/RookieStation/Drawing/ExecuteCmds/CmdCreateMainMaterialsTable.cs index 09e3051..72bdfb5 100644 --- a/RookieStation/Drawing/ExecuteCmds/CmdCreateMainMaterialsTable.cs +++ b/RookieStation/Drawing/ExecuteCmds/CmdCreateMainMaterialsTable.cs @@ -27,7 +27,8 @@ namespace RookieStation.Drawing.ExecuteCmds try { CurveArray curveArray = new CurveArray(); - var tableLocation = uidoc.Selection.PickPoint(ObjectSnapTypes.Endpoints, "请选择布图区域左上角端点"); + var tableLocation = uidoc.Selection.PickPoint(ObjectSnapTypes.Endpoints, "请选择布图区域左上角点"); + var tableLocation1 = uidoc.Selection.PickPoint(ObjectSnapTypes.Endpoints, "请选择布图区域右下角点"); var sql = SQLiteUtil.GetInstance(); sql.CreateDb(UserConstant.DbFolder + "Inventory.db"); @@ -50,8 +51,7 @@ namespace RookieStation.Drawing.ExecuteCmds foreach (var ele in collectorAll) { string name = string.Empty; - FamilyInstance fi = ele as FamilyInstance; - if (fi != null) + if (ele is FamilyInstance fi) { name = fi.Symbol.FamilyName; } @@ -80,18 +80,21 @@ namespace RookieStation.Drawing.ExecuteCmds materialItems.Add(item); } } - var width = 346 / 304.8; - var height = 283 / 304.8; - var gridWidth = width / 7; - var gridHeight = height / (materialItems.Count + 1);//表头要加1 + //var width = 346 / 304.8; + //var height = 283 / 304.8; + + var width = tableLocation1.X - tableLocation.X; + var height = tableLocation.Y - tableLocation1.Y; + var cellWidth = width / 7; + var cellHeight = height / (materialItems.Count + 1);//表头要加1 doc.InvokeGroup(tg => { doc.Invoke(ts => { for (int j = 0; j < 8; j++) { - var colStart = new XYZ(tableLocation.X + j * gridWidth, tableLocation.Y, 0); - var colEnd = new XYZ(tableLocation.X + j * gridWidth, tableLocation.Y - height, 0); + var colStart = new XYZ(tableLocation.X + j * cellWidth, tableLocation.Y, 0); + var colEnd = new XYZ(tableLocation.X + j * cellWidth, tableLocation.Y - height, 0); Line colLine = Line.CreateBound(colStart, colEnd); curveArray.Append(colLine); } @@ -103,8 +106,8 @@ namespace RookieStation.Drawing.ExecuteCmds }; for (int i = 0; i <= materialItems.Count; i++) { - var rowStart = new XYZ(tableLocation.X, tableLocation.Y - i * gridHeight, 0); - var rowEnd = new XYZ(tableLocation.X + width, tableLocation.Y - i * gridHeight, 0); + var rowStart = new XYZ(tableLocation.X, tableLocation.Y - i * cellHeight, 0); + var rowEnd = new XYZ(tableLocation.X + width, tableLocation.Y - i * cellHeight, 0); Line rowLine = Line.CreateBound(rowStart, rowEnd); curveArray.Append(rowLine); @@ -112,37 +115,37 @@ namespace RookieStation.Drawing.ExecuteCmds { TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 0.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 0.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), "材料名称\nDESCRIPTION", opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 1.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 1.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), "防火等级\nFIRE RATING", opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 2.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 2.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), "图例\nLEGEND", opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 3.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 3.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), "规格\nSPECIFICATIONS", opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 4.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 4.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), "颜色\nPIGMENT", opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 5.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 5.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), "位置\nPOSITION", opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 6.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 6.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), "备注\nREMARK", opts); continue; @@ -151,12 +154,12 @@ namespace RookieStation.Drawing.ExecuteCmds var item = materialItems[i - 1];//从0开始,i=0已运行,并跳过此段 TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 0.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 0.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), item.Description, opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 1.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 1.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), item.FireRating, opts); @@ -164,7 +167,7 @@ namespace RookieStation.Drawing.ExecuteCmds var ii = ImageInstance.Create(doc, activeview, it.Id, - new ImagePlacementOptions(new XYZ(tableLocation.X + 2.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new ImagePlacementOptions(new XYZ(tableLocation.X + 2.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), BoxPlacement.Center)); doc.Regenerate(); ii.get_Parameter(BuiltInParameter.RASTER_SHEETHEIGHT).SetValueString("21"); @@ -172,22 +175,22 @@ namespace RookieStation.Drawing.ExecuteCmds TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 3.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 3.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), item.Specifications, opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 4.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 4.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), item.Pigment, opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 5.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 5.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), item.Position, opts); TextNote.Create(doc, doc.ActiveView.Id, - new XYZ(tableLocation.X + 6.5 * gridWidth, tableLocation.Y - (i + 0.5) * gridHeight, 0), + new XYZ(tableLocation.X + 6.5 * cellWidth, tableLocation.Y - (i + 0.5) * cellHeight, 0), item.Remark, opts); } diff --git a/RookieStation/Drawing/ExecuteCmds/CmdCreateShelvesLegend.cs b/RookieStation/Drawing/ExecuteCmds/CmdCreateShelvesLegend.cs index bce4e1e..582ca3d 100644 --- a/RookieStation/Drawing/ExecuteCmds/CmdCreateShelvesLegend.cs +++ b/RookieStation/Drawing/ExecuteCmds/CmdCreateShelvesLegend.cs @@ -25,6 +25,7 @@ namespace RookieStation.Drawing.ExecuteCmds if (uidoc.ActiveView.ViewType == ViewType.DrawingSheet) { var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter(), "请选择参考的视口确定比例尺"); + var location = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选择左下角点放置图例"); var viewport = doc.GetElement(portRefer) as Viewport; var viewPlan = doc.GetElement(viewport.ViewId); if (!(viewPlan is ViewPlan)) @@ -49,7 +50,7 @@ namespace RookieStation.Drawing.ExecuteCmds }); doc.Invoke(ts => { - RsRevitUtils.SetLegendLocation(doc, legend); + RsRevitUtils.SetLegendLocation(doc, legend, location); }); }, "创建货架图例"); } @@ -113,9 +114,9 @@ namespace RookieStation.Drawing.ExecuteCmds } double fontSize = textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE).AsDouble(); double actualTextHeight = fontSize * 1.6; - double tableGridHeight = actualTextHeight * viewScale * 1.2;//图例网格高度 - double tableGridWidth = tableGridHeight * 5;//图例网格长度 - double[] widths = new double[6] { tableGridHeight * 2, tableGridHeight * 2, tableGridHeight * 6, tableGridHeight * 2, tableGridHeight * 2, tableGridHeight * 2 }; + double tableCellHeight = actualTextHeight * viewScale * 1.2;//图例网格高度 + double tableCellWidth = tableCellHeight * 5;//图例网格长度 + double[] widths = new double[6] { tableCellHeight * 2, tableCellHeight * 2, tableCellHeight * 6, tableCellHeight * 2, tableCellHeight * 2, tableCellHeight * 2 }; CurveArray curveArray = new CurveArray(); for (int i = statistics.Count + 1; i >= 0; i--)//水平线 @@ -123,39 +124,39 @@ namespace RookieStation.Drawing.ExecuteCmds Curve line; if (i > 0 && i < statistics.Count) { - line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * tableGridWidth * 3).CreateOffset(tableGridHeight * i, -XYZ.BasisZ); + line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * tableCellWidth * 3).CreateOffset(tableCellHeight * i, -XYZ.BasisZ); } else { - line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * tableGridWidth * 6).CreateOffset(tableGridHeight * i, -XYZ.BasisZ); + line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * tableCellWidth * 6).CreateOffset(tableCellHeight * i, -XYZ.BasisZ); } curveArray.Append(line); } for (int i = 0; i < 7; i++)//垂直线 { - Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisY * (statistics.Count() + 1) * tableGridHeight).CreateOffset(tableGridWidth * i, XYZ.BasisZ); + Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisY * (statistics.Count() + 1) * tableCellHeight).CreateOffset(tableCellWidth * i, XYZ.BasisZ); curveArray.Append(line); } - var y = XYZ.BasisY * tableGridHeight * (statistics.Count + 0.5); + var y = XYZ.BasisY * tableCellHeight * (statistics.Count + 0.5); var opts = new TextNoteOptions(textNoteType.Id) { VerticalAlignment = VerticalTextAlignment.Middle, HorizontalAlignment = HorizontalTextAlignment.Center }; - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * tableGridWidth * 0.5 + y, "货架类型", opts); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 1.5) + y, "数量", opts); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 2.5) + y, "总延米", opts); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 3.5) + y, "总承载单量", opts); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 4.5) + y, "设计单量", opts); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 5.5) + y, "场地面积", opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * tableCellWidth * 0.5 + y, "货架类型", opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 1.5) + y, "数量", opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 2.5) + y, "总延米", opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 3.5) + y, "总承载单量", opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 4.5) + y, "设计单量", opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 5.5) + y, "场地面积", opts); for (int i = 0; i < statistics.Count(); i++) { - var yElevation = XYZ.BasisY * tableGridHeight * (i + 0.5); + var yElevation = XYZ.BasisY * tableCellHeight * (i + 0.5); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * tableGridWidth * 0.5 + yElevation, statistics[i].ShelfType, opts); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 1.5) + yElevation, statistics[i].Count.ToString(), opts); - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 2.5) + yElevation, + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * tableCellWidth * 0.5 + yElevation, statistics[i].ShelfType, opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 1.5) + yElevation, statistics[i].Count.ToString(), opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 2.5) + yElevation, statistics[i].LinearMetre.ToString(), opts); } //承载单量总和 @@ -164,11 +165,11 @@ namespace RookieStation.Drawing.ExecuteCmds { orders += statistics[i].CapacityOrders; } - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 3.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, orders.ToString(), opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 3.5) + XYZ.BasisY * tableCellHeight * statistics.Count() / 2, orders.ToString(), opts); //设计单量 - TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 4.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, statistics.FirstOrDefault().DesignOrders.ToString(), opts); + TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 4.5) + XYZ.BasisY * tableCellHeight * statistics.Count() / 2, statistics.FirstOrDefault().DesignOrders.ToString(), opts); //面积 - TextNote area = TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 5.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, statistics[0].GroundArea + "m2".ToString(), opts); + TextNote area = TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableCellWidth * 5.5) + XYZ.BasisY * tableCellHeight * statistics.Count() / 2, statistics[0].GroundArea + "m2".ToString(), opts); FormattedText formattedText = new FormattedText(area.Text); TextRange range = new TextRange(area.Text.Length - 2, 1); formattedText.SetSuperscriptStatus(range, true); diff --git a/RookieStation/Drawing/ExecuteCmds/CmdCreateSocketLegend.cs b/RookieStation/Drawing/ExecuteCmds/CmdCreateSocketLegend.cs index 95ad117..08d79dc 100644 --- a/RookieStation/Drawing/ExecuteCmds/CmdCreateSocketLegend.cs +++ b/RookieStation/Drawing/ExecuteCmds/CmdCreateSocketLegend.cs @@ -24,7 +24,8 @@ namespace RookieStation.Drawing.ExecuteCmds if (uidoc.ActiveView.ViewType == ViewType.DrawingSheet) { - var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter(), "请选择参考的视口"); + var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter(), "请选择参考的视口确定比例尺"); + var location = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选择左下角点放置图例"); var viewport = doc.GetElement(portRefer) as Viewport; var viewPlan = doc.GetElement(viewport.ViewId); if (!(viewPlan is ViewPlan)) @@ -49,7 +50,7 @@ namespace RookieStation.Drawing.ExecuteCmds }); doc.Invoke(ts => { - RsRevitUtils.SetLegendLocation(doc, legend); + RsRevitUtils.SetLegendLocation(doc, legend, location); }); }, "创建插座图例"); } diff --git a/RookieStation/Drawing/ExecuteCmds/CmdCreateSwitchLegend.cs b/RookieStation/Drawing/ExecuteCmds/CmdCreateSwitchLegend.cs index 4b02019..6ccd43b 100644 --- a/RookieStation/Drawing/ExecuteCmds/CmdCreateSwitchLegend.cs +++ b/RookieStation/Drawing/ExecuteCmds/CmdCreateSwitchLegend.cs @@ -24,7 +24,8 @@ namespace RookieStation.Drawing.ExecuteCmds if (uidoc.ActiveView.ViewType == ViewType.DrawingSheet) { - var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter(), "请选择参考的视口"); + var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter(), "请选择参考的视口确定比例尺"); + var location = uidoc.Selection.PickPoint(UserConstant.SnapAll, "请选择左下角点放置图例"); var viewport = doc.GetElement(portRefer) as Viewport; var viewPlan = doc.GetElement(viewport.ViewId); if (!(viewPlan is ViewPlan)) @@ -49,7 +50,7 @@ namespace RookieStation.Drawing.ExecuteCmds }); doc.Invoke(ts => { - RsRevitUtils.SetLegendLocation(doc, legend); + RsRevitUtils.SetLegendLocation(doc, legend, location); }); }, "创建开关图例"); } diff --git a/RookieStation/Drawing/ExecuteCmds/CmdCreateViewPlanAnnotation.cs b/RookieStation/Drawing/ExecuteCmds/CmdCreateViewPlanAnnotation.cs index a2831ee..642756c 100644 --- a/RookieStation/Drawing/ExecuteCmds/CmdCreateViewPlanAnnotation.cs +++ b/RookieStation/Drawing/ExecuteCmds/CmdCreateViewPlanAnnotation.cs @@ -103,6 +103,10 @@ namespace RookieStation.Drawing.ExecuteCmds GetParallFacesReferenceArray(faces, faces.FirstOrDefault(), referenceArray, referenceArrayArray); foreach (ReferenceArray array in referenceArrayArray) { + if (array.Size == 0) + { + continue; + } var face = familyInstance.GetGeometryObjectFromReference(array.get_Item(0)) as PlanarFace; var line = Line.CreateUnbound(loc, face.FaceNormal).CreateOffset(600 / 304.8, XYZ.BasisZ) as Line; doc.Create.NewDimension(doc.ActiveView, line, array); @@ -516,6 +520,7 @@ namespace RookieStation.Drawing.ExecuteCmds private void JoinWallsAndColumns(Document doc) { var wallcol = doc.QueryByView(doc.ActiveView); + StringBuilder sb = new StringBuilder(); foreach (var wall in wallcol) { var columncol = doc.QueryByView(doc.ActiveView, BuiltInCategory.OST_StructuralColumns); @@ -526,7 +531,6 @@ namespace RookieStation.Drawing.ExecuteCmds LogicalOrFilter orFilter = new LogicalOrFilter(isInsideFilter, intersectsFilter); columncol.WherePasses(orFilter); - StringBuilder sb = new StringBuilder(); foreach (FamilyInstance column in columncol) { if (!JoinGeometryUtils.AreElementsJoined(doc, wall, column)) @@ -537,10 +541,13 @@ namespace RookieStation.Drawing.ExecuteCmds } catch (Exception) { - sb.Append(column.Id.IntegerValue.ToString() + "\n\r"); + sb.Append($"{column.Name}:{column.Id.IntegerValue}/{wall.Name}:{wall.Id.IntegerValue}" + "\n\r"); } } } + } + if (sb.Length > 0) + { TaskDialog.Show("连接墙柱存在错误", sb.ToString()); } } @@ -632,18 +639,19 @@ namespace RookieStation.Drawing.ExecuteCmds FilteredElementCollector eles = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Walls).WhereElementIsNotElementType(); IntersectionResultArray intersection; StringBuilder sb = new StringBuilder(); - foreach (Wall ele in eles) + foreach (Element e in eles) { - if (ele != null) + Wall wall = e as Wall; + if (wall != null) { - var lc = ele.Location as LocationCurve; + var lc = wall.Location as LocationCurve; var c = lc.Curve; var result = curve.Intersect(c, out intersection); if (result == SetComparisonResult.Overlap) { - joinedElements.Add(ele.Id); + joinedElements.Add(wall.Id); } - sb.Append(ele.Id.ToString() + result + "\r\n"); + sb.Append(wall.Id.ToString() + result + "\r\n"); } } return joinedElements; diff --git a/RookieStation/Drawing/ExecuteCmds/CmdCreateViewSectionAnnotation.cs b/RookieStation/Drawing/ExecuteCmds/CmdCreateViewSectionAnnotation.cs index 05525d7..f43b2d5 100644 --- a/RookieStation/Drawing/ExecuteCmds/CmdCreateViewSectionAnnotation.cs +++ b/RookieStation/Drawing/ExecuteCmds/CmdCreateViewSectionAnnotation.cs @@ -43,23 +43,24 @@ namespace RookieStation.Drawing.ExecuteCmds for (int i = 0; i < ids.Count; i++) { var wall = doc.GetElement(ids[i]); - var loc = RsRevitUtils.GetLocationCurveByElement(wall).Evaluate(0.5, true) + new XYZ(0, 0, 10 / 304.8); + var loc = RsRevitUtils.GetLocationCurveByElement(wall).Evaluate(0.5, true) + new XYZ(0, 0, 20 / 304.8); var tagtext = loc + new XYZ(0, 0, 10 * (i + 1)); - var tag = IndependentTag.Create(doc, v.Id, new Reference(wall), true, TagMode.TM_ADDBY_MATERIAL, TagOrientation.Horizontal, XYZ.Zero); + var tag = IndependentTag.Create(doc, v.Id, new Reference(wall), true, TagMode.TM_ADDBY_MATERIAL, TagOrientation.Horizontal, loc); + doc.Regenerate(); + //tag.LeaderEnd = loc; //tag.TagHeadPosition = tagtext; tags.Add(tag); } - doc.Regenerate(); - for (int i = 0; i < tags.Count; i++) - { - IndependentTag tag = tags[i]; - Wall wall = tag.GetTaggedLocalElement() as Wall; - double wallLength = wall.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsDouble(); - //tag.LeaderElbow = new XYZ(tag.LeaderEnd.X + wallLength / 2, tag.LeaderEnd.Y + wallLength / 2, (i * 0.1 + 1) * 20); - //tag.TagHeadPosition = new XYZ(tag.LeaderEnd.X + wallLength / 2 + 10, tag.LeaderEnd.Y + wallLength / 2 + 10, (i * 0.1 + 1) * 20); - //tag.LeaderEnd += new XYZ(wallLength / 2, wallLength / 2, 0); - } + //for (int i = 0; i < tags.Count; i++) + //{ + // IndependentTag tag = tags[i]; + // Wall wall = tag.GetTaggedLocalElement() as Wall; + // double wallLength = wall.get_Parameter(BuiltInParameter.CURVE_ELEM_LENGTH).AsDouble(); + // tag.LeaderElbow = new XYZ(tag.LeaderEnd.X + wallLength / 2, tag.LeaderEnd.Y + wallLength / 2, (i * 0.1 + 1) * 20); + // tag.TagHeadPosition = new XYZ(tag.LeaderEnd.X + wallLength / 2 + 10, tag.LeaderEnd.Y + wallLength / 2 + 10, (i * 0.1 + 1) * 20); + // tag.LeaderEnd += new XYZ(wallLength / 2, wallLength / 2, 0); + //} } } }); diff --git a/RookieStation/Finishes/ExecuteCmds/CmdFloorFinishes.cs b/RookieStation/Finishes/ExecuteCmds/CmdFloorFinishes.cs index 2beebc9..6089d90 100644 --- a/RookieStation/Finishes/ExecuteCmds/CmdFloorFinishes.cs +++ b/RookieStation/Finishes/ExecuteCmds/CmdFloorFinishes.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Linq; using System.Windows; using RookieStation.Finishes.Views; +using RookieStation.Properties; namespace RookieStation.Finishes.ExecuteCmds { @@ -32,7 +33,10 @@ namespace RookieStation.Finishes.ExecuteCmds return Result.Failed; } WpfFloorFinishes floorCovering = CommonUtils.ShowDialog(); - + if (floorCovering.DialogResult != true) + { + return Result.Cancelled; + } double length; double width; double gap; diff --git a/RookieStation/Finishes/ExecuteCmds/CmdPlaceFloorFinishes.cs b/RookieStation/Finishes/ExecuteCmds/CmdPlaceFloorFinishes.cs index 02e46d5..67601d0 100644 --- a/RookieStation/Finishes/ExecuteCmds/CmdPlaceFloorFinishes.cs +++ b/RookieStation/Finishes/ExecuteCmds/CmdPlaceFloorFinishes.cs @@ -28,7 +28,10 @@ namespace RookieStation.Finishes.ExecuteCmds } WpfFloorFinishes floorFinishes = CommonUtils.ShowDialog(); - + if (floorFinishes.DialogResult != true) + { + return Result.Cancelled; + } double length, width, gap, thickness; bool IsByRoom = false; if (floorFinishes.DialogResult == true) diff --git a/RookieStation/Finishes/Views/WpfFloorFinishes.xaml b/RookieStation/Finishes/Views/WpfFloorFinishes.xaml index cf2f760..3cf9ee3 100644 --- a/RookieStation/Finishes/Views/WpfFloorFinishes.xaml +++ b/RookieStation/Finishes/Views/WpfFloorFinishes.xaml @@ -3,7 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:RookieStation" + xmlns:local="clr-namespace:RookieStation.Finishes.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Width="81" Height="59" diff --git a/RookieStation/MailingAreaModule/ExecuteCmds/CmdPlaceReceptionArea.cs b/RookieStation/MailingAreaModule/ExecuteCmds/CmdPlaceReceptionArea.cs index c872022..d712a16 100644 --- a/RookieStation/MailingAreaModule/ExecuteCmds/CmdPlaceReceptionArea.cs +++ b/RookieStation/MailingAreaModule/ExecuteCmds/CmdPlaceReceptionArea.cs @@ -46,6 +46,10 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds revitWindow = uiapp.MainWindowHandle; WpfReceptionArea receptionAreaPlacement = CommonUtils.ShowDialog(); + if (receptionAreaPlacement.DialogResult != true) + { + return Result.Cancelled; + } //初始值 //阻燃板厚度 double fireRetardantBoardWidth = 15 / 304.8; diff --git a/RookieStation/ProjectConfig/ExcuteCmd/CmdProjectSettings.cs b/RookieStation/ProjectConfig/ExcuteCmd/CmdProjectSettings.cs index 4bef0b6..31ee7f8 100644 --- a/RookieStation/ProjectConfig/ExcuteCmd/CmdProjectSettings.cs +++ b/RookieStation/ProjectConfig/ExcuteCmd/CmdProjectSettings.cs @@ -5,6 +5,8 @@ using RookieStation.ProjectConfig.Views; using RookieStation.Utils; using System; using System.IO; +using System.Linq; +using System.Windows.Forms; namespace RookieStation.ProjectConfig.ExecuteCmds { @@ -18,24 +20,53 @@ namespace RookieStation.ProjectConfig.ExecuteCmds UIDocument uidoc = uiapp.ActiveUIDocument; Document doc = uidoc.Document; WpfProjectSettings settings = CommonUtils.ShowDialog(); + if (settings.DialogResult != true) + { + return Result.Cancelled; + } if (!doc.IsFamilyDocument) { doc.Invoke(ts => { - doc.ProjectInformation.get_Parameter(BuiltInParameter.PROJECT_BUILDING_NAME).Set(Properties.Settings.Default.SchoolName); doc.ProjectInformation.get_Parameter(BuiltInParameter.PROJECT_NAME).Set(Properties.Settings.Default.ProjectName); + try + { + doc.ProjectInformation.GetParameters("建设单位").FirstOrDefault().Set(Properties.Settings.Default.ConstrctionOrg); + doc.ProjectInformation.GetParameters("项目负责人").FirstOrDefault().Set(Properties.Settings.Default.Leader); + doc.ProjectInformation.GetParameters("设计").FirstOrDefault().Set(Properties.Settings.Default.Designer); + doc.ProjectInformation.GetParameters("校对").FirstOrDefault().Set(Properties.Settings.Default.ProofReader); + doc.ProjectInformation.GetParameters("审核").FirstOrDefault().Set(Properties.Settings.Default.Reviewer); + doc.ProjectInformation.GetParameters("审定").FirstOrDefault().Set(Properties.Settings.Default.Approver); + doc.ProjectInformation.GetParameters("专业").FirstOrDefault().Set(Properties.Settings.Default.Major); + doc.ProjectInformation.GetParameters("阶段").FirstOrDefault().Set(Properties.Settings.Default.Phase); + } + catch (Exception ex) + { + Log.WriteLog(ex.Message); + } + var viewSheets = doc.QueryByType(); var viewPlans = doc.QueryByType(); + var levels = doc.QueryByType().Cast().OrderBy(l => l.Elevation); + foreach (Level level in levels) + { + if (Math.Round(level.Elevation) != 0.0) + { + level.Elevation = Properties.Settings.Default.Height / 304.8; + break; + } + } foreach (var v in viewSheets) { v.get_Parameter(BuiltInParameter.SHEET_ISSUE_DATE).Set(Properties.Settings.Default.Date); } + foreach (var v in viewPlans) { try { - var scale = Properties.Settings.Default.Scale; - v.get_Parameter(BuiltInParameter.VIEW_SCALE).SetValueString(scale); + var scale = Convert.ToInt32(Properties.Settings.Default.Scale); + v.get_Parameter(BuiltInParameter.VIEW_SCALE).Set(scale); } catch (Exception ex) { diff --git a/RookieStation/ProjectConfig/Views/WpfProjectSettings.xaml b/RookieStation/ProjectConfig/Views/WpfProjectSettings.xaml index 8dc7a4c..494dd40 100644 --- a/RookieStation/ProjectConfig/Views/WpfProjectSettings.xaml +++ b/RookieStation/ProjectConfig/Views/WpfProjectSettings.xaml @@ -9,7 +9,7 @@ xmlns:sys="clr-namespace:System;assembly=mscorlib" Width="121" Height="112" - MinWidth="300" + MinWidth="500" MinHeight="300" ShowInTaskbar="False" mc:Ignorable="d"> @@ -23,7 +23,9 @@ - + + + @@ -49,32 +51,47 @@ VerticalContentAlignment="Center" InputMethod.IsInputMethodEnabled="True" TextAlignment="Center" /> - + + VerticalAlignment="Center"> - + + + + Text="设计单量:" /> + + + + + + + + + + + +