族库整理
This commit is contained in:
@@ -51,7 +51,7 @@ namespace RookieStation.CommonTools.ViewModels
|
||||
if (Cancel)
|
||||
break;
|
||||
viewmodel.CurrentValue += 1;
|
||||
viewmodel.CurrentContext = string.Format("总进度{1}/{2}\r\n正在对<{0}>进行处理", Families[i].Name, viewmodel.CurrentValue, viewmodel.MaxValue);
|
||||
viewmodel.CurrentContext = $"总进度{viewmodel.CurrentValue}/{viewmodel.MaxValue}\r\n正在对<{Families[i].Name}>进行处理";
|
||||
try
|
||||
{
|
||||
if (IsEncrypt)
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace RookieStation.Drawing.ExecuteCmds
|
||||
{
|
||||
try
|
||||
{
|
||||
newLegend.Name = string.Format("货架说明 {0}", i);
|
||||
newLegend.Name = $"货架说明 {i}";
|
||||
break;
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace RookieStation.Finishes.ExecuteCmds
|
||||
TaskDialog.Show("温馨提示", "项目中当前没有房间");
|
||||
return Result.Failed;
|
||||
}
|
||||
WpfFloorFinishes floorCovering = CommonUtils.GenerateWindow<WpfFloorFinishes>();
|
||||
WpfFloorFinishes floorCovering = CommonUtils.ShowDialog<WpfFloorFinishes>();
|
||||
|
||||
double length;
|
||||
double width;
|
||||
@@ -207,7 +207,7 @@ namespace RookieStation.Finishes.ExecuteCmds
|
||||
{
|
||||
//删除模型线
|
||||
doc.Delete(modelCurveIds);
|
||||
string file = UserConstant.FamilyLibraryDirectory + "FloorFinish\\地砖.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "板饰面\\地砖.rfa";
|
||||
symbol = RsRevitUtils.GetAndActiveDefaultFamilySymbol(doc, file);
|
||||
try
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace RookieStation.Finishes.ExecuteCmds
|
||||
return Result.Failed;
|
||||
}
|
||||
|
||||
WpfFloorFinishes floorFinishes = CommonUtils.GenerateWindow<WpfFloorFinishes>();
|
||||
WpfFloorFinishes floorFinishes = CommonUtils.ShowDialog<WpfFloorFinishes>();
|
||||
|
||||
double length, width, gap, thickness;
|
||||
bool IsByRoom = false;
|
||||
@@ -74,7 +74,7 @@ namespace RookieStation.Finishes.ExecuteCmds
|
||||
private static void CreateCurtainSystemByFace(UIDocument uidoc, double length, double width, double gap, double thickness)
|
||||
{
|
||||
Document doc = uidoc.Document;
|
||||
Reference faceReference = uidoc.Selection.PickObject(ObjectType.Face, "请选择铺贴面");
|
||||
Reference faceReference = uidoc.Selection.PickObject(ObjectType.Face, "请选择铺贴的面");
|
||||
Element element = doc.GetElement(faceReference);
|
||||
Face face = element.GetGeometryObjectFromReference(faceReference) as Face;
|
||||
FaceArray faceArray = new FaceArray();
|
||||
@@ -99,7 +99,7 @@ namespace RookieStation.Finishes.ExecuteCmds
|
||||
TaskDialog.Show("温馨提示", "项目中当前没有房间");
|
||||
return;
|
||||
}
|
||||
Reference refer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Room>(), "请选择布置的房间");
|
||||
Reference refer = uidoc.Selection.PickObject(ObjectType.Element, new SelectFilter<Room>(), "请选择铺贴的房间");
|
||||
Room room = doc.GetElement(refer) as Room;
|
||||
List<CurveLoop> curveLoops = new List<CurveLoop>();
|
||||
var opts = new SpatialElementBoundaryOptions();
|
||||
@@ -166,9 +166,9 @@ namespace RookieStation.Finishes.ExecuteCmds
|
||||
PanelType panelType = null;
|
||||
MullionType mullionType = null;
|
||||
|
||||
string cutainSystemTypeName = String.Format("{0} x {1}mm", length, width);
|
||||
string cutainSystemTypeName = $"铺贴{length} x {width}mm";
|
||||
string panelTypeName = "铺贴";
|
||||
string mullionTypeName = String.Format("{0} x {1}mm", gap, thickness);
|
||||
string mullionTypeName = $"{gap} x {thickness}mm";
|
||||
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
Document doc = uidoc.Document;
|
||||
revitWindow = uiapp.MainWindowHandle;
|
||||
|
||||
WpfReceptionArea receptionAreaPlacement = CommonUtils.GenerateWindow<WpfReceptionArea>();
|
||||
WpfReceptionArea receptionAreaPlacement = CommonUtils.ShowDialog<WpfReceptionArea>();
|
||||
//初始值
|
||||
//基层厚度
|
||||
double baseLayerThickness = 15 / 304.8;
|
||||
@@ -201,7 +201,7 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
FamilyInstance signage = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
string file = UserConstant.FamilyLibraryDirectory + "Sign\\菜鸟使命.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "标识标牌\\菜鸟使命.rfa";
|
||||
symbol = RsRevitUtils.GetAndActiveDefaultFamilySymbol(doc, file);
|
||||
|
||||
var endPoint = referline.GetEndPoint(0);
|
||||
@@ -229,7 +229,7 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
FamilyInstance reception = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
string file = UserConstant.FamilyLibraryDirectory + "Furniture\\寄件接待台.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "家具\\寄件接待台.rfa";
|
||||
symbol = RsRevitUtils.GetAndActiveDefaultFamilySymbol(doc, file);
|
||||
try
|
||||
{
|
||||
@@ -250,7 +250,7 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
FamilyInstance logo = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
var file = UserConstant.FamilyLibraryDirectory + "Sign\\菜鸟LOGO.rfa";
|
||||
var file = UserConstant.FamilyLibraryDirectory + "标识标牌\\精工背发光字.rfa";
|
||||
symbol = RsRevitUtils.GetAndActiveDefaultFamilySymbol(doc, file);
|
||||
try
|
||||
{
|
||||
@@ -264,11 +264,11 @@ namespace RookieStation.MailingAreaModule.ExecuteCmds
|
||||
{
|
||||
Log.WriteLog(ex.Message);
|
||||
}
|
||||
}, "菜鸟LOG布置");
|
||||
}, "菜鸟LOGO布置");
|
||||
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
string file = UserConstant.FamilyLibraryDirectory + "Lamp\\吊灯.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "灯具\\艺术吊灯.rfa";
|
||||
symbol = RsRevitUtils.GetAndActiveDefaultFamilySymbol(doc, file);
|
||||
var referlineDirection = referline.Direction;
|
||||
List<XYZ> lampLocationPoints = new List<XYZ>();
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
Document doc = uidoc.Document;
|
||||
revitWindow = uiapp.MainWindowHandle;
|
||||
|
||||
WpfEntranceGate entranceGateLayout = CommonUtils.GenerateWindow<WpfEntranceGate>();
|
||||
WpfEntranceGate entranceGateLayout = CommonUtils.ShowDialog<WpfEntranceGate>();
|
||||
if (entranceGateLayout.DialogResult != true)
|
||||
{
|
||||
return Result.Cancelled;
|
||||
@@ -94,7 +94,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
offest = 0.0;
|
||||
return;
|
||||
}
|
||||
Family gateFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "Gate\\闸机.rfa");
|
||||
Family gateFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "出入口\\三轴手动闸机.rfa");
|
||||
ElementId symbolId = gateFamily.GetFamilySymbolIds().FirstOrDefault();
|
||||
FamilySymbol gateSymbol = doc.GetElement(symbolId) as FamilySymbol;
|
||||
offest = gateSymbol.GetParameters("深度").FirstOrDefault().AsDouble() / 2;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
Document doc = uidoc.Document;
|
||||
revitWindow = uiapp.MainWindowHandle;
|
||||
|
||||
WpfExitGate gateLayout = CommonUtils.GenerateWindow<WpfExitGate>();
|
||||
WpfExitGate gateLayout = CommonUtils.ShowDialog<WpfExitGate>();
|
||||
|
||||
if (gateLayout.DialogResult == true)
|
||||
{
|
||||
@@ -101,11 +101,11 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
List<XYZ> locationPoint = new List<XYZ>();
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
Family gateFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "Gate\\收检台-左.rfa");
|
||||
Family gateFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "出入口\\收检台-左.rfa");
|
||||
IEnumerable<ElementId> leftSymbolId = from id in gateFamily.GetFamilySymbolIds()
|
||||
where doc.GetElement(id).Name.Contains("左")
|
||||
select id;
|
||||
gateFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "Gate\\收检台-右.rfa");
|
||||
gateFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "出入口\\收检台-右.rfa");
|
||||
IEnumerable<ElementId> rightSymbolId = from id in gateFamily.GetFamilySymbolIds()
|
||||
where doc.GetElement(id).Name.Contains("右")
|
||||
select id;
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
TaskDialog.Show("温馨提示", "项目中当前没有房间");
|
||||
return Result.Cancelled;
|
||||
}
|
||||
WpfLampsLayout placeLamps = CommonUtils.GenerateWindow<WpfLampsLayout>();
|
||||
WpfLampsLayout placeLamps = CommonUtils.ShowDialog<WpfLampsLayout>();
|
||||
|
||||
if (placeLamps.DialogResult == true)
|
||||
{
|
||||
@@ -190,7 +190,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
{
|
||||
//删除模型线
|
||||
doc.Delete(modelCurveIds);
|
||||
string file = UserConstant.FamilyLibraryDirectory + "Lamp\\筒灯.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "灯具\\明装筒灯.rfa";
|
||||
symbol = RsRevitUtils.GetAndActiveDefaultFamilySymbol(doc, file);
|
||||
try
|
||||
{
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||
Autodesk.Revit.DB.Document doc = uidoc.Document;
|
||||
revitWindow = uiapp.MainWindowHandle;
|
||||
WpfShelvesLayout placement = CommonUtils.GenerateWindow<WpfShelvesLayout>();
|
||||
WpfShelvesLayout placement = CommonUtils.ShowDialog<WpfShelvesLayout>();
|
||||
|
||||
if (placement.DialogResult != true)
|
||||
{
|
||||
@@ -93,7 +93,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
double parallelReferlineOffest = vm.ParallelReferlineOffest / 304.8;
|
||||
//参考线起点垂直于参考线的偏移量
|
||||
double verticalReferlineOffest = vm.VerticalReferlineOffest / 304.8;
|
||||
shelfFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "Shelf\\单联货架.rfa");
|
||||
shelfFamily = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "货架\\仓储货架.rfa");
|
||||
|
||||
for (int i = 0; i < shelves.Count; i++)
|
||||
{
|
||||
@@ -327,7 +327,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
{
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
string file = UserConstant.FamilyLibraryDirectory + "Others\\吊线.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "其他\\吊线.rfa";
|
||||
FamilySymbol symbol = RsRevitUtils.GetAndActiveDefaultFamilySymbol(doc, file);
|
||||
try
|
||||
{
|
||||
@@ -448,7 +448,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
List<XYZ> locs = new List<XYZ>();
|
||||
Locations = locs;
|
||||
|
||||
string file = UserConstant.FamilyLibraryDirectory + "Lamp\\筒灯.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "灯具\\明装筒灯.rfa";
|
||||
List<FamilyInstanceCreationData> instanceCreationDatas = new List<FamilyInstanceCreationData>();
|
||||
|
||||
for (int i = 0; i < firstRowPoints.Count; i++)
|
||||
@@ -552,7 +552,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
case NumOfGroup.Single:
|
||||
for (int j = 0; j < cardInstances.Count(); j++)
|
||||
{
|
||||
cardInstances[j].GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}", currentnum));
|
||||
cardInstances[j].GetParameters("货架号").FirstOrDefault().Set($"{currentnum}");
|
||||
}
|
||||
|
||||
currentnum += 1;
|
||||
@@ -566,7 +566,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
}
|
||||
for (int j = 0; j < cardInstances.Count(); j++)
|
||||
{
|
||||
cardInstances[j].GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}~{1}", currentnum, currentnum + 1));
|
||||
cardInstances[j].GetParameters("货架号").FirstOrDefault().Set($"{currentnum}~{currentnum + 1}");
|
||||
}
|
||||
//最后一个需要加上组合数作为下一列的开始
|
||||
if (i == shelfInstances.Count - 1)
|
||||
@@ -583,7 +583,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
}
|
||||
for (int j = 0; j < cardInstances.Count(); j++)
|
||||
{
|
||||
cardInstances[j].GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}~{1}", currentnum, currentnum + 2));
|
||||
cardInstances[j].GetParameters("货架号").FirstOrDefault().Set($"{currentnum}~{currentnum + 2}");
|
||||
}
|
||||
//最后一个需要加上组合数作为下一列的开始
|
||||
if (i == shelfInstances.Count - 1)
|
||||
@@ -777,7 +777,7 @@ namespace RookieStation.ParcelAreaModule.ExecuteCmds
|
||||
{
|
||||
var shelfwidth = fi.Symbol.GetParameters("宽度").FirstOrDefault().AsDouble();
|
||||
|
||||
Family card = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "Shelf\\货架端牌.rfa");
|
||||
Family card = RsRevitUtils.GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "货架\\货架端牌.rfa");
|
||||
var cardsymbolIds = card.GetFamilySymbolIds();
|
||||
|
||||
FamilySymbol cardsymbol = null;
|
||||
|
||||
@@ -35,6 +35,6 @@ namespace RookieStation.ParcelAreaModule.Models
|
||||
}
|
||||
}
|
||||
|
||||
public string SymbolName => String.Format("{0}mmx{1}mm", CommonUtils.GetEnumDescription(ShelfLength), CommonUtils.GetEnumDescription(ShelfWidth));
|
||||
public string SymbolName => $"{CommonUtils.GetEnumDescription(ShelfLength)}mmx{CommonUtils.GetEnumDescription(ShelfWidth)}mm";
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
private void NumberCards(WpfShelfCards wpfShelfCards, UIDocument uidoc)
|
||||
{
|
||||
Document doc = uidoc.Document;
|
||||
int CurrentNumber = wpfShelfCards.CurrentNumber;
|
||||
int currentNumber = wpfShelfCards.CurrentNumber;
|
||||
bool isContinue = wpfShelfCards.IsContinue;
|
||||
int GroupNumber = wpfShelfCards.GroupNumber;
|
||||
try
|
||||
@@ -82,20 +82,20 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Reference cards_refer = uidoc.Selection.PickObject(ObjectType.Element, new CardsSelectedFilter(instances), "请选择起始端牌");
|
||||
var first_card = doc.GetElement(cards_refer) as FamilyInstance;
|
||||
var location_point = RsRevitUtils.GetLocationPointByElement(first_card);
|
||||
Reference cardRefer = uidoc.Selection.PickObject(ObjectType.Element, new CardsSelectedFilter(instances), "请选择起始端牌");
|
||||
var firstCard = doc.GetElement(cardRefer) as FamilyInstance;
|
||||
var firstLocation = RsRevitUtils.GetLocationPointByElement(firstCard);
|
||||
|
||||
List<XYZ> location_points = new List<XYZ>();
|
||||
List<XYZ> locationPoints = new List<XYZ>();
|
||||
instances.ForEach(f =>
|
||||
{
|
||||
var p = RsRevitUtils.GetLocationPointByElement(f);
|
||||
location_points.Add(p);
|
||||
locationPoints.Add(p);
|
||||
});
|
||||
var line_direction = location_points.LastOrDefault() - location_points.FirstOrDefault();
|
||||
Line line = Line.CreateUnbound(location_points.FirstOrDefault(), line_direction);
|
||||
var line_direction = locationPoints.LastOrDefault() - locationPoints.FirstOrDefault();
|
||||
Line line = Line.CreateUnbound(locationPoints.FirstOrDefault(), line_direction);
|
||||
//是否共线
|
||||
foreach (var p in location_points)
|
||||
foreach (var p in locationPoints)
|
||||
{
|
||||
if (line.Distance(p) > 0.01)
|
||||
{
|
||||
@@ -103,71 +103,52 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
return;
|
||||
}
|
||||
}
|
||||
Dictionary<FamilyInstance, double> dict_instance_double = new Dictionary<FamilyInstance, double>();
|
||||
Dictionary<FamilyInstance, double> dictInstanceDouble = new Dictionary<FamilyInstance, double>();
|
||||
foreach (var f in instances)
|
||||
{
|
||||
var p = RsRevitUtils.GetLocationPointByElement(f);
|
||||
var distance = location_point.DistanceTo(p);
|
||||
dict_instance_double.Add(f, distance);
|
||||
var distance = firstLocation.DistanceTo(p);
|
||||
dictInstanceDouble.Add(f, distance);
|
||||
}
|
||||
var dict_sorted = dict_instance_double.OrderBy(x => x.Value);
|
||||
int last_number = 0;
|
||||
var dictSorted = dictInstanceDouble.OrderBy(x => x.Value);
|
||||
int lastNumber = 0;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
if (GroupNumber == 1)
|
||||
{
|
||||
for (int i = 0; i < dict_sorted.Count(); i++)
|
||||
for (int i = 0; i < dictSorted.Count(); i++)
|
||||
{
|
||||
var finstance = dict_sorted.ElementAt(i).Key;
|
||||
string current_num_str = CurrentNumber.ToString();
|
||||
if (CurrentNumber < 10)
|
||||
var finstance = dictSorted.ElementAt(i).Key;
|
||||
string currenNumStr = currentNumber.ToString();
|
||||
if (currentNumber < 10)
|
||||
{
|
||||
current_num_str = $"0{current_num_str}";
|
||||
currenNumStr = $"0{currenNumStr}";
|
||||
}
|
||||
finstance.GetParameters("货架号").FirstOrDefault().Set(current_num_str);
|
||||
finstance.GetParameters("货架号").FirstOrDefault().Set(currenNumStr);
|
||||
|
||||
CurrentNumber += 1;
|
||||
}
|
||||
}
|
||||
else if (GroupNumber == 2)
|
||||
{
|
||||
for (int i = 0; i < dict_sorted.Count(); i++)
|
||||
{
|
||||
last_number = CurrentNumber + 1;
|
||||
string current_num_str = CurrentNumber.ToString();
|
||||
string last_num_str = last_number.ToString();
|
||||
|
||||
if (CurrentNumber < 10)
|
||||
{
|
||||
current_num_str = $"0{current_num_str}";
|
||||
}
|
||||
if (last_number < 10)
|
||||
{
|
||||
last_num_str = $"0{last_number}";
|
||||
}
|
||||
var finstance = dict_sorted.ElementAt(i).Key;
|
||||
finstance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}~{1}", current_num_str, last_num_str));
|
||||
CurrentNumber = last_number + 1;
|
||||
currentNumber += 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < dict_sorted.Count(); i++)
|
||||
for (int i = 0; i < dictSorted.Count(); i++)
|
||||
{
|
||||
last_number = CurrentNumber + 2;
|
||||
string current_num_str = CurrentNumber.ToString();
|
||||
string last_num_str = last_number.ToString();
|
||||
if (CurrentNumber < 10)
|
||||
lastNumber = currentNumber + GroupNumber - 1;
|
||||
string currentNumStr = currentNumber.ToString();
|
||||
string lastNumStr = lastNumber.ToString();
|
||||
|
||||
if (currentNumber < 10)
|
||||
{
|
||||
current_num_str = $"0{current_num_str}";
|
||||
currentNumStr = $"0{currentNumStr}";
|
||||
}
|
||||
if (last_number < 10)
|
||||
if (lastNumber < 10)
|
||||
{
|
||||
last_num_str = $"0{last_number}";
|
||||
lastNumStr = $"0{lastNumber}";
|
||||
}
|
||||
var finstance = dict_sorted.ElementAt(i).Key;
|
||||
finstance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}~{1}", current_num_str, last_num_str));
|
||||
CurrentNumber = last_number + 1;
|
||||
var finstance = dictSorted.ElementAt(i).Key;
|
||||
finstance.GetParameters("货架号").FirstOrDefault().Set($"{currentNumStr}~{lastNumStr}");
|
||||
//finstance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}~{1}", current_num_str, last_num_str));
|
||||
currentNumber = lastNumber + 1;
|
||||
}
|
||||
}
|
||||
}, "端牌编号");
|
||||
@@ -177,7 +158,7 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
{
|
||||
if (wpfShelfCards != null)
|
||||
{
|
||||
wpfShelfCards.tbCurrentNum.Text = CurrentNumber.ToString();
|
||||
wpfShelfCards.tbCurrentNum.Text = currentNumber.ToString();
|
||||
wpfShelfCards.ShowDialog();
|
||||
}
|
||||
}
|
||||
@@ -193,22 +174,56 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
{
|
||||
while (isCoutinue)
|
||||
{
|
||||
List<FamilyInstance> instances = uidoc.Selection.PickElementsByRectangle(new ShelfFilter(), "请框选需要布置端牌的货架")
|
||||
.Cast<FamilyInstance>()
|
||||
.ToList();
|
||||
if (instances.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Reference cardRefer = uidoc.Selection.PickObject(ObjectType.Element, new ShelvessSelectedFilter(instances), "请选择起始货架");
|
||||
FamilyInstance firstShelf = doc.GetElement(cardRefer) as FamilyInstance;
|
||||
var firstLocation = RsRevitUtils.GetLocationPointByElement(firstShelf);
|
||||
|
||||
List<XYZ> locationPoints = new List<XYZ>();
|
||||
instances.ForEach(f =>
|
||||
{
|
||||
var p = RsRevitUtils.GetLocationPointByElement(f);
|
||||
locationPoints.Add(p);
|
||||
});
|
||||
var line_direction = locationPoints.LastOrDefault() - locationPoints.FirstOrDefault();
|
||||
Line line = Line.CreateUnbound(locationPoints.FirstOrDefault(), line_direction);
|
||||
//是否共线
|
||||
foreach (var p in locationPoints)
|
||||
{
|
||||
if (line.Distance(p) > 0.01)
|
||||
{
|
||||
TaskDialog.Show("温馨提示", "所选货架不在一条直线上");
|
||||
return;
|
||||
}
|
||||
}
|
||||
Dictionary<FamilyInstance, double> dictInstanceDouble = new Dictionary<FamilyInstance, double>();
|
||||
foreach (var f in instances)
|
||||
{
|
||||
var p = RsRevitUtils.GetLocationPointByElement(f);
|
||||
var distance = firstLocation.DistanceTo(p);
|
||||
dictInstanceDouble.Add(f, distance);
|
||||
}
|
||||
var dictSorted = dictInstanceDouble.OrderBy(x => x.Value);
|
||||
|
||||
Reference front_face = firstShelf.GetReferences(FamilyInstanceReferenceType.Front).FirstOrDefault();
|
||||
Reference back_face = firstShelf.GetReferences(FamilyInstanceReferenceType.Back).FirstOrDefault();
|
||||
|
||||
var hand = firstShelf.HandOrientation;
|
||||
|
||||
var width = firstShelf.Symbol.GetParameters("宽度").FirstOrDefault().AsDouble();
|
||||
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
Reference refer_shelf = uidoc.Selection.PickObject(ObjectType.Element, new ShelfFilter(), "请选择布置端牌的货架");
|
||||
FamilyInstance shelf = doc.GetElement(refer_shelf) as FamilyInstance;
|
||||
int LastNum = CurrentNumber + wpfShelfCards.GroupNumber - 1;
|
||||
var location_XYZ = RsRevitUtils.GetLocationPointByElement(shelf);
|
||||
Reference front_face = shelf.GetReferences(FamilyInstanceReferenceType.Front).FirstOrDefault();
|
||||
Reference back_face = shelf.GetReferences(FamilyInstanceReferenceType.Back).FirstOrDefault();
|
||||
|
||||
var hand = shelf.HandOrientation;
|
||||
|
||||
var width = shelf.Symbol.GetParameters("宽度").FirstOrDefault().AsDouble();
|
||||
string file = UserConstant.FamilyLibraryDirectory + "Shelf\\货架端牌.rfa";
|
||||
string file = UserConstant.FamilyLibraryDirectory + "货架\\货架端牌.rfa";
|
||||
Family family = RsRevitUtils.GetLoadedFamily(doc, file);
|
||||
|
||||
var symbolIds = family.GetFamilySymbolIds();
|
||||
ISet<ElementId> symbolIds = family.GetFamilySymbolIds();
|
||||
|
||||
FamilySymbol symbol = null;
|
||||
foreach (ElementId syid in symbolIds)
|
||||
@@ -225,28 +240,44 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
{
|
||||
symbol.Activate();
|
||||
}
|
||||
if (shelf.HandFlipped)
|
||||
if (firstShelf.HandFlipped)
|
||||
{
|
||||
hand = -hand;
|
||||
}
|
||||
var front_instance = doc.Create.NewFamilyInstance(front_face, location_XYZ, hand, symbol);
|
||||
if (front_instance.CanFlipWorkPlane)
|
||||
|
||||
for (int i = 0; i < dictSorted.Count(); i++)
|
||||
{
|
||||
front_instance.IsWorkPlaneFlipped = true;
|
||||
var location_XYZ = RsRevitUtils.GetLocationPointByElement(dictSorted.ElementAt(i).Key);
|
||||
int LastNum = CurrentNumber + wpfShelfCards.GroupNumber - 1;
|
||||
|
||||
var frontInstance = doc.Create.NewFamilyInstance(front_face, location_XYZ, hand, symbol);
|
||||
if (frontInstance.CanFlipWorkPlane)
|
||||
{
|
||||
frontInstance.IsWorkPlaneFlipped = true;
|
||||
}
|
||||
var backInstance = doc.Create.NewFamilyInstance(back_face, location_XYZ, -hand, symbol);
|
||||
string cardStr = string.Empty;
|
||||
string firstNumber = $"{CurrentNumber}";
|
||||
string lastNumber = $"{LastNum}";
|
||||
if (CurrentNumber < 10)
|
||||
{
|
||||
firstNumber = $"0{CurrentNumber}";
|
||||
}
|
||||
if (LastNum < 10)
|
||||
{
|
||||
lastNumber = $"0{LastNum}";
|
||||
}
|
||||
cardStr = $"{firstNumber}~{lastNumber}";
|
||||
frontInstance.GetParameters("货架号").FirstOrDefault().Set(cardStr);
|
||||
backInstance.GetParameters("货架号").FirstOrDefault().Set(cardStr);
|
||||
if (GroupNumber == 1)
|
||||
{
|
||||
frontInstance.GetParameters("货架号").FirstOrDefault().Set(CurrentNumber.ToString());
|
||||
backInstance.GetParameters("货架号").FirstOrDefault().Set(CurrentNumber.ToString());
|
||||
}
|
||||
CurrentNumber = LastNum + 1;
|
||||
}
|
||||
|
||||
var back_instance = doc.Create.NewFamilyInstance(back_face, location_XYZ, -hand, symbol);
|
||||
|
||||
front_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}~{1}", CurrentNumber, LastNum));
|
||||
|
||||
back_instance.GetParameters("货架号").FirstOrDefault().Set(string.Format("{0}~{1}", CurrentNumber, LastNum));
|
||||
if (GroupNumber == 1)
|
||||
{
|
||||
front_instance.GetParameters("货架号").FirstOrDefault().Set(CurrentNumber.ToString());
|
||||
back_instance.GetParameters("货架号").FirstOrDefault().Set(CurrentNumber.ToString());
|
||||
}
|
||||
CurrentNumber = LastNum + 1;
|
||||
|
||||
#region 备用
|
||||
|
||||
//List<Face> placeFaces = new List<Face>();
|
||||
@@ -351,4 +382,32 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
internal class ShelvessSelectedFilter : ISelectionFilter
|
||||
{
|
||||
private List<FamilyInstance> fis;
|
||||
|
||||
internal ShelvessSelectedFilter(List<FamilyInstance> familyInstances)
|
||||
{
|
||||
fis = familyInstances;
|
||||
}
|
||||
|
||||
public bool AllowElement(Element elem)
|
||||
{
|
||||
FamilyInstance fi = elem as FamilyInstance;
|
||||
foreach (FamilyInstance instance in fis)
|
||||
{
|
||||
if (fi != null && fi.UniqueId == instance.UniqueId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool AllowReference(Reference reference, XYZ position)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,8 +68,7 @@ namespace RookieStation.ParcelAreaModule.Views
|
||||
for (int i = 0; i < vm.Data.Count; i++)
|
||||
{
|
||||
Shelf shelf = vm.Data[i];
|
||||
string str = string.Format("{0},{1},{2}"
|
||||
, CommonUtils.GetEnumDescription(shelf.NumOfGroup).ToString(), CommonUtils.GetEnumDescription(shelf.ShelfLength), CommonUtils.GetEnumDescription(shelf.ShelfWidth));
|
||||
string str = $"{CommonUtils.GetEnumDescription(shelf.NumOfGroup)},{CommonUtils.GetEnumDescription(shelf.ShelfLength)},{CommonUtils.GetEnumDescription(shelf.ShelfWidth)}";
|
||||
sc.Add(str);
|
||||
}
|
||||
Properties.Settings.Default.Shelves = sc;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace RookieStation.ProjectConfig.ExecuteCmds
|
||||
UIApplication uiapp = commandData.Application;
|
||||
UIDocument uidoc = uiapp.ActiveUIDocument;
|
||||
Document doc = uidoc.Document;
|
||||
WpfProjectSettings settings = CommonUtils.GenerateWindow<WpfProjectSettings>();
|
||||
WpfProjectSettings settings = CommonUtils.ShowDialog<WpfProjectSettings>();
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
doc.ProjectInformation.get_Parameter(BuiltInParameter.PROJECT_BUILDING_NAME).Set(Properties.Settings.Default.SchoolName);
|
||||
|
||||
@@ -107,6 +107,7 @@
|
||||
<Compile Include="Drawing\Views\WpfLegendCreator.xaml.cs">
|
||||
<DependentUpon>WpfLegendCreator.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Statistics\ExecuteCmds\CmdExportOrderQuantity.cs" />
|
||||
<Compile Include="Statistics\ExecuteCmds\CmdExportWorkSchedule.cs" />
|
||||
<Compile Include="Finishes\ExecuteCmds\CmdPlaceFloorFinishes.cs" />
|
||||
<Compile Include="MailingAreaModule\ExecuteCmds\CmdLogoExtrusion.cs" />
|
||||
@@ -193,43 +194,88 @@
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Door\双扇平开防火子母门.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\开关\三联开关 - 暗装.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Door\防火卷帘-中装.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\开关\单联开关 - 暗装.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Equipment\自助寄件机.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\开关\双联开关 - 暗装.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\1.5m绿动箱.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\插座\单相地面二三孔插座.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\3.0m绿动箱.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\插座\单相暗装二三孔插座.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\圆形餐桌组.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\亚克力水晶字.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\咖餐厅座椅组.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\精工背发光字.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\钢制桌椅.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\腰封玻璃贴.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Gate\三辊闸机.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\灯具\支架灯.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Gate\收检台-右.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\灯具\明装筒灯.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Gate\收检台-左.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\灯具\艺术吊灯.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Others\吊线.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\灯具\轨道射灯.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\WallFinish\背景墙.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\设备\家用配电箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\设备\配电箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\货架\仓储货架.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\门\双扇平开防火子母门.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\门\防火卷帘-中装.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\设备\自助寄件机.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\1.5m绿动箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\3.0m绿动箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\圆形餐桌组.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\咖餐厅座椅组.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\钢制桌椅.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\三辊闸机.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\收检台-右.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\收检台-左.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\其他\吊线.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\墙饰面\背景墙.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\Inventory.db">
|
||||
@@ -239,97 +285,76 @@
|
||||
<None Include="RsLibrary\Document\样板工程量清单.xlsx">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Door\幕墙门-双扇无边框.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\门\幕墙门-双扇无边框.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Door\幕墙门-玻璃门.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\门\幕墙门-玻璃门.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\FloorFinish\地砖.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\板饰面\地砖.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\寄件接待台-带收检台.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\寄件接待台-带收检台.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\寄件接待台.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\寄件接待台.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\拆包桌.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\拆包桌.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Furniture\绿动箱.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\家具\绿动箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Gate\L型收检台.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\L型收检台.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Gate\直线形收检台.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\直线形收检台.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Gate\简易收检台.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\简易收检台.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Gate\闸机.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\出入口\闸机.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Lamp\吊灯.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\其他\定位线.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Lamp\筒灯.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\货架\货架端牌.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Location\定位线.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\侧招灯箱.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Shelf\三联货架.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\台卡.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Shelf\单联货架.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\四牌.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Shelf\双联货架.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\地贴.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Shelf\货架端牌.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\墙贴.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\侧招灯箱.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\寄件收费标准.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\台卡.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\常规门头.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\四牌.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\快递指导规范.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\地贴.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\玻璃贴.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\墙贴.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\标识标牌\菜鸟使命.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\寄件收费标准.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\常规门头.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\快递指导规范.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\玻璃贴.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\菜鸟LOGO.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\菜鸟使命.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\Sign\防撞条.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="RsLibrary\FamilyLibrary\WallFinish\校园文化墙.rfa">
|
||||
<None Include="RsLibrary\FamilyLibrary\墙饰面\校园文化墙.rfa">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/出入口/三轴手动闸机.rfa
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/开关/三联开关 - 暗装.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/开关/三联开关 - 暗装.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/开关/单联开关 - 暗装.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/开关/单联开关 - 暗装.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/开关/双联开关 - 暗装.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/开关/双联开关 - 暗装.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/插座/单相地面二三孔插座.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/插座/单相地面二三孔插座.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/插座/单相暗装二三孔插座.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/插座/单相暗装二三孔插座.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/亚克力水晶字.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/亚克力水晶字.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/快递指导规范.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/快递指导规范.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/精工背发光字.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/精工背发光字.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/腰封玻璃贴.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/标识标牌/腰封玻璃贴.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/支架灯.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/支架灯.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0001.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0001.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0002.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.0002.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/明装筒灯.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/艺术吊灯.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/艺术吊灯.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/轨道射灯.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/灯具/轨道射灯.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/设备/家用配电箱.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/设备/家用配电箱.rfa
Normal file
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/设备/配电箱.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/设备/配电箱.rfa
Normal file
Binary file not shown.
Binary file not shown.
BIN
RookieStation/RsLibrary/FamilyLibrary/货架/货架端牌.rfa
Normal file
BIN
RookieStation/RsLibrary/FamilyLibrary/货架/货架端牌.rfa
Normal file
Binary file not shown.
Binary file not shown.
@@ -44,7 +44,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
SaveFileDialog sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Excel文件|*.xlsx",
|
||||
FileName = "菜鸟驿站工程预算清单"
|
||||
FileName = $"{UserConstant.SchoolName}菜鸟驿站工程预算清单"
|
||||
};
|
||||
string destinationFileName = string.Empty;
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
@@ -58,15 +58,16 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
var strs = sql.QueryTable("CaiNiaoInventory");
|
||||
var items = GetQuantity(doc, strs);
|
||||
sql.CloseConncetion();
|
||||
var itemGroups = items.GroupBy(i => i.RootCategory).Select(s => s.Where(q => q.Quantity != 0.0));
|
||||
var itemGroups = items.GroupBy(i => i.RootCategory).Select(s => s.Where(q => q.Quantity != 0.0));//分成三组
|
||||
|
||||
using (ExcelPackage package = new ExcelPackage())
|
||||
{
|
||||
ExcelWorksheet sheet = CreateTableHeader(doc, package);
|
||||
int row = 4;
|
||||
List<int> rows = new List<int>();
|
||||
for (int i = 0; i < itemGroups.Count(); i++)
|
||||
{
|
||||
int startrow = row;
|
||||
int startRow = row + 1;//用于根分类下一行,做汇总计算的起始行
|
||||
|
||||
#region 根分类
|
||||
|
||||
@@ -92,23 +93,31 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
|
||||
#endregion 根分类
|
||||
|
||||
var subGroupys = rootItem.GroupBy(s => s.SubCategory);
|
||||
for (int j = 0; j < subGroupys.Count(); j++)
|
||||
var subGroupys = rootItem.GroupBy(s => s.SubCategory);//装饰装修分成六组
|
||||
for (int j = 0; j < subGroupys.Count(); j++)//每个子分类
|
||||
{
|
||||
#region 子分类
|
||||
|
||||
sheet.Cells[row, 1].Value = NumberToChar(j + 1);
|
||||
sheet.Cells[row, 2].Value = subGroupys.ElementAt(j).Key;
|
||||
using (var range = sheet.Cells[row, 1, row, 10])
|
||||
int subStartRow = row;
|
||||
//子分类标题
|
||||
if (subGroupys.ElementAt(j).ElementAt(0).SubCategory != "")
|
||||
{
|
||||
range.Style.Font.Name = "宋体";
|
||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
range.Style.Font.Size = 10;
|
||||
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
|
||||
range.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray);
|
||||
range.Style.Border.BorderAround(ExcelBorderStyle.Thin);
|
||||
sheet.Cells[row, 1].Value = NumberToChar(j + 1);
|
||||
sheet.Cells[row, 2].Value = subGroupys.ElementAt(j).Key;
|
||||
sheet.Cells[row, 3].Value = $"=SUM({sheet.Cells[subStartRow + 1, 9].Address}:{sheet.Cells[subStartRow + subGroupys.ElementAt(j).Count(), 9].Address})";
|
||||
sheet.Cells[row, 3].Style.Numberformat.Format = "#,##0.00";
|
||||
using (var range = sheet.Cells[row, 1, row, 10])
|
||||
{
|
||||
range.Style.Font.Name = "宋体";
|
||||
range.Style.Font.Bold = true;
|
||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
range.Style.Font.Size = 10;
|
||||
range.Style.Fill.PatternType = ExcelFillStyle.Solid;
|
||||
range.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.LightGray);
|
||||
range.Style.Border.BorderAround(ExcelBorderStyle.Thin);
|
||||
}
|
||||
row += 1;
|
||||
}
|
||||
row += 1;
|
||||
|
||||
#endregion 子分类
|
||||
|
||||
@@ -118,14 +127,14 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
var subitem = subGroupys.ElementAt(j).ElementAt(k);
|
||||
sheet.Cells[row, 1].Value = k + 1;
|
||||
sheet.Cells[row, 2].Value = subitem.Name;
|
||||
sheet.Cells[row, 2].Value = subitem.ItemName;
|
||||
sheet.Cells[row, 3].Value = subitem.Description;
|
||||
sheet.Cells[row, 4].Value = subitem.Unit;
|
||||
sheet.Cells[row, 5].Value = subitem.Quantity;
|
||||
|
||||
sheet.Cells[row, 8].Formula = String.Format("=SUM({0}:{1})", sheet.Cells[row, 6].Address, sheet.Cells[row, 6].Address);
|
||||
|
||||
sheet.Cells[row, 9].Formula = String.Format("={0}*{1}", sheet.Cells[row, 5].Address, sheet.Cells[row, 8].Address);
|
||||
sheet.Cells[row, 5].Style.Font.Color.SetColor(System.Drawing.Color.Red);
|
||||
sheet.Cells[row, 5].Style.Numberformat.Format = "0.00";
|
||||
sheet.Cells[row, 8].Formula = $"=SUM({sheet.Cells[row, 6].Address}:{sheet.Cells[row, 6].Address})";
|
||||
sheet.Cells[row, 9].Formula = $"={sheet.Cells[row, 5].Address}*{sheet.Cells[row, 8].Address}";
|
||||
using (var range = sheet.Cells[row, 1, row, 10])
|
||||
{
|
||||
range.Style.Font.Name = "宋体";
|
||||
@@ -135,11 +144,31 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
|
||||
range.AutoFitColumns();
|
||||
}
|
||||
|
||||
using (var range = sheet.Cells[row, 6, row, 9])
|
||||
{
|
||||
range.Style.Numberformat.Format = "#,##0.00";
|
||||
}
|
||||
row += 1;
|
||||
}
|
||||
//if (subGroupys.ElementAt(j).ElementAt(0).SubCategory != null)
|
||||
//{
|
||||
// sheet.Cells[row, 1, row, 8].Merge = true;
|
||||
// sheet.Cells[row, 1].Value = rootItem.FirstOrDefault().SubCategory + "合计";
|
||||
// sheet.Cells[row, 9].Formula = string.Format("=SUM({0}:{1})", sheet.Cells[startrow, 9].Address, sheet.Cells[row - 1, 9].Address);
|
||||
|
||||
// using (var range = sheet.Cells[row, 1, row, 10])
|
||||
// {
|
||||
// range.Style.Font.Name = "宋体";
|
||||
// range.Style.Font.Bold = true;
|
||||
// range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
// range.Style.Font.Size = 10;
|
||||
// range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
|
||||
// range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
|
||||
// range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
|
||||
// range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
|
||||
// }
|
||||
//}
|
||||
|
||||
#endregion 子项
|
||||
|
||||
@@ -152,7 +181,8 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
|
||||
sheet.Cells[row, 1, row, 8].Merge = true;
|
||||
sheet.Cells[row, 1].Value = rootItem.FirstOrDefault().RootCategory + "合计";
|
||||
sheet.Cells[row, 9].Formula = String.Format("=SUM({0}:{1})", sheet.Cells[startrow, 9].Address, sheet.Cells[row - 1, 9].Address);
|
||||
sheet.Cells[row, 9].Formula = $"=SUM({sheet.Cells[startRow, 9].Address}:{sheet.Cells[row - 1, 9].Address})";
|
||||
rows.Add(row);//记录汇总行号
|
||||
using (var range = sheet.Cells[row, 1, row, 10])
|
||||
{
|
||||
range.Style.Font.Name = "宋体";
|
||||
@@ -168,9 +198,39 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
|
||||
#endregion 合计项
|
||||
}
|
||||
//using (var range = sheet.Cells[1, 4, 4, 10])
|
||||
//{
|
||||
//}
|
||||
|
||||
#region 预算总价
|
||||
|
||||
sheet.Cells[row, 1, row, 8].Merge = true;
|
||||
sheet.Cells[row, 1].Value = "预算总价(一+二+三)";
|
||||
sheet.Cells[row, 9].Formula = $"=SUM({sheet.Cells[rows[0], 9].Address}+{sheet.Cells[rows[1], 9].Address}+{sheet.Cells[rows[2], 9].Address})";
|
||||
using (var range = sheet.Cells[row, 1, row, 10])
|
||||
{
|
||||
range.Style.Font.Name = "宋体";
|
||||
range.Style.Font.Bold = true;
|
||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
range.Style.Font.Size = 10;
|
||||
range.Style.Border.Top.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Bottom.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Left.Style = ExcelBorderStyle.Thin;
|
||||
range.Style.Border.Right.Style = ExcelBorderStyle.Thin;
|
||||
}
|
||||
row += 1;
|
||||
|
||||
#endregion 预算总价
|
||||
|
||||
sheet.Cells[row, 1, row, 8].Merge = true;
|
||||
sheet.Cells[row, 1].Value = "※本清单根据施工图生成,仅作为财务模型预算参考,不包含拆除、户外、空调、消防等其他专业预算;";
|
||||
using (var range = sheet.Cells[row, 1, row, 10])
|
||||
{
|
||||
range.Style.Font.Name = "宋体";
|
||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
|
||||
range.Style.Font.Size = 10;
|
||||
}
|
||||
using (var range = sheet.Cells[sheet.Dimension.Start.Row, sheet.Dimension.Start.Column, sheet.Dimension.End.Row, sheet.Dimension.End.Column])
|
||||
{
|
||||
range.AutoFitColumns();
|
||||
}
|
||||
sheet.Calculate();
|
||||
using (Stream stream = new FileStream(destinationFileName, FileMode.Create))
|
||||
{
|
||||
@@ -182,6 +242,11 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
return Result.Succeeded;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数字转汉字
|
||||
/// </summary>
|
||||
/// <param name="n"></param>
|
||||
/// <returns></returns>
|
||||
private string NumberToChineseDigital(int n)
|
||||
{
|
||||
switch (n)
|
||||
@@ -203,6 +268,11 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 数字转字母
|
||||
/// </summary>
|
||||
/// <param name="n"></param>
|
||||
/// <returns></returns>
|
||||
private string NumberToChar(int n)
|
||||
{
|
||||
switch (n)
|
||||
@@ -233,8 +303,15 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取量
|
||||
/// </summary>
|
||||
/// <param name="doc"></param>
|
||||
/// <param name="li"></param>
|
||||
/// <returns></returns>
|
||||
private static List<SubItem> GetQuantity(Document doc, List<string[]> li)
|
||||
{
|
||||
double similarity = 0.3;
|
||||
List<SubItem> items = new List<SubItem>();
|
||||
for (int i = 0; i < li.Count; i++)
|
||||
{
|
||||
@@ -248,7 +325,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
|
||||
foreach (var wall in walls)
|
||||
{
|
||||
if (name.Contains(wall.Name))
|
||||
if (levenshtein(name, wall.Name) > similarity)
|
||||
{
|
||||
if (name.Contains("踢脚线"))
|
||||
{
|
||||
@@ -264,7 +341,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
RootCategory = li[i].ElementAt(1),
|
||||
SubCategory = li[i].ElementAt(2),
|
||||
Name = li[i].ElementAt(3),
|
||||
ItemName = li[i].ElementAt(3),
|
||||
Description = li[i].ElementAt(4),
|
||||
Unit = li[i].ElementAt(5),
|
||||
};
|
||||
@@ -282,9 +359,13 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
double floorTotalArea = 0.0;
|
||||
var floors = new FilteredElementCollector(doc).OfClass(typeof(Floor)).Cast<Floor>();
|
||||
|
||||
foreach (var floor in floors)
|
||||
{
|
||||
if (name.Contains(floor.Name))
|
||||
//if (name.Intersect(floor.Name).Count() >= 3)
|
||||
//{
|
||||
//}
|
||||
if (levenshtein(name, floor.Name) > similarity)
|
||||
{
|
||||
floorTotalArea += floor.get_Parameter(BuiltInParameter.HOST_AREA_COMPUTED).AsDouble();
|
||||
}
|
||||
@@ -293,7 +374,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
RootCategory = li[i].ElementAt(1),
|
||||
SubCategory = li[i].ElementAt(2),
|
||||
Name = li[i].ElementAt(3),
|
||||
ItemName = li[i].ElementAt(3),
|
||||
Description = li[i].ElementAt(4),
|
||||
Unit = li[i].ElementAt(5),
|
||||
Quantity = RsRevitUtils.ConvertSquareFeetToSquareMetre(floorTotalArea)
|
||||
@@ -306,7 +387,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
var ceilings = new FilteredElementCollector(doc).OfClass(typeof(Ceiling)).Cast<Ceiling>();
|
||||
foreach (var ceiling in ceilings)
|
||||
{
|
||||
if (name.Contains(ceiling.Name))
|
||||
if (levenshtein(name, ceiling.Name) > similarity)
|
||||
{
|
||||
ceilingTotalArea += ceiling.get_Parameter(BuiltInParameter.HOST_AREA_COMPUTED).AsDouble();
|
||||
}
|
||||
@@ -315,7 +396,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
RootCategory = li[i].ElementAt(1),
|
||||
SubCategory = li[i].ElementAt(2),
|
||||
Name = li[i].ElementAt(3),
|
||||
ItemName = li[i].ElementAt(3),
|
||||
Description = li[i].ElementAt(4),
|
||||
Unit = li[i].ElementAt(5),
|
||||
Quantity = RsRevitUtils.ConvertSquareFeetToSquareMetre(ceilingTotalArea)
|
||||
@@ -325,10 +406,132 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
else if (revitType == "familyinstance")
|
||||
{
|
||||
var instances = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).Cast<FamilyInstance>();
|
||||
int count = 0;
|
||||
double length = 0.0;
|
||||
double area = 0.0;
|
||||
string unit = li[i].ElementAt(5);
|
||||
|
||||
if (true)
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
string familyName = instance.Symbol.FamilyName;
|
||||
if (levenshtein(familyName, li[i].ElementAt(3)) > similarity)
|
||||
{
|
||||
if (unit == "m")
|
||||
{
|
||||
if (familyName.Contains("接待台"))
|
||||
{
|
||||
length += RsRevitUtils.ConvertFeetToMetre(instance.Symbol.GetParameters("台面长度").FirstOrDefault().AsDouble());
|
||||
}
|
||||
if (familyName.Contains("腰封玻璃贴"))
|
||||
{
|
||||
var cur = RsRevitUtils.GetLocationCurveByElement(instance);
|
||||
length += RsRevitUtils.ConvertFeetToMetre(cur.Length);
|
||||
}
|
||||
if (familyName.Contains("亚克力水晶字"))
|
||||
{
|
||||
length += instance.GetParameters("文字").FirstOrDefault().AsString().Length * 116.4 / 1000;
|
||||
}
|
||||
if (familyName.Contains("精工背发光字"))
|
||||
{
|
||||
double l = Convert.ToDouble((instance.Symbol.Name.Substring(0, instance.Symbol.Name.IndexOf('m')))) / 1000;
|
||||
length += l;
|
||||
}
|
||||
if (familyName.Contains("立体发光字"))
|
||||
{
|
||||
double l = Convert.ToDouble((instance.Symbol.Name.Substring(0, instance.Symbol.Name.IndexOf('m')))) / 1000;
|
||||
length += l;
|
||||
}
|
||||
}
|
||||
else if (unit == "m2")
|
||||
{
|
||||
if (familyName.Contains("卷帘"))
|
||||
{
|
||||
var a = instance.Symbol.get_Parameter(BuiltInParameter.FAMILY_HEIGHT_PARAM).AsDouble() * instance.Symbol.get_Parameter(BuiltInParameter.FURNITURE_WIDTH).AsDouble();
|
||||
|
||||
area += RsRevitUtils.ConvertSquareFeetToSquareMetre(a);
|
||||
}
|
||||
}
|
||||
else if (unit == "套" || unit == "个")
|
||||
{
|
||||
if (familyName.Contains("仓储货架"))
|
||||
{
|
||||
if (li[i].ElementAt(3).Contains(instance.Symbol.GetParameters("长度").FirstOrDefault().AsValueString()))
|
||||
{
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
if (familyName.Contains("明装筒灯"))
|
||||
{
|
||||
if (li[i].ElementAt(3).Contains(instance.Symbol.Name))
|
||||
{
|
||||
count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
//var categoryValue = instance.Category.Id.IntegerValue;
|
||||
//if (categoryValue == -2001060 || categoryValue == -2008087 || categoryValue == -2001350)//插座、开关、专用设备
|
||||
//{
|
||||
// count += 1;
|
||||
//}
|
||||
//else if (categoryValue == -2001120)//照明设备
|
||||
//{
|
||||
// if (li[i].ElementAt(3).Contains(instance.Symbol.Name))
|
||||
// {
|
||||
// count += 1;
|
||||
// }
|
||||
//}
|
||||
//else if (categoryValue == -2000080 || categoryValue == -2001100)//家具、家具系统
|
||||
//{
|
||||
// if (li[i].ElementAt(5) == "m")
|
||||
// {
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// count += 1;
|
||||
// }
|
||||
//}
|
||||
//else if (categoryValue == -2000023 || categoryValue == -2000014)//门、窗
|
||||
//{
|
||||
// if (li[i].ElementAt(5) == "m2")
|
||||
// {
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// count += 1;
|
||||
// }
|
||||
//}
|
||||
};
|
||||
}
|
||||
SubItem item = new SubItem()
|
||||
{
|
||||
RootCategory = li[i].ElementAt(1),
|
||||
SubCategory = li[i].ElementAt(2),
|
||||
ItemName = li[i].ElementAt(3),
|
||||
Description = li[i].ElementAt(4),
|
||||
Unit = li[i].ElementAt(5),
|
||||
};
|
||||
switch (unit)
|
||||
{
|
||||
case "m":
|
||||
item.Quantity = length;
|
||||
break;
|
||||
|
||||
case "m2":
|
||||
item.Quantity = area;
|
||||
break;
|
||||
|
||||
case "个":
|
||||
item.Quantity = count;
|
||||
break;
|
||||
|
||||
case "套":
|
||||
item.Quantity = count;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
items.Add(item);
|
||||
}
|
||||
else if (revitType == "cabletray")
|
||||
{
|
||||
@@ -342,14 +545,45 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
RootCategory = li[i].ElementAt(1),
|
||||
SubCategory = li[i].ElementAt(2),
|
||||
Name = li[i].ElementAt(3),
|
||||
ItemName = li[i].ElementAt(3),
|
||||
Description = li[i].ElementAt(4),
|
||||
Unit = li[i].ElementAt(5),
|
||||
Quantity = RsRevitUtils.ConvertFeetToMetre(ctTotalLength)
|
||||
};
|
||||
items.Add(item);
|
||||
}
|
||||
else
|
||||
else if (revitType == "curtainsystem")
|
||||
{
|
||||
double area = 0.0;
|
||||
var curtainSystems = new FilteredElementCollector(doc).OfClass(typeof(CurtainSystem)).OfCategory(BuiltInCategory.OST_CurtaSystem).Cast<CurtainSystem>();
|
||||
foreach (var curtainSystem in curtainSystems)
|
||||
{
|
||||
if (levenshtein(name, curtainSystem.Name) > similarity)
|
||||
{
|
||||
var geometryElement = curtainSystem.get_Geometry(new Options());
|
||||
foreach (GeometryObject geomObj in geometryElement)
|
||||
{
|
||||
var solid = geomObj as Solid;
|
||||
if (solid != null)
|
||||
{
|
||||
area += solid.SurfaceArea / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SubItem item = new SubItem()
|
||||
{
|
||||
RootCategory = li[i].ElementAt(1),
|
||||
SubCategory = li[i].ElementAt(2),
|
||||
ItemName = li[i].ElementAt(3),
|
||||
Description = li[i].ElementAt(4),
|
||||
Unit = li[i].ElementAt(5),
|
||||
Quantity = RsRevitUtils.ConvertSquareFeetToSquareMetre(area)
|
||||
};
|
||||
items.Add(item);
|
||||
}
|
||||
else//无法统计的量,采用总场地面积计
|
||||
{
|
||||
double otherArea = 0.0;
|
||||
var rooms = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).Cast<Room>();
|
||||
@@ -362,7 +596,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
RootCategory = li[i].ElementAt(1),
|
||||
SubCategory = li[i].ElementAt(2),
|
||||
Name = li[i].ElementAt(3),
|
||||
ItemName = li[i].ElementAt(3),
|
||||
Description = li[i].ElementAt(4),
|
||||
Unit = li[i].ElementAt(5),
|
||||
Quantity = RsRevitUtils.ConvertSquareFeetToSquareMetre(otherArea)
|
||||
@@ -374,6 +608,53 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
return items;
|
||||
}
|
||||
|
||||
public static float levenshtein(String str1, String str2)
|
||||
{
|
||||
int len1 = str1.Length;
|
||||
int len2 = str2.Length;
|
||||
int[,] dif = new int[len1 + 1, len2 + 1];
|
||||
for (int a = 0; a <= len1; a++)
|
||||
{
|
||||
dif[a, 0] = a;
|
||||
}
|
||||
for (int a = 0; a <= len2; a++)
|
||||
{
|
||||
dif[0, a] = a;
|
||||
}
|
||||
int temp;
|
||||
for (int i = 1; i <= len1; i++)
|
||||
{
|
||||
for (int j = 1; j <= len2; j++)
|
||||
{
|
||||
if (str1.ElementAt(i - 1) == str2.ElementAt(j - 1))
|
||||
{
|
||||
temp = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = 1;
|
||||
}
|
||||
dif[i, j] = min(dif[i - 1, j - 1] + temp, dif[i, j - 1] + 1,
|
||||
dif[i - 1, j] + 1);
|
||||
}
|
||||
}
|
||||
float similarity = 1 - (float)dif[len1, len2] / Math.Max(len1, len2);
|
||||
return similarity;
|
||||
}
|
||||
|
||||
private static int min(params int[] arr)
|
||||
{
|
||||
int min = int.MaxValue;
|
||||
foreach (int i in arr)
|
||||
{
|
||||
if (min > i)
|
||||
{
|
||||
min = i;
|
||||
}
|
||||
}
|
||||
return min;
|
||||
}
|
||||
|
||||
private static ExcelWorksheet CreateTableHeader(Document doc, ExcelPackage package)
|
||||
{
|
||||
var rooms = new FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_Rooms).Cast<Room>();
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
using Autodesk.Revit.DB;
|
||||
using Autodesk.Revit.UI;
|
||||
using Autodesk.Revit.UI.Selection;
|
||||
using OfficeOpenXml;
|
||||
using OfficeOpenXml.Style;
|
||||
using RookieStation.ProjectConfig;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
[Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
|
||||
[Autodesk.Revit.Attributes.Regeneration(Autodesk.Revit.Attributes.RegenerationOption.Manual)]
|
||||
internal class CmdExportOrderQuantity : 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 shelves = new FilteredElementCollector(doc).OfClass(typeof(FamilyInstance)).Cast<FamilyInstance>().Where(n => n.Symbol.FamilyName.EndsWith("货架"));
|
||||
var totalLength = 0.0;
|
||||
SaveFileDialog sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Excel文件|*.xlsx",
|
||||
FileName = "单量增长预测"
|
||||
};
|
||||
string destinationFileName = string.Empty;
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
destinationFileName = sfd.FileName;
|
||||
}
|
||||
if (destinationFileName == string.Empty)
|
||||
{
|
||||
return Result.Cancelled;
|
||||
}
|
||||
foreach (var instance in shelves)
|
||||
{
|
||||
totalLength += Math.Round(instance.Symbol.GetParameters("长度").FirstOrDefault().AsDouble() * 304.8 / 1000);
|
||||
}
|
||||
using (ExcelPackage package = new ExcelPackage())
|
||||
{
|
||||
ExcelWorksheet sheet = package.Workbook.Worksheets.Add("单量预测");
|
||||
//sheet.Cells["A1:F1"].Merge = true;
|
||||
sheet.Cells[1, 1].Value = "第一年";
|
||||
sheet.Cells[1, 2].Value = "第二年";
|
||||
sheet.Cells[1, 3].Value = "第三年";
|
||||
sheet.Cells[1, 4].Value = "第四年";
|
||||
sheet.Cells[1, 5].Value = "第五年";
|
||||
sheet.Cells[1, 6].Value = "最大承载单量";
|
||||
|
||||
sheet.Cells[2, 1].Value = UserConstant.Orders;
|
||||
sheet.Cells[2, 2].Value = Math.Ceiling(UserConstant.Orders * Math.Pow(1.15, 2));
|
||||
sheet.Cells[2, 3].Value = Math.Ceiling(UserConstant.Orders * Math.Pow(1.15, 3));
|
||||
sheet.Cells[2, 4].Value = Math.Ceiling(UserConstant.Orders * Math.Pow(1.15, 4));
|
||||
sheet.Cells[2, 5].Value = Math.Ceiling(UserConstant.Orders * Math.Pow(1.15, 5));
|
||||
sheet.Cells[2, 6].Value = totalLength * 80;
|
||||
|
||||
using (var range = sheet.Cells[1, 1, 2, 6])
|
||||
{
|
||||
range.Style.Font.Name = "宋体";
|
||||
range.Style.HorizontalAlignment = ExcelHorizontalAlignment.Center;
|
||||
range.Style.Font.Size = 10;
|
||||
range.Style.Border.BorderAround(ExcelBorderStyle.Thin);
|
||||
range.AutoFitColumns();
|
||||
}
|
||||
using (Stream stream = new FileStream(destinationFileName, FileMode.Create))
|
||||
{
|
||||
package.SaveAs(stream);
|
||||
}
|
||||
}
|
||||
System.Diagnostics.Process.Start(destinationFileName);
|
||||
|
||||
return Result.Succeeded;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
trashCanCount += 2;
|
||||
}
|
||||
}
|
||||
else if (furn.Symbol.FamilyName.Contains("货架"))
|
||||
else if (furn.Symbol.FamilyName.Contains("仓储货架"))
|
||||
{
|
||||
shelfCount += 1;
|
||||
}
|
||||
@@ -277,7 +277,7 @@ namespace RookieStation.Statistics.ExecuteCmds
|
||||
{
|
||||
cainiaoDutyCount += 1;
|
||||
}
|
||||
else if (furnsys.Symbol.FamilyName.Contains("防撞条"))
|
||||
else if (furnsys.Symbol.FamilyName.Contains("腰封玻璃贴"))
|
||||
{
|
||||
containmentLength += furnsys.get_Parameter(BuiltInParameter.FAMILY_LINE_LENGTH_PARAM).AsDouble();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace RookieStation.Statistics.Models
|
||||
/// <summary>
|
||||
/// 分项
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
public string ItemName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 项目特征
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace RookieStation.ProjectConfig
|
||||
private static string AddinPath = typeof(RsApp).Assembly.Location;
|
||||
|
||||
public static string AddinDirectory => System.IO.Path.GetDirectoryName(AddinPath);
|
||||
#if DEBUG
|
||||
#if (DEBUG)
|
||||
|
||||
//调试路径
|
||||
internal static string FamilyLibraryDirectory => AddinDirectory + "\\RsLibrary\\FamilyLibrary\\";
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace RookieStation.Utils
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <returns></returns>
|
||||
public static T GenerateWindow<T>() where T : System.Windows.Window, new()
|
||||
public static T ShowDialog<T>() where T : System.Windows.Window, new()
|
||||
{
|
||||
string AddInPath = typeof(RsApp).Assembly.Location;
|
||||
string dirAssembly = System.IO.Path.GetDirectoryName(AddInPath);
|
||||
|
||||
@@ -187,7 +187,7 @@ namespace RookieStation.Utils
|
||||
FamilySymbol lineSymbol = null;
|
||||
doc.Invoke(ts =>
|
||||
{
|
||||
Family lineFamily = GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "定位线.rfa");
|
||||
Family lineFamily = GetLoadedFamily(doc, UserConstant.FamilyLibraryDirectory + "其他\\定位线.rfa");
|
||||
if (lineFamily != null)
|
||||
{
|
||||
lineSymbol = doc.GetElement(lineFamily.GetFamilySymbolIds().FirstOrDefault()) as FamilySymbol;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user