图例功能
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using HandyControl.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:RookieStation"
|
||||
xmlns:local="clr-namespace:RookieStation.CommonTools.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Width="216"
|
||||
Height="540"
|
||||
@@ -67,10 +67,18 @@
|
||||
Content=""
|
||||
FontFamily="{StaticResource IconFont}"
|
||||
IsDefault="True" />
|
||||
<ListBox x:Name="lbFamilyLib" Grid.Row="2" Grid.ColumnSpan="3" Style="{DynamicResource WrapPanelHorizontalListBox}">
|
||||
<ListBox
|
||||
x:Name="lbFamilyLib"
|
||||
Grid.Row="2"
|
||||
Grid.ColumnSpan="3"
|
||||
Style="{DynamicResource WrapPanelHorizontalListBox}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Margin="10" BorderBrush="Black" BorderThickness="2" CornerRadius="5">
|
||||
<Border
|
||||
Margin="10"
|
||||
BorderBrush="Black"
|
||||
BorderThickness="2"
|
||||
CornerRadius="5">
|
||||
<Grid Width="128">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="128" />
|
||||
@@ -86,7 +94,10 @@
|
||||
<hc:RunningBlock Grid.Row="1" Runaway="False">
|
||||
<TextBlock Text="{Binding Title}" TextAlignment="Center" />
|
||||
</hc:RunningBlock>
|
||||
<StackPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="{x:Type StackPanel}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Autodesk.Revit.UI;
|
||||
using HandyControl.Tools;
|
||||
using RookieStation.CommonTools.ExtHandler;
|
||||
using RookieStation.CommonTools.Models;
|
||||
using RookieStation.Properties;
|
||||
@@ -29,7 +30,6 @@ namespace RookieStation.CommonTools.Views
|
||||
public WpfFamilyDockablePane()
|
||||
{
|
||||
FamilyFolder = Settings.Default.FamilyFolder;
|
||||
|
||||
LoadFamilyExEvent = ExternalEvent.Create(LoadHandler);
|
||||
//if (IsContain)
|
||||
//{
|
||||
|
||||
154
RookieStation/Drawing/ExecuteCmds/CmdCreateLightLegend.cs
Normal file
154
RookieStation/Drawing/ExecuteCmds/CmdCreateLightLegend.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using Autodesk.Revit.UI;
|
||||
using RookieStation.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using RookieStation.Extension;
|
||||
using System.Windows.Controls;
|
||||
using RookieStation.Drawing.Models;
|
||||
using RookieStation.ProjectConfig;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class CmdCreateLightLegend : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||
{
|
||||
UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
|
||||
if (doc.ActiveView.ViewType == ViewType.DrawingSheet)
|
||||
{
|
||||
var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Viewport>(), "请选择参考的视口");
|
||||
var viewport = doc.GetElement(portRefer) as Viewport;
|
||||
var viewPlan = doc.GetElement(viewport.ViewId);
|
||||
if (!(viewPlan is ViewPlan))
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请选择平面视图的视口");
|
||||
return Result.Failed;
|
||||
}
|
||||
try
|
||||
{
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
var viewScale = viewport.get_Parameter(BuiltInParameter.VIEW_SCALE).AsInteger();
|
||||
View legend = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
legend = RsRevitUtils.CreateNewLegend(doc, "灯具图例", viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
var items = GetLightData(doc);
|
||||
CreateLightLegend(doc, GetLightData(doc), legend, viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
RsRevitUtils.SetLegendLocation(doc, legend);
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请打开图纸视图");
|
||||
return Result.Failed;
|
||||
}
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
private List<LegendItem> GetLightData(Document doc)
|
||||
{
|
||||
var lights = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_LightingFixtures).Cast<FamilyInstance>().Where(s => s.Symbol.FamilyName.Contains("灯"));
|
||||
var lightFamilyGroup = lights.GroupBy(g => g.Symbol.FamilyName);//按族分组
|
||||
List<LegendItem> items = new List<LegendItem>();
|
||||
|
||||
var lightAnnotationSymboltypes = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_GenericAnnotation).Cast<FamilySymbol>().Where(s => s.Name.Contains("灯"));
|
||||
|
||||
foreach (var g1 in lightFamilyGroup)
|
||||
{
|
||||
var lightSymbolGroup = g1.ToList().GroupBy(f => f.Name).Reverse();//同一族按类型分组
|
||||
foreach (var g2 in lightSymbolGroup)
|
||||
{
|
||||
var instance = g2.ElementAt(0);
|
||||
var wattage = instance.Symbol.get_Parameter(BuiltInParameter.FBX_LIGHT_WATTAGE).AsValueString();
|
||||
var mark = instance.Symbol.get_Parameter(BuiltInParameter.WINDOW_TYPE_ID).AsString();
|
||||
var annotation = instance.Symbol.get_Parameter(BuiltInParameter.ALL_MODEL_TYPE_COMMENTS).AsString();
|
||||
var comment = annotation == null ? $"{instance.Symbol.FamilyName}" : $"{instance.Symbol.FamilyName},{annotation}";
|
||||
|
||||
var planeLegendTypes = from type in lightAnnotationSymboltypes
|
||||
where type.Name.Contains(instance.Symbol.FamilyName) && type.Name.Contains("平面")
|
||||
select type;
|
||||
LegendItem item = new LegendItem
|
||||
{
|
||||
PlaneLegendType = planeLegendTypes.FirstOrDefault(),
|
||||
Description = comment,
|
||||
Mark = mark,
|
||||
Count = g2.Count(),
|
||||
ColorTemperature = instance.Name,
|
||||
};
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private void CreateLightLegend(Document doc, List<LegendItem> items, View newLegend, int viewScale)
|
||||
{
|
||||
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains(UserConstant.FontName)).FirstOrDefault() as TextNoteType;
|
||||
double fontSize = textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE).AsDouble();
|
||||
double actualTextHeight = fontSize * 1.6;
|
||||
double tableGridHeight = actualTextHeight * viewScale * 2;//图例网格高度
|
||||
var opts = new TextNoteOptions(textNoteType.Id)
|
||||
{
|
||||
HorizontalAlignment = HorizontalTextAlignment.Center,
|
||||
VerticalAlignment = VerticalTextAlignment.Middle,
|
||||
};
|
||||
double[] widths = new double[5] { tableGridHeight * 2, tableGridHeight * 2, tableGridHeight * 6, tableGridHeight * 2, tableGridHeight * 2 };
|
||||
RsRevitUtils.CreateTable(doc, newLegend, items.Count + 1, 5, tableGridHeight, widths);
|
||||
var y = XYZ.BasisY * (items.Count + 0.5) * tableGridHeight;
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * tableGridHeight + y, "图例", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 3) + y, "编号", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 7) + y, "说明", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 11) + y, "色温", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 13) + y, "数量", opts);
|
||||
for (int i = items.Count - 1; i >= 0; i--)
|
||||
{
|
||||
LegendItem item = items[i];
|
||||
y = XYZ.BasisY * (i + 0.5) * tableGridHeight;
|
||||
if (item.PlaneLegendType != null)
|
||||
{
|
||||
doc.Create.NewFamilyInstance(XYZ.BasisX * tableGridHeight + y, item.PlaneLegendType, newLegend);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.Mark))
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 3) + y, item.Mark, opts);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.Description))
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 7) + y, item.Description, opts);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(item.ColorTemperature))
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 11) + y, item.ColorTemperature, opts);
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(item.Count.ToString()))
|
||||
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 13) + y, $"{item.Count}个", opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,9 +56,6 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
else
|
||||
{
|
||||
name = ele.Name;
|
||||
if (name == "单喷灰色乳胶漆")
|
||||
{
|
||||
}
|
||||
}
|
||||
if (CommonUtils.levenshtein(description, name) > similarity || CommonUtils.levenshtein(position, name) > similarity)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using RookieStation.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
@@ -31,11 +32,30 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
TaskDialog.Show("温馨提示", "请选择平面视图的视口");
|
||||
return Result.Failed;
|
||||
}
|
||||
doc.InvokeGroup(tg =>
|
||||
try
|
||||
{
|
||||
var viewScale = viewport.get_Parameter(BuiltInParameter.VIEW_SCALE).AsInteger();
|
||||
CreateLegend(doc, GetShelfData(uidoc), viewScale);
|
||||
});
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
var viewScale = viewport.get_Parameter(BuiltInParameter.VIEW_SCALE).AsInteger();
|
||||
View legend = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
legend = RsRevitUtils.CreateNewLegend(doc, "货架说明", viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
var shelvesData = GetShelfData(doc);
|
||||
CreateShelfLegend(doc, shelvesData, legend, viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
RsRevitUtils.SetLegendLocation(doc, legend);
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -45,9 +65,8 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
private static List<ShelfStatistic> GetShelfData(UIDocument uidoc)
|
||||
private List<ShelfStatistic> GetShelfData(Document doc)
|
||||
{
|
||||
Document doc = uidoc.Document;
|
||||
var shelves = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_Furniture).Cast<FamilyInstance>().Where(s => s.Symbol.FamilyName.Contains("货架"));
|
||||
var rooms = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).Cast<Room>();
|
||||
double area = 0.0;
|
||||
@@ -76,112 +95,71 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
return statistics;
|
||||
}
|
||||
|
||||
private static Autodesk.Revit.DB.View CreateLegend(Document doc, List<ShelfStatistic> statistics, int scale)
|
||||
/// <summary>
|
||||
/// 创建表格、文字
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="statistics"></param>
|
||||
/// <param name="newLegend"></param>
|
||||
/// <param name="viewScale"></param>
|
||||
private void CreateShelfLegend(Document doc, List<ShelfStatistic> statistics, View newLegend, int viewScale)
|
||||
{
|
||||
var legends = doc.QueryByClassAndBuiltInCategory<Autodesk.Revit.DB.View>(BuiltInCategory.OST_Views).Cast<Autodesk.Revit.DB.View>().Where(v => v.ViewType == ViewType.Legend);
|
||||
Autodesk.Revit.DB.View newLegend = null;
|
||||
|
||||
if (legends.Count() == 0)
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请先新建图例");
|
||||
return newLegend;
|
||||
}
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
var legendToCopy = legends.FirstOrDefault();
|
||||
|
||||
var newLegendId = legendToCopy.Duplicate(ViewDuplicateOption.Duplicate);
|
||||
newLegend = doc.GetElement(newLegendId) as Autodesk.Revit.DB.View;
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
newLegend.Name = $"货架说明 {i}";
|
||||
break;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
newLegend.Scale = scale;
|
||||
});
|
||||
|
||||
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains("宋")).FirstOrDefault() as TextNoteType;
|
||||
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains(UserConstant.FontName)).FirstOrDefault() as TextNoteType;
|
||||
double fontSize = textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE).AsDouble();
|
||||
double actualTextHeight = fontSize * 1.6;
|
||||
double legendGridHeight = actualTextHeight * scale * 1.2;//图例网格高度
|
||||
double legendGridLength = legendGridHeight * 5;//图例网格长度
|
||||
doc.Invoke(ts =>
|
||||
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 };
|
||||
CurveArray curveArray = new CurveArray();
|
||||
|
||||
for (int i = statistics.Count + 1; i >= 0; i--)//水平线
|
||||
{
|
||||
CurveArray curveArray = new CurveArray();
|
||||
for (int i = 0; i < statistics.Count() + 2; i++)//水平线
|
||||
Curve line;
|
||||
if (i > 0 && i < statistics.Count)
|
||||
{
|
||||
if (i == 0 || i == statistics.Count() || i == statistics.Count() + 1)
|
||||
{
|
||||
Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * legendGridLength * 6).CreateOffset(legendGridHeight * i, -XYZ.BasisZ);
|
||||
curveArray.Append(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * legendGridLength * 3).CreateOffset(legendGridHeight * i, -XYZ.BasisZ);
|
||||
curveArray.Append(line);
|
||||
}
|
||||
line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * tableGridWidth * 3).CreateOffset(tableGridHeight * i, -XYZ.BasisZ);
|
||||
}
|
||||
for (int i = 0; i < 7; i++)//垂直线
|
||||
else
|
||||
{
|
||||
Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisY * (statistics.Count() + 1) * legendGridHeight).CreateOffset(legendGridLength * i, XYZ.BasisZ);
|
||||
curveArray.Append(line);
|
||||
line = Line.CreateBound(XYZ.Zero, XYZ.BasisX * tableGridWidth * 6).CreateOffset(tableGridHeight * i, -XYZ.BasisZ);
|
||||
}
|
||||
var opts = new TextNoteOptions(textNoteType.Id);
|
||||
for (int i = 0; i <= statistics.Count(); i++)
|
||||
{
|
||||
var yElevation = XYZ.BasisY * legendGridHeight * (i + 1);
|
||||
if (i < statistics.Count())
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * 0.5 + yElevation, statistics[i].ShelfType, opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength + 0.5) + yElevation, statistics[i].Count.ToString(), opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 2 + 0.5) + yElevation,
|
||||
statistics[i].LinearMetre.ToString(), opts);
|
||||
}
|
||||
else
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * 0.5 + yElevation, "货架类型", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength + 0.5) + yElevation, "数量", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 2 + 0.5) + yElevation, "总延米", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 3 + 0.5) + yElevation, "总承载单量", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 4 + 0.5) + yElevation, "设计单量", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 5 + 0.5) + yElevation, "场地面积", opts);
|
||||
}
|
||||
}
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 3 + 0.5) + XYZ.BasisY * legendGridHeight * (statistics.Count() + 1) / 2, statistics[0].CapacityOrders.ToString(), opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 4 + 0.5) + XYZ.BasisY * legendGridHeight * (statistics.Count() + 1) / 2, statistics[0].DesignOrders.ToString(), opts);
|
||||
TextNote tn = TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (legendGridLength * 5 + 0.5) + XYZ.BasisY * legendGridHeight * (statistics.Count() + 1) / 2, statistics[0].GroundArea + "m2".ToString(), opts);
|
||||
FormattedText formattedText = new FormattedText(tn.Text);
|
||||
TextRange range = new TextRange(tn.Text.Length - 2, 1);
|
||||
formattedText.SetSuperscriptStatus(range, true);
|
||||
tn.SetFormattedText(formattedText);
|
||||
doc.Create.NewDetailCurveArray(newLegend, curveArray);
|
||||
});
|
||||
|
||||
doc.Invoke(ts =>
|
||||
curveArray.Append(line);
|
||||
}
|
||||
for (int i = 0; i < 7; i++)//垂直线
|
||||
{
|
||||
//doc.Create.NewDetailCurve(doc.ActiveView, Line.CreateBound(XYZ.Zero, XYZ.BasisX));
|
||||
//XYZ p = new XYZ(6.0335, 1, 0) * 0.03606;
|
||||
//ViewSheet.Create(doc, newLegend.Id);
|
||||
var viewport = Viewport.Create(doc, doc.ActiveView.Id, newLegend.Id, XYZ.Zero);
|
||||
double l = viewport.GetBoxOutline().MaximumPoint.X - viewport.GetBoxOutline().MinimumPoint.X;
|
||||
double w = viewport.GetBoxOutline().MaximumPoint.Y - viewport.GetBoxOutline().MinimumPoint.Y;
|
||||
XYZ c = new XYZ(l / 2 + 7 / 304.8, w / 2 + 7 / 304.8, 0);
|
||||
Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisY * (statistics.Count() + 1) * tableGridHeight).CreateOffset(tableGridWidth * i, XYZ.BasisZ);
|
||||
curveArray.Append(line);
|
||||
}
|
||||
var y = XYZ.BasisY * tableGridHeight * (statistics.Count + 0.5);
|
||||
|
||||
viewport.SetBoxCenter(c);
|
||||
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);
|
||||
for (int i = 0; i < statistics.Count(); i++)
|
||||
{
|
||||
var yElevation = XYZ.BasisY * tableGridHeight * (i + 0.5);
|
||||
|
||||
var ele = new FilteredElementCollector(doc).OfClass(typeof(ElementType)).WhereElementIsElementType().FirstOrDefault(x => x.Name.Contains("无"));
|
||||
viewport.ChangeTypeId(ele.Id);//选择视口-无标题
|
||||
});
|
||||
|
||||
return newLegend;
|
||||
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,
|
||||
statistics[i].LinearMetre.ToString(), opts);
|
||||
}
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 3.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, statistics[0].CapacityOrders.ToString(), opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 4.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, statistics[0].DesignOrders.ToString(), opts);
|
||||
TextNote tn = TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 5.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, statistics[0].GroundArea + "m2".ToString(), opts);
|
||||
FormattedText formattedText = new FormattedText(tn.Text);
|
||||
TextRange range = new TextRange(tn.Text.Length - 2, 1);
|
||||
formattedText.SetSuperscriptStatus(range, true);
|
||||
tn.SetFormattedText(formattedText);
|
||||
var curves = doc.Create.NewDetailCurveArray(newLegend, curveArray);
|
||||
}
|
||||
}
|
||||
}
|
||||
145
RookieStation/Drawing/ExecuteCmds/CmdCreateSocketLegend.cs
Normal file
145
RookieStation/Drawing/ExecuteCmds/CmdCreateSocketLegend.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using RookieStation.Drawing.Models;
|
||||
using RookieStation.Extension;
|
||||
using RookieStation.ProjectConfig;
|
||||
using RookieStation.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class CmdCreateSocketLegend : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||
{
|
||||
UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
|
||||
if (uidoc.ActiveView.ViewType == ViewType.DrawingSheet)
|
||||
{
|
||||
var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Viewport>(), "请选择参考的视口");
|
||||
var viewport = doc.GetElement(portRefer) as Viewport;
|
||||
var viewPlan = doc.GetElement(viewport.ViewId);
|
||||
if (!(viewPlan is ViewPlan))
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请选择平面视图的视口");
|
||||
return Result.Failed;
|
||||
}
|
||||
try
|
||||
{
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
var viewScale = viewport.get_Parameter(BuiltInParameter.VIEW_SCALE).AsInteger();
|
||||
View legend = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
legend = RsRevitUtils.CreateNewLegend(doc, "插座图例", viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
var items = GetSocketData(doc);
|
||||
CreateSocketLegend(doc, GetSocketData(doc), legend, viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
RsRevitUtils.SetLegendLocation(doc, legend);
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请打开图纸视图");
|
||||
return Result.Failed;
|
||||
}
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
private List<LegendItem> GetSocketData(Document doc)
|
||||
{
|
||||
ElementCategoryFilter filter1 = new ElementCategoryFilter(BuiltInCategory.OST_CommunicationDevices);
|
||||
ElementCategoryFilter filter2 = new ElementCategoryFilter(BuiltInCategory.OST_ElectricalFixtures);
|
||||
LogicalOrFilter logicalOrFilter = new LogicalOrFilter(filter1, filter2);
|
||||
var sockets = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).WherePasses(logicalOrFilter).Cast<FamilyInstance>().Where(s => s.Symbol.FamilyName.Contains("插座"));
|
||||
var socketAnnotationSymboltypes = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_GenericAnnotation).Cast<FamilySymbol>().Where(s => s.Name.Contains("插座"));
|
||||
|
||||
var socketFamilyGroup = sockets.GroupBy(g => g.Symbol.FamilyName);//按族分组
|
||||
List<LegendItem> items = new List<LegendItem>();
|
||||
|
||||
foreach (var g1 in socketFamilyGroup)
|
||||
{
|
||||
var lightSymbolGroup = g1.ToList().GroupBy(f => f.Name);//同一族按类型分组
|
||||
foreach (var g2 in lightSymbolGroup)
|
||||
{
|
||||
var instance = g2.ElementAt(0);
|
||||
var familyName = instance.Symbol.FamilyName;
|
||||
var planeLegendTypes = from type in socketAnnotationSymboltypes
|
||||
where type.Name.Contains(familyName) && type.Name.Contains("平面")
|
||||
select type;
|
||||
|
||||
LegendItem item = new LegendItem
|
||||
{
|
||||
PlaneLegendType = planeLegendTypes.FirstOrDefault(),
|
||||
Description = familyName.Split(' ').FirstOrDefault(),
|
||||
Count = g2.Count(),
|
||||
Position = "现场定高"
|
||||
};
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private void CreateSocketLegend(Document doc, List<LegendItem> items, View newLegend, int viewScale)
|
||||
{
|
||||
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains(UserConstant.FontName)).FirstOrDefault() as TextNoteType;
|
||||
double fontSize = textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE).AsDouble();
|
||||
double actualTextHeight = fontSize * 1.6;
|
||||
double tableGridHeight = actualTextHeight * viewScale * 2;//图例网格高度
|
||||
double tableGridWidth = tableGridHeight * 2;
|
||||
var opts = new TextNoteOptions(textNoteType.Id)
|
||||
{
|
||||
HorizontalAlignment = HorizontalTextAlignment.Center,
|
||||
VerticalAlignment = VerticalTextAlignment.Middle,
|
||||
};
|
||||
double[] widths = new double[4] { tableGridWidth, tableGridWidth, tableGridWidth, tableGridWidth };
|
||||
RsRevitUtils.CreateTable(doc, newLegend, items.Count + 1, 4, tableGridHeight, widths);
|
||||
var y = XYZ.BasisY * (items.Count + 0.5) * tableGridHeight;
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * tableGridHeight + y, "图例", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 3) + y, "说明", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 5) + y, "定位", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 7) + y, "数量", opts);
|
||||
for (int i = items.Count - 1; i >= 0; i--)
|
||||
{
|
||||
LegendItem item = items[i];
|
||||
y = XYZ.BasisY * (i + 0.5) * tableGridHeight;
|
||||
//TextNote.Create(doc, newLegend.Id, new XYZ(tableGridWidth * 0.5, (items.Count + 0.5) * tableGridHeight, 0), "图例", opts);
|
||||
if (item.PlaneLegendType != null)
|
||||
{
|
||||
doc.Create.NewFamilyInstance(XYZ.BasisX * tableGridHeight + y, item.PlaneLegendType, newLegend);
|
||||
}
|
||||
if (item.Description != null)
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 3) + y, item.Description, opts);
|
||||
}
|
||||
if (item.Position != null)
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 5) + y, item.Position, opts);
|
||||
}
|
||||
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridHeight * 7) + y, $"{item.Count}个", opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
142
RookieStation/Drawing/ExecuteCmds/CmdCreateSwitchLegend.cs
Normal file
142
RookieStation/Drawing/ExecuteCmds/CmdCreateSwitchLegend.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using RookieStation.Drawing.Models;
|
||||
using RookieStation.Extension;
|
||||
using RookieStation.ProjectConfig;
|
||||
using RookieStation.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class CmdCreateSwitchLegend : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||
{
|
||||
UIDocument uidoc = commandData.Application.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
|
||||
if (uidoc.ActiveView.ViewType == ViewType.DrawingSheet)
|
||||
{
|
||||
var portRefer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Viewport>(), "请选择参考的视口");
|
||||
var viewport = doc.GetElement(portRefer) as Viewport;
|
||||
var viewPlan = doc.GetElement(viewport.ViewId);
|
||||
if (!(viewPlan is ViewPlan))
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请选择平面视图的视口");
|
||||
return Result.Failed;
|
||||
}
|
||||
try
|
||||
{
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
var viewScale = viewport.get_Parameter(BuiltInParameter.VIEW_SCALE).AsInteger();
|
||||
View legend = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
legend = RsRevitUtils.CreateNewLegend(doc, "开关图例", viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
var items = GetSwitchData(doc);
|
||||
CreateSwitchLegend(doc, GetSwitchData(doc), legend, viewScale);
|
||||
});
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
RsRevitUtils.SetLegendLocation(doc, legend);
|
||||
});
|
||||
});
|
||||
}
|
||||
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请打开图纸视图");
|
||||
return Result.Failed;
|
||||
}
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
private List<LegendItem> GetSwitchData(Document doc)
|
||||
{
|
||||
var switchs = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_LightingDevices).Cast<FamilyInstance>().Where(s => s.Symbol.FamilyName.Contains("开关"));
|
||||
|
||||
var socketFamilyGroup = switchs.GroupBy(g => g.Symbol.FamilyName).Reverse();//按族分组
|
||||
List<LegendItem> items = new List<LegendItem>();
|
||||
|
||||
foreach (var g1 in socketFamilyGroup)
|
||||
{
|
||||
var lightSymbolGroup = g1.ToList().GroupBy(f => f.Name);//同一族按类型分组
|
||||
foreach (var g2 in lightSymbolGroup)
|
||||
{
|
||||
var instance = g2.ElementAt(0);
|
||||
var symbolName = instance.Symbol.Name;
|
||||
var switchAnnotationSymboltypes = new FilteredElementCollector(doc).OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_GenericAnnotation).Cast<FamilySymbol>().Where(s => s.Name.Contains("开关"));
|
||||
var planeLegendTypes = from type in switchAnnotationSymboltypes
|
||||
where type.Name.Contains(symbolName) && type.Name.Contains("平面")
|
||||
select type;
|
||||
var elevationLegendTypes = from type in switchAnnotationSymboltypes
|
||||
where type.Name.Contains(symbolName) && type.Name.Contains("立面")
|
||||
select type;
|
||||
LegendItem item = new LegendItem
|
||||
{
|
||||
PlaneLegendType = planeLegendTypes.FirstOrDefault(),
|
||||
Description = symbolName,
|
||||
ElevationLegend = elevationLegendTypes.FirstOrDefault(),
|
||||
Count = g2.Count(),
|
||||
};
|
||||
items.Add(item);
|
||||
}
|
||||
}
|
||||
return items; ;
|
||||
}
|
||||
|
||||
private void CreateSwitchLegend(Document doc, List<LegendItem> items, View newLegend, int viewScale)
|
||||
{
|
||||
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains(UserConstant.FontName)).FirstOrDefault() as TextNoteType;
|
||||
double fontSize = textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE).AsDouble();
|
||||
double actualTextHeight = fontSize * 1.6;
|
||||
double tableGridHeight = actualTextHeight * viewScale * 2;//图例网格高度
|
||||
double tableGridWidth = tableGridHeight * 2;
|
||||
var opts = new TextNoteOptions(textNoteType.Id)
|
||||
{
|
||||
HorizontalAlignment = HorizontalTextAlignment.Center,
|
||||
VerticalAlignment = VerticalTextAlignment.Middle,
|
||||
};
|
||||
double[] widths = new double[4] { tableGridWidth, tableGridWidth, tableGridWidth, tableGridWidth };
|
||||
RsRevitUtils.CreateTable(doc, newLegend, items.Count + 1, 4, tableGridHeight, widths);
|
||||
var y = XYZ.BasisY * (items.Count + 0.5) * tableGridHeight;
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth / 2) + y, "图例", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 3 / 2) + y, "说明", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 5 / 2) + y, "立面图例", opts);
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 7 / 2) + y, "数量", opts);
|
||||
for (int i = items.Count - 1; i >= 0; i--)
|
||||
{
|
||||
LegendItem item = items[i];
|
||||
y = XYZ.BasisY * (i + 0.5) * tableGridHeight;
|
||||
if (item.PlaneLegendType != null)
|
||||
{
|
||||
doc.Create.NewFamilyInstance(XYZ.BasisX * (tableGridWidth / 2) + y, item.PlaneLegendType, newLegend);
|
||||
}
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 3 / 2) + y, item.Description, opts);
|
||||
if (item.ElevationLegend != null)
|
||||
{
|
||||
doc.Create.NewFamilyInstance(XYZ.BasisX * (tableGridWidth * 5 / 2) + y, item.ElevationLegend, newLegend);
|
||||
}
|
||||
if (item.Count != 0)
|
||||
{
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 7 / 2) + y, $"{item.Count}个", opts);
|
||||
}
|
||||
}
|
||||
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 5.5) + y, "注:面板底边距地H:1300mm", opts);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using RookieStation.Extension;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class UnifyViewPlanCropBoxAndPositionOnViewSheet : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||
{
|
||||
UIApplication uiapp = commandData.Application;
|
||||
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||
Autodesk.Revit.ApplicationServices.Application app = uiapp.Application;
|
||||
Document doc = uidoc.Document;
|
||||
DocumentSet docset = uiapp.Application.Documents;
|
||||
var box = uidoc.Selection.PickBox(PickBoxStyle.Crossing, "请选择出图的范围框");
|
||||
var viewplans = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan)).Cast<ViewPlan>();
|
||||
ICollection<Element> wallinstances = new FilteredElementCollector(doc).OfClass(typeof(ViewPlan)).WhereElementIsNotElementType().ToElements();
|
||||
//min (0.0229658792650917, 0.0229658792650921, 0)
|
||||
//max (1.15813648293937, 0.951443569553805, 0)
|
||||
doc.InvokeGroup(tg =>
|
||||
{
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
foreach (var v in viewplans)
|
||||
{
|
||||
//var isdrawing = item.GetParameters("视图分类").FirstOrDefault().AsString().Contains("出图");
|
||||
|
||||
//if (isdrawing)
|
||||
//{
|
||||
//}
|
||||
v.CropBoxActive = true;
|
||||
BoundingBoxXYZ boundingBox = new BoundingBoxXYZ();
|
||||
boundingBox.Max = box.Max;
|
||||
boundingBox.Min = box.Min;
|
||||
v.CropBox = boundingBox;
|
||||
}
|
||||
}, "设置裁剪框");
|
||||
}, "统一图纸平面的视口");
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
52
RookieStation/Drawing/Models/LegendItem.cs
Normal file
52
RookieStation/Drawing/Models/LegendItem.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RookieStation.Drawing.Models
|
||||
{
|
||||
internal class LegendItem
|
||||
{
|
||||
/// <summary>
|
||||
/// 标记、编号
|
||||
/// </summary>
|
||||
public string Mark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 色温
|
||||
/// </summary>
|
||||
public string ColorTemperature { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 常规注释族
|
||||
/// </summary>
|
||||
public FamilySymbol PlaneLegendType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 元素,图例构件平面
|
||||
/// </summary>
|
||||
public Element Element { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 说明,族名
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int Count { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置
|
||||
/// </summary>
|
||||
public string Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 立面图例
|
||||
/// </summary>
|
||||
public FamilySymbol ElevationLegend { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,12 @@ namespace RookieStation.Drawing.Models
|
||||
public int Count { get; set; }
|
||||
public double LinearMetre { get; set; }
|
||||
public string ShelfType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最大容量
|
||||
/// </summary>
|
||||
public int CapacityOrders { get; set; }
|
||||
|
||||
public int DesignOrders { get; set; }
|
||||
public double GroundArea { get; set; }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using HandyControl.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace RookieStation.Finishes.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
[Obsolete]
|
||||
[Obsolete("已替换", true)]
|
||||
internal class CmdFloorFinishes : IExternalCommand
|
||||
{
|
||||
public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using HandyControl.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -30,7 +31,6 @@ namespace RookieStation.Finishes.Views
|
||||
public double PavementThickness { get; set; }
|
||||
|
||||
public WpfFloorFinishes()
|
||||
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.DB.Architecture;
|
||||
using HandyControl.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Autodesk.Revit.UI;
|
||||
using HandyControl.Tools;
|
||||
using RookieStation.ProjectConfig;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -33,7 +34,6 @@ namespace RookieStation.MailingAreaModule.Views
|
||||
public double AluminumpLasticPanelGgap;
|
||||
|
||||
public WpfReceptionArea()
|
||||
|
||||
{
|
||||
InitializeComponent();
|
||||
tbAluminumpLasticPanelHeight.Text = (UserConstant.Height / 3 * 2).ToString();
|
||||
|
||||
@@ -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.ParcelAreaModule.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Width="58"
|
||||
Height="145"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using HandyControl.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using HandyControl.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -25,7 +26,6 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
public double PassageWidth { get; set; }
|
||||
|
||||
public WpfExitGate()
|
||||
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using HandyControl.Tools;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -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.ParcelAreaModule.Views"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="货架端牌"
|
||||
Width="129"
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Tools;
|
||||
|
||||
namespace RookieStation.ParcelAreaModule.Views
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Autodesk.Revit.UI;
|
||||
using HandyControl.Tools;
|
||||
using RookieStation.ParcelAreaModule;
|
||||
using RookieStation.ParcelAreaModule.Models;
|
||||
using RookieStation.ParcelAreaModule.ViewModels;
|
||||
|
||||
@@ -3,6 +3,7 @@ using Autodesk.Revit.UI;
|
||||
using RookieStation.Extension;
|
||||
using RookieStation.ProjectConfig.Views;
|
||||
using RookieStation.Utils;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace RookieStation.ProjectConfig.ExecuteCmds
|
||||
@@ -17,11 +18,33 @@ namespace RookieStation.ProjectConfig.ExecuteCmds
|
||||
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
WpfProjectSettings settings = CommonUtils.ShowDialog<WpfProjectSettings>();
|
||||
doc.Invoke(ts =>
|
||||
if (!doc.IsFamilyDocument)
|
||||
{
|
||||
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);
|
||||
}, "项目设置");
|
||||
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);
|
||||
var viewSheets = doc.QueryByType<ViewSheet>();
|
||||
var viewPlans = doc.QueryByType<ViewPlan>();
|
||||
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 = Convert.ToInt32(Properties.Settings.Default.Scale);
|
||||
v.get_Parameter(BuiltInParameter.VIEW_SCALE).Set(scale);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.WriteLog(ex.Message);//可能存在部分视图设置视图样板导致无法修改比例尺
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}, "项目设置");
|
||||
}
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
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.ProjectConfig"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
Width="121"
|
||||
Height="112"
|
||||
MinWidth="300"
|
||||
@@ -21,7 +22,7 @@
|
||||
</Window.Resources>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.75*" />
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
@@ -30,6 +31,8 @@
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
@@ -91,9 +94,38 @@
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
PreviewTextInput="tb_PreviewTextInput"
|
||||
TextAlignment="Center" />
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Text="图纸比例:1/ " />
|
||||
<TextBox
|
||||
x:Name="tbScale"
|
||||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Height="30"
|
||||
VerticalContentAlignment="Center"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
PreviewTextInput="tb_PreviewTextInput"
|
||||
TextAlignment="Center" />
|
||||
<TextBlock
|
||||
Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Text="图纸日期:" />
|
||||
<DatePicker
|
||||
x:Name="tpDate"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Height="30"
|
||||
VerticalContentAlignment="Center"
|
||||
InputMethod.IsInputMethodEnabled="False"
|
||||
SelectedDate="{x:Static sys:DateTime.Today}" />
|
||||
<Button
|
||||
x:Name="btnConfirm"
|
||||
Grid.Row="4"
|
||||
Grid.Row="6"
|
||||
Grid.Column="1"
|
||||
Width="75"
|
||||
Height="30"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using HandyControl.Properties.Langs;
|
||||
using HandyControl.Tools;
|
||||
using RookieStation.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -42,6 +44,8 @@ namespace RookieStation.ProjectConfig.Views
|
||||
Properties.Settings.Default.Orders = Convert.ToInt32(tbOrders.Text);
|
||||
Properties.Settings.Default.SchoolName = tbSchoolName.Text;
|
||||
Properties.Settings.Default.ProjectName = tbProjectName.Text;
|
||||
Properties.Settings.Default.Scale = tbScale.Text;
|
||||
Properties.Settings.Default.Date = tpDate.SelectedDate.Value.ToString("d");
|
||||
Properties.Settings.Default.Save();
|
||||
|
||||
Close();
|
||||
|
||||
34
RookieStation/Properties/Resources.Designer.cs
generated
34
RookieStation/Properties/Resources.Designer.cs
generated
@@ -153,9 +153,9 @@ namespace RookieStation.Properties {
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap Legend {
|
||||
internal static System.Drawing.Bitmap LightLegend {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("Legend", resourceCulture);
|
||||
object obj = ResourceManager.GetObject("LightLegend", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
@@ -210,6 +210,16 @@ namespace RookieStation.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap ShelfLegend {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("ShelfLegend", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
@@ -220,6 +230,26 @@ namespace RookieStation.Properties {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap SocketLegend {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("SocketLegend", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap SwitchLegend {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("SwitchLegend", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||
/// </summary>
|
||||
|
||||
@@ -145,8 +145,8 @@
|
||||
<data name="Lamp" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\lamp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Legend" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Legend.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
<data name="LightLegend" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\LightLegend.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="LogoExtrusion" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\logoextrusion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
@@ -163,9 +163,18 @@
|
||||
<data name="ShelfCard" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\shelfcard.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ShelfLegend" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ShelfLegend.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="Shipping" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\shipping.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SocketLegend" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SocketLegend.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="SwitchLegend" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\SwitchLegend.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="ViewPlanDim" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ViewPlanDim.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
24
RookieStation/Properties/Settings.Designer.cs
generated
24
RookieStation/Properties/Settings.Designer.cs
generated
@@ -108,5 +108,29 @@ namespace RookieStation.Properties {
|
||||
this["SchoolName"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string Date {
|
||||
get {
|
||||
return ((string)(this["Date"]));
|
||||
}
|
||||
set {
|
||||
this["Date"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
[global::System.Configuration.UserScopedSettingAttribute()]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Configuration.DefaultSettingValueAttribute("")]
|
||||
public string Scale {
|
||||
get {
|
||||
return ((string)(this["Scale"]));
|
||||
}
|
||||
set {
|
||||
this["Scale"] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,5 +26,11 @@
|
||||
<Setting Name="SchoolName" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)">漳州职业技术学院</Value>
|
||||
</Setting>
|
||||
<Setting Name="Date" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
<Setting Name="Scale" Type="System.String" Scope="User">
|
||||
<Value Profile="(Default)" />
|
||||
</Setting>
|
||||
</Settings>
|
||||
</SettingsFile>
|
||||
BIN
RookieStation/Resources/LightLegend.png
Normal file
BIN
RookieStation/Resources/LightLegend.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 597 B |
BIN
RookieStation/Resources/ShelfLegend.png
Normal file
BIN
RookieStation/Resources/ShelfLegend.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 434 B |
BIN
RookieStation/Resources/SocketLegend.png
Normal file
BIN
RookieStation/Resources/SocketLegend.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 472 B |
BIN
RookieStation/Resources/SwitchLegend.png
Normal file
BIN
RookieStation/Resources/SwitchLegend.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 342 B |
@@ -100,10 +100,15 @@
|
||||
<Compile Include="CommonTools\Views\ProgressMonitorView.xaml.cs">
|
||||
<DependentUpon>ProgressMonitorView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateLightLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateShelvesLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdBatchExportDwg.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateMainMaterialsTable.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateSocketLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateSwitchLegend.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\CmdCreateViewSectionAnnotation.cs" />
|
||||
<Compile Include="Drawing\ExecuteCmds\UnifyViewPlanCropBoxAndPositionOnViewSheet.cs" />
|
||||
<Compile Include="Drawing\Models\LegendItem.cs" />
|
||||
<Compile Include="Drawing\Models\MaterialItem.cs" />
|
||||
<Compile Include="Drawing\Models\ShelfStatistic.cs" />
|
||||
<Compile Include="Drawing\Views\WpfLegendCreator.xaml.cs">
|
||||
@@ -432,10 +437,14 @@
|
||||
<None Include="Resources\Decrypt.png" />
|
||||
<None Include="Resources\Encrypt.png" />
|
||||
<None Include="Resources\ExportDwg.png" />
|
||||
<None Include="Resources\LightLegend.png" />
|
||||
<Content Include="Resources\LogoExtrusion.png" />
|
||||
<None Include="Resources\ViewPlanDim.png" />
|
||||
<None Include="Resources\ViewSectionDim.png" />
|
||||
<None Include="Resources\MainMaterials.png" />
|
||||
<None Include="Resources\ShelfLegend.png" />
|
||||
<None Include="Resources\SwitchLegend.png" />
|
||||
<None Include="Resources\SocketLegend.png" />
|
||||
<Content Include="Resources\WallFinishes.png" />
|
||||
<Content Include="Resources\YTX.ico" />
|
||||
<None Include="Resources\WorkSchedule.png" />
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace RookieStation.RibbonMenu
|
||||
private const string ProjectSettingsPanelName = "项目设置";
|
||||
private const string ReceptionPanelName = "前台布置";
|
||||
private const string EntranceAndExitGatePanelName = "取件区";
|
||||
private const string FinishesPanelName = "饰面,完成面";
|
||||
private const string FinishesPanelName = "饰面";
|
||||
private const string StatisticsPanelName = "统计";
|
||||
private const string DrawingPanelName = "出图";
|
||||
private const string CommonTools = "通用工具";
|
||||
@@ -100,8 +100,45 @@ namespace RookieStation.RibbonMenu
|
||||
CreatePushButton<CmdExportBudgetInventory>(statisticsPanel, "工程量导出", Properties.Resources.WorkSchedule, null);
|
||||
//出图面板
|
||||
RibbonPanel drawingPanel = application.CreateRibbonPanel(TabName, DrawingPanelName);
|
||||
|
||||
CreatePushButton<CmdCreateMainMaterialsTable>(drawingPanel, "主材表", Properties.Resources.MainMaterials, DrawingSheetCmdEnabled);
|
||||
CreatePushButton<CmdCreateShelvesLegend>(drawingPanel, "货架图例说明", Properties.Resources.Legend, DrawingSheetCmdEnabled);
|
||||
SplitButtonData splitButtonData = new SplitButtonData("创建图例", "创建图例");
|
||||
var spb = drawingPanel.AddItem(splitButtonData) as SplitButton;
|
||||
|
||||
PushButtonData shelfButtonData = new PushButtonData("货架说明", "货架说明", AddInPath, typeof(CmdCreateShelvesLegend).FullName)
|
||||
{
|
||||
LargeImage = ConvertFromBitmap(Properties.Resources.ShelfLegend),
|
||||
Image = ConvertFromBitmap(Properties.Resources.ShelfLegend),
|
||||
AvailabilityClassName = DrawingSheetCmdEnabled
|
||||
};
|
||||
PushButtonData lightButtonData = new PushButtonData("灯具说明", "灯具说明", AddInPath, typeof(CmdCreateLightLegend).FullName)
|
||||
{
|
||||
LargeImage = ConvertFromBitmap(Properties.Resources.LightLegend),
|
||||
Image = ConvertFromBitmap(Properties.Resources.LightLegend),
|
||||
AvailabilityClassName = DrawingSheetCmdEnabled
|
||||
};
|
||||
PushButtonData socketButtonData = new PushButtonData("插座说明", "插座说明", AddInPath, typeof(CmdCreateSocketLegend).FullName)
|
||||
{
|
||||
LargeImage = ConvertFromBitmap(Properties.Resources.SocketLegend),
|
||||
Image = ConvertFromBitmap(Properties.Resources.SocketLegend),
|
||||
AvailabilityClassName = DrawingSheetCmdEnabled
|
||||
};
|
||||
PushButtonData switchButtonData = new PushButtonData("开关说明", "开关说明", AddInPath, typeof(CmdCreateSwitchLegend).FullName)
|
||||
{
|
||||
LargeImage = ConvertFromBitmap(Properties.Resources.SwitchLegend),
|
||||
Image = ConvertFromBitmap(Properties.Resources.SwitchLegend),
|
||||
AvailabilityClassName = DrawingSheetCmdEnabled
|
||||
};
|
||||
spb.AddPushButton(shelfButtonData);
|
||||
spb.AddPushButton(lightButtonData);
|
||||
spb.AddPushButton(socketButtonData);
|
||||
spb.AddPushButton(switchButtonData);
|
||||
|
||||
//CreatePushButton<CmdCreateShelvesLegend>(drawingPanel, "货架说明", Properties.Resources.ShelfLegend, DrawingSheetCmdEnabled);
|
||||
//CreatePushButton<CmdCreateLightLegend>(drawingPanel, "灯具说明", Properties.Resources.LightLegend, DrawingSheetCmdEnabled);
|
||||
//CreatePushButton<CmdCreateSocketLegend>(drawingPanel, "插座说明", Properties.Resources.SocketLegend, DrawingSheetCmdEnabled);
|
||||
//CreatePushButton<CmdCreateSwitchLegend>(drawingPanel, "开关说明", Properties.Resources.SwitchLegend, DrawingSheetCmdEnabled);
|
||||
|
||||
CreatePushButton<CmdCreateViewPlanAnnotation>(drawingPanel, "平面标注", Properties.Resources.ViewPlanDim, ViewPlanCmdEnabled);
|
||||
CreatePushButton<CmdCreateViewSectionAnnotation>(drawingPanel, "立面标注", Properties.Resources.ViewSectionDim, ViewSectionCmdEnabled);
|
||||
CreatePushButton<CmdBatchExportDwg>(drawingPanel, "批量导出DWG", Properties.Resources.ExportDWG, null);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0005.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0005.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0006.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0006.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0007.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0007.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/艺术吊灯.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/艺术吊灯.0001.rfa
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,6 +15,7 @@ namespace RookieStation.ProjectConfig
|
||||
private static string AddinPath = typeof(RsApp).Assembly.Location;
|
||||
|
||||
public static string AddinDirectory => System.IO.Path.GetDirectoryName(AddinPath);
|
||||
public static string FontName = "宋体-2.4mm_0.8";
|
||||
#if (DEBUG)
|
||||
|
||||
//调试路径
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace RookieStation.Utils
|
||||
if (null != applicationData.ActiveUIDocument)
|
||||
{
|
||||
Autodesk.Revit.DB.View view = applicationData.ActiveUIDocument.Document.ActiveView;
|
||||
if (view.ViewType == ViewType.FloorPlan)
|
||||
if (view.ViewType == ViewType.FloorPlan && !applicationData.ActiveUIDocument.Document.IsFamilyDocument)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ namespace RookieStation.Utils
|
||||
if (null != applicationData.ActiveUIDocument)
|
||||
{
|
||||
Autodesk.Revit.DB.View view = applicationData.ActiveUIDocument.Document.ActiveView;
|
||||
if (view.ViewType == ViewType.DrawingSheet)
|
||||
if (view.ViewType == ViewType.DrawingSheet && !applicationData.ActiveUIDocument.Document.IsFamilyDocument)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using Autodesk.Revit.UI;
|
||||
|
||||
namespace RookieStation.Utils
|
||||
{
|
||||
@@ -42,6 +43,124 @@ namespace RookieStation.Utils
|
||||
return UnitUtils.ConvertFromInternalUnits(valueToConvert, DisplayUnitType.DUT_MILLIMETERS);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复制图例
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="viewScale"></param>
|
||||
/// <returns></returns>
|
||||
public static View CreateNewLegend(Document doc, string legendName, int viewScale)
|
||||
{
|
||||
IEnumerable<View> legends = doc.QueryByClassAndBuiltInCategory<View>(BuiltInCategory.OST_Views).Cast<Autodesk.Revit.DB.View>().Where(v => v.ViewType == ViewType.Legend);
|
||||
Autodesk.Revit.DB.View newLegend = null;
|
||||
|
||||
if (legends.Count() == 0)
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "请先新建图例");
|
||||
return newLegend;
|
||||
}
|
||||
|
||||
var legendToCopy = legends.FirstOrDefault();
|
||||
|
||||
var newLegendId = legendToCopy.Duplicate(ViewDuplicateOption.Duplicate);
|
||||
newLegend = doc.GetElement(newLegendId) as Autodesk.Revit.DB.View;
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
try
|
||||
{
|
||||
newLegend.Name = $"{legendName} {i}";
|
||||
break;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
newLegend.Scale = viewScale;
|
||||
return newLegend;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置图例位置
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="newLegend"></param>
|
||||
public static void SetLegendLocation(Document doc, View newLegend)
|
||||
{
|
||||
var viewport = Viewport.Create(doc, doc.ActiveView.Id, newLegend.Id, XYZ.Zero);
|
||||
double l = viewport.GetBoxOutline().MaximumPoint.X - viewport.GetBoxOutline().MinimumPoint.X;
|
||||
double w = viewport.GetBoxOutline().MaximumPoint.Y - viewport.GetBoxOutline().MinimumPoint.Y;
|
||||
XYZ c = new XYZ(l / 2 + 7 / 304.8, w / 2 + 7 / 304.8, 0);//边距均为7mm
|
||||
|
||||
viewport.SetBoxCenter(c);
|
||||
|
||||
var ele = new FilteredElementCollector(doc).OfClass(typeof(ElementType)).WhereElementIsElementType().FirstOrDefault(x => x.Name.Contains("无"));
|
||||
viewport.ChangeTypeId(ele.Id);//选择视口-无标题
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建表格
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="rowcount"></param>
|
||||
/// <param name="columncount"></param>
|
||||
/// <param name="gridwidth"></param>
|
||||
/// <param name="gridheight"></param>
|
||||
public static void CreateTable(Document doc, View legend, int rowcount, int columncount, double gridwidth, double gridheight)
|
||||
{
|
||||
CurveArray curveArray = new CurveArray();
|
||||
|
||||
for (int i = 0; i <= rowcount; i++)//水平网格
|
||||
{
|
||||
Curve l = Line.CreateBound(XYZ.Zero, XYZ.BasisX * gridwidth * columncount).CreateOffset(gridheight * i, -XYZ.BasisZ);
|
||||
curveArray.Append(l);
|
||||
}
|
||||
Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisY * rowcount * gridheight);
|
||||
curveArray.Append(line);
|
||||
for (int i = 0; i <= columncount; i++)//垂直网格
|
||||
{
|
||||
line = line.CreateOffset(gridwidth, XYZ.BasisZ);
|
||||
curveArray.Append(line);
|
||||
}
|
||||
doc.Create.NewDetailCurveArray(legend, curveArray);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建表格
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="legend">图例视图</param>
|
||||
/// <param name="rowcount">行数</param>
|
||||
/// <param name="columncount">列数</param>
|
||||
/// <param name="gridheight">单元格高度</param>
|
||||
/// <param name="gridwidths">各单元格对应的宽度</param>
|
||||
public static void CreateTable(Document doc, View legend, int rowcount, int columncount, double gridheight, params double[] gridwidths)
|
||||
{
|
||||
if (columncount != gridwidths.Count())
|
||||
{
|
||||
return;
|
||||
}
|
||||
CurveArray curveArray = new CurveArray();
|
||||
var width = 0.0;
|
||||
foreach (var w in gridwidths)
|
||||
{
|
||||
width += w;
|
||||
}
|
||||
for (int i = 0; i <= rowcount; i++)//水平网格
|
||||
{
|
||||
Curve c = Line.CreateBound(XYZ.Zero, XYZ.BasisX * width).CreateOffset(gridheight * i, -XYZ.BasisZ);
|
||||
curveArray.Append(c);
|
||||
}
|
||||
Curve line = Line.CreateBound(XYZ.Zero, XYZ.BasisY * rowcount * gridheight);
|
||||
curveArray.Append(line);
|
||||
for (int i = 0; i < columncount; i++)//垂直网格
|
||||
{
|
||||
line = line.CreateOffset(gridwidths[i], XYZ.BasisZ);
|
||||
curveArray.Append(line);
|
||||
}
|
||||
doc.Create.NewDetailCurveArray(legend, curveArray);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过名称获取默认的墙类型完整厚度
|
||||
/// </summary>
|
||||
@@ -91,7 +210,8 @@ namespace RookieStation.Utils
|
||||
XYZ zdir = XYZ.BasisZ;
|
||||
|
||||
//通过第三点垂直于直线的单位向量(无论左右侧)*偏移距离(一半的闸机长度)
|
||||
XYZ offestVector = zdir.CrossProduct(referLine.Direction).Normalize() * offest;
|
||||
XYZ offestVector = zdir.CrossProduct(referLine.Direction).Normalize();
|
||||
|
||||
//旋转角度
|
||||
double angle = XYZ.BasisY.AngleTo(offestVector);
|
||||
//判断相对于Y轴是正向角度(逆时针)还是逆向角度(顺时针)
|
||||
@@ -102,7 +222,7 @@ namespace RookieStation.Utils
|
||||
angle = -angle;
|
||||
//var ml = doc.Create.NewModelCurve(Line.CreateBound(XYZ.Zero, re), SketchPlane.Create(doc, Plane.CreateByNormalAndOrigin(XYZ.BasisZ, new XYZ())));
|
||||
}
|
||||
|
||||
offestVector *= offest;
|
||||
foreach (FamilyInstance instance in instances)
|
||||
{
|
||||
XYZ p = GetLocationPointByElement(instance);
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<UserControl x:Class="RookieStation.WpfFamilyDockPane"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:RookieStation"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace RookieStation
|
||||
{
|
||||
/// <summary>
|
||||
/// WpfFamilyDockPane.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class WpfFamilyDockPane : UserControl
|
||||
{
|
||||
public WpfFamilyDockPane()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,12 @@
|
||||
<setting name="SchoolName" serializeAs="String">
|
||||
<value>漳州职业技术学院</value>
|
||||
</setting>
|
||||
<setting name="Date" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
<setting name="Scale" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</RookieStation.Properties.Settings>
|
||||
</userSettings>
|
||||
<startup>
|
||||
|
||||
Reference in New Issue
Block a user