修复bug,更新族

This commit is contained in:
GG Z
2021-09-09 12:39:12 +08:00
parent ed4a8eaa34
commit 6a7254b9dd
65 changed files with 552 additions and 288 deletions

View File

@@ -51,7 +51,7 @@ namespace RookieStation.Drawing.ExecuteCmds
{
RsRevitUtils.SetLegendLocation(doc, legend);
});
});
}, "创建货架图例");
}
catch (Autodesk.Revit.Exceptions.OperationCanceledException)
{
@@ -79,7 +79,7 @@ namespace RookieStation.Drawing.ExecuteCmds
foreach (var group in shelfGroup)
{
var instance = group.ElementAt(0);
var l = Math.Round(instance.Symbol.GetParameters("长度").FirstOrDefault().AsDouble() * 304.8 / 1000);
var l = instance.Symbol.GetParameters("长度").FirstOrDefault().AsValueString();
ShelfStatistic shelfStatistic = new ShelfStatistic
{
@@ -88,8 +88,8 @@ namespace RookieStation.Drawing.ExecuteCmds
GroundArea = Math.Round(area, 2),
DesignOrders = UserConstant.Orders
};
shelfStatistic.LinearMetre = shelfStatistic.Count * l;
shelfStatistic.CapacityOrders = (int)shelfStatistic.LinearMetre * 80;
shelfStatistic.LinearMetre = shelfStatistic.Count * Convert.ToDouble(l) / 1000;
shelfStatistic.CapacityOrders = Convert.ToInt32(shelfStatistic.LinearMetre * 80);
statistics.Add(shelfStatistic);
}
return statistics;
@@ -105,6 +105,12 @@ namespace RookieStation.Drawing.ExecuteCmds
private void CreateShelfLegend(Document doc, List<ShelfStatistic> statistics, View newLegend, int viewScale)
{
TextNoteType textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Where(x => x.Name.Contains(UserConstant.FontName)).FirstOrDefault() as TextNoteType;
if (textNoteType == null)
{
textNoteType = new FilteredElementCollector(doc).OfClass(typeof(TextNoteType)).Cast<TextNoteType>().FirstOrDefault().Duplicate(UserConstant.FontName) as TextNoteType;
textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE).SetValueString("2.5");
textNoteType.get_Parameter(BuiltInParameter.TEXT_WIDTH_SCALE).SetValueString("0.8");
}
double fontSize = textNoteType.get_Parameter(BuiltInParameter.TEXT_SIZE).AsDouble();
double actualTextHeight = fontSize * 1.6;
double tableGridHeight = actualTextHeight * viewScale * 1.2;//图例网格高度
@@ -152,13 +158,21 @@ namespace RookieStation.Drawing.ExecuteCmds
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);
//承载单量总和
int orders = 0;
for (int i = 0; i < statistics.Count; i++)
{
orders += statistics[i].CapacityOrders;
}
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 3.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, orders.ToString(), opts);
//设计单量
TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 4.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, statistics.FirstOrDefault().DesignOrders.ToString(), opts);
//面积
TextNote area = TextNote.Create(doc, newLegend.Id, XYZ.BasisX * (tableGridWidth * 5.5) + XYZ.BasisY * tableGridHeight * statistics.Count() / 2, statistics[0].GroundArea + "m2".ToString(), opts);
FormattedText formattedText = new FormattedText(area.Text);
TextRange range = new TextRange(area.Text.Length - 2, 1);
formattedText.SetSuperscriptStatus(range, true);
tn.SetFormattedText(formattedText);
area.SetFormattedText(formattedText);
var curves = doc.Create.NewDetailCurveArray(newLegend, curveArray);
}
}